@synerise/ds-insight 1.1.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/CHANGELOG.md +16 -0
- package/LICENSE.md +21 -0
- package/README.md +40 -0
- package/dist/Insight.d.ts +4 -0
- package/dist/Insight.js +40 -0
- package/dist/Insight.styles.d.ts +12 -0
- package/dist/Insight.styles.js +43 -0
- package/dist/Insight.types.d.ts +12 -0
- package/dist/Insight.types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/modules.d.js +1 -0
- package/package.json +46 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 1.1.0 (2025-09-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **insight:** update dependencies ([5c097ea](https://github.com/Synerise/synerise-design/commit/5c097ea0f99eb2e7a39274afd1ea7aa7a0027fce))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **insight:** new component ([090427d](https://github.com/Synerise/synerise-design/commit/090427d8c7aba94ccf60342b065480c43d7baeb3))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Synerise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: insight
|
|
3
|
+
title: Insight
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Insight UI Component
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm i @synerise/ds-insight
|
|
12
|
+
or
|
|
13
|
+
yarn add @synerise/ds-insight
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
import Insight from '@synerise/ds-insight'
|
|
20
|
+
|
|
21
|
+
<Insight />
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Demo
|
|
26
|
+
|
|
27
|
+
<iframe src="/storybook-static/iframe.html?id=components-insight--default"></iframe>
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Property | Description | Type | Default |
|
|
32
|
+
| --------------- | ------------------------------------------------------------------- | ------------------------------ | ------- |
|
|
33
|
+
| avatar | avatar component | ReactNode | - |
|
|
34
|
+
| subTitle | text under title of Insight | ReactNode | - |
|
|
35
|
+
| title | title of Insight | ReactNode | - |
|
|
36
|
+
| headerRightSide | component on right side of Insight | ReactNode | - |
|
|
37
|
+
| footer | render components in footer | ReactNode | - |
|
|
38
|
+
| onClick | The callback function that is triggered when click on outer wrapper | function | - |
|
|
39
|
+
| content | render components inside Insight | ReactNode / InlineAlertProps[] | - |
|
|
40
|
+
| className | Insight className | string | - |
|
package/dist/Insight.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var _excluded = ["title", "subTitle", "avatar", "headerRightSide", "content", "footer", "onClick", "className"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import InlineAlert from '@synerise/ds-inline-alert';
|
|
6
|
+
import * as S from './Insight.styles';
|
|
7
|
+
var isInlineAlertPropsArray = function isInlineAlertPropsArray(value) {
|
|
8
|
+
return Array.isArray(value) && value.length > 0 && value.every(function (item) {
|
|
9
|
+
return typeof item === 'object' && item !== null && ! /*#__PURE__*/React.isValidElement(item) && 'message' in item && 'type' in item;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var Insight = function Insight(_ref) {
|
|
13
|
+
var title = _ref.title,
|
|
14
|
+
subTitle = _ref.subTitle,
|
|
15
|
+
avatar = _ref.avatar,
|
|
16
|
+
headerRightSide = _ref.headerRightSide,
|
|
17
|
+
content = _ref.content,
|
|
18
|
+
footer = _ref.footer,
|
|
19
|
+
onClick = _ref.onClick,
|
|
20
|
+
className = _ref.className,
|
|
21
|
+
htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
|
+
var renderedContent = useMemo(function () {
|
|
23
|
+
if (isInlineAlertPropsArray(content)) {
|
|
24
|
+
return content.map(function (props, index) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(InlineAlert, _extends({
|
|
26
|
+
key: index
|
|
27
|
+
}, props));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return content != null ? content : null;
|
|
31
|
+
}, [content]);
|
|
32
|
+
return /*#__PURE__*/React.createElement(S.InsightContainer, _extends({
|
|
33
|
+
className: "ds-insight " + (className || ''),
|
|
34
|
+
hasHover: !!onClick,
|
|
35
|
+
onClick: onClick
|
|
36
|
+
}, htmlAttributes), /*#__PURE__*/React.createElement(S.InsightHeaderBar, null, /*#__PURE__*/React.createElement(S.InsightAvatarWrapper, null, avatar, /*#__PURE__*/React.createElement(S.InsightTextWrapper, {
|
|
37
|
+
avatar: !!avatar
|
|
38
|
+
}, /*#__PURE__*/React.createElement(S.Title, null, title), /*#__PURE__*/React.createElement(S.SubTitle, null, subTitle))), headerRightSide), renderedContent && /*#__PURE__*/React.createElement(S.InsightContent, null, renderedContent), footer && /*#__PURE__*/React.createElement(S.InsightFooter, null, footer));
|
|
39
|
+
};
|
|
40
|
+
export default Insight;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const InsightContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
hasHover?: boolean;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const InsightContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const SubTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const Title: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
7
|
+
export declare const InsightHeaderBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const InsightAvatarWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const InsightTextWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
avatar?: boolean;
|
|
11
|
+
}, never>;
|
|
12
|
+
export declare const InsightFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export var InsightContainer = styled.div.withConfig({
|
|
3
|
+
displayName: "Insightstyles__InsightContainer",
|
|
4
|
+
componentId: "sc-4cncfc-0"
|
|
5
|
+
})(["display:flex;flex-direction:column;background-color:", ";gap:16px;padding:24px;width:100%;border-bottom:solid 1px ", ";", ";"], function (props) {
|
|
6
|
+
return props.theme.palette.white;
|
|
7
|
+
}, function (props) {
|
|
8
|
+
return props.theme.palette['grey-200'];
|
|
9
|
+
}, function (props) {
|
|
10
|
+
return props.hasHover && "&:hover {\n background-color: " + props.theme.palette['grey-050'] + ";\n }";
|
|
11
|
+
});
|
|
12
|
+
export var InsightContent = styled.div.withConfig({
|
|
13
|
+
displayName: "Insightstyles__InsightContent",
|
|
14
|
+
componentId: "sc-4cncfc-1"
|
|
15
|
+
})(["display:flex;flex-direction:column;justify-content:center;gap:4px;"]);
|
|
16
|
+
export var SubTitle = styled.div.withConfig({
|
|
17
|
+
displayName: "Insightstyles__SubTitle",
|
|
18
|
+
componentId: "sc-4cncfc-2"
|
|
19
|
+
})(["display:flex;"]);
|
|
20
|
+
export var Title = styled.label.withConfig({
|
|
21
|
+
displayName: "Insightstyles__Title",
|
|
22
|
+
componentId: "sc-4cncfc-3"
|
|
23
|
+
})(["color:", ";font-weight:500;display:block;font-size:14px;"], function (props) {
|
|
24
|
+
return props.theme.palette['grey-800'];
|
|
25
|
+
});
|
|
26
|
+
export var InsightHeaderBar = styled.div.withConfig({
|
|
27
|
+
displayName: "Insightstyles__InsightHeaderBar",
|
|
28
|
+
componentId: "sc-4cncfc-4"
|
|
29
|
+
})(["display:flex;justify-content:space-between;"]);
|
|
30
|
+
export var InsightAvatarWrapper = styled.div.withConfig({
|
|
31
|
+
displayName: "Insightstyles__InsightAvatarWrapper",
|
|
32
|
+
componentId: "sc-4cncfc-5"
|
|
33
|
+
})(["display:flex;justify-content:center;align-items:center;"]);
|
|
34
|
+
export var InsightTextWrapper = styled.div.withConfig({
|
|
35
|
+
displayName: "Insightstyles__InsightTextWrapper",
|
|
36
|
+
componentId: "sc-4cncfc-6"
|
|
37
|
+
})(["display:flex;flex-direction:column;margin-left:", ";"], function (props) {
|
|
38
|
+
return props.avatar ? '12px' : '0';
|
|
39
|
+
});
|
|
40
|
+
export var InsightFooter = styled.div.withConfig({
|
|
41
|
+
displayName: "Insightstyles__InsightFooter",
|
|
42
|
+
componentId: "sc-4cncfc-7"
|
|
43
|
+
})(["display:flex;"]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type InlineAlertProps } from '@synerise/ds-inline-alert';
|
|
3
|
+
import { type WithHTMLAttributes } from '@synerise/ds-utils';
|
|
4
|
+
export type InsightProps = WithHTMLAttributes<HTMLDivElement, {
|
|
5
|
+
avatar?: ReactNode;
|
|
6
|
+
headerRightSide?: ReactNode;
|
|
7
|
+
subTitle?: ReactNode;
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
content?: InlineAlertProps[] | ReactNode;
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Insight';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@synerise/ds-insight",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Insight UI Component for the Synerise Design System",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"repository": "Synerise/synerise-design",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist",
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"README.md",
|
|
12
|
+
"package.json",
|
|
13
|
+
"LICENSE.md"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "npm run build:js && npm run build:css && npm run defs",
|
|
20
|
+
"build:css": "node ../../../scripts/style/less.js",
|
|
21
|
+
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
+
"build:watch": "npm run build:js -- --watch",
|
|
23
|
+
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
|
+
"prepublish": "npm run build",
|
|
25
|
+
"types": "tsc --noEmit",
|
|
26
|
+
"pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
|
|
27
|
+
"test": "jest",
|
|
28
|
+
"test:watch": "npm run test -- --watchAll",
|
|
29
|
+
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
30
|
+
},
|
|
31
|
+
"sideEffects": [
|
|
32
|
+
"dist/style/*",
|
|
33
|
+
"*.less"
|
|
34
|
+
],
|
|
35
|
+
"types": "dist/index.d.ts",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@synerise/ds-inline-alert": "^1.0.2",
|
|
38
|
+
"@synerise/ds-utils": "^1.4.2"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@synerise/ds-core": "*",
|
|
42
|
+
"react": ">=16.9.0 <= 18.3.1",
|
|
43
|
+
"styled-components": "^5.3.3"
|
|
44
|
+
},
|
|
45
|
+
"gitHead": "4f56489ade5b08524578821d0c51c963002ff48c"
|
|
46
|
+
}
|