@synerise/ds-banner 0.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/LICENSE.md +21 -0
- package/README.md +81 -0
- package/dist/Banner.const.d.ts +3 -0
- package/dist/Banner.const.js +4 -0
- package/dist/Banner.d.ts +4 -0
- package/dist/Banner.js +93 -0
- package/dist/Banner.styles.d.ts +45 -0
- package/dist/Banner.styles.js +107 -0
- package/dist/Banner.types.d.ts +55 -0
- package/dist/Banner.types.js +1 -0
- package/dist/components/BannerCounter/BannerCounter.d.ts +3 -0
- package/dist/components/BannerCounter/BannerCounter.js +34 -0
- package/dist/components/BannerHeader/BannerHeader.d.ts +3 -0
- package/dist/components/BannerHeader/BannerHeader.js +29 -0
- package/dist/components/BannerSlide/BannerSlide.d.ts +3 -0
- package/dist/components/BannerSlide/BannerSlide.js +40 -0
- package/dist/components/BannerSlideMediaContent/BannerSlideMediaContent.d.ts +3 -0
- package/dist/components/BannerSlideMediaContent/BannerSlideMediaContent.js +12 -0
- package/dist/components/BannerSlideTextContent/BannerSlideTextContent.d.ts +3 -0
- package/dist/components/BannerSlideTextContent/BannerSlideTextContent.js +27 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useCarousel.d.ts +8 -0
- package/dist/hooks/useCarousel.js +19 -0
- package/dist/hooks/useTexts.d.ts +2 -0
- package/dist/hooks/useTexts.js +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/modules.d.js +1 -0
- package/dist/utils/isMediaContent.d.ts +2 -0
- package/dist/utils/isMediaContent.js +3 -0
- package/package.json +53 -0
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,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: banner
|
|
3
|
+
title: Banner
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Banner UI Component
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm i @synerise/ds-banner
|
|
12
|
+
or
|
|
13
|
+
yarn add @synerise/ds-banner
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
import Banner from '@synerise/ds-banner'
|
|
20
|
+
|
|
21
|
+
<Banner />
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Demo
|
|
26
|
+
|
|
27
|
+
<iframe src="/storybook-static/iframe.html?id=components-banner--default"></iframe>
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Property | Description | Type | Default |
|
|
32
|
+
| ---------------- | --------------------------------------------------------------------- | ------------------------------------ | --------- |
|
|
33
|
+
| slides | Array of slides to display | BannerSlideProps[] | - |
|
|
34
|
+
| autoPlay | auto-start slideshow (if multiple slides present) | boolean | true |
|
|
35
|
+
| transitionEffect | slide transition effect | 'scrollx' / 'fade' see antd carousel | 'scrollx' |
|
|
36
|
+
| autoPlaySpeed | duration of single slide display (ms) | number | 5000 |
|
|
37
|
+
| onAfterChange | handler to call after slides change | (index: number) => void | - |
|
|
38
|
+
| onBeforeChange | handler to call before slides change | (from: number, to: index) => void | - |
|
|
39
|
+
| onClose | handler to call when 'X' is clicked | () => void | - |
|
|
40
|
+
| expandable | displays persistent bar above slides with a collapse button and title | ExpandableProps | - |
|
|
41
|
+
| texts | custom translations | BannerTexts | - |
|
|
42
|
+
|
|
43
|
+
### BannerSlideProps
|
|
44
|
+
|
|
45
|
+
| Property | Description | Type | Default |
|
|
46
|
+
| ---------------- | ------------------ | ---------------------------------------------------------- | ------- |
|
|
47
|
+
| mainContent | main area content | BannerSlideTextContentProps / BannerSlideMediaContentProps | - |
|
|
48
|
+
| leftSideContent | left side content | BannerSlideTextContentProps / BannerSlideMediaContentProps | - |
|
|
49
|
+
| rightSideContent | right side content | BannerSlideTextContentProps / BannerSlideMediaContentProps | - |
|
|
50
|
+
|
|
51
|
+
### BannerSlideTextContentProps
|
|
52
|
+
|
|
53
|
+
| Property | Description | Type | Default |
|
|
54
|
+
| ----------- | --------------------------------- | -------------------------- | ------- |
|
|
55
|
+
| titlePrefix | icon / avatar prefix of the title | ReactNode | - |
|
|
56
|
+
| titleStatus | Title status tag | StatusProps, see ds-status | - |
|
|
57
|
+
| title | Slide title | ReactNode | - |
|
|
58
|
+
| buttons | Slide buttons | ReactNode | - |
|
|
59
|
+
| description | Slide description text | ReactNode | - |
|
|
60
|
+
|
|
61
|
+
### BannerSlideMediaContentProps
|
|
62
|
+
|
|
63
|
+
| Property | Description | Type | Default |
|
|
64
|
+
| -------- | ---------------- | --------- | ------- |
|
|
65
|
+
| media | image to display | ReactNode | - |
|
|
66
|
+
|
|
67
|
+
### ExpandableProps
|
|
68
|
+
|
|
69
|
+
| Property | Description | Type | Default |
|
|
70
|
+
| -------- | ---------------------- | --------- | ------- |
|
|
71
|
+
| title | Top bar title text | ReactNode | - |
|
|
72
|
+
| icon | Top bar icon prefix | ReactNode | - |
|
|
73
|
+
| expanded | default exapnded state | boolean | true |
|
|
74
|
+
|
|
75
|
+
### BannerTexts
|
|
76
|
+
|
|
77
|
+
| Property | Description | Type | Default |
|
|
78
|
+
| ------------ | -------------------------------------------- | --------- | ---------- |
|
|
79
|
+
| expand | toggle button label when banner is collapsed | ReactNode | 'Expand' |
|
|
80
|
+
| collapse | toggle button label when banner is expanded | ReactNode | 'Collapse' |
|
|
81
|
+
| closeTooltip | tooltip text over 'X' icon | ReactNode | 'Close' |
|
package/dist/Banner.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BannerProps } from './Banner.types';
|
|
3
|
+
declare const Banner: ({ slides, autoPlay, autoPlaySpeed, transitionEffect, onAfterChange, onBeforeChange, texts, onClose, expandable, ...htmlAttributes }: BannerProps) => React.JSX.Element;
|
|
4
|
+
export default Banner;
|
package/dist/Banner.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var _excluded = ["slides", "autoPlay", "autoPlaySpeed", "transitionEffect", "onAfterChange", "onBeforeChange", "texts", "onClose", "expandable"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import React, { useState, useMemo } from 'react';
|
|
10
|
+
import { v4 as uuid } from 'uuid';
|
|
11
|
+
import Button from '@synerise/ds-button';
|
|
12
|
+
import Icon, { CloseM } from '@synerise/ds-icon';
|
|
13
|
+
import Tooltip from '@synerise/ds-tooltip';
|
|
14
|
+
import * as S from './Banner.styles';
|
|
15
|
+
import { BannerSlide, BannerCounter, BannerHeader } from './components';
|
|
16
|
+
import { useTexts, useCarousel } from './hooks';
|
|
17
|
+
import { DEFAULT_SLIDE_SPEED } from './Banner.const';
|
|
18
|
+
var Banner = function Banner(_ref) {
|
|
19
|
+
var slides = _ref.slides,
|
|
20
|
+
_ref$autoPlay = _ref.autoPlay,
|
|
21
|
+
autoPlay = _ref$autoPlay === void 0 ? true : _ref$autoPlay,
|
|
22
|
+
_ref$autoPlaySpeed = _ref.autoPlaySpeed,
|
|
23
|
+
autoPlaySpeed = _ref$autoPlaySpeed === void 0 ? DEFAULT_SLIDE_SPEED : _ref$autoPlaySpeed,
|
|
24
|
+
_ref$transitionEffect = _ref.transitionEffect,
|
|
25
|
+
transitionEffect = _ref$transitionEffect === void 0 ? 'scrollx' : _ref$transitionEffect,
|
|
26
|
+
onAfterChange = _ref.onAfterChange,
|
|
27
|
+
onBeforeChange = _ref.onBeforeChange,
|
|
28
|
+
texts = _ref.texts,
|
|
29
|
+
onClose = _ref.onClose,
|
|
30
|
+
expandable = _ref.expandable,
|
|
31
|
+
htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
|
+
var _useState = useState(0),
|
|
33
|
+
currentIndex = _useState[0],
|
|
34
|
+
setCurrentIndex = _useState[1];
|
|
35
|
+
var _useState2 = useState((expandable == null ? void 0 : expandable.isExpanded) !== undefined ? expandable == null ? void 0 : expandable.isExpanded : true),
|
|
36
|
+
isExpanded = _useState2[0],
|
|
37
|
+
setIsExpanded = _useState2[1];
|
|
38
|
+
var _useCarousel = useCarousel(),
|
|
39
|
+
bannerRef = _useCarousel.bannerRef,
|
|
40
|
+
handleDotClick = _useCarousel.handleDotClick,
|
|
41
|
+
handleNextClick = _useCarousel.handleNextClick,
|
|
42
|
+
handlePrevClick = _useCarousel.handlePrevClick;
|
|
43
|
+
var allTexts = useTexts(texts);
|
|
44
|
+
var slidesWithUUID = useMemo(function () {
|
|
45
|
+
return slides.map(function (slide) {
|
|
46
|
+
return _objectSpread({}, slide, {
|
|
47
|
+
id: uuid()
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}, [slides]);
|
|
51
|
+
var handleBeforeChange = function handleBeforeChange(from, to) {
|
|
52
|
+
setCurrentIndex(to);
|
|
53
|
+
// eslint-disable-next-line no-unused-expressions
|
|
54
|
+
onBeforeChange == null || onBeforeChange(from, to);
|
|
55
|
+
};
|
|
56
|
+
var closeButton = onClose && /*#__PURE__*/React.createElement(S.BannerCloseWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
57
|
+
title: texts == null ? void 0 : texts.closeTooltip
|
|
58
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
59
|
+
onClick: onClose,
|
|
60
|
+
mode: "single-icon",
|
|
61
|
+
type: "ghost"
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
63
|
+
component: /*#__PURE__*/React.createElement(CloseM, null)
|
|
64
|
+
}))));
|
|
65
|
+
var expandableHeader = expandable && /*#__PURE__*/React.createElement(BannerHeader, _extends({}, expandable, {
|
|
66
|
+
isExpanded: isExpanded,
|
|
67
|
+
closeButton: closeButton,
|
|
68
|
+
onToggle: setIsExpanded,
|
|
69
|
+
texts: allTexts
|
|
70
|
+
}));
|
|
71
|
+
return /*#__PURE__*/React.createElement(S.BannerWrapper, _extends({}, htmlAttributes, {
|
|
72
|
+
count: slides.length
|
|
73
|
+
}), expandableHeader || closeButton, isExpanded && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.BannerSlides, {
|
|
74
|
+
ref: bannerRef,
|
|
75
|
+
afterChange: onAfterChange,
|
|
76
|
+
beforeChange: handleBeforeChange,
|
|
77
|
+
autoplay: autoPlay,
|
|
78
|
+
autoplaySpeed: autoPlaySpeed,
|
|
79
|
+
effect: transitionEffect,
|
|
80
|
+
dots: false
|
|
81
|
+
}, slidesWithUUID.map(function (slide) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(BannerSlide, _extends({}, slide, {
|
|
83
|
+
key: slide.id
|
|
84
|
+
}));
|
|
85
|
+
})), slides.length > 1 && /*#__PURE__*/React.createElement(BannerCounter, {
|
|
86
|
+
onPrevClick: handlePrevClick,
|
|
87
|
+
onNextClick: handleNextClick,
|
|
88
|
+
onDotClick: handleDotClick,
|
|
89
|
+
currentIndex: currentIndex,
|
|
90
|
+
slides: slidesWithUUID
|
|
91
|
+
})));
|
|
92
|
+
};
|
|
93
|
+
export default Banner;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Carousel } from 'antd';
|
|
3
|
+
export declare const BannerWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
count: number;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const BannerCloseWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const BannerHeaderWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
isExpanded: boolean;
|
|
9
|
+
}, never>;
|
|
10
|
+
export declare const BannerHeaderIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const BannerHeaderTitle: import("styled-components").StyledComponent<({ size, className, children, ellipsis }: {
|
|
12
|
+
size?: import("@synerise/ds-typography").TextSize | undefined;
|
|
13
|
+
ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps | undefined;
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
className?: string | undefined;
|
|
16
|
+
}) => import("react").JSX.Element, any, {}, never>;
|
|
17
|
+
export declare const BannerHeaderToggle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const BannerDivider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const BannerSlides: import("styled-components").StyledComponent<typeof Carousel, any, {
|
|
20
|
+
count?: number | undefined;
|
|
21
|
+
}, never>;
|
|
22
|
+
export declare const BannerSlideWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
23
|
+
export declare const BannerSlideInner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
24
|
+
export declare const BannerSlideTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
25
|
+
export declare const BannerSlideContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
26
|
+
export declare const BannerSlideContentWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
27
|
+
hasMainContent: boolean;
|
|
28
|
+
type?: "text" | "media" | undefined;
|
|
29
|
+
position: 'left' | 'right' | 'main';
|
|
30
|
+
}, never>;
|
|
31
|
+
export declare const BannerSlideTitlePrefix: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
32
|
+
export declare const BannerSlideTitleStatus: import("styled-components").StyledComponent<{
|
|
33
|
+
({ id, name, className, disabled, removable, image, shape, color, textColor, onRemove, onClick, prefixel, suffixel, texts, asPill, dashed, ...htmlAttributes }: import("@synerise/ds-tags/dist/Tag/Tag.types").TagProps): import("react").JSX.Element;
|
|
34
|
+
defaultProps: {
|
|
35
|
+
shape: import("@synerise/ds-tags").TagShape;
|
|
36
|
+
};
|
|
37
|
+
}, any, {}, never>;
|
|
38
|
+
export declare const BannerSlideTitleText: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => import("react").JSX.Element, any, {}, never>;
|
|
39
|
+
export declare const BannerSlideDescription: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
40
|
+
export declare const BannerSlideMediaWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
41
|
+
export declare const BannerSlideButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
42
|
+
export declare const BannerCounterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
43
|
+
export declare const BannerCounterDot: import("styled-components").StyledComponent<"div", any, {
|
|
44
|
+
active?: boolean | undefined;
|
|
45
|
+
}, never>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { Carousel } from 'antd';
|
|
3
|
+
import { Tag } from '@synerise/ds-tags';
|
|
4
|
+
import { Text, Title } from '@synerise/ds-typography';
|
|
5
|
+
export var BannerWrapper = styled.div.withConfig({
|
|
6
|
+
displayName: "Bannerstyles__BannerWrapper",
|
|
7
|
+
componentId: "sc-1rovna0-0"
|
|
8
|
+
})(["width:100%;background:", ";position:relative;border-radius:3px;overflow:hidden;.ant-carousel{min-width:100%;flex:1 0 100%;}.ant-carousel .slick-track{display:flex;align-items:center;}"], function (props) {
|
|
9
|
+
return props.theme.palette['grey-100'];
|
|
10
|
+
});
|
|
11
|
+
export var BannerCloseWrapper = styled.div.withConfig({
|
|
12
|
+
displayName: "Bannerstyles__BannerCloseWrapper",
|
|
13
|
+
componentId: "sc-1rovna0-1"
|
|
14
|
+
})(["position:absolute;right:8px;top:8px;z-index:10;"]);
|
|
15
|
+
export var BannerHeaderWrapper = styled.div.withConfig({
|
|
16
|
+
displayName: "Bannerstyles__BannerHeaderWrapper",
|
|
17
|
+
componentId: "sc-1rovna0-2"
|
|
18
|
+
})(["display:flex;gap:16px;align-items:center;padding:8px 16px;", " ", "{position:static;}"], function (props) {
|
|
19
|
+
return props.isExpanded && css(["border-bottom:solid 1px ", ";"], props.theme.palette['grey-300']);
|
|
20
|
+
}, BannerCloseWrapper);
|
|
21
|
+
export var BannerHeaderIcon = styled.div.withConfig({
|
|
22
|
+
displayName: "Bannerstyles__BannerHeaderIcon",
|
|
23
|
+
componentId: "sc-1rovna0-3"
|
|
24
|
+
})([""]);
|
|
25
|
+
export var BannerHeaderTitle = styled(Text).withConfig({
|
|
26
|
+
displayName: "Bannerstyles__BannerHeaderTitle",
|
|
27
|
+
componentId: "sc-1rovna0-4"
|
|
28
|
+
})(["flex-grow:1;"]);
|
|
29
|
+
export var BannerHeaderToggle = styled.div.withConfig({
|
|
30
|
+
displayName: "Bannerstyles__BannerHeaderToggle",
|
|
31
|
+
componentId: "sc-1rovna0-5"
|
|
32
|
+
})([""]);
|
|
33
|
+
export var BannerDivider = styled.div.withConfig({
|
|
34
|
+
displayName: "Bannerstyles__BannerDivider",
|
|
35
|
+
componentId: "sc-1rovna0-6"
|
|
36
|
+
})(["width:1px;height:32px;background:", ";"], function (props) {
|
|
37
|
+
return props.theme.palette['grey-300'];
|
|
38
|
+
});
|
|
39
|
+
export var BannerSlides = styled(Carousel).withConfig({
|
|
40
|
+
displayName: "Bannerstyles__BannerSlides",
|
|
41
|
+
componentId: "sc-1rovna0-7"
|
|
42
|
+
})(["min-width:100%;display:flex;"]);
|
|
43
|
+
export var BannerSlideWrapper = styled.div.withConfig({
|
|
44
|
+
displayName: "Bannerstyles__BannerSlideWrapper",
|
|
45
|
+
componentId: "sc-1rovna0-8"
|
|
46
|
+
})([""]);
|
|
47
|
+
export var BannerSlideInner = styled.div.withConfig({
|
|
48
|
+
displayName: "Bannerstyles__BannerSlideInner",
|
|
49
|
+
componentId: "sc-1rovna0-9"
|
|
50
|
+
})(["display:flex;flex:1 0 100%;width:100%;"]);
|
|
51
|
+
export var BannerSlideTitle = styled.div.withConfig({
|
|
52
|
+
displayName: "Bannerstyles__BannerSlideTitle",
|
|
53
|
+
componentId: "sc-1rovna0-10"
|
|
54
|
+
})(["display:flex;gap:16px;align-items:center;position:relative;"]);
|
|
55
|
+
export var BannerSlideContent = styled.div.withConfig({
|
|
56
|
+
displayName: "Bannerstyles__BannerSlideContent",
|
|
57
|
+
componentId: "sc-1rovna0-11"
|
|
58
|
+
})([""]);
|
|
59
|
+
export var BannerSlideContentWrapper = styled.div.withConfig({
|
|
60
|
+
displayName: "Bannerstyles__BannerSlideContentWrapper",
|
|
61
|
+
componentId: "sc-1rovna0-12"
|
|
62
|
+
})(["display:flex;", ";", ";"], function (_ref) {
|
|
63
|
+
var type = _ref.type;
|
|
64
|
+
return type === 'media' ? css(["flex-direction:row;"]) : css(["flex-direction:column;gap:8px;padding:48px 40px;"]);
|
|
65
|
+
}, function (_ref2) {
|
|
66
|
+
var position = _ref2.position,
|
|
67
|
+
hasMainContent = _ref2.hasMainContent;
|
|
68
|
+
return position === 'main' ? css(["flex-grow:1;"]) : css(["flex-grow:", ";flex-basis:240px;flex-shrink:0;"], hasMainContent ? '0' : '1');
|
|
69
|
+
});
|
|
70
|
+
export var BannerSlideTitlePrefix = styled.div.withConfig({
|
|
71
|
+
displayName: "Bannerstyles__BannerSlideTitlePrefix",
|
|
72
|
+
componentId: "sc-1rovna0-13"
|
|
73
|
+
})([""]);
|
|
74
|
+
export var BannerSlideTitleStatus = styled(Tag).withConfig({
|
|
75
|
+
displayName: "Bannerstyles__BannerSlideTitleStatus",
|
|
76
|
+
componentId: "sc-1rovna0-14"
|
|
77
|
+
})(["margin:0;"]);
|
|
78
|
+
export var BannerSlideTitleText = styled(Title).withConfig({
|
|
79
|
+
displayName: "Bannerstyles__BannerSlideTitleText",
|
|
80
|
+
componentId: "sc-1rovna0-15"
|
|
81
|
+
})(["margin-bottom:0;"]);
|
|
82
|
+
export var BannerSlideDescription = styled.div.withConfig({
|
|
83
|
+
displayName: "Bannerstyles__BannerSlideDescription",
|
|
84
|
+
componentId: "sc-1rovna0-16"
|
|
85
|
+
})([""]);
|
|
86
|
+
export var BannerSlideMediaWrapper = styled.div.withConfig({
|
|
87
|
+
displayName: "Bannerstyles__BannerSlideMediaWrapper",
|
|
88
|
+
componentId: "sc-1rovna0-17"
|
|
89
|
+
})(["width:100%;display:flex;justify-content:center;align-items:center;overflow:hidden;img,video{max-width:100%;max-height:100%;}"]);
|
|
90
|
+
export var BannerSlideButtons = styled.div.withConfig({
|
|
91
|
+
displayName: "Bannerstyles__BannerSlideButtons",
|
|
92
|
+
componentId: "sc-1rovna0-18"
|
|
93
|
+
})(["margin-top:16px;display:flex;gap:8px;"]);
|
|
94
|
+
export var BannerCounterWrapper = styled.div.withConfig({
|
|
95
|
+
displayName: "Bannerstyles__BannerCounterWrapper",
|
|
96
|
+
componentId: "sc-1rovna0-19"
|
|
97
|
+
})(["padding:4px;display:flex;align-items:center;justify-content:center;gap:8px;border-top:solid 1px ", ";"], function (props) {
|
|
98
|
+
return props.theme.palette['grey-300'];
|
|
99
|
+
});
|
|
100
|
+
export var BannerCounterDot = styled.div.withConfig({
|
|
101
|
+
displayName: "Bannerstyles__BannerCounterDot",
|
|
102
|
+
componentId: "sc-1rovna0-20"
|
|
103
|
+
})(["display:flex;width:24px;height:32px;cursor:pointer;align-items:center;&:after{content:'';transition:background-color 0.2s ease-in-out;background:", ";height:4px;width:100%;border-radius:2px;display:block;}&:hover{&:after{background:", ";}}"], function (props) {
|
|
104
|
+
return props.active ? props.theme.palette['blue-600'] : props.theme.palette['grey-300'];
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.active ? props.theme.palette['blue-600'] : props.theme.palette['grey-400'];
|
|
107
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
+
import type { TagProps } from '@synerise/ds-tags';
|
|
4
|
+
type Texts = 'expand' | 'collapse' | 'closeTooltip';
|
|
5
|
+
export type BannerTexts = {
|
|
6
|
+
[k in Texts]: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type BannerProps = WithHTMLAttributes<HTMLDivElement, {
|
|
9
|
+
slides: Array<BannerSlideProps>;
|
|
10
|
+
autoPlay?: boolean;
|
|
11
|
+
transitionEffect?: 'scrollx' | 'fade';
|
|
12
|
+
autoPlaySpeed?: number;
|
|
13
|
+
onAfterChange?: (index: number) => void;
|
|
14
|
+
onBeforeChange?: (from: number, to: number) => void;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
expandable?: Omit<BannerHeaderProps, 'closeButton' | 'onToggle' | 'texts'>;
|
|
17
|
+
texts?: Partial<BannerTexts>;
|
|
18
|
+
}>;
|
|
19
|
+
export type BannerHeaderProps = {
|
|
20
|
+
closeButton?: ReactNode;
|
|
21
|
+
title: ReactNode;
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
isExpanded?: boolean;
|
|
24
|
+
onToggle: (isExpanded: boolean) => void;
|
|
25
|
+
texts: BannerTexts;
|
|
26
|
+
};
|
|
27
|
+
export type BannerSlideProps = WithHTMLAttributes<HTMLDivElement, {
|
|
28
|
+
mainContent?: BannerSlideTextContentProps | BannerSlideMediaContentProps;
|
|
29
|
+
leftSideContent?: BannerSlideTextContentProps | BannerSlideMediaContentProps;
|
|
30
|
+
rightSideContent?: BannerSlideTextContentProps | BannerSlideMediaContentProps;
|
|
31
|
+
}>;
|
|
32
|
+
export type BannerSlideContentProps = {
|
|
33
|
+
position: 'left' | 'right' | 'main';
|
|
34
|
+
hasMainContent?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type BannerSlideTextContentProps = {
|
|
37
|
+
titlePrefix?: ReactNode;
|
|
38
|
+
titleStatus?: Pick<TagProps, 'textColor' | 'color' | 'name'>;
|
|
39
|
+
title?: ReactNode;
|
|
40
|
+
buttons?: ReactNode;
|
|
41
|
+
description?: ReactNode;
|
|
42
|
+
};
|
|
43
|
+
export type BannerSlideMediaContentProps = {
|
|
44
|
+
media?: ReactNode;
|
|
45
|
+
};
|
|
46
|
+
export type BannerCounterProps = {
|
|
47
|
+
slides: Array<BannerSlideProps & {
|
|
48
|
+
id: string;
|
|
49
|
+
}>;
|
|
50
|
+
currentIndex: number;
|
|
51
|
+
onDotClick: (index: number) => void;
|
|
52
|
+
onNextClick: () => void;
|
|
53
|
+
onPrevClick: () => void;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '@synerise/ds-button';
|
|
3
|
+
import Icon, { AngleLeftS, AngleRightS } from '@synerise/ds-icon';
|
|
4
|
+
import * as S from '../../Banner.styles';
|
|
5
|
+
export var BannerCounter = function BannerCounter(_ref) {
|
|
6
|
+
var slides = _ref.slides,
|
|
7
|
+
currentIndex = _ref.currentIndex,
|
|
8
|
+
onDotClick = _ref.onDotClick,
|
|
9
|
+
onPrevClick = _ref.onPrevClick,
|
|
10
|
+
onNextClick = _ref.onNextClick;
|
|
11
|
+
return /*#__PURE__*/React.createElement(S.BannerCounterWrapper, {
|
|
12
|
+
"data-testid": "banner-counter"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
14
|
+
type: "ghost",
|
|
15
|
+
onClick: onPrevClick,
|
|
16
|
+
mode: "single-icon"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
component: /*#__PURE__*/React.createElement(AngleLeftS, null)
|
|
19
|
+
})), slides.map(function (slide, index) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(S.BannerCounterDot, {
|
|
21
|
+
key: slide.id,
|
|
22
|
+
active: index === currentIndex,
|
|
23
|
+
onClick: function onClick() {
|
|
24
|
+
return onDotClick(index);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
type: "ghost",
|
|
29
|
+
onClick: onNextClick,
|
|
30
|
+
mode: "single-icon"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
32
|
+
component: /*#__PURE__*/React.createElement(AngleRightS, null)
|
|
33
|
+
})));
|
|
34
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import Button from '@synerise/ds-button';
|
|
3
|
+
import Icon, { AngleDownS, AngleUpS } from '@synerise/ds-icon';
|
|
4
|
+
import * as S from '../../Banner.styles';
|
|
5
|
+
export var BannerHeader = function BannerHeader(_ref) {
|
|
6
|
+
var closeButton = _ref.closeButton,
|
|
7
|
+
icon = _ref.icon,
|
|
8
|
+
title = _ref.title,
|
|
9
|
+
_ref$isExpanded = _ref.isExpanded,
|
|
10
|
+
isExpanded = _ref$isExpanded === void 0 ? true : _ref$isExpanded,
|
|
11
|
+
texts = _ref.texts,
|
|
12
|
+
onToggle = _ref.onToggle;
|
|
13
|
+
var toggleButtonElement = useMemo(function () {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
15
|
+
mode: "label-icon",
|
|
16
|
+
type: "ghost-primary",
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
return onToggle(!isExpanded);
|
|
19
|
+
}
|
|
20
|
+
}, isExpanded ? texts.collapse : texts.expand, /*#__PURE__*/React.createElement(Icon, {
|
|
21
|
+
component: isExpanded ? /*#__PURE__*/React.createElement(AngleUpS, null) : /*#__PURE__*/React.createElement(AngleDownS, null)
|
|
22
|
+
}));
|
|
23
|
+
}, [isExpanded, onToggle, texts.collapse, texts.expand]);
|
|
24
|
+
return /*#__PURE__*/React.createElement(S.BannerHeaderWrapper, {
|
|
25
|
+
isExpanded: isExpanded
|
|
26
|
+
}, icon && /*#__PURE__*/React.createElement(S.BannerHeaderIcon, null, icon), /*#__PURE__*/React.createElement(S.BannerHeaderTitle, {
|
|
27
|
+
size: "small"
|
|
28
|
+
}, title), /*#__PURE__*/React.createElement(S.BannerHeaderToggle, null, toggleButtonElement), closeButton && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.BannerDivider, null), closeButton));
|
|
29
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import * as S from '../../Banner.styles';
|
|
4
|
+
import { BannerSlideMediaContent, BannerSlideTextContent } from '../index';
|
|
5
|
+
import { isMediaContent } from '../../utils/isMediaContent';
|
|
6
|
+
export var BannerSlide = function BannerSlide(_ref) {
|
|
7
|
+
var mainContent = _ref.mainContent,
|
|
8
|
+
leftSideContent = _ref.leftSideContent,
|
|
9
|
+
rightSideContent = _ref.rightSideContent;
|
|
10
|
+
var hasMainContent = Boolean(mainContent);
|
|
11
|
+
var leftSideComponent = useMemo(function () {
|
|
12
|
+
if (!leftSideContent) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
13
|
+
return isMediaContent(leftSideContent) ? /*#__PURE__*/React.createElement(BannerSlideMediaContent, _extends({
|
|
14
|
+
position: "left",
|
|
15
|
+
hasMainContent: hasMainContent
|
|
16
|
+
}, leftSideContent)) : /*#__PURE__*/React.createElement(BannerSlideTextContent, _extends({
|
|
17
|
+
position: "left",
|
|
18
|
+
hasMainContent: hasMainContent
|
|
19
|
+
}, leftSideContent));
|
|
20
|
+
}, [leftSideContent, hasMainContent]);
|
|
21
|
+
var rightSideComponent = useMemo(function () {
|
|
22
|
+
if (!rightSideContent) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
23
|
+
return isMediaContent(rightSideContent) ? /*#__PURE__*/React.createElement(BannerSlideMediaContent, _extends({
|
|
24
|
+
position: "right",
|
|
25
|
+
hasMainContent: hasMainContent
|
|
26
|
+
}, rightSideContent)) : /*#__PURE__*/React.createElement(BannerSlideTextContent, _extends({
|
|
27
|
+
position: "right",
|
|
28
|
+
hasMainContent: hasMainContent
|
|
29
|
+
}, rightSideContent));
|
|
30
|
+
}, [rightSideContent, hasMainContent]);
|
|
31
|
+
var mainComponent = useMemo(function () {
|
|
32
|
+
if (!mainContent) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
33
|
+
return isMediaContent(mainContent) ? /*#__PURE__*/React.createElement(BannerSlideMediaContent, _extends({
|
|
34
|
+
position: "main"
|
|
35
|
+
}, mainContent)) : /*#__PURE__*/React.createElement(BannerSlideTextContent, _extends({
|
|
36
|
+
position: "main"
|
|
37
|
+
}, mainContent));
|
|
38
|
+
}, [mainContent]);
|
|
39
|
+
return /*#__PURE__*/React.createElement(S.BannerSlideWrapper, null, /*#__PURE__*/React.createElement(S.BannerSlideInner, null, leftSideComponent, mainComponent, rightSideComponent));
|
|
40
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BannerSlideContentProps, BannerSlideMediaContentProps } from '../../Banner.types';
|
|
3
|
+
export declare const BannerSlideMediaContent: ({ media, position, hasMainContent, }: BannerSlideMediaContentProps & BannerSlideContentProps) => React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as S from '../../Banner.styles';
|
|
3
|
+
export var BannerSlideMediaContent = function BannerSlideMediaContent(_ref) {
|
|
4
|
+
var media = _ref.media,
|
|
5
|
+
position = _ref.position,
|
|
6
|
+
hasMainContent = _ref.hasMainContent;
|
|
7
|
+
return /*#__PURE__*/React.createElement(S.BannerSlideContentWrapper, {
|
|
8
|
+
hasMainContent: !!hasMainContent,
|
|
9
|
+
position: position,
|
|
10
|
+
type: "media"
|
|
11
|
+
}, /*#__PURE__*/React.createElement(S.BannerSlideMediaWrapper, null, media));
|
|
12
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BannerSlideTextContentProps, BannerSlideContentProps } from '../../Banner.types';
|
|
3
|
+
export declare const BannerSlideTextContent: ({ title, titlePrefix, titleStatus, description, position, buttons, hasMainContent, }: BannerSlideTextContentProps & BannerSlideContentProps) => React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TagShape } from '@synerise/ds-tags';
|
|
4
|
+
import * as S from '../../Banner.styles';
|
|
5
|
+
import { DEFAULT_STATUS_COLOR, DEFAULT_STATUS_TEXT_COLOR } from '../../Banner.const';
|
|
6
|
+
export var BannerSlideTextContent = function BannerSlideTextContent(_ref) {
|
|
7
|
+
var title = _ref.title,
|
|
8
|
+
titlePrefix = _ref.titlePrefix,
|
|
9
|
+
titleStatus = _ref.titleStatus,
|
|
10
|
+
description = _ref.description,
|
|
11
|
+
position = _ref.position,
|
|
12
|
+
buttons = _ref.buttons,
|
|
13
|
+
hasMainContent = _ref.hasMainContent;
|
|
14
|
+
return /*#__PURE__*/React.createElement(S.BannerSlideContentWrapper, {
|
|
15
|
+
hasMainContent: !!hasMainContent,
|
|
16
|
+
position: position,
|
|
17
|
+
type: "text"
|
|
18
|
+
}, title && /*#__PURE__*/React.createElement(React.Fragment, null, titleStatus && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(S.BannerSlideTitleStatus, _extends({
|
|
19
|
+
color: DEFAULT_STATUS_COLOR,
|
|
20
|
+
textColor: DEFAULT_STATUS_TEXT_COLOR
|
|
21
|
+
}, titleStatus, {
|
|
22
|
+
asPill: true,
|
|
23
|
+
shape: TagShape.SMALL_SQUARE
|
|
24
|
+
}))), /*#__PURE__*/React.createElement(S.BannerSlideTitle, null, titlePrefix && /*#__PURE__*/React.createElement(S.BannerSlideTitlePrefix, null, titlePrefix), /*#__PURE__*/React.createElement(S.BannerSlideTitleText, {
|
|
25
|
+
level: 1
|
|
26
|
+
}, title))), description && /*#__PURE__*/React.createElement(S.BannerSlideDescription, null, description), buttons && /*#__PURE__*/React.createElement(S.BannerSlideButtons, null, buttons));
|
|
27
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './BannerCounter/BannerCounter';
|
|
2
|
+
export * from './BannerHeader/BannerHeader';
|
|
3
|
+
export * from './BannerSlide/BannerSlide';
|
|
4
|
+
export * from './BannerSlideMediaContent/BannerSlideMediaContent';
|
|
5
|
+
export * from './BannerSlideTextContent/BannerSlideTextContent';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './BannerCounter/BannerCounter';
|
|
2
|
+
export * from './BannerHeader/BannerHeader';
|
|
3
|
+
export * from './BannerSlide/BannerSlide';
|
|
4
|
+
export * from './BannerSlideMediaContent/BannerSlideMediaContent';
|
|
5
|
+
export * from './BannerSlideTextContent/BannerSlideTextContent';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Carousel from 'antd/lib/carousel';
|
|
3
|
+
export declare const useCarousel: () => {
|
|
4
|
+
bannerRef: import("react").RefObject<Carousel>;
|
|
5
|
+
handleDotClick: (index: number) => void;
|
|
6
|
+
handleNextClick: () => void;
|
|
7
|
+
handlePrevClick: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
export var useCarousel = function useCarousel() {
|
|
3
|
+
var bannerRef = useRef(null);
|
|
4
|
+
var handleDotClick = function handleDotClick(index) {
|
|
5
|
+
bannerRef.current && bannerRef.current.goTo(index);
|
|
6
|
+
};
|
|
7
|
+
var handleNextClick = function handleNextClick() {
|
|
8
|
+
bannerRef.current && bannerRef.current.next();
|
|
9
|
+
};
|
|
10
|
+
var handlePrevClick = function handlePrevClick() {
|
|
11
|
+
bannerRef.current && bannerRef.current.prev();
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
bannerRef: bannerRef,
|
|
15
|
+
handleDotClick: handleDotClick,
|
|
16
|
+
handleNextClick: handleNextClick,
|
|
17
|
+
handlePrevClick: handlePrevClick
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
7
|
+
export var useTexts = function useTexts(texts) {
|
|
8
|
+
var intl = useIntl();
|
|
9
|
+
return _objectSpread({
|
|
10
|
+
expand: intl.formatMessage({
|
|
11
|
+
id: 'DS.BANNER.EXPAND',
|
|
12
|
+
defaultMessage: 'Expand'
|
|
13
|
+
}),
|
|
14
|
+
collapse: intl.formatMessage({
|
|
15
|
+
id: 'DS.BANNER.COLLAPSE',
|
|
16
|
+
defaultMessage: 'Collapse'
|
|
17
|
+
}),
|
|
18
|
+
closeTooltip: intl.formatMessage({
|
|
19
|
+
id: 'DS.BANNER.CLOSE-TOOLTIP',
|
|
20
|
+
defaultMessage: 'Close'
|
|
21
|
+
})
|
|
22
|
+
}, texts || {});
|
|
23
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Banner';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@synerise/ds-banner",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Banner 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 ../../portal/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": "^0.21.21",
|
|
38
|
+
"@synerise/ds-icon": "^0.68.0",
|
|
39
|
+
"@synerise/ds-tags": "^0.10.20",
|
|
40
|
+
"@synerise/ds-tooltip": "^0.14.51",
|
|
41
|
+
"@synerise/ds-typography": "^0.16.8",
|
|
42
|
+
"@synerise/ds-utils": "^0.31.2",
|
|
43
|
+
"uuid": "^8.3.2"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@synerise/ds-core": "*",
|
|
47
|
+
"antd": "4.7.0",
|
|
48
|
+
"react": ">=16.9.0 <= 17.0.2",
|
|
49
|
+
"react-intl": ">= 3.12.0 <= 6.8",
|
|
50
|
+
"styled-components": "^5.0.1"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "a378cf0bf0f6ed94c63e0aed6da0ca95a8264c83"
|
|
53
|
+
}
|