@synerise/ds-sidebar 1.1.41 → 1.1.43
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/CHANGELOG.md +8 -0
- package/dist/Collapse/Collapse.d.ts +12 -0
- package/dist/Collapse/Collapse.js +61 -0
- package/dist/Collapse/Collapse.styles.d.ts +17 -0
- package/dist/Collapse/Collapse.styles.js +42 -0
- package/dist/Collapse/Collapse.types.d.ts +43 -0
- package/dist/Collapse/Collapse.types.js +1 -0
- package/dist/Collapse/CollapsePanel.d.ts +10 -0
- package/dist/Collapse/CollapsePanel.js +44 -0
- package/dist/PanelContent/PanelContent.js +3 -2
- package/dist/Sidebar.js +8 -26
- package/dist/Sidebar.styles.d.ts +0 -6
- package/dist/Sidebar.styles.js +9 -24
- package/dist/Sidebar.types.d.ts +1 -1
- package/package.json +3 -4
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/style/index.css +0 -1
- package/dist/utils/prefixKeys.d.ts +0 -1
- package/dist/utils/prefixKeys.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.43](https://github.com/Synerise/synerise-design/compare/@synerise/ds-sidebar@1.1.42...@synerise/ds-sidebar@1.1.43) (2026-07-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-sidebar
|
|
9
|
+
|
|
10
|
+
## [1.1.42](https://github.com/Synerise/synerise-design/compare/@synerise/ds-sidebar@1.1.41...@synerise/ds-sidebar@1.1.42) (2026-06-27)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-sidebar
|
|
13
|
+
|
|
6
14
|
## [1.1.41](https://github.com/Synerise/synerise-design/compare/@synerise/ds-sidebar@1.1.40...@synerise/ds-sidebar@1.1.41) (2026-06-17)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-sidebar
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CollapseProps } from './Collapse.types';
|
|
3
|
+
/**
|
|
4
|
+
* DS-native, antd-free accordion (replaces antd `Collapse`). Manages the open panel(s) by each
|
|
5
|
+
* panel's `id` prop — controlled via `activeKey`, uncontrolled via `defaultActiveKey` — and clones
|
|
6
|
+
* its children, injecting `isActive` / `onItemClick` / `expandIcon` / `expandIconPosition`.
|
|
7
|
+
*
|
|
8
|
+
* Reproduces antd's `ant-collapse*` DOM class hooks (kept for ui-tests / interim external CSS) and
|
|
9
|
+
* emits `ds-sidebar-*` alongside.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Collapse: ({ activeKey, defaultActiveKey, onChange, accordion, expandIcon, expandIconPosition, className, children, ...rest }: CollapseProps) => React.JSX.Element;
|
|
12
|
+
export default Collapse;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { useState, Children, isValidElement, cloneElement } from "react";
|
|
4
|
+
import { CollapseRoot } from "./Collapse.styles.js";
|
|
5
|
+
const toKeyArray = (key) => key === null || key === void 0 ? [] : (Array.isArray(key) ? key : [key]).map(String);
|
|
6
|
+
const resolvePanelKey = (child, index) => {
|
|
7
|
+
const rawKey = child.key;
|
|
8
|
+
if (rawKey !== null && rawKey !== void 0) {
|
|
9
|
+
const key = String(rawKey);
|
|
10
|
+
if (key.startsWith(".$")) {
|
|
11
|
+
return key.slice(2);
|
|
12
|
+
}
|
|
13
|
+
if (!/^\.\d+$/.test(key)) {
|
|
14
|
+
return key;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return String(index);
|
|
18
|
+
};
|
|
19
|
+
const Collapse = ({
|
|
20
|
+
activeKey,
|
|
21
|
+
defaultActiveKey,
|
|
22
|
+
onChange,
|
|
23
|
+
accordion = false,
|
|
24
|
+
expandIcon,
|
|
25
|
+
expandIconPosition = "start",
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
const isControlled = activeKey !== void 0;
|
|
31
|
+
const [internalKeys, setInternalKeys] = useState(() => toKeyArray(defaultActiveKey));
|
|
32
|
+
const activeKeys = isControlled ? toKeyArray(activeKey) : internalKeys;
|
|
33
|
+
const handleItemClick = (key) => {
|
|
34
|
+
let next;
|
|
35
|
+
if (accordion) {
|
|
36
|
+
next = activeKeys[0] === key ? [] : [key];
|
|
37
|
+
} else {
|
|
38
|
+
next = activeKeys.includes(key) ? activeKeys.filter((k) => k !== key) : [...activeKeys, key];
|
|
39
|
+
}
|
|
40
|
+
if (!isControlled) {
|
|
41
|
+
setInternalKeys(next);
|
|
42
|
+
}
|
|
43
|
+
onChange?.(next);
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ jsx(CollapseRoot, { className: classNames("ant-collapse", "ds-sidebar", `ant-collapse-icon-position-${expandIconPosition}`, className), ...rest, children: Children.map(children, (child, index) => {
|
|
46
|
+
if (!isValidElement(child)) {
|
|
47
|
+
return child;
|
|
48
|
+
}
|
|
49
|
+
const panelKey = resolvePanelKey(child, index);
|
|
50
|
+
return cloneElement(child, {
|
|
51
|
+
isActive: activeKeys.includes(panelKey),
|
|
52
|
+
onItemClick: () => handleItemClick(panelKey),
|
|
53
|
+
expandIcon,
|
|
54
|
+
expandIconPosition
|
|
55
|
+
});
|
|
56
|
+
}) });
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
Collapse,
|
|
60
|
+
Collapse as default
|
|
61
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CollapseExpandIconPosition } from './Collapse.types';
|
|
2
|
+
export declare const headerStyle: import('styled-components').FlattenInterpolation<import('styled-components').ThemeProps<any>>;
|
|
3
|
+
export declare const expandIconStyle: import('styled-components').FlattenSimpleInterpolation;
|
|
4
|
+
export declare const CollapseRoot: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const PanelItem: import('styled-components').StyledComponent<"div", any, {
|
|
6
|
+
$isActive?: boolean;
|
|
7
|
+
$isDragOverlay?: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const PanelHeader: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export declare const PanelExpandIcon: import('styled-components').StyledComponent<"span", any, {
|
|
11
|
+
$iconPosition?: CollapseExpandIconPosition;
|
|
12
|
+
}, never>;
|
|
13
|
+
export declare const PanelContent: import('styled-components').StyledComponent<"div", any, {
|
|
14
|
+
$isActive?: boolean;
|
|
15
|
+
}, never>;
|
|
16
|
+
export declare const PanelContentBox: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const PanelContentInner: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const headerStyle = /* @__PURE__ */ css(["padding:18px 24px;color:", ";font-weight:500;font-size:14px;background:white;position:relative;cursor:pointer;&:hover{color:", ";}"], (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["grey-800"]);
|
|
3
|
+
const expandIconStyle = /* @__PURE__ */ css(["position:absolute;right:24px;top:50%;transform:translateY(-50%);"]);
|
|
4
|
+
const CollapseRoot = /* @__PURE__ */ styled.div.withConfig({
|
|
5
|
+
displayName: "Collapsestyles__CollapseRoot",
|
|
6
|
+
componentId: "sc-1eq1yr7-0"
|
|
7
|
+
})(["background-color:", ";border:none;"], (props) => props.theme.palette["blue-050"]);
|
|
8
|
+
const PanelItem = /* @__PURE__ */ styled.div.withConfig({
|
|
9
|
+
displayName: "Collapsestyles__PanelItem",
|
|
10
|
+
componentId: "sc-1eq1yr7-1"
|
|
11
|
+
})(["position:relative;border-top:solid 1px ", ";border-bottom:none;", ""], (props) => props.theme.palette["grey-200"], (props) => props.$isDragOverlay && css(["box-shadow:", ";z-index:10;"], props.theme.variables["box-shadow-2"]));
|
|
12
|
+
const PanelHeader = /* @__PURE__ */ styled.div.withConfig({
|
|
13
|
+
displayName: "Collapsestyles__PanelHeader",
|
|
14
|
+
componentId: "sc-1eq1yr7-2"
|
|
15
|
+
})(["", " display:flex;align-items:center;justify-content:flex-start;user-select:none;transition:0.2s ease-in-out;"], headerStyle);
|
|
16
|
+
const PanelExpandIcon = /* @__PURE__ */ styled.span.withConfig({
|
|
17
|
+
displayName: "Collapsestyles__PanelExpandIcon",
|
|
18
|
+
componentId: "sc-1eq1yr7-3"
|
|
19
|
+
})(["display:block;", ""], (props) => props.$iconPosition === "end" && expandIconStyle);
|
|
20
|
+
const PanelContent = /* @__PURE__ */ styled.div.withConfig({
|
|
21
|
+
displayName: "Collapsestyles__PanelContent",
|
|
22
|
+
componentId: "sc-1eq1yr7-4"
|
|
23
|
+
})(["background-color:white;border-radius:0;border:none;display:grid;grid-template-rows:", ";transition:grid-template-rows 0.24s ease;overflow:hidden;"], (props) => props.$isActive ? "1fr" : "0fr");
|
|
24
|
+
const PanelContentBox = /* @__PURE__ */ styled.div.withConfig({
|
|
25
|
+
displayName: "Collapsestyles__PanelContentBox",
|
|
26
|
+
componentId: "sc-1eq1yr7-5"
|
|
27
|
+
})(["min-height:0;min-width:0;"]);
|
|
28
|
+
const PanelContentInner = /* @__PURE__ */ styled.div.withConfig({
|
|
29
|
+
displayName: "Collapsestyles__PanelContentInner",
|
|
30
|
+
componentId: "sc-1eq1yr7-6"
|
|
31
|
+
})(["padding:16px 24px;"]);
|
|
32
|
+
export {
|
|
33
|
+
CollapseRoot,
|
|
34
|
+
PanelContent,
|
|
35
|
+
PanelContentBox,
|
|
36
|
+
PanelContentInner,
|
|
37
|
+
PanelExpandIcon,
|
|
38
|
+
PanelHeader,
|
|
39
|
+
PanelItem,
|
|
40
|
+
expandIconStyle,
|
|
41
|
+
headerStyle
|
|
42
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { DataAttributes } from '@synerise/ds-utils';
|
|
3
|
+
export type CollapseKey = string | number;
|
|
4
|
+
export type CollapseExpandIconPosition = 'start' | 'end';
|
|
5
|
+
/** Props the `Collapse` injects into each panel child via `cloneElement`. */
|
|
6
|
+
export type CollapseInjectedProps = {
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
onItemClick?: () => void;
|
|
9
|
+
expandIcon?: (panelProps: {
|
|
10
|
+
isActive?: boolean;
|
|
11
|
+
}) => ReactNode;
|
|
12
|
+
expandIconPosition?: CollapseExpandIconPosition;
|
|
13
|
+
};
|
|
14
|
+
export type CollapseProps = {
|
|
15
|
+
/** Open panel id(s) — controlled. */
|
|
16
|
+
activeKey?: CollapseKey | CollapseKey[];
|
|
17
|
+
/** Initially open panel id(s) — uncontrolled. */
|
|
18
|
+
defaultActiveKey?: CollapseKey | CollapseKey[];
|
|
19
|
+
/** Fired with the open panel ids when a panel toggles. */
|
|
20
|
+
onChange?: (key: string | string[]) => void;
|
|
21
|
+
/** Only one panel open at a time. */
|
|
22
|
+
accordion?: boolean;
|
|
23
|
+
/** Render prop for the per-panel expand indicator. */
|
|
24
|
+
expandIcon?: (panelProps: {
|
|
25
|
+
isActive?: boolean;
|
|
26
|
+
}) => ReactNode;
|
|
27
|
+
/** Where the expand icon sits. */
|
|
28
|
+
expandIconPosition?: CollapseExpandIconPosition;
|
|
29
|
+
className?: string;
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
} & DataAttributes;
|
|
33
|
+
export type CollapsePanelProps = {
|
|
34
|
+
/** Panel id — drives the active-key matching. */
|
|
35
|
+
id?: CollapseKey;
|
|
36
|
+
header?: ReactNode;
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
/** Render the body even while collapsed. */
|
|
39
|
+
forceRender?: boolean;
|
|
40
|
+
/** Styling flag set by the sidebar drag overlay (consumed by the styled wrapper). */
|
|
41
|
+
isDragOverlay?: boolean;
|
|
42
|
+
className?: string;
|
|
43
|
+
} & CollapseInjectedProps & DataAttributes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CollapsePanelProps } from './Collapse.types';
|
|
3
|
+
/**
|
|
4
|
+
* One accordion item. Each element is a styled-component that owns its styles; the
|
|
5
|
+
* `ant-collapse-*` / `ds-sidebar-*` class names are kept on the elements purely as hooks (ui-tests /
|
|
6
|
+
* interim external CSS) and are not used as styling selectors. Renders its body when active or
|
|
7
|
+
* `forceRender`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CollapsePanel: ({ header, children, isActive, onItemClick, expandIcon, expandIconPosition, isDragOverlay, forceRender, id, className, ...rest }: CollapsePanelProps) => React.JSX.Element;
|
|
10
|
+
export default CollapsePanel;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { PanelItem, PanelHeader, PanelExpandIcon, PanelContent, PanelContentBox, PanelContentInner } from "./Collapse.styles.js";
|
|
4
|
+
const CollapsePanel = ({
|
|
5
|
+
header,
|
|
6
|
+
children,
|
|
7
|
+
isActive,
|
|
8
|
+
onItemClick,
|
|
9
|
+
expandIcon,
|
|
10
|
+
// consumed so they do not leak to the DOM (positioning/box-shadow handled via CSS)
|
|
11
|
+
expandIconPosition,
|
|
12
|
+
isDragOverlay,
|
|
13
|
+
forceRender,
|
|
14
|
+
// not rendered as a DOM id — the active-key matching uses it upstream in Collapse
|
|
15
|
+
id,
|
|
16
|
+
className,
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
19
|
+
const icon = expandIcon ? expandIcon({
|
|
20
|
+
isActive
|
|
21
|
+
}) : null;
|
|
22
|
+
const handleKeyDown = (event) => {
|
|
23
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
onItemClick?.();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ jsxs(PanelItem, { className: classNames("ant-collapse-item", "ds-sidebar-item", {
|
|
29
|
+
"ant-collapse-item-active": isActive,
|
|
30
|
+
"ds-sidebar-item-active": isActive
|
|
31
|
+
}, className), $isActive: isActive, $isDragOverlay: isDragOverlay, ...rest, children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(PanelHeader, { className: "ant-collapse-header ds-sidebar-header", role: "button", tabIndex: 0, "aria-expanded": Boolean(isActive), onClick: onItemClick, onKeyDown: handleKeyDown, children: [
|
|
33
|
+
header,
|
|
34
|
+
icon && /* @__PURE__ */ jsx(PanelExpandIcon, { className: "ant-collapse-expand-icon ds-sidebar-expand-icon", $iconPosition: expandIconPosition, children: icon })
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ jsx(PanelContent, { className: classNames("ant-collapse-content", "ds-sidebar-content", {
|
|
37
|
+
"ant-collapse-content-active": isActive
|
|
38
|
+
}), $isActive: isActive, children: /* @__PURE__ */ jsx(PanelContentBox, { className: "ant-collapse-content-box ds-sidebar-content-box", children: /* @__PURE__ */ jsx(PanelContentInner, { children }) }) })
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
CollapsePanel,
|
|
43
|
+
CollapsePanel as default
|
|
44
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { theme } from "@synerise/ds-core";
|
|
3
3
|
import Icon, { DragHandleM } from "@synerise/ds-icon";
|
|
4
|
-
import {
|
|
4
|
+
import { CollapsePanel } from "../Collapse/CollapsePanel.js";
|
|
5
|
+
import { SidebarContentWrapper, SidebarHeader, SidebarHandle } from "../Sidebar.styles.js";
|
|
5
6
|
const PanelContent = ({
|
|
6
7
|
header,
|
|
7
8
|
children,
|
|
@@ -10,7 +11,7 @@ const PanelContent = ({
|
|
|
10
11
|
dragHandleProps,
|
|
11
12
|
...props
|
|
12
13
|
}) => {
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
+
return /* @__PURE__ */ jsx(CollapsePanel, { header: /* @__PURE__ */ jsxs(SidebarHeader, { children: [
|
|
14
15
|
/* @__PURE__ */ jsx("span", { "data-testid": `header-${id}`, children: header }),
|
|
15
16
|
draggable && /* @__PURE__ */ jsx(SidebarHandle, { "data-testid": "ds-sidebar-header-handle", ...dragHandleProps, children: /* @__PURE__ */ jsx(Icon, { color: theme.palette["grey-400"], component: /* @__PURE__ */ jsx(DragHandleM, {}) }) })
|
|
16
17
|
] }), isDragOverlay: id === "-1", ...props, children: /* @__PURE__ */ jsx(SidebarContentWrapper, { children }) }, id);
|
package/dist/Sidebar.js
CHANGED
|
@@ -5,12 +5,10 @@ import { createPortal } from "react-dom";
|
|
|
5
5
|
import { useTheme } from "@synerise/ds-core";
|
|
6
6
|
import Icon, { AngleUpS, AngleDownS } from "@synerise/ds-icon";
|
|
7
7
|
import { DragOverlay, SortableContainer } from "@synerise/ds-sortable";
|
|
8
|
+
import { Collapse } from "./Collapse/Collapse.js";
|
|
8
9
|
import { DragOverlayPanel } from "./DragOverlayPanel/DragOverlayPanel.js";
|
|
9
10
|
import { Panel } from "./Panel/Panel.js";
|
|
10
11
|
import { SidebarContext } from "./Sidebar.context.js";
|
|
11
|
-
import { AntdCollapse } from "./Sidebar.styles.js";
|
|
12
|
-
import { prefixKeys } from "./utils/prefixKeys.js";
|
|
13
|
-
import "./style/index.css";
|
|
14
12
|
const Sidebar = ({
|
|
15
13
|
children,
|
|
16
14
|
order = [],
|
|
@@ -42,10 +40,10 @@ const Sidebar = ({
|
|
|
42
40
|
id
|
|
43
41
|
})), [order]);
|
|
44
42
|
const handleOnChange = useCallback((keys) => {
|
|
45
|
-
const finalKeys =
|
|
46
|
-
setActiveKeys(
|
|
43
|
+
const finalKeys = Array.isArray(keys) ? keys : [keys];
|
|
44
|
+
setActiveKeys(finalKeys);
|
|
47
45
|
onChange?.(finalKeys);
|
|
48
|
-
}, [
|
|
46
|
+
}, [onChange]);
|
|
49
47
|
const sortedChildren = useMemo(() => {
|
|
50
48
|
return Children.toArray(children).sort((a, b) => {
|
|
51
49
|
if (!isSortable) {
|
|
@@ -54,21 +52,6 @@ const Sidebar = ({
|
|
|
54
52
|
return Array.isArray(order) && order.indexOf(a.props.id) > order.indexOf(b.props.id) ? 1 : -1;
|
|
55
53
|
});
|
|
56
54
|
}, [children, isSortable, order]);
|
|
57
|
-
const activeKeysProp = useMemo(() => {
|
|
58
|
-
const prependedActiveKey = isSortable && activeKey ? prefixKeys(activeKey) : activeKey;
|
|
59
|
-
const prependedDefaultActiveKey = isSortable && defaultActiveKey ? prefixKeys(defaultActiveKey) : defaultActiveKey;
|
|
60
|
-
let keyProp = {};
|
|
61
|
-
if (prependedDefaultActiveKey !== void 0) {
|
|
62
|
-
keyProp = {
|
|
63
|
-
defaultActiveKey: prependedDefaultActiveKey
|
|
64
|
-
};
|
|
65
|
-
} else if (prependedActiveKey !== void 0) {
|
|
66
|
-
keyProp = {
|
|
67
|
-
activeKey: prependedActiveKey
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return keyProp;
|
|
71
|
-
}, [isSortable, activeKey, defaultActiveKey]);
|
|
72
55
|
const isDraggedPanelActive = useCallback((id) => {
|
|
73
56
|
return activeKeys.indexOf(id) > -1;
|
|
74
57
|
}, [activeKeys]);
|
|
@@ -87,15 +70,14 @@ const Sidebar = ({
|
|
|
87
70
|
const collapseContent = useMemo(() => {
|
|
88
71
|
const dragOverlay = /* @__PURE__ */ jsx(DragOverlay, { children: draggedItem && /* @__PURE__ */ createElement(DragOverlayPanel, { isActive: isDraggedPanelActive(draggedItem.id), forceRender: isDraggedPanelActive(draggedItem.id), ...draggedItem, draggable: true, id: "-1", key: "-1" }) });
|
|
89
72
|
return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, children: [
|
|
90
|
-
/* @__PURE__ */ jsx(
|
|
91
|
-
"is-drag-drop": isSortable
|
|
92
|
-
|
|
93
|
-
}), expandIconPosition: "end", expandIcon: ({
|
|
73
|
+
/* @__PURE__ */ jsx(Collapse, { activeKey, defaultActiveKey, className: classNames({
|
|
74
|
+
"is-drag-drop": isSortable
|
|
75
|
+
}, className), expandIconPosition: "end", expandIcon: ({
|
|
94
76
|
isActive
|
|
95
77
|
}) => /* @__PURE__ */ jsx(Icon, { color: theme.palette["grey-600"], component: isActive ? /* @__PURE__ */ jsx(AngleUpS, {}) : /* @__PURE__ */ jsx(AngleDownS, {}) }), onChange: handleOnChange, ...collapseProps, children: isSortable ? sortedChildren : children }),
|
|
96
78
|
wrapperRef.current && getPopupContainer ? createPortal(dragOverlay, getPopupContainer(wrapperRef.current)) : dragOverlay
|
|
97
79
|
] });
|
|
98
|
-
}, [draggedItem, isDraggedPanelActive,
|
|
80
|
+
}, [draggedItem, isDraggedPanelActive, activeKey, defaultActiveKey, isSortable, className, handleOnChange, collapseProps, sortedChildren, children, getPopupContainer, theme.palette]);
|
|
99
81
|
return isSortable ? /* @__PURE__ */ jsx(SortableContainer, { axis: "y", items: sortableItems, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragCancel: handleDragEnd, onOrderChange: handleOrderChange, children: /* @__PURE__ */ jsx(SidebarContext.Provider, { value: {
|
|
100
82
|
isSortable
|
|
101
83
|
}, children: collapseContent }) }) : collapseContent;
|
package/dist/Sidebar.styles.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
export declare const SidebarHandle: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const SidebarHeader: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const DraggablePanelWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const AntdCollapse: import('styled-components').StyledComponent<import('react').FC<import('antd').CollapseProps> & {
|
|
5
|
-
Panel: import('react').FC<import('antd').CollapsePanelProps>;
|
|
6
|
-
}, any, {}, never>;
|
|
7
|
-
export declare const AntdPanel: import('styled-components').StyledComponent<import('react').FC<import('antd').CollapsePanelProps>, any, {
|
|
8
|
-
isDragOverlay?: boolean;
|
|
9
|
-
}, never>;
|
|
10
4
|
export declare const SidebarContentWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
11
5
|
export declare const DragOverlay: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
12
6
|
export declare const DragOverlayHeader: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/dist/Sidebar.styles.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
const {
|
|
4
|
-
Panel
|
|
5
|
-
} = Collapse;
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { headerStyle, expandIconStyle } from "./Collapse/Collapse.styles.js";
|
|
6
3
|
const SidebarHandle = /* @__PURE__ */ styled.div.withConfig({
|
|
7
4
|
displayName: "Sidebarstyles__SidebarHandle",
|
|
8
5
|
componentId: "sc-19um1hw-0"
|
|
@@ -15,39 +12,27 @@ const DraggablePanelWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
15
12
|
displayName: "Sidebarstyles__DraggablePanelWrapper",
|
|
16
13
|
componentId: "sc-19um1hw-2"
|
|
17
14
|
})(["position:relative;"]);
|
|
18
|
-
const expandIconStyles = /* @__PURE__ */ css(["right:24px;top:50%;transform:translateY(-50%);position:absolute;"]);
|
|
19
|
-
const headerStyle = /* @__PURE__ */ css(["padding:18px 24px;color:", ";font-weight:500;font-size:14px;background:white;position:relative;cursor:pointer;&:hover{color:", ";}"], (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["grey-800"]);
|
|
20
|
-
const AntdCollapse = /* @__PURE__ */ styled(Collapse).withConfig({
|
|
21
|
-
displayName: "Sidebarstyles__AntdCollapse",
|
|
22
|
-
componentId: "sc-19um1hw-3"
|
|
23
|
-
})(["&.ant-collapse{background-color:", ";border:none;.ant-collapse-arrow{position:static !important;vertical-align:0 !important;transform:none !important;display:block;}.ant-collapse-header{", "}", " > .ant-collapse-item > .ant-collapse-header{transition:0.2s ease-in-out;display:flex;align-items:center;justify-content:flex-start;}.ant-collapse-content-active,.ant-collapse-item-active{border-top:0;", ",", "{color:", ";&:hover{color:", ";}}}.ant-collapse-content-box{padding:16px 24px;}.ant-collapse-item{position:relative;border-top:solid 1px ", ";border-bottom:none;}}.ant-collapse-item:hover ", "{opacity:1;}&.ant-collapse-icon-position-end{.ant-collapse-item > .ant-collapse-header{padding:18px 24px;user-select:none;.ant-collapse-expand-icon{", "}}&.ant-collapse-icon-position-end.is-drag-drop ", " > .ant-collapse-item{&:hover{color:", ";}}}"], (props) => props.theme.palette["blue-050"], headerStyle, DraggablePanelWrapper, SidebarHeader, SidebarHandle, (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["grey-800"], (props) => props.theme.palette["grey-200"], SidebarHandle, expandIconStyles, DraggablePanelWrapper, (props) => props.theme.palette["grey-800"]);
|
|
24
|
-
const AntdPanel = /* @__PURE__ */ styled(Panel).withConfig({
|
|
25
|
-
displayName: "Sidebarstyles__AntdPanel",
|
|
26
|
-
componentId: "sc-19um1hw-4"
|
|
27
|
-
})(["", " .ant-collapse-content{background-color:white;border-radius:0;border:none;}"], (props) => props.isDragOverlay && css(["box-shadow:", ";z-index:10;"], props.theme.variables["box-shadow-2"]));
|
|
28
15
|
const SidebarContentWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
29
16
|
displayName: "Sidebarstyles__SidebarContentWrapper",
|
|
30
|
-
componentId: "sc-19um1hw-
|
|
17
|
+
componentId: "sc-19um1hw-3"
|
|
31
18
|
})([""]);
|
|
32
19
|
const DragOverlay = /* @__PURE__ */ styled.div.withConfig({
|
|
33
20
|
displayName: "Sidebarstyles__DragOverlay",
|
|
34
|
-
componentId: "sc-19um1hw-
|
|
21
|
+
componentId: "sc-19um1hw-4"
|
|
35
22
|
})([""]);
|
|
36
23
|
const DragOverlayHeader = /* @__PURE__ */ styled.div.withConfig({
|
|
37
24
|
displayName: "Sidebarstyles__DragOverlayHeader",
|
|
38
|
-
componentId: "sc-19um1hw-
|
|
39
|
-
})(["border-top:1px solid ", ";
|
|
25
|
+
componentId: "sc-19um1hw-5"
|
|
26
|
+
})(["border-top:1px solid ", ";", " user-select:none;"], (props) => props.theme.palette["grey-200"], headerStyle);
|
|
40
27
|
const DragOverlayContent = /* @__PURE__ */ styled.div.withConfig({
|
|
41
28
|
displayName: "Sidebarstyles__DragOverlayContent",
|
|
42
|
-
componentId: "sc-19um1hw-
|
|
29
|
+
componentId: "sc-19um1hw-6"
|
|
43
30
|
})(["background-color:white;padding:16px 24px;"]);
|
|
44
31
|
const ExpandIcon = /* @__PURE__ */ styled.div.withConfig({
|
|
45
32
|
displayName: "Sidebarstyles__ExpandIcon",
|
|
46
|
-
componentId: "sc-19um1hw-
|
|
47
|
-
})(["", ""],
|
|
33
|
+
componentId: "sc-19um1hw-7"
|
|
34
|
+
})(["", ""], expandIconStyle);
|
|
48
35
|
export {
|
|
49
|
-
AntdCollapse,
|
|
50
|
-
AntdPanel,
|
|
51
36
|
DragOverlay,
|
|
52
37
|
DragOverlayContent,
|
|
53
38
|
DragOverlayHeader,
|
package/dist/Sidebar.types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-sidebar",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
4
4
|
"description": "Sidebar UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -44,17 +44,16 @@
|
|
|
44
44
|
"@synerise/ds-button": "^1.5.33",
|
|
45
45
|
"@synerise/ds-dropdown": "^1.3.16",
|
|
46
46
|
"@synerise/ds-icon": "^1.18.4",
|
|
47
|
-
"@synerise/ds-menu": "^1.4.
|
|
47
|
+
"@synerise/ds-menu": "^1.4.30",
|
|
48
48
|
"@synerise/ds-sortable": "^1.3.20",
|
|
49
49
|
"@synerise/ds-utils": "^1.10.1",
|
|
50
50
|
"classnames": "^2.5.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@synerise/ds-core": "*",
|
|
54
|
-
"antd": "4.24.16",
|
|
55
54
|
"react": ">=16.9.0 <= 18.3.1",
|
|
56
55
|
"styled-components": "^5.3.3",
|
|
57
56
|
"vitest": "4"
|
|
58
57
|
},
|
|
59
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "5452c886c6a70cc2847fdb50ccf376dfb93916e5"
|
|
60
59
|
}
|
|
File without changes
|
package/dist/style/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.ant-collapse{box-sizing:border-box;margin:0;padding:0;color:#6a7580;font-size:13px;font-variant:tabular-nums;line-height:1.38;list-style:none;font-feature-settings:'tnum';background-color:#e9edee;border:1px solid #dbe0e3;border-bottom:0;border-radius:3px}.ant-collapse>.ant-collapse-item{border-bottom:1px solid #dbe0e3}.ant-collapse>.ant-collapse-item:last-child,.ant-collapse>.ant-collapse-item:last-child>.ant-collapse-header{border-radius:0 0 3px 3px}.ant-collapse>.ant-collapse-item>.ant-collapse-header{position:relative;display:flex;flex-wrap:nowrap;align-items:flex-start;padding:12px 16px;color:#384350;line-height:1.38;cursor:pointer;transition:all .3s,visibility 0s}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{display:inline-block;margin-right:12px;font-size:11px;vertical-align:-1px}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow svg{transition:transform .24s}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-header-text{flex:auto}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-extra{margin-left:auto}.ant-collapse>.ant-collapse-item>.ant-collapse-header:focus{outline:0}.ant-collapse>.ant-collapse-item .ant-collapse-header-collapsible-only{cursor:default}.ant-collapse>.ant-collapse-item .ant-collapse-header-collapsible-only .ant-collapse-header-text{flex:none;cursor:pointer}.ant-collapse>.ant-collapse-item .ant-collapse-icon-collapsible-only{cursor:default}.ant-collapse>.ant-collapse-item .ant-collapse-icon-collapsible-only .ant-collapse-expand-icon{cursor:pointer}.ant-collapse>.ant-collapse-item.ant-collapse-no-arrow>.ant-collapse-header{padding-left:12px}.ant-collapse-icon-position-end>.ant-collapse-item>.ant-collapse-header{position:relative;padding:12px 16px;padding-right:40px}.ant-collapse-icon-position-end>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{position:absolute;top:50%;right:16px;left:auto;margin:0;transform:translateY(-50%)}.ant-collapse-content{color:#6a7580;background-color:#fff;border-top:1px solid #dbe0e3}.ant-collapse-content>.ant-collapse-content-box{padding:16px}.ant-collapse-content-hidden{display:none}.ant-collapse-item:last-child>.ant-collapse-content{border-radius:0 0 3px 3px}.ant-collapse-borderless{background-color:#e9edee;border:0}.ant-collapse-borderless>.ant-collapse-item{border-bottom:1px solid #dbe0e3}.ant-collapse-borderless>.ant-collapse-item:last-child,.ant-collapse-borderless>.ant-collapse-item:last-child .ant-collapse-header{border-radius:0}.ant-collapse-borderless>.ant-collapse-item:last-child{border-bottom:0}.ant-collapse-borderless>.ant-collapse-item>.ant-collapse-content{background-color:transparent;border-top:0}.ant-collapse-borderless>.ant-collapse-item>.ant-collapse-content>.ant-collapse-content-box{padding-top:4px}.ant-collapse-ghost{background-color:transparent;border:0}.ant-collapse-ghost>.ant-collapse-item{border-bottom:0}.ant-collapse-ghost>.ant-collapse-item>.ant-collapse-content{background-color:transparent;border-top:0}.ant-collapse-ghost>.ant-collapse-item>.ant-collapse-content>.ant-collapse-content-box{padding-top:12px;padding-bottom:12px}.ant-collapse .ant-collapse-item-disabled>.ant-collapse-header,.ant-collapse .ant-collapse-item-disabled>.ant-collapse-header>.arrow{color:#b5bdc3;cursor:not-allowed}.ant-collapse-rtl{direction:rtl}.ant-collapse-rtl.ant-collapse.ant-collapse-icon-position-end>.ant-collapse-item>.ant-collapse-header{position:relative;padding:12px 16px;padding-left:40px}.ant-collapse-rtl.ant-collapse.ant-collapse-icon-position-end>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{position:absolute;top:50%;right:auto;left:16px;margin:0;transform:translateY(-50%)}.ant-collapse-rtl .ant-collapse>.ant-collapse-item>.ant-collapse-header{padding:12px 16px;padding-right:40px}.ant-collapse-rtl.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{margin-right:0;margin-left:12px}.ant-collapse-rtl.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow svg{transform:rotate(180deg)}.ant-collapse-rtl.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-extra{margin-right:auto;margin-left:0}.ant-collapse-rtl.ant-collapse>.ant-collapse-item.ant-collapse-no-arrow>.ant-collapse-header{padding-right:12px;padding-left:0}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const prefixKeys: (keys: string | number | (string | number)[]) => string | string[];
|