@plasmicpkgs/react-slick 0.0.183 → 0.0.185
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.
- package/dist/index.d.ts +20 -6
- package/dist/react-slick.cjs.development.js +252 -58
- package/dist/react-slick.cjs.development.js.map +1 -1
- package/dist/react-slick.cjs.production.min.js +1 -1
- package/dist/react-slick.cjs.production.min.js.map +1 -1
- package/dist/react-slick.esm.js +253 -61
- package/dist/react-slick.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),i=e(require("@seznam/compose-react-refs")),n=require("antd"),a=require("react"),l=e(a),o=e(require("react-slick")),d=["editingSlide","setControlContextData"],s=n.Select.Option,r={name:"hostless-slider",displayName:"Slider Carousel",importName:"Slider",importPath:"react-slick",description:"[See tutorial video](https://www.youtube.com/watch?v=GMgXLbNHX8c)",actions:[{type:"custom-action",control:function(e){var t,i,a=e.componentProps,o=e.studioOps,d=null!=(t=a.editingSlide)?t:0,r=null!=(i=a.children.length)?i:"img"===a.children.type?1:0,p=Array.from({length:r},(function(e,t){return t})).map((function(e){return l.createElement(s,{value:e.toString()},"Slide ",e+1)}));return l.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},l.createElement("div",null,"Current slide:"),l.createElement(n.Select,{defaultValue:d.toString(),style:{width:"100%"},onChange:function(e){var t=Number(e);o.updateProps({editingSlide:t%r})},value:d.toString()},p))}},{type:"custom-action",control:function(e){var t,i=e.componentProps,a=e.studioOps,o=i.children.length,d=null!=(t=i.editingSlide)?t:0;return l.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},l.createElement(n.Button,{style:{width:"100%"},onClick:function(){a.updateProps({editingSlide:(d-1+o)%o})}},"Prev slide"),l.createElement(n.Button,{style:{width:"100%"},onClick:function(){a.updateProps({editingSlide:(d+1)%o})}},"Next slide"))}},{type:"button-action",label:"Append new slide",onClick:function(e){var t=e.studioOps,i=e.componentProps.children.length;t.appendToSlot({type:"img",src:"",styles:{maxWidth:"100%"}},"children"),t.updateProps({editingSlide:i})}},{type:"button-action",label:"Delete current slide",onClick:function(e){var t,i=e.componentProps,n=e.studioOps,a=null!=(t=e.contextData.editingSlide)?t:0;n.removeFromSlotAt(a,"children");var l=i.children.length-1;n.updateProps({editingSlide:(a-1+l)%l})}},{type:"custom-action",control:function(){return l.createElement("div",null,"* To re-arrange slides, use the Outline panel")}}],props:{children:{type:"slot",defaultValue:[0,1,2].map((function(e){return{type:"vbox",children:{type:"img",src:"https://static1.plasmic.app/components/react-slick/slide"+(e+1)+".png",styles:{maxWidth:"100%"}}}}))},editingSlide:{displayName:"Currently edited slide",type:"number",description:"Switch to the specified slide (first is 0). Only affects the editor, not the final page.",defaultValueHint:0,editOnly:!0,hidden:function(){return!0}},accessibility:{advanced:!0,displayName:"Accessibility",type:"boolean",description:"Enables tabbing and arrow key navigation",defaultValueHint:!0},adaptiveHeight:{advanced:!0,displayName:"Adaptive Height",type:"boolean",description:"Adjust the slide's height automatically",defaultValueHint:!1},arrows:{displayName:"Arrows",type:"boolean",description:"Show next/prev arrows",defaultValueHint:!0},autoplay:{displayName:"Auto Play",type:"boolean",description:"Automatically start scrolling",defaultValueHint:!1},autoplaySpeed:{displayName:"Auto Play Speed",type:"number",description:"Delay between each auto scroll, in milliseconds",defaultValueHint:3e3,hidden:function(e){return!e.autoplay}},centerMode:{displayName:"Center Mode",type:"boolean",description:"Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts",defaultValueHint:!1},centerPadding:{displayName:"Center Padding",type:"string",description:"Side padding when in center mode (px or %)",defaultValueHint:"50px",hidden:function(e){return!e.centerMode}},dots:{displayName:"Dots",type:"boolean",description:"Show dots for each slide",defaultValueHint:!1},draggable:{advanced:!0,displayName:"Draggable",type:"boolean",description:"Enables mouse dragging on desktop",defaultValueHint:!0},cssEase:{advanced:!0,displayName:"Easing",type:"string",description:"Easing method for transition",defaultValueHint:"linear"},easing:{hidden:function(){return!0},advanced:!0,displayName:"Easing",type:"string",description:"Easing method for transition",defaultValueHint:"linear"},fade:{advanced:!0,displayName:"Fade",type:"boolean",description:"Cross-fade between slides",defaultValueHint:!1},focusOnSelect:{advanced:!0,displayName:"Focus On Select",type:"boolean",description:"Go to slide on click",defaultValueHint:!1},infinite:{displayName:"Infinite",type:"boolean",description:"Infinitely wrap around contents",defaultValueHint:!0},initialSlide:{displayName:"Initial Slide",type:"number",description:"Index of initial slide (first is 0)",defaultValueHint:0},lazyLoad:{advanced:!0,displayName:"Lazy Load",type:"choice",options:["ondemand","progressive"],description:"Load images or render components on demand or progressively"},pauseOnDotsHover:{displayName:"Pause On Dots Hover",type:"boolean",description:"Prevents autoplay while hovering on dots",defaultValueHint:!1},pauseOnFocus:{displayName:"Pause On Focus",type:"boolean",description:"Prevents autoplay while focused on slides",defaultValueHint:!1},pauseOnHover:{displayName:"Pause On Hover",type:"boolean",description:"Prevents autoplay while hovering on track",defaultValueHint:!0},rows:{displayName:"Rows",type:"number",description:"Number of rows per slide (enables grid mode)",defaultValueHint:1},rtl:{advanced:!0,displayName:"Reverse",type:"boolean",description:"Reverses the slide order",defaultValueHint:!1},slidesPerRow:{displayName:"Slides Per Row",type:"number",description:"Number of slides to display in grid mode, this is useful with rows option",defaultValueHint:1},slidesToScroll:{advanced:!0,displayName:"Slides To Scroll",type:"number",description:"Number of slides to scroll at once",defaultValueHint:1},slidesToShow:{advanced:!0,displayName:"Slides To Show",type:"number",description:"Number of slides to show in one frame",defaultValueHint:1},speed:{advanced:!0,displayName:"Speed",type:"number",description:"Transition speed in milliseconds",defaultValueHint:500},swipe:{advanced:!0,displayName:"Swipe",type:"boolean",description:"Enable swiping to change slides",defaultValueHint:!0},swipeToSlide:{advanced:!0,displayName:"Swipe To Slide",type:"boolean",description:"Enable drag/swipe irrespective of 'slidesToScroll'",defaultValueHint:!1},touchMove:{advanced:!0,displayName:"Touch Move",type:"boolean",description:"Enable slide moving on touch",defaultValueHint:!0},touchThreshold:{advanced:!0,displayName:"Touch Threshold",type:"number",description:"Swipe distance threshold in pixels",defaultValueHint:5},useCSS:{advanced:!0,displayName:"Use CSS",type:"boolean",description:"Enable/Disable CSS Transitions",defaultValueHint:!0},useTransform:{advanced:!0,displayName:"Use Transform",type:"boolean",description:"Enable/Disable CSS Transforms",defaultValueHint:!0},variableWidth:{advanced:!0,displayName:"Variable Width",type:"boolean",description:"Variable width slides",defaultValueHint:!1},vertical:{advanced:!0,displayName:"Vertical",type:"boolean",description:"Vertical slide mode",defaultValueHint:!1}},isDefaultExport:!0,defaultStyles:{width:"stretch",maxWidth:"100%",flexDirection:"column"}},p=a.forwardRef((function(e,t){var n=e.editingSlide,s=e.setControlContextData,r=function(e,t){if(null==e)return{};var i,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(i=l[n])>=0||(a[i]=e[i]);return a}(e,d);null==s||s({editingSlide:n});var p=a.useRef(null);return a.useEffect((function(){void 0!==n&&p.current.slickGoTo(n)}),[n]),l.createElement(o,Object.assign({ref:i(p,t)},r))}));exports.SliderWrapper=p,exports.registerSlider=function(e,i){e?e.registerComponent(p,null!=i?i:r):t(p,null!=i?i:r)},exports.sliderMeta=r;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),i=require("antd"),n=require("react"),a=e(n),l=e(require("react-slick"));function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var r=["editingSlide","initialSlide","arrowColor","className","sliderScopeClassName"];function s(e){var t=e.rows,i=void 0===t?1:t,n=e.slidesPerRow,a=void 0===n?1:n,l=e.editingSlide,o=void 0===l?0:l,r=e.children,s=Array.isArray(r)?r.length:1,d=i*a,u=Math.ceil(s/d);return{currentDotIndex:o>=u?u-1:o,slidesPerDot:d,dotCount:u,totalSlides:s}}var d={states:{currentSlide:{onChangeArgsToValue:function(e,t){return t}}}},u={name:"hostless-slider",displayName:"Slider Carousel",importName:"SliderWrapper",importPath:"@plasmicpkgs/react-slick",description:"[See tutorial video](https://www.youtube.com/watch?v=GMgXLbNHX8c)",actions:[{type:"custom-action",control:function(e){var t=e.studioOps,i=s(e.componentProps),n=i.currentDotIndex,l=Array.from({length:i.dotCount},(function(e,t){return t})).map((function(e){return a.createElement("option",{key:e,value:e.toString()},"Slide ",e)}));return a.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},a.createElement("div",null,"Current slide:"),a.createElement("select",{defaultValue:n.toString(),style:{width:"100%"},onChange:function(e){t.updateProps({editingSlide:Number(e.target.value)})},value:n.toString()},l))}},{type:"custom-action",control:function(e){var t=e.studioOps,n=s(e.componentProps),l=n.dotCount,o=n.currentDotIndex;return a.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},a.createElement(i.Button,{style:{width:"100%"},onClick:function(){t.updateProps({editingSlide:0===o?l-1:(o-1)%l})}},"Prev slide"),a.createElement(i.Button,{style:{width:"100%"},onClick:function(){t.updateProps({editingSlide:(o+1)%l})}},"Next slide"))}},{type:"button-action",label:"Append new slide",onClick:function(e){var t=e.studioOps,i=s(e.componentProps),n=i.dotCount,a=i.totalSlides%i.slidesPerDot?n-1:n;t.appendToSlot({type:"img",src:"",styles:{maxWidth:"100%"}},"children"),t.updateProps({editingSlide:a})}},{type:"button-action",label:"Delete current slide",hidden:function(e){var t;return"CanvasSlotPlaceholder"===(null==(t=e.children)||null==(t=t.type)?void 0:t.name)},onClick:function(e){var t=e.studioOps,i=s(e.componentProps),n=i.currentDotIndex,a=i.dotCount,l=i.slidesPerDot,o=i.totalSlides;t.removeFromSlotAt(n*l,"children"),t.updateProps({editingSlide:1===a?0:n!==a-1?1===l?n-1:n:o%l==1?n-1:n})}},{type:"custom-action",control:function(){return a.createElement("div",null,"* To re-arrange slides, use the Outline panel")}}],refActions:{slickGoTo:{displayName:"Jump to slide",argTypes:[{name:"index",displayName:"Slide index",type:"number"},{name:"dontAnimate",displayName:"Animate?",type:"boolean"}]},slickNext:{displayName:"Go to Next slide",argTypes:[]},slickPause:{displayName:"Pause",argTypes:[]},slickPlay:{displayName:"Play",argTypes:[]},slickPrev:{displayName:"Go to Previous slide",argTypes:[]}},props:{children:{type:"slot",defaultValue:[0,1,2].map((function(e){return{type:"vbox",children:{type:"img",src:"https://static1.plasmic.app/components/react-slick/slide"+(e+1)+".png",styles:{maxWidth:"100%"}}}}))},editingSlide:{displayName:"Currently edited slide",type:"number",description:"Switch to the specified slide (first is 0). Only affects the editor, not the final page.",defaultValueHint:0,defaultValue:0,editOnly:!0,hidden:function(){return!0}},accessibility:{advanced:!0,displayName:"Accessibility",type:"boolean",description:"Enables tabbing and arrow key navigation",defaultValueHint:!0},adaptiveHeight:{advanced:!0,displayName:"Adaptive Height",type:"boolean",description:"Adjust the slide's height automatically",defaultValueHint:!1},arrows:{displayName:"Arrows",type:"boolean",description:"Show next/prev arrows",defaultValueHint:!0},sliderScopeClassName:{type:"styleScopeClass",scopeName:"slider"},arrowColor:{type:"color",description:"Color of next/prev arrow buttons",defaultValueHint:"#000000",hidden:function(e){return void 0!==e.arrows&&!e.arrows}},autoplay:{displayName:"Auto Play",type:"boolean",description:"Automatically start scrolling",defaultValueHint:!1},autoplaySpeed:{displayName:"Auto Play Speed",type:"number",description:"Delay between each auto scroll, in milliseconds",defaultValueHint:3e3,hidden:function(e){return!e.autoplay}},centerMode:{displayName:"Center Mode",type:"boolean",description:"Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts",defaultValueHint:!1},centerPadding:{displayName:"Center Padding",type:"string",description:"Side padding when in center mode (px or %)",defaultValueHint:"50px",hidden:function(e){return!e.centerMode}},dots:{displayName:"Dots",type:"boolean",description:"Show dots for each slide",defaultValueHint:!1},draggable:{advanced:!0,displayName:"Draggable",type:"boolean",description:"Enables mouse dragging on desktop",defaultValueHint:!0},cssEase:{advanced:!0,displayName:"Easing",type:"string",description:"Easing method for transition",defaultValueHint:"linear"},easing:{hidden:function(){return!0},advanced:!0,displayName:"Easing",type:"string",description:"Easing method for transition",defaultValueHint:"linear"},fade:{advanced:!0,displayName:"Fade",type:"boolean",description:"Cross-fade between slides",defaultValueHint:!1},focusOnSelect:{advanced:!0,displayName:"Focus On Select",type:"boolean",description:"Go to slide on click",defaultValueHint:!1},infinite:{displayName:"Infinite",type:"boolean",description:"Infinitely wrap around contents",defaultValueHint:!0},initialSlide:{displayName:"Initial Slide",type:"number",description:"Index of the first visible slide (first is 0), accounting for multiple slides per view if applicable.",defaultValueHint:0,defaultValue:0},lazyLoad:{advanced:!0,displayName:"Lazy Load",type:"choice",options:["ondemand","progressive"],description:"Load images or render components on demand or progressively"},pauseOnDotsHover:{displayName:"Pause On Dots Hover",type:"boolean",description:"Prevents autoplay while hovering on dots",defaultValueHint:!1},pauseOnFocus:{displayName:"Pause On Focus",type:"boolean",description:"Prevents autoplay while focused on slides",defaultValueHint:!1},pauseOnHover:{displayName:"Pause On Hover",type:"boolean",description:"Prevents autoplay while hovering on track",defaultValueHint:!0},rows:{displayName:"Rows",type:"number",description:"Number of rows per slide (enables grid mode)",defaultValueHint:1},rtl:{advanced:!0,displayName:"Reverse",type:"boolean",description:"Reverses the slide order",defaultValueHint:!1},slidesPerRow:{displayName:"Slides Per Row",type:"number",description:"Number of slides to display in grid mode, this is useful with rows option",defaultValueHint:1},slidesToScroll:{advanced:!0,displayName:"Slides To Scroll",type:"number",description:"Number of slides to scroll at once",defaultValueHint:1},slidesToShow:{advanced:!0,displayName:"Slides To Show",type:"number",description:"Number of slides to show in one frame",defaultValueHint:1},speed:{advanced:!0,displayName:"Speed",type:"number",description:"Transition speed in milliseconds",defaultValueHint:500},swipe:{advanced:!0,displayName:"Swipe",type:"boolean",description:"Enable swiping to change slides",defaultValueHint:!0},swipeToSlide:{advanced:!0,displayName:"Swipe To Slide",type:"boolean",description:"Enable drag/swipe irrespective of 'slidesToScroll'",defaultValueHint:!1},touchMove:{advanced:!0,displayName:"Touch Move",type:"boolean",description:"Enable slide moving on touch",defaultValueHint:!0},touchThreshold:{advanced:!0,displayName:"Touch Threshold",type:"number",description:"Swipe distance threshold in pixels",defaultValueHint:5},useCSS:{advanced:!0,displayName:"Use CSS",type:"boolean",description:"Enable/Disable CSS Transitions",defaultValueHint:!0},useTransform:{advanced:!0,displayName:"Use Transform",type:"boolean",description:"Enable/Disable CSS Transforms",defaultValueHint:!0},variableWidth:{advanced:!0,displayName:"Variable Width",type:"boolean",description:"Variable width slides",defaultValueHint:!1},vertical:{advanced:!0,displayName:"Vertical",type:"boolean",description:"Vertical slide mode",defaultValueHint:!1},beforeChange:{type:"eventHandler",advanced:!0,argTypes:[{name:"currentSlide",type:"number"}]}},states:{currentSlide:o({type:"writable",valueProp:"editingSlide",onChangeProp:"beforeChange",variableType:"number"},d.states.currentSlide)},componentHelpers:{helpers:d,importName:"sliderHelpers",importPath:"@plasmicpkgs/react-slick"},defaultStyles:{width:"stretch",maxWidth:"100%",flexDirection:"column"}};function c(e,t){var i=n.useState(e),a=i[0],l=i[1];return n.useEffect((function(){var i=setTimeout((function(){return l(e)}),t||500);return function(){clearTimeout(i)}}),[e,t]),a}var p=n.forwardRef((function(e,t){var i=e.editingSlide,o=e.initialSlide,s=e.arrowColor,d=e.className,u=e.sliderScopeClassName,p=function(e,t){if(null==e)return{};var i,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(i=l[n])>=0||(a[i]=e[i]);return a}(e,r),y=!!e["data-plasmic-canvas-envs"],m=n.useRef(null),f=c(i);n.useEffect((function(){var e;void 0!==f&&y&&(null==(e=m.current)||e.slickGoTo(f))}),[f,y]),n.useEffect((function(){var e;void 0!==o&&(null==(e=m.current)||e.slickGoTo(o,!0))}),[o]),a.useImperativeHandle(t,(function(){return{slickGoTo:function(e,t){m.current&&(0,m.current.slickGoTo)(e,t)},slickNext:function(){m.current&&(0,m.current.slickNext)()},slickPause:function(){m.current&&(0,m.current.slickPause)()},slickPlay:function(){m.current&&(0,m.current.slickPlay)()},slickPrev:function(){m.current&&(0,m.current.slickPrev)()}}}),[]);var v="\n ."+u+" .slick-arrow:before {\n color: "+(null!=s?s:"black")+";\n }\n ";return a.createElement(a.Fragment,null,a.createElement(l,Object.assign({className:d+" "+u,ref:m},p)),a.createElement("style",{dangerouslySetInnerHTML:{__html:v}}))}));exports.SliderWrapper=p,exports.registerSlider=function(e,i){e?e.registerComponent(p,null!=i?i:u):t(p,null!=i?i:u)},exports.sliderHelpers=d,exports.sliderMeta=u,exports.useDebounce=c;
|
|
2
2
|
//# sourceMappingURL=react-slick.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-slick.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport React, { forwardRef, Ref, useEffect, useRef } from \"react\";\nimport Slider, { Settings } from \"react-slick\";\n\nconst { Option } = Select;\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\nexport const sliderMeta: ComponentMeta<Settings> = {\n name: \"hostless-slider\",\n displayName: \"Slider Carousel\",\n importName: \"Slider\",\n importPath: \"react-slick\",\n description:\n \"[See tutorial video](https://www.youtube.com/watch?v=GMgXLbNHX8c)\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n accessibility: {\n advanced: true,\n displayName: \"Accessibility\",\n type: \"boolean\",\n description: \"Enables tabbing and arrow key navigation\",\n defaultValueHint: true,\n },\n adaptiveHeight: {\n advanced: true,\n displayName: \"Adaptive Height\",\n type: \"boolean\",\n description: \"Adjust the slide's height automatically\",\n defaultValueHint: false,\n },\n arrows: {\n displayName: \"Arrows\",\n type: \"boolean\",\n description: \"Show next/prev arrows\",\n defaultValueHint: true,\n },\n autoplay: {\n displayName: \"Auto Play\",\n type: \"boolean\",\n description: \"Automatically start scrolling\",\n defaultValueHint: false,\n },\n autoplaySpeed: {\n displayName: \"Auto Play Speed\",\n type: \"number\",\n description: \"Delay between each auto scroll, in milliseconds\",\n defaultValueHint: 3000,\n hidden: (props) => !props.autoplay,\n },\n centerMode: {\n displayName: \"Center Mode\",\n type: \"boolean\",\n description:\n \"Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts\",\n defaultValueHint: false,\n },\n centerPadding: {\n displayName: \"Center Padding\",\n type: \"string\",\n description: \"Side padding when in center mode (px or %)\",\n defaultValueHint: \"50px\",\n hidden: (props) => !props.centerMode,\n },\n dots: {\n displayName: \"Dots\",\n type: \"boolean\",\n description: \"Show dots for each slide\",\n defaultValueHint: false,\n },\n draggable: {\n advanced: true,\n displayName: \"Draggable\",\n type: \"boolean\",\n description: \"Enables mouse dragging on desktop\",\n defaultValueHint: true,\n },\n cssEase: {\n advanced: true,\n displayName: \"Easing\",\n type: \"string\",\n description: \"Easing method for transition\",\n defaultValueHint: \"linear\",\n },\n /** Deprecated, this was apparently never working:\n * https://github.com/akiran/react-slick/issues/363 */\n easing: {\n hidden: () => true,\n advanced: true,\n displayName: \"Easing\",\n type: \"string\",\n description: \"Easing method for transition\",\n defaultValueHint: \"linear\",\n },\n fade: {\n advanced: true,\n displayName: \"Fade\",\n type: \"boolean\",\n description: \"Cross-fade between slides\",\n defaultValueHint: false,\n },\n focusOnSelect: {\n advanced: true,\n displayName: \"Focus On Select\",\n type: \"boolean\",\n description: \"Go to slide on click\",\n defaultValueHint: false,\n },\n infinite: {\n displayName: \"Infinite\",\n type: \"boolean\",\n description: \"Infinitely wrap around contents\",\n defaultValueHint: true,\n },\n initialSlide: {\n displayName: \"Initial Slide\",\n type: \"number\",\n description: \"Index of initial slide (first is 0)\",\n defaultValueHint: 0,\n },\n lazyLoad: {\n advanced: true,\n displayName: \"Lazy Load\",\n type: \"choice\",\n options: [\"ondemand\", \"progressive\"],\n description:\n \"Load images or render components on demand or progressively\",\n },\n pauseOnDotsHover: {\n displayName: \"Pause On Dots Hover\",\n type: \"boolean\",\n description: \"Prevents autoplay while hovering on dots\",\n defaultValueHint: false,\n },\n pauseOnFocus: {\n displayName: \"Pause On Focus\",\n type: \"boolean\",\n description: \"Prevents autoplay while focused on slides\",\n defaultValueHint: false,\n },\n pauseOnHover: {\n displayName: \"Pause On Hover\",\n type: \"boolean\",\n description: \"Prevents autoplay while hovering on track\",\n defaultValueHint: true,\n },\n rows: {\n displayName: \"Rows\",\n type: \"number\",\n description: \"Number of rows per slide (enables grid mode)\",\n defaultValueHint: 1,\n },\n rtl: {\n advanced: true,\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n // Looks like the `slide` prop is not being used to set the container tag:\n // https://github.com/akiran/react-slick/issues/1318\n // https://github.com/akiran/react-slick/pull/1885\n // https://stackoverflow.com/questions/51492535/wrap-react-slick-li-slides-inside-ul\n //\n // slide: {\n // displayName: \"Slide Tag\",\n // type: \"string\",\n // description: 'Slide container element type',\n // defaultValueHint: \"div\",\n // },\n slidesPerRow: {\n displayName: \"Slides Per Row\",\n type: \"number\",\n description:\n \"Number of slides to display in grid mode, this is useful with rows option\",\n defaultValueHint: 1,\n },\n slidesToScroll: {\n advanced: true,\n displayName: \"Slides To Scroll\",\n type: \"number\",\n description: \"Number of slides to scroll at once\",\n defaultValueHint: 1,\n },\n slidesToShow: {\n advanced: true,\n displayName: \"Slides To Show\",\n type: \"number\",\n description: \"Number of slides to show in one frame\",\n defaultValueHint: 1,\n },\n speed: {\n advanced: true,\n displayName: \"Speed\",\n type: \"number\",\n description: \"Transition speed in milliseconds\",\n defaultValueHint: 500,\n },\n swipe: {\n advanced: true,\n displayName: \"Swipe\",\n type: \"boolean\",\n description: \"Enable swiping to change slides\",\n defaultValueHint: true,\n },\n swipeToSlide: {\n advanced: true,\n displayName: \"Swipe To Slide\",\n type: \"boolean\",\n description: \"Enable drag/swipe irrespective of 'slidesToScroll'\",\n defaultValueHint: false,\n },\n touchMove: {\n advanced: true,\n displayName: \"Touch Move\",\n type: \"boolean\",\n description: \"Enable slide moving on touch\",\n defaultValueHint: true,\n },\n touchThreshold: {\n advanced: true,\n displayName: \"Touch Threshold\",\n type: \"number\",\n description: \"Swipe distance threshold in pixels\",\n defaultValueHint: 5,\n },\n useCSS: {\n advanced: true,\n displayName: \"Use CSS\",\n type: \"boolean\",\n description: \"Enable/Disable CSS Transitions\",\n defaultValueHint: true,\n },\n useTransform: {\n advanced: true,\n displayName: \"Use Transform\",\n type: \"boolean\",\n description: \"Enable/Disable CSS Transforms\",\n defaultValueHint: true,\n },\n variableWidth: {\n advanced: true,\n displayName: \"Variable Width\",\n type: \"boolean\",\n description: \"Variable width slides\",\n defaultValueHint: false,\n },\n vertical: {\n advanced: true,\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n },\n },\n isDefaultExport: true,\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n setControlContextData,\n ...props\n }: Settings & {\n editingSlide?: number;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<Slider>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const slider = useRef<Slider>(null);\n useEffect(() => {\n if (editingSlide !== undefined) {\n slider.current!.slickGoTo(editingSlide);\n }\n }, [editingSlide]);\n return <Slider ref={composeRefs(slider, userRef)} {...props} />;\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: ComponentMeta<Settings>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","sliderMeta","name","displayName","importName","importPath","description","actions","type","control","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","options","Array","from","_","i","map","React","value","toString","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","slideIdx","Number","updateProps","_ref2","_componentProps$editi2","Button","onClick","label","_ref3","appendToSlot","src","styles","maxWidth","_ref4","_contextData$editingS","contextData","removeFromSlotAt","props","defaultValueHint","editOnly","hidden","accessibility","advanced","adaptiveHeight","arrows","autoplay","autoplaySpeed","centerMode","centerPadding","dots","draggable","cssEase","easing","fade","focusOnSelect","infinite","initialSlide","lazyLoad","pauseOnDotsHover","pauseOnFocus","pauseOnHover","rows","rtl","slidesPerRow","slidesToScroll","slidesToShow","speed","swipe","swipeToSlide","touchMove","touchThreshold","useCSS","useTransform","variableWidth","vertical","isDefaultExport","defaultStyles","SliderWrapper","forwardRef","_ref5","userRef","setControlContextData","_objectWithoutPropertiesLoose","_excluded","slider","useRef","useEffect","undefined","current","slickGoTo","Slider","ref","composeRefs","loader","customSliderMeta","registerComponent"],"mappings":"+VASQA,EAAWC,SAAXD,OAgFKE,EAAsC,CACjDC,KAAM,kBACNC,YAAa,kBACbC,WAAY,SACZC,WAAY,cACZC,YACE,oEACFC,QAAS,CACP,CACEC,KAAM,gBACNC,QAxFN,SAA6BC,WAAGC,EAAcD,EAAdC,eAAgBC,EAASF,EAATE,UACxCC,SAAYC,EAAGH,EAAeE,cAAYC,EAAI,EAC9CC,SAASC,EACbL,EAAeM,SAASC,QAAMF,EACI,QAAjCL,EAAeM,SAAST,KAAiB,EAAI,EAE1CW,EAAUC,MAAMC,KAAK,CAAEH,OAAQH,IAAa,SAACO,EAAGC,GAAC,OAAKA,KAAGC,KAAI,SAACD,GAClE,OAAOE,gBAAC1B,GAAO2B,MAAOH,EAAEI,qBAAmBJ,EAAI,MAQjD,OACEE,uBACEG,MAAO,CACLC,MAAO,OACPC,QAAS,OACTC,cAAe,MACfC,IAAK,OACLC,eAAgB,kBAGlBR,6CACAA,gBAACzB,UACCkC,aAAcrB,EAAac,WAC3BC,MAAO,CAAEC,MAAO,QAChBM,SAnBe,SAACT,GACpB,IAAMU,EAAWC,OAAOX,GACxBd,EAAU0B,YAAY,CAAEzB,aAAcuB,EAAWrB,KAkB7CW,MAAOb,EAAac,YAEnBR,MA0DL,CACEX,KAAM,gBACNC,QAtDN,SAAuB8B,SAAG5B,EAAc4B,EAAd5B,eAAgBC,EAAS2B,EAAT3B,UAClCG,EAAYJ,EAAeM,SAASC,OACpCL,SAAY2B,EAAG7B,EAAeE,cAAY2B,EAAI,EAEpD,OACEf,uBACEG,MAAO,CACLC,MAAO,OACPC,QAAS,OACTC,cAAe,MACfC,IAAK,OACL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a,wBACbgD,kBAAkB,GAEpBoC,SAAU,CACRhC,UAAU,EACVvD,YAAa,WACbK,KAAM,UACNF,YAAa,sBACbgD,kBAAkB,IAGtBqC,iBAAiB,EACjBC,cAAe,CACb/D,MAAO,UACPmB,SAAU,OACVjB,cAAe,WAIN8D,EAAgBC,cAAW,SAAuBC,EAW7DC,OATEnF,EAAYkF,EAAZlF,aACAoF,EAAqBF,EAArBE,sBACG5C,oIAAK6C,CAAAH,EAAAI,SASVF,GAAAA,EAAwB,CAAEpF,aAAcA,IACxC,IAAMuF,EAASC,SAAe,MAM9B,OALAC,aAAU,gBACaC,IAAjB1F,GACFuF,EAAOI,QAASC,UAAU5F,KAE3B,CAACA,IACGY,gBAACiF,iBAAOC,IAAKC,EAAYR,EAAQJ,IAAc3C,+DAItDwD,EACAC,GAEID,EACFA,EAAOE,kBAAkBlB,QAAeiB,EAAAA,EAAoB7G,GAE5D8G,EAAkBlB,QAAeiB,EAAAA,EAAoB7G"}
|
|
1
|
+
{"version":3,"file":"react-slick.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport { Button } from \"antd\";\nimport React, {\n ChangeEvent,\n forwardRef,\n Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport Slider, { Settings } from \"react-slick\";\n\ntype SliderProps = Settings & {\n arrowColor?: string;\n editingSlide?: number;\n sliderScopeClassName: string;\n};\n\nfunction getSlideInfo({\n rows = 1,\n slidesPerRow = 1,\n editingSlide = 0,\n children,\n}: SliderProps) {\n const slidesCnt = Array.isArray(children) ? children.length : 1;\n\n const slidesPerDot = rows * slidesPerRow;\n const dotCount = Math.ceil(slidesCnt / slidesPerDot);\n const currentDotIndex =\n editingSlide >= dotCount ? dotCount - 1 : editingSlide;\n\n return {\n currentDotIndex,\n slidesPerDot,\n dotCount,\n totalSlides: slidesCnt,\n };\n}\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const { dotCount, currentDotIndex } = getSlideInfo(componentProps);\n\n const options = Array.from({ length: dotCount }, (_, i) => i).map((i) => {\n return (\n <option key={i} value={i.toString()}>\n Slide {i}\n </option>\n );\n });\n\n const handleChange = (e: ChangeEvent<HTMLSelectElement>) => {\n studioOps.updateProps({ editingSlide: Number(e.target.value) });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <select\n defaultValue={currentDotIndex.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={currentDotIndex.toString()}\n >\n {options}\n </select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const { dotCount, currentDotIndex } = getSlideInfo(componentProps);\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide =\n currentDotIndex === 0\n ? dotCount - 1\n : (currentDotIndex - 1) % dotCount;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (currentDotIndex + 1) % dotCount;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\nexport const sliderHelpers = {\n states: {\n currentSlide: {\n onChangeArgsToValue: (_: number, newIndex: number) => newIndex,\n },\n },\n};\n\nexport const sliderMeta: ComponentMeta<SliderProps> = {\n name: \"hostless-slider\",\n displayName: \"Slider Carousel\",\n importName: \"SliderWrapper\",\n importPath: \"@plasmicpkgs/react-slick\",\n description:\n \"[See tutorial video](https://www.youtube.com/watch?v=GMgXLbNHX8c)\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const { dotCount, slidesPerDot, totalSlides } =\n getSlideInfo(componentProps);\n const editingSlide =\n totalSlides % slidesPerDot ? dotCount - 1 : dotCount;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n hidden: (ps) =>\n (ps.children as any)?.type?.name === \"CanvasSlotPlaceholder\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const { currentDotIndex, dotCount, slidesPerDot, totalSlides } =\n getSlideInfo(componentProps);\n studioOps.removeFromSlotAt(currentDotIndex * slidesPerDot, \"children\");\n let newPos = currentDotIndex;\n if (dotCount === 1) {\n // not the only dot\n newPos = 0;\n } else if (currentDotIndex !== dotCount - 1) {\n // not the last dot\n if (slidesPerDot === 1) {\n newPos = currentDotIndex - 1;\n } else {\n newPos = currentDotIndex;\n }\n } else {\n // the last dot\n newPos =\n totalSlides % slidesPerDot === 1\n ? currentDotIndex - 1\n : currentDotIndex;\n }\n studioOps.updateProps({\n editingSlide: newPos,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n refActions: {\n slickGoTo: {\n displayName: \"Jump to slide\",\n argTypes: [\n {\n name: \"index\",\n displayName: \"Slide index\",\n type: \"number\",\n },\n {\n name: \"dontAnimate\",\n displayName: \"Animate?\",\n type: \"boolean\",\n },\n ],\n },\n slickNext: {\n displayName: \"Go to Next slide\",\n argTypes: [],\n },\n slickPause: {\n displayName: \"Pause\",\n argTypes: [],\n },\n slickPlay: {\n displayName: \"Play\",\n argTypes: [],\n },\n slickPrev: {\n displayName: \"Go to Previous slide\",\n argTypes: [],\n },\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n defaultValue: 0,\n editOnly: true,\n hidden: () => true,\n },\n accessibility: {\n advanced: true,\n displayName: \"Accessibility\",\n type: \"boolean\",\n description: \"Enables tabbing and arrow key navigation\",\n defaultValueHint: true,\n },\n adaptiveHeight: {\n advanced: true,\n displayName: \"Adaptive Height\",\n type: \"boolean\",\n description: \"Adjust the slide's height automatically\",\n defaultValueHint: false,\n },\n arrows: {\n displayName: \"Arrows\",\n type: \"boolean\",\n description: \"Show next/prev arrows\",\n defaultValueHint: true,\n },\n sliderScopeClassName: {\n type: \"styleScopeClass\",\n scopeName: \"slider\",\n } as any,\n arrowColor: {\n type: \"color\",\n description: \"Color of next/prev arrow buttons\",\n defaultValueHint: \"#000000\",\n hidden: (ps) => (ps.arrows === undefined ? false : !ps.arrows),\n },\n autoplay: {\n displayName: \"Auto Play\",\n type: \"boolean\",\n description: \"Automatically start scrolling\",\n defaultValueHint: false,\n },\n autoplaySpeed: {\n displayName: \"Auto Play Speed\",\n type: \"number\",\n description: \"Delay between each auto scroll, in milliseconds\",\n defaultValueHint: 3000,\n hidden: (props) => !props.autoplay,\n },\n centerMode: {\n displayName: \"Center Mode\",\n type: \"boolean\",\n description:\n \"Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts\",\n defaultValueHint: false,\n },\n centerPadding: {\n displayName: \"Center Padding\",\n type: \"string\",\n description: \"Side padding when in center mode (px or %)\",\n defaultValueHint: \"50px\",\n hidden: (props) => !props.centerMode,\n },\n dots: {\n displayName: \"Dots\",\n type: \"boolean\",\n description: \"Show dots for each slide\",\n defaultValueHint: false,\n },\n draggable: {\n advanced: true,\n displayName: \"Draggable\",\n type: \"boolean\",\n description: \"Enables mouse dragging on desktop\",\n defaultValueHint: true,\n },\n cssEase: {\n advanced: true,\n displayName: \"Easing\",\n type: \"string\",\n description: \"Easing method for transition\",\n defaultValueHint: \"linear\",\n },\n /** Deprecated, this was apparently never working:\n * https://github.com/akiran/react-slick/issues/363 */\n easing: {\n hidden: () => true,\n advanced: true,\n displayName: \"Easing\",\n type: \"string\",\n description: \"Easing method for transition\",\n defaultValueHint: \"linear\",\n },\n fade: {\n advanced: true,\n displayName: \"Fade\",\n type: \"boolean\",\n description: \"Cross-fade between slides\",\n defaultValueHint: false,\n },\n focusOnSelect: {\n advanced: true,\n displayName: \"Focus On Select\",\n type: \"boolean\",\n description: \"Go to slide on click\",\n defaultValueHint: false,\n },\n infinite: {\n displayName: \"Infinite\",\n type: \"boolean\",\n description: \"Infinitely wrap around contents\",\n defaultValueHint: true,\n },\n initialSlide: {\n displayName: \"Initial Slide\",\n type: \"number\",\n description:\n \"Index of the first visible slide (first is 0), accounting for multiple slides per view if applicable.\",\n defaultValueHint: 0,\n defaultValue: 0,\n },\n lazyLoad: {\n advanced: true,\n displayName: \"Lazy Load\",\n type: \"choice\",\n options: [\"ondemand\", \"progressive\"],\n description:\n \"Load images or render components on demand or progressively\",\n },\n pauseOnDotsHover: {\n displayName: \"Pause On Dots Hover\",\n type: \"boolean\",\n description: \"Prevents autoplay while hovering on dots\",\n defaultValueHint: false,\n },\n pauseOnFocus: {\n displayName: \"Pause On Focus\",\n type: \"boolean\",\n description: \"Prevents autoplay while focused on slides\",\n defaultValueHint: false,\n },\n pauseOnHover: {\n displayName: \"Pause On Hover\",\n type: \"boolean\",\n description: \"Prevents autoplay while hovering on track\",\n defaultValueHint: true,\n },\n rows: {\n displayName: \"Rows\",\n type: \"number\",\n description: \"Number of rows per slide (enables grid mode)\",\n defaultValueHint: 1,\n },\n rtl: {\n advanced: true,\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n // Looks like the `slide` prop is not being used to set the container tag:\n // https://github.com/akiran/react-slick/issues/1318\n // https://github.com/akiran/react-slick/pull/1885\n // https://stackoverflow.com/questions/51492535/wrap-react-slick-li-slides-inside-ul\n //\n // slide: {\n // displayName: \"Slide Tag\",\n // type: \"string\",\n // description: 'Slide container element type',\n // defaultValueHint: \"div\",\n // },\n slidesPerRow: {\n displayName: \"Slides Per Row\",\n type: \"number\",\n description:\n \"Number of slides to display in grid mode, this is useful with rows option\",\n defaultValueHint: 1,\n },\n slidesToScroll: {\n advanced: true,\n displayName: \"Slides To Scroll\",\n type: \"number\",\n description: \"Number of slides to scroll at once\",\n defaultValueHint: 1,\n },\n slidesToShow: {\n advanced: true,\n displayName: \"Slides To Show\",\n type: \"number\",\n description: \"Number of slides to show in one frame\",\n defaultValueHint: 1,\n },\n speed: {\n advanced: true,\n displayName: \"Speed\",\n type: \"number\",\n description: \"Transition speed in milliseconds\",\n defaultValueHint: 500,\n },\n swipe: {\n advanced: true,\n displayName: \"Swipe\",\n type: \"boolean\",\n description: \"Enable swiping to change slides\",\n defaultValueHint: true,\n },\n swipeToSlide: {\n advanced: true,\n displayName: \"Swipe To Slide\",\n type: \"boolean\",\n description: \"Enable drag/swipe irrespective of 'slidesToScroll'\",\n defaultValueHint: false,\n },\n touchMove: {\n advanced: true,\n displayName: \"Touch Move\",\n type: \"boolean\",\n description: \"Enable slide moving on touch\",\n defaultValueHint: true,\n },\n touchThreshold: {\n advanced: true,\n displayName: \"Touch Threshold\",\n type: \"number\",\n description: \"Swipe distance threshold in pixels\",\n defaultValueHint: 5,\n },\n useCSS: {\n advanced: true,\n displayName: \"Use CSS\",\n type: \"boolean\",\n description: \"Enable/Disable CSS Transitions\",\n defaultValueHint: true,\n },\n useTransform: {\n advanced: true,\n displayName: \"Use Transform\",\n type: \"boolean\",\n description: \"Enable/Disable CSS Transforms\",\n defaultValueHint: true,\n },\n variableWidth: {\n advanced: true,\n displayName: \"Variable Width\",\n type: \"boolean\",\n description: \"Variable width slides\",\n defaultValueHint: false,\n },\n vertical: {\n advanced: true,\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n },\n beforeChange: {\n type: \"eventHandler\",\n advanced: true,\n argTypes: [{ name: \"currentSlide\", type: \"number\" }],\n },\n },\n states: {\n currentSlide: {\n type: \"writable\",\n valueProp: \"editingSlide\",\n onChangeProp: \"beforeChange\",\n variableType: \"number\",\n ...sliderHelpers.states.currentSlide,\n },\n },\n componentHelpers: {\n helpers: sliderHelpers,\n importName: \"sliderHelpers\",\n importPath: \"@plasmicpkgs/react-slick\",\n },\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport function useDebounce<T>(value: T, delay?: number): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedValue(value), delay || 500);\n\n return () => {\n clearTimeout(timer);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}\n\nexport type SliderMethods = Pick<\n Slider,\n \"slickGoTo\" | \"slickNext\" | \"slickPause\" | \"slickPlay\" | \"slickPrev\"\n>;\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n props: SliderProps,\n userRef?: Ref<SliderMethods>\n) {\n const {\n editingSlide,\n initialSlide,\n arrowColor,\n className,\n sliderScopeClassName,\n ...rest\n } = props;\n // \"data-plasmic-canvas-envs\" prop only exists in studio canvas\n const isEditMode = (props as any)[\"data-plasmic-canvas-envs\"] ? true : false;\n const slider = useRef<Slider>(null);\n const debouncedEditingSlide = useDebounce(editingSlide);\n\n useEffect(() => {\n if (debouncedEditingSlide !== undefined && isEditMode) {\n slider.current?.slickGoTo(debouncedEditingSlide);\n }\n }, [debouncedEditingSlide, isEditMode]);\n\n useEffect(() => {\n // passing the initialSlide prop directly to <Slider> does not work when inifinite: true and slidesPerRow: 3. So usingSlickGoTo instead\n if (initialSlide === undefined) return;\n slider.current?.slickGoTo(initialSlide, true);\n }, [initialSlide]);\n\n React.useImperativeHandle(\n userRef,\n () => ({\n slickGoTo(index, dontAnimate) {\n if (slider.current) {\n const { slickGoTo } = slider.current;\n slickGoTo(index, dontAnimate);\n }\n },\n slickNext() {\n if (slider.current) {\n const { slickNext } = slider.current;\n slickNext();\n }\n },\n slickPause() {\n if (slider.current) {\n const { slickPause } = slider.current;\n slickPause();\n }\n },\n slickPlay() {\n if (slider.current) {\n const { slickPlay } = slider.current;\n slickPlay();\n }\n },\n slickPrev() {\n if (slider.current) {\n const { slickPrev } = slider.current;\n slickPrev();\n }\n },\n }),\n []\n );\n\n const css = `\n .${sliderScopeClassName} .slick-arrow:before {\n color: ${arrowColor ?? \"black\"};\n }\n `;\n\n return (\n <>\n <Slider\n className={`${className} ${sliderScopeClassName}`}\n ref={slider}\n {...rest}\n />\n <style dangerouslySetInnerHTML={{ __html: css }} />\n </>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: ComponentMeta<SliderProps>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["getSlideInfo","_ref","rows","_ref$rows","_ref$slidesPerRow","slidesPerRow","_ref$editingSlide","editingSlide","children","slidesCnt","Array","isArray","length","slidesPerDot","dotCount","Math","ceil","currentDotIndex","totalSlides","sliderHelpers","states","currentSlide","onChangeArgsToValue","_","newIndex","sliderMeta","name","displayName","importName","importPath","description","actions","type","control","_ref2","studioOps","_getSlideInfo","componentProps","options","from","i","map","React","key","value","toString","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","e","updateProps","Number","target","_ref3","_getSlideInfo2","Button","onClick","label","_ref4","_getSlideInfo3","appendToSlot","src","styles","maxWidth","hidden","ps","_ps$children","_ref5","_getSlideInfo4","removeFromSlotAt","refActions","slickGoTo","argTypes","slickNext","slickPause","slickPlay","slickPrev","props","defaultValueHint","editOnly","accessibility","advanced","adaptiveHeight","arrows","sliderScopeClassName","scopeName","arrowColor","undefined","autoplay","autoplaySpeed","centerMode","centerPadding","dots","draggable","cssEase","easing","fade","focusOnSelect","infinite","initialSlide","lazyLoad","pauseOnDotsHover","pauseOnFocus","pauseOnHover","rtl","slidesToScroll","slidesToShow","speed","swipe","swipeToSlide","touchMove","touchThreshold","useCSS","useTransform","variableWidth","vertical","beforeChange","_extends","valueProp","onChangeProp","variableType","componentHelpers","helpers","defaultStyles","useDebounce","delay","_useState","useState","debouncedValue","setDebouncedValue","useEffect","timer","setTimeout","clearTimeout","SliderWrapper","forwardRef","userRef","className","rest","_objectWithoutPropertiesLoose","_excluded","isEditMode","slider","useRef","debouncedEditingSlide","_slider$current","current","_slider$current2","useImperativeHandle","index","dontAnimate","css","Slider","ref","dangerouslySetInnerHTML","__html","loader","customSliderMeta","registerComponent"],"mappings":"kkBAqBA,SAASA,EAAYC,WACnBC,KAAAA,WAAIC,EAAG,EAACA,EAAAC,EAAAH,EACRI,aAAAA,WAAYD,EAAG,EAACA,EAAAE,EAAAL,EAChBM,aAAAA,WAAYD,EAAG,EAACA,EAChBE,EAAQP,EAARO,SAEMC,EAAYC,MAAMC,QAAQH,GAAYA,EAASI,OAAS,EAExDC,EAAeX,EAAOG,EACtBS,EAAWC,KAAKC,KAAKP,EAAYI,GAIvC,MAAO,CACLI,gBAHAV,GAAgBO,EAAWA,EAAW,EAAIP,EAI1CM,aAAAA,EACAC,SAAAA,EACAI,YAAaT,OAoFJU,EAAgB,CAC3BC,OAAQ,CACNC,aAAc,CACZC,oBAAqB,SAACC,EAAWC,GAAgB,OAAKA,MAK/CC,EAAyC,CACpDC,KAAM,kBACNC,YAAa,kBACbC,WAAY,gBACZC,WAAY,2BACZC,YACE,oEACFC,QAAS,CACP,CACEC,KAAM,gBACNC,QAlGN,SAA6BC,OAAm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ASC,SAAe,MACxBC,EAAwBpB,EAAY1H,GAE1CgI,aAAU,WAC+C,IAAAe,OAAzB1D,IAA1ByD,GAAuCH,WACzCI,EAAAH,EAAOI,UAAPD,EAAgB1E,UAAUyE,MAE3B,CAACA,EAAuBH,IAE3BX,aAAU,sBAEa3C,IAAjBY,WACJgD,EAAAL,EAAOI,UAAPC,EAAgB5E,UAAU4B,GAAc,MACvC,CAACA,IAEJ9D,EAAM+G,oBACJZ,GACA,WAAA,MAAO,CACLjE,mBAAU8E,EAAOC,GACXR,EAAOI,UAET3E,EADsBuE,EAAOI,QAArB3E,WACE8E,EAAOC,IAGrB7E,qBACMqE,EAAOI,UAETzE,EADsBqE,EAAOI,QAArBzE,cAIZC,sBACMoE,EAAOI,UAETxE,EADuBoE,EAAOI,QAAtBxE,eAIZC,qBACMmE,EAAOI,UAETvE,EADsBmE,EAAOI,QAArBvE,cAIZC,qBACMkE,EAAOI,UAETtE,EADsBkE,EAAOI,QAArBtE,iBAKd,IAGF,IAAM2E,UACHnE,iDACUE,EAAAA,EAAc,wBAI3B,OACEjD,gCACEA,gBAACmH,iBACCf,UAAcA,MAAarD,EAC3BqE,IAAKX,GACDJ,IAENrG,yBAAOqH,wBAAyB,CAAEC,OAAQJ,iEAM9CK,EACAC,GAEID,EACFA,EAAOE,kBAAkBxB,QAAeuB,EAAAA,EAAoBzI,GAE5D0I,EAAkBxB,QAAeuB,EAAAA,EAAoBzI"}
|
package/dist/react-slick.esm.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import React, { forwardRef, useRef, useEffect } from 'react';
|
|
2
|
+
import { Button } from 'antd';
|
|
3
|
+
import React, { useState, useEffect, forwardRef, useRef } from 'react';
|
|
5
4
|
import Slider from 'react-slick';
|
|
6
5
|
|
|
6
|
+
function _extends() {
|
|
7
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
8
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9
|
+
var source = arguments[i];
|
|
10
|
+
for (var key in source) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
+
target[key] = source[key];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
return _extends.apply(this, arguments);
|
|
19
|
+
}
|
|
7
20
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
8
21
|
if (source == null) return {};
|
|
9
22
|
var target = {};
|
|
@@ -17,27 +30,45 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
17
30
|
return target;
|
|
18
31
|
}
|
|
19
32
|
|
|
20
|
-
var _excluded = ["editingSlide", "
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
var _excluded = ["editingSlide", "initialSlide", "arrowColor", "className", "sliderScopeClassName"];
|
|
34
|
+
function getSlideInfo(_ref) {
|
|
35
|
+
var _ref$rows = _ref.rows,
|
|
36
|
+
rows = _ref$rows === void 0 ? 1 : _ref$rows,
|
|
37
|
+
_ref$slidesPerRow = _ref.slidesPerRow,
|
|
38
|
+
slidesPerRow = _ref$slidesPerRow === void 0 ? 1 : _ref$slidesPerRow,
|
|
39
|
+
_ref$editingSlide = _ref.editingSlide,
|
|
40
|
+
editingSlide = _ref$editingSlide === void 0 ? 0 : _ref$editingSlide,
|
|
41
|
+
children = _ref.children;
|
|
42
|
+
var slidesCnt = Array.isArray(children) ? children.length : 1;
|
|
43
|
+
var slidesPerDot = rows * slidesPerRow;
|
|
44
|
+
var dotCount = Math.ceil(slidesCnt / slidesPerDot);
|
|
45
|
+
var currentDotIndex = editingSlide >= dotCount ? dotCount - 1 : editingSlide;
|
|
46
|
+
return {
|
|
47
|
+
currentDotIndex: currentDotIndex,
|
|
48
|
+
slidesPerDot: slidesPerDot,
|
|
49
|
+
dotCount: dotCount,
|
|
50
|
+
totalSlides: slidesCnt
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function CurrentSlideDropdown(_ref2) {
|
|
54
|
+
var componentProps = _ref2.componentProps,
|
|
55
|
+
studioOps = _ref2.studioOps;
|
|
56
|
+
var _getSlideInfo = getSlideInfo(componentProps),
|
|
57
|
+
dotCount = _getSlideInfo.dotCount,
|
|
58
|
+
currentDotIndex = _getSlideInfo.currentDotIndex;
|
|
28
59
|
var options = Array.from({
|
|
29
|
-
length:
|
|
60
|
+
length: dotCount
|
|
30
61
|
}, function (_, i) {
|
|
31
62
|
return i;
|
|
32
63
|
}).map(function (i) {
|
|
33
|
-
return React.createElement(
|
|
64
|
+
return React.createElement("option", {
|
|
65
|
+
key: i,
|
|
34
66
|
value: i.toString()
|
|
35
|
-
}, "Slide ", i
|
|
67
|
+
}, "Slide ", i);
|
|
36
68
|
});
|
|
37
|
-
var handleChange = function handleChange(
|
|
38
|
-
var slideIdx = Number(value);
|
|
69
|
+
var handleChange = function handleChange(e) {
|
|
39
70
|
studioOps.updateProps({
|
|
40
|
-
editingSlide:
|
|
71
|
+
editingSlide: Number(e.target.value)
|
|
41
72
|
});
|
|
42
73
|
};
|
|
43
74
|
return React.createElement("div", {
|
|
@@ -48,21 +79,21 @@ function CurrentSlideDropdown(_ref) {
|
|
|
48
79
|
gap: "10px",
|
|
49
80
|
justifyContent: "space-between"
|
|
50
81
|
}
|
|
51
|
-
}, React.createElement("div", null, "Current slide:"), React.createElement(
|
|
52
|
-
defaultValue:
|
|
82
|
+
}, React.createElement("div", null, "Current slide:"), React.createElement("select", {
|
|
83
|
+
defaultValue: currentDotIndex.toString(),
|
|
53
84
|
style: {
|
|
54
85
|
width: "100%"
|
|
55
86
|
},
|
|
56
87
|
onChange: handleChange,
|
|
57
|
-
value:
|
|
88
|
+
value: currentDotIndex.toString()
|
|
58
89
|
}, options));
|
|
59
90
|
}
|
|
60
|
-
function NavigateSlides(
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
91
|
+
function NavigateSlides(_ref3) {
|
|
92
|
+
var componentProps = _ref3.componentProps,
|
|
93
|
+
studioOps = _ref3.studioOps;
|
|
94
|
+
var _getSlideInfo2 = getSlideInfo(componentProps),
|
|
95
|
+
dotCount = _getSlideInfo2.dotCount,
|
|
96
|
+
currentDotIndex = _getSlideInfo2.currentDotIndex;
|
|
66
97
|
return React.createElement("div", {
|
|
67
98
|
style: {
|
|
68
99
|
width: "100%",
|
|
@@ -76,7 +107,7 @@ function NavigateSlides(_ref2) {
|
|
|
76
107
|
width: "100%"
|
|
77
108
|
},
|
|
78
109
|
onClick: function onClick() {
|
|
79
|
-
var prevSlide =
|
|
110
|
+
var prevSlide = currentDotIndex === 0 ? dotCount - 1 : (currentDotIndex - 1) % dotCount;
|
|
80
111
|
studioOps.updateProps({
|
|
81
112
|
editingSlide: prevSlide
|
|
82
113
|
});
|
|
@@ -86,7 +117,7 @@ function NavigateSlides(_ref2) {
|
|
|
86
117
|
width: "100%"
|
|
87
118
|
},
|
|
88
119
|
onClick: function onClick() {
|
|
89
|
-
var nextSlide = (
|
|
120
|
+
var nextSlide = (currentDotIndex + 1) % dotCount;
|
|
90
121
|
studioOps.updateProps({
|
|
91
122
|
editingSlide: nextSlide
|
|
92
123
|
});
|
|
@@ -96,11 +127,20 @@ function NavigateSlides(_ref2) {
|
|
|
96
127
|
function OutlineMessage() {
|
|
97
128
|
return React.createElement("div", null, "* To re-arrange slides, use the Outline panel");
|
|
98
129
|
}
|
|
130
|
+
var sliderHelpers = {
|
|
131
|
+
states: {
|
|
132
|
+
currentSlide: {
|
|
133
|
+
onChangeArgsToValue: function onChangeArgsToValue(_, newIndex) {
|
|
134
|
+
return newIndex;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
99
139
|
var sliderMeta = {
|
|
100
140
|
name: "hostless-slider",
|
|
101
141
|
displayName: "Slider Carousel",
|
|
102
|
-
importName: "
|
|
103
|
-
importPath: "react-slick",
|
|
142
|
+
importName: "SliderWrapper",
|
|
143
|
+
importPath: "@plasmicpkgs/react-slick",
|
|
104
144
|
description: "[See tutorial video](https://www.youtube.com/watch?v=GMgXLbNHX8c)",
|
|
105
145
|
actions: [{
|
|
106
146
|
type: "custom-action",
|
|
@@ -111,10 +151,14 @@ var sliderMeta = {
|
|
|
111
151
|
}, {
|
|
112
152
|
type: "button-action",
|
|
113
153
|
label: "Append new slide",
|
|
114
|
-
onClick: function onClick(
|
|
115
|
-
var componentProps =
|
|
116
|
-
studioOps =
|
|
117
|
-
var
|
|
154
|
+
onClick: function onClick(_ref4) {
|
|
155
|
+
var componentProps = _ref4.componentProps,
|
|
156
|
+
studioOps = _ref4.studioOps;
|
|
157
|
+
var _getSlideInfo3 = getSlideInfo(componentProps),
|
|
158
|
+
dotCount = _getSlideInfo3.dotCount,
|
|
159
|
+
slidesPerDot = _getSlideInfo3.slidesPerDot,
|
|
160
|
+
totalSlides = _getSlideInfo3.totalSlides;
|
|
161
|
+
var editingSlide = totalSlides % slidesPerDot ? dotCount - 1 : dotCount;
|
|
118
162
|
studioOps.appendToSlot({
|
|
119
163
|
type: "img",
|
|
120
164
|
src: "",
|
|
@@ -123,28 +167,78 @@ var sliderMeta = {
|
|
|
123
167
|
}
|
|
124
168
|
}, "children");
|
|
125
169
|
studioOps.updateProps({
|
|
126
|
-
editingSlide:
|
|
170
|
+
editingSlide: editingSlide
|
|
127
171
|
});
|
|
128
172
|
}
|
|
129
173
|
}, {
|
|
130
174
|
type: "button-action",
|
|
131
175
|
label: "Delete current slide",
|
|
132
|
-
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
var
|
|
176
|
+
hidden: function hidden(ps) {
|
|
177
|
+
var _ps$children;
|
|
178
|
+
return ((_ps$children = ps.children) == null || (_ps$children = _ps$children.type) == null ? void 0 : _ps$children.name) === "CanvasSlotPlaceholder";
|
|
179
|
+
},
|
|
180
|
+
onClick: function onClick(_ref5) {
|
|
181
|
+
var componentProps = _ref5.componentProps,
|
|
182
|
+
studioOps = _ref5.studioOps;
|
|
183
|
+
var _getSlideInfo4 = getSlideInfo(componentProps),
|
|
184
|
+
currentDotIndex = _getSlideInfo4.currentDotIndex,
|
|
185
|
+
dotCount = _getSlideInfo4.dotCount,
|
|
186
|
+
slidesPerDot = _getSlideInfo4.slidesPerDot,
|
|
187
|
+
totalSlides = _getSlideInfo4.totalSlides;
|
|
188
|
+
studioOps.removeFromSlotAt(currentDotIndex * slidesPerDot, "children");
|
|
189
|
+
var newPos = currentDotIndex;
|
|
190
|
+
if (dotCount === 1) {
|
|
191
|
+
// not the only dot
|
|
192
|
+
newPos = 0;
|
|
193
|
+
} else if (currentDotIndex !== dotCount - 1) {
|
|
194
|
+
// not the last dot
|
|
195
|
+
if (slidesPerDot === 1) {
|
|
196
|
+
newPos = currentDotIndex - 1;
|
|
197
|
+
} else {
|
|
198
|
+
newPos = currentDotIndex;
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
// the last dot
|
|
202
|
+
newPos = totalSlides % slidesPerDot === 1 ? currentDotIndex - 1 : currentDotIndex;
|
|
203
|
+
}
|
|
140
204
|
studioOps.updateProps({
|
|
141
|
-
editingSlide:
|
|
205
|
+
editingSlide: newPos
|
|
142
206
|
});
|
|
143
207
|
}
|
|
144
208
|
}, {
|
|
145
209
|
type: "custom-action",
|
|
146
210
|
control: OutlineMessage
|
|
147
211
|
}],
|
|
212
|
+
refActions: {
|
|
213
|
+
slickGoTo: {
|
|
214
|
+
displayName: "Jump to slide",
|
|
215
|
+
argTypes: [{
|
|
216
|
+
name: "index",
|
|
217
|
+
displayName: "Slide index",
|
|
218
|
+
type: "number"
|
|
219
|
+
}, {
|
|
220
|
+
name: "dontAnimate",
|
|
221
|
+
displayName: "Animate?",
|
|
222
|
+
type: "boolean"
|
|
223
|
+
}]
|
|
224
|
+
},
|
|
225
|
+
slickNext: {
|
|
226
|
+
displayName: "Go to Next slide",
|
|
227
|
+
argTypes: []
|
|
228
|
+
},
|
|
229
|
+
slickPause: {
|
|
230
|
+
displayName: "Pause",
|
|
231
|
+
argTypes: []
|
|
232
|
+
},
|
|
233
|
+
slickPlay: {
|
|
234
|
+
displayName: "Play",
|
|
235
|
+
argTypes: []
|
|
236
|
+
},
|
|
237
|
+
slickPrev: {
|
|
238
|
+
displayName: "Go to Previous slide",
|
|
239
|
+
argTypes: []
|
|
240
|
+
}
|
|
241
|
+
},
|
|
148
242
|
props: {
|
|
149
243
|
children: {
|
|
150
244
|
type: "slot",
|
|
@@ -166,6 +260,7 @@ var sliderMeta = {
|
|
|
166
260
|
type: "number",
|
|
167
261
|
description: "Switch to the specified slide (first is 0). Only affects the editor, not the final page.",
|
|
168
262
|
defaultValueHint: 0,
|
|
263
|
+
defaultValue: 0,
|
|
169
264
|
editOnly: true,
|
|
170
265
|
hidden: function hidden() {
|
|
171
266
|
return true;
|
|
@@ -191,6 +286,18 @@ var sliderMeta = {
|
|
|
191
286
|
description: "Show next/prev arrows",
|
|
192
287
|
defaultValueHint: true
|
|
193
288
|
},
|
|
289
|
+
sliderScopeClassName: {
|
|
290
|
+
type: "styleScopeClass",
|
|
291
|
+
scopeName: "slider"
|
|
292
|
+
},
|
|
293
|
+
arrowColor: {
|
|
294
|
+
type: "color",
|
|
295
|
+
description: "Color of next/prev arrow buttons",
|
|
296
|
+
defaultValueHint: "#000000",
|
|
297
|
+
hidden: function hidden(ps) {
|
|
298
|
+
return ps.arrows === undefined ? false : !ps.arrows;
|
|
299
|
+
}
|
|
300
|
+
},
|
|
194
301
|
autoplay: {
|
|
195
302
|
displayName: "Auto Play",
|
|
196
303
|
type: "boolean",
|
|
@@ -276,8 +383,9 @@ var sliderMeta = {
|
|
|
276
383
|
initialSlide: {
|
|
277
384
|
displayName: "Initial Slide",
|
|
278
385
|
type: "number",
|
|
279
|
-
description: "Index of
|
|
280
|
-
defaultValueHint: 0
|
|
386
|
+
description: "Index of the first visible slide (first is 0), accounting for multiple slides per view if applicable.",
|
|
387
|
+
defaultValueHint: 0,
|
|
388
|
+
defaultValue: 0
|
|
281
389
|
},
|
|
282
390
|
lazyLoad: {
|
|
283
391
|
advanced: true,
|
|
@@ -410,31 +518,115 @@ var sliderMeta = {
|
|
|
410
518
|
type: "boolean",
|
|
411
519
|
description: "Vertical slide mode",
|
|
412
520
|
defaultValueHint: false
|
|
521
|
+
},
|
|
522
|
+
beforeChange: {
|
|
523
|
+
type: "eventHandler",
|
|
524
|
+
advanced: true,
|
|
525
|
+
argTypes: [{
|
|
526
|
+
name: "currentSlide",
|
|
527
|
+
type: "number"
|
|
528
|
+
}]
|
|
413
529
|
}
|
|
414
530
|
},
|
|
415
|
-
|
|
531
|
+
states: {
|
|
532
|
+
currentSlide: /*#__PURE__*/_extends({
|
|
533
|
+
type: "writable",
|
|
534
|
+
valueProp: "editingSlide",
|
|
535
|
+
onChangeProp: "beforeChange",
|
|
536
|
+
variableType: "number"
|
|
537
|
+
}, sliderHelpers.states.currentSlide)
|
|
538
|
+
},
|
|
539
|
+
componentHelpers: {
|
|
540
|
+
helpers: sliderHelpers,
|
|
541
|
+
importName: "sliderHelpers",
|
|
542
|
+
importPath: "@plasmicpkgs/react-slick"
|
|
543
|
+
},
|
|
416
544
|
defaultStyles: {
|
|
417
545
|
width: "stretch",
|
|
418
546
|
maxWidth: "100%",
|
|
419
547
|
flexDirection: "column"
|
|
420
548
|
}
|
|
421
549
|
};
|
|
422
|
-
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
550
|
+
function useDebounce(value, delay) {
|
|
551
|
+
var _useState = useState(value),
|
|
552
|
+
debouncedValue = _useState[0],
|
|
553
|
+
setDebouncedValue = _useState[1];
|
|
554
|
+
useEffect(function () {
|
|
555
|
+
var timer = setTimeout(function () {
|
|
556
|
+
return setDebouncedValue(value);
|
|
557
|
+
}, delay || 500);
|
|
558
|
+
return function () {
|
|
559
|
+
clearTimeout(timer);
|
|
560
|
+
};
|
|
561
|
+
}, [value, delay]);
|
|
562
|
+
return debouncedValue;
|
|
563
|
+
}
|
|
564
|
+
var SliderWrapper = /*#__PURE__*/forwardRef(function SliderWrapper_(props, userRef) {
|
|
565
|
+
var editingSlide = props.editingSlide,
|
|
566
|
+
initialSlide = props.initialSlide,
|
|
567
|
+
arrowColor = props.arrowColor,
|
|
568
|
+
className = props.className,
|
|
569
|
+
sliderScopeClassName = props.sliderScopeClassName,
|
|
570
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
571
|
+
// "data-plasmic-canvas-envs" prop only exists in studio canvas
|
|
572
|
+
var isEditMode = props["data-plasmic-canvas-envs"] ? true : false;
|
|
429
573
|
var slider = useRef(null);
|
|
574
|
+
var debouncedEditingSlide = useDebounce(editingSlide);
|
|
430
575
|
useEffect(function () {
|
|
431
|
-
if (
|
|
432
|
-
|
|
576
|
+
if (debouncedEditingSlide !== undefined && isEditMode) {
|
|
577
|
+
var _slider$current;
|
|
578
|
+
(_slider$current = slider.current) == null || _slider$current.slickGoTo(debouncedEditingSlide);
|
|
579
|
+
}
|
|
580
|
+
}, [debouncedEditingSlide, isEditMode]);
|
|
581
|
+
useEffect(function () {
|
|
582
|
+
var _slider$current2;
|
|
583
|
+
// passing the initialSlide prop directly to <Slider> does not work when inifinite: true and slidesPerRow: 3. So usingSlickGoTo instead
|
|
584
|
+
if (initialSlide === undefined) return;
|
|
585
|
+
(_slider$current2 = slider.current) == null || _slider$current2.slickGoTo(initialSlide, true);
|
|
586
|
+
}, [initialSlide]);
|
|
587
|
+
React.useImperativeHandle(userRef, function () {
|
|
588
|
+
return {
|
|
589
|
+
slickGoTo: function slickGoTo(index, dontAnimate) {
|
|
590
|
+
if (slider.current) {
|
|
591
|
+
var slickGoTo = slider.current.slickGoTo;
|
|
592
|
+
slickGoTo(index, dontAnimate);
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
slickNext: function slickNext() {
|
|
596
|
+
if (slider.current) {
|
|
597
|
+
var slickNext = slider.current.slickNext;
|
|
598
|
+
slickNext();
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
slickPause: function slickPause() {
|
|
602
|
+
if (slider.current) {
|
|
603
|
+
var slickPause = slider.current.slickPause;
|
|
604
|
+
slickPause();
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
slickPlay: function slickPlay() {
|
|
608
|
+
if (slider.current) {
|
|
609
|
+
var slickPlay = slider.current.slickPlay;
|
|
610
|
+
slickPlay();
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
slickPrev: function slickPrev() {
|
|
614
|
+
if (slider.current) {
|
|
615
|
+
var slickPrev = slider.current.slickPrev;
|
|
616
|
+
slickPrev();
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
}, []);
|
|
621
|
+
var css = "\n ." + sliderScopeClassName + " .slick-arrow:before {\n color: " + (arrowColor != null ? arrowColor : "black") + ";\n }\n ";
|
|
622
|
+
return React.createElement(React.Fragment, null, React.createElement(Slider, Object.assign({
|
|
623
|
+
className: className + " " + sliderScopeClassName,
|
|
624
|
+
ref: slider
|
|
625
|
+
}, rest)), React.createElement("style", {
|
|
626
|
+
dangerouslySetInnerHTML: {
|
|
627
|
+
__html: css
|
|
433
628
|
}
|
|
434
|
-
}
|
|
435
|
-
return React.createElement(Slider, Object.assign({
|
|
436
|
-
ref: composeRefs(slider, userRef)
|
|
437
|
-
}, props));
|
|
629
|
+
}));
|
|
438
630
|
});
|
|
439
631
|
function registerSlider(loader, customSliderMeta) {
|
|
440
632
|
if (loader) {
|
|
@@ -444,5 +636,5 @@ function registerSlider(loader, customSliderMeta) {
|
|
|
444
636
|
}
|
|
445
637
|
}
|
|
446
638
|
|
|
447
|
-
export { SliderWrapper, registerSlider, sliderMeta };
|
|
639
|
+
export { SliderWrapper, registerSlider, sliderHelpers, sliderMeta, useDebounce };
|
|
448
640
|
//# sourceMappingURL=react-slick.esm.js.map
|