@synerise/ds-format-picker 0.5.11 → 0.5.13

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,22 @@
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.5.13](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@0.5.12...@synerise/ds-format-picker@0.5.13) (2024-10-28)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-format-picker
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.5.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@0.5.11...@synerise/ds-format-picker@0.5.12) (2024-10-23)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-format-picker
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.5.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@0.5.10...@synerise/ds-format-picker@0.5.11) (2024-10-14)
7
23
 
8
24
  **Note:** Version bump only for package @synerise/ds-format-picker
@@ -42,4 +42,5 @@ export type FormatPickerProps = {
42
42
  currenciesConfig?: CurrencyConfig[];
43
43
  buttonType?: string;
44
44
  disabled?: boolean;
45
+ maxFixedLength?: number;
45
46
  };
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { FormatPickerProps } from './FomartPicker.types';
3
- declare const FormatPicker: ({ onUseSeparatorChange, onFixedLengthChange, onDataFormatChange, onCurrencyChange, onCompactNumbersChange, onSetDefault, onFormattedValueChange, value, format, text, currenciesConfig, buttonType, disabled, }: FormatPickerProps) => React.JSX.Element;
3
+ declare const FormatPicker: ({ onUseSeparatorChange, onFixedLengthChange, onDataFormatChange, onCurrencyChange, onCompactNumbersChange, onSetDefault, onFormattedValueChange, value, format, text, currenciesConfig, buttonType, disabled, maxFixedLength, }: FormatPickerProps) => React.JSX.Element;
4
4
  export default FormatPicker;
@@ -26,7 +26,8 @@ var FormatPicker = function FormatPicker(_ref) {
26
26
  currenciesConfig = _ref.currenciesConfig,
27
27
  _ref$buttonType = _ref.buttonType,
28
28
  buttonType = _ref$buttonType === void 0 ? 'tertiary' : _ref$buttonType,
29
- disabled = _ref.disabled;
29
+ disabled = _ref.disabled,
30
+ maxFixedLength = _ref.maxFixedLength;
30
31
  var intl = useIntl();
31
32
 
32
33
  var _useDataFormat = useDataFormat(),
@@ -127,7 +128,8 @@ var FormatPicker = function FormatPicker(_ref) {
127
128
  text: texts,
128
129
  currenciesConfig: currenciesConfig,
129
130
  disabled: disabled,
130
- getFormattedValue: getFormattedValue
131
+ getFormattedValue: getFormattedValue,
132
+ maxFixedLength: maxFixedLength
131
133
  }),
132
134
  placement: "topCenter"
133
135
  }, /*#__PURE__*/React.createElement(Button, {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { FormatSettingsProps } from './FormatSettings.types';
3
- declare const FormatSettings: ({ onCompactNumbersChange, onCurrencyChange, onDataFormatChange, onFixedLengthChange, onUseSeparatorChange, onSetDefault, getFormattedValue, format, text, currenciesConfig, disabled, }: FormatSettingsProps) => React.JSX.Element;
3
+ declare const FormatSettings: ({ onCompactNumbersChange, onCurrencyChange, onDataFormatChange, onFixedLengthChange, onUseSeparatorChange, onSetDefault, getFormattedValue, format, text, currenciesConfig, disabled, maxFixedLength, }: FormatSettingsProps) => React.JSX.Element;
4
4
  export default FormatSettings;
@@ -51,7 +51,8 @@ var FormatSettings = function FormatSettings(_ref) {
51
51
  text = _ref.text,
52
52
  _ref$currenciesConfig = _ref.currenciesConfig,
53
53
  currenciesConfig = _ref$currenciesConfig === void 0 ? DEFAULT_CURRENCIES_CONFIG : _ref$currenciesConfig,
54
- disabled = _ref.disabled;
54
+ disabled = _ref.disabled,
55
+ maxFixedLength = _ref.maxFixedLength;
55
56
  var intl = useIntl();
56
57
  var handleDecreaseFixedLength = useCallback(function () {
57
58
  if (format.fixedLength > 0) {
@@ -61,8 +62,10 @@ var FormatSettings = function FormatSettings(_ref) {
61
62
  }
62
63
  }, [onFixedLengthChange, format]);
63
64
  var handleIncreaseFixedLength = useCallback(function () {
64
- onFixedLengthChange(format.fixedLength + 1);
65
- }, [onFixedLengthChange, format]);
65
+ if (maxFixedLength === undefined || maxFixedLength > format.fixedLength) {
66
+ onFixedLengthChange(format.fixedLength + 1);
67
+ }
68
+ }, [onFixedLengthChange, format, maxFixedLength]);
66
69
  var selectedCurrency = useMemo(function () {
67
70
  return currenciesConfig.find(function (currency) {
68
71
  return currency.currency === format.currency;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-format-picker",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "FormatPicker UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,17 +34,17 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-button": "^0.21.13",
38
- "@synerise/ds-button-group": "^0.7.17",
39
- "@synerise/ds-checkbox": "^0.12.11",
37
+ "@synerise/ds-button": "^0.21.15",
38
+ "@synerise/ds-button-group": "^0.7.19",
39
+ "@synerise/ds-checkbox": "^0.12.13",
40
40
  "@synerise/ds-data-format": "^0.5.4",
41
- "@synerise/ds-dropdown": "^0.18.18",
42
- "@synerise/ds-icon": "^0.65.8",
43
- "@synerise/ds-list-item": "^0.4.13",
44
- "@synerise/ds-radio": "^0.12.7",
45
- "@synerise/ds-tooltip": "^0.14.43",
46
- "@synerise/ds-typography": "^0.16.0",
47
- "@synerise/ds-utils": "^0.30.0",
41
+ "@synerise/ds-dropdown": "^0.18.20",
42
+ "@synerise/ds-icon": "^0.66.1",
43
+ "@synerise/ds-list-item": "^0.4.15",
44
+ "@synerise/ds-radio": "^0.12.9",
45
+ "@synerise/ds-tooltip": "^0.14.45",
46
+ "@synerise/ds-typography": "^0.16.2",
47
+ "@synerise/ds-utils": "^0.30.1",
48
48
  "react-intl": "3.12.0"
49
49
  },
50
50
  "peerDependencies": {
@@ -52,5 +52,5 @@
52
52
  "react": ">=16.9.0 <= 17.0.2",
53
53
  "styled-components": "5.0.1"
54
54
  },
55
- "gitHead": "39c906a3f4d8ec9442e5780c6e6a387584eabce1"
55
+ "gitHead": "fbadaa2299668c527b52ecc66d61fc2165528bff"
56
56
  }