@synerise/ds-action-area 0.3.25 → 0.4.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 CHANGED
@@ -3,6 +3,17 @@
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.4.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-action-area@0.3.25...@synerise/ds-action-area@0.4.0) (2024-05-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * **action-area:** add validation state ([a358aba](https://github.com/Synerise/synerise-design/commit/a358abac7ecef64afd9579734eeb8f4cd8677304))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.3.25](https://github.com/Synerise/synerise-design/compare/@synerise/ds-action-area@0.3.24...@synerise/ds-action-area@0.3.25) (2024-05-16)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-action-area
package/README.md CHANGED
@@ -33,4 +33,9 @@ import ActionArea from '@synerise/ds-action-area'
33
33
  | description | Description of ActionArea | `React.ReactNode` | - |
34
34
  | label | Label of ActionArea | `React.ReactNode` | - |
35
35
  | buttonProps | optional additional button props | see ds-button | - |
36
+ | isFullWidth | Set component width to 100% available space | `boolean` | false |
37
+ | isError | Set component state to invalid | `boolean` | false |
38
+ | errorText | Text to display when is invalid state | `React.ReactNode` | - |
39
+ | className | custom class name | `string` | - |
40
+ | style | custom CSS style | `React.CSSProperties` | - |
36
41
 
@@ -1,3 +1,13 @@
1
- import { ActionAreaProps } from './ActionArea.types';
2
- declare const ActionArea: ({ label, description, action, actionLabel, buttonProps }: ActionAreaProps) => JSX.Element;
1
+ import React from 'react';
2
+ import type { ActionAreaProps } from './ActionArea.types';
3
+ declare const ActionArea: {
4
+ ({ label, description, action, actionLabel, buttonProps, isFullWidth, isError, errorText, className, style, }: ActionAreaProps): React.JSX.Element;
5
+ ActionAreaWrapper: import("styled-components").StyledComponent<"div", any, {
6
+ isFullWidth?: boolean | undefined;
7
+ }, never>;
8
+ ActionAreaContent: import("styled-components").StyledComponent<"div", any, {
9
+ isError?: boolean | undefined;
10
+ }, never>;
11
+ ErrorText: import("styled-components").StyledComponent<"div", any, {}, never>;
12
+ };
3
13
  export default ActionArea;
@@ -1,6 +1,7 @@
1
1
  function _extends() { _extends = Object.assign || 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
2
 
3
- import * as React from 'react';
3
+ import React from 'react';
4
+ import classnames from 'classnames';
4
5
  import Button from '@synerise/ds-button';
5
6
  import { Title, Description } from '@synerise/ds-typography';
6
7
  import * as S from './ActionArea.styles';
@@ -10,15 +11,31 @@ var ActionArea = function ActionArea(_ref) {
10
11
  description = _ref.description,
11
12
  action = _ref.action,
12
13
  actionLabel = _ref.actionLabel,
13
- buttonProps = _ref.buttonProps;
14
+ buttonProps = _ref.buttonProps,
15
+ _ref$isFullWidth = _ref.isFullWidth,
16
+ isFullWidth = _ref$isFullWidth === void 0 ? false : _ref$isFullWidth,
17
+ _ref$isError = _ref.isError,
18
+ isError = _ref$isError === void 0 ? false : _ref$isError,
19
+ errorText = _ref.errorText,
20
+ className = _ref.className,
21
+ style = _ref.style;
22
+ var isErrorText = isError && Boolean(errorText);
14
23
  return /*#__PURE__*/React.createElement(S.ActionAreaWrapper, {
15
- className: "ds-action-area"
24
+ style: style,
25
+ className: classnames('ds-action-area', className),
26
+ isFullWidth: isFullWidth
27
+ }, /*#__PURE__*/React.createElement(S.ActionAreaContent, {
28
+ isError: isError,
29
+ "data-testid": "action-area-content"
16
30
  }, label && /*#__PURE__*/React.createElement(Title, {
17
31
  level: 6
18
32
  }, label), /*#__PURE__*/React.createElement(Description, null, description), /*#__PURE__*/React.createElement(Button, _extends({
19
33
  type: "primary",
20
34
  onClick: action
21
- }, buttonProps), actionLabel));
35
+ }, buttonProps), actionLabel)), isErrorText && /*#__PURE__*/React.createElement(S.ErrorText, null, errorText));
22
36
  };
23
37
 
38
+ ActionArea.ActionAreaWrapper = S.ActionAreaWrapper;
39
+ ActionArea.ActionAreaContent = S.ActionAreaContent;
40
+ ActionArea.ErrorText = S.ErrorText;
24
41
  export default ActionArea;
@@ -1 +1,7 @@
1
- export declare const ActionAreaWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const ActionAreaWrapper: import("styled-components").StyledComponent<"div", any, {
2
+ isFullWidth?: boolean | undefined;
3
+ }, never>;
4
+ export declare const ActionAreaContent: import("styled-components").StyledComponent<"div", any, {
5
+ isError?: boolean | undefined;
6
+ }, never>;
7
+ export declare const ErrorText: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,9 +1,27 @@
1
1
  import styled from 'styled-components';
2
- import { Description } from '@synerise/ds-typography'; // eslint-disable-next-line import/prefer-default-export
3
-
2
+ import { Description } from '@synerise/ds-typography';
4
3
  export var ActionAreaWrapper = styled.div.withConfig({
5
4
  displayName: "ActionAreastyles__ActionAreaWrapper",
6
5
  componentId: "sc-10ey0kr-0"
7
- })(["max-width:100%;width:588px;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:28px 24px;border-radius:3px;border:1px dashed ", ";.ds-title{margin-bottom:8px;text-align:center;word-break:break-word;}", "{margin-bottom:16px;text-align:center;word-break:break-word;}"], function (props) {
8
- return props.theme.palette['grey-300'];
9
- }, Description);
6
+ })(["max-width:100%;width:", ";"], function (_ref) {
7
+ var isFullWidth = _ref.isFullWidth;
8
+ return isFullWidth ? '100%;' : '588px;';
9
+ });
10
+ export var ActionAreaContent = styled.div.withConfig({
11
+ displayName: "ActionAreastyles__ActionAreaContent",
12
+ componentId: "sc-10ey0kr-1"
13
+ })(["width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:28px 24px;border-radius:3px;border:1px dashed ", ";", " .ds-title{margin-bottom:8px;text-align:center;word-break:break-word;}", "{margin-bottom:16px;text-align:center;word-break:break-word;}"], function (_ref2) {
14
+ var theme = _ref2.theme;
15
+ return theme.palette['grey-300'];
16
+ }, function (_ref3) {
17
+ var isError = _ref3.isError,
18
+ theme = _ref3.theme;
19
+ return isError && "border-color: " + theme.palette['red-600'] + ";";
20
+ }, Description);
21
+ export var ErrorText = styled.div.withConfig({
22
+ displayName: "ActionAreastyles__ErrorText",
23
+ componentId: "sc-10ey0kr-2"
24
+ })(["margin-top:8px;color:", ";"], function (_ref4) {
25
+ var theme = _ref4.theme;
26
+ return theme.palette['red-600'];
27
+ });
@@ -1,9 +1,14 @@
1
- import { ReactNode } from 'react';
1
+ import { CSSProperties, ReactNode } from 'react';
2
2
  import { ButtonProps } from '@synerise/ds-button';
3
3
  export type ActionAreaProps = {
4
- label?: ReactNode;
5
- description: ReactNode;
6
4
  action: () => void;
7
5
  actionLabel: ReactNode;
8
6
  buttonProps?: Partial<ButtonProps>;
7
+ className?: string;
8
+ description: ReactNode;
9
+ errorText?: ReactNode;
10
+ isError?: boolean;
11
+ isFullWidth?: boolean;
12
+ label?: ReactNode;
13
+ style?: CSSProperties;
9
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-action-area",
3
- "version": "0.3.25",
3
+ "version": "0.4.0",
4
4
  "description": "ActionArea UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,8 +33,9 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-button": "^0.20.0",
37
- "@synerise/ds-typography": "^0.15.0"
36
+ "@synerise/ds-button": "^0.20.1",
37
+ "@synerise/ds-typography": "^0.15.0",
38
+ "classnames": "2.3.2"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@synerise/ds-core": "*",
@@ -42,9 +43,9 @@
42
43
  "styled-components": "5.0.1"
43
44
  },
44
45
  "devDependencies": {
45
- "@synerise/ds-utils": "^0.26.6",
46
+ "@synerise/ds-utils": "^0.27.0",
46
47
  "@testing-library/jest-dom": "5.1.1",
47
48
  "@testing-library/react": "10.0.1"
48
49
  },
49
- "gitHead": "fc089bbf34c691a313b3fa648851d7831a23e3d0"
50
+ "gitHead": "6bd94c78745df68ee3b853120a863ab24fc233ef"
50
51
  }