@synerise/ds-operators 0.9.28 → 0.10.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.10.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-operators@0.9.29...@synerise/ds-operators@0.10.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.9.29](https://github.com/Synerise/synerise-design/compare/@synerise/ds-operators@0.9.28...@synerise/ds-operators@0.9.29) (2022-12-07)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-operators
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.9.28](https://github.com/Synerise/synerise-design/compare/@synerise/ds-operators@0.9.27...@synerise/ds-operators@0.9.28) (2022-11-30)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-operators
@@ -34,6 +34,7 @@ export declare type OperatorsProps = {
34
34
  texts?: Partial<OperatorTexts>;
35
35
  opened?: boolean;
36
36
  getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
37
+ readOnly?: boolean;
37
38
  };
38
39
  export declare type OperatorsDropdownProps = {
39
40
  setDropdownVisible: (show: boolean) => void;
package/dist/Operators.js CHANGED
@@ -23,7 +23,9 @@ var Operators = function Operators(_ref) {
23
23
  opened = _ref.opened,
24
24
  getPopupContainerOverride = _ref.getPopupContainerOverride,
25
25
  onActivate = _ref.onActivate,
26
- onDeactivate = _ref.onDeactivate;
26
+ onDeactivate = _ref.onDeactivate,
27
+ _ref$readOnly = _ref.readOnly,
28
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
27
29
 
28
30
  var _useIntl = useIntl(),
29
31
  formatMessage = _useIntl.formatMessage;
@@ -66,9 +68,27 @@ var Operators = function Operators(_ref) {
66
68
  newValue && onActivate && onActivate();
67
69
  !newValue && onDeactivate && onDeactivate();
68
70
  }, [onActivate, onDeactivate]);
69
- return /*#__PURE__*/React.createElement("div", {
70
- "data-popup-container": true
71
- }, /*#__PURE__*/React.createElement(Dropdown, {
71
+ var triggerMode = React.useMemo(function () {
72
+ if (value) {
73
+ return readOnly ? 'icon-label' : 'two-icons';
74
+ }
75
+
76
+ return readOnly ? 'simple' : 'label-icon';
77
+ }, [value, readOnly]);
78
+ var dropdownTrigger = /*#__PURE__*/React.createElement(Tooltip, {
79
+ getPopupContainer: getPopupContainerOverride || getPopupContainer,
80
+ title: (value == null ? void 0 : value.name) || '',
81
+ trigger: ['hover']
82
+ }, /*#__PURE__*/React.createElement(Button, {
83
+ type: "secondary",
84
+ mode: triggerMode,
85
+ onClick: !readOnly ? handleClick : undefined
86
+ }, value && /*#__PURE__*/React.createElement(Icon, {
87
+ component: value.icon
88
+ }), /*#__PURE__*/React.createElement(S.Value, null, value ? value.name : text.buttonLabel), !readOnly && /*#__PURE__*/React.createElement(Icon, {
89
+ component: /*#__PURE__*/React.createElement(AngleDownS, null)
90
+ })));
91
+ var content = readOnly ? dropdownTrigger : /*#__PURE__*/React.createElement(Dropdown, {
72
92
  visible: dropdownVisible,
73
93
  onVisibleChange: onDropdownVisibilityChange,
74
94
  getPopupContainer: getPopupContainerOverride || getPopupContainer,
@@ -80,19 +100,10 @@ var Operators = function Operators(_ref) {
80
100
  items: items,
81
101
  texts: text
82
102
  })
83
- }, /*#__PURE__*/React.createElement(Tooltip, {
84
- getPopupContainer: getPopupContainerOverride || getPopupContainer,
85
- title: (value == null ? void 0 : value.name) || '',
86
- trigger: ['hover']
87
- }, /*#__PURE__*/React.createElement(Button, {
88
- type: "secondary",
89
- mode: value ? 'two-icons' : 'label-icon',
90
- onClick: handleClick
91
- }, value && /*#__PURE__*/React.createElement(Icon, {
92
- component: value.icon
93
- }), /*#__PURE__*/React.createElement(S.Value, null, value ? value.name : text.buttonLabel), /*#__PURE__*/React.createElement(Icon, {
94
- component: /*#__PURE__*/React.createElement(AngleDownS, null)
95
- })))));
103
+ }, dropdownTrigger);
104
+ return /*#__PURE__*/React.createElement("div", {
105
+ "data-popup-container": true
106
+ }, content);
96
107
  };
97
108
 
98
109
  export default Operators;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-operators",
3
- "version": "0.9.28",
3
+ "version": "0.10.0",
4
4
  "description": "Operators UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,18 +32,18 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-button": "^0.17.9",
36
- "@synerise/ds-dropdown": "^0.17.43",
37
- "@synerise/ds-icon": "^0.51.0",
38
- "@synerise/ds-menu": "^0.17.0",
39
- "@synerise/ds-result": "^0.6.16",
40
- "@synerise/ds-scrollbar": "^0.5.2",
41
- "@synerise/ds-tabs": "^0.13.39",
35
+ "@synerise/ds-button": "^0.17.10",
36
+ "@synerise/ds-dropdown": "^0.17.44",
37
+ "@synerise/ds-icon": "^0.52.0",
38
+ "@synerise/ds-menu": "^0.17.1",
39
+ "@synerise/ds-result": "^0.6.17",
40
+ "@synerise/ds-scrollbar": "^0.5.3",
41
+ "@synerise/ds-tabs": "^0.13.40",
42
42
  "@synerise/ds-utils": "^0.19.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@synerise/ds-core": "*",
46
46
  "react": ">=16.9.0 < 17.0.0"
47
47
  },
48
- "gitHead": "515b60d89b64d98fbf5d750802314640715c5f99"
48
+ "gitHead": "1ab09990244dd615bdfe696f365ae8075bd31762"
49
49
  }