@redis-ui/components 47.6.1 → 47.6.3
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/Banner/bannerContext.cjs +6 -5
- package/dist/Banner/bannerContext.js +6 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup/components/Button/Button.cjs +3 -1
- package/dist/ButtonGroup/components/Button/Button.d.ts +1 -1
- package/dist/ButtonGroup/components/Button/Button.js +3 -1
- package/dist/Helpers/index.d.ts +1 -0
- package/dist/Helpers/index.js +1 -0
- package/dist/Helpers/throttle.cjs +40 -0
- package/dist/Helpers/throttle.d.ts +5 -0
- package/dist/Helpers/throttle.js +40 -0
- package/dist/Overflow/components/OverflowContainer/OverflowContainer.cjs +2 -3
- package/dist/Overflow/components/OverflowContainer/OverflowContainer.js +2 -3
- package/dist/SideBar/SideBar.cjs +3 -4
- package/dist/SideBar/SideBar.constants.cjs +55 -0
- package/dist/SideBar/SideBar.constants.d.ts +62 -0
- package/dist/SideBar/SideBar.constants.js +55 -0
- package/dist/SideBar/SideBar.js +3 -4
- package/dist/SideBar/SideBar.style.cjs +6 -5
- package/dist/SideBar/SideBar.style.js +6 -5
- package/dist/SideBar/SideBar.utils.cjs +2 -2
- package/dist/SideBar/SideBar.utils.d.ts +1 -1
- package/dist/SideBar/SideBar.utils.js +2 -2
- package/dist/SideBar/components/Button/Button.style.cjs +4 -3
- package/dist/SideBar/components/Button/Button.style.js +4 -3
- package/dist/SideBar/components/Divider/Divider.style.cjs +4 -3
- package/dist/SideBar/components/Divider/Divider.style.js +4 -3
- package/dist/SideBar/components/Footer/components/MetaData/MetaData.style.cjs +5 -4
- package/dist/SideBar/components/Footer/components/MetaData/MetaData.style.js +5 -4
- package/dist/SideBar/components/Group/components/Title/Title.style.cjs +2 -3
- package/dist/SideBar/components/Group/components/Title/Title.style.js +2 -3
- package/dist/SideBar/components/Header/Header.style.cjs +9 -8
- package/dist/SideBar/components/Header/Header.style.js +9 -8
- package/dist/SideBar/components/Item/Item.style.cjs +12 -11
- package/dist/SideBar/components/Item/Item.style.js +12 -11
- package/dist/SideBar/components/Item/components/Button/Button.style.cjs +2 -1
- package/dist/SideBar/components/Item/components/Button/Button.style.js +2 -1
- package/dist/SideBar/components/SideBarLogo/SideBarLogo.style.cjs +2 -4
- package/dist/SideBar/components/SideBarLogo/SideBarLogo.style.js +3 -5
- package/dist/Toast/Toaster.style.cjs +2 -2
- package/dist/Toast/Toaster.style.js +2 -2
- package/dist/Toast/core/mapping.helpers.cjs +1 -1
- package/dist/Toast/core/mapping.helpers.js +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +0 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/index.cjs +2 -0
- package/dist/index.js +2 -1
- package/dist/{packages/components/node_modules → node_modules}/react-toastify/dist/react-toastify.esm.cjs +3 -3
- package/dist/{packages/components/node_modules → node_modules}/react-toastify/dist/react-toastify.esm.js +2 -2
- package/package.json +2 -3
- package/skills/redis-ui-components/references/ButtonGroup.md +2 -1
- package/skills/redis-ui-components/references/SideBar.md +1 -0
- package/dist/SideBar/SideBarThemeProvider.cjs +0 -30
- package/dist/SideBar/SideBarThemeProvider.d.ts +0 -7
- package/dist/SideBar/SideBarThemeProvider.js +0 -29
- package/dist/node_modules/lodash/lodash.cjs +0 -14557
- package/dist/node_modules/lodash/lodash.js +0 -14554
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const require_lodash$1 = require("../node_modules/lodash/lodash.cjs");
|
|
3
2
|
let react = require("react");
|
|
4
3
|
//#region src/Banner/bannerContext.ts
|
|
5
|
-
var import_lodash = require_lodash$1.default;
|
|
6
4
|
var BannerContext = (0, react.createContext)({
|
|
7
5
|
variant: "informative",
|
|
8
6
|
size: "M",
|
|
9
7
|
onClose: void 0
|
|
10
8
|
});
|
|
11
|
-
var skipUndefined = (target, src) => (0, import_lodash.isUndefined)(src) ? target : src;
|
|
12
9
|
var useBannerParams = (customParams = {}) => {
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
return {
|
|
11
|
+
...(0, react.useContext)(BannerContext),
|
|
12
|
+
...customParams.variant !== void 0 && { variant: customParams.variant },
|
|
13
|
+
...customParams.size !== void 0 && { size: customParams.size },
|
|
14
|
+
...customParams.onClose !== void 0 && { onClose: customParams.onClose }
|
|
15
|
+
};
|
|
15
16
|
};
|
|
16
17
|
//#endregion
|
|
17
18
|
exports.BannerContext = BannerContext;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { require_lodash } from "../node_modules/lodash/lodash.js";
|
|
2
1
|
import { createContext, useContext } from "react";
|
|
3
2
|
//#region src/Banner/bannerContext.ts
|
|
4
|
-
var import_lodash = require_lodash();
|
|
5
3
|
var BannerContext = createContext({
|
|
6
4
|
variant: "informative",
|
|
7
5
|
size: "M",
|
|
8
6
|
onClose: void 0
|
|
9
7
|
});
|
|
10
|
-
var skipUndefined = (target, src) => (0, import_lodash.isUndefined)(src) ? target : src;
|
|
11
8
|
var useBannerParams = (customParams = {}) => {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
return {
|
|
10
|
+
...useContext(BannerContext),
|
|
11
|
+
...customParams.variant !== void 0 && { variant: customParams.variant },
|
|
12
|
+
...customParams.size !== void 0 && { size: customParams.size },
|
|
13
|
+
...customParams.onClose !== void 0 && { onClose: customParams.onClose }
|
|
14
|
+
};
|
|
14
15
|
};
|
|
15
16
|
//#endregion
|
|
16
17
|
export { BannerContext, useBannerParams };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonGroupProps } from './ButtonGroup.types';
|
|
2
2
|
declare const ButtonGroup: ((props: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
-
Button: (props: import("./components/Button/Button.types").ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Button: ({ isSelected, ...props }: import("./components/Button/Button.types").ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Icon: ({ icon }: import("./components/Icon/Icon.types").ButtonIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
};
|
|
6
6
|
export default ButtonGroup;
|
|
@@ -2,8 +2,10 @@ require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_Button_style = require("./Button.style.cjs");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
//#region src/ButtonGroup/components/Button/Button.tsx
|
|
5
|
-
var Button = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button_style.Button, {
|
|
5
|
+
var Button = ({ isSelected, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button_style.Button, {
|
|
6
6
|
type: "button",
|
|
7
|
+
isSelected,
|
|
8
|
+
"aria-pressed": isSelected,
|
|
7
9
|
...props
|
|
8
10
|
});
|
|
9
11
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ButtonProps } from './Button.types';
|
|
2
|
-
export declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Button: ({ isSelected, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Button as Button$1 } from "./Button.style.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/ButtonGroup/components/Button/Button.tsx
|
|
4
|
-
var Button = (props) => /* @__PURE__ */ jsx(Button$1, {
|
|
4
|
+
var Button = ({ isSelected, ...props }) => /* @__PURE__ */ jsx(Button$1, {
|
|
5
5
|
type: "button",
|
|
6
|
+
isSelected,
|
|
7
|
+
"aria-pressed": isSelected,
|
|
6
8
|
...props
|
|
7
9
|
});
|
|
8
10
|
//#endregion
|
package/dist/Helpers/index.d.ts
CHANGED
package/dist/Helpers/index.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/Helpers/throttle.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a throttled function that only invokes the provided function at most once per every delay milliseconds.
|
|
4
|
+
* The trailing invocation uses the most recent arguments and preserves the call-time `this` context.
|
|
5
|
+
*/
|
|
6
|
+
var throttle = (func, delay) => {
|
|
7
|
+
let timeoutId = null;
|
|
8
|
+
let previous = 0;
|
|
9
|
+
let result;
|
|
10
|
+
let lastArgs = null;
|
|
11
|
+
let lastContext = null;
|
|
12
|
+
const throttled = function(...args) {
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const remaining = delay - (now - previous);
|
|
15
|
+
lastArgs = args;
|
|
16
|
+
lastContext = this;
|
|
17
|
+
if (remaining <= 0 || remaining > delay) {
|
|
18
|
+
if (timeoutId) {
|
|
19
|
+
clearTimeout(timeoutId);
|
|
20
|
+
timeoutId = null;
|
|
21
|
+
}
|
|
22
|
+
previous = now;
|
|
23
|
+
lastArgs = null;
|
|
24
|
+
lastContext = null;
|
|
25
|
+
result = func.apply(this, args);
|
|
26
|
+
} else if (!timeoutId) timeoutId = setTimeout(() => {
|
|
27
|
+
previous = Date.now();
|
|
28
|
+
timeoutId = null;
|
|
29
|
+
if (lastArgs) {
|
|
30
|
+
result = func.apply(lastContext, lastArgs);
|
|
31
|
+
lastArgs = null;
|
|
32
|
+
lastContext = null;
|
|
33
|
+
}
|
|
34
|
+
}, remaining);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
return throttled;
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.throttle = throttle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a throttled function that only invokes the provided function at most once per every delay milliseconds.
|
|
3
|
+
* The trailing invocation uses the most recent arguments and preserves the call-time `this` context.
|
|
4
|
+
*/
|
|
5
|
+
export declare const throttle: <T extends (...args: any[]) => any>(func: T, delay: number) => ((...args: Parameters<T>) => ReturnType<T> | undefined);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/Helpers/throttle.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a throttled function that only invokes the provided function at most once per every delay milliseconds.
|
|
4
|
+
* The trailing invocation uses the most recent arguments and preserves the call-time `this` context.
|
|
5
|
+
*/
|
|
6
|
+
var throttle = (func, delay) => {
|
|
7
|
+
let timeoutId = null;
|
|
8
|
+
let previous = 0;
|
|
9
|
+
let result;
|
|
10
|
+
let lastArgs = null;
|
|
11
|
+
let lastContext = null;
|
|
12
|
+
const throttled = function(...args) {
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const remaining = delay - (now - previous);
|
|
15
|
+
lastArgs = args;
|
|
16
|
+
lastContext = this;
|
|
17
|
+
if (remaining <= 0 || remaining > delay) {
|
|
18
|
+
if (timeoutId) {
|
|
19
|
+
clearTimeout(timeoutId);
|
|
20
|
+
timeoutId = null;
|
|
21
|
+
}
|
|
22
|
+
previous = now;
|
|
23
|
+
lastArgs = null;
|
|
24
|
+
lastContext = null;
|
|
25
|
+
result = func.apply(this, args);
|
|
26
|
+
} else if (!timeoutId) timeoutId = setTimeout(() => {
|
|
27
|
+
previous = Date.now();
|
|
28
|
+
timeoutId = null;
|
|
29
|
+
if (lastArgs) {
|
|
30
|
+
result = func.apply(lastContext, lastArgs);
|
|
31
|
+
lastArgs = null;
|
|
32
|
+
lastContext = null;
|
|
33
|
+
}
|
|
34
|
+
}, remaining);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
return throttled;
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { throttle };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const
|
|
2
|
+
const require_throttle = require("../../../Helpers/throttle.cjs");
|
|
3
3
|
const require_useResize = require("../../useResize.cjs");
|
|
4
4
|
const require_OverflowContainer_style = require("./OverflowContainer.style.cjs");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
//#region src/Overflow/components/OverflowContainer/OverflowContainer.tsx
|
|
8
|
-
var import_lodash = require_lodash$1.default;
|
|
9
8
|
var OverflowContainer = ({ size, onSizeChange, onStartSizeChange, onGapChange, ...restProps }) => {
|
|
10
9
|
const onSizeChangeRef = (0, react.useRef)(onSizeChange);
|
|
11
10
|
onSizeChangeRef.current = onSizeChange;
|
|
12
|
-
const setContainerSizeDeferred = (0, react.useMemo)(() =>
|
|
11
|
+
const setContainerSizeDeferred = (0, react.useMemo)(() => require_throttle.throttle((newSize) => onSizeChangeRef.current?.(newSize), 200), []);
|
|
13
12
|
const ref = (0, react.useRef)(null);
|
|
14
13
|
require_useResize.useResizeWidth((newSize = 0) => {
|
|
15
14
|
if (ref.current && newSize && onGapChange) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { throttle } from "../../../Helpers/throttle.js";
|
|
2
2
|
import { useResizeWidth } from "../../useResize.js";
|
|
3
3
|
import { OverflowContainer as OverflowContainer$1 } from "./OverflowContainer.style.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo, useRef } from "react";
|
|
6
6
|
//#region src/Overflow/components/OverflowContainer/OverflowContainer.tsx
|
|
7
|
-
var import_lodash = require_lodash();
|
|
8
7
|
var OverflowContainer = ({ size, onSizeChange, onStartSizeChange, onGapChange, ...restProps }) => {
|
|
9
8
|
const onSizeChangeRef = useRef(onSizeChange);
|
|
10
9
|
onSizeChangeRef.current = onSizeChange;
|
|
11
|
-
const setContainerSizeDeferred = useMemo(() =>
|
|
10
|
+
const setContainerSizeDeferred = useMemo(() => throttle((newSize) => onSizeChangeRef.current?.(newSize), 200), []);
|
|
12
11
|
const ref = useRef(null);
|
|
13
12
|
useResizeWidth((newSize = 0) => {
|
|
14
13
|
if (ref.current && newSize && onGapChange) {
|
package/dist/SideBar/SideBar.cjs
CHANGED
|
@@ -3,9 +3,9 @@ const require_index = require("../node_modules/@radix-ui/react-id/dist/index.cjs
|
|
|
3
3
|
const require_Provider = require("../Tooltip/Provider/Provider.cjs");
|
|
4
4
|
const require_FlexSplit = require("../Layouts/FlexSplit/FlexSplit.cjs");
|
|
5
5
|
const require_SideBar_context = require("./SideBar.context.cjs");
|
|
6
|
-
const require_SideBar_style = require("./SideBar.style.cjs");
|
|
7
6
|
const require_SideBarLogo = require("./components/SideBarLogo/SideBarLogo.cjs");
|
|
8
7
|
const require_ItemsContainer = require("./components/ItemsContainer/ItemsContainer.cjs");
|
|
8
|
+
const require_SideBar_style = require("./SideBar.style.cjs");
|
|
9
9
|
const require_Divider = require("./components/Divider/Divider.cjs");
|
|
10
10
|
const require_Item = require("./components/Item/Item.cjs");
|
|
11
11
|
const require_Button = require("./components/Button/Button.cjs");
|
|
@@ -13,7 +13,6 @@ const require_Header = require("./components/Header/Header.cjs");
|
|
|
13
13
|
const require_ScrollContainer = require("./components/ScrollContainer/ScrollContainer.cjs");
|
|
14
14
|
const require_Footer = require("./components/Footer/Footer.cjs");
|
|
15
15
|
const require_Group = require("./components/Group/Group.cjs");
|
|
16
|
-
const require_SideBarThemeProvider = require("./SideBarThemeProvider.cjs");
|
|
17
16
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
18
17
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
19
18
|
let react = require("react");
|
|
@@ -25,7 +24,7 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
25
24
|
const handleTransitionChange = (end) => {
|
|
26
25
|
setTransitionEnd(prefersReducedMotion ? true : end);
|
|
27
26
|
};
|
|
28
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SideBar_context.SideBarContextProvider, {
|
|
29
28
|
value: {
|
|
30
29
|
transitionEnd,
|
|
31
30
|
handleTransitionChange,
|
|
@@ -44,7 +43,7 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
44
43
|
$expandedWidth: expandedWidth,
|
|
45
44
|
...rest
|
|
46
45
|
}) })
|
|
47
|
-
})
|
|
46
|
+
});
|
|
48
47
|
}, {
|
|
49
48
|
SideBarLogo: require_SideBarLogo.default,
|
|
50
49
|
ItemsContainer: require_ItemsContainer.default,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/SideBar/SideBar.constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* SideBar component constants - structural values that don't change across themes
|
|
4
|
+
*/
|
|
5
|
+
var SIDEBAR_CONSTANTS = {
|
|
6
|
+
shadow: "none",
|
|
7
|
+
width: {
|
|
8
|
+
collapsed: "5.8rem",
|
|
9
|
+
expanded: "20rem"
|
|
10
|
+
},
|
|
11
|
+
divider: {
|
|
12
|
+
thickness: "1px",
|
|
13
|
+
blockMargin: "2rem",
|
|
14
|
+
sidePadding: {
|
|
15
|
+
collapsed: "0",
|
|
16
|
+
expanded: "1rem"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
button: {
|
|
20
|
+
height: "3.6rem",
|
|
21
|
+
width: {
|
|
22
|
+
collapsed: "3.6rem",
|
|
23
|
+
expanded: "14.5rem"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
collapseButton: {
|
|
27
|
+
size: "2.2rem",
|
|
28
|
+
borderRadius: "100%"
|
|
29
|
+
},
|
|
30
|
+
header: {
|
|
31
|
+
height: "7rem",
|
|
32
|
+
margin: "0 0 3rem 0"
|
|
33
|
+
},
|
|
34
|
+
footer: { meta: { padding: "0 1.8rem 2rem 1.8rem" } },
|
|
35
|
+
item: {
|
|
36
|
+
margin: "0.2rem 0.5rem 0.2rem 1rem",
|
|
37
|
+
height: "3.2rem",
|
|
38
|
+
padding: "0 0.8rem",
|
|
39
|
+
gap: "0.8rem",
|
|
40
|
+
borderRadius: "0.4rem",
|
|
41
|
+
itemWithButtonOffset: "1.8rem",
|
|
42
|
+
button: { borderSize: "1px" },
|
|
43
|
+
activeIndicator: {
|
|
44
|
+
left: "-1rem",
|
|
45
|
+
top: "0.5rem",
|
|
46
|
+
bottom: "0.5rem",
|
|
47
|
+
width: "3px",
|
|
48
|
+
borderRadius: "0 2px 2px 0"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
logo: { offset: "1.6rem" },
|
|
52
|
+
groupTitle: { padding: "1.4rem 1.6rem 0.4rem" }
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
exports.SIDEBAR_CONSTANTS = SIDEBAR_CONSTANTS;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SideBar component constants - structural values that don't change across themes
|
|
3
|
+
*/
|
|
4
|
+
export declare const SIDEBAR_CONSTANTS: {
|
|
5
|
+
readonly shadow: "none";
|
|
6
|
+
readonly width: {
|
|
7
|
+
readonly collapsed: "5.8rem";
|
|
8
|
+
readonly expanded: "20rem";
|
|
9
|
+
};
|
|
10
|
+
readonly divider: {
|
|
11
|
+
readonly thickness: "1px";
|
|
12
|
+
readonly blockMargin: "2rem";
|
|
13
|
+
readonly sidePadding: {
|
|
14
|
+
readonly collapsed: "0";
|
|
15
|
+
readonly expanded: "1rem";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly button: {
|
|
19
|
+
readonly height: "3.6rem";
|
|
20
|
+
readonly width: {
|
|
21
|
+
readonly collapsed: "3.6rem";
|
|
22
|
+
readonly expanded: "14.5rem";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly collapseButton: {
|
|
26
|
+
readonly size: "2.2rem";
|
|
27
|
+
readonly borderRadius: "100%";
|
|
28
|
+
};
|
|
29
|
+
readonly header: {
|
|
30
|
+
readonly height: "7rem";
|
|
31
|
+
readonly margin: "0 0 3rem 0";
|
|
32
|
+
};
|
|
33
|
+
readonly footer: {
|
|
34
|
+
readonly meta: {
|
|
35
|
+
readonly padding: "0 1.8rem 2rem 1.8rem";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly item: {
|
|
39
|
+
readonly margin: "0.2rem 0.5rem 0.2rem 1rem";
|
|
40
|
+
readonly height: "3.2rem";
|
|
41
|
+
readonly padding: "0 0.8rem";
|
|
42
|
+
readonly gap: "0.8rem";
|
|
43
|
+
readonly borderRadius: "0.4rem";
|
|
44
|
+
readonly itemWithButtonOffset: "1.8rem";
|
|
45
|
+
readonly button: {
|
|
46
|
+
readonly borderSize: "1px";
|
|
47
|
+
};
|
|
48
|
+
readonly activeIndicator: {
|
|
49
|
+
readonly left: "-1rem";
|
|
50
|
+
readonly top: "0.5rem";
|
|
51
|
+
readonly bottom: "0.5rem";
|
|
52
|
+
readonly width: "3px";
|
|
53
|
+
readonly borderRadius: "0 2px 2px 0";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
readonly logo: {
|
|
57
|
+
readonly offset: "1.6rem";
|
|
58
|
+
};
|
|
59
|
+
readonly groupTitle: {
|
|
60
|
+
readonly padding: "1.4rem 1.6rem 0.4rem";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/SideBar/SideBar.constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* SideBar component constants - structural values that don't change across themes
|
|
4
|
+
*/
|
|
5
|
+
var SIDEBAR_CONSTANTS = {
|
|
6
|
+
shadow: "none",
|
|
7
|
+
width: {
|
|
8
|
+
collapsed: "5.8rem",
|
|
9
|
+
expanded: "20rem"
|
|
10
|
+
},
|
|
11
|
+
divider: {
|
|
12
|
+
thickness: "1px",
|
|
13
|
+
blockMargin: "2rem",
|
|
14
|
+
sidePadding: {
|
|
15
|
+
collapsed: "0",
|
|
16
|
+
expanded: "1rem"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
button: {
|
|
20
|
+
height: "3.6rem",
|
|
21
|
+
width: {
|
|
22
|
+
collapsed: "3.6rem",
|
|
23
|
+
expanded: "14.5rem"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
collapseButton: {
|
|
27
|
+
size: "2.2rem",
|
|
28
|
+
borderRadius: "100%"
|
|
29
|
+
},
|
|
30
|
+
header: {
|
|
31
|
+
height: "7rem",
|
|
32
|
+
margin: "0 0 3rem 0"
|
|
33
|
+
},
|
|
34
|
+
footer: { meta: { padding: "0 1.8rem 2rem 1.8rem" } },
|
|
35
|
+
item: {
|
|
36
|
+
margin: "0.2rem 0.5rem 0.2rem 1rem",
|
|
37
|
+
height: "3.2rem",
|
|
38
|
+
padding: "0 0.8rem",
|
|
39
|
+
gap: "0.8rem",
|
|
40
|
+
borderRadius: "0.4rem",
|
|
41
|
+
itemWithButtonOffset: "1.8rem",
|
|
42
|
+
button: { borderSize: "1px" },
|
|
43
|
+
activeIndicator: {
|
|
44
|
+
left: "-1rem",
|
|
45
|
+
top: "0.5rem",
|
|
46
|
+
bottom: "0.5rem",
|
|
47
|
+
width: "3px",
|
|
48
|
+
borderRadius: "0 2px 2px 0"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
logo: { offset: "1.6rem" },
|
|
52
|
+
groupTitle: { padding: "1.4rem 1.6rem 0.4rem" }
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { SIDEBAR_CONSTANTS };
|
package/dist/SideBar/SideBar.js
CHANGED
|
@@ -2,9 +2,9 @@ import { useId } from "../node_modules/@radix-ui/react-id/dist/index.js";
|
|
|
2
2
|
import Provider from "../Tooltip/Provider/Provider.js";
|
|
3
3
|
import { FlexSplit } from "../Layouts/FlexSplit/FlexSplit.js";
|
|
4
4
|
import { SideBarContextProvider } from "./SideBar.context.js";
|
|
5
|
-
import { SideBarContainer } from "./SideBar.style.js";
|
|
6
5
|
import SideBarLogo from "./components/SideBarLogo/SideBarLogo.js";
|
|
7
6
|
import SideBarItemsContainer from "./components/ItemsContainer/ItemsContainer.js";
|
|
7
|
+
import { SideBarContainer } from "./SideBar.style.js";
|
|
8
8
|
import Divider from "./components/Divider/Divider.js";
|
|
9
9
|
import Item from "./components/Item/Item.js";
|
|
10
10
|
import Button from "./components/Button/Button.js";
|
|
@@ -12,7 +12,6 @@ import Header from "./components/Header/Header.js";
|
|
|
12
12
|
import ScrollContainer from "./components/ScrollContainer/ScrollContainer.js";
|
|
13
13
|
import Footer from "./components/Footer/Footer.js";
|
|
14
14
|
import Group from "./components/Group/Group.js";
|
|
15
|
-
import { SideBarThemeProvider } from "./SideBarThemeProvider.js";
|
|
16
15
|
import { usePrefersReducedMotion } from "@redis-ui/styles";
|
|
17
16
|
import { jsx } from "react/jsx-runtime";
|
|
18
17
|
import { useState } from "react";
|
|
@@ -24,7 +23,7 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
24
23
|
const handleTransitionChange = (end) => {
|
|
25
24
|
setTransitionEnd(prefersReducedMotion ? true : end);
|
|
26
25
|
};
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
26
|
+
return /* @__PURE__ */ jsx(SideBarContextProvider, {
|
|
28
27
|
value: {
|
|
29
28
|
transitionEnd,
|
|
30
29
|
handleTransitionChange,
|
|
@@ -43,7 +42,7 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
43
42
|
$expandedWidth: expandedWidth,
|
|
44
43
|
...rest
|
|
45
44
|
}) })
|
|
46
|
-
})
|
|
45
|
+
});
|
|
47
46
|
}, {
|
|
48
47
|
SideBarLogo,
|
|
49
48
|
ItemsContainer: SideBarItemsContainer,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_FlexGroup = require("../Layouts/FlexGroup/FlexGroup.cjs");
|
|
3
|
+
const require_SideBar_constants = require("./SideBar.constants.cjs");
|
|
3
4
|
let styled_components = require("styled-components");
|
|
4
5
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
5
6
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -8,13 +9,13 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
8
9
|
* same as {@link useStateStyle}, but for styling root <nav> element
|
|
9
10
|
*/
|
|
10
11
|
var useRootStateStyle = (getStyle) => {
|
|
11
|
-
const
|
|
12
|
+
const theme = (0, _redislabsdev_redis_ui_styles.useTheme)().components.sideBar;
|
|
12
13
|
return styled_components.css`
|
|
13
14
|
&[data-state='collapsed'] {
|
|
14
|
-
${getStyle(
|
|
15
|
+
${getStyle(theme, "collapsed")}
|
|
15
16
|
}
|
|
16
17
|
&[data-state='expanded'] {
|
|
17
|
-
${getStyle(
|
|
18
|
+
${getStyle(theme, "expanded")}
|
|
18
19
|
}
|
|
19
20
|
`;
|
|
20
21
|
};
|
|
@@ -22,9 +23,9 @@ var SideBarContainer = (0, styled_components.default)(require_FlexGroup.FlexGrou
|
|
|
22
23
|
displayName: "SideBarstyle__SideBarContainer",
|
|
23
24
|
componentId: "RedisUI__sc-suwica-0"
|
|
24
25
|
})(["position:relative;height:100%;transition:width 0.6s;@media (prefers-reduced-motion:reduce){transition:none;}", ""], ({ $expandedWidth }) => useRootStateStyle((theme, state) => styled_components.css`
|
|
25
|
-
box-shadow: ${
|
|
26
|
+
box-shadow: ${require_SideBar_constants.SIDEBAR_CONSTANTS.shadow};
|
|
26
27
|
background-color: ${theme.bgColor};
|
|
27
|
-
width: ${(state === "expanded" ? $expandedWidth : void 0) ??
|
|
28
|
+
width: ${(state === "expanded" ? $expandedWidth : void 0) ?? require_SideBar_constants.SIDEBAR_CONSTANTS.width[state]};
|
|
28
29
|
border-right: ${theme.borderRight};
|
|
29
30
|
`));
|
|
30
31
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FlexGroup } from "../Layouts/FlexGroup/FlexGroup.js";
|
|
2
|
+
import { SIDEBAR_CONSTANTS } from "./SideBar.constants.js";
|
|
2
3
|
import _styled, { css } from "styled-components";
|
|
3
4
|
import { useTheme } from "@redis-ui/styles";
|
|
4
5
|
//#region src/SideBar/SideBar.style.ts
|
|
@@ -6,13 +7,13 @@ import { useTheme } from "@redis-ui/styles";
|
|
|
6
7
|
* same as {@link useStateStyle}, but for styling root <nav> element
|
|
7
8
|
*/
|
|
8
9
|
var useRootStateStyle = (getStyle) => {
|
|
9
|
-
const
|
|
10
|
+
const theme = useTheme().components.sideBar;
|
|
10
11
|
return css`
|
|
11
12
|
&[data-state='collapsed'] {
|
|
12
|
-
${getStyle(
|
|
13
|
+
${getStyle(theme, "collapsed")}
|
|
13
14
|
}
|
|
14
15
|
&[data-state='expanded'] {
|
|
15
|
-
${getStyle(
|
|
16
|
+
${getStyle(theme, "expanded")}
|
|
16
17
|
}
|
|
17
18
|
`;
|
|
18
19
|
};
|
|
@@ -20,9 +21,9 @@ var SideBarContainer = _styled(FlexGroup).withConfig({
|
|
|
20
21
|
displayName: "SideBarstyle__SideBarContainer",
|
|
21
22
|
componentId: "RedisUI__sc-suwica-0"
|
|
22
23
|
})(["position:relative;height:100%;transition:width 0.6s;@media (prefers-reduced-motion:reduce){transition:none;}", ""], ({ $expandedWidth }) => useRootStateStyle((theme, state) => css`
|
|
23
|
-
box-shadow: ${
|
|
24
|
+
box-shadow: ${SIDEBAR_CONSTANTS.shadow};
|
|
24
25
|
background-color: ${theme.bgColor};
|
|
25
|
-
width: ${(state === "expanded" ? $expandedWidth : void 0) ??
|
|
26
|
+
width: ${(state === "expanded" ? $expandedWidth : void 0) ?? SIDEBAR_CONSTANTS.width[state]};
|
|
26
27
|
border-right: ${theme.borderRight};
|
|
27
28
|
`));
|
|
28
29
|
//#endregion
|
|
@@ -8,14 +8,14 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
8
8
|
* @param getStyle - custom state builder, state theme is passed as parameter
|
|
9
9
|
*/
|
|
10
10
|
var useStateStyle = (getStyle) => {
|
|
11
|
-
const
|
|
11
|
+
const theme = (0, _redislabsdev_redis_ui_styles.useTheme)().components.sideBar;
|
|
12
12
|
return (0, styled_components.css)([
|
|
13
13
|
"",
|
|
14
14
|
":is([data-state='collapsed'],[data-state='expanded'][data-transition='active']) &&{",
|
|
15
15
|
"}",
|
|
16
16
|
"[data-state='expanded'][data-transition='inactive'] &&{",
|
|
17
17
|
"}"
|
|
18
|
-
], require_SideBar_style.SideBarContainer, getStyle(
|
|
18
|
+
], require_SideBar_style.SideBarContainer, getStyle(theme, "collapsed"), require_SideBar_style.SideBarContainer, getStyle(theme, "expanded"));
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
21
|
exports.useStateStyle = useStateStyle;
|
|
@@ -5,4 +5,4 @@ import { ThemeProps } from 'styled-components/macro';
|
|
|
5
5
|
* generates styles for all sideBar states
|
|
6
6
|
* @param getStyle - custom state builder, state theme is passed as parameter
|
|
7
7
|
*/
|
|
8
|
-
export declare const useStateStyle: (getStyle: (theme: Theme["components"]["sideBar"]
|
|
8
|
+
export declare const useStateStyle: (getStyle: (theme: Theme["components"]["sideBar"], state: "collapsed" | "expanded") => FlattenInterpolation<ThemeProps<Theme>>) => FlattenInterpolation<ThemeProps<any>>;
|
|
@@ -7,14 +7,14 @@ import { useTheme } from "@redis-ui/styles";
|
|
|
7
7
|
* @param getStyle - custom state builder, state theme is passed as parameter
|
|
8
8
|
*/
|
|
9
9
|
var useStateStyle = (getStyle) => {
|
|
10
|
-
const
|
|
10
|
+
const theme = useTheme().components.sideBar;
|
|
11
11
|
return css([
|
|
12
12
|
"",
|
|
13
13
|
":is([data-state='collapsed'],[data-state='expanded'][data-transition='active']) &&{",
|
|
14
14
|
"}",
|
|
15
15
|
"[data-state='expanded'][data-transition='inactive'] &&{",
|
|
16
16
|
"}"
|
|
17
|
-
], SideBarContainer, getStyle(
|
|
17
|
+
], SideBarContainer, getStyle(theme, "collapsed"), SideBarContainer, getStyle(theme, "expanded"));
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
export { useStateStyle };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_Button = require("../../../Button/Button.cjs");
|
|
3
3
|
const require_Tooltip = require("../../../Tooltip/Tooltip.cjs");
|
|
4
|
+
const require_SideBar_constants = require("../../SideBar.constants.cjs");
|
|
4
5
|
const require_SideBar_utils = require("../../SideBar.utils.cjs");
|
|
5
6
|
let styled_components = require("styled-components");
|
|
6
7
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
@@ -8,9 +9,9 @@ styled_components = require_runtime.__toESM(styled_components, 1);
|
|
|
8
9
|
var SideBarButton = (0, styled_components.default)(require_Button.default).withConfig({
|
|
9
10
|
displayName: "Buttonstyle__SideBarButton",
|
|
10
11
|
componentId: "RedisUI__sc-ngkny4-0"
|
|
11
|
-
})(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => require_SideBar_utils.useStateStyle((theme) => styled_components.css`
|
|
12
|
-
height: ${
|
|
13
|
-
width: ${
|
|
12
|
+
})(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => require_SideBar_utils.useStateStyle((theme, state) => styled_components.css`
|
|
13
|
+
height: ${require_SideBar_constants.SIDEBAR_CONSTANTS.button.height};
|
|
14
|
+
width: ${require_SideBar_constants.SIDEBAR_CONSTANTS.button.width[state]};
|
|
14
15
|
`));
|
|
15
16
|
var appear = styled_components.keyframes`
|
|
16
17
|
0% {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import Button from "../../../Button/Button.js";
|
|
2
2
|
import Tooltip from "../../../Tooltip/Tooltip.js";
|
|
3
|
+
import { SIDEBAR_CONSTANTS } from "../../SideBar.constants.js";
|
|
3
4
|
import { useStateStyle } from "../../SideBar.utils.js";
|
|
4
5
|
import _styled, { css, keyframes } from "styled-components";
|
|
5
6
|
//#region src/SideBar/components/Button/Button.style.ts
|
|
6
7
|
var SideBarButton = _styled(Button).withConfig({
|
|
7
8
|
displayName: "Buttonstyle__SideBarButton",
|
|
8
9
|
componentId: "RedisUI__sc-ngkny4-0"
|
|
9
|
-
})(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => useStateStyle((theme) => css`
|
|
10
|
-
height: ${
|
|
11
|
-
width: ${
|
|
10
|
+
})(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => useStateStyle((theme, state) => css`
|
|
11
|
+
height: ${SIDEBAR_CONSTANTS.button.height};
|
|
12
|
+
width: ${SIDEBAR_CONSTANTS.button.width[state]};
|
|
12
13
|
`));
|
|
13
14
|
var appear = keyframes`
|
|
14
15
|
0% {
|