@snack-uikit/chips 0.10.11 → 0.11.1

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,27 @@
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.11.1 (2024-02-07)
7
+
8
+ ### Only dependencies have been changed
9
+ * [@snack-uikit/calendar@0.7.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/calendar/CHANGELOG.md)
10
+ * [@snack-uikit/locale@0.1.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/locale/CHANGELOG.md)
11
+
12
+
13
+
14
+
15
+
16
+ # 0.11.0 (2024-02-06)
17
+
18
+
19
+ ### Features
20
+
21
+ * **FF-4166:** add translation to Chips ([23c0a8d](https://github.com/cloud-ru-tech/snack-uikit/commit/23c0a8d720809d6812530fc438db3d9282b4698f))
22
+
23
+
24
+
25
+
26
+
6
27
  ## 0.10.11 (2024-02-05)
7
28
 
8
29
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -219,7 +219,7 @@ import { PlaceholderSVG } from '@snack-uikit/icons';
219
219
  | size | enum ChipChoiceRowSize: `"xs"`, `"s"`, `"m"` | s | Размер |
220
220
  | className | `string` | - | CSS-класс |
221
221
  | showClearAllButton | `boolean` | true | Скрыть/показать кнопку очиски |
222
- | clearAllButtonLabel | `string` | Clear all | Текст кнопки очистки |
222
+ | clearAllButtonLabel | `string` | 'Clear all' | Текст кнопки очистки |
223
223
 
224
224
 
225
225
  [//]: DOCUMENTATION_SECTION_END
@@ -19,4 +19,4 @@ export type ChipChoiceRowProps<TState extends FiltersState> = WithSupportProps<{
19
19
  /** Текст кнопки очистки @default 'Clear all' */
20
20
  clearAllButtonLabel?: string;
21
21
  }>;
22
- export declare function ChipChoiceRow<TState extends FiltersState>({ filters, onChange, showClearAllButton, clearAllButtonLabel, className, value, defaultValue, size, ...rest }: ChipChoiceRowProps<TState>): import("react/jsx-runtime").JSX.Element;
22
+ export declare function ChipChoiceRow<TState extends FiltersState>({ filters, onChange, showClearAllButton, clearAllButtonLabel: clearAllButtonLabelProp, className, value, defaultValue, size, ...rest }: ChipChoiceRowProps<TState>): import("react/jsx-runtime").JSX.Element;
@@ -14,13 +14,16 @@ import cn from 'classnames';
14
14
  import { useUncontrolledProp } from 'uncontrollable';
15
15
  import { ButtonFunction } from '@snack-uikit/button';
16
16
  import { CrossSVG } from '@snack-uikit/icons';
17
+ import { useLocale } from '@snack-uikit/locale';
17
18
  import { extractSupportProps } from '@snack-uikit/utils';
18
19
  import { CHIP_CHOICE_ROW_IDS } from '../../constants';
19
20
  import { ForwardedChipChoice } from './components';
20
21
  import { CHIP_CHOICE_ROW_SIZE, MAP_ROW_SIZE_TO_BUTTON_SIZE, MAP_ROW_SIZE_TO_CHOICE_SIZE } from './constants';
21
22
  import styles from './styles.module.css';
22
23
  export function ChipChoiceRow(_a) {
23
- var { filters, onChange, showClearAllButton = true, clearAllButtonLabel = 'Clear all', className, value, defaultValue, size = CHIP_CHOICE_ROW_SIZE.S } = _a, rest = __rest(_a, ["filters", "onChange", "showClearAllButton", "clearAllButtonLabel", "className", "value", "defaultValue", "size"]);
24
+ var { filters, onChange, showClearAllButton = true, clearAllButtonLabel: clearAllButtonLabelProp, className, value, defaultValue, size = CHIP_CHOICE_ROW_SIZE.S } = _a, rest = __rest(_a, ["filters", "onChange", "showClearAllButton", "clearAllButtonLabel", "className", "value", "defaultValue", "size"]);
25
+ const [locales] = useLocale('Chips');
26
+ const clearAllButtonLabel = clearAllButtonLabelProp !== null && clearAllButtonLabelProp !== void 0 ? clearAllButtonLabelProp : locales.clearAllButton;
24
27
  const [state, setState] = useUncontrolledProp(value, (defaultValue !== null && defaultValue !== void 0 ? defaultValue : {}), newState => {
25
28
  const result = typeof newState === 'function' ? newState(state) : newState;
26
29
  onChange === null || onChange === void 0 ? void 0 : onChange(result);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Chips",
7
- "version": "0.10.11",
7
+ "version": "0.11.1",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -33,13 +33,14 @@
33
33
  "scripts": {},
34
34
  "dependencies": {
35
35
  "@snack-uikit/button": "0.16.0",
36
- "@snack-uikit/calendar": "0.6.5",
36
+ "@snack-uikit/calendar": "0.7.1",
37
37
  "@snack-uikit/droplist": "0.13.3",
38
38
  "@snack-uikit/icons": "0.20.1",
39
39
  "@snack-uikit/loaders": "0.5.0",
40
+ "@snack-uikit/locale": "0.1.1",
40
41
  "@snack-uikit/utils": "3.2.0",
41
42
  "classnames": "2.3.2",
42
43
  "uncontrollable": "8.0.2"
43
44
  },
44
- "gitHead": "b1acc8128bdab6f23b534d7c464208069e59ed8c"
45
+ "gitHead": "0e3f0ca15d2f0903a25bfa72bd95da9a414bddc2"
45
46
  }
@@ -3,6 +3,7 @@ import { useUncontrolledProp } from 'uncontrollable';
3
3
 
4
4
  import { ButtonFunction } from '@snack-uikit/button';
5
5
  import { CrossSVG } from '@snack-uikit/icons';
6
+ import { useLocale } from '@snack-uikit/locale';
6
7
  import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
7
8
 
8
9
  import { CHIP_CHOICE_ROW_IDS } from '../../constants';
@@ -36,13 +37,17 @@ export function ChipChoiceRow<TState extends FiltersState>({
36
37
  filters,
37
38
  onChange,
38
39
  showClearAllButton = true,
39
- clearAllButtonLabel = 'Clear all',
40
+ clearAllButtonLabel: clearAllButtonLabelProp,
40
41
  className,
41
42
  value,
42
43
  defaultValue,
43
44
  size = CHIP_CHOICE_ROW_SIZE.S,
44
45
  ...rest
45
46
  }: ChipChoiceRowProps<TState>) {
47
+ const [locales] = useLocale('Chips');
48
+
49
+ const clearAllButtonLabel = clearAllButtonLabelProp ?? locales.clearAllButton;
50
+
46
51
  const [state, setState] = useUncontrolledProp<TState>(value, (defaultValue ?? {}) as TState, newState => {
47
52
  const result = typeof newState === 'function' ? newState(state) : newState;
48
53
  onChange?.(result);