@cleartrip/ct-platform-pill-carousel 1.0.0-beta.29 → 1.0.0-beta.30

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,2 +1,2 @@
1
- "use strict";var e=require("tslib"),l=require("react/jsx-runtime"),i=require("react"),t=require("swiper"),n=require("swiper/react"),r=require("classnames"),s=require("@cleartrip/ct-design-typography");function a(e){return e&&e.__esModule?e:{default:e}}var o=a(t),d=a(r);function p(e,l){void 0===l&&(l={});var i=l.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var c="index-module_swiper__r5-8U";p(".index-module_swiper__r5-8U{height:100%;width:100%}");var u,_={"pill-story-container":"index-module_pill-story-container__QnH4k","pill-chip-container":"index-module_pill-chip-container__-CDkA","pill-chip-image":"index-module_pill-chip-image__FGQ6V","pill-story-image":"index-module_pill-story-image__7VUfq"};p(".index-module_pill-story-container__QnH4k{align-items:center;display:flex;flex-direction:column;justify-content:space-evenly}.index-module_pill-chip-container__-CDkA{align-items:center;background-color:#fff;border:1.5px solid #e6e6e6;border-radius:16px;display:flex;gap:8px;height:32px;padding:0 8px;width:auto}.index-module_pill-chip-image__FGQ6V{max-height:20px;max-width:20px}.index-module_pill-story-image__7VUfq{border-radius:30px;padding:5px}"),exports.PillType=void 0,(u=exports.PillType||(exports.PillType={})).CHIPS="CHIPS",u.STORY="STORY";var x,m=function(t){var n=t.pillData,r=t.pillType,a=t.pillClickHandler,o=t.isSelected,p=t.selectedPillStyles,c=t.textClass,u=t.imageClass,x=t.pillContainerClass,m=t.pillContainerStyles,g=t.textStyles,y=t.imageStyles,f=t.renderCustomLabel,C=t.renderCustomImage,h=e.__assign({border:"1.5px solid #1A1A1A",backgroundColor:"#F3F3F3"},p),S=i.useCallback((function(){return f?f(n):n.text?l.jsx(s.Typography,e.__assign({variant:s.TypographyVariant.B2,className:d.default(c,_["pill-text"]),style:g},{children:n.text})):l.jsx(l.Fragment,{})}),[]),v=i.useCallback((function(){return l.jsx(l.Fragment,{children:C?C(n):n.imageUrl&&l.jsx("img",{src:n.imageUrl,className:d.default(u,_[r===exports.PillType.STORY?"pill-story-container":"pill-chip-image"]),style:y})})}),[]);return r===exports.PillType.STORY?l.jsxs("div",e.__assign({className:d.default(x,_["pill-story-container"]),style:o?e.__assign(e.__assign({},m),h):m,onClick:a},{children:[v(),S()]})):l.jsxs("div",e.__assign({className:d.default(x,_["pill-chip-container"]),style:o?e.__assign(e.__assign({},m),h):m,onClick:a},{children:[v(),S()]}))};exports.CarouselType=void 0,(x=exports.CarouselType||(exports.CarouselType={})).PILL_CHIP="PILL_CHIP",x.PILL_STORY="PILL_STORY",o.default.use([t.Autoplay,t.Pagination]);exports.PillCarousel=function(t){var r,s,a,o,d=t.carouselData,p=t.carouselType,u=t.onItemClick,_=t.styleConfig,x=t.carouselConfig,g=t.renderCustomPillImage,y=t.defaultSelectedPillIndex,f=i.useState(null!=y?y:0),C=f[0],h=f[1],S=i.useCallback((function(e,l,i){h(i),e(l,i)}),[]),v=i.useCallback((function(){return l.jsxs(l.Fragment,{children:[d.map((function(i,t){var r=e.__assign({pillType:p&&p===exports.CarouselType.PILL_STORY?exports.PillType.STORY:exports.PillType.CHIPS,pillData:i,isSelected:t==C,renderCustomImage:g,pillClickHandler:function(){S(u,i,t)}},null==_?void 0:_.pillStyleConfig);return l.jsx(n.SwiperSlide,e.__assign({style:{minWidth:"fit-content"}},{children:l.jsx(m,e.__assign({},r))}),"slide-".concat(t))}))," "]})}),[C,d]),T={freeMode:null===(r=null==x?void 0:x.isFreeSwipe)||void 0===r||r,slidesPerView:null!==(s=null==x?void 0:x.pillsPerView)&&void 0!==s?s:3.5,spaceBetween:null!==(a=null==x?void 0:x.spaceBetweenPills)&&void 0!==a?a:12,loop:null!==(o=null==x?void 0:x.isInfiniteScroll)&&void 0!==o&&o};return l.jsx(l.Fragment,{children:l.jsx(n.Swiper,e.__assign({initialSlide:C,autoplay:!1,pagination:!1,className:c,style:null==_?void 0:_.carouselStyleConfig},T,{children:v()}))})};
1
+ "use strict";var e=require("tslib"),l=require("react/jsx-runtime"),i=require("react"),t=require("swiper"),n=require("swiper/react"),r=require("classnames"),s=require("@cleartrip/ct-design-typography");function a(e){return e&&e.__esModule?e:{default:e}}var o=a(t),d=a(r);function p(e,l){void 0===l&&(l={});var i=l.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var c="index-module_swiper__r5-8U";p(".index-module_swiper__r5-8U{height:100%;width:100%}");var u,_={"pill-story-container":"index-module_pill-story-container__QnH4k","pill-chip-container":"index-module_pill-chip-container__-CDkA","pill-chip-image":"index-module_pill-chip-image__FGQ6V","pill-story-image":"index-module_pill-story-image__7VUfq"};p(".index-module_pill-story-container__QnH4k{align-items:center;display:flex;flex-direction:column;justify-content:space-evenly}.index-module_pill-chip-container__-CDkA{align-items:center;background-color:#fff;border:1.5px solid #e6e6e6;border-radius:16px;display:flex;gap:6px;height:32px;padding:0 8px;width:auto}.index-module_pill-chip-image__FGQ6V{max-height:20px;max-width:20px}.index-module_pill-story-image__7VUfq{border-radius:30px;padding:5px}"),exports.PillType=void 0,(u=exports.PillType||(exports.PillType={})).CHIPS="CHIPS",u.STORY="STORY";var x,m=function(t){var n=t.pillData,r=t.pillType,a=t.pillClickHandler,o=t.isSelected,p=t.selectedPillStyles,c=t.textClass,u=t.imageClass,x=t.pillContainerClass,m=t.pillContainerStyles,g=t.textStyles,y=t.imageStyles,f=t.renderCustomLabel,C=t.renderCustomImage,h=e.__assign({border:"1.5px solid #1A1A1A",backgroundColor:"#F3F3F3"},p),S=i.useCallback((function(){return f?f(n):n.text?l.jsx(s.Typography,e.__assign({variant:s.TypographyVariant.B2,className:d.default(c,_["pill-text"]),style:g},{children:n.text})):l.jsx(l.Fragment,{})}),[]),v=i.useCallback((function(){return l.jsx(l.Fragment,{children:C?C(n):n.imageUrl&&l.jsx("img",{src:n.imageUrl,className:d.default(u,_[r===exports.PillType.STORY?"pill-story-container":"pill-chip-image"]),style:y})})}),[]);return r===exports.PillType.STORY?l.jsxs("div",e.__assign({className:d.default(x,_["pill-story-container"]),style:o?e.__assign(e.__assign({},m),h):m,onClick:a},{children:[v(),S()]})):l.jsxs("div",e.__assign({className:d.default(x,_["pill-chip-container"]),style:o?e.__assign(e.__assign({},m),h):m,onClick:a},{children:[v(),S()]}))};exports.CarouselType=void 0,(x=exports.CarouselType||(exports.CarouselType={})).PILL_CHIP="PILL_CHIP",x.PILL_STORY="PILL_STORY",o.default.use([t.Autoplay,t.Pagination]);exports.PillCarousel=function(t){var r,s,a,o,d=t.carouselData,p=t.carouselType,u=t.onItemClick,_=t.styleConfig,x=t.carouselConfig,g=t.renderCustomPillImage,y=t.defaultSelectedPillIndex,f=i.useState(null!=y?y:0),C=f[0],h=f[1],S=i.useCallback((function(e,l,i){h(i),e(l,i)}),[]),v=i.useCallback((function(){return l.jsxs(l.Fragment,{children:[d.map((function(i,t){var r=e.__assign({pillType:p&&p===exports.CarouselType.PILL_STORY?exports.PillType.STORY:exports.PillType.CHIPS,pillData:i,isSelected:t==C,renderCustomImage:g,pillClickHandler:function(){S(u,i,t)}},null==_?void 0:_.pillStyleConfig);return l.jsx(n.SwiperSlide,e.__assign({style:{minWidth:"fit-content"}},{children:l.jsx(m,e.__assign({},r))}),"slide-".concat(t))}))," "]})}),[C,d]),T={freeMode:null===(r=null==x?void 0:x.isFreeSwipe)||void 0===r||r,slidesPerView:null!==(s=null==x?void 0:x.pillsPerView)&&void 0!==s?s:3.5,spaceBetween:null!==(a=null==x?void 0:x.spaceBetweenPills)&&void 0!==a?a:12,loop:null!==(o=null==x?void 0:x.isInfiniteScroll)&&void 0!==o&&o};return l.jsx(l.Fragment,{children:l.jsx(n.Swiper,e.__assign({initialSlide:C,autoplay:!1,pagination:!1,className:c,style:null==_?void 0:_.carouselStyleConfig},T,{children:v()}))})};
2
2
  //# sourceMappingURL=ct-platform-pill-carousel.cjs.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as i,Fragment as l,jsxs as t}from"react/jsx-runtime";import{useCallback as n,useState as r}from"react";import o,{Autoplay as a,Pagination as d}from"swiper";import{SwiperSlide as s,Swiper as c}from"swiper/react";import p from"classnames";import{Typography as m,TypographyVariant as u}from"@cleartrip/ct-design-typography";function f(e,i){void 0===i&&(i={});var l=i.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===l&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var y="index-module_swiper__r5-8U";f(".index-module_swiper__r5-8U{height:100%;width:100%}");var x,h={"pill-story-container":"index-module_pill-story-container__QnH4k","pill-chip-container":"index-module_pill-chip-container__-CDkA","pill-chip-image":"index-module_pill-chip-image__FGQ6V","pill-story-image":"index-module_pill-story-image__7VUfq"};f(".index-module_pill-story-container__QnH4k{align-items:center;display:flex;flex-direction:column;justify-content:space-evenly}.index-module_pill-chip-container__-CDkA{align-items:center;background-color:#fff;border:1.5px solid #e6e6e6;border-radius:16px;display:flex;gap:8px;height:32px;padding:0 8px;width:auto}.index-module_pill-chip-image__FGQ6V{max-height:20px;max-width:20px}.index-module_pill-story-image__7VUfq{border-radius:30px;padding:5px}"),function(e){e.CHIPS="CHIPS",e.STORY="STORY"}(x||(x={}));var _,g=function(r){var o=r.pillData,a=r.pillType,d=r.pillClickHandler,s=r.isSelected,c=r.selectedPillStyles,f=r.textClass,y=r.imageClass,_=r.pillContainerClass,g=r.pillContainerStyles,C=r.textStyles,S=r.imageStyles,v=r.renderCustomLabel,I=r.renderCustomImage,P=e({border:"1.5px solid #1A1A1A",backgroundColor:"#F3F3F3"},c),T=n((function(){return v?v(o):o.text?i(m,e({variant:u.B2,className:p(f,h["pill-text"]),style:C},{children:o.text})):i(l,{})}),[]),w=n((function(){return i(l,{children:I?I(o):o.imageUrl&&i("img",{src:o.imageUrl,className:p(y,h[a===x.STORY?"pill-story-container":"pill-chip-image"]),style:S})})}),[]);return a===x.STORY?t("div",e({className:p(_,h["pill-story-container"]),style:s?e(e({},g),P):g,onClick:d},{children:[w(),T()]})):t("div",e({className:p(_,h["pill-chip-container"]),style:s?e(e({},g),P):g,onClick:d},{children:[w(),T()]}))};!function(e){e.PILL_CHIP="PILL_CHIP",e.PILL_STORY="PILL_STORY"}(_||(_={})),o.use([a,d]);var C=function(o){var a,d,p,m,u=o.carouselData,f=o.carouselType,h=o.onItemClick,C=o.styleConfig,S=o.carouselConfig,v=o.renderCustomPillImage,I=o.defaultSelectedPillIndex,P=r(null!=I?I:0),T=P[0],w=P[1],k=n((function(e,i,l){w(l),e(i,l)}),[]),L=n((function(){return t(l,{children:[u.map((function(l,t){var n=e({pillType:f&&f===_.PILL_STORY?x.STORY:x.CHIPS,pillData:l,isSelected:t==T,renderCustomImage:v,pillClickHandler:function(){k(h,l,t)}},null==C?void 0:C.pillStyleConfig);return i(s,e({style:{minWidth:"fit-content"}},{children:i(g,e({},n))}),"slide-".concat(t))}))," "]})}),[T,u]),H={freeMode:null===(a=null==S?void 0:S.isFreeSwipe)||void 0===a||a,slidesPerView:null!==(d=null==S?void 0:S.pillsPerView)&&void 0!==d?d:3.5,spaceBetween:null!==(p=null==S?void 0:S.spaceBetweenPills)&&void 0!==p?p:12,loop:null!==(m=null==S?void 0:S.isInfiniteScroll)&&void 0!==m&&m};return i(l,{children:i(c,e({initialSlide:T,autoplay:!1,pagination:!1,className:y,style:null==C?void 0:C.carouselStyleConfig},H,{children:L()}))})};export{_ as CarouselType,C as PillCarousel,x as PillType};
1
+ import{__assign as e}from"tslib";import{jsx as i,Fragment as l,jsxs as t}from"react/jsx-runtime";import{useCallback as n,useState as r}from"react";import o,{Autoplay as a,Pagination as d}from"swiper";import{SwiperSlide as s,Swiper as c}from"swiper/react";import p from"classnames";import{Typography as m,TypographyVariant as u}from"@cleartrip/ct-design-typography";function f(e,i){void 0===i&&(i={});var l=i.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===l&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var y="index-module_swiper__r5-8U";f(".index-module_swiper__r5-8U{height:100%;width:100%}");var x,h={"pill-story-container":"index-module_pill-story-container__QnH4k","pill-chip-container":"index-module_pill-chip-container__-CDkA","pill-chip-image":"index-module_pill-chip-image__FGQ6V","pill-story-image":"index-module_pill-story-image__7VUfq"};f(".index-module_pill-story-container__QnH4k{align-items:center;display:flex;flex-direction:column;justify-content:space-evenly}.index-module_pill-chip-container__-CDkA{align-items:center;background-color:#fff;border:1.5px solid #e6e6e6;border-radius:16px;display:flex;gap:6px;height:32px;padding:0 8px;width:auto}.index-module_pill-chip-image__FGQ6V{max-height:20px;max-width:20px}.index-module_pill-story-image__7VUfq{border-radius:30px;padding:5px}"),function(e){e.CHIPS="CHIPS",e.STORY="STORY"}(x||(x={}));var _,g=function(r){var o=r.pillData,a=r.pillType,d=r.pillClickHandler,s=r.isSelected,c=r.selectedPillStyles,f=r.textClass,y=r.imageClass,_=r.pillContainerClass,g=r.pillContainerStyles,C=r.textStyles,S=r.imageStyles,v=r.renderCustomLabel,I=r.renderCustomImage,P=e({border:"1.5px solid #1A1A1A",backgroundColor:"#F3F3F3"},c),T=n((function(){return v?v(o):o.text?i(m,e({variant:u.B2,className:p(f,h["pill-text"]),style:C},{children:o.text})):i(l,{})}),[]),w=n((function(){return i(l,{children:I?I(o):o.imageUrl&&i("img",{src:o.imageUrl,className:p(y,h[a===x.STORY?"pill-story-container":"pill-chip-image"]),style:S})})}),[]);return a===x.STORY?t("div",e({className:p(_,h["pill-story-container"]),style:s?e(e({},g),P):g,onClick:d},{children:[w(),T()]})):t("div",e({className:p(_,h["pill-chip-container"]),style:s?e(e({},g),P):g,onClick:d},{children:[w(),T()]}))};!function(e){e.PILL_CHIP="PILL_CHIP",e.PILL_STORY="PILL_STORY"}(_||(_={})),o.use([a,d]);var C=function(o){var a,d,p,m,u=o.carouselData,f=o.carouselType,h=o.onItemClick,C=o.styleConfig,S=o.carouselConfig,v=o.renderCustomPillImage,I=o.defaultSelectedPillIndex,P=r(null!=I?I:0),T=P[0],w=P[1],k=n((function(e,i,l){w(l),e(i,l)}),[]),L=n((function(){return t(l,{children:[u.map((function(l,t){var n=e({pillType:f&&f===_.PILL_STORY?x.STORY:x.CHIPS,pillData:l,isSelected:t==T,renderCustomImage:v,pillClickHandler:function(){k(h,l,t)}},null==C?void 0:C.pillStyleConfig);return i(s,e({style:{minWidth:"fit-content"}},{children:i(g,e({},n))}),"slide-".concat(t))}))," "]})}),[T,u]),H={freeMode:null===(a=null==S?void 0:S.isFreeSwipe)||void 0===a||a,slidesPerView:null!==(d=null==S?void 0:S.pillsPerView)&&void 0!==d?d:3.5,spaceBetween:null!==(p=null==S?void 0:S.spaceBetweenPills)&&void 0!==p?p:12,loop:null!==(m=null==S?void 0:S.isInfiniteScroll)&&void 0!==m&&m};return i(l,{children:i(c,e({initialSlide:T,autoplay:!1,pagination:!1,className:y,style:null==C?void 0:C.carouselStyleConfig},H,{children:L()}))})};export{_ as CarouselType,C as PillCarousel,x as PillType};
2
2
  //# sourceMappingURL=ct-platform-pill-carousel.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleartrip/ct-platform-pill-carousel",
3
- "version": "1.0.0-beta.29",
3
+ "version": "1.0.0-beta.30",
4
4
  "description": "PillCarousel Component",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/ct-platform-pill-carousel.cjs.js",
@@ -13,7 +13,7 @@
13
13
  "@cleartrip/ct-design-typography": "2.6.0",
14
14
  "classnames": "^2.5.1",
15
15
  "swiper": "6.8.4",
16
- "@cleartrip/ct-platform-assets": "3.0.0-beta.28"
16
+ "@cleartrip/ct-platform-assets": "3.0.0-beta.29"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",