react-joyride
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -60,2 +60,3 @@ import * as React from 'react'; | ||
type AnyObject<T = any> = Record<string, T>; | ||
type NarrowPlainObject<T extends Record<string, any>> = Exclude<T, Array<unknown> | Function | Map<unknown, unknown> | Set<unknown>>; | ||
interface Locale { | ||
@@ -342,2 +343,6 @@ back?: ReactNode; | ||
/** | ||
* Additional data you can add to the step. | ||
*/ | ||
data?: any; | ||
/** | ||
* Don't show the Beacon before the tooltip. | ||
@@ -505,5 +510,5 @@ * @default false | ||
declare namespace ReactJoyride { | ||
export { ACTIONS, type Actions, type AnyObject, type BaseProps, type BeaconProps, type BeaconRenderProps, type CallBackProps, type Callback, EVENTS, type Events, LIFECYCLE, type Lifecycle, type Locale, ORIGIN, type Origin, type OverlayProps, type Placement, type Props, STATUS, type State, type Status, type Step, type StepMerged, type StepProps, type StoreHelpers, type StoreOptions, type Styles, type StylesOptions, type StylesWithFloaterStyles, type TooltipProps, type TooltipRenderProps, Joyride as default }; | ||
export { ACTIONS, type Actions, type AnyObject, type BaseProps, type BeaconProps, type BeaconRenderProps, type CallBackProps, type Callback, EVENTS, type Events, LIFECYCLE, type Lifecycle, type Locale, type NarrowPlainObject, ORIGIN, type Origin, type OverlayProps, type Placement, type Props, STATUS, type State, type Status, type Step, type StepMerged, type StepProps, type StoreHelpers, type StoreOptions, type Styles, type StylesOptions, type StylesWithFloaterStyles, type TooltipProps, type TooltipRenderProps, Joyride as default }; | ||
} | ||
export = ReactJoyride; |
{ | ||
"name": "react-joyride", | ||
"version": "2.8.0", | ||
"version": "2.8.1", | ||
"description": "Create guided tours for your apps", | ||
@@ -41,3 +41,2 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"@gilbarbara/deep-equal": "^0.3.1", | ||
"@gilbarbara/helpers": "^0.9.2", | ||
"deep-diff": "^1.0.2", | ||
@@ -52,6 +51,6 @@ "deepmerge": "^4.3.1", | ||
"tree-changes": "^0.11.2", | ||
"type-fest": "^4.12.0" | ||
"type-fest": "^4.15.0" | ||
}, | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "^0.15.1", | ||
"@arethetypeswrong/cli": "^0.15.3", | ||
"@gilbarbara/eslint-config": "^0.7.5", | ||
@@ -61,13 +60,13 @@ "@gilbarbara/node-helpers": "^0.1.0", | ||
"@gilbarbara/tsconfig": "^0.2.3", | ||
"@playwright/experimental-ct-react": "^1.42.1", | ||
"@size-limit/preset-big-lib": "^11.1.1", | ||
"@swc/core": "^1.4.8", | ||
"@testing-library/dom": "^9.3.4", | ||
"@playwright/experimental-ct-react": "^1.43.0", | ||
"@size-limit/preset-big-lib": "^11.1.2", | ||
"@swc/core": "^1.4.12", | ||
"@testing-library/dom": "^10.0.0", | ||
"@testing-library/jest-dom": "^6.4.2", | ||
"@testing-library/react": "^14.2.1", | ||
"@testing-library/react": "^14.3.0", | ||
"@total-typescript/shoehorn": "^0.1.2", | ||
"@types/exenv": "^1.2.2", | ||
"@types/node": "^20.11.28", | ||
"@types/react": "^18.2.66", | ||
"@types/react-dom": "^18.2.22", | ||
"@types/node": "^20.12.5", | ||
"@types/react": "^18.2.74", | ||
"@types/react-dom": "^18.2.24", | ||
"@types/scroll": "^3.0.3", | ||
@@ -77,3 +76,3 @@ "@types/scrollparent": "^2.0.3", | ||
"@vitest/coverage-v8": "^1.4.0", | ||
"caniuse-lite": "^1.0.30001598", | ||
"caniuse-lite": "^1.0.30001607", | ||
"cross-env": "^7.0.3", | ||
@@ -89,6 +88,6 @@ "csstype": "^3.1.3", | ||
"repo-tools": "^0.3.1", | ||
"size-limit": "^11.1.1", | ||
"size-limit": "^11.1.2", | ||
"ts-node": "^10.9.2", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.2", | ||
"typescript": "^5.4.4", | ||
"vite-tsconfig-paths": "^4.3.2", | ||
@@ -165,4 +164,3 @@ "vitest": "^1.4.0" | ||
} | ||
], | ||
"packageManager": "pnpm@8.6.2+sha256.c6da9e00697e334b6193c034a5d1508e4c8605b12f249736b13f31139f4f0d73" | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
import { noop } from '@gilbarbara/helpers'; | ||
import { noop } from '~/modules/helpers'; | ||
@@ -3,0 +3,0 @@ export const defaultFloaterProps = { |
@@ -7,3 +7,3 @@ import { isValidElement, ReactNode } from 'react'; | ||
import { Lifecycle, Step } from '~/types'; | ||
import { AnyObject, Lifecycle, NarrowPlainObject, Step } from '~/types'; | ||
@@ -176,2 +176,70 @@ import { hasPosition } from './dom'; | ||
/** | ||
* A function that does nothing. | ||
*/ | ||
export function noop() { | ||
return undefined; | ||
} | ||
/** | ||
* Type-safe Object.keys() | ||
*/ | ||
export function objectKeys<T extends AnyObject>(input: T) { | ||
return Object.keys(input) as Array<keyof T>; | ||
} | ||
/** | ||
* Remove properties from an object | ||
*/ | ||
export function omit<T extends Record<string, any>, K extends keyof T>( | ||
input: NarrowPlainObject<T>, | ||
...filter: K[] | ||
) { | ||
if (!is.plainObject(input)) { | ||
throw new TypeError('Expected an object'); | ||
} | ||
const output: any = {}; | ||
for (const key in input) { | ||
/* istanbul ignore else */ | ||
if ({}.hasOwnProperty.call(input, key)) { | ||
if (!filter.includes(key as unknown as K)) { | ||
output[key] = input[key]; | ||
} | ||
} | ||
} | ||
return output as Omit<T, K>; | ||
} | ||
/** | ||
* Select properties from an object | ||
*/ | ||
export function pick<T extends Record<string, any>, K extends keyof T>( | ||
input: NarrowPlainObject<T>, | ||
...filter: K[] | ||
) { | ||
if (!is.plainObject(input)) { | ||
throw new TypeError('Expected an object'); | ||
} | ||
if (!filter.length) { | ||
return input; | ||
} | ||
const output: any = {}; | ||
for (const key in input) { | ||
/* istanbul ignore else */ | ||
if ({}.hasOwnProperty.call(input, key)) { | ||
if (filter.includes(key as unknown as K)) { | ||
output[key] = input[key]; | ||
} | ||
} | ||
} | ||
return output as Pick<T, K>; | ||
} | ||
export function shouldScroll(options: ShouldScrollOptions): boolean { | ||
@@ -189,1 +257,10 @@ const { isFirstStep, lifecycle, previousLifecycle, scrollToFirstStep, step, target } = options; | ||
} | ||
/** | ||
* Block execution | ||
*/ | ||
export function sleep(seconds = 1) { | ||
return new Promise(resolve => { | ||
setTimeout(resolve, seconds * 1000); | ||
}); | ||
} |
import { Props as FloaterProps } from 'react-floater'; | ||
import { omit, pick } from '@gilbarbara/helpers'; | ||
import deepmerge from 'deepmerge'; | ||
@@ -12,3 +11,3 @@ import is from 'is-lite'; | ||
import { getElement, hasCustomScrollParent } from './dom'; | ||
import { log } from './helpers'; | ||
import { log, omit, pick } from './helpers'; | ||
@@ -15,0 +14,0 @@ function getTourProps(props: Props) { |
import { Props as FloaterProps } from 'react-floater'; | ||
import { objectKeys, omit } from '@gilbarbara/helpers'; | ||
import is from 'is-lite'; | ||
@@ -9,3 +8,3 @@ | ||
import { hasValidKeys } from './helpers'; | ||
import { hasValidKeys, objectKeys, omit } from './helpers'; | ||
@@ -12,0 +11,0 @@ type StateWithContinuous = State & { continuous: boolean }; |
@@ -15,2 +15,8 @@ import { CSSProperties, ReactNode } from 'react'; | ||
export type NarrowPlainObject<T extends Record<string, any>> = Exclude< | ||
T, | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
Array<unknown> | Function | Map<unknown, unknown> | Set<unknown> | ||
>; | ||
export interface Locale { | ||
@@ -17,0 +23,0 @@ back?: ReactNode; |
@@ -226,2 +226,6 @@ import { ElementType, MouseEventHandler, ReactNode, RefCallback } from 'react'; | ||
/** | ||
* Additional data you can add to the step. | ||
*/ | ||
data?: any; | ||
/** | ||
* Don't show the Beacon before the tooltip. | ||
@@ -228,0 +232,0 @@ * @default false |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
481761
13
7638
- Removed@gilbarbara/helpers@^0.9.2
- Removed@gilbarbara/helpers@0.9.3(transitive)
- Removed@gilbarbara/types@0.2.2(transitive)
Updatedtype-fest@^4.15.0