@synerise/ds-condition 1.6.16 → 1.6.17

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Condition.d.ts +2 -2
  3. package/dist/Condition.js +128 -207
  4. package/dist/Condition.style.d.ts +32 -32
  5. package/dist/Condition.style.js +84 -93
  6. package/dist/Condition.types.d.ts +5 -5
  7. package/dist/Condition.types.js +1 -1
  8. package/dist/ConditionStep/AddCondition/AddCondition.d.ts +1 -1
  9. package/dist/ConditionStep/AddCondition/AddCondition.js +25 -28
  10. package/dist/ConditionStep/AddCondition/AddCondition.types.d.ts +2 -2
  11. package/dist/ConditionStep/AddCondition/AddCondition.types.js +1 -1
  12. package/dist/ConditionStep/AddCondition/index.js +4 -1
  13. package/dist/ConditionStep/ConditionRow/ConditionRow.d.ts +1 -1
  14. package/dist/ConditionStep/ConditionRow/ConditionRow.js +109 -167
  15. package/dist/ConditionStep/ConditionRow/ConditionRow.types.d.ts +4 -4
  16. package/dist/ConditionStep/ConditionRow/ConditionRow.types.js +1 -1
  17. package/dist/ConditionStep/ConditionRow/index.js +4 -2
  18. package/dist/ConditionStep/ConditionStep.d.ts +1 -1
  19. package/dist/ConditionStep/ConditionStep.js +144 -247
  20. package/dist/ConditionStep/ConditionStep.types.d.ts +6 -6
  21. package/dist/ConditionStep/ConditionStep.types.js +1 -1
  22. package/dist/ConditionStep/EmptyCondition/EmptyCondition.d.ts +1 -1
  23. package/dist/ConditionStep/EmptyCondition/EmptyCondition.js +16 -15
  24. package/dist/ConditionStep/EmptyCondition/emptyCondition.styles.d.ts +6 -6
  25. package/dist/ConditionStep/EmptyCondition/emptyCondition.styles.js +9 -5
  26. package/dist/ConditionStep/EmptyCondition/index.js +4 -1
  27. package/dist/ConditionStep/StepHeader/StepHeader.d.ts +1 -1
  28. package/dist/ConditionStep/StepHeader/StepHeader.js +46 -62
  29. package/dist/ConditionStep/StepHeader/StepHeader.types.d.ts +2 -2
  30. package/dist/ConditionStep/StepHeader/StepHeader.types.js +1 -1
  31. package/dist/ConditionStep/StepHeader/index.js +4 -2
  32. package/dist/ConditionStep/StepName/StepName.d.ts +2 -2
  33. package/dist/ConditionStep/StepName/StepName.js +19 -10
  34. package/dist/ConditionStep/index.js +4 -2
  35. package/dist/constants.js +22 -11
  36. package/dist/hooks/useTranslations.d.ts +1 -1
  37. package/dist/hooks/useTranslations.js +61 -59
  38. package/dist/index.js +4 -1
  39. package/dist/modules.d.js +1 -1
  40. package/dist/modules.d.ts +0 -0
  41. package/package.json +17 -17
@@ -1,70 +1,54 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import debounce from 'lodash.debounce';
3
- import React, { useCallback, useEffect, useRef, useState } from 'react';
4
- import Cruds from '@synerise/ds-cruds';
5
- import { DragHandleM } from '@synerise/ds-icon';
6
- import InlineEdit from '@synerise/ds-inline-edit';
7
- import { NOOP } from '@synerise/ds-utils';
8
- import * as S from '../../Condition.style';
9
- import { StepName } from '../StepName/StepName';
10
- export var StepHeader = function StepHeader(_ref) {
11
- var stepName = _ref.stepName,
12
- stepId = _ref.stepId,
13
- texts = _ref.texts,
14
- updateStepName = _ref.updateStepName,
15
- duplicateStep = _ref.duplicateStep,
16
- removeStep = _ref.removeStep,
17
- index = _ref.index,
18
- draggableEnabled = _ref.draggableEnabled,
19
- _ref$dragHandleProps = _ref.dragHandleProps,
20
- dragHandleProps = _ref$dragHandleProps === void 0 ? {} : _ref$dragHandleProps,
21
- _ref$readOnly = _ref.readOnly,
22
- readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
23
- var onChangeNameDebounce = useRef(debounce(updateStepName || NOOP, 300)).current;
24
- var _useState = useState(stepName),
25
- localName = _useState[0],
26
- setLocalName = _useState[1];
27
- useEffect(function () {
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import debounce from "lodash.debounce";
3
+ import { useRef, useState, useEffect, useCallback } from "react";
4
+ import Cruds from "@synerise/ds-cruds";
5
+ import { DragHandleM } from "@synerise/ds-icon";
6
+ import InlineEdit from "@synerise/ds-inline-edit";
7
+ import { NOOP } from "@synerise/ds-utils";
8
+ import { DragIcon, StepCruds, StepHeader as StepHeader$1, LeftSide } from "../../Condition.style.js";
9
+ import { StepName } from "../StepName/StepName.js";
10
+ const StepHeader = ({
11
+ stepName,
12
+ stepId,
13
+ texts,
14
+ updateStepName,
15
+ duplicateStep,
16
+ removeStep,
17
+ index,
18
+ draggableEnabled,
19
+ dragHandleProps = {},
20
+ readOnly = false
21
+ }) => {
22
+ const onChangeNameDebounce = useRef(debounce(updateStepName || NOOP, 300)).current;
23
+ const [localName, setLocalName] = useState(stepName);
24
+ useEffect(() => {
28
25
  setLocalName(stepName);
29
26
  }, [stepName]);
30
- useEffect(function () {
31
- return function () {
27
+ useEffect(() => {
28
+ return () => {
32
29
  onChangeNameDebounce.cancel();
33
30
  };
34
31
  }, [onChangeNameDebounce]);
35
- var handleChangeName = useCallback(function (event) {
32
+ const handleChangeName = useCallback((event) => {
36
33
  setLocalName(event.target.value);
37
34
  onChangeNameDebounce(stepId, event.target.value);
38
35
  }, [onChangeNameDebounce, stepId]);
39
- var dragHandleElement = !readOnly && draggableEnabled && /*#__PURE__*/React.createElement(S.DragIcon, _extends({
40
- className: "step-drag-handler",
41
- component: /*#__PURE__*/React.createElement(DragHandleM, null)
42
- }, dragHandleProps));
43
- var stepNameElement = readOnly ? localName : /*#__PURE__*/React.createElement(InlineEdit, {
44
- size: "small",
45
- input: {
46
- value: localName,
47
- name: "condition-step-name-" + stepId,
48
- placeholder: texts.stepNamePlaceholder,
49
- onChange: handleChangeName
50
- }
51
- });
52
- var crudElement = !readOnly && /*#__PURE__*/React.createElement(S.StepCruds, null, /*#__PURE__*/React.createElement(Cruds, {
53
- onDuplicate: duplicateStep ? function () {
54
- return duplicateStep(stepId);
55
- } : undefined,
56
- onDelete: removeStep ? function () {
57
- return removeStep(stepId);
58
- } : undefined,
59
- duplicateTooltip: texts.duplicateTooltip,
60
- deleteTooltip: texts.removeTooltip
61
- }));
62
- return /*#__PURE__*/React.createElement(S.StepHeader, {
63
- className: "ds-condition-step-header",
64
- draggable: draggableEnabled
65
- }, /*#__PURE__*/React.createElement(S.LeftSide, null, dragHandleElement, /*#__PURE__*/React.createElement(StepName, {
66
- name: stepNameElement,
67
- index: index,
68
- texts: texts
69
- })), crudElement);
70
- };
36
+ const dragHandleElement = !readOnly && draggableEnabled && /* @__PURE__ */ jsx(DragIcon, { className: "step-drag-handler", component: /* @__PURE__ */ jsx(DragHandleM, {}), ...dragHandleProps });
37
+ const stepNameElement = readOnly ? localName : /* @__PURE__ */ jsx(InlineEdit, { size: "small", input: {
38
+ value: localName,
39
+ name: `condition-step-name-${stepId}`,
40
+ placeholder: texts.stepNamePlaceholder,
41
+ onChange: handleChangeName
42
+ } });
43
+ const crudElement = !readOnly && /* @__PURE__ */ jsx(StepCruds, { children: /* @__PURE__ */ jsx(Cruds, { onDuplicate: duplicateStep ? () => duplicateStep(stepId) : void 0, onDelete: removeStep ? () => removeStep(stepId) : void 0, duplicateTooltip: texts.duplicateTooltip, deleteTooltip: texts.removeTooltip }) });
44
+ return /* @__PURE__ */ jsxs(StepHeader$1, { className: "ds-condition-step-header", draggable: draggableEnabled, children: [
45
+ /* @__PURE__ */ jsxs(LeftSide, { children: [
46
+ dragHandleElement,
47
+ /* @__PURE__ */ jsx(StepName, { name: stepNameElement, index, texts })
48
+ ] }),
49
+ crudElement
50
+ ] });
51
+ };
52
+ export {
53
+ StepHeader
54
+ };
@@ -1,5 +1,5 @@
1
- import { type HTMLAttributes, type ReactText } from 'react';
2
- import { type ConditionProps, type ConditionTexts } from '../../Condition.types';
1
+ import { HTMLAttributes, ReactText } from 'react';
2
+ import { ConditionProps, ConditionTexts } from '../../Condition.types';
3
3
  export type StepHeaderProps = {
4
4
  index: number;
5
5
  texts: ConditionTexts;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,2 +1,4 @@
1
- export * from './StepHeader.types';
2
- export * from './StepHeader';
1
+ import { StepHeader } from "./StepHeader.js";
2
+ export {
3
+ StepHeader
4
+ };
@@ -1,5 +1,5 @@
1
- import React, { type ReactNode } from 'react';
2
- import { type ConditionTexts } from '../../Condition.types';
1
+ import { default as React, ReactNode } from 'react';
2
+ import { ConditionTexts } from '../../Condition.types';
3
3
  type StepNameProps = {
4
4
  texts: ConditionTexts;
5
5
  index: number;
@@ -1,10 +1,19 @@
1
- import React from 'react';
2
- import * as S from '../../Condition.style';
3
- export var StepName = function StepName(_ref) {
4
- var texts = _ref.texts,
5
- index = _ref.index,
6
- name = _ref.name;
7
- return /*#__PURE__*/React.createElement(S.StepName, {
8
- className: "ds-condition-step-name"
9
- }, /*#__PURE__*/React.createElement(S.StepIndexWrapper, null, texts.stepNamePrefix, " ", "" + (index + 1)), name);
10
- };
1
+ import { jsxs } from "react/jsx-runtime";
2
+ import { StepName as StepName$1, StepIndexWrapper } from "../../Condition.style.js";
3
+ const StepName = ({
4
+ texts,
5
+ index,
6
+ name
7
+ }) => {
8
+ return /* @__PURE__ */ jsxs(StepName$1, { className: "ds-condition-step-name", children: [
9
+ /* @__PURE__ */ jsxs(StepIndexWrapper, { children: [
10
+ texts.stepNamePrefix,
11
+ " ",
12
+ `${index + 1}`
13
+ ] }),
14
+ name
15
+ ] });
16
+ };
17
+ export {
18
+ StepName
19
+ };
@@ -1,2 +1,4 @@
1
- export * from './ConditionStep.types';
2
- export * from './ConditionStep';
1
+ import { ConditionStep } from "./ConditionStep.js";
2
+ export {
3
+ ConditionStep
4
+ };
package/dist/constants.js CHANGED
@@ -1,14 +1,25 @@
1
- export var DEFAULT_FIELD = '';
2
- export var DEFAULT_CONDITION = '';
3
- export var DEFAULT_STEP = '';
4
- export var OPERATOR = 'operator';
5
- export var PARAMETER = 'parameter';
6
- export var FACTOR = 'factor';
7
- export var SUBJECT = 'subject';
8
- export var ACTION_ATTRIBUTE = 'actionAttribute';
9
- export var DEFAULT_INPUT_PROPS = {
1
+ const DEFAULT_FIELD = "";
2
+ const DEFAULT_CONDITION = "";
3
+ const DEFAULT_STEP = "";
4
+ const OPERATOR = "operator";
5
+ const PARAMETER = "parameter";
6
+ const FACTOR = "factor";
7
+ const SUBJECT = "subject";
8
+ const ACTION_ATTRIBUTE = "actionAttribute";
9
+ const DEFAULT_INPUT_PROPS = {
10
10
  autoResize: {
11
- minWidth: '173px',
11
+ minWidth: "173px",
12
12
  stretchToFit: true
13
13
  }
14
- };
14
+ };
15
+ export {
16
+ ACTION_ATTRIBUTE,
17
+ DEFAULT_CONDITION,
18
+ DEFAULT_FIELD,
19
+ DEFAULT_INPUT_PROPS,
20
+ DEFAULT_STEP,
21
+ FACTOR,
22
+ OPERATOR,
23
+ PARAMETER,
24
+ SUBJECT
25
+ };
@@ -1,2 +1,2 @@
1
- import { type ConditionTexts } from '../Condition.types';
1
+ import { ConditionTexts } from '../Condition.types';
2
2
  export declare const useTranslations: (defaultTexts?: Partial<ConditionTexts>) => ConditionTexts;
@@ -1,60 +1,62 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import { useMemo } from 'react';
3
- import { useIntl } from 'react-intl';
4
- export var useTranslations = function useTranslations(defaultTexts) {
5
- var _useIntl = useIntl(),
6
- formatMessage = _useIntl.formatMessage;
7
- var texts = useMemo(function () {
8
- return _extends({
9
- stepNamePrefix: formatMessage({
10
- id: 'DS.CONDITION.STEP_NAME-PREFIX',
11
- defaultMessage: 'Step'
12
- }),
13
- emptyConditionLabel: formatMessage({
14
- id: 'DS.CONDITION.EMPTY_CONDITION_LABEL',
15
- defaultMessage: 'Choose event first'
16
- }),
17
- stepNamePlaceholder: formatMessage({
18
- id: 'DS.CONDITION.STEP_NAME-PLACEHOLDER',
19
- defaultMessage: 'Step name'
20
- }),
21
- removeConditionRowTooltip: formatMessage({
22
- id: 'DS.CONDITION.REMOVE-CONDITION-ROW-TOOLTIP',
23
- defaultMessage: 'Delete'
24
- }),
25
- addConditionRowButton: formatMessage({
26
- id: 'DS.CONDITION.ADD-CONDITION-ROW-BUTTON',
27
- defaultMessage: 'Add condition'
28
- }),
29
- addFirstConditionRowButton: formatMessage({
30
- id: 'DS.CONDITION.ADD-FIRST-CONDITION-ROW-BUTTON',
31
- defaultMessage: 'Add condition'
32
- }),
33
- dropLabel: formatMessage({
34
- id: 'DS.CONDITION.DROP-LABEL',
35
- defaultMessage: 'Drop me here'
36
- }),
37
- moveTooltip: formatMessage({
38
- id: 'DS.CONDITION.MOVE-TOOLTIP',
39
- defaultMessage: 'Move'
40
- }),
41
- duplicateTooltip: formatMessage({
42
- id: 'DS.CONDITION.DUPLICATE-TOOLTIP',
43
- defaultMessage: 'Duplicate'
44
- }),
45
- removeTooltip: formatMessage({
46
- id: 'DS.CONDITION.REMOVE-TOOLTIP',
47
- defaultMessage: 'Delete'
48
- }),
49
- addStep: formatMessage({
50
- id: 'DS.CONDITION.ADD-STEP',
51
- defaultMessage: 'Add step'
52
- }),
53
- conditionSuffix: formatMessage({
54
- id: 'DS.CONDITION.SUFFIX',
55
- defaultMessage: 'and'
56
- })
57
- }, defaultTexts || {});
58
- }, [formatMessage, defaultTexts]);
1
+ import { useMemo } from "react";
2
+ import { useIntl } from "react-intl";
3
+ const useTranslations = (defaultTexts) => {
4
+ const {
5
+ formatMessage
6
+ } = useIntl();
7
+ const texts = useMemo(() => ({
8
+ stepNamePrefix: formatMessage({
9
+ id: "DS.CONDITION.STEP_NAME-PREFIX",
10
+ defaultMessage: "Step"
11
+ }),
12
+ emptyConditionLabel: formatMessage({
13
+ id: "DS.CONDITION.EMPTY_CONDITION_LABEL",
14
+ defaultMessage: "Choose event first"
15
+ }),
16
+ stepNamePlaceholder: formatMessage({
17
+ id: "DS.CONDITION.STEP_NAME-PLACEHOLDER",
18
+ defaultMessage: "Step name"
19
+ }),
20
+ removeConditionRowTooltip: formatMessage({
21
+ id: "DS.CONDITION.REMOVE-CONDITION-ROW-TOOLTIP",
22
+ defaultMessage: "Delete"
23
+ }),
24
+ addConditionRowButton: formatMessage({
25
+ id: "DS.CONDITION.ADD-CONDITION-ROW-BUTTON",
26
+ defaultMessage: "Add condition"
27
+ }),
28
+ addFirstConditionRowButton: formatMessage({
29
+ id: "DS.CONDITION.ADD-FIRST-CONDITION-ROW-BUTTON",
30
+ defaultMessage: "Add condition"
31
+ }),
32
+ dropLabel: formatMessage({
33
+ id: "DS.CONDITION.DROP-LABEL",
34
+ defaultMessage: "Drop me here"
35
+ }),
36
+ moveTooltip: formatMessage({
37
+ id: "DS.CONDITION.MOVE-TOOLTIP",
38
+ defaultMessage: "Move"
39
+ }),
40
+ duplicateTooltip: formatMessage({
41
+ id: "DS.CONDITION.DUPLICATE-TOOLTIP",
42
+ defaultMessage: "Duplicate"
43
+ }),
44
+ removeTooltip: formatMessage({
45
+ id: "DS.CONDITION.REMOVE-TOOLTIP",
46
+ defaultMessage: "Delete"
47
+ }),
48
+ addStep: formatMessage({
49
+ id: "DS.CONDITION.ADD-STEP",
50
+ defaultMessage: "Add step"
51
+ }),
52
+ conditionSuffix: formatMessage({
53
+ id: "DS.CONDITION.SUFFIX",
54
+ defaultMessage: "and"
55
+ }),
56
+ ...defaultTexts || {}
57
+ }), [formatMessage, defaultTexts]);
59
58
  return texts;
60
- };
59
+ };
60
+ export {
61
+ useTranslations
62
+ };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export { default } from './Condition';
1
+ import { default as default2 } from "./Condition.js";
2
+ export {
3
+ default2 as default
4
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "1.6.16",
3
+ "version": "1.6.17",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,19 +35,19 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-button": "^1.5.17",
39
- "@synerise/ds-context-selector": "^1.3.16",
40
- "@synerise/ds-cruds": "^1.1.1",
41
- "@synerise/ds-factors": "^1.11.11",
42
- "@synerise/ds-icon": "^1.15.0",
43
- "@synerise/ds-inline-edit": "^1.1.23",
44
- "@synerise/ds-input": "^1.6.9",
45
- "@synerise/ds-operators": "^1.1.23",
46
- "@synerise/ds-sortable": "^1.3.13",
47
- "@synerise/ds-subject": "^1.1.23",
48
- "@synerise/ds-tooltip": "^1.4.9",
49
- "@synerise/ds-typography": "^1.1.12",
50
- "@synerise/ds-utils": "^1.7.0",
38
+ "@synerise/ds-button": "^1.5.18",
39
+ "@synerise/ds-context-selector": "^1.3.17",
40
+ "@synerise/ds-cruds": "^1.1.2",
41
+ "@synerise/ds-factors": "^1.11.12",
42
+ "@synerise/ds-icon": "^1.15.1",
43
+ "@synerise/ds-inline-edit": "^1.1.24",
44
+ "@synerise/ds-input": "^1.6.10",
45
+ "@synerise/ds-operators": "^1.1.24",
46
+ "@synerise/ds-sortable": "^1.3.14",
47
+ "@synerise/ds-subject": "^1.1.24",
48
+ "@synerise/ds-tooltip": "^1.4.10",
49
+ "@synerise/ds-typography": "^1.1.13",
50
+ "@synerise/ds-utils": "^1.7.1",
51
51
  "lodash.debounce": "^4.0.8"
52
52
  },
53
53
  "devDependencies": {
@@ -61,5 +61,5 @@
61
61
  "react-intl": ">=3.12.0 <= 6.8",
62
62
  "styled-components": "^5.3.3"
63
63
  },
64
- "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
64
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
65
65
  }