@synerise/ds-factors 1.3.1 → 1.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +786 -2398
  2. package/dist/FactorTypeSelector/FactorTypeSelector.d.ts +1 -1
  3. package/dist/FactorTypeSelector/FactorTypeSelector.js +6 -4
  4. package/dist/FactorValue/Array/Array.d.ts +1 -1
  5. package/dist/FactorValue/Array/Array.js +5 -3
  6. package/dist/FactorValue/Array/Array.styles.js +2 -2
  7. package/dist/FactorValue/Array/Array.types.d.ts +1 -1
  8. package/dist/FactorValue/Array/Array.utils.d.ts +1 -1
  9. package/dist/FactorValue/Array/components/ArrayCollector.d.ts +1 -1
  10. package/dist/FactorValue/Array/components/ArrayCollector.js +1 -1
  11. package/dist/FactorValue/Array/components/ArrayCreator.js +1 -1
  12. package/dist/FactorValue/Array/components/ArrayLimit.d.ts +1 -1
  13. package/dist/FactorValue/Array/components/ArrayModal.d.ts +1 -1
  14. package/dist/FactorValue/Array/components/ArrayModal.js +3 -4
  15. package/dist/FactorValue/Array/components/ArrayRaw.d.ts +1 -1
  16. package/dist/FactorValue/Array/components/ArrayRaw.js +1 -1
  17. package/dist/FactorValue/Array/components/CopyButton.d.ts +1 -1
  18. package/dist/FactorValue/Array/components/CopyButton.js +2 -2
  19. package/dist/FactorValue/Array/hooks/useCollector.d.ts +1 -1
  20. package/dist/FactorValue/Array/hooks/useCollector.js +1 -1
  21. package/dist/FactorValue/Date/Date.d.ts +1 -1
  22. package/dist/FactorValue/Date/Date.js +1 -1
  23. package/dist/FactorValue/DateRange/DateRange.d.ts +1 -1
  24. package/dist/FactorValue/DateRange/DateRange.js +1 -1
  25. package/dist/FactorValue/DynamicKey/DynamicKey.d.ts +2 -2
  26. package/dist/FactorValue/DynamicKey/DynamicKey.js +14 -4
  27. package/dist/FactorValue/DynamicKey/DynamicKey.style.d.ts +5 -0
  28. package/dist/FactorValue/DynamicKey/DynamicKey.style.js +10 -7
  29. package/dist/FactorValue/FactorValue.d.ts +2 -2
  30. package/dist/FactorValue/FactorValue.js +5 -3
  31. package/dist/FactorValue/FactorValue.style.js +0 -1
  32. package/dist/FactorValue/Formula/Formula.d.ts +1 -1
  33. package/dist/FactorValue/Formula/Formula.js +3 -3
  34. package/dist/FactorValue/Formula/Formula.styles.js +0 -2
  35. package/dist/FactorValue/Formula/FormulaModal.d.ts +1 -1
  36. package/dist/FactorValue/Formula/FormulaModal.js +1 -1
  37. package/dist/FactorValue/Number/NumberInput.d.ts +1 -1
  38. package/dist/FactorValue/Parameter/Parameter.constants.d.ts +1 -1
  39. package/dist/FactorValue/Parameter/Parameter.d.ts +1 -1
  40. package/dist/FactorValue/Parameter/Parameter.js +8 -9
  41. package/dist/FactorValue/Parameter/Parameter.style.d.ts +3 -1
  42. package/dist/FactorValue/Parameter/Parameter.style.js +11 -6
  43. package/dist/FactorValue/Parameter/Parameter.types.d.ts +2 -2
  44. package/dist/FactorValue/Parameter/ParameterDropdown.d.ts +1 -1
  45. package/dist/FactorValue/Parameter/ParameterDropdown.js +11 -11
  46. package/dist/FactorValue/Parameter/ParameterDropdownItem.d.ts +2 -2
  47. package/dist/FactorValue/Parameter/useGroups.d.ts +1 -1
  48. package/dist/FactorValue/Parameter/utils.d.ts +3 -3
  49. package/dist/FactorValue/RelativeDate/RelativeDate.const.d.ts +1 -1
  50. package/dist/FactorValue/RelativeDate/RelativeDate.d.ts +1 -1
  51. package/dist/FactorValue/RelativeDate/RelativeDate.js +8 -6
  52. package/dist/FactorValue/RelativeDate/RelativeDateDropdown.d.ts +1 -1
  53. package/dist/FactorValue/RelativeDate/RelativeDateDropdown.js +2 -2
  54. package/dist/FactorValue/RelativeDate/RelativeDateDropdown.styles.js +2 -2
  55. package/dist/FactorValue/Text/Text.d.ts +2 -2
  56. package/dist/FactorValue/Text/Text.js +17 -8
  57. package/dist/FactorValue/Text/Text.styles.js +0 -2
  58. package/dist/FactorValue/Text/TextModal.d.ts +1 -1
  59. package/dist/FactorValue/Text/TextModal.js +3 -2
  60. package/dist/Factors.d.ts +2 -2
  61. package/dist/Factors.js +10 -9
  62. package/dist/Factors.types.d.ts +23 -9
  63. package/dist/hooks/useTexts.d.ts +1 -1
  64. package/dist/hooks/useTexts.js +1 -1
  65. package/dist/index.d.ts +2 -3
  66. package/dist/index.js +5 -1
  67. package/dist/style/Factors.style.js +1 -1
  68. package/package.json +30 -30
@@ -1,20 +1,20 @@
1
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 React, { useRef, useState, useMemo, useCallback, useEffect } from 'react';
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { v4 as uuid } from 'uuid';
4
- import Dropdown from '@synerise/ds-dropdown';
4
+ import { theme } from '@synerise/ds-core';
5
5
  import Divider from '@synerise/ds-divider';
6
+ import Dropdown from '@synerise/ds-dropdown';
6
7
  import Icon, { ArrowRightCircleM, SearchM } from '@synerise/ds-icon';
7
- import Tabs from '@synerise/ds-tabs';
8
- import { useSearchResults, getGroupName, focusWithArrowKeys, useOnClickOutside, getClosest } from '@synerise/ds-utils';
8
+ import { itemSizes } from '@synerise/ds-list-item';
9
9
  import Result from '@synerise/ds-result';
10
- import { theme } from '@synerise/ds-core';
11
10
  import Scrollbar from '@synerise/ds-scrollbar';
12
- import { itemSizes } from '@synerise/ds-list-item';
11
+ import Tabs from '@synerise/ds-tabs';
12
+ import { focusWithArrowKeys, getClosest, getGroupName, useOnClickOutside, useSearchResults } from '@synerise/ds-utils';
13
+ import { DROPDOWN_HEIGHT, ITEM_SIZE, LIST_STYLE, NO_GROUP_NAME, SEARCH_HEGIHT, SUBGROUP_HEADER_HEIGHT, TABS_HEIGHT } from './Parameter.constants';
13
14
  import * as S from './Parameter.style';
14
15
  import ParameterDropdownItem from './ParameterDropdownItem';
15
- import { groupItems } from './utils';
16
16
  import { useGroups } from './useGroups';
17
- import { DROPDOWN_HEIGHT, SEARCH_HEGIHT, TABS_HEIGHT, SUBGROUP_HEADER_HEIGHT, ITEM_SIZE, LIST_STYLE, NO_GROUP_NAME } from './Parameter.constants';
17
+ import { groupItems } from './utils';
18
18
  var isListTitle = function isListTitle(element) {
19
19
  return element.title !== undefined;
20
20
  };
@@ -91,7 +91,6 @@ var ParameterDropdown = function ParameterDropdown(_ref) {
91
91
  var groupedItems = {};
92
92
  for (var i = 0; i < itemsNumber; i += 1) {
93
93
  var item = dropdownItems[i];
94
- // @ts-ignore
95
94
  var groupName = item.groupName || NO_GROUP_NAME;
96
95
  var group = groupedItems[groupName] || [];
97
96
  group.push(item);
@@ -248,7 +247,9 @@ var ParameterDropdown = function ParameterDropdown(_ref) {
248
247
  }, [searchQuery, activeGroup, activeTab]);
249
248
  var getItemSize = function getItemSize(index) {
250
249
  var item = currentItems && currentItems[index];
251
- if (isListTitle(item)) return ITEM_SIZE.title;
250
+ if (isListTitle(item)) {
251
+ return ITEM_SIZE.title;
252
+ }
252
253
  return ITEM_SIZE[itemSizes.DEFAULT];
253
254
  };
254
255
  var hasTabs = tabs.length > 1;
@@ -265,7 +266,6 @@ var ParameterDropdown = function ParameterDropdown(_ref) {
265
266
  ref: overlayRef,
266
267
  onKeyDown: function onKeyDown(event) {
267
268
  setSearchInputFocus(false);
268
- // eslint-disable-next-line @typescript-eslint/no-empty-function
269
269
  searchQuery && focusWithArrowKeys(event, classNames.split(' ')[1], function () {
270
270
  setSearchInputFocus(true);
271
271
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ParameterGroup, ParameterItem } from '../../Factors.types';
3
- import { DropdownItem } from './Parameter.types';
2
+ import { type ParameterGroup, type ParameterItem } from '../../Factors.types';
3
+ import { type DropdownItem } from './Parameter.types';
4
4
  declare const ParameterDropdownItem: <ItemType extends ParameterGroup | ParameterItem>({ item, clearSearch, searchQuery, hideDropdown, select, className, style, label, }: DropdownItem<ItemType>) => React.JSX.Element;
5
5
  export default ParameterDropdownItem;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ParameterItem, ParameterGroup } from '../../Factors.types';
2
+ import { type ParameterGroup, type ParameterItem } from '../../Factors.types';
3
3
  export declare const useGroups: (items?: ParameterItem[], groups?: ParameterGroup[], renderEmptyGroups?: boolean) => {
4
4
  visibleGroups: ParameterGroup[] | undefined;
5
5
  tabs: {
@@ -1,4 +1,4 @@
1
- import type { ParameterGroup } from '../../Factors.types';
2
- import { DropdownItem } from './Parameter.types';
3
- import { DividerItem, TitleItem } from './ParameterDropdown';
1
+ import { type ParameterGroup } from 'Factors.types';
2
+ import { type DropdownItem } from './Parameter.types';
3
+ import { type DividerItem, type TitleItem } from './ParameterDropdown';
4
4
  export declare const groupItems: (dropdownItems: DropdownItem<ParameterGroup>[], activeGroup: ParameterGroup | undefined) => (DropdownItem<ParameterGroup> | TitleItem | DividerItem)[];
@@ -1,4 +1,4 @@
1
- import { RelativeDateUnit, RelativeTimeRelation } from '../../Factors.types';
1
+ import { type RelativeDateUnit, type RelativeTimeRelation } from '../../Factors.types';
2
2
  export declare const INTERVALS: RelativeDateUnit[];
3
3
  export declare const BEFORE: RelativeTimeRelation;
4
4
  export declare const AFTER: RelativeTimeRelation;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { FactorValueComponentProps } from '../../Factors.types';
2
+ import { type FactorValueComponentProps } from '../../Factors.types';
3
3
  declare const RelativeDateInput: ({ value, onChange, texts: allTexts, opened, onDeactivate, onActivate, error, allowClear, readOnly, triggerValueFormatter, getPopupContainerOverride, availableUnits, }: FactorValueComponentProps) => React.JSX.Element;
4
4
  export default RelativeDateInput;
@@ -1,11 +1,11 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { useTheme } from '@synerise/ds-core';
3
- import { getPopupContainer } from '@synerise/ds-utils';
4
3
  import Dropdown from '@synerise/ds-dropdown';
5
4
  import Icon, { AngleDownS, Close3S } from '@synerise/ds-icon';
5
+ import { getPopupContainer } from '@synerise/ds-utils';
6
+ import { defaultTriggerModifier } from './RelativeDate.utils';
6
7
  import { RelativeDateDropdown } from './RelativeDateDropdown';
7
8
  import * as S from './RelativeDateDropdown.styles';
8
- import { defaultTriggerModifier } from './RelativeDate.utils';
9
9
  var RelativeDateInput = function RelativeDateInput(_ref) {
10
10
  var value = _ref.value,
11
11
  onChange = _ref.onChange,
@@ -59,10 +59,12 @@ var RelativeDateInput = function RelativeDateInput(_ref) {
59
59
  return triggerValueFormatter ? triggerValueFormatter(localValue) : defaultTriggerModifier(localValue, texts);
60
60
  }, [texts, localValue, triggerValueFormatter]);
61
61
  var icon = useMemo(function () {
62
- if (!localValue || !allowClear) return /*#__PURE__*/React.createElement(Icon, {
63
- component: /*#__PURE__*/React.createElement(AngleDownS, null),
64
- onClick: handleOpen
65
- });
62
+ if (!localValue || !allowClear) {
63
+ return /*#__PURE__*/React.createElement(Icon, {
64
+ component: /*#__PURE__*/React.createElement(AngleDownS, null),
65
+ onClick: handleOpen
66
+ });
67
+ }
66
68
  return /*#__PURE__*/React.createElement(S.IconWrapper, null, /*#__PURE__*/React.createElement(S.ChevronIcon, {
67
69
  onClick: handleOpen,
68
70
  component: /*#__PURE__*/React.createElement(AngleDownS, null)
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { RelativeDateFactorTexts, RelativeDateUnit, RelativeDateValueType } from '../../Factors.types';
2
+ import { type RelativeDateFactorTexts, type RelativeDateUnit, type RelativeDateValueType } from '../../Factors.types';
3
3
  type RelativeDateDropdownProps = {
4
4
  value?: RelativeDateValueType;
5
5
  texts: RelativeDateFactorTexts;
@@ -1,11 +1,11 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
2
  import Button from '@synerise/ds-button';
3
3
  import { InputGroup } from '@synerise/ds-input';
4
- import Select from '@synerise/ds-select/dist/Select';
5
4
  import InputNumber from '@synerise/ds-input-number';
5
+ import Select from '@synerise/ds-select/dist/Select';
6
6
  import { AFTER, BEFORE, DEFAULT_VALUE, INTERVALS, TIME_RELATIONS } from './RelativeDate.const';
7
- import * as S from './RelativeDateDropdown.styles';
8
7
  import { getTranslation } from './RelativeDate.utils';
8
+ import * as S from './RelativeDateDropdown.styles';
9
9
  var getRelationForModifier = function getRelationForModifier(value) {
10
10
  return value < 0 ? BEFORE : AFTER;
11
11
  };
@@ -1,8 +1,8 @@
1
1
  import styled from 'styled-components';
2
- import Icon from '@synerise/ds-icon';
3
- import { InputNumberWrapper } from '@synerise/ds-input-number/dist/InputNumber.styles';
4
2
  import Dropdown from '@synerise/ds-dropdown';
3
+ import Icon from '@synerise/ds-icon';
5
4
  import { Input } from '@synerise/ds-input';
5
+ import { InputNumberWrapper } from '@synerise/ds-input-number/dist/InputNumber.styles';
6
6
  export var RelativeDateDropdownWrapper = styled(Dropdown.Wrapper).withConfig({
7
7
  displayName: "RelativeDateDropdownstyles__RelativeDateDropdownWrapper",
8
8
  componentId: "sc-1xn8l81-0"
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { FactorValueComponentProps } from '../../Factors.types';
3
- declare const TextInput: ({ value, onChange, texts, textType, autocompleteText, factorType, opened, onDeactivate, onActivate, error, inputProps, getPopupContainerOverride, readOnly, }: FactorValueComponentProps) => React.JSX.Element;
2
+ import { type FactorValueComponentProps } from '../../Factors.types';
3
+ declare const TextInput: ({ value, onChange, texts, textType, autocompleteText, factorType, opened, onDeactivate, onActivate, error, inputProps, getPopupContainerOverride, readOnly, factorValueExtraProps, }: FactorValueComponentProps) => React.JSX.Element;
4
4
  export default TextInput;
@@ -1,8 +1,8 @@
1
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
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
- import Icon, { FullScreenM } from '@synerise/ds-icon';
4
- import { theme } from '@synerise/ds-core';
5
3
  import Autocomplete from '@synerise/ds-autocomplete';
4
+ import { useTheme } from '@synerise/ds-core';
5
+ import Icon, { FullScreenM } from '@synerise/ds-icon';
6
6
  import { Input } from '@synerise/ds-input';
7
7
  import * as S from './Text.styles';
8
8
  import TextModal from './TextModal';
@@ -20,7 +20,8 @@ var TextInput = function TextInput(_ref) {
20
20
  inputProps = _ref.inputProps,
21
21
  getPopupContainerOverride = _ref.getPopupContainerOverride,
22
22
  _ref$readOnly = _ref.readOnly,
23
- readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
23
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
24
+ factorValueExtraProps = _ref.factorValueExtraProps;
24
25
  var _useState = useState(false),
25
26
  openExpanseEditor = _useState[0],
26
27
  setOpenExpanseEditor = _useState[1];
@@ -33,6 +34,7 @@ var TextInput = function TextInput(_ref) {
33
34
  var _useState4 = useState(false),
34
35
  localError = _useState4[0],
35
36
  setLocalError = _useState4[1];
37
+ var theme = useTheme();
36
38
  useEffect(function () {
37
39
  if (inputRef != null && inputRef.current && opened) {
38
40
  inputRef.current.focus();
@@ -64,9 +66,14 @@ var TextInput = function TextInput(_ref) {
64
66
  return option.toLowerCase().includes(String(localValue).toLowerCase());
65
67
  }) || [];
66
68
  }, [localValue, autocompleteText]);
69
+ var _ref2 = (factorValueExtraProps == null ? void 0 : factorValueExtraProps.text) || {},
70
+ _ref2$autoCompletePro = _ref2.autoCompleteProps,
71
+ autoCompleteProps = _ref2$autoCompletePro === void 0 ? {} : _ref2$autoCompletePro,
72
+ _ref2$inputProps = _ref2.inputProps,
73
+ extraInputProps = _ref2$inputProps === void 0 ? {} : _ref2$inputProps;
67
74
  var renderInput = function renderInput(typesOfInput, factorsType) {
68
75
  if (typesOfInput === 'autocomplete' && factorsType === 'text') {
69
- return /*#__PURE__*/React.createElement(Autocomplete, _extends({}, inputProps, {
76
+ return /*#__PURE__*/React.createElement(Autocomplete, _extends({}, inputProps, autoCompleteProps, {
70
77
  placeholder: texts.valuePlaceholder,
71
78
  value: localValue,
72
79
  onChange: handleAutocomplete,
@@ -85,7 +92,7 @@ var TextInput = function TextInput(_ref) {
85
92
  }));
86
93
  }
87
94
  if (typesOfInput === 'default' && factorsType === 'text') {
88
- return /*#__PURE__*/React.createElement(S.InputWrapper, null, /*#__PURE__*/React.createElement(Input, _extends({}, inputProps, {
95
+ return /*#__PURE__*/React.createElement(S.InputWrapper, null, /*#__PURE__*/React.createElement(Input, _extends({}, inputProps, extraInputProps, {
89
96
  handleInputRef: setInputRef,
90
97
  placeholder: texts.valuePlaceholder,
91
98
  value: localValue,
@@ -93,10 +100,11 @@ var TextInput = function TextInput(_ref) {
93
100
  onBlur: onDeactivate,
94
101
  onFocus: onActivate,
95
102
  error: localError || error,
96
- readOnly: readOnly
103
+ readOnly: readOnly,
104
+ resetMargin: true
97
105
  })));
98
106
  }
99
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.InputWrapper, null, /*#__PURE__*/React.createElement(Input, _extends({}, inputProps, {
107
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.InputWrapper, null, /*#__PURE__*/React.createElement(Input, _extends({}, inputProps, extraInputProps, {
100
108
  handleInputRef: setInputRef,
101
109
  placeholder: texts.valuePlaceholder,
102
110
  icon1: /*#__PURE__*/React.createElement(S.IconWrapper, {
@@ -114,7 +122,8 @@ var TextInput = function TextInput(_ref) {
114
122
  onBlur: onDeactivate,
115
123
  onFocus: onActivate,
116
124
  error: localError || error,
117
- readOnly: readOnly
125
+ readOnly: readOnly,
126
+ resetMargin: true
118
127
  }))), /*#__PURE__*/React.createElement(TextModal, {
119
128
  visible: openExpanseEditor,
120
129
  onCancel: function onCancel() {
@@ -1,6 +1,4 @@
1
1
  import styled from 'styled-components';
2
-
3
- // eslint-disable-next-line import/prefer-default-export
4
2
  export var IconWrapper = styled.span.withConfig({
5
3
  displayName: "Textstyles__IconWrapper",
6
4
  componentId: "sc-rjr8p0-0"
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { TextModalProps } from '../../Factors.types';
2
+ import { type TextModalProps } from '../../Factors.types';
3
3
  declare const TextModal: React.FC<TextModalProps>;
4
4
  export default TextModal;
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
- import ModalProxy from '@synerise/ds-modal';
3
2
  import Textarea from '@synerise/ds-input/dist/Textarea/Textarea';
3
+ import ModalProxy from '@synerise/ds-modal';
4
4
  var TextModal = function TextModal(_ref) {
5
5
  var value = _ref.value,
6
6
  onApply = _ref.onApply,
7
7
  onCancel = _ref.onCancel,
8
8
  visible = _ref.visible,
9
9
  texts = _ref.texts;
10
- var _React$useState = React.useState('' || value),
10
+ // const [expandValue, setExpandValue] = React.useState('' || value); // TESTME
11
+ var _React$useState = React.useState(value),
11
12
  expandValue = _React$useState[0],
12
13
  setExpandValue = _React$useState[1];
13
14
  React.useEffect(function () {
package/dist/Factors.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DefinedFactorTypes, FactorsProps, SelectedFactorType } from './Factors.types';
2
+ import { type DefinedFactorTypes, type FactorsProps, type SelectedFactorType } from './Factors.types';
3
3
  export declare const FACTOR_TYPE_MAPPING: Record<DefinedFactorTypes, SelectedFactorType>;
4
- declare const Factors: ({ selectedFactorType, setSelectedFactorType, onChangeValue, onParamsClick, value, defaultFactorType, textType, unavailableFactorTypes, availableFactorTypes, parameters, autocompleteText, allowClear, withoutTypeSelector, texts, formulaEditor, opened, loading, factorKey, preventAutoloadData, onActivate, onDeactivate, getPopupContainerOverride, customFactorValueComponents, error, inputProps, arrayProps, readOnly, getMenuEntryProps, }: FactorsProps) => React.JSX.Element;
4
+ declare const Factors: ({ selectedFactorType, setSelectedFactorType, onChangeValue, onParamsClick, value, defaultFactorType, textType, unavailableFactorTypes, availableFactorTypes, parameters, autocompleteText, allowClear, withoutTypeSelector, texts, formulaEditor, opened, loading, factorKey, preventAutoloadData, onActivate, onDeactivate, getPopupContainerOverride, customFactorValueComponents, error, inputProps, arrayProps, readOnly, factorValueExtraProps, getMenuEntryProps, }: FactorsProps) => React.JSX.Element;
5
5
  export default Factors;
package/dist/Factors.js CHANGED
@@ -2,19 +2,19 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React, { useMemo } from 'react';
3
3
  import { BookM, Calendar2M, CalendarSwitchM, DynamicKeyM, FormulaM, HashM, ListM, ShowM, TextM } from '@synerise/ds-icon';
4
4
  import { NOOP } from '@synerise/ds-utils';
5
- import * as S from './style/Factors.style';
6
5
  import FactorTypeSelector from './FactorTypeSelector/FactorTypeSelector';
7
- import FactorValue from './FactorValue/FactorValue';
8
- import DynamicKey from './FactorValue/DynamicKey/DynamicKey';
6
+ import { Array } from './FactorValue/Array/Array';
9
7
  import DateInput from './FactorValue/Date/Date';
8
+ import DateRangeInput from './FactorValue/DateRange/DateRange';
9
+ import DynamicKey from './FactorValue/DynamicKey/DynamicKey';
10
+ import FactorValue from './FactorValue/FactorValue';
10
11
  import FormulaInput from './FactorValue/Formula/Formula';
11
- import TextInput from './FactorValue/Text/Text';
12
- import ParameterInput from './FactorValue/Parameter/Parameter';
13
12
  import NumberInput from './FactorValue/Number/NumberInput';
14
- import DateRangeInput from './FactorValue/DateRange/DateRange';
13
+ import ParameterInput from './FactorValue/Parameter/Parameter';
15
14
  import RelativeDateInput from './FactorValue/RelativeDate/RelativeDate';
15
+ import TextInput from './FactorValue/Text/Text';
16
16
  import { useTexts } from './hooks/useTexts';
17
- import { Array } from './FactorValue/Array/Array';
17
+ import * as S from './style/Factors.style';
18
18
  export var FACTOR_TYPE_MAPPING = {
19
19
  text: {
20
20
  icon: /*#__PURE__*/React.createElement(TextM, null),
@@ -100,6 +100,7 @@ var Factors = function Factors(_ref) {
100
100
  inputProps = _ref.inputProps,
101
101
  arrayProps = _ref.arrayProps,
102
102
  readOnly = _ref.readOnly,
103
+ factorValueExtraProps = _ref.factorValueExtraProps,
103
104
  getMenuEntryProps = _ref.getMenuEntryProps;
104
105
  var allTexts = useTexts(texts);
105
106
  var factorType = useMemo(function () {
@@ -114,7 +115,6 @@ var Factors = function Factors(_ref) {
114
115
  }).reduce(function (result, _ref3) {
115
116
  var type = _ref3[0],
116
117
  factorTypeData = _ref3[1];
117
- // eslint-disable-next-line no-param-reassign
118
118
  result[type] = factorTypeData;
119
119
  return result;
120
120
  }, {});
@@ -160,7 +160,8 @@ var Factors = function Factors(_ref) {
160
160
  error: error,
161
161
  allowClear: allowClear,
162
162
  readOnly: readOnly,
163
- getMenuEntryProps: getMenuEntryProps
163
+ getMenuEntryProps: getMenuEntryProps,
164
+ factorValueExtraProps: factorValueExtraProps
164
165
  }));
165
166
  };
166
167
  export default Factors;
@@ -1,16 +1,17 @@
1
- import type { ReactText, ReactNode, ComponentType } from 'react';
1
+ import type { ComponentType, ReactNode, ReactText } from 'react';
2
+ import type { AutocompleteProps } from '@synerise/ds-autocomplete';
2
3
  import type { CollectorValue } from '@synerise/ds-collector';
4
+ import type { Texts as DateRangeTexts } from '@synerise/ds-date-range-picker/dist/DateRangePicker.types';
3
5
  import type { DateFilter, RelativeUnits } from '@synerise/ds-date-range-picker/dist/date.types';
4
- import type { DateRangePickerTexts as DateRangeTexts } from '@synerise/ds-date-range-picker';
5
- import type { MenuItemProps } from '@synerise/ds-menu';
6
- import type { AutoResizeProp, InputProps } from '@synerise/ds-input';
7
6
  import type { InformationCardProps } from '@synerise/ds-information-card';
7
+ import type { AutoResizeProp, InputProps } from '@synerise/ds-input';
8
8
  import type { ListItemProps } from '@synerise/ds-list-item';
9
- import type { LiteralStringUnion, DeepPartial } from '@synerise/ds-utils';
9
+ import type { MenuItemProps } from '@synerise/ds-menu';
10
+ import type { DeepPartial, LiteralStringUnion } from '@synerise/ds-utils';
10
11
  import type { ArrayValueElement } from './FactorValue/Array/Array.types';
11
12
  export declare const ALL_FACTOR_TYPES: readonly ["text", "number", "parameter", "contextParameter", "dynamicKey", "formula", "array", "date", "relativeDate", "dateRange"];
12
- export type FactorType = LiteralStringUnion<typeof ALL_FACTOR_TYPES[number]>;
13
- export type DefinedFactorTypes = typeof ALL_FACTOR_TYPES[number];
13
+ export type FactorType = LiteralStringUnion<(typeof ALL_FACTOR_TYPES)[number]>;
14
+ export type DefinedFactorTypes = (typeof ALL_FACTOR_TYPES)[number];
14
15
  export type RelativeDateUnit = Exclude<RelativeUnits, 'SINCE'>;
15
16
  export type RelativeTimeRelation = 'BEFORE' | 'AFTER';
16
17
  export type RelativeDateValueType = {
@@ -134,6 +135,17 @@ export type FactorsTexts = {
134
135
  };
135
136
  };
136
137
  export type FactorTypeMapping = Record<DefinedFactorTypes, Partial<SelectedFactorType>>;
138
+ type InputPropKeys = 'icon1' | 'icon1Tooltip' | 'icon2' | 'icon2Tooltip';
139
+ export type ExtraPropsMapping = {
140
+ text: {
141
+ inputProps?: Pick<InputProps, InputPropKeys>;
142
+ autoCompleteProps?: Partial<AutocompleteProps>;
143
+ };
144
+ dynamicKey: {
145
+ keyInputProps?: Pick<InputProps, InputPropKeys>;
146
+ valueInputProps?: Pick<InputProps, InputPropKeys>;
147
+ };
148
+ };
137
149
  export type ArrayProps = {
138
150
  itemType?: ArrayItemType;
139
151
  limit?: number;
@@ -150,6 +162,7 @@ export type FactorsProps = {
150
162
  selectedFactorType: FactorType;
151
163
  defaultFactorType: FactorType;
152
164
  customFactorValueComponents?: Partial<FactorTypeMapping>;
165
+ factorValueExtraProps?: Partial<ExtraPropsMapping>;
153
166
  getPopupContainerOverride?: (trigger: HTMLElement | null) => HTMLElement;
154
167
  onActivate?: () => void;
155
168
  onDeactivate?: () => void;
@@ -199,11 +212,11 @@ export type FactorTypeSelectorProps = Pick<FactorsProps, 'unavailableFactorTypes
199
212
  [k in DefinedFactorTypes]: string;
200
213
  };
201
214
  };
202
- export type FactorValueProps = Pick<FactorsProps, 'onChangeValue' | 'onParamsClick' | 'value' | 'selectedFactorType' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'formulaEditor' | 'opened' | 'loading' | 'factorKey' | 'preventAutoloadData' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'allowClear' | 'inputProps' | 'autoResize' | 'readOnly' | 'relativeDateProps' | 'arrayProps' | 'getMenuEntryProps'> & {
215
+ export type FactorValueProps = Pick<FactorsProps, 'onChangeValue' | 'onParamsClick' | 'value' | 'selectedFactorType' | 'parameters' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'formulaEditor' | 'opened' | 'loading' | 'factorKey' | 'preventAutoloadData' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'allowClear' | 'inputProps' | 'autoResize' | 'readOnly' | 'relativeDateProps' | 'arrayProps' | 'getMenuEntryProps' | 'factorValueExtraProps'> & {
203
216
  texts: FactorsTexts;
204
217
  selectedFactor: SelectedFactorType;
205
218
  };
206
- export type FactorValueComponentProps = Pick<FactorsProps, 'value' | 'parameters' | 'allowClear' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'opened' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'inputProps' | 'autoResize' | 'readOnly' | 'arrayProps' | 'getMenuEntryProps'> & {
219
+ export type FactorValueComponentProps = Pick<FactorsProps, 'value' | 'parameters' | 'allowClear' | 'autocompleteText' | 'withoutTypeSelector' | 'textType' | 'opened' | 'getPopupContainerOverride' | 'onActivate' | 'onDeactivate' | 'error' | 'inputProps' | 'autoResize' | 'readOnly' | 'arrayProps' | 'getMenuEntryProps' | 'factorValueExtraProps'> & {
207
220
  texts: FactorsTexts;
208
221
  onChange: (value: FactorValueType) => void;
209
222
  factorType: FactorType;
@@ -242,3 +255,4 @@ export type FormulaModalProps = {
242
255
  texts: FactorsTexts;
243
256
  formulaEditor?: ReactNode;
244
257
  };
258
+ export {};
@@ -1,3 +1,3 @@
1
- import type { DeepPartial } from '@synerise/ds-utils';
1
+ import { type DeepPartial } from '@synerise/ds-utils';
2
2
  import type { FactorsTexts } from '../Factors.types';
3
3
  export declare const useTexts: (defaultTexts?: DeepPartial<FactorsTexts>) => FactorsTexts;
@@ -1,6 +1,6 @@
1
+ import { merge } from 'lodash';
1
2
  import { useMemo } from 'react';
2
3
  import { useIntl } from 'react-intl';
3
- import { merge } from 'lodash';
4
4
  import { utils as dateRangePickerUtils } from '@synerise/ds-date-range-picker';
5
5
  export var useTexts = function useTexts(defaultTexts) {
6
6
  var intl = useIntl();
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export { default, FACTOR_TYPE_MAPPING as factorTypes } from './Factors';
2
- export { ALL_FACTOR_TYPES } from './Factors.types';
3
- export type { FactorType, DefinedFactorTypes, FactorsProps, FactorsTexts, ParameterValueType, ParameterItem, ParameterGroup, FactorValueComponentProps,
2
+ export { ALL_FACTOR_TYPES, type FactorType, type DefinedFactorTypes, type FactorsProps, type FactorsTexts, type ParameterValueType, type ParameterItem, type ParameterGroup, type FactorValueComponentProps,
4
3
  /**
5
4
  * @deprecated, use FactorValueComponentProps type instead
6
5
  */
7
- FactorValueComponentProps as InputProps, FactorValueType, FactorValueProps, DynamicKeyValueType, FormulaValueType, FactorTypeSelectorProps, FormulaModalProps, TextModalProps, ParameterDropdownProps, SelectedFactorType, } from './Factors.types';
6
+ type FactorValueComponentProps as InputProps, type FactorValueType, type FactorValueProps, type DynamicKeyValueType, type FormulaValueType, type FactorTypeSelectorProps, type FormulaModalProps, type TextModalProps, type ParameterDropdownProps, type SelectedFactorType, } from './Factors.types';
package/dist/index.js CHANGED
@@ -1,2 +1,6 @@
1
1
  export { default, FACTOR_TYPE_MAPPING as factorTypes } from './Factors';
2
- export { ALL_FACTOR_TYPES } from './Factors.types';
2
+ export { ALL_FACTOR_TYPES
3
+
4
+ /**
5
+ * @deprecated, use FactorValueComponentProps type instead
6
+ */ } from './Factors.types';
@@ -1,7 +1,7 @@
1
1
  import styled from 'styled-components';
2
2
  import { InputGroup } from '@synerise/ds-input';
3
3
  import { OuterWrapper } from '@synerise/ds-input/dist/Input.styles';
4
- import { InputGroupWrapper, InputGroupItem } from '@synerise/ds-input/dist/InputGroup.styles';
4
+ import { InputGroupItem, InputGroupWrapper } from '@synerise/ds-input/dist/InputGroup.styles';
5
5
  import { FactorInput } from '../FactorValue/FactorValue.style';
6
6
  export var Group = styled(InputGroup).withConfig({
7
7
  displayName: "Factorsstyle__Group",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-factors",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Factors UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,34 +34,34 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-alert": "^1.1.6",
38
- "@synerise/ds-autocomplete": "^1.1.8",
39
- "@synerise/ds-badge": "^1.0.12",
40
- "@synerise/ds-button": "^1.4.1",
41
- "@synerise/ds-button-group": "^1.1.5",
42
- "@synerise/ds-collector": "^1.2.1",
43
- "@synerise/ds-date-picker": "^1.1.10",
44
- "@synerise/ds-date-range-picker": "^1.3.9",
45
- "@synerise/ds-divider": "^1.0.12",
46
- "@synerise/ds-dropdown": "^1.0.14",
47
- "@synerise/ds-empty-states": "^1.0.11",
48
- "@synerise/ds-icon": "^1.5.3",
49
- "@synerise/ds-information-card": "^1.0.17",
50
- "@synerise/ds-inline-edit": "^1.0.16",
51
- "@synerise/ds-input": "^1.3.1",
52
- "@synerise/ds-input-number": "^1.2.2",
53
- "@synerise/ds-list-item": "^1.0.12",
54
- "@synerise/ds-menu": "^1.0.13",
55
- "@synerise/ds-modal": "^1.2.1",
56
- "@synerise/ds-result": "^1.0.13",
57
- "@synerise/ds-scrollbar": "^1.1.1",
58
- "@synerise/ds-search": "^1.2.1",
59
- "@synerise/ds-select": "^1.1.7",
60
- "@synerise/ds-skeleton": "^1.0.13",
61
- "@synerise/ds-tabs": "^1.0.15",
62
- "@synerise/ds-tag": "^1.1.11",
63
- "@synerise/ds-tooltip": "^1.1.11",
64
- "@synerise/ds-utils": "^1.3.0",
37
+ "@synerise/ds-alert": "^1.1.7",
38
+ "@synerise/ds-autocomplete": "^1.2.0",
39
+ "@synerise/ds-badge": "^1.0.13",
40
+ "@synerise/ds-button": "^1.4.2",
41
+ "@synerise/ds-button-group": "^1.1.6",
42
+ "@synerise/ds-collector": "^1.3.0",
43
+ "@synerise/ds-date-picker": "^1.1.11",
44
+ "@synerise/ds-date-range-picker": "^1.3.11",
45
+ "@synerise/ds-divider": "^1.0.13",
46
+ "@synerise/ds-dropdown": "^1.0.15",
47
+ "@synerise/ds-empty-states": "^1.0.12",
48
+ "@synerise/ds-icon": "^1.5.4",
49
+ "@synerise/ds-information-card": "^1.0.19",
50
+ "@synerise/ds-inline-edit": "^1.0.17",
51
+ "@synerise/ds-input": "^1.3.2",
52
+ "@synerise/ds-input-number": "^1.2.3",
53
+ "@synerise/ds-list-item": "^1.0.13",
54
+ "@synerise/ds-menu": "^1.0.14",
55
+ "@synerise/ds-modal": "^1.2.2",
56
+ "@synerise/ds-result": "^1.0.14",
57
+ "@synerise/ds-scrollbar": "^1.1.2",
58
+ "@synerise/ds-search": "^1.2.2",
59
+ "@synerise/ds-select": "^1.1.9",
60
+ "@synerise/ds-skeleton": "^1.0.14",
61
+ "@synerise/ds-tabs": "^1.0.16",
62
+ "@synerise/ds-tag": "^1.1.12",
63
+ "@synerise/ds-tooltip": "^1.1.12",
64
+ "@synerise/ds-utils": "^1.3.1",
65
65
  "copy-to-clipboard": "^3.3.3",
66
66
  "lodash": "^4.17.21",
67
67
  "react-window": "^1.8.5",
@@ -74,5 +74,5 @@
74
74
  "react-intl": ">=3.12.0 <= 6.8",
75
75
  "styled-components": "^5.3.3"
76
76
  },
77
- "gitHead": "11fe1d29b2ac23e70c3d5e6ce8ae20201a619a34"
77
+ "gitHead": "2161bdb04f3db0f79b7d0465ce6b41121f1543ef"
78
78
  }