@synerise/ds-format-picker 2.0.7 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/CLAUDE.md +13 -8
- package/README.md +5 -1
- package/dist/FomartPicker.types.d.ts +14 -0
- package/dist/FormatPicker.d.ts +1 -1
- package/dist/FormatPicker.js +25 -10
- package/dist/FormatPicker.styles.d.ts +6 -0
- package/dist/FormatPicker.styles.js +20 -0
- package/dist/FormatSettings/FormatSettings.js +22 -15
- package/dist/FormatSettings/FormatSettings.styles.d.ts +1 -3
- package/dist/FormatSettings/FormatSettings.styles.js +6 -13
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [2.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@2.0.7...@synerise/ds-format-picker@2.1.0) (2026-10-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **format-picker:** placeholder and clear action ([8475163](https://github.com/Synerise/synerise-design/commit/8475163f9dbd02c1d60e3aaca30aa7ec3f49df78))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.0.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-format-picker@2.0.6...@synerise/ds-format-picker@2.0.7) (2026-09-24)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-format-picker
|
package/CLAUDE.md
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
src/
|
|
9
|
-
FormatPicker.tsx — main component; trigger button + Dropdown shell
|
|
9
|
+
FormatPicker.tsx — main component; trigger button + Dropdown shell + optional clear icon
|
|
10
|
+
FormatPicker.styles.ts — trigger / clear-icon layout
|
|
10
11
|
FomartPicker.types.ts — all types (NOTE: filename typo: Fomart vs Format)
|
|
11
12
|
index.ts — public exports
|
|
12
13
|
FormatSettings/
|
|
13
|
-
FormatSettings.tsx — dropdown overlay: format buttons, currency
|
|
14
|
+
FormatSettings.tsx — dropdown overlay: format buttons, currency menu (DropdownMenu), checkboxes, footer
|
|
14
15
|
FormatSettings.types.ts — FormatSettingsProps (internal)
|
|
15
16
|
FormatSettings.styles.ts — all styled components for the settings panel
|
|
16
17
|
__specs__/
|
|
@@ -37,6 +38,8 @@ src/
|
|
|
37
38
|
| `buttonType` | `string` | `'tertiary'` | Ant Design / DS button type for the trigger button |
|
|
38
39
|
| `disabled` | `boolean` | — | Disables the trigger button and all controls inside the panel |
|
|
39
40
|
| `maxFixedLength` | `number` | — | Upper bound for decimal places (increment is blocked when reached) |
|
|
41
|
+
| `isEmpty` | `boolean` | `false` | No format chosen yet: trigger shows `texts.placeholder`; the panel still edits `format` |
|
|
42
|
+
| `onClear` | `() => void` | — | If provided, renders a red `Close3S` clear icon (tooltip and `aria-label` `texts.clear`) in the trigger while a format is set and the picker is enabled |
|
|
40
43
|
|
|
41
44
|
### `FormatPickerProps`
|
|
42
45
|
|
|
@@ -56,7 +59,7 @@ Shape of the `format` prop:
|
|
|
56
59
|
|
|
57
60
|
### `FormatPickerTexts` (i18n defaults)
|
|
58
61
|
|
|
59
|
-
All fields are `ReactNode` except `currencyMenuItemPrefix` which
|
|
62
|
+
All fields are `ReactNode` except `currencyMenuItemPrefix` and `clear`, which are `string`.
|
|
60
63
|
|
|
61
64
|
| Key | Default |
|
|
62
65
|
|-----|---------|
|
|
@@ -69,6 +72,8 @@ All fields are `ReactNode` except `currencyMenuItemPrefix` which is `string`.
|
|
|
69
72
|
| `useSeparator` | `'Use 1000 separator'` |
|
|
70
73
|
| `compactNumbers` | `'Use compact numbers'` |
|
|
71
74
|
| `currencyMenuItemPrefix` | `'e.g.'` |
|
|
75
|
+
| `placeholder` | `'Set format'` |
|
|
76
|
+
| `clear` | `'Clear'` |
|
|
72
77
|
|
|
73
78
|
### `CurrencyConfig`
|
|
74
79
|
|
|
@@ -104,24 +109,24 @@ const [format, setFormat] = useState<FormattingValue>({
|
|
|
104
109
|
|
|
105
110
|
`FormatSettings.styles.ts` — all styles for the dropdown panel. Uses `theme.palette` tokens (`white`, `grey-050`, `grey-100`, `grey-300`, `grey-500`, `grey-700`). Hardcoded `min-width: 268px` for the panel container.
|
|
106
111
|
|
|
107
|
-
> **Note:** `SuffixWrapper` is imported from `@synerise/ds-list-item/dist/components/Text/Text.styles` — a fragile deep/internal path.
|
|
108
|
-
|
|
109
112
|
## Key dependencies
|
|
110
113
|
|
|
111
|
-
- `@synerise/ds-dropdown` — wraps the whole component as a click-triggered dropdown overlay
|
|
114
|
+
- `@synerise/ds-dropdown` — wraps the whole component as a click-triggered dropdown overlay; its `DropdownMenu` renders the currency list
|
|
112
115
|
- `@synerise/ds-core` (`useDataFormat`) — `formatValue` utility that applies `NumberToFormatOptions`; requires `DSProvider` in the tree
|
|
113
116
|
- `react-intl` — i18n for all labels; requires `IntlProvider` (supplied by `DSProvider`)
|
|
114
117
|
- `@synerise/ds-button` + `@synerise/ds-button-group` — format-type buttons and decimal-place controls
|
|
115
118
|
- `@synerise/ds-checkbox` — separator and compact-numbers checkboxes
|
|
116
119
|
- `@synerise/ds-radio` — wraps the button-group for format-type selection (value binding)
|
|
117
|
-
- `@synerise/ds-list-item` — currency
|
|
120
|
+
- `@synerise/ds-list-item` — dev-only: the currency-list spec reads the row height from `LIST_ITEM_SIZE_MAPPING`
|
|
118
121
|
|
|
119
122
|
## Implementation notes
|
|
120
123
|
|
|
121
|
-
- **Trigger button label** is
|
|
124
|
+
- **Trigger button label** is `"{texts.format} {getFormattedValue()}"` — e.g. `"Format 19,000.70"` — or `texts.placeholder` while `isEmpty`. The `value` prop is purely for display.
|
|
125
|
+
- **Clear icon** follows `ds-completed-within`: a ghost `single-icon` button absolutely positioned at the trigger's right edge (`FormatPicker.styles.ts`), the trigger padded by 32px so the label never runs under it.
|
|
122
126
|
- **`onFormattedValueChange`** fires via `useEffect` on every change to `format` or `value`; it is not fired on user interaction directly.
|
|
123
127
|
- **`onSetDefault` is optional** — when omitted, the footer (grey bar with "Set default" button) is not rendered at all.
|
|
124
128
|
- **`currenciesConfig` default** is `DEFAULT_CURRENCIES_CONFIG` defined in `FormatSettings.tsx`: USD, EUR, PLN, JPY. Not exported.
|
|
129
|
+
- **Currency list** is a `DropdownMenu` (`@synerise/ds-dropdown`): it shows `CURRENCY_LIST_VISIBLE_ITEMS` (7) rows and scrolls the rest, and always carries the menu's built-in search. `currencyMatchesQuery` matches the label **and** the ISO code (`PLN`, `GBP`…), case-insensitively; "No results" is the menu's empty state. Each row's `suffixel` is the `currencyMenuItemPrefix` + example value.
|
|
125
130
|
- **`CurrencyType` is typed as `string`** (not a union of specific codes). The README's `USD | EUR | PLN | JPY` is only the default config list, not a type constraint.
|
|
126
131
|
- **Filename typo** — the types file is `FomartPicker.types.ts` (missing `t`). The import in `index.ts` matches the typo, so it works, but it should be fixed.
|
|
127
132
|
- **Uses Vitest**.
|
package/README.md
CHANGED
|
@@ -49,10 +49,12 @@ import FormatPicker from '@synerise/ds-format-picker'
|
|
|
49
49
|
| onSetDefault | If provided, renders a "Set default" footer button | `() => void` | - |
|
|
50
50
|
| onFormattedValueChange | Called whenever the formatted display value changes | `(formattedValue: string) => void` | - |
|
|
51
51
|
| text | Override any subset of UI labels | `Partial<FormatPickerTexts>` | - |
|
|
52
|
-
| currenciesConfig | Custom currency list for the cash dropdown
|
|
52
|
+
| currenciesConfig | Custom currency list for the cash dropdown; scrolls past 7 entries, searchable by label or ISO code | `CurrencyConfig[]` | USD/EUR/PLN/JPY |
|
|
53
53
|
| buttonType | DS button type for the trigger button | `string` | `'tertiary'` |
|
|
54
54
|
| disabled | Disables the trigger and all panel controls | `boolean` | - |
|
|
55
55
|
| maxFixedLength | Upper bound for decimal places | `number` | - |
|
|
56
|
+
| isEmpty | No format chosen yet: the trigger shows `texts.placeholder`; the panel still edits `format` | `boolean` | `false` |
|
|
57
|
+
| onClear | If provided, renders a clear icon in the trigger while a format is set | `() => void` | - |
|
|
56
58
|
|
|
57
59
|
### Texts
|
|
58
60
|
|
|
@@ -67,6 +69,8 @@ import FormatPicker from '@synerise/ds-format-picker'
|
|
|
67
69
|
| useSeparator | Use 1000 separator checkbox label | `string \| ReactNode` | `Use 1000 separator` |
|
|
68
70
|
| compactNumbers | Compact numbers checkbox label | `string \| ReactNode` | `Use compact numbers` |
|
|
69
71
|
| currencyMenuItemPrefix | Prefix shown before the example value in currency rows | `string` | `'e.g.'` |
|
|
72
|
+
| placeholder | Trigger label while `isEmpty` | `string \| ReactNode` | `Set format` |
|
|
73
|
+
| clear | Tooltip and accessible name of the clear icon | `string` | `Clear` |
|
|
70
74
|
|
|
71
75
|
### FormattingValue
|
|
72
76
|
|
|
@@ -28,6 +28,10 @@ export type FormatPickerTexts = {
|
|
|
28
28
|
useSeparator: ReactNode;
|
|
29
29
|
compactNumbers: ReactNode;
|
|
30
30
|
currencyMenuItemPrefix: string;
|
|
31
|
+
/** Trigger label while `isEmpty` is set. Optional so a full `FormatPickerTexts` object stays valid. */
|
|
32
|
+
placeholder?: ReactNode;
|
|
33
|
+
/** Tooltip and accessible name (`aria-label`) of the clear icon, so it must be a plain string. */
|
|
34
|
+
clear?: string;
|
|
31
35
|
};
|
|
32
36
|
export type FormatPickerProps = {
|
|
33
37
|
format: FormattingValue;
|
|
@@ -44,4 +48,14 @@ export type FormatPickerProps = {
|
|
|
44
48
|
buttonType?: ButtonType;
|
|
45
49
|
disabled?: boolean;
|
|
46
50
|
maxFixedLength?: number;
|
|
51
|
+
/**
|
|
52
|
+
* No format has been chosen yet: the trigger shows `texts.placeholder` instead of the formatted
|
|
53
|
+
* example. The settings panel still edits `format`, so pass the value editing should start from.
|
|
54
|
+
*/
|
|
55
|
+
isEmpty?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* If provided, a clear icon is rendered inside the trigger while a format is set (`isEmpty` is
|
|
58
|
+
* falsy and the picker is enabled), mirroring `ds-completed-within`.
|
|
59
|
+
*/
|
|
60
|
+
onClear?: () => void;
|
|
47
61
|
};
|
package/dist/FormatPicker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { default as 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, maxFixedLength, }: FormatPickerProps) => React.JSX.Element;
|
|
3
|
+
declare const FormatPicker: ({ onUseSeparatorChange, onFixedLengthChange, onDataFormatChange, onCurrencyChange, onCompactNumbersChange, onSetDefault, onFormattedValueChange, value, format, text, currenciesConfig, buttonType, disabled, maxFixedLength, isEmpty, onClear, }: FormatPickerProps) => React.JSX.Element;
|
|
4
4
|
export default FormatPicker;
|
package/dist/FormatPicker.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useCallback, useEffect } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import Button from "@synerise/ds-button";
|
|
5
4
|
import { useDataFormat } from "@synerise/ds-core";
|
|
6
5
|
import Dropdown from "@synerise/ds-dropdown";
|
|
7
|
-
import Icon, { HashM } from "@synerise/ds-icon";
|
|
6
|
+
import Icon, { HashM, Close3S } from "@synerise/ds-icon";
|
|
7
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
+
import { FormatPickerWrapper, TriggerButton, ClearButton } from "./FormatPicker.styles.js";
|
|
8
9
|
import FormatSettings from "./FormatSettings/FormatSettings.js";
|
|
9
10
|
const FormatPicker = ({
|
|
10
11
|
onUseSeparatorChange,
|
|
@@ -20,7 +21,9 @@ const FormatPicker = ({
|
|
|
20
21
|
currenciesConfig,
|
|
21
22
|
buttonType = "tertiary",
|
|
22
23
|
disabled,
|
|
23
|
-
maxFixedLength
|
|
24
|
+
maxFixedLength,
|
|
25
|
+
isEmpty = false,
|
|
26
|
+
onClear
|
|
24
27
|
}) => {
|
|
25
28
|
const intl = useIntl();
|
|
26
29
|
const {
|
|
@@ -63,6 +66,14 @@ const FormatPicker = ({
|
|
|
63
66
|
id: "DS.FORMAT-PICKER.COMPACT-NUMBERS",
|
|
64
67
|
defaultMessage: "Use compact numbers"
|
|
65
68
|
}),
|
|
69
|
+
placeholder: intl.formatMessage({
|
|
70
|
+
id: "DS.FORMAT-PICKER.PLACEHOLDER",
|
|
71
|
+
defaultMessage: "Set format"
|
|
72
|
+
}),
|
|
73
|
+
clear: intl.formatMessage({
|
|
74
|
+
id: "DS.FORMAT-PICKER.CLEAR",
|
|
75
|
+
defaultMessage: "Clear"
|
|
76
|
+
}),
|
|
66
77
|
...text
|
|
67
78
|
}), [text, intl]);
|
|
68
79
|
const getFormattedValue = useCallback((overrideOptions) => {
|
|
@@ -107,12 +118,16 @@ const FormatPicker = ({
|
|
|
107
118
|
useEffect(() => {
|
|
108
119
|
onFormattedValueChange && onFormattedValueChange(getFormattedValue());
|
|
109
120
|
}, [getFormattedValue, onFormattedValueChange]);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
const showClear = Boolean(onClear) && !isEmpty && !disabled;
|
|
122
|
+
return /* @__PURE__ */ jsxs(FormatPickerWrapper, { withClear: showClear, children: [
|
|
123
|
+
/* @__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: {
|
|
124
|
+
testId: "format-picker"
|
|
125
|
+
}, size: "auto", asChild: true, children: /* @__PURE__ */ jsxs(TriggerButton, { type: buttonType, mode: "icon-label", disabled, "data-testid": "ds-format-picker-trigger", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(HashM, {}) }),
|
|
127
|
+
isEmpty ? texts.placeholder : `${texts.format} ${getFormattedValue()}`
|
|
128
|
+
] }) }),
|
|
129
|
+
showClear && /* @__PURE__ */ jsx(Tooltip, { title: texts.clear, children: /* @__PURE__ */ jsx(ClearButton, { mode: "single-icon", type: "ghost", onClick: onClear, "aria-label": texts.clear, "data-testid": "ds-format-picker-clear", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}) }) }) })
|
|
130
|
+
] });
|
|
116
131
|
};
|
|
117
132
|
export {
|
|
118
133
|
FormatPicker as default
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StyledButton } from '@synerise/ds-button';
|
|
2
|
+
export declare const TriggerButton: StyledButton;
|
|
3
|
+
export declare const ClearButton: StyledButton;
|
|
4
|
+
export declare const FormatPickerWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
5
|
+
withClear: boolean;
|
|
6
|
+
}, never>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
4
|
+
const TriggerButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
5
|
+
displayName: "FormatPickerstyles__TriggerButton",
|
|
6
|
+
componentId: "sc-1sk419c-0"
|
|
7
|
+
})(["transition:padding 0s;"]);
|
|
8
|
+
const ClearButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
9
|
+
displayName: "FormatPickerstyles__ClearButton",
|
|
10
|
+
componentId: "sc-1sk419c-1"
|
|
11
|
+
})(["&&&{", "{svg{fill:", ";color:", ";}}&:hover{", "{svg{fill:", " !important;color:", " !important;}}}&:focus{.btn-focus{box-shadow:none;}}}"], IconContainer, (props) => props.theme.palette["red-600"], (props) => props.theme.palette["red-600"], IconContainer, (props) => props.theme.palette["red-600"], (props) => props.theme.palette["red-600"]);
|
|
12
|
+
const FormatPickerWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
13
|
+
displayName: "FormatPickerstyles__FormatPickerWrapper",
|
|
14
|
+
componentId: "sc-1sk419c-2"
|
|
15
|
+
})(["display:inline-flex;align-items:center;position:relative;", ";"], (props) => props.withClear && css(["&&&{", "{padding-right:32px;}", "{background-color:transparent !important;position:absolute;right:0;}}"], TriggerButton, ClearButton));
|
|
16
|
+
export {
|
|
17
|
+
ClearButton,
|
|
18
|
+
FormatPickerWrapper,
|
|
19
|
+
TriggerButton
|
|
20
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useMemo } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import Button from "@synerise/ds-button";
|
|
5
5
|
import ButtonGroup from "@synerise/ds-button-group";
|
|
6
6
|
import Checkbox from "@synerise/ds-checkbox";
|
|
7
|
-
import
|
|
7
|
+
import { DropdownMenu } from "@synerise/ds-dropdown";
|
|
8
8
|
import Icon, { CommaDecM, CommaIncM, AngleDownS, HashM, PercentM, Coin2M } from "@synerise/ds-icon";
|
|
9
9
|
import Radio from "@synerise/ds-radio";
|
|
10
10
|
import Tooltip from "@synerise/ds-tooltip";
|
|
11
11
|
import { Title } from "@synerise/ds-typography";
|
|
12
|
-
import { FormatSettingsContainer, FormatSettingsWrapper, FormatSettings as FormatSettings$1, WrapperButtons, FixedLengthButton, FormatOptions, DropdownTrigger, DropdownValue,
|
|
12
|
+
import { CurrencyExample, FormatSettingsContainer, FormatSettingsWrapper, FormatSettings as FormatSettings$1, WrapperButtons, FixedLengthButton, FormatOptions, DropdownTrigger, DropdownValue, FormatFooter } from "./FormatSettings.styles.js";
|
|
13
13
|
const DEFAULT_CURRENCIES_CONFIG = [{
|
|
14
14
|
currency: "USD",
|
|
15
15
|
label: "Dollar (US)"
|
|
@@ -23,6 +23,11 @@ const DEFAULT_CURRENCIES_CONFIG = [{
|
|
|
23
23
|
currency: "JPY",
|
|
24
24
|
label: "Yen (JP)"
|
|
25
25
|
}];
|
|
26
|
+
const CURRENCY_LIST_VISIBLE_ITEMS = 7;
|
|
27
|
+
const currencyMatchesQuery = (item, query) => {
|
|
28
|
+
const needle = query.toLocaleLowerCase();
|
|
29
|
+
return item.text.toLocaleLowerCase().includes(needle) || item.currency.toLocaleLowerCase().includes(needle);
|
|
30
|
+
};
|
|
26
31
|
const getFormattingTypes = (intl, text) => [{
|
|
27
32
|
format: "numeric",
|
|
28
33
|
icon: /* @__PURE__ */ jsx(HashM, {}),
|
|
@@ -51,9 +56,6 @@ const FormatSettings = ({
|
|
|
51
56
|
maxFixedLength
|
|
52
57
|
}) => {
|
|
53
58
|
const intl = useIntl();
|
|
54
|
-
const handleSelectCurrency = (currency) => {
|
|
55
|
-
onCurrencyChange(currency);
|
|
56
|
-
};
|
|
57
59
|
const handleDecreaseFixedLength = useCallback(() => {
|
|
58
60
|
if (format.fixedLength > 0) {
|
|
59
61
|
onFixedLengthChange(format.fixedLength - 1);
|
|
@@ -69,6 +71,18 @@ const FormatSettings = ({
|
|
|
69
71
|
const selectedCurrency = useMemo(() => {
|
|
70
72
|
return currenciesConfig.find((currency) => currency.currency === format.currency);
|
|
71
73
|
}, [currenciesConfig, format]);
|
|
74
|
+
const currencyItems = useMemo(() => currenciesConfig.map(({
|
|
75
|
+
currency,
|
|
76
|
+
label
|
|
77
|
+
}) => ({
|
|
78
|
+
key: currency,
|
|
79
|
+
text: label,
|
|
80
|
+
currency,
|
|
81
|
+
suffixel: /* @__PURE__ */ jsx(CurrencyExample, { children: `${text.currencyMenuItemPrefix} ${getFormattedValue({
|
|
82
|
+
currency
|
|
83
|
+
})}` }),
|
|
84
|
+
onClick: () => onCurrencyChange(currency)
|
|
85
|
+
})), [currenciesConfig, getFormattedValue, onCurrencyChange, text.currencyMenuItemPrefix]);
|
|
72
86
|
return /* @__PURE__ */ jsxs(FormatSettingsContainer, { "data-testid": "ds-format-picker-overlay", children: [
|
|
73
87
|
/* @__PURE__ */ jsxs(FormatSettingsWrapper, { children: [
|
|
74
88
|
/* @__PURE__ */ jsx(Title, { level: 6, children: text.header }),
|
|
@@ -80,16 +94,9 @@ const FormatSettings = ({
|
|
|
80
94
|
] })
|
|
81
95
|
] }),
|
|
82
96
|
/* @__PURE__ */ jsxs(FormatOptions, { children: [
|
|
83
|
-
format.dataFormat === "cash" && /* @__PURE__ */ jsx(
|
|
97
|
+
format.dataFormat === "cash" && /* @__PURE__ */ jsx(DropdownMenu, { dataSource: currencyItems, maxVisibleItems: CURRENCY_LIST_VISIBLE_ITEMS, withSearch: true, itemMatchesSearchQuery: currencyMatchesQuery, disabled, popoverProps: {
|
|
84
98
|
testId: "format-picker-settings"
|
|
85
|
-
}, asChild: true, size: "match-trigger",
|
|
86
|
-
currency,
|
|
87
|
-
label
|
|
88
|
-
}) => /* @__PURE__ */ jsx(ListItem, { suffixel: `${text.currencyMenuItemPrefix} ${getFormattedValue({
|
|
89
|
-
currency
|
|
90
|
-
})}`, onClick: () => {
|
|
91
|
-
handleSelectCurrency(currency);
|
|
92
|
-
}, children: label }, currency)) }), children: /* @__PURE__ */ jsxs(DropdownTrigger, { "data-testid": "ds-format-picker-currency-trigger", children: [
|
|
99
|
+
}, asChild: true, size: "match-trigger", children: /* @__PURE__ */ jsxs(DropdownTrigger, { "data-testid": "ds-format-picker-currency-trigger", children: [
|
|
93
100
|
/* @__PURE__ */ jsx(DropdownValue, { children: selectedCurrency?.label }),
|
|
94
101
|
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleDownS, {}) })
|
|
95
102
|
] }) }),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StyledButton } from '@synerise/ds-button';
|
|
2
|
-
import { StyledListItem } from '@synerise/ds-list-item';
|
|
3
2
|
export declare const FormatSettingsContainer: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
3
|
export declare const FormatSettingsWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
4
|
export declare const FormatSettings: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -7,7 +6,6 @@ export declare const FormatOptions: import('styled-components').StyledComponent<
|
|
|
7
6
|
export declare const FormatFooter: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
8
7
|
export declare const DropdownTrigger: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
9
8
|
export declare const DropdownValue: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const ListItem: StyledListItem;
|
|
9
|
+
export declare const CurrencyExample: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
12
10
|
export declare const FixedLengthButton: StyledButton;
|
|
13
11
|
export declare const WrapperButtons: import('styled-components').StyledComponent<({ className, style, children, title, description, size, fullWidth, buttonsPosition, disabled, splitMode, compact, error, }: import('@synerise/ds-button-group').ButtonGroupProps) => React.JSX.Element, any, {}, never>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import Button from "@synerise/ds-button";
|
|
3
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
4
|
const FormatSettingsContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
7
5
|
displayName: "FormatSettingsstyles__FormatSettingsContainer",
|
|
8
6
|
componentId: "sc-ipk0xd-0"
|
|
@@ -31,32 +29,27 @@ const DropdownValue = /* @__PURE__ */ styled.span.withConfig({
|
|
|
31
29
|
displayName: "FormatSettingsstyles__DropdownValue",
|
|
32
30
|
componentId: "sc-ipk0xd-6"
|
|
33
31
|
})(["font-size:13px;line-height:18px;font-weight:400;color:", ";"], (props) => props.theme.palette["grey-700"]);
|
|
34
|
-
const
|
|
35
|
-
displayName: "
|
|
32
|
+
const CurrencyExample = /* @__PURE__ */ styled.span.withConfig({
|
|
33
|
+
displayName: "FormatSettingsstyles__CurrencyExample",
|
|
36
34
|
componentId: "sc-ipk0xd-7"
|
|
37
|
-
})(["
|
|
38
|
-
const ListItem = /* @__PURE__ */ styled(DSListItem).withConfig({
|
|
39
|
-
displayName: "FormatSettingsstyles__ListItem",
|
|
40
|
-
componentId: "sc-ipk0xd-8"
|
|
41
|
-
})(["font-weight:500;width:100%;color:", ";", "{color:", ";font-weight:400;}"], (props) => props.theme.palette["grey-700"], SuffixWrapper, (props) => props.theme.palette["grey-500"]);
|
|
35
|
+
})(["color:", ";font-weight:400;"], (props) => props.theme.palette["grey-500"]);
|
|
42
36
|
const FixedLengthButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
43
37
|
displayName: "FormatSettingsstyles__FixedLengthButton",
|
|
44
|
-
componentId: "sc-ipk0xd-
|
|
38
|
+
componentId: "sc-ipk0xd-8"
|
|
45
39
|
})(["&&&{padding:4px;}"]);
|
|
46
40
|
const WrapperButtons = /* @__PURE__ */ styled(ButtonGroup).withConfig({
|
|
47
41
|
displayName: "FormatSettingsstyles__WrapperButtons",
|
|
48
|
-
componentId: "sc-ipk0xd-
|
|
42
|
+
componentId: "sc-ipk0xd-9"
|
|
49
43
|
})(["&&&{padding-left:8px;}"]);
|
|
50
44
|
export {
|
|
45
|
+
CurrencyExample,
|
|
51
46
|
DropdownTrigger,
|
|
52
47
|
DropdownValue,
|
|
53
|
-
DropdownWrapper,
|
|
54
48
|
FixedLengthButton,
|
|
55
49
|
FormatFooter,
|
|
56
50
|
FormatOptions,
|
|
57
51
|
FormatSettings,
|
|
58
52
|
FormatSettingsContainer,
|
|
59
53
|
FormatSettingsWrapper,
|
|
60
|
-
ListItem,
|
|
61
54
|
WrapperButtons
|
|
62
55
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-format-picker",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "FormatPicker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,15 +42,14 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-button": "^2.1.
|
|
46
|
-
"@synerise/ds-button-group": "^2.0.
|
|
47
|
-
"@synerise/ds-checkbox": "^2.0.
|
|
48
|
-
"@synerise/ds-dropdown": "^2.1.
|
|
49
|
-
"@synerise/ds-icon": "^2.2.
|
|
50
|
-
"@synerise/ds-
|
|
51
|
-
"@synerise/ds-
|
|
52
|
-
"@synerise/ds-
|
|
53
|
-
"@synerise/ds-typography": "^2.0.6",
|
|
45
|
+
"@synerise/ds-button": "^2.1.2",
|
|
46
|
+
"@synerise/ds-button-group": "^2.0.7",
|
|
47
|
+
"@synerise/ds-checkbox": "^2.0.7",
|
|
48
|
+
"@synerise/ds-dropdown": "^2.1.4",
|
|
49
|
+
"@synerise/ds-icon": "^2.2.1",
|
|
50
|
+
"@synerise/ds-radio": "^2.0.7",
|
|
51
|
+
"@synerise/ds-tooltip": "^2.0.7",
|
|
52
|
+
"@synerise/ds-typography": "^2.0.7",
|
|
54
53
|
"@synerise/ds-utils": "^2.2.0"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
@@ -60,5 +59,8 @@
|
|
|
60
59
|
"styled-components": "^5.3.3",
|
|
61
60
|
"vitest": "4"
|
|
62
61
|
},
|
|
63
|
-
"
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@synerise/ds-list-item": "^2.2.0"
|
|
64
|
+
},
|
|
65
|
+
"gitHead": "7331c532cf684b40b130328005359a348aa06976"
|
|
64
66
|
}
|