@helpdice/ui 1.7.8 → 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,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import(/* webpackChunkName: "carousel-component" */'./component').then(function (_ref) {
|
|
4
|
+
var Carousel = _ref["default"];
|
|
5
|
+
var DemoCarousel = function DemoCarousel() {
|
|
6
|
+
return /*#__PURE__*/React.createElement(Carousel, {
|
|
7
|
+
showArrows: true,
|
|
8
|
+
infiniteLoop: true,
|
|
9
|
+
autoPlay: true,
|
|
10
|
+
emulateTouch: true,
|
|
11
|
+
onClickItem: function onClickItem() {
|
|
12
|
+
var _console;
|
|
13
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
args[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
return (_console = console).log.apply(_console, ['onClickItem'].concat(args));
|
|
17
|
+
},
|
|
18
|
+
onChange: function onChange() {
|
|
19
|
+
var _console2;
|
|
20
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
21
|
+
args[_key2] = arguments[_key2];
|
|
22
|
+
}
|
|
23
|
+
return (_console2 = console).log.apply(_console2, ['onChange'].concat(args));
|
|
24
|
+
},
|
|
25
|
+
onClickThumb: function onClickThumb() {
|
|
26
|
+
var _console3;
|
|
27
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
28
|
+
args[_key3] = arguments[_key3];
|
|
29
|
+
}
|
|
30
|
+
return (_console3 = console).log.apply(_console3, ['onClickThumb'].concat(args));
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
|
|
33
|
+
src: "assets/1.jpeg"
|
|
34
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
35
|
+
className: "legend"
|
|
36
|
+
}, "Legend 1")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
|
|
37
|
+
src: "assets/2.jpeg"
|
|
38
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
39
|
+
className: "legend"
|
|
40
|
+
}, "Legend 2")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
|
|
41
|
+
src: "assets/3.jpeg"
|
|
42
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
43
|
+
className: "legend"
|
|
44
|
+
}, "Legend 3")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
|
|
45
|
+
src: "assets/4.jpeg"
|
|
46
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
47
|
+
className: "legend"
|
|
48
|
+
}, "Legend 4")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
|
|
49
|
+
src: "assets/5.jpeg"
|
|
50
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
51
|
+
className: "legend"
|
|
52
|
+
}, "Legend 5")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
|
|
53
|
+
src: "assets/6.jpeg"
|
|
54
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
55
|
+
className: "legend"
|
|
56
|
+
}, "Legend 6")));
|
|
57
|
+
};
|
|
58
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(DemoCarousel, null), document.querySelector('.demo-carousel'));
|
|
59
|
+
});
|
package/esm/index.d.ts
CHANGED
|
@@ -120,3 +120,7 @@ export type { ReactiveDomReact } from './utils/layouts';
|
|
|
120
120
|
export { default as CodeBlock } from './code-block';
|
|
121
121
|
export { default as Skeleton } from './skeleton';
|
|
122
122
|
export * from './login-with';
|
|
123
|
+
export { default as Swipe } from './swipe';
|
|
124
|
+
export type { SwipeProps } from './swipe';
|
|
125
|
+
export { Carousel } from './carousal';
|
|
126
|
+
export type { CarouselProps } from './carousal';
|
package/esm/index.js
CHANGED
|
@@ -78,4 +78,9 @@ export { default as CodeBlock } from './code-block';
|
|
|
78
78
|
export { default as Skeleton } from './skeleton';
|
|
79
79
|
|
|
80
80
|
// Social Logins
|
|
81
|
-
export * from './login-with';
|
|
81
|
+
export * from './login-with';
|
|
82
|
+
|
|
83
|
+
// Swipe
|
|
84
|
+
export { default as Swipe } from './swipe';
|
|
85
|
+
// Carousel
|
|
86
|
+
export { Carousel } from './carousal';
|
package/esm/link/link.d.ts
CHANGED
package/esm/link/link.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["href", "showColor", "underline", "children", "className", "block", "icon"];
|
|
3
|
+
var _excluded = ["href", "showColor", "underline", "children", "className", "block", "arrow", "icon"];
|
|
4
4
|
import _JSXStyle from "../styled-jsx.es.js";
|
|
5
5
|
// "use client"
|
|
6
6
|
|
|
@@ -21,8 +21,9 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
21
21
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
22
22
|
_ref$block = _ref.block,
|
|
23
23
|
block = _ref$block === void 0 ? false : _ref$block,
|
|
24
|
-
_ref$
|
|
25
|
-
|
|
24
|
+
_ref$arrow = _ref.arrow,
|
|
25
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
26
|
+
icon = _ref.icon,
|
|
26
27
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
28
|
var theme = useTheme();
|
|
28
29
|
var _useScale = useScale(),
|
|
@@ -37,11 +38,13 @@ var LinkComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
37
38
|
href: href
|
|
38
39
|
}, props, {
|
|
39
40
|
ref: ref,
|
|
40
|
-
className: _JSXStyle.dynamic([["
|
|
41
|
-
}),
|
|
42
|
-
|
|
41
|
+
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 || "")
|
|
42
|
+
}), icon && icon, /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
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]]])
|
|
44
|
+
}, children, arrow && /*#__PURE__*/React.createElement(LinkIcon, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
45
|
+
id: "1742013413",
|
|
43
46
|
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]
|
|
44
|
-
}, ".link.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:
|
|
47
|
+
}, ".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, ";}")));
|
|
45
48
|
});
|
|
46
49
|
LinkComponent.displayName = 'Link';
|
|
47
50
|
var Link = withScale(LinkComponent);
|
package/esm/login-with/index.js
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
4
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
|
+
import React, { Component } from 'react';
|
|
9
|
+
import ReactDOM from 'react-dom';
|
|
10
|
+
import Swipe from './react-swipe';
|
|
11
|
+
|
|
12
|
+
/* eslint no-console: 0*/
|
|
13
|
+
var MyComponent = /*#__PURE__*/function (_Component) {
|
|
14
|
+
function MyComponent() {
|
|
15
|
+
_classCallCheck(this, MyComponent);
|
|
16
|
+
return _callSuper(this, MyComponent, arguments);
|
|
17
|
+
}
|
|
18
|
+
_inherits(MyComponent, _Component);
|
|
19
|
+
return _createClass(MyComponent, [{
|
|
20
|
+
key: "onSwipeStart",
|
|
21
|
+
value: function onSwipeStart(event) {
|
|
22
|
+
console.log('Start swiping...', event);
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
key: "onSwipeMove",
|
|
26
|
+
value: function onSwipeMove(position, event) {
|
|
27
|
+
console.log("Moved ".concat(position.x, " pixels horizontally"), event);
|
|
28
|
+
console.log("Moved ".concat(position.y, " pixels vertically"), event);
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "onSwipeEnd",
|
|
32
|
+
value: function onSwipeEnd(event) {
|
|
33
|
+
console.log('End swiping...', event);
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "render",
|
|
37
|
+
value: function render() {
|
|
38
|
+
var boxStyle = {
|
|
39
|
+
width: '100%',
|
|
40
|
+
margin: '20px auto',
|
|
41
|
+
height: '300px',
|
|
42
|
+
border: '1px solid black',
|
|
43
|
+
background: '#ccc',
|
|
44
|
+
padding: '20px',
|
|
45
|
+
fontSize: '3em'
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/React.createElement(Swipe, {
|
|
48
|
+
onSwipeStart: this.onSwipeStart,
|
|
49
|
+
onSwipeMove: this.onSwipeMove,
|
|
50
|
+
onSwipeEnd: this.onSwipeEnd
|
|
51
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
style: boxStyle
|
|
53
|
+
}, "Open the console and swipe me"));
|
|
54
|
+
}
|
|
55
|
+
}]);
|
|
56
|
+
}(Component);
|
|
57
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(MyComponent, null), document.getElementById('root'));
|
|
@@ -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';
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
var _excluded = ["tagName", "className", "style", "children", "allowMouseEvents", "onSwipeUp", "onSwipeDown", "onSwipeLeft", "onSwipeRight", "onSwipeStart", "onSwipeMove", "onSwipeEnd", "innerRef", "tolerance"];
|
|
10
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
+
import React, { Component } from 'react';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
var supportsCaptureOption = false;
|
|
15
|
+
export function setHasSupportToCaptureOption(hasSupport) {
|
|
16
|
+
supportsCaptureOption = hasSupport;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
addEventListener('test', null, Object.defineProperty({}, 'capture', {
|
|
20
|
+
get: function get() {
|
|
21
|
+
setHasSupportToCaptureOption(true);
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
} catch (e) {} // eslint-disable-line no-empty
|
|
25
|
+
|
|
26
|
+
function getSafeEventHandlerOpts() {
|
|
27
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
28
|
+
capture: true
|
|
29
|
+
};
|
|
30
|
+
return supportsCaptureOption ? options : false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* [getPosition returns a position element that works for mouse or touch events]
|
|
35
|
+
* @param {[Event]} event [the received event]
|
|
36
|
+
* @return {[Object]} [x and y coords]
|
|
37
|
+
*/
|
|
38
|
+
function getPosition(event) {
|
|
39
|
+
if ('touches' in event) {
|
|
40
|
+
var _event$touches$ = event.touches[0],
|
|
41
|
+
pageX = _event$touches$.pageX,
|
|
42
|
+
pageY = _event$touches$.pageY;
|
|
43
|
+
return {
|
|
44
|
+
x: pageX,
|
|
45
|
+
y: pageY
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var screenX = event.screenX,
|
|
49
|
+
screenY = event.screenY;
|
|
50
|
+
return {
|
|
51
|
+
x: screenX,
|
|
52
|
+
y: screenY
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var ReactSwipe = /*#__PURE__*/function (_Component) {
|
|
56
|
+
function ReactSwipe() {
|
|
57
|
+
var _this;
|
|
58
|
+
_classCallCheck(this, ReactSwipe);
|
|
59
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
|
+
args[_key] = arguments[_key];
|
|
61
|
+
}
|
|
62
|
+
_this = _callSuper(this, ReactSwipe, [].concat(args));
|
|
63
|
+
_this._handleSwipeStart = _this._handleSwipeStart.bind(_this);
|
|
64
|
+
_this._handleSwipeMove = _this._handleSwipeMove.bind(_this);
|
|
65
|
+
_this._handleSwipeEnd = _this._handleSwipeEnd.bind(_this);
|
|
66
|
+
_this._onMouseDown = _this._onMouseDown.bind(_this);
|
|
67
|
+
_this._onMouseMove = _this._onMouseMove.bind(_this);
|
|
68
|
+
_this._onMouseUp = _this._onMouseUp.bind(_this);
|
|
69
|
+
_this._setSwiperRef = _this._setSwiperRef.bind(_this);
|
|
70
|
+
return _this;
|
|
71
|
+
}
|
|
72
|
+
_inherits(ReactSwipe, _Component);
|
|
73
|
+
return _createClass(ReactSwipe, [{
|
|
74
|
+
key: "componentDidMount",
|
|
75
|
+
value: function componentDidMount() {
|
|
76
|
+
if (this.swiper) {
|
|
77
|
+
this.swiper.addEventListener('touchmove', this._handleSwipeMove, getSafeEventHandlerOpts({
|
|
78
|
+
capture: true,
|
|
79
|
+
passive: false
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "componentWillUnmount",
|
|
85
|
+
value: function componentWillUnmount() {
|
|
86
|
+
if (this.swiper) {
|
|
87
|
+
this.swiper.removeEventListener('touchmove', this._handleSwipeMove, getSafeEventHandlerOpts({
|
|
88
|
+
capture: true,
|
|
89
|
+
passive: false
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "_onMouseDown",
|
|
95
|
+
value: function _onMouseDown(event) {
|
|
96
|
+
if (!this.props.allowMouseEvents) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.mouseDown = true;
|
|
100
|
+
document.addEventListener('mouseup', this._onMouseUp);
|
|
101
|
+
document.addEventListener('mousemove', this._onMouseMove);
|
|
102
|
+
this._handleSwipeStart(event);
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "_onMouseMove",
|
|
106
|
+
value: function _onMouseMove(event) {
|
|
107
|
+
if (!this.mouseDown) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
this._handleSwipeMove(event);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "_onMouseUp",
|
|
114
|
+
value: function _onMouseUp(event) {
|
|
115
|
+
this.mouseDown = false;
|
|
116
|
+
document.removeEventListener('mouseup', this._onMouseUp);
|
|
117
|
+
document.removeEventListener('mousemove', this._onMouseMove);
|
|
118
|
+
this._handleSwipeEnd(event);
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "_handleSwipeStart",
|
|
122
|
+
value: function _handleSwipeStart(event) {
|
|
123
|
+
var _getPosition = getPosition(event),
|
|
124
|
+
x = _getPosition.x,
|
|
125
|
+
y = _getPosition.y;
|
|
126
|
+
this.moveStart = {
|
|
127
|
+
x: x,
|
|
128
|
+
y: y
|
|
129
|
+
};
|
|
130
|
+
this.props.onSwipeStart(event);
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "_handleSwipeMove",
|
|
134
|
+
value: function _handleSwipeMove(event) {
|
|
135
|
+
if (!this.moveStart) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
var _getPosition2 = getPosition(event),
|
|
139
|
+
x = _getPosition2.x,
|
|
140
|
+
y = _getPosition2.y;
|
|
141
|
+
var deltaX = x - this.moveStart.x;
|
|
142
|
+
var deltaY = y - this.moveStart.y;
|
|
143
|
+
this.moving = true;
|
|
144
|
+
|
|
145
|
+
// handling the responsability of cancelling the scroll to
|
|
146
|
+
// the component handling the event
|
|
147
|
+
var shouldPreventDefault = this.props.onSwipeMove({
|
|
148
|
+
x: deltaX,
|
|
149
|
+
y: deltaY
|
|
150
|
+
}, event);
|
|
151
|
+
if (shouldPreventDefault && event.cancelable) {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
}
|
|
154
|
+
this.movePosition = {
|
|
155
|
+
deltaX: deltaX,
|
|
156
|
+
deltaY: deltaY
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
key: "_handleSwipeEnd",
|
|
161
|
+
value: function _handleSwipeEnd(event) {
|
|
162
|
+
this.props.onSwipeEnd(event);
|
|
163
|
+
var tolerance = this.props.tolerance;
|
|
164
|
+
if (this.moving && this.movePosition) {
|
|
165
|
+
if (this.movePosition.deltaX < -tolerance) {
|
|
166
|
+
this.props.onSwipeLeft(1, event);
|
|
167
|
+
} else if (this.movePosition.deltaX > tolerance) {
|
|
168
|
+
this.props.onSwipeRight(1, event);
|
|
169
|
+
}
|
|
170
|
+
if (this.movePosition.deltaY < -tolerance) {
|
|
171
|
+
this.props.onSwipeUp(1, event);
|
|
172
|
+
} else if (this.movePosition.deltaY > tolerance) {
|
|
173
|
+
this.props.onSwipeDown(1, event);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.moveStart = null;
|
|
177
|
+
this.moving = false;
|
|
178
|
+
this.movePosition = null;
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "_setSwiperRef",
|
|
182
|
+
value: function _setSwiperRef(node) {
|
|
183
|
+
this.swiper = node;
|
|
184
|
+
this.props.innerRef(node);
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
key: "render",
|
|
188
|
+
value: function render() {
|
|
189
|
+
var _this$props = this.props,
|
|
190
|
+
tagName = _this$props.tagName,
|
|
191
|
+
className = _this$props.className,
|
|
192
|
+
style = _this$props.style,
|
|
193
|
+
children = _this$props.children,
|
|
194
|
+
allowMouseEvents = _this$props.allowMouseEvents,
|
|
195
|
+
onSwipeUp = _this$props.onSwipeUp,
|
|
196
|
+
onSwipeDown = _this$props.onSwipeDown,
|
|
197
|
+
onSwipeLeft = _this$props.onSwipeLeft,
|
|
198
|
+
onSwipeRight = _this$props.onSwipeRight,
|
|
199
|
+
onSwipeStart = _this$props.onSwipeStart,
|
|
200
|
+
onSwipeMove = _this$props.onSwipeMove,
|
|
201
|
+
onSwipeEnd = _this$props.onSwipeEnd,
|
|
202
|
+
innerRef = _this$props.innerRef,
|
|
203
|
+
tolerance = _this$props.tolerance,
|
|
204
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
205
|
+
return /*#__PURE__*/React.createElement(this.props.tagName, _extends({
|
|
206
|
+
ref: this._setSwiperRef,
|
|
207
|
+
onMouseDown: this._onMouseDown,
|
|
208
|
+
onTouchStart: this._handleSwipeStart,
|
|
209
|
+
onTouchEnd: this._handleSwipeEnd,
|
|
210
|
+
className: className,
|
|
211
|
+
style: style
|
|
212
|
+
}, props), children);
|
|
213
|
+
}
|
|
214
|
+
}]);
|
|
215
|
+
}(Component);
|
|
216
|
+
_defineProperty(ReactSwipe, "displayName", 'ReactSwipe');
|
|
217
|
+
_defineProperty(ReactSwipe, "propTypes", {
|
|
218
|
+
tagName: PropTypes.string,
|
|
219
|
+
className: PropTypes.string,
|
|
220
|
+
style: PropTypes.object,
|
|
221
|
+
children: PropTypes.node,
|
|
222
|
+
allowMouseEvents: PropTypes.bool,
|
|
223
|
+
onSwipeUp: PropTypes.func,
|
|
224
|
+
onSwipeDown: PropTypes.func,
|
|
225
|
+
onSwipeLeft: PropTypes.func,
|
|
226
|
+
onSwipeRight: PropTypes.func,
|
|
227
|
+
onSwipeStart: PropTypes.func,
|
|
228
|
+
onSwipeMove: PropTypes.func,
|
|
229
|
+
onSwipeEnd: PropTypes.func,
|
|
230
|
+
innerRef: PropTypes.func,
|
|
231
|
+
tolerance: PropTypes.number.isRequired
|
|
232
|
+
});
|
|
233
|
+
_defineProperty(ReactSwipe, "defaultProps", {
|
|
234
|
+
tagName: 'div',
|
|
235
|
+
allowMouseEvents: false,
|
|
236
|
+
onSwipeUp: function onSwipeUp() {},
|
|
237
|
+
onSwipeDown: function onSwipeDown() {},
|
|
238
|
+
onSwipeLeft: function onSwipeLeft() {},
|
|
239
|
+
onSwipeRight: function onSwipeRight() {},
|
|
240
|
+
onSwipeStart: function onSwipeStart() {},
|
|
241
|
+
onSwipeMove: function onSwipeMove() {},
|
|
242
|
+
onSwipeEnd: function onSwipeEnd() {},
|
|
243
|
+
innerRef: function innerRef() {},
|
|
244
|
+
tolerance: 0
|
|
245
|
+
});
|
|
246
|
+
export default ReactSwipe;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helpdice/ui",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "esm/index.d.ts",
|
|
6
6
|
"unpkg": "dist/index.min.js",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
"sideEffects": false,
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@babel/core": "7.27.4",
|
|
55
|
-
"@helpdice/pro": "^1.1.6",
|
|
56
55
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
57
56
|
"@babel/plugin-transform-runtime": "^7.14.5",
|
|
58
57
|
"@babel/preset-env": "^7.14.7",
|
|
59
58
|
"@babel/preset-react": "^7.14.5",
|
|
60
59
|
"@babel/preset-typescript": "^7.14.5",
|
|
61
60
|
"@helpdice/icons": "^1.1.2",
|
|
61
|
+
"@helpdice/pro": "^1.1.6",
|
|
62
62
|
"@helpdice/theme": "^1.0.3",
|
|
63
63
|
"@mapbox/rehype-prism": "^0.9.0",
|
|
64
64
|
"@mdx-js/loader": "^3.1.0",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"react-color": "^2.19.3",
|
|
96
96
|
"react-dom": "^18.3.1",
|
|
97
97
|
"react-live": "^4.1.8",
|
|
98
|
+
"remark-gfm": "^4.0.1",
|
|
98
99
|
"rollup": "^4.32.1",
|
|
99
100
|
"styled-jsx": "^5.1.6",
|
|
100
101
|
"typescript": "^5.7.3",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"tslib": "^2.8.1"
|
|
134
135
|
},
|
|
135
136
|
"peerDependencies": {
|
|
136
|
-
"@helpdice/theme": "^1.0.
|
|
137
|
+
"@helpdice/theme": "^1.0.3",
|
|
137
138
|
"react": "^18.3.1 || ^19.1.0",
|
|
138
139
|
"react-dom": "^18.3.1 || ^19.1.0"
|
|
139
140
|
},
|
package/esm/carousal/Arrow.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import klass from '../../cssClasses'; // Assuming cssClasses.ts is in src/
|
|
3
|
-
|
|
4
|
-
var Arrow = function Arrow(_ref) {
|
|
5
|
-
var direction = _ref.direction,
|
|
6
|
-
onClickHandler = _ref.onClickHandler,
|
|
7
|
-
enabled = _ref.enabled,
|
|
8
|
-
label = _ref.label;
|
|
9
|
-
var isPrev = direction === 'prev';
|
|
10
|
-
var arrowClassName = isPrev ? klass.ARROW_PREV(!enabled) : klass.ARROW_NEXT(!enabled);
|
|
11
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
12
|
-
type: "button",
|
|
13
|
-
"aria-label": label,
|
|
14
|
-
className: arrowClassName,
|
|
15
|
-
onClick: onClickHandler
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
export default Arrow;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import klass from '../../cssClasses'; // Assuming cssClasses.ts is in src/
|
|
3
|
-
|
|
4
|
-
var Indicator = function Indicator(_ref) {
|
|
5
|
-
var onClickHandler = _ref.onClickHandler,
|
|
6
|
-
isSelected = _ref.isSelected,
|
|
7
|
-
index = _ref.index,
|
|
8
|
-
label = _ref.label;
|
|
9
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
10
|
-
className: klass.DOT(isSelected),
|
|
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
|
-
});
|
|
19
|
-
};
|
|
20
|
-
export default Indicator;
|
|
File without changes
|