@synerise/ds-tray 1.1.26 → 1.1.27
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 +4 -0
- package/dist/Tray.const.js +8 -3
- package/dist/Tray.d.ts +2 -2
- package/dist/Tray.js +41 -36
- package/dist/Tray.styles.d.ts +8 -8
- package/dist/Tray.styles.js +26 -28
- package/dist/Tray.types.d.ts +1 -1
- package/dist/Tray.types.js +1 -1
- package/dist/components/TrayProvider.d.ts +1 -1
- package/dist/components/TrayProvider.js +31 -30
- package/dist/contexts/TrayContext.d.ts +2 -2
- package/dist/contexts/TrayContext.js +5 -2
- package/dist/hooks/useTray.d.ts +1 -1
- package/dist/hooks/useTray.js +10 -6
- package/dist/hooks/useTrayContext.d.ts +1 -1
- package/dist/hooks/useTrayContext.js +9 -6
- package/dist/index.js +8 -3
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.27](https://github.com/Synerise/synerise-design/compare/@synerise/ds-tray@1.1.26...@synerise/ds-tray@1.1.27) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-tray
|
|
9
|
+
|
|
6
10
|
## [1.1.26](https://github.com/Synerise/synerise-design/compare/@synerise/ds-tray@1.1.25...@synerise/ds-tray@1.1.26) (2026-03-20)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-tray
|
package/dist/Tray.const.js
CHANGED
package/dist/Tray.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TrayProps } from './Tray.types';
|
|
3
3
|
declare const Tray: ({ id, ...htmlAttributes }: TrayProps) => React.JSX.Element | null;
|
|
4
4
|
export default Tray;
|
package/dist/Tray.js
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
isOpen
|
|
16
|
-
data
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import Icon, { CloseM } from "@synerise/ds-icon";
|
|
4
|
+
import { TrayWrapper, TrayHeader, TrayHeaderLeft, TrayTitle, TrayHeaderRight, TrayContent, TrayScrollbar, TrayFooter } from "./Tray.styles.js";
|
|
5
|
+
import { useTrayContext } from "./hooks/useTrayContext.js";
|
|
6
|
+
const Tray = ({
|
|
7
|
+
id,
|
|
8
|
+
...htmlAttributes
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
getTrayState,
|
|
12
|
+
closeTray
|
|
13
|
+
} = useTrayContext();
|
|
14
|
+
const {
|
|
15
|
+
isOpen,
|
|
16
|
+
data
|
|
17
|
+
} = getTrayState(id);
|
|
17
18
|
if (!isOpen) {
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
const {
|
|
22
|
+
content,
|
|
23
|
+
title,
|
|
24
|
+
footer,
|
|
25
|
+
headerRightSide,
|
|
26
|
+
onClose
|
|
27
|
+
} = data;
|
|
28
|
+
return /* @__PURE__ */ jsxs(TrayWrapper, { ...htmlAttributes, children: [
|
|
29
|
+
/* @__PURE__ */ jsxs(TrayHeader, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(TrayHeaderLeft, { children: /* @__PURE__ */ jsx(TrayTitle, { level: 4, children: title }) }),
|
|
31
|
+
/* @__PURE__ */ jsxs(TrayHeaderRight, { children: [
|
|
32
|
+
headerRightSide,
|
|
33
|
+
/* @__PURE__ */ jsx(Button, { type: "ghost", mode: "single-icon", onClick: () => {
|
|
34
|
+
closeTray(id);
|
|
35
|
+
onClose?.(id);
|
|
36
|
+
}, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}) }) })
|
|
37
|
+
] })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsx(TrayContent, { children: /* @__PURE__ */ jsx(TrayScrollbar, { absolute: true, children: content }) }),
|
|
40
|
+
footer && /* @__PURE__ */ jsx(TrayFooter, { children: footer })
|
|
41
|
+
] });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
Tray as default
|
|
39
45
|
};
|
|
40
|
-
export default Tray;
|
package/dist/Tray.styles.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const TrayContent: import(
|
|
2
|
-
export declare const TrayScrollbar: import(
|
|
3
|
-
export declare const TrayWrapper: import(
|
|
4
|
-
export declare const TrayHeader: import(
|
|
5
|
-
export declare const TrayHeaderLeft: import(
|
|
6
|
-
export declare const TrayHeaderRight: import(
|
|
7
|
-
export declare const TrayFooter: import(
|
|
8
|
-
export declare const TrayTitle: import(
|
|
1
|
+
export declare const TrayContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const TrayScrollbar: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<(import('@synerise/ds-scrollbar').ScrollbarProps | import('@synerise/ds-scrollbar').VirtualScrollbarProps) & import('react').RefAttributes<HTMLElement>>, any, {}, never>;
|
|
3
|
+
export declare const TrayWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const TrayHeader: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const TrayHeaderLeft: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const TrayHeaderRight: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const TrayFooter: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const TrayTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
|
package/dist/Tray.styles.js
CHANGED
|
@@ -1,48 +1,46 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import Scrollbar from
|
|
3
|
-
import { Title } from
|
|
4
|
-
import { FOOTER_HEIGHT, HEADER_HEIGHT, WRAPPER_HEIGHT } from
|
|
5
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import Scrollbar from "@synerise/ds-scrollbar";
|
|
3
|
+
import { Title } from "@synerise/ds-typography";
|
|
4
|
+
import { FOOTER_HEIGHT, HEADER_HEIGHT, WRAPPER_HEIGHT } from "./Tray.const.js";
|
|
5
|
+
const TrayContent = /* @__PURE__ */ styled.div.withConfig({
|
|
6
6
|
displayName: "Traystyles__TrayContent",
|
|
7
7
|
componentId: "sc-1v5sbw5-0"
|
|
8
8
|
})(["flex:1 1 auto;min-height:0;position:relative;display:flex;flex-direction:column;"]);
|
|
9
|
-
|
|
9
|
+
const TrayScrollbar = /* @__PURE__ */ styled(Scrollbar).withConfig({
|
|
10
10
|
displayName: "Traystyles__TrayScrollbar",
|
|
11
11
|
componentId: "sc-1v5sbw5-1"
|
|
12
12
|
})(["min-height:0;display:flex;flex-direction:column;.scrollbar-container{min-height:0;}"]);
|
|
13
|
-
|
|
13
|
+
const TrayWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
14
14
|
displayName: "Traystyles__TrayWrapper",
|
|
15
15
|
componentId: "sc-1v5sbw5-2"
|
|
16
|
-
})(["position:fixed;top:0;right:0;z-index:", ";box-shadow:", ";width:400px;border-radius:3px;max-height:", "px;display:flex;flex-direction:column;background:", ";"],
|
|
17
|
-
|
|
18
|
-
}, function (props) {
|
|
19
|
-
return props.theme.variables['box-shadow-2'];
|
|
20
|
-
}, WRAPPER_HEIGHT, function (props) {
|
|
21
|
-
return props.theme.palette.white;
|
|
22
|
-
});
|
|
23
|
-
export var TrayHeader = styled.div.withConfig({
|
|
16
|
+
})(["position:fixed;top:0;right:0;z-index:", ";box-shadow:", ";width:400px;border-radius:3px;max-height:", "px;display:flex;flex-direction:column;background:", ";"], (props) => props.theme.variables["zindex-tooltip"], (props) => props.theme.variables["box-shadow-2"], WRAPPER_HEIGHT, (props) => props.theme.palette.white);
|
|
17
|
+
const TrayHeader = /* @__PURE__ */ styled.div.withConfig({
|
|
24
18
|
displayName: "Traystyles__TrayHeader",
|
|
25
19
|
componentId: "sc-1v5sbw5-3"
|
|
26
|
-
})(["height:", "px;flex:0 0 ", "px;padding-left:18px;padding-right:12px;border-bottom:solid 1px ", ";display:flex;align-items:center;justify-content:space-between;"], HEADER_HEIGHT, HEADER_HEIGHT,
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
export var TrayHeaderLeft = styled.div.withConfig({
|
|
20
|
+
})(["height:", "px;flex:0 0 ", "px;padding-left:18px;padding-right:12px;border-bottom:solid 1px ", ";display:flex;align-items:center;justify-content:space-between;"], HEADER_HEIGHT, HEADER_HEIGHT, (props) => props.theme.palette["grey-200"]);
|
|
21
|
+
const TrayHeaderLeft = /* @__PURE__ */ styled.div.withConfig({
|
|
30
22
|
displayName: "Traystyles__TrayHeaderLeft",
|
|
31
23
|
componentId: "sc-1v5sbw5-4"
|
|
32
24
|
})([""]);
|
|
33
|
-
|
|
25
|
+
const TrayHeaderRight = /* @__PURE__ */ styled.div.withConfig({
|
|
34
26
|
displayName: "Traystyles__TrayHeaderRight",
|
|
35
27
|
componentId: "sc-1v5sbw5-5"
|
|
36
28
|
})(["display:flex;gap:8px;align-items:center;"]);
|
|
37
|
-
|
|
29
|
+
const TrayFooter = /* @__PURE__ */ styled.div.withConfig({
|
|
38
30
|
displayName: "Traystyles__TrayFooter",
|
|
39
31
|
componentId: "sc-1v5sbw5-6"
|
|
40
|
-
})(["border-top:solid 1px ", ";background:", ";height:", "px;display:flex;align-items:center;padding:0 8px;flex:0 0 ", "px;"],
|
|
41
|
-
|
|
42
|
-
}, function (props) {
|
|
43
|
-
return props.theme.palette['grey-050'];
|
|
44
|
-
}, FOOTER_HEIGHT, FOOTER_HEIGHT);
|
|
45
|
-
export var TrayTitle = styled(Title).withConfig({
|
|
32
|
+
})(["border-top:solid 1px ", ";background:", ";height:", "px;display:flex;align-items:center;padding:0 8px;flex:0 0 ", "px;"], (props) => props.theme.palette["grey-100"], (props) => props.theme.palette["grey-050"], FOOTER_HEIGHT, FOOTER_HEIGHT);
|
|
33
|
+
const TrayTitle = /* @__PURE__ */ styled(Title).withConfig({
|
|
46
34
|
displayName: "Traystyles__TrayTitle",
|
|
47
35
|
componentId: "sc-1v5sbw5-7"
|
|
48
|
-
})(["margin:0;"]);
|
|
36
|
+
})(["margin:0;"]);
|
|
37
|
+
export {
|
|
38
|
+
TrayContent,
|
|
39
|
+
TrayFooter,
|
|
40
|
+
TrayHeader,
|
|
41
|
+
TrayHeaderLeft,
|
|
42
|
+
TrayHeaderRight,
|
|
43
|
+
TrayScrollbar,
|
|
44
|
+
TrayTitle,
|
|
45
|
+
TrayWrapper
|
|
46
|
+
};
|
package/dist/Tray.types.d.ts
CHANGED
package/dist/Tray.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { TrayContext } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return _extends({}, prev, (_extends2 = {}, _extends2[id] = {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { TrayContext } from "../contexts/TrayContext.js";
|
|
4
|
+
const TrayProvider = ({
|
|
5
|
+
children
|
|
6
|
+
}) => {
|
|
7
|
+
const [trayState, setTrayState] = useState({});
|
|
8
|
+
const openTray = (id, data) => {
|
|
9
|
+
setTrayState((prev) => ({
|
|
10
|
+
...prev,
|
|
11
|
+
[id]: {
|
|
13
12
|
isOpen: true,
|
|
14
|
-
data
|
|
15
|
-
}
|
|
16
|
-
});
|
|
13
|
+
data
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
setTrayState(
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const closeTray = (id) => {
|
|
18
|
+
setTrayState((prev) => ({
|
|
19
|
+
...prev,
|
|
20
|
+
[id]: {
|
|
21
|
+
...prev[id],
|
|
22
22
|
isOpen: false
|
|
23
|
-
}
|
|
24
|
-
});
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const getTrayState = (id) => {
|
|
27
27
|
return trayState[id] || {
|
|
28
28
|
isOpen: false,
|
|
29
29
|
data: null
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
return /* @__PURE__ */ jsx(TrayContext.Provider, { value: {
|
|
33
|
+
openTray,
|
|
34
|
+
closeTray,
|
|
35
|
+
getTrayState
|
|
36
|
+
}, children });
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
TrayProvider
|
|
40
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TrayData } from '../components/TrayProvider';
|
|
2
2
|
export type TrayContextType = {
|
|
3
3
|
openTray: (id: string, data: TrayData) => void;
|
|
4
4
|
closeTray: (id: string) => void;
|
|
@@ -7,4 +7,4 @@ export type TrayContextType = {
|
|
|
7
7
|
data: TrayData;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export declare const TrayContext: import(
|
|
10
|
+
export declare const TrayContext: import('react').Context<TrayContextType | undefined>;
|
package/dist/hooks/useTray.d.ts
CHANGED
package/dist/hooks/useTray.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { useTrayContext } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
openTray
|
|
5
|
-
closeTray
|
|
1
|
+
import { useTrayContext } from "./useTrayContext.js";
|
|
2
|
+
const useTray = () => {
|
|
3
|
+
const {
|
|
4
|
+
openTray,
|
|
5
|
+
closeTray
|
|
6
|
+
} = useTrayContext();
|
|
6
7
|
return {
|
|
7
8
|
open: openTray,
|
|
8
9
|
close: closeTray
|
|
9
10
|
};
|
|
10
|
-
};
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
useTray
|
|
14
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TrayContextType } from '../contexts/TrayContext';
|
|
2
2
|
export declare const useTrayContext: () => TrayContextType;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { useContext } from
|
|
2
|
-
import { TrayContext } from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { TrayContext } from "../contexts/TrayContext.js";
|
|
3
|
+
const useTrayContext = () => {
|
|
4
|
+
const context = useContext(TrayContext);
|
|
5
5
|
if (!context) {
|
|
6
|
-
throw new Error(
|
|
6
|
+
throw new Error("useTrayContext must be used within a TrayProvider");
|
|
7
7
|
}
|
|
8
8
|
return context;
|
|
9
|
-
};
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
useTrayContext
|
|
12
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { default as default2 } from "./Tray.js";
|
|
2
|
+
import { TrayProvider } from "./components/TrayProvider.js";
|
|
3
|
+
import { useTray } from "./hooks/useTray.js";
|
|
4
|
+
export {
|
|
5
|
+
TrayProvider,
|
|
6
|
+
default2 as default,
|
|
7
|
+
useTray
|
|
8
|
+
};
|
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-tray",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
4
4
|
"description": "Tray UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"prepublish": "pnpm run build",
|
|
25
25
|
"types": "tsc --noEmit",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^1.5.
|
|
38
|
-
"@synerise/ds-icon": "^1.15.
|
|
39
|
-
"@synerise/ds-scrollbar": "^1.2.
|
|
40
|
-
"@synerise/ds-typography": "^1.1.
|
|
41
|
-
"@synerise/ds-utils": "^1.7.
|
|
37
|
+
"@synerise/ds-button": "^1.5.18",
|
|
38
|
+
"@synerise/ds-icon": "^1.15.1",
|
|
39
|
+
"@synerise/ds-scrollbar": "^1.2.17",
|
|
40
|
+
"@synerise/ds-typography": "^1.1.13",
|
|
41
|
+
"@synerise/ds-utils": "^1.7.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@synerise/ds-core": "*",
|
|
45
45
|
"react": ">=16.9.0 <= 18.3.1",
|
|
46
46
|
"styled-components": "^5.3.3"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
49
49
|
}
|