@synerise/ds-empty-states 0.2.63 → 0.3.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 CHANGED
@@ -3,6 +3,25 @@
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
+ ## [0.3.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-empty-states@0.3.0...@synerise/ds-empty-states@0.3.1) (2024-11-21)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-empty-states
9
+
10
+
11
+
12
+
13
+
14
+ # [0.3.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-empty-states@0.2.63...@synerise/ds-empty-states@0.3.0) (2024-11-14)
15
+
16
+
17
+ ### Features
18
+
19
+ * **empty-states:** added iconPosition and textAlign props ([cbc0c70](https://github.com/Synerise/synerise-design/commit/cbc0c70bc0e7cd4843c10acb4265ae43ec6a1368))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.2.63](https://github.com/Synerise/synerise-design/compare/@synerise/ds-empty-states@0.2.62...@synerise/ds-empty-states@0.2.63) (2024-11-12)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-empty-states
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { EmptyStatesProps } from './EmptyStates.types';
3
- declare const EmptyStates: ({ size, label, labelPosition, text, button, fontSize, customIcon, className, mode, }: EmptyStatesProps) => React.JSX.Element;
3
+ declare const EmptyStates: ({ size, label, text, button, fontSize, customIcon, className, mode, iconPosition, textAlign, }: EmptyStatesProps) => React.JSX.Element;
4
4
  export default EmptyStates;
@@ -10,32 +10,34 @@ var EmptyStates = function EmptyStates(_ref) {
10
10
  var _ref$size = _ref.size,
11
11
  size = _ref$size === void 0 ? EmptyStatesSize.SMALL : _ref$size,
12
12
  label = _ref.label,
13
- _ref$labelPosition = _ref.labelPosition,
14
- labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
15
13
  text = _ref.text,
16
14
  button = _ref.button,
17
15
  fontSize = _ref.fontSize,
18
16
  customIcon = _ref.customIcon,
19
17
  className = _ref.className,
20
- mode = _ref.mode;
18
+ mode = _ref.mode,
19
+ _ref$iconPosition = _ref.iconPosition,
20
+ iconPosition = _ref$iconPosition === void 0 ? 'top' : _ref$iconPosition,
21
+ _ref$textAlign = _ref.textAlign,
22
+ textAlign = _ref$textAlign === void 0 ? 'center' : _ref$textAlign;
21
23
  return /*#__PURE__*/React.createElement(S.EmptyStatesWrapper, {
24
+ iconPosition: iconPosition,
22
25
  mode: mode,
23
- className: "ds-empty-states " + className,
24
- labelPosition: labelPosition
25
- }, customIcon && /*#__PURE__*/React.createElement(S.EmptyStatesIconContainer, {
26
- size: size
27
- }, /*#__PURE__*/React.createElement(S.StatusIconContainer, null, /*#__PURE__*/React.createElement(Icon, {
26
+ className: "ds-empty-states " + className
27
+ }, customIcon && /*#__PURE__*/React.createElement(S.EmptyStatesIconContainer, null, /*#__PURE__*/React.createElement(Icon, {
28
28
  "data-testid": "empty-states-custom-icon",
29
29
  component: customIcon,
30
30
  size: mapSizeToPx[size]
31
- }))), text && /*#__PURE__*/React.createElement(S.HeaderWrapper, {
31
+ })), /*#__PURE__*/React.createElement(S.EmptyStatesContent, {
32
+ textAlign: textAlign
33
+ }, text && /*#__PURE__*/React.createElement(S.HeaderWrapper, {
34
+ hasIcon: Boolean(customIcon),
32
35
  "data-testid": "empty-states-header",
33
36
  size: size,
34
37
  fontSize: fontSize
35
38
  }, text), label && /*#__PURE__*/React.createElement(S.TextWrapper, {
36
- "data-testid": "empty-states-label",
37
- labelPosition: labelPosition
38
- }, label), button && /*#__PURE__*/React.createElement(S.ButtonWrapper, null, button));
39
+ "data-testid": "empty-states-label"
40
+ }, label), button && /*#__PURE__*/React.createElement(S.ButtonWrapper, null, button)));
39
41
  };
40
42
 
41
43
  export default EmptyStates;
@@ -1,17 +1,16 @@
1
1
  import { EmptyStatesSize } from './EmptyStates.types';
2
- export declare const TextWrapper: import("styled-components").StyledComponent<"div", any, {
3
- labelPosition: 'bottom' | 'right';
4
- }, never>;
2
+ export declare const EmptyStatesIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const TextWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
4
  export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {
6
5
  fontSize?: EmptyStatesSize | undefined;
7
6
  size?: EmptyStatesSize | undefined;
7
+ hasIcon?: boolean | undefined;
8
8
  }, never>;
9
9
  export declare const ButtonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
10
10
  export declare const EmptyStatesWrapper: import("styled-components").StyledComponent<"div", any, {
11
- labelPosition: 'bottom' | 'right';
11
+ iconPosition: 'top' | 'left' | 'right';
12
12
  mode?: "absolute" | undefined;
13
13
  }, never>;
14
- export declare const EmptyStatesIconContainer: import("styled-components").StyledComponent<"div", any, {
15
- size?: EmptyStatesSize | undefined;
14
+ export declare const EmptyStatesContent: import("styled-components").StyledComponent<"div", any, {
15
+ textAlign: 'left' | 'right' | 'center' | 'justify';
16
16
  }, never>;
17
- export declare const StatusIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,20 +1,36 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { EmptyStatesSize, FontSize } from './EmptyStates.types';
3
3
  var FONT_SIZE_DEFAULT = 14;
4
- var mapElementsPosition = {
5
- right: 'row',
6
- bottom: 'column'
4
+
5
+ var getFlexStyle = function getFlexStyle(iconPosition) {
6
+ return iconPosition === 'top' ? css(["flex-direction:", ";align-items:center;"], mapIconPosition[iconPosition]) : css(["flex-direction:", ";gap:16px;align-items:flex-start;"], mapIconPosition[iconPosition]);
7
7
  };
8
+
9
+ var mapIconPosition = {
10
+ right: 'row-reverse',
11
+ top: 'column',
12
+ left: 'row'
13
+ };
14
+ var mapTextAlign = {
15
+ right: 'flex-end',
16
+ left: 'flex-start',
17
+ center: 'center',
18
+ justify: 'center'
19
+ };
20
+ export var EmptyStatesIconContainer = styled.div.withConfig({
21
+ displayName: "EmptyStatesstyles__EmptyStatesIconContainer",
22
+ componentId: "sc-7sb4gr-0"
23
+ })([""]);
8
24
  export var TextWrapper = styled.div.withConfig({
9
25
  displayName: "EmptyStatesstyles__TextWrapper",
10
- componentId: "sc-7sb4gr-0"
11
- })(["display:flex;line-height:16px;max-width:440px;word-wrap:break-word;justify-content:", ";text-align:center;padding-bottom:8px;"], function (props) {
12
- return props.labelPosition === 'bottom' ? 'center' : 'flex-start';
13
- });
26
+ componentId: "sc-7sb4gr-1"
27
+ })(["display:flex;line-height:16px;max-width:440px;word-wrap:break-word;padding-bottom:8px;"]);
14
28
  export var HeaderWrapper = styled.div.withConfig({
15
29
  displayName: "EmptyStatesstyles__HeaderWrapper",
16
- componentId: "sc-7sb4gr-1"
17
- })(["display:flex;line-height:16px;color:", ";font-size:", "px;font-weight:500;padding-bottom:", ";"], function (props) {
30
+ componentId: "sc-7sb4gr-2"
31
+ })(["display:flex;line-height:16px;margin-top:", ";color:", ";font-size:", "px;font-weight:500;padding-bottom:", ";"], function (props) {
32
+ return props.hasIcon && props.size === EmptyStatesSize.SMALL ? '12px' : '';
33
+ }, function (props) {
18
34
  return props.theme.palette['grey-800'];
19
35
  }, function (props) {
20
36
  return FontSize[props.fontSize] || FONT_SIZE_DEFAULT;
@@ -23,23 +39,21 @@ export var HeaderWrapper = styled.div.withConfig({
23
39
  });
24
40
  export var ButtonWrapper = styled.div.withConfig({
25
41
  displayName: "EmptyStatesstyles__ButtonWrapper",
26
- componentId: "sc-7sb4gr-2"
42
+ componentId: "sc-7sb4gr-3"
27
43
  })(["padding-top:12px;display:flex;"]);
28
44
  export var EmptyStatesWrapper = styled.div.withConfig({
29
45
  displayName: "EmptyStatesstyles__EmptyStatesWrapper",
30
- componentId: "sc-7sb4gr-3"
31
- })(["display:flex;flex-direction:", ";align-items:center;justify-content:center;", ";"], function (props) {
32
- return mapElementsPosition[props.labelPosition];
46
+ componentId: "sc-7sb4gr-4"
47
+ })(["display:flex;", " ", ";"], function (props) {
48
+ return getFlexStyle(props.iconPosition);
33
49
  }, function (props) {
34
50
  return props.mode === 'absolute' && css(["position:absolute;top:50%;left:50%;"]);
35
51
  });
36
- export var EmptyStatesIconContainer = styled.div.withConfig({
37
- displayName: "EmptyStatesstyles__EmptyStatesIconContainer",
38
- componentId: "sc-7sb4gr-4"
39
- })(["margin-bottom:", ";"], function (props) {
40
- return props.size === EmptyStatesSize.SMALL ? '8px' : '40px';
41
- });
42
- export var StatusIconContainer = styled.div.withConfig({
43
- displayName: "EmptyStatesstyles__StatusIconContainer",
52
+ export var EmptyStatesContent = styled.div.withConfig({
53
+ displayName: "EmptyStatesstyles__EmptyStatesContent",
44
54
  componentId: "sc-7sb4gr-5"
45
- })(["width:40px;height:40px;border-radius:20px;text-align:center;display:flex;align-items:center;justify-content:center;margin:0 auto;"]);
55
+ })(["display:flex;flex-direction:column;text-align:", ";> *{justify-content:", ";}"], function (props) {
56
+ return props.textAlign;
57
+ }, function (props) {
58
+ return mapTextAlign[props.textAlign];
59
+ });
@@ -5,10 +5,15 @@ export type EmptyStatesProps = {
5
5
  text?: ReactNode;
6
6
  button?: ReactNode;
7
7
  label?: ReactNode;
8
+ /**
9
+ * @deprecated
10
+ */
8
11
  labelPosition?: 'bottom' | 'right';
9
12
  mode?: 'absolute';
10
13
  customIcon?: ReactElement;
11
14
  className?: string;
15
+ iconPosition?: 'top' | 'left' | 'right';
16
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
12
17
  };
13
18
  export declare enum EmptyStatesSize {
14
19
  SMALL = "small",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-empty-states",
3
- "version": "0.2.63",
3
+ "version": "0.3.1",
4
4
  "description": "EmptyStates UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,13 +34,13 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-icon": "^0.66.4",
38
- "@synerise/ds-utils": "^0.31.1"
37
+ "@synerise/ds-icon": "^0.67.0",
38
+ "@synerise/ds-utils": "^0.31.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@synerise/ds-core": "*",
42
42
  "react": ">=16.9.0 <= 17.0.2",
43
43
  "styled-components": "5.0.1"
44
44
  },
45
- "gitHead": "8d26191fc0475407e0691b9b183761ad3cd7c87d"
45
+ "gitHead": "05f083c767e2cec3c2f91c9475aee89852a77d6c"
46
46
  }