@weaverse/react 1.0.3 → 1.0.4

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 CHANGED
@@ -17,6 +17,8 @@ declare let CircleNotch: (props: HTMLAttributes<SVGElement>) => JSX.Element;
17
17
  declare let X: (props: HTMLAttributes<SVGElement>) => JSX.Element;
18
18
  declare let Minus: (props: HTMLAttributes<SVGElement>) => JSX.Element;
19
19
  declare let Plus: (props: HTMLAttributes<SVGElement>) => JSX.Element;
20
+ declare let CaretLeft: (props: HTMLAttributes<SVGElement>) => JSX.Element;
21
+ declare let CaretRight: (props: HTMLAttributes<SVGElement>) => JSX.Element;
20
22
  declare let ArrowLeft: (props: HTMLAttributes<SVGElement>) => JSX.Element;
21
23
  declare let ArrowRight: (props: HTMLAttributes<SVGElement>) => JSX.Element;
22
24
  declare let Image: (props: HTMLAttributes<SVGElement>) => JSX.Element;
@@ -31,6 +33,8 @@ declare const PhosphorIcons_CircleNotch: typeof CircleNotch;
31
33
  declare const PhosphorIcons_X: typeof X;
32
34
  declare const PhosphorIcons_Minus: typeof Minus;
33
35
  declare const PhosphorIcons_Plus: typeof Plus;
36
+ declare const PhosphorIcons_CaretLeft: typeof CaretLeft;
37
+ declare const PhosphorIcons_CaretRight: typeof CaretRight;
34
38
  declare const PhosphorIcons_ArrowLeft: typeof ArrowLeft;
35
39
  declare const PhosphorIcons_ArrowRight: typeof ArrowRight;
36
40
  declare const PhosphorIcons_Image: typeof Image;
@@ -46,6 +50,8 @@ declare namespace PhosphorIcons {
46
50
  PhosphorIcons_X as X,
47
51
  PhosphorIcons_Minus as Minus,
48
52
  PhosphorIcons_Plus as Plus,
53
+ PhosphorIcons_CaretLeft as CaretLeft,
54
+ PhosphorIcons_CaretRight as CaretRight,
49
55
  PhosphorIcons_ArrowLeft as ArrowLeft,
50
56
  PhosphorIcons_ArrowRight as ArrowRight,
51
57
  PhosphorIcons_Image as Image,
@@ -80,6 +86,7 @@ interface SliderArrowsProps {
80
86
  currentSlide: number;
81
87
  instanceRef: React.MutableRefObject<KeenSliderInstance | null>;
82
88
  offset: number;
89
+ icon: 'caret' | 'arrow';
83
90
  className?: string;
84
91
  }
85
92
  interface SliderDotsProps {
@@ -286,6 +293,9 @@ interface SlideshowProps extends WeaverseElementProps {
286
293
  slidesPerView: number;
287
294
  spacing: number;
288
295
  showArrows: boolean;
296
+ showArrowsOnHover: boolean;
297
+ arrowIcon: 'caret' | 'arrow';
298
+ arrowsColor: 'light' | 'dark';
289
299
  showDots: boolean;
290
300
  dotsPosition: 'top' | 'bottom' | 'left' | 'right';
291
301
  dotsColor: 'light' | 'dark';
package/dist/index.js CHANGED
@@ -82,6 +82,8 @@ var css = {
82
82
  backgroundColor: "#393e46",
83
83
  color: "#fff",
84
84
  fontSize: "14px",
85
+ lineHeight: "1.5",
86
+ letterSpacing: "0",
85
87
  fontWeight: "medium",
86
88
  padding: "10px 20px",
87
89
  height: "42px",
@@ -513,7 +515,9 @@ var css7 = {
513
515
  all: "inherit",
514
516
  margin: "0",
515
517
  wordBreak: "break-word",
516
- overflowWrap: "break-word"
518
+ overflowWrap: "break-word",
519
+ width: "auto",
520
+ height: "auto"
517
521
  }
518
522
  }
519
523
  }
@@ -642,6 +646,8 @@ __export(phosphor_exports, {
642
646
  ArrowLeft: () => ArrowLeft,
643
647
  ArrowRight: () => ArrowRight,
644
648
  Backpack: () => Backpack,
649
+ CaretLeft: () => CaretLeft,
650
+ CaretRight: () => CaretRight,
645
651
  CircleNotch: () => CircleNotch,
646
652
  Eye: () => Eye,
647
653
  Image: () => Image2,
@@ -756,6 +762,56 @@ var Plus = (props) => {
756
762
  /* @__PURE__ */ import_react14.default.createElement("path", { d: "M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z" })
757
763
  );
758
764
  };
765
+ var CaretLeft = (props) => {
766
+ return /* @__PURE__ */ import_react14.default.createElement(
767
+ "svg",
768
+ {
769
+ xmlns: "http://www.w3.org/2000/svg",
770
+ width: "192",
771
+ height: "192",
772
+ fill: "currentColor",
773
+ viewBox: "0 0 256 256",
774
+ ...props
775
+ },
776
+ /* @__PURE__ */ import_react14.default.createElement("rect", { width: "256", height: "256", fill: "none" }),
777
+ /* @__PURE__ */ import_react14.default.createElement(
778
+ "polyline",
779
+ {
780
+ points: "160 208 80 128 160 48",
781
+ fill: "none",
782
+ stroke: "currentColor",
783
+ strokeLinecap: "round",
784
+ strokeLinejoin: "round",
785
+ strokeWidth: "16"
786
+ }
787
+ )
788
+ );
789
+ };
790
+ var CaretRight = (props) => {
791
+ return /* @__PURE__ */ import_react14.default.createElement(
792
+ "svg",
793
+ {
794
+ xmlns: "http://www.w3.org/2000/svg",
795
+ width: "192",
796
+ height: "192",
797
+ fill: "currentColor",
798
+ viewBox: "0 0 256 256",
799
+ ...props
800
+ },
801
+ /* @__PURE__ */ import_react14.default.createElement("rect", { width: "256", height: "256", fill: "none" }),
802
+ /* @__PURE__ */ import_react14.default.createElement(
803
+ "polyline",
804
+ {
805
+ points: "96 48 176 128 96 208",
806
+ fill: "none",
807
+ stroke: "currentColor",
808
+ strokeLinecap: "round",
809
+ strokeLinejoin: "round",
810
+ strokeWidth: "16"
811
+ }
812
+ )
813
+ );
814
+ };
759
815
  var ArrowLeft = (props) => {
760
816
  return /* @__PURE__ */ import_react14.default.createElement(
761
817
  "svg",
@@ -1241,7 +1297,7 @@ function Icon({ name, className, ...props }) {
1241
1297
 
1242
1298
  // src/components/slider/arrows.tsx
1243
1299
  function Arrows(props) {
1244
- let { currentSlide, instanceRef, className, offset } = props;
1300
+ let { currentSlide, instanceRef, className, icon, offset } = props;
1245
1301
  let isFirst = currentSlide === 0;
1246
1302
  let isLast = false;
1247
1303
  if (instanceRef.current) {
@@ -1260,7 +1316,7 @@ function Arrows(props) {
1260
1316
  instanceRef?.current?.prev();
1261
1317
  }
1262
1318
  },
1263
- /* @__PURE__ */ import_react17.default.createElement(Icon, { name: "ArrowLeft" })
1319
+ /* @__PURE__ */ import_react17.default.createElement(Icon, { name: icon === "caret" ? "CaretLeft" : "ArrowLeft" })
1264
1320
  ), /* @__PURE__ */ import_react17.default.createElement(
1265
1321
  "button",
1266
1322
  {
@@ -1271,7 +1327,7 @@ function Arrows(props) {
1271
1327
  instanceRef?.current?.next();
1272
1328
  }
1273
1329
  },
1274
- /* @__PURE__ */ import_react17.default.createElement(Icon, { name: "ArrowRight" })
1330
+ /* @__PURE__ */ import_react17.default.createElement(Icon, { name: icon === "caret" ? "CaretRight" : "ArrowRight" })
1275
1331
  ));
1276
1332
  }
1277
1333
  var StyledArrows = (0, import_react16.styled)("div", {
@@ -1505,7 +1561,7 @@ function useSlideshowConfigs(props) {
1505
1561
  }
1506
1562
  let [sliderRef, instanceRef] = (0, import_react20.useKeenSlider)(
1507
1563
  {
1508
- slides: animation === "fade" ? import_react21.default.Children.count(children) : { perView: slidesPerView },
1564
+ slides: animation === "fade" ? import_react21.default.Children.count(children) : { perView: slidesPerView, number: import_react21.default.Children.count(children) },
1509
1565
  drag: isPreviewMode || !isDesignMode,
1510
1566
  loop,
1511
1567
  selector: animation === "fade" ? null : ".keen-slider__slide",
@@ -1561,6 +1617,9 @@ var Slideshow = (0, import_react23.forwardRef)((props, ref) => {
1561
1617
  let {
1562
1618
  animation,
1563
1619
  showArrows,
1620
+ showArrowsOnHover,
1621
+ arrowIcon,
1622
+ arrowsColor,
1564
1623
  showDots,
1565
1624
  dotsPosition,
1566
1625
  dotsColor,
@@ -1586,12 +1645,18 @@ var Slideshow = (0, import_react23.forwardRef)((props, ref) => {
1586
1645
  faderClass,
1587
1646
  animation === "slide" ? "keen-slider" : "keen-fader"
1588
1647
  );
1648
+ let arrowsClass = (0, import_clsx5.default)(
1649
+ "wv-slideshow--arrows",
1650
+ showArrowsOnHover && "show-on-hover",
1651
+ `arrows--${arrowsColor}`
1652
+ );
1589
1653
  return /* @__PURE__ */ import_react23.default.createElement("div", { ref, style, ...rest }, /* @__PURE__ */ import_react23.default.createElement("div", { ref: sliderRef, className: _className }, children), showArrows && created && instanceRef?.current && /* @__PURE__ */ import_react23.default.createElement(
1590
1654
  Arrows,
1591
1655
  {
1592
1656
  instanceRef,
1593
1657
  currentSlide,
1594
- className: "wv-slideshow--arrows",
1658
+ className: arrowsClass,
1659
+ icon: arrowIcon,
1595
1660
  offset: 20
1596
1661
  }
1597
1662
  ), showDots && created && instanceRef?.current && /* @__PURE__ */ import_react23.default.createElement(
@@ -1621,6 +1686,39 @@ var css9 = {
1621
1686
  position: "absolute",
1622
1687
  inset: 0
1623
1688
  }
1689
+ },
1690
+ ".wv-slideshow--arrows": {
1691
+ ".arrow": {
1692
+ borderRadius: "100%",
1693
+ backgroundColor: "transparent",
1694
+ padding: "6px",
1695
+ "&:hover": {
1696
+ backgroundColor: "#fff"
1697
+ },
1698
+ svg: {
1699
+ width: "28px",
1700
+ height: "28px"
1701
+ }
1702
+ },
1703
+ "&.show-on-hover": {
1704
+ opacity: 0,
1705
+ transition: "opacity 0.3s ease"
1706
+ },
1707
+ "&.arrows--dark": {
1708
+ ".arrow": {
1709
+ color: "#000"
1710
+ }
1711
+ },
1712
+ "&.arrows--light": {
1713
+ ".arrow": {
1714
+ color: "#fff"
1715
+ }
1716
+ }
1717
+ },
1718
+ "&:hover": {
1719
+ ".wv-slideshow--arrows": {
1720
+ opacity: 1
1721
+ }
1624
1722
  }
1625
1723
  }
1626
1724
  };
@@ -1629,9 +1727,12 @@ Slideshow.defaultProps = {
1629
1727
  slidesPerView: 1,
1630
1728
  spacing: 0,
1631
1729
  showArrows: true,
1730
+ showArrowsOnHover: false,
1731
+ arrowIcon: "caret",
1732
+ arrowsColor: "dark",
1632
1733
  showDots: true,
1633
1734
  dotsPosition: "bottom",
1634
- dotsColor: "light",
1735
+ dotsColor: "dark",
1635
1736
  loop: true,
1636
1737
  autoRotate: false,
1637
1738
  changeSlidesEvery: 5
@@ -2171,7 +2272,8 @@ function Slider(props) {
2171
2272
  currentSlide,
2172
2273
  instanceRef,
2173
2274
  className: arrowsClass,
2174
- offset: arrowOffset
2275
+ offset: arrowOffset,
2276
+ icon: "arrow"
2175
2277
  }
2176
2278
  ));
2177
2279
  }
package/dist/index.mjs CHANGED
@@ -46,6 +46,8 @@ var css = {
46
46
  backgroundColor: "#393e46",
47
47
  color: "#fff",
48
48
  fontSize: "14px",
49
+ lineHeight: "1.5",
50
+ letterSpacing: "0",
49
51
  fontWeight: "medium",
50
52
  padding: "10px 20px",
51
53
  height: "42px",
@@ -477,7 +479,9 @@ var css7 = {
477
479
  all: "inherit",
478
480
  margin: "0",
479
481
  wordBreak: "break-word",
480
- overflowWrap: "break-word"
482
+ overflowWrap: "break-word",
483
+ width: "auto",
484
+ height: "auto"
481
485
  }
482
486
  }
483
487
  }
@@ -606,6 +610,8 @@ __export(phosphor_exports, {
606
610
  ArrowLeft: () => ArrowLeft,
607
611
  ArrowRight: () => ArrowRight,
608
612
  Backpack: () => Backpack,
613
+ CaretLeft: () => CaretLeft,
614
+ CaretRight: () => CaretRight,
609
615
  CircleNotch: () => CircleNotch,
610
616
  Eye: () => Eye,
611
617
  Image: () => Image2,
@@ -720,6 +726,56 @@ var Plus = (props) => {
720
726
  /* @__PURE__ */ React15.createElement("path", { d: "M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z" })
721
727
  );
722
728
  };
729
+ var CaretLeft = (props) => {
730
+ return /* @__PURE__ */ React15.createElement(
731
+ "svg",
732
+ {
733
+ xmlns: "http://www.w3.org/2000/svg",
734
+ width: "192",
735
+ height: "192",
736
+ fill: "currentColor",
737
+ viewBox: "0 0 256 256",
738
+ ...props
739
+ },
740
+ /* @__PURE__ */ React15.createElement("rect", { width: "256", height: "256", fill: "none" }),
741
+ /* @__PURE__ */ React15.createElement(
742
+ "polyline",
743
+ {
744
+ points: "160 208 80 128 160 48",
745
+ fill: "none",
746
+ stroke: "currentColor",
747
+ strokeLinecap: "round",
748
+ strokeLinejoin: "round",
749
+ strokeWidth: "16"
750
+ }
751
+ )
752
+ );
753
+ };
754
+ var CaretRight = (props) => {
755
+ return /* @__PURE__ */ React15.createElement(
756
+ "svg",
757
+ {
758
+ xmlns: "http://www.w3.org/2000/svg",
759
+ width: "192",
760
+ height: "192",
761
+ fill: "currentColor",
762
+ viewBox: "0 0 256 256",
763
+ ...props
764
+ },
765
+ /* @__PURE__ */ React15.createElement("rect", { width: "256", height: "256", fill: "none" }),
766
+ /* @__PURE__ */ React15.createElement(
767
+ "polyline",
768
+ {
769
+ points: "96 48 176 128 96 208",
770
+ fill: "none",
771
+ stroke: "currentColor",
772
+ strokeLinecap: "round",
773
+ strokeLinejoin: "round",
774
+ strokeWidth: "16"
775
+ }
776
+ )
777
+ );
778
+ };
723
779
  var ArrowLeft = (props) => {
724
780
  return /* @__PURE__ */ React15.createElement(
725
781
  "svg",
@@ -1205,7 +1261,7 @@ function Icon({ name, className, ...props }) {
1205
1261
 
1206
1262
  // src/components/slider/arrows.tsx
1207
1263
  function Arrows(props) {
1208
- let { currentSlide, instanceRef, className, offset } = props;
1264
+ let { currentSlide, instanceRef, className, icon, offset } = props;
1209
1265
  let isFirst = currentSlide === 0;
1210
1266
  let isLast = false;
1211
1267
  if (instanceRef.current) {
@@ -1224,7 +1280,7 @@ function Arrows(props) {
1224
1280
  instanceRef?.current?.prev();
1225
1281
  }
1226
1282
  },
1227
- /* @__PURE__ */ React17.createElement(Icon, { name: "ArrowLeft" })
1283
+ /* @__PURE__ */ React17.createElement(Icon, { name: icon === "caret" ? "CaretLeft" : "ArrowLeft" })
1228
1284
  ), /* @__PURE__ */ React17.createElement(
1229
1285
  "button",
1230
1286
  {
@@ -1235,7 +1291,7 @@ function Arrows(props) {
1235
1291
  instanceRef?.current?.next();
1236
1292
  }
1237
1293
  },
1238
- /* @__PURE__ */ React17.createElement(Icon, { name: "ArrowRight" })
1294
+ /* @__PURE__ */ React17.createElement(Icon, { name: icon === "caret" ? "CaretRight" : "ArrowRight" })
1239
1295
  ));
1240
1296
  }
1241
1297
  var StyledArrows = styled("div", {
@@ -1469,7 +1525,7 @@ function useSlideshowConfigs(props) {
1469
1525
  }
1470
1526
  let [sliderRef, instanceRef] = useKeenSlider(
1471
1527
  {
1472
- slides: animation === "fade" ? React19.Children.count(children) : { perView: slidesPerView },
1528
+ slides: animation === "fade" ? React19.Children.count(children) : { perView: slidesPerView, number: React19.Children.count(children) },
1473
1529
  drag: isPreviewMode || !isDesignMode,
1474
1530
  loop,
1475
1531
  selector: animation === "fade" ? null : ".keen-slider__slide",
@@ -1525,6 +1581,9 @@ var Slideshow = forwardRef8((props, ref) => {
1525
1581
  let {
1526
1582
  animation,
1527
1583
  showArrows,
1584
+ showArrowsOnHover,
1585
+ arrowIcon,
1586
+ arrowsColor,
1528
1587
  showDots,
1529
1588
  dotsPosition,
1530
1589
  dotsColor,
@@ -1550,12 +1609,18 @@ var Slideshow = forwardRef8((props, ref) => {
1550
1609
  faderClass,
1551
1610
  animation === "slide" ? "keen-slider" : "keen-fader"
1552
1611
  );
1612
+ let arrowsClass = clsx5(
1613
+ "wv-slideshow--arrows",
1614
+ showArrowsOnHover && "show-on-hover",
1615
+ `arrows--${arrowsColor}`
1616
+ );
1553
1617
  return /* @__PURE__ */ React20.createElement("div", { ref, style, ...rest }, /* @__PURE__ */ React20.createElement("div", { ref: sliderRef, className: _className }, children), showArrows && created && instanceRef?.current && /* @__PURE__ */ React20.createElement(
1554
1618
  Arrows,
1555
1619
  {
1556
1620
  instanceRef,
1557
1621
  currentSlide,
1558
- className: "wv-slideshow--arrows",
1622
+ className: arrowsClass,
1623
+ icon: arrowIcon,
1559
1624
  offset: 20
1560
1625
  }
1561
1626
  ), showDots && created && instanceRef?.current && /* @__PURE__ */ React20.createElement(
@@ -1585,6 +1650,39 @@ var css9 = {
1585
1650
  position: "absolute",
1586
1651
  inset: 0
1587
1652
  }
1653
+ },
1654
+ ".wv-slideshow--arrows": {
1655
+ ".arrow": {
1656
+ borderRadius: "100%",
1657
+ backgroundColor: "transparent",
1658
+ padding: "6px",
1659
+ "&:hover": {
1660
+ backgroundColor: "#fff"
1661
+ },
1662
+ svg: {
1663
+ width: "28px",
1664
+ height: "28px"
1665
+ }
1666
+ },
1667
+ "&.show-on-hover": {
1668
+ opacity: 0,
1669
+ transition: "opacity 0.3s ease"
1670
+ },
1671
+ "&.arrows--dark": {
1672
+ ".arrow": {
1673
+ color: "#000"
1674
+ }
1675
+ },
1676
+ "&.arrows--light": {
1677
+ ".arrow": {
1678
+ color: "#fff"
1679
+ }
1680
+ }
1681
+ },
1682
+ "&:hover": {
1683
+ ".wv-slideshow--arrows": {
1684
+ opacity: 1
1685
+ }
1588
1686
  }
1589
1687
  }
1590
1688
  };
@@ -1593,9 +1691,12 @@ Slideshow.defaultProps = {
1593
1691
  slidesPerView: 1,
1594
1692
  spacing: 0,
1595
1693
  showArrows: true,
1694
+ showArrowsOnHover: false,
1695
+ arrowIcon: "caret",
1696
+ arrowsColor: "dark",
1596
1697
  showDots: true,
1597
1698
  dotsPosition: "bottom",
1598
- dotsColor: "light",
1699
+ dotsColor: "dark",
1599
1700
  loop: true,
1600
1701
  autoRotate: false,
1601
1702
  changeSlidesEvery: 5
@@ -2135,7 +2236,8 @@ function Slider(props) {
2135
2236
  currentSlide,
2136
2237
  instanceRef,
2137
2238
  className: arrowsClass,
2138
- offset: arrowOffset
2239
+ offset: arrowOffset,
2240
+ icon: "arrow"
2139
2241
  }
2140
2242
  ));
2141
2243
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.3",
2
+ "version": "1.0.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@radix-ui/react-dialog": "^1.0.2",
36
36
  "@stitches/react": "^1.2.8",
37
- "@weaverse/core": "1.0.3",
37
+ "@weaverse/core": "1.0.4",
38
38
  "clsx": "^1.2.1",
39
39
  "keen-slider": "^6.8.5"
40
40
  }