@synerise/ds-logic 0.7.8 → 0.8.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,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.8.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-logic@0.7.9...@synerise/ds-logic@0.8.0) (2022-12-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * **filter:** readOnly state for conditions ([dfa4db3](https://github.com/Synerise/synerise-design/commit/dfa4db35826c0800859b7217dd1ea2f1497ac3c9))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.7.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-logic@0.7.8...@synerise/ds-logic@0.7.9) (2022-12-07)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-logic
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.7.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-logic@0.7.7...@synerise/ds-logic@0.7.8) (2022-08-31)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-logic
package/dist/Logic.js CHANGED
@@ -8,7 +8,9 @@ var DEFAULT_OPTIONS = ['AND', 'OR'];
8
8
  var Logic = function Logic(_ref) {
9
9
  var value = _ref.value,
10
10
  options = _ref.options,
11
- onChange = _ref.onChange;
11
+ onChange = _ref.onChange,
12
+ _ref$readOnly = _ref.readOnly,
13
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
12
14
  var intl = useIntl();
13
15
  var operators = React.useMemo(function () {
14
16
  if (options !== undefined && options.length) {
@@ -40,7 +42,8 @@ var Logic = function Logic(_ref) {
40
42
  }, [operators, value]);
41
43
  return /*#__PURE__*/React.createElement(S.Logic, {
42
44
  className: "ds-logic",
43
- onClick: handleNextLogic
45
+ onClick: !readOnly ? handleNextLogic : undefined,
46
+ readOnly: readOnly
44
47
  }, /*#__PURE__*/React.createElement(Title, {
45
48
  withoutMargin: true,
46
49
  level: 4
@@ -1 +1,3 @@
1
- export declare const Logic: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const Logic: import("styled-components").StyledComponent<"div", any, {
2
+ readOnly?: boolean | undefined;
3
+ }, never>;
@@ -3,14 +3,12 @@ import styled from 'styled-components'; // eslint-disable-next-line import/prefe
3
3
  export var Logic = styled.div.withConfig({
4
4
  displayName: "Logicstyle__Logic",
5
5
  componentId: "yp0pif-0"
6
- })(["user-select:none;position:relative;.ds-title{cursor:pointer;&:after{position:absolute;bottom:-2px;width:100%;content:'';height:1px;left:1px;background-image:linear-gradient( to right,", " 25%,", " 0% );background-position:top;background-size:4px 1px;background-repeat:repeat-x;}}&:hover{.ds-title{color:", ";&:after{background-image:linear-gradient( to right,", " 25%,", " 0% );}}}"], function (props) {
7
- return props.theme.palette['grey-600'];
8
- }, function (props) {
9
- return props.theme.palette.white;
10
- }, function (props) {
11
- return props.theme.palette['blue-700'];
12
- }, function (props) {
13
- return props.theme.palette['blue-700'];
14
- }, function (props) {
15
- return props.theme.palette.white;
6
+ })(["user-select:none;position:relative;.ds-title{cursor:pointer;", "}", ""], function (_ref) {
7
+ var readOnly = _ref.readOnly,
8
+ theme = _ref.theme;
9
+ return !readOnly ? "&:after {\n position: absolute;\n bottom: -2px;\n width: 100%;\n content: '';\n height: 1px;\n left: 1px;\n background-image: linear-gradient(\n to right,\n " + theme.palette['grey-600'] + " 25%,\n " + theme.palette.white + " 0%\n );\n background-position: top;\n background-size: 4px 1px;\n background-repeat: repeat-x;\n }" : '';
10
+ }, function (_ref2) {
11
+ var readOnly = _ref2.readOnly,
12
+ theme = _ref2.theme;
13
+ return !readOnly ? " &:hover {\n .ds-title {\n color: " + theme.palette['blue-700'] + ";\n &:after {\n background-image: linear-gradient(\n to right,\n " + theme.palette['blue-700'] + " 25%,\n " + theme.palette.white + " 0%\n );\n }\n }\n }" : '';
16
14
  });
@@ -9,6 +9,7 @@ export declare type LogicProps = {
9
9
  value: LogicOperatorValue;
10
10
  options?: LogicOperator[];
11
11
  onChange: (value: LogicOperatorValue) => void;
12
+ readOnly?: boolean;
12
13
  };
13
14
  export declare type LogicSubComponents = {
14
15
  Matching: typeof Matching;
@@ -14,7 +14,9 @@ var Matching = function Matching(_ref) {
14
14
  matching = _ref$matching === void 0 ? true : _ref$matching,
15
15
  sentence = _ref.sentence,
16
16
  onChange = _ref.onChange,
17
- texts = _ref.texts;
17
+ texts = _ref.texts,
18
+ _ref$readOnly = _ref.readOnly,
19
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
18
20
  var intl = useIntl();
19
21
  var text = React.useMemo(function () {
20
22
  return _objectSpread({
@@ -33,11 +35,12 @@ var Matching = function Matching(_ref) {
33
35
  }, [onChange, matching]);
34
36
  var getToggle = React.useMemo(function () {
35
37
  return /*#__PURE__*/React.createElement(S.Toggle, {
36
- onClick: handleClick,
38
+ onClick: !readOnly ? handleClick : undefined,
37
39
  matching: matching,
38
- className: "ds-matching-toggle"
40
+ className: "ds-matching-toggle",
41
+ readOnly: readOnly
39
42
  }, matching ? text.matching : text.notMatching);
40
- }, [handleClick, matching, text]);
43
+ }, [handleClick, matching, text, readOnly]);
41
44
  var getLabelWithToggle = React.useMemo(function () {
42
45
  if (sentence) {
43
46
  var startOfToggle = sentence == null ? void 0 : sentence.search(MATCHING_TOGGLE);
@@ -1,4 +1,5 @@
1
1
  export declare const MatchingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const Toggle: import("styled-components").StyledComponent<"span", any, {
3
3
  matching: boolean;
4
+ readOnly?: boolean | undefined;
4
5
  }, never>;
@@ -8,16 +8,16 @@ export var MatchingWrapper = styled.div.withConfig({
8
8
  export var Toggle = styled.span.withConfig({
9
9
  displayName: "Matchingstyles__Toggle",
10
10
  componentId: "sc-7z57qz-1"
11
- })(["cursor:pointer;font-size:16px;font-weight:500;line-height:1.25;color:", ";transition:color 0.1s ease-in-out;position:relative;display:inline-flex;&:after{position:absolute;bottom:-2px;width:100%;content:'';height:1px;left:1px;background-image:linear-gradient( to right,", " 25%,", " 0% );background-position:top;background-size:4px 1px;background-repeat:repeat-x;}&:hover{color:", ";&:after{background-image:linear-gradient( to right,", " 25%,", " 0% );}}"], function (props) {
12
- return props.theme.palette["blue-600"];
13
- }, function (props) {
14
- return props.theme.palette['blue-600'];
15
- }, function (props) {
16
- return props.theme.palette.white;
17
- }, function (props) {
18
- return props.theme.palette["blue-700"];
19
- }, function (props) {
20
- return props.theme.palette['blue-700'];
21
- }, function (props) {
22
- return props.theme.palette.white;
11
+ })(["cursor:pointer;font-size:16px;font-weight:500;line-height:1.25;color:", ";transition:color 0.1s ease-in-out;position:relative;display:inline-flex;", " ", ""], function (_ref) {
12
+ var readOnly = _ref.readOnly,
13
+ theme = _ref.theme;
14
+ return theme.palette[readOnly ? "grey-800" : "blue-600"];
15
+ }, function (_ref2) {
16
+ var readOnly = _ref2.readOnly,
17
+ theme = _ref2.theme;
18
+ return !readOnly ? "\n &:after {\n position: absolute;\n bottom: -2px;\n width: 100%;\n content: '';\n height: 1px;\n left: 1px;\n background-image: linear-gradient(\n to right,\n " + theme.palette['blue-600'] + " 25%,\n " + theme.palette.white + " 0%\n );\n background-position: top;\n background-size: 4px 1px;\n background-repeat: repeat-x;\n }" : '';
19
+ }, function (_ref3) {
20
+ var readOnly = _ref3.readOnly,
21
+ theme = _ref3.theme;
22
+ return !readOnly ? " &:hover {\n color: " + theme.palette["blue-700"] + ";\n &:after {\n background-image: linear-gradient(\n to right,\n " + theme.palette['blue-700'] + " 25%,\n " + theme.palette.white + " 0%\n );\n }\n }" : '';
23
23
  });
@@ -7,4 +7,5 @@ export declare type MatchingProps = {
7
7
  sentence?: string;
8
8
  onChange: (matching: boolean) => void;
9
9
  texts?: MatchingTexts;
10
+ readOnly?: boolean;
10
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-logic",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
4
4
  "description": "Logic UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-icon": "^0.51.0",
35
+ "@synerise/ds-icon": "^0.52.0",
36
36
  "@synerise/ds-typography": "^0.12.7",
37
37
  "@synerise/ds-utils": "^0.19.0"
38
38
  },
@@ -40,5 +40,5 @@
40
40
  "@synerise/ds-core": "*",
41
41
  "react": ">=16.9.0 < 17.0.0"
42
42
  },
43
- "gitHead": "ef480757296035e4ba2928cd169a98458477b8d1"
43
+ "gitHead": "1ab09990244dd615bdfe696f365ae8075bd31762"
44
44
  }