@synerise/ds-logic 0.9.2 → 0.9.3
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 +8 -0
- package/dist/Logic.js +4 -8
- package/dist/Logic.style.js +4 -3
- package/dist/Matching/Matching.js +7 -18
- package/dist/Matching/Matching.styles.js +6 -15
- package/dist/Placeholder/Placeholder.js +0 -2
- package/dist/Placeholder/Placeholder.styles.js +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.9.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-logic@0.9.2...@synerise/ds-logic@0.9.3) (2024-11-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-logic
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.9.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-logic@0.9.1...@synerise/ds-logic@0.9.2) (2024-11-21)
|
|
7
15
|
|
|
8
16
|
|
package/dist/Logic.js
CHANGED
|
@@ -4,19 +4,17 @@ import { Title } from '@synerise/ds-typography';
|
|
|
4
4
|
import * as S from './Logic.style';
|
|
5
5
|
import Matching from './Matching/Matching';
|
|
6
6
|
var DEFAULT_OPTIONS = ['AND', 'OR'];
|
|
7
|
-
|
|
8
7
|
var Logic = function Logic(_ref) {
|
|
9
8
|
var value = _ref.value,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
options = _ref.options,
|
|
10
|
+
onChange = _ref.onChange,
|
|
11
|
+
_ref$readOnly = _ref.readOnly,
|
|
12
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
14
13
|
var intl = useIntl();
|
|
15
14
|
var operators = React.useMemo(function () {
|
|
16
15
|
if (options !== undefined && options.length) {
|
|
17
16
|
return options;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
return DEFAULT_OPTIONS.map(function (option) {
|
|
21
19
|
return {
|
|
22
20
|
value: option,
|
|
@@ -35,7 +33,6 @@ var Logic = function Logic(_ref) {
|
|
|
35
33
|
}, [onChange, operators, value]);
|
|
36
34
|
var renderValue = React.useMemo(function () {
|
|
37
35
|
var _operators$find;
|
|
38
|
-
|
|
39
36
|
return (_operators$find = operators.find(function (option) {
|
|
40
37
|
return option.value === value;
|
|
41
38
|
})) == null ? void 0 : _operators$find.label;
|
|
@@ -49,6 +46,5 @@ var Logic = function Logic(_ref) {
|
|
|
49
46
|
level: 4
|
|
50
47
|
}, renderValue));
|
|
51
48
|
};
|
|
52
|
-
|
|
53
49
|
Logic.Matching = Matching;
|
|
54
50
|
export default Logic;
|
package/dist/Logic.style.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
3
4
|
export var Logic = styled.div.withConfig({
|
|
4
5
|
displayName: "Logicstyle__Logic",
|
|
5
6
|
componentId: "yp0pif-0"
|
|
6
7
|
})(["user-select:none;position:relative;.ds-title{cursor:pointer;", "}", ""], function (_ref) {
|
|
7
8
|
var readOnly = _ref.readOnly,
|
|
8
|
-
|
|
9
|
+
theme = _ref.theme;
|
|
9
10
|
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
11
|
}, function (_ref2) {
|
|
11
12
|
var readOnly = _ref2.readOnly,
|
|
12
|
-
|
|
13
|
+
theme = _ref2.theme;
|
|
13
14
|
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 }" : '';
|
|
14
15
|
});
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
var _excluded = ["matching", "sentence", "onChange", "texts", "readOnly"];
|
|
2
|
-
|
|
3
2
|
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
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
7
4
|
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; }
|
|
8
|
-
|
|
9
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
10
|
-
|
|
11
6
|
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); }
|
|
12
|
-
|
|
13
7
|
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; }
|
|
14
|
-
|
|
15
8
|
import React from 'react';
|
|
16
9
|
import { useIntl } from 'react-intl';
|
|
17
10
|
import * as S from './Matching.styles';
|
|
18
11
|
var MATCHING_TOGGLE = '#MATCHING_TOGGLE#';
|
|
19
|
-
|
|
20
12
|
var Matching = function Matching(_ref) {
|
|
21
13
|
var _ref$matching = _ref.matching,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
matching = _ref$matching === void 0 ? true : _ref$matching,
|
|
15
|
+
sentence = _ref.sentence,
|
|
16
|
+
onChange = _ref.onChange,
|
|
17
|
+
texts = _ref.texts,
|
|
18
|
+
_ref$readOnly = _ref.readOnly,
|
|
19
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
20
|
+
htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
30
21
|
var intl = useIntl();
|
|
31
22
|
var text = React.useMemo(function () {
|
|
32
23
|
return _objectSpread({
|
|
@@ -57,10 +48,8 @@ var Matching = function Matching(_ref) {
|
|
|
57
48
|
var endOfToggle = startOfToggle + MATCHING_TOGGLE.length;
|
|
58
49
|
return [sentence.substring(0, startOfToggle), getToggle, sentence.substring(endOfToggle, sentence.length)];
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
return getToggle;
|
|
62
52
|
}, [getToggle, sentence]);
|
|
63
53
|
return /*#__PURE__*/React.createElement(S.MatchingWrapper, htmlAttributes, getLabelWithToggle);
|
|
64
54
|
};
|
|
65
|
-
|
|
66
55
|
export default Matching;
|
|
@@ -1,30 +1,21 @@
|
|
|
1
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
|
-
|
|
3
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; }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
-
|
|
9
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); }
|
|
10
|
-
|
|
11
6
|
import styled, { css } from 'styled-components';
|
|
12
|
-
|
|
13
7
|
var getColor = function getColor(_ref) {
|
|
14
8
|
var theme = _ref.theme,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
matching = _ref.matching,
|
|
10
|
+
readOnly = _ref.readOnly,
|
|
11
|
+
_ref$hovered = _ref.hovered,
|
|
12
|
+
hovered = _ref$hovered === void 0 ? false : _ref$hovered;
|
|
20
13
|
if (readOnly) {
|
|
21
14
|
return theme.palette["grey-800"];
|
|
22
15
|
}
|
|
23
|
-
|
|
24
16
|
var hue = hovered ? '700' : '600';
|
|
25
17
|
return theme.palette[matching ? "green-" + hue : "red-" + hue];
|
|
26
18
|
};
|
|
27
|
-
|
|
28
19
|
export var MatchingWrapper = styled.div.withConfig({
|
|
29
20
|
displayName: "Matchingstyles__MatchingWrapper",
|
|
30
21
|
componentId: "sc-7z57qz-0"
|
|
@@ -37,13 +28,13 @@ export var Toggle = styled.span.withConfig({
|
|
|
37
28
|
})(["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;", " ", ""], getColor, function (props) {
|
|
38
29
|
var color = getColor(props);
|
|
39
30
|
var readOnly = props.readOnly,
|
|
40
|
-
|
|
31
|
+
theme = props.theme;
|
|
41
32
|
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 " + color + " 25%,\n " + theme.palette.white + " 0%\n );\n background-position: top;\n background-size: 4px 1px;\n background-repeat: repeat-x;\n}";
|
|
42
33
|
}, function (props) {
|
|
43
34
|
var hoveredColor = getColor(_objectSpread({}, props, {
|
|
44
35
|
hovered: true
|
|
45
36
|
}));
|
|
46
37
|
var readOnly = props.readOnly,
|
|
47
|
-
|
|
38
|
+
theme = props.theme;
|
|
48
39
|
return !readOnly && css(["&:hover{color:", ";&:after{background-image:linear-gradient( to right,", " 25%,", " 0% );}"], hoveredColor, hoveredColor, theme.palette.white);
|
|
49
40
|
});
|
|
@@ -3,7 +3,6 @@ import Icon, { ClickM } from '@synerise/ds-icon';
|
|
|
3
3
|
import { Text } from '@synerise/ds-typography';
|
|
4
4
|
import { theme } from '@synerise/ds-core';
|
|
5
5
|
import * as S from './Placeholder.styles';
|
|
6
|
-
|
|
7
6
|
var Placeholder = function Placeholder(_ref) {
|
|
8
7
|
var text = _ref.text;
|
|
9
8
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.PlaceholderContainer, null, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -14,5 +13,4 @@ var Placeholder = function Placeholder(_ref) {
|
|
|
14
13
|
size: "medium"
|
|
15
14
|
}, text)));
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
export default Placeholder;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
3
4
|
export var PlaceholderContainer = styled.div.withConfig({
|
|
4
5
|
displayName: "Placeholderstyles__PlaceholderContainer",
|
|
5
6
|
componentId: "sc-1dp40dc-0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-logic",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Logic UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-icon": "^0.67.
|
|
38
|
-
"@synerise/ds-typography": "^0.16.
|
|
37
|
+
"@synerise/ds-icon": "^0.67.1",
|
|
38
|
+
"@synerise/ds-typography": "^0.16.7",
|
|
39
39
|
"@synerise/ds-utils": "^0.31.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
45
45
|
"styled-components": "5.0.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4a56ee7ef816c22341ce704154dc7aa65b7d1dcc"
|
|
48
48
|
}
|