@rc-component/tour
Advanced tools
Comparing version 1.0.0-8 to 1.0.0-9
@@ -0,0 +0,0 @@ import type { TourStepInfo } from '..'; |
@@ -1,2 +0,2 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { useState, useMemo } from 'react'; | ||
@@ -3,0 +3,0 @@ import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect"; |
@@ -0,0 +0,0 @@ import Tour from './Tour'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -1,2 +0,2 @@ | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import React, { forwardRef } from 'react'; | ||
@@ -3,0 +3,0 @@ import classNames from 'classnames'; |
@@ -0,0 +0,0 @@ import type { BuildInPlacements } from 'rc-trigger'; |
@@ -1,2 +0,2 @@ | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread2"; | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
var autoAdjustOverflow = { | ||
@@ -3,0 +3,0 @@ adjustX: 1, |
@@ -12,3 +12,3 @@ import type { ReactNode } from 'react'; | ||
onChange?: (current: number) => void; | ||
onClose?: () => void; | ||
onClose?: (current: number) => void; | ||
onFinish?: () => void; | ||
@@ -15,0 +15,0 @@ mask?: boolean; |
@@ -1,7 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread2"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import _typeof from "@babel/runtime/helpers/typeof"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
var _excluded = ["prefixCls", "steps", "defaultCurrent", "current", "onChange", "onClose", "onFinish", "open", "mask", "arrow", "rootClassName", "placement", "renderPanel", "gap"]; | ||
@@ -58,3 +58,11 @@ import * as React from 'react'; | ||
var mergedOpen = mergedCurrent < 0 || mergedCurrent >= steps.length ? false : open !== null && open !== void 0 ? open : true; | ||
var _useMergedState3 = useMergedState(undefined, { | ||
value: open, | ||
postState: function postState(origin) { | ||
return mergedCurrent < 0 || mergedCurrent >= steps.length ? false : origin !== null && origin !== void 0 ? origin : true; | ||
} | ||
}), | ||
_useMergedState4 = _slicedToArray(_useMergedState3, 2), | ||
mergedOpen = _useMergedState4[0], | ||
setMergedOpen = _useMergedState4[1]; | ||
@@ -115,8 +123,9 @@ var _ref = steps[mergedCurrent] || {}, | ||
onClose: function onClose() { | ||
setMergedCurrent(-1); | ||
_onClose === null || _onClose === void 0 ? void 0 : _onClose(); | ||
setMergedOpen(false); | ||
_onClose === null || _onClose === void 0 ? void 0 : _onClose(mergedCurrent); | ||
}, | ||
current: mergedCurrent, | ||
onFinish: function onFinish() { | ||
setMergedCurrent(-1); | ||
setMergedOpen(false); | ||
_onClose === null || _onClose === void 0 ? void 0 : _onClose(mergedCurrent); | ||
_onFinish === null || _onFinish === void 0 ? void 0 : _onFinish(); | ||
@@ -133,3 +142,2 @@ } | ||
popupVisible: mergedOpen, | ||
key: mergedCurrent, | ||
popupClassName: classNames(rootClassName, stepClassName), | ||
@@ -139,2 +147,3 @@ prefixCls: prefixCls, | ||
forceRender: false, | ||
destroyPopupOnHide: true, | ||
zIndex: 1090 | ||
@@ -146,3 +155,2 @@ }), /*#__PURE__*/React.createElement(Portal, { | ||
className: classNames(rootClassName, "".concat(prefixCls, "-target-placeholder")), | ||
key: mergedCurrent, | ||
style: _objectSpread(_objectSpread({}, posInfo || CENTER_PLACEHOLDER), {}, { | ||
@@ -149,0 +157,0 @@ position: 'fixed', |
/// <reference types="react" /> | ||
import type { TourStepProps } from '.'; | ||
export default function DefaultPanel(props: TourStepProps): JSX.Element; |
@@ -1,2 +0,2 @@ | ||
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; | ||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
import * as React from 'react'; | ||
@@ -20,16 +20,3 @@ export default function DefaultPanel(props) { | ||
className: "".concat(prefixCls, "-close-x") | ||
}), /*#__PURE__*/React.createElement("span", { | ||
role: "img", | ||
"aria-label": "close" | ||
}, /*#__PURE__*/React.createElement("svg", { | ||
viewBox: "64 64 896 896", | ||
focusable: "false", | ||
"data-icon": "close", | ||
width: "1em", | ||
height: "1em", | ||
fill: "currentColor", | ||
"aria-hidden": "true" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
d: "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" | ||
})))), /*#__PURE__*/React.createElement("div", { | ||
}, "\xD7")), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-header") | ||
@@ -53,18 +40,12 @@ }, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-buttons") | ||
}, current !== 0 ? /*#__PURE__*/React.createElement("div", { | ||
}, current !== 0 ? /*#__PURE__*/React.createElement("button", { | ||
className: "".concat(prefixCls, "-prev-btn"), | ||
onClick: onPrev | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "ant-btn ant-btn-primary" | ||
}, "\u4E0A\u4E00\u6B65")) : null, current === total - 1 ? /*#__PURE__*/React.createElement("div", { | ||
}, "Prev") : null, current === total - 1 ? /*#__PURE__*/React.createElement("button", { | ||
className: "".concat(prefixCls, "-finish-btn"), | ||
onClick: onFinish | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "ant-btn ant-btn-primary" | ||
}, "\u7ED3\u675F\u5F15\u5BFC")) : /*#__PURE__*/React.createElement("div", { | ||
}, "Finish") : /*#__PURE__*/React.createElement("button", { | ||
className: "".concat(prefixCls, "-next-btn"), | ||
onClick: onNext | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "ant-btn ant-btn-primary" | ||
}, "\u4E0B\u4E00\u6B65"))))); | ||
}, "Next")))); | ||
} |
@@ -0,0 +0,0 @@ import type { ReactNode, CSSProperties } from 'react'; |
@@ -1,5 +0,1 @@ | ||
export declare function getMotionName(prefixCls: string, transitionName?: string, animationName?: string): string; | ||
export declare function getUUID(): number; | ||
export declare function isWindow(obj: any): obj is Window; | ||
export declare function getScroll(target: HTMLElement | Window | Document | null, top?: boolean): number; | ||
export declare function isInViewPort(element: HTMLElement): boolean; |
@@ -1,52 +0,1 @@ | ||
// =============================== Motion =============================== | ||
export function getMotionName(prefixCls, transitionName, animationName) { | ||
var motionName = transitionName; | ||
if (!motionName && animationName) { | ||
motionName = "".concat(prefixCls, "-").concat(animationName); | ||
} | ||
return motionName; | ||
} // ================================ UUID ================================ | ||
var uuid = -1; | ||
export function getUUID() { | ||
uuid += 1; | ||
return uuid; | ||
} // =============================== getScroll =============================== | ||
export function isWindow(obj) { | ||
return obj !== null && obj !== undefined && obj === obj.window; | ||
} | ||
export function getScroll(target, top) { | ||
if (typeof window === 'undefined') { | ||
return 0; | ||
} | ||
var method = top ? 'scrollTop' : 'scrollLeft'; | ||
var result = 0; | ||
if (isWindow(target)) { | ||
result = target[top ? 'pageYOffset' : 'pageXOffset']; | ||
} else if (target instanceof Document) { | ||
result = target.documentElement[method]; | ||
} else if (target instanceof HTMLElement) { | ||
result = target[method]; | ||
} else if (target) { | ||
// According to the type inference, the `target` is `never` type. | ||
// Since we configured the loose mode type checking, and supports mocking the target with such shape below:: | ||
// `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`, | ||
// the program may falls into this branch. | ||
// Check the corresponding tests for details. Don't sure what is the real scenario this happens. | ||
result = target[method]; | ||
} | ||
if (target && !isWindow(target) && typeof result !== 'number' && !(target instanceof HTMLElement)) { | ||
var _documentElement, _target$ownerDocument; | ||
result = (_documentElement = ((_target$ownerDocument = target.ownerDocument) !== null && _target$ownerDocument !== void 0 ? _target$ownerDocument : target).documentElement) === null || _documentElement === void 0 ? void 0 : _documentElement[method]; | ||
} | ||
return result; | ||
} | ||
export function isInViewPort(element) { | ||
@@ -53,0 +2,0 @@ var viewWidth = window.innerWidth || document.documentElement.clientWidth; |
@@ -0,0 +0,0 @@ import type { TourStepInfo } from '..'; |
@@ -0,0 +0,0 @@ import Tour from './Tour'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import type { BuildInPlacements } from 'rc-trigger'; |
@@ -12,3 +12,3 @@ import type { ReactNode } from 'react'; | ||
onChange?: (current: number) => void; | ||
onClose?: () => void; | ||
onClose?: (current: number) => void; | ||
onFinish?: () => void; | ||
@@ -15,0 +15,0 @@ mask?: boolean; |
@@ -32,3 +32,3 @@ "use strict"; | ||
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState")); | ||
var _useMergedState5 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState")); | ||
@@ -77,3 +77,3 @@ var _useTarget3 = _interopRequireDefault(require("./hooks/useTarget")); | ||
var _useMergedState = (0, _useMergedState3.default)(0, { | ||
var _useMergedState = (0, _useMergedState5.default)(0, { | ||
value: current, | ||
@@ -86,3 +86,11 @@ defaultValue: defaultCurrent | ||
var mergedOpen = mergedCurrent < 0 || mergedCurrent >= steps.length ? false : open !== null && open !== void 0 ? open : true; | ||
var _useMergedState3 = (0, _useMergedState5.default)(undefined, { | ||
value: open, | ||
postState: function postState(origin) { | ||
return mergedCurrent < 0 || mergedCurrent >= steps.length ? false : origin !== null && origin !== void 0 ? origin : true; | ||
} | ||
}), | ||
_useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2), | ||
mergedOpen = _useMergedState4[0], | ||
setMergedOpen = _useMergedState4[1]; | ||
@@ -143,8 +151,9 @@ var _ref = steps[mergedCurrent] || {}, | ||
onClose: function onClose() { | ||
setMergedCurrent(-1); | ||
_onClose === null || _onClose === void 0 ? void 0 : _onClose(); | ||
setMergedOpen(false); | ||
_onClose === null || _onClose === void 0 ? void 0 : _onClose(mergedCurrent); | ||
}, | ||
current: mergedCurrent, | ||
onFinish: function onFinish() { | ||
setMergedCurrent(-1); | ||
setMergedOpen(false); | ||
_onClose === null || _onClose === void 0 ? void 0 : _onClose(mergedCurrent); | ||
_onFinish === null || _onFinish === void 0 ? void 0 : _onFinish(); | ||
@@ -161,3 +170,2 @@ } | ||
popupVisible: mergedOpen, | ||
key: mergedCurrent, | ||
popupClassName: (0, _classnames.default)(rootClassName, stepClassName), | ||
@@ -167,2 +175,3 @@ prefixCls: prefixCls, | ||
forceRender: false, | ||
destroyPopupOnHide: true, | ||
zIndex: 1090 | ||
@@ -174,3 +183,2 @@ }), /*#__PURE__*/React.createElement(_portal.default, { | ||
className: (0, _classnames.default)(rootClassName, "".concat(prefixCls, "-target-placeholder")), | ||
key: mergedCurrent, | ||
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, posInfo || CENTER_PLACEHOLDER), {}, { | ||
@@ -177,0 +185,0 @@ position: 'fixed', |
/// <reference types="react" /> | ||
import type { TourStepProps } from '.'; | ||
export default function DefaultPanel(props: TourStepProps): JSX.Element; |
@@ -33,16 +33,3 @@ "use strict"; | ||
className: "".concat(prefixCls, "-close-x") | ||
}), /*#__PURE__*/React.createElement("span", { | ||
role: "img", | ||
"aria-label": "close" | ||
}, /*#__PURE__*/React.createElement("svg", { | ||
viewBox: "64 64 896 896", | ||
focusable: "false", | ||
"data-icon": "close", | ||
width: "1em", | ||
height: "1em", | ||
fill: "currentColor", | ||
"aria-hidden": "true" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
d: "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" | ||
})))), /*#__PURE__*/React.createElement("div", { | ||
}, "\xD7")), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-header") | ||
@@ -66,18 +53,12 @@ }, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-buttons") | ||
}, current !== 0 ? /*#__PURE__*/React.createElement("div", { | ||
}, current !== 0 ? /*#__PURE__*/React.createElement("button", { | ||
className: "".concat(prefixCls, "-prev-btn"), | ||
onClick: onPrev | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "ant-btn ant-btn-primary" | ||
}, "\u4E0A\u4E00\u6B65")) : null, current === total - 1 ? /*#__PURE__*/React.createElement("div", { | ||
}, "Prev") : null, current === total - 1 ? /*#__PURE__*/React.createElement("button", { | ||
className: "".concat(prefixCls, "-finish-btn"), | ||
onClick: onFinish | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "ant-btn ant-btn-primary" | ||
}, "\u7ED3\u675F\u5F15\u5BFC")) : /*#__PURE__*/React.createElement("div", { | ||
}, "Finish") : /*#__PURE__*/React.createElement("button", { | ||
className: "".concat(prefixCls, "-next-btn"), | ||
onClick: onNext | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "ant-btn ant-btn-primary" | ||
}, "\u4E0B\u4E00\u6B65"))))); | ||
}, "Next")))); | ||
} |
@@ -0,0 +0,0 @@ import type { ReactNode, CSSProperties } from 'react'; |
@@ -1,5 +0,1 @@ | ||
export declare function getMotionName(prefixCls: string, transitionName?: string, animationName?: string): string; | ||
export declare function getUUID(): number; | ||
export declare function isWindow(obj: any): obj is Window; | ||
export declare function getScroll(target: HTMLElement | Window | Document | null, top?: boolean): number; | ||
export declare function isInViewPort(element: HTMLElement): boolean; |
@@ -6,64 +6,4 @@ "use strict"; | ||
}); | ||
exports.getMotionName = getMotionName; | ||
exports.getScroll = getScroll; | ||
exports.getUUID = getUUID; | ||
exports.isInViewPort = isInViewPort; | ||
exports.isWindow = isWindow; | ||
// =============================== Motion =============================== | ||
function getMotionName(prefixCls, transitionName, animationName) { | ||
var motionName = transitionName; | ||
if (!motionName && animationName) { | ||
motionName = "".concat(prefixCls, "-").concat(animationName); | ||
} | ||
return motionName; | ||
} // ================================ UUID ================================ | ||
var uuid = -1; | ||
function getUUID() { | ||
uuid += 1; | ||
return uuid; | ||
} // =============================== getScroll =============================== | ||
function isWindow(obj) { | ||
return obj !== null && obj !== undefined && obj === obj.window; | ||
} | ||
function getScroll(target, top) { | ||
if (typeof window === 'undefined') { | ||
return 0; | ||
} | ||
var method = top ? 'scrollTop' : 'scrollLeft'; | ||
var result = 0; | ||
if (isWindow(target)) { | ||
result = target[top ? 'pageYOffset' : 'pageXOffset']; | ||
} else if (target instanceof Document) { | ||
result = target.documentElement[method]; | ||
} else if (target instanceof HTMLElement) { | ||
result = target[method]; | ||
} else if (target) { | ||
// According to the type inference, the `target` is `never` type. | ||
// Since we configured the loose mode type checking, and supports mocking the target with such shape below:: | ||
// `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`, | ||
// the program may falls into this branch. | ||
// Check the corresponding tests for details. Don't sure what is the real scenario this happens. | ||
result = target[method]; | ||
} | ||
if (target && !isWindow(target) && typeof result !== 'number' && !(target instanceof HTMLElement)) { | ||
var _documentElement, _target$ownerDocument; | ||
result = (_documentElement = ((_target$ownerDocument = target.ownerDocument) !== null && _target$ownerDocument !== void 0 ? _target$ownerDocument : target).documentElement) === null || _documentElement === void 0 ? void 0 : _documentElement[method]; | ||
} | ||
return result; | ||
} | ||
function isInViewPort(element) { | ||
@@ -70,0 +10,0 @@ var viewWidth = window.innerWidth || document.documentElement.clientWidth; |
{ | ||
"name": "@rc-component/tour", | ||
"version": "1.0.0-8", | ||
"version": "1.0.0-9", | ||
"description": "React tour Component", | ||
@@ -39,6 +39,3 @@ "keywords": [ | ||
"start": "dumi dev", | ||
"test": "npm run test:client && npm run test:server", | ||
"test:client": "umi-test --testPathIgnorePatterns=ssr.test.tsx --testPathIgnorePatterns=ssr.test.tsx", | ||
"test:coverage": "npm run test:client --coverage", | ||
"test:server": "umi-test --env=node tests/ssr.test.tsx", | ||
"test": "umi-test", | ||
"watch": "father dev" | ||
@@ -45,0 +42,0 @@ }, |
@@ -0,0 +0,0 @@ # @rc-component/tour |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55036
1267