@synerise/ds-broadcast-bar 1.0.1

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 ADDED
@@ -0,0 +1,8 @@
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.0.1 (2025-09-05)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-broadcast-bar
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,37 @@
1
+ ---
2
+ id: broadcast-bar
3
+ title: BroadcastBar
4
+ ---
5
+
6
+ BroadcastBar UI Component
7
+
8
+ ## Installation
9
+ ```
10
+ npm i @synerise/ds-broadcast-bar
11
+ or
12
+ yarn add @synerise/ds-broadcast-bar
13
+ ```
14
+
15
+ ## Usage
16
+ ```
17
+ import BroadcastBar from '@synerise/ds-broadcast-bar'
18
+
19
+ <BroadcastBar />
20
+
21
+ ```
22
+
23
+ ## Demo
24
+
25
+ <iframe src="/storybook-static/iframe.html?id=components-broadcast-bar--default"></iframe>
26
+
27
+ ## API
28
+
29
+ | Property | Description | Type | Default |
30
+ | ---- | --- | --- | --- |
31
+ | type | Type of Broadcast-bar styles, options: `success`, `warning`, `negative` | `string` | `warning` |
32
+ | onCloseClick | callback fired when close icon clicked | `void` | - |
33
+ | withClose | prop to set closeIcon | `boolean` | - |
34
+ | button | prop to set button | `React.ReactNode` | - |
35
+ | customIcon | prop to set icon | `React.ReactNode` | - |
36
+ | description | prop to set description | `React.ReactNode` | - |
37
+
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type BroadcastBarProps } from './BroadcastBar.types';
3
+ declare const BroadcastBar: ({ customIcon, type, description, button, withClose, onCloseClick, }: BroadcastBarProps) => React.JSX.Element;
4
+ export default BroadcastBar;
@@ -0,0 +1,46 @@
1
+ import React, { useMemo } from 'react';
2
+ import Icon, { CloseM } from '@synerise/ds-icon';
3
+ import * as S from './BroadcastBar.styles';
4
+ import { DEFAULT_ICON, ICONS } from './constants';
5
+ var BroadcastBar = function BroadcastBar(_ref) {
6
+ var customIcon = _ref.customIcon,
7
+ type = _ref.type,
8
+ description = _ref.description,
9
+ button = _ref.button,
10
+ withClose = _ref.withClose,
11
+ onCloseClick = _ref.onCloseClick;
12
+ var renderMessage = useMemo(function () {
13
+ return /*#__PURE__*/React.createElement(S.AlertContent, null, description && /*#__PURE__*/React.createElement(S.AlertDescription, null, description));
14
+ }, [description]);
15
+ var renderIcon = useMemo(function () {
16
+ if (customIcon) {
17
+ return customIcon;
18
+ }
19
+ if (ICONS[type]) {
20
+ return ICONS[type];
21
+ }
22
+ return DEFAULT_ICON;
23
+ }, [customIcon, type]);
24
+ return /*#__PURE__*/React.createElement(S.Container, {
25
+ close: withClose,
26
+ type: type
27
+ }, /*#__PURE__*/React.createElement(S.WrapperBroadcastBar, {
28
+ close: withClose,
29
+ type: type
30
+ }, /*#__PURE__*/React.createElement(S.AllContent, {
31
+ close: withClose,
32
+ type: type
33
+ }, /*#__PURE__*/React.createElement(S.IconWrapper, {
34
+ type: type
35
+ }, /*#__PURE__*/React.createElement(Icon, {
36
+ component: renderIcon
37
+ })), renderMessage, /*#__PURE__*/React.createElement(S.ButtonWrapper, {
38
+ type: type
39
+ }, button)), withClose && /*#__PURE__*/React.createElement(S.ButtonCloseWrapper, null, /*#__PURE__*/React.createElement(S.IconCloseWrapper, {
40
+ onClick: onCloseClick,
41
+ type: type
42
+ }, /*#__PURE__*/React.createElement(Icon, {
43
+ component: /*#__PURE__*/React.createElement(CloseM, null)
44
+ })))));
45
+ };
46
+ export default BroadcastBar;
@@ -0,0 +1,29 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type BroadcastBarType } from './BroadcastBar.types';
3
+ export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const AllContent: import("styled-components").StyledComponent<"div", any, {
5
+ type?: BroadcastBarType;
6
+ close?: boolean | ReactNode;
7
+ }, never>;
8
+ export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
9
+ type?: BroadcastBarType;
10
+ }, never>;
11
+ export declare const IconCloseWrapper: import("styled-components").StyledComponent<"div", any, {
12
+ type?: BroadcastBarType;
13
+ }, never>;
14
+ export declare const ButtonWrapper: import("styled-components").StyledComponent<"div", any, {
15
+ type?: BroadcastBarType;
16
+ }, never>;
17
+ export declare const ButtonCloseWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
18
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
19
+ type?: BroadcastBarType;
20
+ }, never>;
21
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
22
+ type?: BroadcastBarType;
23
+ close?: boolean;
24
+ }, never>;
25
+ export declare const WrapperBroadcastBar: import("styled-components").StyledComponent<"div", any, {
26
+ type?: BroadcastBarType;
27
+ close?: boolean;
28
+ }, never>;
29
+ export declare const AlertDescription: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,74 @@
1
+ import styled, { css } from 'styled-components';
2
+ var getColorBackground = function getColorBackground(props) {
3
+ if (props.type === 'warning') {
4
+ return props.theme.palette['yellow-600'];
5
+ }
6
+ if (props.type === 'negative') {
7
+ return props.theme.palette['red-600'];
8
+ }
9
+ return props.theme.palette["green-600"];
10
+ };
11
+ var getColorIcon = function getColorIcon(props) {
12
+ if (props.type === 'warning') {
13
+ return props.theme.palette['grey-800'];
14
+ }
15
+ return props.theme.palette.white;
16
+ };
17
+ export var AlertContent = styled.div.withConfig({
18
+ displayName: "BroadcastBarstyles__AlertContent",
19
+ componentId: "sc-1wlkvzq-0"
20
+ })(["display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px 0;color:inherit;"]);
21
+ export var AllContent = styled.div.withConfig({
22
+ displayName: "BroadcastBarstyles__AllContent",
23
+ componentId: "sc-1wlkvzq-1"
24
+ })(["display:flex;", ";color:", ";"], function (props) {
25
+ return props.close && css(["position:absolute;left:50%;transform:translateX(-50%);"]);
26
+ }, function (props) {
27
+ return getColorIcon(props);
28
+ });
29
+ export var IconWrapper = styled.div.withConfig({
30
+ displayName: "BroadcastBarstyles__IconWrapper",
31
+ componentId: "sc-1wlkvzq-2"
32
+ })(["margin:8px 12px;color:", ";"], function (props) {
33
+ return getColorIcon(props);
34
+ });
35
+ export var IconCloseWrapper = styled.div.withConfig({
36
+ displayName: "BroadcastBarstyles__IconCloseWrapper",
37
+ componentId: "sc-1wlkvzq-3"
38
+ })(["margin:3px 5px 2px;cursor:pointer;color:", ";"], function (props) {
39
+ return getColorIcon(props);
40
+ });
41
+ export var ButtonWrapper = styled.div.withConfig({
42
+ displayName: "BroadcastBarstyles__ButtonWrapper",
43
+ componentId: "sc-1wlkvzq-4"
44
+ })(["margin:6px 8px;border-radius:3px;display:flex;background-color:rgba(255,255,255,0.2);"]);
45
+ export var ButtonCloseWrapper = styled.div.withConfig({
46
+ displayName: "BroadcastBarstyles__ButtonCloseWrapper",
47
+ componentId: "sc-1wlkvzq-5"
48
+ })(["margin:6px 8px;display:flex;"]);
49
+ export var Wrapper = styled.div.withConfig({
50
+ displayName: "BroadcastBarstyles__Wrapper",
51
+ componentId: "sc-1wlkvzq-6"
52
+ })(["margin-top:10px;color:", ";"], function (props) {
53
+ return getColorIcon(props);
54
+ });
55
+ export var Container = styled.div.withConfig({
56
+ displayName: "BroadcastBarstyles__Container",
57
+ componentId: "sc-1wlkvzq-7"
58
+ })(["width:100%;display:flex;justify-content:", ";position:relative;background-color:", ";"], function (props) {
59
+ return props.close ? 'space-between' : 'center';
60
+ }, function (props) {
61
+ return getColorBackground(props);
62
+ });
63
+ export var WrapperBroadcastBar = styled.div.withConfig({
64
+ displayName: "BroadcastBarstyles__WrapperBroadcastBar",
65
+ componentId: "sc-1wlkvzq-8"
66
+ })(["font-size:13px;", ";color:", ";"], function (props) {
67
+ return props.close && css(["margin-left:auto;"]);
68
+ }, function (props) {
69
+ return getColorIcon(props);
70
+ });
71
+ export var AlertDescription = styled.span.withConfig({
72
+ displayName: "BroadcastBarstyles__AlertDescription",
73
+ componentId: "sc-1wlkvzq-9"
74
+ })(["display:flex;max-width:800px;white-space:normal;font-size:13px;line-height:1.39;font-weight:500;color:inherit;"]);
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from 'react';
2
+ export type BroadcastBarType = 'success' | 'warning' | 'negative';
3
+ export type BroadcastBarProps = {
4
+ type: BroadcastBarType;
5
+ button?: ReactNode;
6
+ withClose?: boolean;
7
+ onCloseClick?: () => void;
8
+ customIcon?: ReactNode;
9
+ description?: ReactNode;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type BroadcastBarType } from './BroadcastBar.types';
3
+ export declare const ICONS: Record<BroadcastBarType, ReactNode>;
4
+ export declare const DEFAULT_ICON: React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { Check3M, ErrorFillM, WarningFillM } from '@synerise/ds-icon';
3
+ export var ICONS = {
4
+ success: /*#__PURE__*/React.createElement(Check3M, null),
5
+ warning: /*#__PURE__*/React.createElement(WarningFillM, null),
6
+ negative: /*#__PURE__*/React.createElement(ErrorFillM, null)
7
+ };
8
+ export var DEFAULT_ICON = /*#__PURE__*/React.createElement(WarningFillM, null);
@@ -0,0 +1,2 @@
1
+ export { default } from './BroadcastBar';
2
+ export type { BroadcastBarProps, BroadcastBarType } from './BroadcastBar.types';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from './BroadcastBar';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@synerise/ds-broadcast-bar",
3
+ "version": "1.0.1",
4
+ "description": "BroadcastBar 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
+ "pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
25
+ "prepublish": "npm run build",
26
+ "test": "jest",
27
+ "test:watch": "npm run test -- --watchAll",
28
+ "types": "tsc --noEmit",
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-button": "^1.4.8",
38
+ "@synerise/ds-icon": "^1.7.0",
39
+ "@synerise/ds-utils": "^1.4.0",
40
+ "animate.css": "^4.1.1"
41
+ },
42
+ "peerDependencies": {
43
+ "@synerise/ds-core": "*",
44
+ "react": ">=16.9.0 <= 18.3.1",
45
+ "styled-components": "^5.3.3"
46
+ },
47
+ "gitHead": "7f119fa17e645f1d800aea95c313fe22f348439c"
48
+ }