@helpdice/ui 1.7.7 → 1.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/breadcrumbs/index.js +10 -7
  2. package/dist/card/index.js +10 -7
  3. package/dist/carousal/CSSTranslate.d.ts +2 -0
  4. package/dist/carousal/component/Arrow.d.ts +9 -0
  5. package/dist/carousal/component/Indicator.d.ts +9 -0
  6. package/dist/carousal/component/Thumbs.d.ts +65 -0
  7. package/dist/carousal/component/animations.d.ts +27 -0
  8. package/dist/carousal/component/index.d.ts +87 -0
  9. package/dist/carousal/component/types.d.ts +79 -0
  10. package/dist/carousal/component/utils.d.ts +15 -0
  11. package/dist/carousal/cssClasses.d.ts +11 -0
  12. package/dist/carousal/dimensions.d.ts +1 -0
  13. package/dist/carousal/index.d.ts +3 -0
  14. package/dist/carousal/index.js +13166 -0
  15. package/dist/carousal/shims/document.d.ts +2 -0
  16. package/dist/carousal/shims/window.d.ts +2 -0
  17. package/dist/image/index.js +10 -7
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.js +2794 -197
  20. package/dist/link/index.js +10 -7
  21. package/dist/link/link.d.ts +2 -1
  22. package/dist/swipe/index.d.ts +4 -0
  23. package/dist/swipe/index.js +1314 -0
  24. package/dist/swipe/react-swipe.d.ts +58 -0
  25. package/dist/user/index.js +10 -7
  26. package/esm/carousal/CSSTranslate.d.ts +2 -0
  27. package/esm/carousal/CSSTranslate.js +7 -0
  28. package/esm/carousal/component/Arrow.d.ts +9 -0
  29. package/esm/carousal/component/Arrow.js +21 -0
  30. package/esm/carousal/component/Indicator.d.ts +9 -0
  31. package/esm/carousal/component/Indicator.js +23 -0
  32. package/esm/carousal/component/Thumbs.d.ts +65 -0
  33. package/esm/carousal/{Thumbs.js → component/Thumbs.js} +41 -12
  34. package/esm/carousal/component/animations.d.ts +27 -0
  35. package/esm/carousal/{animations.js → component/animations.js} +1 -1
  36. package/esm/carousal/component/index.d.ts +87 -0
  37. package/esm/carousal/component/index.js +698 -0
  38. package/esm/carousal/component/types.d.ts +79 -0
  39. package/esm/carousal/component/utils.d.ts +15 -0
  40. package/esm/carousal/{utils.js → component/utils.js} +1 -1
  41. package/esm/carousal/cssClasses.d.ts +11 -0
  42. package/esm/carousal/cssClasses.js +56 -0
  43. package/esm/carousal/dimensions.d.ts +1 -0
  44. package/esm/carousal/dimensions.js +6 -0
  45. package/esm/carousal/index.d.ts +3 -0
  46. package/esm/carousal/index.js +2 -683
  47. package/esm/carousal/main.js +59 -0
  48. package/esm/carousal/shims/document.d.ts +2 -0
  49. package/esm/carousal/shims/document.js +3 -0
  50. package/esm/carousal/shims/window.d.ts +2 -0
  51. package/esm/carousal/shims/window.js +3 -0
  52. package/esm/index.d.ts +4 -0
  53. package/esm/index.js +6 -1
  54. package/esm/link/link.d.ts +2 -1
  55. package/esm/link/link.js +10 -7
  56. package/esm/login-with/index.js +0 -2
  57. package/esm/swipe/demo.js +57 -0
  58. package/esm/swipe/index.d.ts +4 -0
  59. package/esm/swipe/index.js +2 -0
  60. package/esm/swipe/react-swipe.d.ts +58 -0
  61. package/esm/swipe/react-swipe.js +246 -0
  62. package/package.json +4 -3
  63. package/esm/carousal/Arrow.js +0 -18
  64. package/esm/carousal/Indicator.js +0 -20
  65. /package/esm/carousal/{types.js → component/types.js} +0 -0
@@ -3103,7 +3103,7 @@ var LinkIconComponent = function LinkIconComponent() {
3103
3103
  LinkIconComponent.displayName = 'LinkIcon';
3104
3104
  var LinkIcon = /*#__PURE__*/React.memo(LinkIconComponent);
3105
3105
 
3106
- var _excluded$1 = ["href", "showColor", "underline", "children", "className", "block", "icon"];
3106
+ var _excluded$1 = ["href", "showColor", "underline", "children", "className", "block", "arrow", "icon"];
3107
3107
  var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3108
3108
  var _ref$href = _ref.href,
3109
3109
  href = _ref$href === void 0 ? '' : _ref$href,
@@ -3116,8 +3116,9 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3116
3116
  className = _ref$className === void 0 ? '' : _ref$className,
3117
3117
  _ref$block = _ref.block,
3118
3118
  block = _ref$block === void 0 ? false : _ref$block,
3119
- _ref$icon = _ref.icon,
3120
- icon = _ref$icon === void 0 ? false : _ref$icon,
3119
+ _ref$arrow = _ref.arrow,
3120
+ arrow = _ref$arrow === void 0 ? false : _ref$arrow,
3121
+ icon = _ref.icon,
3121
3122
  props = _objectWithoutProperties(_ref, _excluded$1);
3122
3123
  var theme = distExports.useTheme();
3123
3124
  var _useScale = useScale(),
@@ -3132,11 +3133,13 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3132
3133
  href: href
3133
3134
  }, props, {
3134
3135
  ref: ref,
3135
- className: _JSXStyle.dynamic([["442871747", [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]]]) + " " + (props && props.className != null && props.className || classes || "")
3136
- }), children, icon && /*#__PURE__*/React.createElement(LinkIcon, null), /*#__PURE__*/React.createElement(_JSXStyle, {
3137
- id: "442871747",
3136
+ className: _JSXStyle.dynamic([["1742013413", [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]]]) + " " + (props && props.className != null && props.className || classes || "")
3137
+ }), icon && icon, /*#__PURE__*/React.createElement("span", {
3138
+ className: _JSXStyle.dynamic([["1742013413", [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]]])
3139
+ }, children, arrow && /*#__PURE__*/React.createElement(LinkIcon, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
3140
+ id: "1742013413",
3138
3141
  dynamic: [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]
3139
- }, ".link.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:baseline;-webkit-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;line-height:inherit;color:".concat(linkColor, ";-webkit-text-decoration:none;text-decoration:none;border-radius:").concat(block ? theme.layout.radius : 0, ";-webkit-transition:color 200ms ease 0ms;transition:color 200ms ease 0ms;font-size:").concat(SCALES.font(1, 'inherit'), ";width:").concat(SCALES.width(1, 'fit-content'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";}.block.__jsx-style-dynamic-selector{padding:").concat(SCALES.pt(0.125), " ").concat(SCALES.pr(0.25), " ").concat(SCALES.pb(0.125), " ").concat(SCALES.pl(0.25), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(-0.125), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(-0.125), ";}.link.__jsx-style-dynamic-selector:hover,.link.__jsx-style-dynamic-selector:active,.link.__jsx-style-dynamic-selector:focus{-webkit-text-decoration:").concat(decoration, ";text-decoration:").concat(decoration, ";}.link.__jsx-style-dynamic-selector:hover{background-color:").concat(block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', ";color:").concat(hoverColor, ";}")));
3142
+ }, ".link.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:inherit;gap:5px;color:".concat(linkColor, ";-webkit-text-decoration:none;text-decoration:none;border-radius:").concat(block ? theme.layout.radius : 0, ";-webkit-transition:color 200ms ease 0ms;transition:color 200ms ease 0ms;font-size:").concat(SCALES.font(1, 'inherit'), ";width:").concat(SCALES.width(1, 'fit-content'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";}.block.__jsx-style-dynamic-selector{padding:").concat(SCALES.pt(0.125), " ").concat(SCALES.pr(0.25), " ").concat(SCALES.pb(0.125), " ").concat(SCALES.pl(0.25), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(-0.125), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(-0.125), ";}.link.__jsx-style-dynamic-selector:hover,.link.__jsx-style-dynamic-selector:active,.link.__jsx-style-dynamic-selector:focus{-webkit-text-decoration:").concat(decoration, ";text-decoration:").concat(decoration, ";}.link.__jsx-style-dynamic-selector:hover{background-color:").concat(block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', ";color:").concat(hoverColor, ";}")));
3140
3143
  });
3141
3144
  LinkComponent.displayName = 'Link';
3142
3145
  var Link = withScale(LinkComponent);
@@ -3296,7 +3296,7 @@ var addColorAlpha = function addColorAlpha(color, alpha) {
3296
3296
  return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
3297
3297
  };
3298
3298
 
3299
- var _excluded$2 = ["href", "showColor", "underline", "children", "className", "block", "icon"];
3299
+ var _excluded$2 = ["href", "showColor", "underline", "children", "className", "block", "arrow", "icon"];
3300
3300
  var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3301
3301
  var _ref$href = _ref.href,
3302
3302
  href = _ref$href === void 0 ? '' : _ref$href,
@@ -3309,8 +3309,9 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3309
3309
  className = _ref$className === void 0 ? '' : _ref$className,
3310
3310
  _ref$block = _ref.block,
3311
3311
  block = _ref$block === void 0 ? false : _ref$block,
3312
- _ref$icon = _ref.icon,
3313
- icon = _ref$icon === void 0 ? false : _ref$icon,
3312
+ _ref$arrow = _ref.arrow,
3313
+ arrow = _ref$arrow === void 0 ? false : _ref$arrow,
3314
+ icon = _ref.icon,
3314
3315
  props = _objectWithoutProperties(_ref, _excluded$2);
3315
3316
  var theme = distExports.useTheme();
3316
3317
  var _useScale = useScale(),
@@ -3325,11 +3326,13 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3325
3326
  href: href
3326
3327
  }, props, {
3327
3328
  ref: ref,
3328
- className: _JSXStyle.dynamic([["442871747", [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]]]) + " " + (props && props.className != null && props.className || classes || "")
3329
- }), children, icon && /*#__PURE__*/React.createElement(LinkIcon, null), /*#__PURE__*/React.createElement(_JSXStyle, {
3330
- id: "442871747",
3329
+ className: _JSXStyle.dynamic([["1742013413", [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]]]) + " " + (props && props.className != null && props.className || classes || "")
3330
+ }), icon && icon, /*#__PURE__*/React.createElement("span", {
3331
+ className: _JSXStyle.dynamic([["1742013413", [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]]])
3332
+ }, children, arrow && /*#__PURE__*/React.createElement(LinkIcon, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
3333
+ id: "1742013413",
3331
3334
  dynamic: [linkColor, block ? theme.layout.radius : 0, SCALES.font(1, 'inherit'), SCALES.width(1, 'fit-content'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.pt(0.125), SCALES.pr(0.25), SCALES.pb(0.125), SCALES.pl(0.25), SCALES.mt(0), SCALES.mr(-0.125), SCALES.mb(0), SCALES.ml(-0.125), decoration, block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', hoverColor]
3332
- }, ".link.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:baseline;-webkit-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;line-height:inherit;color:".concat(linkColor, ";-webkit-text-decoration:none;text-decoration:none;border-radius:").concat(block ? theme.layout.radius : 0, ";-webkit-transition:color 200ms ease 0ms;transition:color 200ms ease 0ms;font-size:").concat(SCALES.font(1, 'inherit'), ";width:").concat(SCALES.width(1, 'fit-content'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";}.block.__jsx-style-dynamic-selector{padding:").concat(SCALES.pt(0.125), " ").concat(SCALES.pr(0.25), " ").concat(SCALES.pb(0.125), " ").concat(SCALES.pl(0.25), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(-0.125), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(-0.125), ";}.link.__jsx-style-dynamic-selector:hover,.link.__jsx-style-dynamic-selector:active,.link.__jsx-style-dynamic-selector:focus{-webkit-text-decoration:").concat(decoration, ";text-decoration:").concat(decoration, ";}.link.__jsx-style-dynamic-selector:hover{background-color:").concat(block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', ";color:").concat(hoverColor, ";}")));
3335
+ }, ".link.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:inherit;gap:5px;color:".concat(linkColor, ";-webkit-text-decoration:none;text-decoration:none;border-radius:").concat(block ? theme.layout.radius : 0, ";-webkit-transition:color 200ms ease 0ms;transition:color 200ms ease 0ms;font-size:").concat(SCALES.font(1, 'inherit'), ";width:").concat(SCALES.width(1, 'fit-content'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";}.block.__jsx-style-dynamic-selector{padding:").concat(SCALES.pt(0.125), " ").concat(SCALES.pr(0.25), " ").concat(SCALES.pb(0.125), " ").concat(SCALES.pl(0.25), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(-0.125), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(-0.125), ";}.link.__jsx-style-dynamic-selector:hover,.link.__jsx-style-dynamic-selector:active,.link.__jsx-style-dynamic-selector:focus{-webkit-text-decoration:").concat(decoration, ";text-decoration:").concat(decoration, ";}.link.__jsx-style-dynamic-selector:hover{background-color:").concat(block ? addColorAlpha(theme.palette.link, 0.1) : 'unset', ";color:").concat(hoverColor, ";}")));
3333
3336
  });
3334
3337
  LinkComponent.displayName = 'Link';
3335
3338
  var Link = withScale(LinkComponent);
@@ -0,0 +1,2 @@
1
+ declare const _default: (position: number, metric: "px" | "%", axis: "horizontal" | "vertical") => string;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface ArrowProps {
3
+ direction: 'prev' | 'next';
4
+ onClickHandler: () => void;
5
+ enabled: boolean;
6
+ label: string;
7
+ }
8
+ declare const Arrow: React.FC<ArrowProps>;
9
+ export default Arrow;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface IndicatorProps {
3
+ onClickHandler: (e: React.MouseEvent | React.KeyboardEvent) => void;
4
+ isSelected: boolean;
5
+ index: number;
6
+ label: string;
7
+ }
8
+ declare const Indicator: React.FC<IndicatorProps>;
9
+ export default Indicator;
@@ -0,0 +1,65 @@
1
+ import React, { Component } from 'react';
2
+ export interface Props {
3
+ axis: 'horizontal' | 'vertical';
4
+ children: React.ReactChild[];
5
+ labels: {
6
+ leftArrow: string;
7
+ rightArrow: string;
8
+ item: string;
9
+ };
10
+ onSelectItem: (index: number, item: React.ReactNode) => void;
11
+ selectedItem: number;
12
+ thumbWidth: number;
13
+ transitionTime: number;
14
+ emulateTouch?: boolean;
15
+ }
16
+ interface State {
17
+ selectedItem: number;
18
+ firstItem: number;
19
+ itemSize?: number;
20
+ visibleItems: number;
21
+ lastPosition: number;
22
+ showArrows: boolean;
23
+ swiping: boolean;
24
+ }
25
+ export default class Thumbs extends Component<Props, State> {
26
+ private itemsWrapperRef?;
27
+ private itemsListRef?;
28
+ private thumbsRef?;
29
+ static displayName: string;
30
+ static defaultProps: {
31
+ axis: string;
32
+ labels: {
33
+ leftArrow: string;
34
+ rightArrow: string;
35
+ item: string;
36
+ };
37
+ selectedItem: number;
38
+ thumbWidth: number;
39
+ transitionTime: number;
40
+ };
41
+ constructor(props: Props);
42
+ componentDidMount(): void;
43
+ componentDidUpdate(prevProps: Props): void;
44
+ componentWillUnmount(): void;
45
+ setItemsWrapperRef: (node: HTMLDivElement) => void;
46
+ setItemsListRef: (node: HTMLUListElement) => void;
47
+ setThumbsRef: (node: HTMLLIElement, index: number) => void;
48
+ setupThumbs(): void;
49
+ destroyThumbs(): void;
50
+ updateSizes: () => void;
51
+ handleClickItem: (index: number, item: React.ReactNode, e: React.MouseEvent | React.KeyboardEvent) => void;
52
+ onSwipeStart: () => void;
53
+ onSwipeEnd: () => void;
54
+ onSwipeMove: (delta: {
55
+ x: number;
56
+ y: number;
57
+ }) => boolean;
58
+ slideRight: (positions?: number) => void;
59
+ slideLeft: (positions?: number) => void;
60
+ moveTo: (position: number) => void;
61
+ getFirstItem(selectedItem: number): number;
62
+ renderItems(): React.JSX.Element[];
63
+ render(): React.JSX.Element | null;
64
+ }
65
+ export {};
@@ -0,0 +1,27 @@
1
+ import { AnimationHandler, SwipeAnimationHandler, StopSwipingHandler } from './types';
2
+ /**
3
+ * Main animation handler for the default 'sliding' style animation
4
+ * @param props
5
+ * @param state
6
+ */
7
+ export declare const slideAnimationHandler: AnimationHandler;
8
+ /**
9
+ * Swiping animation handler for the default 'sliding' style animation
10
+ * @param delta
11
+ * @param props
12
+ * @param state
13
+ * @param setState
14
+ */
15
+ export declare const slideSwipeAnimationHandler: SwipeAnimationHandler;
16
+ /**
17
+ * Default 'sliding' style animination handler for when a swipe action stops.
18
+ * @param props
19
+ * @param state
20
+ */
21
+ export declare const slideStopSwipingHandler: StopSwipingHandler;
22
+ /**
23
+ * Main animation handler for the default 'fade' style animation
24
+ * @param props
25
+ * @param state
26
+ */
27
+ export declare const fadeAnimationHandler: AnimationHandler;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import Thumbs from './Thumbs';
3
+ import { CarouselProps, CarouselState } from './types';
4
+ export default class Carousel extends React.Component<CarouselProps, CarouselState> {
5
+ private thumbsRef?;
6
+ private carouselWrapperRef?;
7
+ private listRef?;
8
+ private itemsRef?;
9
+ private timer?;
10
+ private animationHandler;
11
+ static displayName: string;
12
+ static defaultProps: CarouselProps;
13
+ constructor(props: CarouselProps);
14
+ componentDidMount(): void;
15
+ componentDidUpdate(prevProps: CarouselProps, prevState: CarouselState): void;
16
+ componentWillUnmount(): void;
17
+ setThumbsRef: (node: Thumbs) => void;
18
+ setCarouselWrapperRef: (node: HTMLDivElement) => void;
19
+ setListRef: (node: HTMLElement | HTMLUListElement) => void;
20
+ setItemsRef: (node: HTMLElement, index: number) => void;
21
+ setupCarousel(): void;
22
+ destroyCarousel(): void;
23
+ setupAutoPlay(): void;
24
+ destroyAutoPlay(): void;
25
+ bindEvents(): void;
26
+ unbindEvents(): void;
27
+ autoPlay: () => void;
28
+ clearAutoPlay: () => void;
29
+ resetAutoPlay: () => void;
30
+ stopOnHover: () => void;
31
+ startOnLeave: () => void;
32
+ forceFocus(): void;
33
+ isFocusWithinTheCarousel: () => boolean;
34
+ navigateWithKeyboard: (e: KeyboardEvent) => void;
35
+ updateSizes: () => void;
36
+ setMountState: () => void;
37
+ handleClickItem: (index: number, item: React.ReactNode) => void;
38
+ /**
39
+ * On Change handler, Passes the index and React node to the supplied onChange prop
40
+ * @param index of the carousel item
41
+ * @param item React node of the item being changed
42
+ */
43
+ handleOnChange: (index: number, item: React.ReactNode) => void;
44
+ handleClickThumb: (index: number, item: React.ReactNode) => void;
45
+ onSwipeStart: (event: React.TouchEvent) => void;
46
+ onSwipeEnd: (event: React.TouchEvent) => void;
47
+ onSwipeMove: (delta: {
48
+ x: number;
49
+ y: number;
50
+ }, event: React.TouchEvent) => boolean;
51
+ /**
52
+ * Decrements the selectedItem index a number of positions through the children list
53
+ * @param positions
54
+ * @param fromSwipe
55
+ */
56
+ decrement: (positions?: number) => void;
57
+ /**
58
+ * Increments the selectedItem index a number of positions through the children list
59
+ * @param positions
60
+ * @param fromSwipe
61
+ */
62
+ increment: (positions?: number) => void;
63
+ /**
64
+ * Moves the selected item to the position provided
65
+ * @param position
66
+ * @param fromSwipe
67
+ */
68
+ moveTo: (position?: number) => void;
69
+ onClickNext: () => void;
70
+ onClickPrev: () => void;
71
+ onSwipeForward: () => void;
72
+ onSwipeBackwards: () => void;
73
+ changeItem: (newIndex: number) => (e: React.MouseEvent | React.KeyboardEvent) => void;
74
+ /**
75
+ * This function is called when you want to 'select' a new item, or rather move to a 'selected' item
76
+ * It also handles the onChange callback wrapper
77
+ * @param state state object with updated selected item, and swiping bool if relevant
78
+ */
79
+ selectItem: (state: Pick<CarouselState, "selectedItem" | "swiping">) => void;
80
+ getInitialImage: () => HTMLImageElement;
81
+ getVariableItemHeight: (position: number) => number | null;
82
+ renderItems(isClone?: boolean): React.JSX.Element[];
83
+ renderControls(): React.JSX.Element | null;
84
+ renderStatus(): React.JSX.Element | null;
85
+ renderThumbs(): React.JSX.Element | null;
86
+ render(): React.JSX.Element | null;
87
+ }
@@ -0,0 +1,79 @@
1
+ export interface AnimationHandlerResponse {
2
+ itemListStyle?: React.CSSProperties;
3
+ slideStyle?: React.CSSProperties;
4
+ selectedStyle?: React.CSSProperties;
5
+ prevStyle?: React.CSSProperties;
6
+ }
7
+ export type AnimationHandler = (props: CarouselProps, state: CarouselState) => AnimationHandlerResponse;
8
+ export type SwipeAnimationHandler = (delta: {
9
+ x: number;
10
+ y: number;
11
+ }, props: CarouselProps, state: CarouselState, setState: Function) => AnimationHandlerResponse;
12
+ export type StopSwipingHandler = (props: CarouselProps, state: CarouselState) => AnimationHandlerResponse;
13
+ export interface CarouselProps {
14
+ ariaLabel?: string | undefined;
15
+ axis: 'horizontal' | 'vertical';
16
+ autoFocus?: boolean;
17
+ autoPlay?: boolean;
18
+ centerMode?: boolean;
19
+ centerSlidePercentage: number;
20
+ children?: React.ReactChild[];
21
+ className?: string;
22
+ dynamicHeight?: boolean;
23
+ emulateTouch?: boolean;
24
+ infiniteLoop?: boolean;
25
+ interval: number;
26
+ labels: {
27
+ leftArrow: string;
28
+ rightArrow: string;
29
+ item: string;
30
+ };
31
+ onClickItem: (index: number, item: React.ReactNode) => void;
32
+ onClickThumb: (index: number, item: React.ReactNode) => void;
33
+ onChange: (index: number, item: React.ReactNode) => void;
34
+ onSwipeStart: (event: React.TouchEvent) => void;
35
+ onSwipeEnd: (event: React.TouchEvent) => void;
36
+ onSwipeMove: (event: React.TouchEvent) => boolean;
37
+ preventMovementUntilSwipeScrollTolerance: boolean;
38
+ renderArrowPrev: (clickHandler: () => void, hasPrev: boolean, label: string) => React.ReactNode;
39
+ renderArrowNext: (clickHandler: () => void, hasNext: boolean, label: string) => React.ReactNode;
40
+ renderIndicator: (clickHandler: (e: React.MouseEvent | React.KeyboardEvent) => void, isSelected: boolean, index: number, label: string) => React.ReactNode;
41
+ renderItem: (item: React.ReactNode, options?: {
42
+ isSelected: boolean;
43
+ isPrevious: boolean;
44
+ }) => React.ReactNode;
45
+ renderThumbs: (children: React.ReactChild[]) => React.ReactChild[];
46
+ selectedItem: number;
47
+ showArrows: boolean;
48
+ showStatus: boolean;
49
+ showIndicators: boolean;
50
+ showThumbs: boolean;
51
+ statusFormatter: (currentItem: number, total: number) => string;
52
+ stopOnHover: boolean;
53
+ swipeable: boolean;
54
+ swipeScrollTolerance: number;
55
+ thumbWidth?: number;
56
+ transitionTime: number;
57
+ useKeyboardArrows?: boolean;
58
+ verticalSwipe: 'natural' | 'standard';
59
+ width: number | string;
60
+ animationHandler: 'slide' | 'fade' | AnimationHandler;
61
+ swipeAnimationHandler: SwipeAnimationHandler;
62
+ stopSwipingHandler: StopSwipingHandler;
63
+ }
64
+ export interface CarouselState {
65
+ autoPlay?: boolean;
66
+ cancelClick: boolean;
67
+ hasMount: boolean;
68
+ initialized: boolean;
69
+ isMouseEntered: boolean;
70
+ itemSize: number;
71
+ previousItem: number;
72
+ selectedItem: number;
73
+ swiping?: boolean;
74
+ swipeMovementStarted: boolean;
75
+ itemListStyle?: React.CSSProperties;
76
+ slideStyle?: React.CSSProperties;
77
+ selectedStyle?: React.CSSProperties;
78
+ prevStyle?: React.CSSProperties;
79
+ }
@@ -0,0 +1,15 @@
1
+ import { CarouselProps } from './types';
2
+ export declare const noop: () => void;
3
+ export declare const defaultStatusFormatter: (current: number, total: number) => string;
4
+ export declare const isKeyboardEvent: (e?: React.MouseEvent | React.KeyboardEvent) => e is React.KeyboardEvent;
5
+ /**
6
+ * Gets the list 'position' relative to a current index
7
+ * @param index
8
+ */
9
+ export declare const getPosition: (index: number, props: CarouselProps) => number;
10
+ /**
11
+ * Sets the 'position' transform for sliding animations
12
+ * @param position
13
+ * @param forceReflow
14
+ */
15
+ export declare const setPosition: (position: number, axis: "horizontal" | "vertical") => React.CSSProperties;
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ ROOT: (customClassName?: string) => string;
3
+ CAROUSEL: (isSlider?: boolean) => string;
4
+ WRAPPER: (isSlider: boolean, axis?: "horizontal" | "vertical") => string;
5
+ SLIDER: (isSlider: boolean, isSwiping?: boolean) => string;
6
+ ITEM: (isSlider: boolean, selected: boolean, previous?: boolean) => string;
7
+ ARROW_PREV: (disabled?: boolean) => string;
8
+ ARROW_NEXT: (disabled?: boolean) => string;
9
+ DOT: (selected?: boolean) => string;
10
+ };
11
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const outerWidth: (el: HTMLElement) => number;
@@ -0,0 +1,3 @@
1
+ export { default as Carousel } from './component';
2
+ export type { CarouselProps } from './component/types';
3
+ export { default as Thumbs } from './component/Thumbs';