@synerise/ds-format-picker 1.1.23 → 1.1.25

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,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
+ ## [1.1.25](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@1.1.24...@synerise/ds-format-picker@1.1.25) (2026-03-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-format-picker
9
+
10
+ ## [1.1.24](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@1.1.23...@synerise/ds-format-picker@1.1.24) (2026-03-20)
11
+
12
+ **Note:** Version bump only for package @synerise/ds-format-picker
13
+
6
14
  ## [1.1.23](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@1.1.22...@synerise/ds-format-picker@1.1.23) (2026-03-09)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-format-picker
package/README.md CHANGED
@@ -37,31 +37,36 @@ import FormatPicker from '@synerise/ds-format-picker'
37
37
 
38
38
  ## API
39
39
 
40
- | Property | Description | Type | Default |
41
- | ---------------------- | ------------------------------ | ---------------------------------- | ------- |
42
- | format | Format configuration | FormattingValue | - |
43
- | value | Example value | number | - |
44
- | onDataFormatChange | Data format change handler | (format) => void} | - |
45
- | onCurrencyChange | Currency change handler | (currency: CurrencyType) => void | - |
46
- | onUseSeparatorChange | Use separator change handler | (useSeparator: boolean) => void} | - |
47
- | onCompactNumbersChange | Compact numbers change handler | (compactNumbers: boolean) => void} | - |
48
- | onFixedLengthChange | Fixed length change handler | (fixedLength) => void | - |
49
- | onSetDefault | Set default value of format | () => void | - |
50
- | text | Set of custom labels | Texts | - |
51
- | buttonType | type of button | string | - |
40
+ | Property | Description | Type | Default |
41
+ | ---------------------- | ------------------------------------------------------ | ------------------------------------------- | --------------- |
42
+ | format | Current format configuration | `FormattingValue` | - |
43
+ | value | Example number shown in the trigger button label | `number` | - |
44
+ | onDataFormatChange | Called when user selects a data format | `(format: FormattingDataFormat) => void` | - |
45
+ | onCurrencyChange | Called when a currency is selected | `(currency: CurrencyType) => void` | - |
46
+ | onUseSeparatorChange | Called when the 1000-separator checkbox changes | `(useSeparator: boolean) => void` | - |
47
+ | onCompactNumbersChange | Called when the compact numbers checkbox changes | `(compactNumbers: boolean) => void` | - |
48
+ | onFixedLengthChange | Called when decimal places are incremented/decremented | `(fixedLength: number) => void` | - |
49
+ | onSetDefault | If provided, renders a "Set default" footer button | `() => void` | - |
50
+ | onFormattedValueChange | Called whenever the formatted display value changes | `(formattedValue: string) => void` | - |
51
+ | text | Override any subset of UI labels | `Partial<FormatPickerTexts>` | - |
52
+ | currenciesConfig | Custom currency list for the cash dropdown | `CurrencyConfig[]` | USD/EUR/PLN/JPY |
53
+ | buttonType | DS button type for the trigger button | `string` | `'tertiary'` |
54
+ | disabled | Disables the trigger and all panel controls | `boolean` | - |
55
+ | maxFixedLength | Upper bound for decimal places | `number` | - |
52
56
 
53
57
  ### Texts
54
58
 
55
59
  | Property | Description | Type | Default |
56
60
  | -------------- | --------------------------------- | ------------------------ | -------------------- |
57
- | header | Header of format settings | string \ React.ReactNode | `Number format` |
58
- | format | Format label | string \ React.ReactNode | `Format` |
59
- | numeric | Numeric type of format tooltip | string \ React.ReactNode | `Numeric` |
60
- | cash | Cash type of format tooltip | string \ React.ReactNode | `Cash` |
61
- | percentage | Percentage type of format tooltip | string \ React.ReactNode | `Percentage` |
62
- | setDefault | Set default format button label | string \ React.ReactNode | `Set default` |
63
- | useSeparator | Use 1000 separator checkbox label | string \ React.ReactNode | `Use 1000 separator` |
64
- | compactNumbers | Compact number checkbox label | string \ React.ReactNode | `Compact humbers` |
61
+ | header | Header of format settings | `string \| ReactNode` | `Number format` |
62
+ | format | Format label | `string \| ReactNode` | `Format` |
63
+ | numeric | Numeric type of format tooltip | `string \| ReactNode` | `Numeric` |
64
+ | cash | Cash type of format tooltip | `string \| ReactNode` | `Cash` |
65
+ | percentage | Percentage type of format tooltip | `string \| ReactNode` | `Percentage` |
66
+ | setDefault | Set default format button label | `string \| ReactNode` | `Set default` |
67
+ | useSeparator | Use 1000 separator checkbox label | `string \| ReactNode` | `Use 1000 separator` |
68
+ | compactNumbers | Compact numbers checkbox label | `string \| ReactNode` | `Use compact numbers` |
69
+ | currencyMenuItemPrefix | Prefix shown before the example value in currency rows | `string` | `'e.g.'` |
65
70
 
66
71
  ### FormattingValue
67
72
 
@@ -75,7 +80,7 @@ import FormatPicker from '@synerise/ds-format-picker'
75
80
 
76
81
  ### CurrencyType
77
82
 
78
- Available values: `USD` | `EUR` | `PLN` | `JPY`
83
+ `string` — any currency code string. The default `currenciesConfig` includes `USD`, `EUR`, `PLN`, `JPY`, but the type is not restricted to those values.
79
84
 
80
85
  ### FormattingDataFormat
81
86
 
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  export type CurrencyType = string;
3
3
  export type FormattingDataFormat = 'numeric' | 'percent' | 'cash';
4
4
  export type FormattingValue = {
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { type FormatPickerProps } from './FomartPicker.types';
1
+ import { default as React } from 'react';
2
+ import { FormatPickerProps } from './FomartPicker.types';
3
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;
@@ -1,135 +1,119 @@
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, { useCallback, useEffect, useMemo } from 'react';
3
- import { useIntl } from 'react-intl';
4
- import Button from '@synerise/ds-button';
5
- import { useDataFormat } from '@synerise/ds-core';
6
- import Dropdown from '@synerise/ds-dropdown';
7
- import Icon, { HashM } from '@synerise/ds-icon';
8
- import FormatSettings from './FormatSettings/FormatSettings';
9
- var FormatPicker = function FormatPicker(_ref) {
10
- var onUseSeparatorChange = _ref.onUseSeparatorChange,
11
- onFixedLengthChange = _ref.onFixedLengthChange,
12
- onDataFormatChange = _ref.onDataFormatChange,
13
- onCurrencyChange = _ref.onCurrencyChange,
14
- onCompactNumbersChange = _ref.onCompactNumbersChange,
15
- onSetDefault = _ref.onSetDefault,
16
- onFormattedValueChange = _ref.onFormattedValueChange,
17
- value = _ref.value,
18
- format = _ref.format,
19
- text = _ref.text,
20
- currenciesConfig = _ref.currenciesConfig,
21
- _ref$buttonType = _ref.buttonType,
22
- buttonType = _ref$buttonType === void 0 ? 'tertiary' : _ref$buttonType,
23
- disabled = _ref.disabled,
24
- maxFixedLength = _ref.maxFixedLength;
25
- var intl = useIntl();
26
- var _useDataFormat = useDataFormat(),
27
- formatValue = _useDataFormat.formatValue;
28
- var texts = useMemo(function () {
29
- return _extends({
30
- header: intl.formatMessage({
31
- id: 'DS.FORMAT-PICKER.HEADER',
32
- defaultMessage: 'Number format'
33
- }),
34
- format: intl.formatMessage({
35
- id: 'DS.FORMAT-PICKER.FORMAT',
36
- defaultMessage: 'Format'
37
- }),
38
- numeric: intl.formatMessage({
39
- id: 'DS.FORMAT-PICKER.NUMERIC',
40
- defaultMessage: 'Numeric'
41
- }),
42
- cash: intl.formatMessage({
43
- id: 'DS.FORMAT-PICKER.CASH',
44
- defaultMessage: 'Cash'
45
- }),
46
- percentage: intl.formatMessage({
47
- id: 'DS.FORMAT-PICKER.PERCENTAGE',
48
- defaultMessage: 'Percentage'
49
- }),
50
- setDefault: intl.formatMessage({
51
- id: 'DS.FORMAT-PICKER.SET-DEFAULT',
52
- defaultMessage: 'Set default'
53
- }),
54
- useSeparator: intl.formatMessage({
55
- id: 'DS.FORMAT-PICKER.USE-SEPARATOR',
56
- defaultMessage: 'Use 1000 separator'
57
- }),
58
- currencyMenuItemPrefix: intl.formatMessage({
59
- id: 'DS.FORMAT-PICKER.EG',
60
- defaultMessage: 'e.g.'
61
- }),
62
- compactNumbers: intl.formatMessage({
63
- id: 'DS.FORMAT-PICKER.COMPACT-NUMBERS',
64
- defaultMessage: 'Use compact numbers'
65
- })
66
- }, text);
67
- }, [text, intl]);
68
- var getFormattedValue = useCallback(function (overrideOptions) {
69
- var useSeparator = format.useSeparator,
70
- compactNumbers = format.compactNumbers,
71
- currency = format.currency,
72
- dataFormat = format.dataFormat,
73
- fixedLength = format.fixedLength;
74
- var options = {
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useCallback, useEffect } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import Button from "@synerise/ds-button";
5
+ import { useDataFormat } from "@synerise/ds-core";
6
+ import Dropdown from "@synerise/ds-dropdown";
7
+ import Icon, { HashM } from "@synerise/ds-icon";
8
+ import FormatSettings from "./FormatSettings/FormatSettings.js";
9
+ const FormatPicker = ({
10
+ onUseSeparatorChange,
11
+ onFixedLengthChange,
12
+ onDataFormatChange,
13
+ onCurrencyChange,
14
+ onCompactNumbersChange,
15
+ onSetDefault,
16
+ onFormattedValueChange,
17
+ value,
18
+ format,
19
+ text,
20
+ currenciesConfig,
21
+ buttonType = "tertiary",
22
+ disabled,
23
+ maxFixedLength
24
+ }) => {
25
+ const intl = useIntl();
26
+ const {
27
+ formatValue
28
+ } = useDataFormat();
29
+ const texts = useMemo(() => ({
30
+ header: intl.formatMessage({
31
+ id: "DS.FORMAT-PICKER.HEADER",
32
+ defaultMessage: "Number format"
33
+ }),
34
+ format: intl.formatMessage({
35
+ id: "DS.FORMAT-PICKER.FORMAT",
36
+ defaultMessage: "Format"
37
+ }),
38
+ numeric: intl.formatMessage({
39
+ id: "DS.FORMAT-PICKER.NUMERIC",
40
+ defaultMessage: "Numeric"
41
+ }),
42
+ cash: intl.formatMessage({
43
+ id: "DS.FORMAT-PICKER.CASH",
44
+ defaultMessage: "Cash"
45
+ }),
46
+ percentage: intl.formatMessage({
47
+ id: "DS.FORMAT-PICKER.PERCENTAGE",
48
+ defaultMessage: "Percentage"
49
+ }),
50
+ setDefault: intl.formatMessage({
51
+ id: "DS.FORMAT-PICKER.SET-DEFAULT",
52
+ defaultMessage: "Set default"
53
+ }),
54
+ useSeparator: intl.formatMessage({
55
+ id: "DS.FORMAT-PICKER.USE-SEPARATOR",
56
+ defaultMessage: "Use 1000 separator"
57
+ }),
58
+ currencyMenuItemPrefix: intl.formatMessage({
59
+ id: "DS.FORMAT-PICKER.EG",
60
+ defaultMessage: "e.g."
61
+ }),
62
+ compactNumbers: intl.formatMessage({
63
+ id: "DS.FORMAT-PICKER.COMPACT-NUMBERS",
64
+ defaultMessage: "Use compact numbers"
65
+ }),
66
+ ...text
67
+ }), [text, intl]);
68
+ const getFormattedValue = useCallback((overrideOptions) => {
69
+ const {
70
+ useSeparator,
71
+ compactNumbers,
72
+ currency,
73
+ dataFormat,
74
+ fixedLength
75
+ } = format;
76
+ let options = {
75
77
  useGrouping: useSeparator
76
78
  };
77
79
  if (compactNumbers) {
78
80
  options = {
79
- notation: 'compact'
81
+ notation: "compact"
80
82
  };
81
83
  }
82
- if (dataFormat === 'cash' && currency) {
83
- options = _extends({}, options, {
84
- currency: currency,
85
- style: 'currency'
86
- });
84
+ if (dataFormat === "cash" && currency) {
85
+ options = {
86
+ ...options,
87
+ currency,
88
+ style: "currency"
89
+ };
87
90
  }
88
- if (dataFormat === 'percent') {
89
- options = _extends({}, options, {
90
- suffix: compactNumbers ? ' %' : '%'
91
- });
91
+ if (dataFormat === "percent") {
92
+ options = {
93
+ ...options,
94
+ suffix: compactNumbers ? " %" : "%"
95
+ };
92
96
  }
93
- if (typeof fixedLength === 'number') {
94
- options = _extends({}, options, {
97
+ if (typeof fixedLength === "number") {
98
+ options = {
99
+ ...options,
95
100
  minimumFractionDigits: fixedLength,
96
- maximumFractionDigits: fixedLength
97
- }, overrideOptions);
101
+ maximumFractionDigits: fixedLength,
102
+ ...overrideOptions
103
+ };
98
104
  }
99
105
  return formatValue(value, options);
100
106
  }, [value, format, formatValue]);
101
- useEffect(function () {
107
+ useEffect(() => {
102
108
  onFormattedValueChange && onFormattedValueChange(getFormattedValue());
103
109
  }, [getFormattedValue, onFormattedValueChange]);
104
- return /*#__PURE__*/React.createElement(Dropdown, {
105
- trigger: ['click'],
106
- disabled: disabled,
107
- overlay: /*#__PURE__*/React.createElement(FormatSettings, {
108
- onCurrencyChange: onCurrencyChange,
109
- onFixedLengthChange: onFixedLengthChange,
110
- onDataFormatChange: onDataFormatChange,
111
- onCompactNumbersChange: onCompactNumbersChange,
112
- onUseSeparatorChange: onUseSeparatorChange,
113
- onSetDefault: onSetDefault,
114
- format: format,
115
- text: texts,
116
- currenciesConfig: currenciesConfig,
117
- disabled: disabled,
118
- getFormattedValue: getFormattedValue,
119
- maxFixedLength: maxFixedLength
120
- }),
121
- placement: "topCenter",
122
- popoverProps: {
123
- testId: 'format-picker'
124
- },
125
- size: "auto",
126
- asChild: true
127
- }, /*#__PURE__*/React.createElement(Button, {
128
- type: buttonType,
129
- mode: "icon-label",
130
- disabled: disabled
131
- }, /*#__PURE__*/React.createElement(Icon, {
132
- component: /*#__PURE__*/React.createElement(HashM, null)
133
- }), texts.format + " " + getFormattedValue()));
110
+ return /* @__PURE__ */ jsx(Dropdown, { trigger: ["click"], disabled, overlay: /* @__PURE__ */ jsx(FormatSettings, { onCurrencyChange, onFixedLengthChange, onDataFormatChange, onCompactNumbersChange, onUseSeparatorChange, onSetDefault, format, text: texts, currenciesConfig, disabled, getFormattedValue, maxFixedLength }), placement: "topCenter", popoverProps: {
111
+ testId: "format-picker"
112
+ }, size: "auto", asChild: true, children: /* @__PURE__ */ jsxs(Button, { type: buttonType, mode: "icon-label", disabled, children: [
113
+ /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(HashM, {}) }),
114
+ `${texts.format} ${getFormattedValue()}`
115
+ ] }) });
116
+ };
117
+ export {
118
+ FormatPicker as default
134
119
  };
135
- export default FormatPicker;
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { type FormatSettingsProps } from './FormatSettings.types';
1
+ import { default as React } from 'react';
2
+ import { FormatSettingsProps } from './FormatSettings.types';
3
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;
@@ -1,161 +1,105 @@
1
- import React, { useCallback, useMemo } from 'react';
2
- import { useIntl } from 'react-intl';
3
- import Button from '@synerise/ds-button';
4
- import ButtonGroup from '@synerise/ds-button-group';
5
- import Checkbox from '@synerise/ds-checkbox';
6
- import Dropdown from '@synerise/ds-dropdown';
7
- import Icon, { AngleDownS, Coin2M, CommaDecM, CommaIncM, HashM, PercentM } from '@synerise/ds-icon';
8
- import Radio from '@synerise/ds-radio';
9
- import Tooltip from '@synerise/ds-tooltip';
10
- import { Title } from '@synerise/ds-typography';
11
- import * as S from './FormatSettings.styles';
12
- var DEFAULT_CURRENCIES_CONFIG = [{
13
- currency: 'USD',
14
- label: 'Dollar (US)'
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import Button from "@synerise/ds-button";
5
+ import ButtonGroup from "@synerise/ds-button-group";
6
+ import Checkbox from "@synerise/ds-checkbox";
7
+ import Dropdown from "@synerise/ds-dropdown";
8
+ import Icon, { CommaDecM, CommaIncM, AngleDownS, HashM, PercentM, Coin2M } from "@synerise/ds-icon";
9
+ import Radio from "@synerise/ds-radio";
10
+ import Tooltip from "@synerise/ds-tooltip";
11
+ import { Title } from "@synerise/ds-typography";
12
+ import { FormatSettingsContainer, FormatSettingsWrapper, FormatSettings as FormatSettings$1, WrapperButtons, FixedLengthButton, FormatOptions, DropdownTrigger, DropdownValue, DropdownWrapper, ListItem, FormatFooter } from "./FormatSettings.styles.js";
13
+ const DEFAULT_CURRENCIES_CONFIG = [{
14
+ currency: "USD",
15
+ label: "Dollar (US)"
15
16
  }, {
16
- currency: 'EUR',
17
- label: 'Euro (EU)'
17
+ currency: "EUR",
18
+ label: "Euro (EU)"
18
19
  }, {
19
- currency: 'PLN',
20
- label: 'Złoty (PL)'
20
+ currency: "PLN",
21
+ label: "Złoty (PL)"
21
22
  }, {
22
- currency: 'JPY',
23
- label: 'Yen (JP)'
23
+ currency: "JPY",
24
+ label: "Yen (JP)"
24
25
  }];
25
- var getFormattingTypes = function getFormattingTypes(intl, text) {
26
- return [{
27
- format: 'numeric',
28
- icon: /*#__PURE__*/React.createElement(HashM, null),
29
- tooltip: text.numeric
30
- }, {
31
- format: 'percent',
32
- icon: /*#__PURE__*/React.createElement(PercentM, null),
33
- tooltip: text.percentage
34
- }, {
35
- format: 'cash',
36
- icon: /*#__PURE__*/React.createElement(Coin2M, null),
37
- tooltip: text.cash
38
- }];
39
- };
40
- var FormatSettings = function FormatSettings(_ref) {
41
- var onCompactNumbersChange = _ref.onCompactNumbersChange,
42
- onCurrencyChange = _ref.onCurrencyChange,
43
- onDataFormatChange = _ref.onDataFormatChange,
44
- onFixedLengthChange = _ref.onFixedLengthChange,
45
- onUseSeparatorChange = _ref.onUseSeparatorChange,
46
- onSetDefault = _ref.onSetDefault,
47
- getFormattedValue = _ref.getFormattedValue,
48
- format = _ref.format,
49
- text = _ref.text,
50
- _ref$currenciesConfig = _ref.currenciesConfig,
51
- currenciesConfig = _ref$currenciesConfig === void 0 ? DEFAULT_CURRENCIES_CONFIG : _ref$currenciesConfig,
52
- disabled = _ref.disabled,
53
- maxFixedLength = _ref.maxFixedLength;
54
- var intl = useIntl();
55
- var handleSelectCurrency = function handleSelectCurrency(currency) {
26
+ const getFormattingTypes = (intl, text) => [{
27
+ format: "numeric",
28
+ icon: /* @__PURE__ */ jsx(HashM, {}),
29
+ tooltip: text.numeric
30
+ }, {
31
+ format: "percent",
32
+ icon: /* @__PURE__ */ jsx(PercentM, {}),
33
+ tooltip: text.percentage
34
+ }, {
35
+ format: "cash",
36
+ icon: /* @__PURE__ */ jsx(Coin2M, {}),
37
+ tooltip: text.cash
38
+ }];
39
+ const FormatSettings = ({
40
+ onCompactNumbersChange,
41
+ onCurrencyChange,
42
+ onDataFormatChange,
43
+ onFixedLengthChange,
44
+ onUseSeparatorChange,
45
+ onSetDefault,
46
+ getFormattedValue,
47
+ format,
48
+ text,
49
+ currenciesConfig = DEFAULT_CURRENCIES_CONFIG,
50
+ disabled,
51
+ maxFixedLength
52
+ }) => {
53
+ const intl = useIntl();
54
+ const handleSelectCurrency = (currency) => {
56
55
  onCurrencyChange(currency);
57
56
  };
58
- var handleDecreaseFixedLength = useCallback(function () {
57
+ const handleDecreaseFixedLength = useCallback(() => {
59
58
  if (format.fixedLength > 0) {
60
59
  onFixedLengthChange(format.fixedLength - 1);
61
60
  } else {
62
61
  onFixedLengthChange(0);
63
62
  }
64
63
  }, [onFixedLengthChange, format]);
65
- var handleIncreaseFixedLength = useCallback(function () {
66
- if (maxFixedLength === undefined || maxFixedLength > format.fixedLength) {
64
+ const handleIncreaseFixedLength = useCallback(() => {
65
+ if (maxFixedLength === void 0 || maxFixedLength > format.fixedLength) {
67
66
  onFixedLengthChange(format.fixedLength + 1);
68
67
  }
69
68
  }, [onFixedLengthChange, format, maxFixedLength]);
70
- var selectedCurrency = useMemo(function () {
71
- return currenciesConfig.find(function (currency) {
72
- return currency.currency === format.currency;
73
- });
69
+ const selectedCurrency = useMemo(() => {
70
+ return currenciesConfig.find((currency) => currency.currency === format.currency);
74
71
  }, [currenciesConfig, format]);
75
- return /*#__PURE__*/React.createElement(S.FormatSettingsContainer, {
76
- "data-testid": "ds-format-picker-overlay"
77
- }, /*#__PURE__*/React.createElement(S.FormatSettingsWrapper, null, /*#__PURE__*/React.createElement(Title, {
78
- level: 6
79
- }, text.header), /*#__PURE__*/React.createElement(S.FormatSettings, null, /*#__PURE__*/React.createElement(Radio.Group, {
80
- defaultValue: format.dataFormat,
81
- onChange: function onChange(event) {
82
- return onDataFormatChange(event.target.value);
83
- }
84
- }, /*#__PURE__*/React.createElement(ButtonGroup, null, getFormattingTypes(intl, text).map(function (type) {
85
- return /*#__PURE__*/React.createElement(Tooltip, {
86
- key: type.format,
87
- trigger: ['hover'],
88
- title: type.tooltip
89
- }, /*#__PURE__*/React.createElement(Button, {
90
- type: type.format === format.dataFormat ? 'primary' : 'secondary',
91
- mode: "icon",
92
- "data-testid": "ds-format-picker-type-" + type.format,
93
- onClick: function onClick() {
94
- return onDataFormatChange(type.format);
95
- },
96
- disabled: disabled
97
- }, /*#__PURE__*/React.createElement(Icon, {
98
- component: type.icon
99
- })));
100
- }))), /*#__PURE__*/React.createElement(S.WrapperButtons, {
101
- buttonsPosition: "right"
102
- }, /*#__PURE__*/React.createElement(S.FixedLengthButton, {
103
- type: "secondary",
104
- mode: "icon",
105
- onClick: handleDecreaseFixedLength,
106
- disabled: disabled
107
- }, /*#__PURE__*/React.createElement(Icon, {
108
- component: /*#__PURE__*/React.createElement(CommaDecM, null)
109
- })), /*#__PURE__*/React.createElement(S.FixedLengthButton, {
110
- type: "secondary",
111
- mode: "icon",
112
- onClick: handleIncreaseFixedLength,
113
- disabled: disabled
114
- }, /*#__PURE__*/React.createElement(Icon, {
115
- component: /*#__PURE__*/React.createElement(CommaIncM, null)
116
- })))), /*#__PURE__*/React.createElement(S.FormatOptions, null, format.dataFormat === 'cash' && /*#__PURE__*/React.createElement(Dropdown, {
117
- trigger: ['click'],
118
- disabled: disabled,
119
- hideOnItemClick: true,
120
- popoverProps: {
121
- testId: 'format-picker-settings'
122
- },
123
- asChild: true,
124
- size: "match-trigger",
125
- overlay: /*#__PURE__*/React.createElement(S.DropdownWrapper, null, currenciesConfig.map(function (_ref2) {
126
- var currency = _ref2.currency,
127
- label = _ref2.label;
128
- return /*#__PURE__*/React.createElement(S.ListItem, {
129
- key: currency,
130
- suffixel: text.currencyMenuItemPrefix + " " + getFormattedValue({
131
- currency: currency
132
- }),
133
- onClick: function onClick() {
72
+ return /* @__PURE__ */ jsxs(FormatSettingsContainer, { "data-testid": "ds-format-picker-overlay", children: [
73
+ /* @__PURE__ */ jsxs(FormatSettingsWrapper, { children: [
74
+ /* @__PURE__ */ jsx(Title, { level: 6, children: text.header }),
75
+ /* @__PURE__ */ jsxs(FormatSettings$1, { children: [
76
+ /* @__PURE__ */ jsx(Radio.Group, { defaultValue: format.dataFormat, onChange: (event) => onDataFormatChange(event.target.value), children: /* @__PURE__ */ jsx(ButtonGroup, { children: getFormattingTypes(intl, text).map((type) => /* @__PURE__ */ jsx(Tooltip, { trigger: ["hover"], title: type.tooltip, children: /* @__PURE__ */ jsx(Button, { type: type.format === format.dataFormat ? "primary" : "secondary", mode: "icon", "data-testid": `ds-format-picker-type-${type.format}`, onClick: () => onDataFormatChange(type.format), disabled, children: /* @__PURE__ */ jsx(Icon, { component: type.icon }) }) }, type.format)) }) }),
77
+ /* @__PURE__ */ jsxs(WrapperButtons, { buttonsPosition: "right", children: [
78
+ /* @__PURE__ */ jsx(FixedLengthButton, { type: "secondary", mode: "icon", onClick: handleDecreaseFixedLength, disabled, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CommaDecM, {}) }) }),
79
+ /* @__PURE__ */ jsx(FixedLengthButton, { type: "secondary", mode: "icon", onClick: handleIncreaseFixedLength, disabled, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CommaIncM, {}) }) })
80
+ ] })
81
+ ] }),
82
+ /* @__PURE__ */ jsxs(FormatOptions, { children: [
83
+ format.dataFormat === "cash" && /* @__PURE__ */ jsx(Dropdown, { trigger: ["click"], disabled, hideOnItemClick: true, popoverProps: {
84
+ testId: "format-picker-settings"
85
+ }, asChild: true, size: "match-trigger", overlay: /* @__PURE__ */ jsx(DropdownWrapper, { children: currenciesConfig.map(({
86
+ currency,
87
+ label
88
+ }) => /* @__PURE__ */ jsx(ListItem, { suffixel: `${text.currencyMenuItemPrefix} ${getFormattedValue({
89
+ currency
90
+ })}`, onClick: () => {
134
91
  handleSelectCurrency(currency);
135
- }
136
- }, label);
137
- }))
138
- }, /*#__PURE__*/React.createElement(S.DropdownTrigger, {
139
- "data-testid": "ds-format-picker-currency-trigger"
140
- }, /*#__PURE__*/React.createElement(S.DropdownValue, null, selectedCurrency == null ? void 0 : selectedCurrency.label), /*#__PURE__*/React.createElement(Icon, {
141
- component: /*#__PURE__*/React.createElement(AngleDownS, null)
142
- }))), /*#__PURE__*/React.createElement(Checkbox, {
143
- onChange: function onChange(event) {
144
- return onUseSeparatorChange(event.target.checked);
145
- },
146
- checked: format.useSeparator,
147
- disabled: disabled
148
- }, text.useSeparator), /*#__PURE__*/React.createElement(Checkbox, {
149
- onChange: function onChange(event) {
150
- return onCompactNumbersChange(event.target.checked);
151
- },
152
- checked: format.compactNumbers,
153
- disabled: disabled
154
- }, text.compactNumbers))), onSetDefault && /*#__PURE__*/React.createElement(S.FormatFooter, null, /*#__PURE__*/React.createElement(Button, {
155
- "data-testid": "ds-format-picker-default-trigger",
156
- type: "ghost",
157
- onClick: onSetDefault,
158
- disabled: disabled
159
- }, text.setDefault)));
92
+ }, children: label }, currency)) }), children: /* @__PURE__ */ jsxs(DropdownTrigger, { "data-testid": "ds-format-picker-currency-trigger", children: [
93
+ /* @__PURE__ */ jsx(DropdownValue, { children: selectedCurrency?.label }),
94
+ /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleDownS, {}) })
95
+ ] }) }),
96
+ /* @__PURE__ */ jsx(Checkbox, { onChange: (event) => onUseSeparatorChange(event.target.checked), checked: format.useSeparator, disabled, children: text.useSeparator }),
97
+ /* @__PURE__ */ jsx(Checkbox, { onChange: (event) => onCompactNumbersChange(event.target.checked), checked: format.compactNumbers, disabled, children: text.compactNumbers })
98
+ ] })
99
+ ] }),
100
+ onSetDefault && /* @__PURE__ */ jsx(FormatFooter, { children: /* @__PURE__ */ jsx(Button, { "data-testid": "ds-format-picker-default-trigger", type: "ghost", onClick: onSetDefault, disabled, children: text.setDefault }) })
101
+ ] });
102
+ };
103
+ export {
104
+ FormatSettings as default
160
105
  };
161
- export default FormatSettings;
@@ -1,13 +1,13 @@
1
- import { type StyledButton } from '@synerise/ds-button';
2
- import { type StyledListItem } from '@synerise/ds-list-item';
3
- export declare const FormatSettingsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const FormatSettingsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export declare const FormatSettings: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- export declare const FormatOptions: import("styled-components").StyledComponent<"div", any, {}, never>;
7
- export declare const FormatFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
8
- export declare const DropdownTrigger: import("styled-components").StyledComponent<"div", any, {}, never>;
9
- export declare const DropdownValue: import("styled-components").StyledComponent<"span", any, {}, never>;
10
- export declare const DropdownWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ import { StyledButton } from '@synerise/ds-button';
2
+ import { StyledListItem } from '@synerise/ds-list-item';
3
+ export declare const FormatSettingsContainer: import('styled-components').StyledComponent<"div", any, {}, never>;
4
+ export declare const FormatSettingsWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
5
+ export declare const FormatSettings: import('styled-components').StyledComponent<"div", any, {}, never>;
6
+ export declare const FormatOptions: import('styled-components').StyledComponent<"div", any, {}, never>;
7
+ export declare const FormatFooter: import('styled-components').StyledComponent<"div", any, {}, never>;
8
+ export declare const DropdownTrigger: import('styled-components').StyledComponent<"div", any, {}, never>;
9
+ export declare const DropdownValue: import('styled-components').StyledComponent<"span", any, {}, never>;
10
+ export declare const DropdownWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
11
11
  export declare const ListItem: StyledListItem;
12
12
  export declare const FixedLengthButton: StyledButton;
13
- export declare const WrapperButtons: import("styled-components").StyledComponent<({ className, children, title, description, size, fullWidth, buttonsPosition, disabled, splitMode, compact, error, }: import("@synerise/ds-button-group").ButtonGroupProps) => React.JSX.Element, any, {}, never>;
13
+ export declare const WrapperButtons: import('styled-components').StyledComponent<({ className, children, title, description, size, fullWidth, buttonsPosition, disabled, splitMode, compact, error, }: import('@synerise/ds-button-group').ButtonGroupProps) => React.JSX.Element, any, {}, never>;
@@ -1,65 +1,62 @@
1
- import styled from 'styled-components';
2
- import Button from '@synerise/ds-button';
3
- import ButtonGroup from '@synerise/ds-button-group';
4
- import DSListItem from '@synerise/ds-list-item';
5
- import { SuffixWrapper } from '@synerise/ds-list-item/dist/components/Text/Text.styles';
6
- export var FormatSettingsContainer = styled.div.withConfig({
1
+ import styled from "styled-components";
2
+ import Button from "@synerise/ds-button";
3
+ import ButtonGroup from "@synerise/ds-button-group";
4
+ import DSListItem from "@synerise/ds-list-item";
5
+ import { SuffixWrapper } from "@synerise/ds-list-item/dist/components/Text/Text.styles";
6
+ const FormatSettingsContainer = /* @__PURE__ */ styled.div.withConfig({
7
7
  displayName: "FormatSettingsstyles__FormatSettingsContainer",
8
8
  componentId: "sc-ipk0xd-0"
9
- })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:stretch;background-color:", ";min-width:268px;.ds-title{margin-bottom:8px;}"], function (props) {
10
- return props.theme.palette.white;
11
- });
12
- export var FormatSettingsWrapper = styled.div.withConfig({
9
+ })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:stretch;background-color:", ";min-width:268px;.ds-title{margin-bottom:8px;}"], (props) => props.theme.palette.white);
10
+ const FormatSettingsWrapper = /* @__PURE__ */ styled.div.withConfig({
13
11
  displayName: "FormatSettingsstyles__FormatSettingsWrapper",
14
12
  componentId: "sc-ipk0xd-1"
15
13
  })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:stretch;width:100%;padding:20px 20px 0;"]);
16
- export var FormatSettings = styled.div.withConfig({
14
+ const FormatSettings = /* @__PURE__ */ styled.div.withConfig({
17
15
  displayName: "FormatSettingsstyles__FormatSettings",
18
16
  componentId: "sc-ipk0xd-2"
19
17
  })(["display:flex;flex-direction:row;align-items:flex-start;width:100%;justify-content:space-between;"]);
20
- export var FormatOptions = styled.div.withConfig({
18
+ const FormatOptions = /* @__PURE__ */ styled.div.withConfig({
21
19
  displayName: "FormatSettingsstyles__FormatOptions",
22
20
  componentId: "sc-ipk0xd-3"
23
21
  })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;margin-top:20px;width:100%;.ds-dropdown-menu{width:100%;}.ds-checkbox{padding:0;margin-bottom:16px;}"]);
24
- export var FormatFooter = styled.div.withConfig({
22
+ const FormatFooter = /* @__PURE__ */ styled.div.withConfig({
25
23
  displayName: "FormatSettingsstyles__FormatFooter",
26
24
  componentId: "sc-ipk0xd-4"
27
- })(["background-color:", ";padding:8px 10px;border-top:1px solid ", ";width:100%;"], function (props) {
28
- return props.theme.palette['grey-050'];
29
- }, function (props) {
30
- return props.theme.palette['grey-100'];
31
- });
32
- export var DropdownTrigger = styled.div.withConfig({
25
+ })(["background-color:", ";padding:8px 10px;border-top:1px solid ", ";width:100%;"], (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["grey-100"]);
26
+ const DropdownTrigger = /* @__PURE__ */ styled.div.withConfig({
33
27
  displayName: "FormatSettingsstyles__DropdownTrigger",
34
28
  componentId: "sc-ipk0xd-5"
35
- })(["display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 8px 0 12px;height:32px;border-radius:3px;border:1px solid ", ";width:100%;margin-bottom:20px;"], function (props) {
36
- return props.theme.palette['grey-300'];
37
- });
38
- export var DropdownValue = styled.span.withConfig({
29
+ })(["display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 8px 0 12px;height:32px;border-radius:3px;border:1px solid ", ";width:100%;margin-bottom:20px;"], (props) => props.theme.palette["grey-300"]);
30
+ const DropdownValue = /* @__PURE__ */ styled.span.withConfig({
39
31
  displayName: "FormatSettingsstyles__DropdownValue",
40
32
  componentId: "sc-ipk0xd-6"
41
- })(["font-size:13px;line-height:18px;font-weight:400;color:", ";"], function (props) {
42
- return props.theme.palette['grey-700'];
43
- });
44
- export var DropdownWrapper = styled.div.withConfig({
33
+ })(["font-size:13px;line-height:18px;font-weight:400;color:", ";"], (props) => props.theme.palette["grey-700"]);
34
+ const DropdownWrapper = /* @__PURE__ */ styled.div.withConfig({
45
35
  displayName: "FormatSettingsstyles__DropdownWrapper",
46
36
  componentId: "sc-ipk0xd-7"
47
- })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;padding:8px;background:", ";"], function (props) {
48
- return props.theme.palette.white;
49
- });
50
- export var ListItem = styled(DSListItem).withConfig({
37
+ })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;padding:8px;background:", ";"], (props) => props.theme.palette.white);
38
+ const ListItem = /* @__PURE__ */ styled(DSListItem).withConfig({
51
39
  displayName: "FormatSettingsstyles__ListItem",
52
40
  componentId: "sc-ipk0xd-8"
53
- })(["font-weight:500;width:100%;color:", ";", "{color:", ";font-weight:400;}"], function (props) {
54
- return props.theme.palette['grey-700'];
55
- }, SuffixWrapper, function (props) {
56
- return props.theme.palette['grey-500'];
57
- });
58
- export var FixedLengthButton = styled(Button).withConfig({
41
+ })(["font-weight:500;width:100%;color:", ";", "{color:", ";font-weight:400;}"], (props) => props.theme.palette["grey-700"], SuffixWrapper, (props) => props.theme.palette["grey-500"]);
42
+ const FixedLengthButton = /* @__PURE__ */ styled(Button).withConfig({
59
43
  displayName: "FormatSettingsstyles__FixedLengthButton",
60
44
  componentId: "sc-ipk0xd-9"
61
45
  })(["&&&{padding:4px;}"]);
62
- export var WrapperButtons = styled(ButtonGroup).withConfig({
46
+ const WrapperButtons = /* @__PURE__ */ styled(ButtonGroup).withConfig({
63
47
  displayName: "FormatSettingsstyles__WrapperButtons",
64
48
  componentId: "sc-ipk0xd-10"
65
- })(["&&&{padding-left:8px;}"]);
49
+ })(["&&&{padding-left:8px;}"]);
50
+ export {
51
+ DropdownTrigger,
52
+ DropdownValue,
53
+ DropdownWrapper,
54
+ FixedLengthButton,
55
+ FormatFooter,
56
+ FormatOptions,
57
+ FormatSettings,
58
+ FormatSettingsContainer,
59
+ FormatSettingsWrapper,
60
+ ListItem,
61
+ WrapperButtons
62
+ };
@@ -1,5 +1,5 @@
1
- import { type NumberToFormatOptions } from '@synerise/ds-core';
2
- import type { FormatPickerProps, FormatPickerTexts } from '../FomartPicker.types';
1
+ import { NumberToFormatOptions } from '@synerise/ds-core';
2
+ import { FormatPickerProps, FormatPickerTexts } from '../FomartPicker.types';
3
3
  export type FormatSettingsProps = Omit<FormatPickerProps, 'text' | 'value'> & {
4
4
  getFormattedValue: (options: NumberToFormatOptions) => string;
5
5
  text: FormatPickerTexts;
@@ -1 +1 @@
1
- export {};
1
+
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export { default } from './FormatPicker';
1
+ import { default as default2 } from "./FormatPicker.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-format-picker",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
4
4
  "description": "FormatPicker 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,16 +35,16 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-button": "^1.5.16",
39
- "@synerise/ds-button-group": "^1.1.41",
40
- "@synerise/ds-checkbox": "^1.2.19",
41
- "@synerise/ds-dropdown": "^1.3.0",
42
- "@synerise/ds-icon": "^1.14.1",
43
- "@synerise/ds-list-item": "^1.4.8",
44
- "@synerise/ds-radio": "^1.1.1",
45
- "@synerise/ds-tooltip": "^1.4.8",
46
- "@synerise/ds-typography": "^1.1.11",
47
- "@synerise/ds-utils": "^1.6.0"
38
+ "@synerise/ds-button": "^1.5.18",
39
+ "@synerise/ds-button-group": "^1.1.43",
40
+ "@synerise/ds-checkbox": "^1.2.21",
41
+ "@synerise/ds-dropdown": "^1.3.2",
42
+ "@synerise/ds-icon": "^1.15.1",
43
+ "@synerise/ds-list-item": "^1.4.10",
44
+ "@synerise/ds-radio": "^1.1.3",
45
+ "@synerise/ds-tooltip": "^1.4.10",
46
+ "@synerise/ds-typography": "^1.1.13",
47
+ "@synerise/ds-utils": "^1.7.1"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@synerise/ds-core": "*",
@@ -52,5 +52,5 @@
52
52
  "react-intl": ">=3.12.0 <= 6.8",
53
53
  "styled-components": "^5.3.3"
54
54
  },
55
- "gitHead": "8dfafc5d7278f09d430f1e7499782d05c76b47c0"
55
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
56
56
  }