@mediamonks/react-kit 1.0.0-0
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/LICENSE +21 -0
- package/README.md +125 -0
- package/dist/_hooks/useStorybookLog.d.ts +21 -0
- package/dist/_hooks/useStorybookLog.js +29 -0
- package/dist/_utils/childrenAreEqual.d.ts +2 -0
- package/dist/_utils/childrenAreEqual.js +16 -0
- package/dist/_utils/getId.d.ts +1 -0
- package/dist/_utils/getId.js +4 -0
- package/dist/_utils/isNonNullableRecord/isNonNullableRecord.d.ts +9 -0
- package/dist/_utils/isNonNullableRecord/isNonNullableRecord.js +6 -0
- package/dist/_utils/trimEnd/trimEnd.d.ts +4 -0
- package/dist/_utils/trimEnd/trimEnd.js +9 -0
- package/dist/components/AutoFill/AutoFill.d.ts +13 -0
- package/dist/components/AutoFill/AutoFill.js +33 -0
- package/dist/gsap/animations.d.ts +11 -0
- package/dist/gsap/animations.js +35 -0
- package/dist/gsap/components/SplitTextWrapper/SplitTextWrapper.d.ts +24 -0
- package/dist/gsap/components/SplitTextWrapper/SplitTextWrapper.js +28 -0
- package/dist/gsap/hooks/useAnimation/useAnimation.d.ts +6 -0
- package/dist/gsap/hooks/useAnimation/useAnimation.js +19 -0
- package/dist/gsap/hooks/useExposeAnimation/useExposeAnimation.d.ts +6 -0
- package/dist/gsap/hooks/useExposeAnimation/useExposeAnimation.js +28 -0
- package/dist/gsap/hooks/useExposedAnimation/useExposedAnimation.d.ts +5 -0
- package/dist/gsap/hooks/useExposedAnimation/useExposedAnimation.js +13 -0
- package/dist/gsap/hooks/useExposedAnimations/useExposedAnimations.d.ts +5 -0
- package/dist/gsap/hooks/useExposedAnimations/useExposedAnimations.js +32 -0
- package/dist/gsap/hooks/useFlip/useFlip.d.ts +3 -0
- package/dist/gsap/hooks/useFlip/useFlip.js +18 -0
- package/dist/gsap/hooks/useScrollAnimation/useScrollAnimation.d.ts +9 -0
- package/dist/gsap/hooks/useScrollAnimation/useScrollAnimation.js +26 -0
- package/dist/gsap/utils/getAnimation/getAnimation.d.ts +4 -0
- package/dist/gsap/utils/getAnimation/getAnimation.js +7 -0
- package/dist/hocs/ensuredForwardRef/ensuredForwardRef.d.ts +11 -0
- package/dist/hocs/ensuredForwardRef/ensuredForwardRef.js +31 -0
- package/dist/hooks/useClientSideValue/useClientSideValue.d.ts +11 -0
- package/dist/hooks/useClientSideValue/useClientSideValue.js +19 -0
- package/dist/hooks/useEventListener/useEventListener.d.ts +2 -0
- package/dist/hooks/useEventListener/useEventListener.js +17 -0
- package/dist/hooks/useForceRerender/useForceRerender.d.ts +11 -0
- package/dist/hooks/useForceRerender/useForceRerender.js +18 -0
- package/dist/hooks/useHasFocus/useHasFocus.d.ts +9 -0
- package/dist/hooks/useHasFocus/useHasFocus.js +18 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +13 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.js +38 -0
- package/dist/hooks/useInterval/useInterval.d.ts +8 -0
- package/dist/hooks/useInterval/useInterval.js +25 -0
- package/dist/hooks/useMediaDuration/useMediaDuration.d.ts +5 -0
- package/dist/hooks/useMediaDuration/useMediaDuration.js +20 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +33 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.js +32 -0
- package/dist/hooks/useMutationObserver/useMutationObserver.d.ts +16 -0
- package/dist/hooks/useMutationObserver/useMutationObserver.js +36 -0
- package/dist/hooks/useRafCallback/useRafCallback.d.ts +5 -0
- package/dist/hooks/useRafCallback/useRafCallback.js +21 -0
- package/dist/hooks/useRefValue/useRefValue.d.ts +11 -0
- package/dist/hooks/useRefValue/useRefValue.js +15 -0
- package/dist/hooks/useRefs/useRefs.d.ts +5 -0
- package/dist/hooks/useRefs/useRefs.js +17 -0
- package/dist/hooks/useRefs/useRefs.types.d.ts +15 -0
- package/dist/hooks/useRefs/useRefs.types.js +1 -0
- package/dist/hooks/useRefs/utils/assertAndUnwrapRefs/assertAndUnwrapRefs.d.ts +14 -0
- package/dist/hooks/useRefs/utils/assertAndUnwrapRefs/assertAndUnwrapRefs.js +19 -0
- package/dist/hooks/useRefs/utils/unwrapRefs/unwrapRefs.d.ts +6 -0
- package/dist/hooks/useRefs/utils/unwrapRefs/unwrapRefs.js +12 -0
- package/dist/hooks/useRefs/utils/unwrapRefs/unwrapRefs.types.d.ts +7 -0
- package/dist/hooks/useRefs/utils/unwrapRefs/unwrapRefs.types.js +1 -0
- package/dist/hooks/useRefs/utils/validateAndUnwrapRefs/validateAndUnwrapRefs.d.ts +12 -0
- package/dist/hooks/useRefs/utils/validateAndUnwrapRefs/validateAndUnwrapRefs.js +17 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +9 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +22 -0
- package/dist/hooks/useStaticValue/useStaticValue.d.ts +6 -0
- package/dist/hooks/useStaticValue/useStaticValue.js +11 -0
- package/dist/hooks/useToggle/useToggle.d.ts +16 -0
- package/dist/hooks/useToggle/useToggle.js +23 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +46 -0
- package/dist/lifecycle/components/CrossFlow/CrossFlow.d.ts +3 -0
- package/dist/lifecycle/components/CrossFlow/CrossFlow.js +55 -0
- package/dist/lifecycle/components/TransitionPresence/TransitionPresence.context.d.ts +4 -0
- package/dist/lifecycle/components/TransitionPresence/TransitionPresence.context.js +2 -0
- package/dist/lifecycle/components/TransitionPresence/TransitionPresence.d.ts +13 -0
- package/dist/lifecycle/components/TransitionPresence/TransitionPresence.js +61 -0
- package/dist/lifecycle/hooks/useBeforeMount/useBeforeMount.d.ts +11 -0
- package/dist/lifecycle/hooks/useBeforeMount/useBeforeMount.js +21 -0
- package/dist/lifecycle/hooks/useBeforeUnmount/useBeforeUnmount.d.ts +11 -0
- package/dist/lifecycle/hooks/useBeforeUnmount/useBeforeUnmount.js +39 -0
- package/dist/lifecycle/hooks/useIsMounted/useIsMounted.d.ts +13 -0
- package/dist/lifecycle/hooks/useIsMounted/useIsMounted.js +34 -0
- package/dist/lifecycle/hooks/useIsMountedState/useIsMountedState.d.ts +9 -0
- package/dist/lifecycle/hooks/useIsMountedState/useIsMountedState.js +21 -0
- package/dist/lifecycle/hooks/useMount/useMount.d.ts +12 -0
- package/dist/lifecycle/hooks/useMount/useMount.js +16 -0
- package/dist/lifecycle/hooks/useUnmount/useUnmount.d.ts +12 -0
- package/dist/lifecycle/hooks/useUnmount/useUnmount.js +19 -0
- package/dist/nextjs/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +18 -0
- package/dist/nextjs/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +18 -0
- package/dist/utils/arrayRef/arrayRef.d.ts +8 -0
- package/dist/utils/arrayRef/arrayRef.js +35 -0
- package/dist/utils/createTimeout/createTimeout.d.ts +5 -0
- package/dist/utils/createTimeout/createTimeout.js +9 -0
- package/dist/utils/isRefObject/isRefObject.d.ts +5 -0
- package/dist/utils/isRefObject/isRefObject.js +6 -0
- package/dist/utils/unref/unref.d.ts +13 -0
- package/dist/utils/unref/unref.js +7 -0
- package/package.json +131 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Type for a value that is optionally wrapped in a RefObject type
|
|
4
|
+
*/
|
|
5
|
+
export type Unreffable<T> = RefObject<T> | T;
|
|
6
|
+
/**
|
|
7
|
+
* Type to get the value of a Unreffable
|
|
8
|
+
*/
|
|
9
|
+
export type Unref<T extends Unreffable<unknown>> = T extends RefObject<infer U> ? U : T;
|
|
10
|
+
/**
|
|
11
|
+
* This function returns the current value of a ref object, or the plain value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function unref<T>(target: Unreffable<T>): T | null;
|
package/package.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mediamonks/react-kit",
|
|
3
|
+
"version": "1.0.0-0",
|
|
4
|
+
"description": "A collection of React hooks, components, utilities that we use at Media.Monks",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"components",
|
|
8
|
+
"typescript",
|
|
9
|
+
"hooks"
|
|
10
|
+
],
|
|
11
|
+
"repository": "git@github.com:mediamonks/react-kit.git",
|
|
12
|
+
"author": "frontend.monks",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/**/*",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"provenance": false
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "npm-run-all -s clean build:*",
|
|
30
|
+
"build:ts": "tsc -p ./tsconfig.build.json",
|
|
31
|
+
"clean": "npm-run-all clean:*",
|
|
32
|
+
"clean:test": "shx rm -rf coverage .nyc_output",
|
|
33
|
+
"clean:npm": "shx rm -rf dist",
|
|
34
|
+
"lint": "npm-run-all lint:*",
|
|
35
|
+
"lint:eslint": "eslint --ext .js,.jsx,.cjs,.ts,.tsx ./src",
|
|
36
|
+
"lint:prettier": "prettier . --check",
|
|
37
|
+
"test": "npm-run-all -s test:*",
|
|
38
|
+
"test:vitest": "vitest ./src/",
|
|
39
|
+
"test:storybook": "concurrently -k -s first \"npm run storybook:build --quiet && npx http-server ./.docs/react-kit --port 6006 --silent\" \"wait-on tcp:6006 && npm run storybook:test\"",
|
|
40
|
+
"check-types": "tsc --project tsconfig.json --noEmit --noUnusedLocals",
|
|
41
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
42
|
+
"storybook:build": "storybook build -o ./.docs/react-kit",
|
|
43
|
+
"storybook:test": "test-storybook --url http://localhost:6006",
|
|
44
|
+
"storybook:deploy": "./deploy-docs.sh",
|
|
45
|
+
"prepublishOnly": "npm run build",
|
|
46
|
+
"plop": "plop",
|
|
47
|
+
"prepare": "husky install"
|
|
48
|
+
},
|
|
49
|
+
"prettier": "@mediamonks/prettier-config",
|
|
50
|
+
"eslintConfig": {
|
|
51
|
+
"overrides": [
|
|
52
|
+
{
|
|
53
|
+
"files": [
|
|
54
|
+
"*.ts",
|
|
55
|
+
"*.tsx"
|
|
56
|
+
],
|
|
57
|
+
"extends": [
|
|
58
|
+
"@mediamonks/eslint-config",
|
|
59
|
+
"@mediamonks/eslint-config-react",
|
|
60
|
+
"@mediamonks/eslint-config-typescript",
|
|
61
|
+
"@mediamonks/eslint-config-typescript-react"
|
|
62
|
+
],
|
|
63
|
+
"parserOptions": {
|
|
64
|
+
"project": "./tsconfig.json"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"files": [
|
|
69
|
+
"*.cjs",
|
|
70
|
+
"*.js",
|
|
71
|
+
"*.jsx",
|
|
72
|
+
"*.mjs"
|
|
73
|
+
],
|
|
74
|
+
"extends": [
|
|
75
|
+
"@mediamonks/eslint-config"
|
|
76
|
+
],
|
|
77
|
+
"parserOptions": {
|
|
78
|
+
"ecmaVersion": "latest"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@mediamonks/eslint-config": "^2.0.6",
|
|
85
|
+
"@mediamonks/eslint-config-react": "^2.1.11",
|
|
86
|
+
"@mediamonks/eslint-config-typescript": "^1.0.8",
|
|
87
|
+
"@mediamonks/eslint-config-typescript-react": "^1.0.10",
|
|
88
|
+
"@mediamonks/prettier-config": "^1.0.1",
|
|
89
|
+
"@storybook/addon-essentials": "^7.5.2",
|
|
90
|
+
"@storybook/addon-interactions": "^7.5.2",
|
|
91
|
+
"@storybook/addon-links": "^7.5.2",
|
|
92
|
+
"@storybook/blocks": "^7.5.2",
|
|
93
|
+
"@storybook/cli": "^7.5.2",
|
|
94
|
+
"@storybook/jest": "^0.2.3",
|
|
95
|
+
"@storybook/react": "^7.5.2",
|
|
96
|
+
"@storybook/react-vite": "^7.5.2",
|
|
97
|
+
"@storybook/test-runner": "^0.13.0",
|
|
98
|
+
"@storybook/testing-library": "^0.2.2",
|
|
99
|
+
"@storybook/types": "^7.5.2",
|
|
100
|
+
"@testing-library/react": "^14.0.0",
|
|
101
|
+
"@types/lodash-es": "^4.17.11",
|
|
102
|
+
"@types/react": "^18.0.25",
|
|
103
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
104
|
+
"concurrently": "^8.2.2",
|
|
105
|
+
"eslint": "^8.28.0",
|
|
106
|
+
"http-server": "^14.1.1",
|
|
107
|
+
"husky": "^8.0.0",
|
|
108
|
+
"jsdom": "^22.0.0",
|
|
109
|
+
"lint-staged": "^13.1.0",
|
|
110
|
+
"npm-run-all": "^4.1.5",
|
|
111
|
+
"plop": "^4.0.0",
|
|
112
|
+
"prettier": "^2.8.0",
|
|
113
|
+
"react": "^18.2.0",
|
|
114
|
+
"react-dom": "^18.2.0",
|
|
115
|
+
"shx": "^0.3.4",
|
|
116
|
+
"storybook": "^7.5.2",
|
|
117
|
+
"ts-node": "^10.9.1",
|
|
118
|
+
"typescript": "^5.0.2",
|
|
119
|
+
"vitest": "^0.34.3",
|
|
120
|
+
"wait-on": "^7.1.0"
|
|
121
|
+
},
|
|
122
|
+
"dependencies": {
|
|
123
|
+
"lodash-es": "^4.17.21"
|
|
124
|
+
},
|
|
125
|
+
"peerDependencies": {
|
|
126
|
+
"react": ">= 17"
|
|
127
|
+
},
|
|
128
|
+
"optionalDependencies": {
|
|
129
|
+
"gsap": "npm:@gsap/business@3.12.2"
|
|
130
|
+
}
|
|
131
|
+
}
|