@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.
- package/dist/breadcrumbs/index.js +10 -7
- package/dist/card/index.js +10 -7
- package/dist/carousal/CSSTranslate.d.ts +2 -0
- package/dist/carousal/component/Arrow.d.ts +9 -0
- package/dist/carousal/component/Indicator.d.ts +9 -0
- package/dist/carousal/component/Thumbs.d.ts +65 -0
- package/dist/carousal/component/animations.d.ts +27 -0
- package/dist/carousal/component/index.d.ts +87 -0
- package/dist/carousal/component/types.d.ts +79 -0
- package/dist/carousal/component/utils.d.ts +15 -0
- package/dist/carousal/cssClasses.d.ts +11 -0
- package/dist/carousal/dimensions.d.ts +1 -0
- package/dist/carousal/index.d.ts +3 -0
- package/dist/carousal/index.js +13166 -0
- package/dist/carousal/shims/document.d.ts +2 -0
- package/dist/carousal/shims/window.d.ts +2 -0
- package/dist/image/index.js +10 -7
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2794 -197
- package/dist/link/index.js +10 -7
- package/dist/link/link.d.ts +2 -1
- package/dist/swipe/index.d.ts +4 -0
- package/dist/swipe/index.js +1314 -0
- package/dist/swipe/react-swipe.d.ts +58 -0
- package/dist/user/index.js +10 -7
- package/esm/carousal/CSSTranslate.d.ts +2 -0
- package/esm/carousal/CSSTranslate.js +7 -0
- package/esm/carousal/component/Arrow.d.ts +9 -0
- package/esm/carousal/component/Arrow.js +21 -0
- package/esm/carousal/component/Indicator.d.ts +9 -0
- package/esm/carousal/component/Indicator.js +23 -0
- package/esm/carousal/component/Thumbs.d.ts +65 -0
- package/esm/carousal/{Thumbs.js → component/Thumbs.js} +41 -12
- package/esm/carousal/component/animations.d.ts +27 -0
- package/esm/carousal/{animations.js → component/animations.js} +1 -1
- package/esm/carousal/component/index.d.ts +87 -0
- package/esm/carousal/component/index.js +698 -0
- package/esm/carousal/component/types.d.ts +79 -0
- package/esm/carousal/component/utils.d.ts +15 -0
- package/esm/carousal/{utils.js → component/utils.js} +1 -1
- package/esm/carousal/cssClasses.d.ts +11 -0
- package/esm/carousal/cssClasses.js +56 -0
- package/esm/carousal/dimensions.d.ts +1 -0
- package/esm/carousal/dimensions.js +6 -0
- package/esm/carousal/index.d.ts +3 -0
- package/esm/carousal/index.js +2 -683
- package/esm/carousal/main.js +59 -0
- package/esm/carousal/shims/document.d.ts +2 -0
- package/esm/carousal/shims/document.js +3 -0
- package/esm/carousal/shims/window.d.ts +2 -0
- package/esm/carousal/shims/window.js +3 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +6 -1
- package/esm/link/link.d.ts +2 -1
- package/esm/link/link.js +10 -7
- package/esm/login-with/index.js +0 -2
- package/esm/swipe/demo.js +57 -0
- package/esm/swipe/index.d.ts +4 -0
- package/esm/swipe/index.js +2 -0
- package/esm/swipe/react-swipe.d.ts +58 -0
- package/esm/swipe/react-swipe.js +246 -0
- package/package.json +4 -3
- package/esm/carousal/Arrow.js +0 -18
- package/esm/carousal/Indicator.js +0 -20
- /package/esm/carousal/{types.js → component/types.js} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function setHasSupportToCaptureOption(hasSupport: any): void;
|
|
2
|
+
export default ReactSwipe;
|
|
3
|
+
declare class ReactSwipe extends React.Component<any, any, any> {
|
|
4
|
+
static displayName: string;
|
|
5
|
+
static propTypes: {
|
|
6
|
+
tagName: PropTypes.Requireable<string>;
|
|
7
|
+
className: PropTypes.Requireable<string>;
|
|
8
|
+
style: PropTypes.Requireable<object>;
|
|
9
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
10
|
+
allowMouseEvents: PropTypes.Requireable<boolean>;
|
|
11
|
+
onSwipeUp: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
onSwipeDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
+
onSwipeLeft: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
+
onSwipeRight: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
onSwipeStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
onSwipeMove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
onSwipeEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
innerRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
tolerance: PropTypes.Validator<number>;
|
|
20
|
+
};
|
|
21
|
+
static defaultProps: {
|
|
22
|
+
tagName: string;
|
|
23
|
+
allowMouseEvents: boolean;
|
|
24
|
+
onSwipeUp(): void;
|
|
25
|
+
onSwipeDown(): void;
|
|
26
|
+
onSwipeLeft(): void;
|
|
27
|
+
onSwipeRight(): void;
|
|
28
|
+
onSwipeStart(): void;
|
|
29
|
+
onSwipeMove(): void;
|
|
30
|
+
onSwipeEnd(): void;
|
|
31
|
+
innerRef(): void;
|
|
32
|
+
tolerance: number;
|
|
33
|
+
};
|
|
34
|
+
constructor(...args: any[]);
|
|
35
|
+
_handleSwipeStart(event: any): void;
|
|
36
|
+
_handleSwipeMove(event: any): void;
|
|
37
|
+
_handleSwipeEnd(event: any): void;
|
|
38
|
+
_onMouseDown(event: any): void;
|
|
39
|
+
_onMouseMove(event: any): void;
|
|
40
|
+
_onMouseUp(event: any): void;
|
|
41
|
+
_setSwiperRef(node: any): void;
|
|
42
|
+
componentDidMount(): void;
|
|
43
|
+
componentWillUnmount(): void;
|
|
44
|
+
mouseDown: boolean | undefined;
|
|
45
|
+
moveStart: {
|
|
46
|
+
x: any;
|
|
47
|
+
y: any;
|
|
48
|
+
} | null | undefined;
|
|
49
|
+
moving: boolean | undefined;
|
|
50
|
+
movePosition: {
|
|
51
|
+
deltaX: number;
|
|
52
|
+
deltaY: number;
|
|
53
|
+
} | null | undefined;
|
|
54
|
+
swiper: any;
|
|
55
|
+
render(): React.JSX.Element;
|
|
56
|
+
}
|
|
57
|
+
import React from 'react';
|
|
58
|
+
import PropTypes from 'prop-types';
|
package/dist/user/index.js
CHANGED
|
@@ -3143,7 +3143,7 @@ var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
|
3143
3143
|
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
3144
3144
|
};
|
|
3145
3145
|
|
|
3146
|
-
var _excluded$1 = ["href", "showColor", "underline", "children", "className", "block", "icon"];
|
|
3146
|
+
var _excluded$1 = ["href", "showColor", "underline", "children", "className", "block", "arrow", "icon"];
|
|
3147
3147
|
var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3148
3148
|
var _ref$href = _ref.href,
|
|
3149
3149
|
href = _ref$href === void 0 ? '' : _ref$href,
|
|
@@ -3156,8 +3156,9 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3156
3156
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
3157
3157
|
_ref$block = _ref.block,
|
|
3158
3158
|
block = _ref$block === void 0 ? false : _ref$block,
|
|
3159
|
-
_ref$
|
|
3160
|
-
|
|
3159
|
+
_ref$arrow = _ref.arrow,
|
|
3160
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
3161
|
+
icon = _ref.icon,
|
|
3161
3162
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
3162
3163
|
var theme = distExports.useTheme();
|
|
3163
3164
|
var _useScale = useScale(),
|
|
@@ -3172,11 +3173,13 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3172
3173
|
href: href
|
|
3173
3174
|
}, props, {
|
|
3174
3175
|
ref: ref,
|
|
3175
|
-
className: _JSXStyle.dynamic([["
|
|
3176
|
-
}),
|
|
3177
|
-
|
|
3176
|
+
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 || "")
|
|
3177
|
+
}), icon && icon, /*#__PURE__*/React.createElement("span", {
|
|
3178
|
+
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]]])
|
|
3179
|
+
}, children, arrow && /*#__PURE__*/React.createElement(LinkIcon, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
3180
|
+
id: "1742013413",
|
|
3178
3181
|
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]
|
|
3179
|
-
}, ".link.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:
|
|
3182
|
+
}, ".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, ";}")));
|
|
3180
3183
|
});
|
|
3181
3184
|
LinkComponent.displayName = 'Link';
|
|
3182
3185
|
var Link = withScale(LinkComponent);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default (function (position, metric, axis) {
|
|
2
|
+
var positionPercent = position === 0 ? position : position + metric;
|
|
3
|
+
var positionCss = axis === 'horizontal' ? [positionPercent, 0, 0] : [0, positionPercent, 0];
|
|
4
|
+
var transitionProp = 'translate3d';
|
|
5
|
+
var translatedPosition = '(' + positionCss.join(',') + ')';
|
|
6
|
+
return transitionProp + translatedPosition;
|
|
7
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import klass from '../cssClasses'; // Assuming cssClasses.ts is in src/
|
|
4
|
+
|
|
5
|
+
var Arrow = function Arrow(_ref) {
|
|
6
|
+
var direction = _ref.direction,
|
|
7
|
+
onClickHandler = _ref.onClickHandler,
|
|
8
|
+
enabled = _ref.enabled,
|
|
9
|
+
label = _ref.label;
|
|
10
|
+
var isPrev = direction === 'prev';
|
|
11
|
+
var arrowClassName = isPrev ? klass.ARROW_PREV(!enabled) : klass.ARROW_NEXT(!enabled);
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": label,
|
|
15
|
+
onClick: onClickHandler,
|
|
16
|
+
className: "jsx-4058608807" + " " + (arrowClassName || "")
|
|
17
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
18
|
+
id: "4058608807"
|
|
19
|
+
}, ".control-arrow.jsx-4058608807{position:absolute;z-index:2;top:0;bottom:0;background:none;border:0;font-size:26px;cursor:pointer;opacity:0.4;-webkit-transition:all 0.25s ease-in;transition:all 0.25s ease-in;margin-top:-13px;padding:5px;color:#fff;}.control-arrow.jsx-4058608807:hover{background:rgba(0,0,0,0.2);opacity:1;}.control-arrow.jsx-4058608807:hover,.control-arrow.jsx-4058608807:focus{opacity:1;}.control-arrow.control-arrow.jsx-4058608807:before{margin:0 5px;display:inline-block;border-top:8px solid transparent;border-bottom:8px solid transparent;content:'';}.control-arrow.control-disabled.jsx-4058608807{opacity:0;cursor:inherit;display:none;}.control-arrow.control-prev.jsx-4058608807{left:0;}.control-arrow.control-prev.jsx-4058608807:before{border-right:8px solid #fff;}.control-arrow.control-next.jsx-4058608807{right:0;}.control-arrow.control-next.jsx-4058608807:before{border-left:8px solid #fff;}"));
|
|
20
|
+
};
|
|
21
|
+
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,23 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import klass from '../cssClasses'; // Assuming cssClasses.ts is in src/
|
|
4
|
+
|
|
5
|
+
var Indicator = function Indicator(_ref) {
|
|
6
|
+
var onClickHandler = _ref.onClickHandler,
|
|
7
|
+
isSelected = _ref.isSelected,
|
|
8
|
+
index = _ref.index,
|
|
9
|
+
label = _ref.label;
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("li", {
|
|
11
|
+
onClick: onClickHandler,
|
|
12
|
+
onKeyDown: onClickHandler,
|
|
13
|
+
value: index,
|
|
14
|
+
key: index,
|
|
15
|
+
role: "button",
|
|
16
|
+
tabIndex: 0,
|
|
17
|
+
"aria-label": "".concat(label, " ").concat(index + 1),
|
|
18
|
+
className: "jsx-3056554148" + " " + (klass.DOT(isSelected) || "")
|
|
19
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
|
+
id: "3056554148"
|
|
21
|
+
}, ".dot.jsx-3056554148{-webkit-transition:opacity 0.25s ease-in;transition:opacity 0.25s ease-in;opacity:0.3;box-shadow:1px 1px 2px rgba(0,0,0,0.9);background:#fff;border-radius:50%;width:8px;height:8px;cursor:pointer;display:inline-block;margin:0 8px;}.dot.selected.jsx-3056554148,.dot.jsx-3056554148:hover{opacity:1;}"));
|
|
22
|
+
};
|
|
23
|
+
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 {};
|
|
@@ -5,6 +5,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
8
9
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
11
|
import React, { Component, Children } from 'react';
|
|
@@ -12,8 +13,10 @@ import klass from '../cssClasses';
|
|
|
12
13
|
import { outerWidth } from '../dimensions';
|
|
13
14
|
import CSSTranslate from '../CSSTranslate';
|
|
14
15
|
// @ts-ignore
|
|
15
|
-
import Swipe from '
|
|
16
|
+
import Swipe from '../../swipe';
|
|
16
17
|
import getWindow from '../shims/window';
|
|
18
|
+
import Button from 'components/button';
|
|
19
|
+
import { ChevronLeft, ChevronRight } from '@helpdice/icons';
|
|
17
20
|
var isKeyboardEvent = function isKeyboardEvent(e) {
|
|
18
21
|
return e.hasOwnProperty('key');
|
|
19
22
|
};
|
|
@@ -211,8 +214,11 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
211
214
|
};
|
|
212
215
|
return /*#__PURE__*/React.createElement("li", _extends({}, thumbProps, {
|
|
213
216
|
role: "button",
|
|
214
|
-
tabIndex: 0
|
|
215
|
-
|
|
217
|
+
tabIndex: 0,
|
|
218
|
+
className: "jsx-2129274269" + " " + (thumbProps && thumbProps.className != null && thumbProps.className || "")
|
|
219
|
+
}), img, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
220
|
+
id: "2129274269"
|
|
221
|
+
}, ".thumb.jsx-2129274269{-webkit-transition:border 0.15s ease-in;transition:border 0.15s ease-in;display:inline-block;margin-right:6px;margin-bottom:0 !important;white-space:nowrap;overflow:hidden;border:3px solid #fff;padding:2px;}.thumb.jsx-2129274269:focus{border:3px solid #ccc;outline:none;}.thumb.selected.jsx-2129274269,.thumb.jsx-2129274269:hover{border:3px solid #0099ff;}.thumb.jsx-2129274269 img.jsx-2129274269{vertical-align:top;}"));
|
|
216
222
|
});
|
|
217
223
|
}
|
|
218
224
|
}, {
|
|
@@ -248,12 +254,21 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
248
254
|
msTransitionDuration: transitionTime
|
|
249
255
|
};
|
|
250
256
|
return /*#__PURE__*/React.createElement("div", {
|
|
251
|
-
className: klass.CAROUSEL(false)
|
|
257
|
+
className: "jsx-3452014152" + " " + (klass.CAROUSEL(false) || "")
|
|
252
258
|
}, /*#__PURE__*/React.createElement("div", {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}, /*#__PURE__*/React.createElement(
|
|
259
|
+
ref: this.setItemsWrapperRef,
|
|
260
|
+
className: "jsx-3452014152" + " " + (klass.WRAPPER(false) || "")
|
|
261
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
262
|
+
scale: 2 / 3,
|
|
263
|
+
auto: true,
|
|
264
|
+
px: 0.6,
|
|
256
265
|
type: "button",
|
|
266
|
+
style: {
|
|
267
|
+
position: 'absolute',
|
|
268
|
+
zIndex: '2',
|
|
269
|
+
left: 0
|
|
270
|
+
},
|
|
271
|
+
iconRight: /*#__PURE__*/React.createElement(ChevronLeft, null),
|
|
257
272
|
className: klass.ARROW_PREV(!hasPrev),
|
|
258
273
|
onClick: function onClick() {
|
|
259
274
|
return _this3.slideRight();
|
|
@@ -267,23 +282,37 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
267
282
|
onSwipeMove: this.onSwipeMove,
|
|
268
283
|
onSwipeStart: this.onSwipeStart,
|
|
269
284
|
onSwipeEnd: this.onSwipeEnd,
|
|
270
|
-
style:
|
|
285
|
+
style: _extends({
|
|
286
|
+
display: 'flex',
|
|
287
|
+
margin: '20px 45px'
|
|
288
|
+
}, itemListStyles),
|
|
271
289
|
innerRef: this.setItemsListRef,
|
|
272
290
|
allowMouseEvents: this.props.emulateTouch
|
|
273
291
|
}, this.renderItems()) : /*#__PURE__*/React.createElement("ul", {
|
|
274
|
-
className: klass.SLIDER(false, this.state.swiping),
|
|
275
292
|
ref: function ref(node) {
|
|
276
293
|
return _this3.setItemsListRef(node);
|
|
277
294
|
},
|
|
278
|
-
style: itemListStyles
|
|
279
|
-
|
|
295
|
+
style: itemListStyles,
|
|
296
|
+
className: "jsx-3452014152" + " " + (klass.SLIDER(false, this.state.swiping) || "")
|
|
297
|
+
}, this.renderItems()), /*#__PURE__*/React.createElement(Button, {
|
|
280
298
|
type: "button",
|
|
299
|
+
scale: 2 / 3,
|
|
300
|
+
auto: true,
|
|
301
|
+
px: 0.6,
|
|
302
|
+
style: {
|
|
303
|
+
position: 'absolute',
|
|
304
|
+
zIndex: '2',
|
|
305
|
+
right: 0
|
|
306
|
+
},
|
|
307
|
+
iconRight: /*#__PURE__*/React.createElement(ChevronRight, null),
|
|
281
308
|
className: klass.ARROW_NEXT(!hasNext),
|
|
282
309
|
onClick: function onClick() {
|
|
283
310
|
return _this3.slideLeft();
|
|
284
311
|
},
|
|
285
312
|
"aria-label": this.props.labels.rightArrow
|
|
286
|
-
}))
|
|
313
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
314
|
+
id: "3452014152"
|
|
315
|
+
}, ".thumbs-wrapper.jsx-3452014152{margin:0;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;position:relative;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.thumbs.jsx-3452014152{-webkit-transition:all 0.15s ease-in;transition:all 0.15s ease-in;position:relative;list-style:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;white-space:nowrap;margin:0 !important;}.control-arrow.control-prev.jsx-3452014152{left:0;}.control-arrow.control-prev.jsx-3452014152:before{border-right:8px solid #fff;}.control-arrow.control-next.jsx-3452014152{right:0;}.control-arrow.control-next.jsx-3452014152:before{border-left:8px solid #fff;}"));
|
|
287
316
|
}
|
|
288
317
|
}]);
|
|
289
318
|
}(Component);
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { Children } from 'react';
|
|
3
|
-
import CSSTranslate from '
|
|
3
|
+
import CSSTranslate from '../CSSTranslate';
|
|
4
4
|
import { getPosition, setPosition } from './utils';
|
|
5
5
|
/**
|
|
6
6
|
* Main animation handler for the default 'sliding' style animation
|
|
@@ -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
|
+
}
|