@okam/next-component 1.3.5 → 1.3.6
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/components/Link/index.d.ts +2 -2
- package/hooks/useFilterState/index.js +2 -2
- package/hooks/useHash/index.js +2 -2
- package/hooks/useLink/index.js +5 -5
- package/lib/createServerContext/index.js +2 -2
- package/package.json +3 -3
- package/providers/AdminBar/index.js +3 -3
- package/providers/DraftMode/index.js +2 -2
- package/theme/index.d.ts +2 -3
- package/theme/index.js +2 -19
- package/theme/index.mjs +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
1
2
|
import { TLinkProps } from './interface';
|
|
2
|
-
import type * as React from 'react';
|
|
3
3
|
declare function Link({ ref, ...props }: TLinkProps & {
|
|
4
|
-
ref?:
|
|
4
|
+
ref?: Ref<HTMLElement>;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare namespace Link {
|
|
7
7
|
var displayName: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const nuqs = require("nuqs");
|
|
5
5
|
const radashi = require("radashi");
|
|
6
|
-
const
|
|
6
|
+
const react = require("react");
|
|
7
7
|
const reactStately = require("react-stately");
|
|
8
8
|
const reactUse = require("react-use");
|
|
9
9
|
function useFilterState(props) {
|
|
@@ -19,7 +19,7 @@ function useFilterState(props) {
|
|
|
19
19
|
...rest
|
|
20
20
|
} = props;
|
|
21
21
|
const defaultValue = Array.from(defaultSelectedKeysProp).map((key) => key.toString());
|
|
22
|
-
const queryStateOptions =
|
|
22
|
+
const queryStateOptions = react.useMemo(
|
|
23
23
|
() => parser.withOptions(options ?? {}).withDefault(defaultValue),
|
|
24
24
|
[parser, options, defaultValue]
|
|
25
25
|
);
|
package/hooks/useHash/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const
|
|
4
|
+
const react = require("react");
|
|
5
5
|
const reactUse = require("react-use");
|
|
6
6
|
function getHash() {
|
|
7
7
|
if (typeof window === "undefined")
|
|
@@ -10,7 +10,7 @@ function getHash() {
|
|
|
10
10
|
}
|
|
11
11
|
function useHash() {
|
|
12
12
|
const defaultHash = getHash();
|
|
13
|
-
const [hash, setHash] =
|
|
13
|
+
const [hash, setHash] = react.useState(defaultHash);
|
|
14
14
|
const handleHashChangeEvent = ({ newURL }) => {
|
|
15
15
|
if (!URL.canParse(newURL))
|
|
16
16
|
return;
|
package/hooks/useLink/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const navigation = require("next/navigation");
|
|
5
|
-
const
|
|
5
|
+
const react = require("react");
|
|
6
6
|
const reactAria = require("react-aria");
|
|
7
7
|
const index = require("../useHash/index.js");
|
|
8
8
|
function scrollToTop(behavior) {
|
|
@@ -56,7 +56,7 @@ function useLink(props) {
|
|
|
56
56
|
const hash = index.useHash();
|
|
57
57
|
const isNextScroll = typeof scroll === "boolean";
|
|
58
58
|
const nextScroll = isNextScroll ? scroll : false;
|
|
59
|
-
const handleScroll =
|
|
59
|
+
const handleScroll = react.useCallback(() => {
|
|
60
60
|
if (isNextScroll)
|
|
61
61
|
return;
|
|
62
62
|
scrollToTop(behavior);
|
|
@@ -69,13 +69,13 @@ function useLink(props) {
|
|
|
69
69
|
onTouchStart?.(event);
|
|
70
70
|
handleScroll();
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
react.useEffect(() => {
|
|
73
73
|
onPathnameChange?.(pathname);
|
|
74
74
|
}, [onPathnameChange, pathname]);
|
|
75
|
-
|
|
75
|
+
react.useEffect(() => {
|
|
76
76
|
onSearchParamsChange?.(searchParams);
|
|
77
77
|
}, [onSearchParamsChange, searchParams]);
|
|
78
|
-
|
|
78
|
+
react.useEffect(() => {
|
|
79
79
|
onHashChange?.(hash);
|
|
80
80
|
}, [onHashChange, hash]);
|
|
81
81
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
function createServerContext(defaultValue) {
|
|
5
|
-
const getRef =
|
|
5
|
+
const getRef = react.cache(() => ({ current: defaultValue }));
|
|
6
6
|
const getValue = () => getRef().current;
|
|
7
7
|
const setValue = (value) => {
|
|
8
8
|
getRef().current = value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okam/next-component",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/OKAMca/stack.git"
|
|
6
6
|
},
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"react-stately": "^3.43.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@okam/core-lib": "1.17.
|
|
46
|
-
"@okam/stack-ui": "1.44.
|
|
45
|
+
"@okam/core-lib": "1.17.3",
|
|
46
|
+
"@okam/stack-ui": "1.44.5",
|
|
47
47
|
"next": "^15.1.0 || ^16.0.0",
|
|
48
48
|
"nuqs": "^2.4.3",
|
|
49
49
|
"radashi": "^12.3.0",
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const coreLib = require("@okam/core-lib");
|
|
6
|
-
const
|
|
6
|
+
const react = require("react");
|
|
7
7
|
const adminBarCtx = coreLib.createCtx();
|
|
8
8
|
const useAdminBar = adminBarCtx[0];
|
|
9
9
|
const AdminBarProvider = adminBarCtx[1];
|
|
10
10
|
function AdminBarContextProvider(props) {
|
|
11
11
|
const { children } = props;
|
|
12
|
-
const [error, setError] =
|
|
13
|
-
const value =
|
|
12
|
+
const [error, setError] = react.useState();
|
|
13
|
+
const value = react.useMemo(() => ({ error, setError }), [error]);
|
|
14
14
|
return /* @__PURE__ */ jsxRuntime.jsx(AdminBarProvider, { value, children });
|
|
15
15
|
}
|
|
16
16
|
exports.AdminBarContextProvider = AdminBarContextProvider;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const coreLib = require("@okam/core-lib");
|
|
6
|
-
const
|
|
6
|
+
const react = require("react");
|
|
7
7
|
const draftModeCtx = coreLib.createCtx();
|
|
8
8
|
const useDraftMode = draftModeCtx[0];
|
|
9
9
|
const DraftModeProvider = draftModeCtx[1];
|
|
10
10
|
function DraftModeContextProvider(props) {
|
|
11
11
|
const { children, isEnabled } = props;
|
|
12
|
-
const value =
|
|
12
|
+
const value = react.useMemo(() => ({ isEnabled }), [isEnabled]);
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsx(DraftModeProvider, { value, children });
|
|
14
14
|
}
|
|
15
15
|
exports.DraftModeContextProvider = DraftModeContextProvider;
|
package/theme/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
children: React.ReactNode;
|
|
1
|
+
declare const _default: import('react').MemoExoticComponent<({ children }: {
|
|
2
|
+
children: import('react').ReactNode;
|
|
4
3
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
5
4
|
export default _default;
|
package/theme/index.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
const stackUi = require("@okam/stack-ui");
|
|
4
|
-
const
|
|
4
|
+
const react = require("react");
|
|
5
5
|
const index$1 = require("./AdminBar/index.js");
|
|
6
6
|
const index$3 = require("./Button/index.js");
|
|
7
7
|
const index$4 = require("./Filter/index.js");
|
|
8
8
|
const index$2 = require("./Typography/index.js");
|
|
9
|
-
function _interopNamespaceDefault(e) {
|
|
10
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
-
if (e) {
|
|
12
|
-
for (const k in e) {
|
|
13
|
-
if (k !== "default") {
|
|
14
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: () => e[k]
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
n.default = e;
|
|
23
|
-
return Object.freeze(n);
|
|
24
|
-
}
|
|
25
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
26
9
|
const BaseTheme = stackUi.makeTheme({
|
|
27
10
|
filter: index$4,
|
|
28
11
|
button: index$3,
|
|
29
12
|
typography: index$2,
|
|
30
13
|
adminBar: index$1.adminBarTheme
|
|
31
14
|
});
|
|
32
|
-
const index =
|
|
15
|
+
const index = react.memo(stackUi.createThemeProvider(BaseTheme));
|
|
33
16
|
module.exports = index;
|
package/theme/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createThemeProvider, makeTheme } from "@okam/stack-ui";
|
|
3
|
-
import
|
|
3
|
+
import { memo } from "react";
|
|
4
4
|
import { adminBarTheme } from "./AdminBar/index.mjs";
|
|
5
5
|
import button from "./Button/index.mjs";
|
|
6
6
|
import filterTheme from "./Filter/index.mjs";
|
|
@@ -11,7 +11,7 @@ const BaseTheme = makeTheme({
|
|
|
11
11
|
typography,
|
|
12
12
|
adminBar: adminBarTheme
|
|
13
13
|
});
|
|
14
|
-
const index =
|
|
14
|
+
const index = memo(createThemeProvider(BaseTheme));
|
|
15
15
|
export {
|
|
16
16
|
index as default
|
|
17
17
|
};
|