@snack-uikit/fields 0.18.2 → 0.18.3

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,18 @@
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.18.3 (2024-04-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-4649:** container width of multiselect ([ca5702d](https://github.com/cloud-ru-tech/snack-uikit/commit/ca5702dbb4ae2574b5b312c926663cc67bbe694c))
12
+ * **FF-4649:** pass props footer and widthStrategy for Droplist ([c4a78cb](https://github.com/cloud-ru-tech/snack-uikit/commit/c4a78cbaddd6b8e6718b7a10614e56b5d618332e))
13
+
14
+
15
+
16
+
17
+
6
18
  ## 0.18.2 (2024-04-22)
7
19
 
8
20
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -340,19 +340,20 @@ const [isOpen, setIsOpen] = useState(false);
340
340
  | showClearButton | `boolean` | true | Отображение кнопки очистки поля |
341
341
  | prefixIcon | `ReactElement<any, string \| JSXElementConstructor<any>>` | - | Иконка-префикс для поля |
342
342
  | footer | `ReactNode` | - | |
343
+ | widthStrategy | enum PopoverWidthStrategy: `"auto"`, `"gte"`, `"eq"` | - | |
343
344
  | search | `SearchState` | - | |
344
345
  | autocomplete | `boolean` | - | |
345
346
  | addOptionByEnter | `boolean` | - | |
346
347
  | open | `boolean` | - | |
347
348
  | onOpenChange | `(open: boolean) => void` | - | |
348
349
  | selectedOptionFormatter | `SelectedOptionFormatter` | - | |
350
+ | pinTop | `ItemProps[]` | - | Элементы списка, закрепленные сверху |
351
+ | pinBottom | `ItemProps[]` | - | Элементы списка, закрепленные снизу |
352
+ | dataFiltered | `boolean` | - | |
349
353
  | dataError | `boolean` | - | |
350
354
  | noDataState | `EmptyStateProps` | - | Экран при отстутствии данных |
351
355
  | noResultsState | `EmptyStateProps` | - | Экран при отстутствии результатов поиска или фильтров |
352
356
  | errorDataState | `EmptyStateProps` | - | Экран при ошибке запроса |
353
- | pinTop | `ItemProps[]` | - | Элементы списка, закрепленные сверху |
354
- | pinBottom | `ItemProps[]` | - | Элементы списка, закрепленные снизу |
355
- | dataFiltered | `boolean` | - | |
356
357
  | selection | "single" \| "multiple" | - | |
357
358
  | ref | `Ref<HTMLInputElement>` | - | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom |
358
359
  | key | `Key` | - | |
@@ -15,10 +15,11 @@ export declare const FieldSelectMultiple: import("react").ForwardRefExoticCompon
15
15
  readonly?: boolean | undefined;
16
16
  prefixIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
17
17
  footer?: import("react").ReactNode;
18
+ widthStrategy?: import("@snack-uikit/popover-private/dist/types").PopoverWidthStrategy | undefined;
18
19
  search?: import("./types").SearchState | undefined;
19
20
  autocomplete?: boolean | undefined;
20
21
  addOptionByEnter?: boolean | undefined;
21
22
  open?: boolean | undefined;
22
23
  onOpenChange?(open: boolean): void;
23
24
  selectedOptionFormatter?: SelectedOptionFormatter | undefined;
24
- } & Pick<import("@snack-uikit/list").ListProps, "dataError" | "noDataState" | "noResultsState" | "errorDataState" | "pinTop" | "pinBottom" | "dataFiltered">, "showCopyButton"> & import("react").RefAttributes<HTMLInputElement>>;
25
+ } & Pick<import("@snack-uikit/list").DroplistProps, "pinTop" | "pinBottom" | "dataFiltered" | "dataError" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -13,10 +13,11 @@ export declare const FieldSelectSingle: import("react").ForwardRefExoticComponen
13
13
  readonly?: boolean | undefined;
14
14
  prefixIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
15
15
  footer?: import("react").ReactNode;
16
+ widthStrategy?: import("@snack-uikit/popover-private/dist/types").PopoverWidthStrategy | undefined;
16
17
  search?: import("./types").SearchState | undefined;
17
18
  autocomplete?: boolean | undefined;
18
19
  addOptionByEnter?: boolean | undefined;
19
20
  open?: boolean | undefined;
20
21
  onOpenChange?(open: boolean): void;
21
22
  selectedOptionFormatter?: SelectedOptionFormatter | undefined;
22
- } & Pick<import("@snack-uikit/list").ListProps, "dataError" | "noDataState" | "noResultsState" | "errorDataState" | "pinTop" | "pinBottom" | "dataFiltered"> & import("react").RefAttributes<HTMLInputElement>>;
23
+ } & Pick<import("@snack-uikit/list").DroplistProps, "pinTop" | "pinBottom" | "dataFiltered" | "dataError" | "noDataState" | "noResultsState" | "errorDataState"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -4,6 +4,8 @@
4
4
  }
5
5
 
6
6
  .contentWrapper{
7
+ position:relative;
8
+ overflow:hidden;
7
9
  display:flex;
8
10
  flex-wrap:wrap;
9
11
  width:100%;
@@ -71,14 +73,10 @@
71
73
  }
72
74
  .container[data-size=s][data-variant=single-line-container] .displayValue{
73
75
  width:calc(100% - (
74
- var(--space-fields-single-line-container-s-right, 6px) +
75
- var(--space-fields-single-line-container-s-gap, 4px) +
76
- calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)
76
+ var(--space-fields-single-line-container-s-right, 6px) + var(--space-fields-single-line-container-s-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)
77
77
  ));
78
78
  margin-right:calc(
79
- var(--space-fields-single-line-container-s-right, 6px) +
80
- var(--space-fields-single-line-container-s-gap, 4px) +
81
- calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)
79
+ var(--space-fields-single-line-container-s-right, 6px) + var(--space-fields-single-line-container-s-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)
82
80
  );
83
81
  padding-left:var(--space-fields-single-line-container-s-left, 6px);
84
82
  border-radius:var(--radius-fields-s, 12px);
@@ -98,14 +96,10 @@
98
96
  }
99
97
  .container[data-size=m][data-variant=single-line-container] .displayValue{
100
98
  width:calc(100% - (
101
- var(--space-fields-single-line-container-m-right, 8px) +
102
- var(--space-fields-single-line-container-m-gap, 4px) +
103
- calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
99
+ var(--space-fields-single-line-container-m-right, 8px) + var(--space-fields-single-line-container-m-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
104
100
  ));
105
101
  margin-right:calc(
106
- var(--space-fields-single-line-container-m-right, 8px) +
107
- var(--space-fields-single-line-container-m-gap, 4px) +
108
- calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
102
+ var(--space-fields-single-line-container-m-right, 8px) + var(--space-fields-single-line-container-m-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
109
103
  );
110
104
  padding-left:var(--space-fields-single-line-container-m-left, 8px);
111
105
  border-radius:var(--radius-fields-m, 14px);
@@ -125,14 +119,10 @@
125
119
  }
126
120
  .container[data-size=l][data-variant=single-line-container] .displayValue{
127
121
  width:calc(100% - (
128
- var(--space-fields-single-line-container-l-right, 10px) +
129
- var(--space-fields-single-line-container-l-gap, 8px) +
130
- calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
122
+ var(--space-fields-single-line-container-l-right, 10px) + var(--space-fields-single-line-container-l-gap, 8px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
131
123
  ));
132
124
  margin-right:calc(
133
- var(--space-fields-single-line-container-l-right, 10px) +
134
- var(--space-fields-single-line-container-l-gap, 8px) +
135
- calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
125
+ var(--space-fields-single-line-container-l-right, 10px) + var(--space-fields-single-line-container-l-gap, 8px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
136
126
  );
137
127
  padding-left:var(--space-fields-single-line-container-l-left, 10px);
138
128
  border-radius:var(--radius-fields-l, 16px);
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { InputPrivateProps } from '@snack-uikit/input-private';
3
- import { AccordionItemProps, BaseItemProps, GroupItemProps, ListProps, NextListItemProps, SelectionMultipleState, SelectionSingleState } from '@snack-uikit/list';
3
+ import { AccordionItemProps, BaseItemProps, DroplistProps, GroupItemProps, NextListItemProps, SelectionMultipleState, SelectionSingleState } from '@snack-uikit/list';
4
4
  import { TagProps } from '@snack-uikit/tag';
5
5
  import { WithSupportProps } from '@snack-uikit/utils';
6
6
  import { FieldDecoratorProps } from '../FieldDecorator';
@@ -51,14 +51,15 @@ type FiledSelectCommonProps = WithSupportProps<{
51
51
  readonly?: boolean;
52
52
  /** Иконка-префикс для поля */
53
53
  prefixIcon?: ReactElement;
54
- footer?: ListProps['footer'];
54
+ footer?: DroplistProps['footer'];
55
+ widthStrategy?: DroplistProps['widthStrategy'];
55
56
  search?: SearchState;
56
57
  autocomplete?: boolean;
57
58
  addOptionByEnter?: boolean;
58
59
  open?: boolean;
59
60
  onOpenChange?(open: boolean): void;
60
61
  selectedOptionFormatter?: SelectedOptionFormatter;
61
- }> & Pick<ListProps, 'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'pinTop' | 'pinBottom' | 'dataFiltered'>;
62
+ }> & Pick<DroplistProps, 'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'pinTop' | 'pinBottom' | 'dataFiltered'>;
62
63
  export type FieldSelectSingleProps = FieldSelectPrivateProps & Omit<SelectionSingleState, 'mode'> & WrapperProps & FiledSelectCommonProps;
63
64
  export type FieldSelectMultipleProps = FieldSelectPrivateProps & {
64
65
  removeByBackspace?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { DroplistProps } from '@snack-uikit/list';
2
2
  import { FieldSelectProps } from '../types';
3
- export declare function extractListProps({ dataError, noDataState, noResultsState, errorDataState, pinTop, pinBottom, dataFiltered, loading, }: Partial<FieldSelectProps>): Partial<DroplistProps>;
3
+ export declare function extractListProps({ dataError, noDataState, noResultsState, errorDataState, pinTop, pinBottom, dataFiltered, loading, footer, widthStrategy, }: Partial<FieldSelectProps>): Partial<DroplistProps>;
@@ -1,4 +1,4 @@
1
- export function extractListProps({ dataError, noDataState, noResultsState, errorDataState, pinTop, pinBottom, dataFiltered, loading, }) {
1
+ export function extractListProps({ dataError, noDataState, noResultsState, errorDataState, pinTop, pinBottom, dataFiltered, loading, footer, widthStrategy, }) {
2
2
  return {
3
3
  dataError,
4
4
  noDataState,
@@ -8,6 +8,8 @@ export function extractListProps({ dataError, noDataState, noResultsState, error
8
8
  pinBottom,
9
9
  dataFiltered,
10
10
  loading,
11
+ footer,
12
+ widthStrategy,
11
13
  trigger: 'clickAndFocusVisible',
12
14
  placement: 'bottom',
13
15
  'data-test-id': 'field-select__list',
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Fields",
7
- "version": "0.18.2",
7
+ "version": "0.18.3",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -34,13 +34,13 @@
34
34
  "dependencies": {
35
35
  "@snack-uikit/button": "0.17.0",
36
36
  "@snack-uikit/calendar": "0.7.6",
37
- "@snack-uikit/droplist": "0.13.14",
37
+ "@snack-uikit/droplist": "0.13.15",
38
38
  "@snack-uikit/icons": "0.20.1",
39
39
  "@snack-uikit/input-private": "3.1.1",
40
40
  "@snack-uikit/list": "0.11.0",
41
41
  "@snack-uikit/scroll": "0.5.2",
42
42
  "@snack-uikit/slider": "0.1.7",
43
- "@snack-uikit/tag": "0.8.2",
43
+ "@snack-uikit/tag": "0.9.0",
44
44
  "@snack-uikit/tooltip": "0.13.1",
45
45
  "@snack-uikit/truncate-string": "0.4.12",
46
46
  "@snack-uikit/utils": "3.2.0",
@@ -56,5 +56,5 @@
56
56
  "peerDependencies": {
57
57
  "@snack-uikit/locale": "*"
58
58
  },
59
- "gitHead": "082743508cd64cdc90ed11d2ea51280b5cab19de"
59
+ "gitHead": "f6b48b7373bda024626822d7c17b05d6ddbf20b2"
60
60
  }
@@ -18,8 +18,12 @@ $base-min-width: 4px;
18
18
  }
19
19
 
20
20
  .contentWrapper {
21
+ position: relative;
22
+
23
+ overflow: hidden;
21
24
  display: flex;
22
25
  flex-wrap: wrap;
26
+
23
27
  width: 100%;
24
28
  }
25
29
 
@@ -59,9 +63,7 @@ $base-min-width: 4px;
59
63
  $button-width: simple-var($icons-sizes, $size);
60
64
  $postfix-width: calc(var(#{$space-fields-postfix-gap}) + $button-width * 2);
61
65
  $margin-right: calc(
62
- #{simple-var($fields, $containerVariant, $size, 'padding-right')} +
63
- #{simple-var($fields, $containerVariant, $size, 'gap')} +
64
- #{$postfix-width}
66
+ #{simple-var($fields, $containerVariant, $size, 'padding-right')} + #{simple-var($fields, $containerVariant, $size, 'gap')} + #{$postfix-width}
65
67
  );
66
68
 
67
69
  width: calc(100% - $margin-right);
@@ -4,8 +4,8 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
4
4
  import {
5
5
  AccordionItemProps,
6
6
  BaseItemProps,
7
+ DroplistProps,
7
8
  GroupItemProps,
8
- ListProps,
9
9
  NextListItemProps,
10
10
  SelectionMultipleState,
11
11
  SelectionSingleState,
@@ -82,7 +82,9 @@ type FiledSelectCommonProps = WithSupportProps<{
82
82
  /** Иконка-префикс для поля */
83
83
  prefixIcon?: ReactElement;
84
84
 
85
- footer?: ListProps['footer'];
85
+ footer?: DroplistProps['footer'];
86
+
87
+ widthStrategy?: DroplistProps['widthStrategy'];
86
88
 
87
89
  search?: SearchState;
88
90
 
@@ -97,7 +99,7 @@ type FiledSelectCommonProps = WithSupportProps<{
97
99
  selectedOptionFormatter?: SelectedOptionFormatter;
98
100
  }> &
99
101
  Pick<
100
- ListProps,
102
+ DroplistProps,
101
103
  'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'pinTop' | 'pinBottom' | 'dataFiltered'
102
104
  >;
103
105
 
@@ -11,6 +11,8 @@ export function extractListProps({
11
11
  pinBottom,
12
12
  dataFiltered,
13
13
  loading,
14
+ footer,
15
+ widthStrategy,
14
16
  }: Partial<FieldSelectProps>): Partial<DroplistProps> {
15
17
  return {
16
18
  dataError,
@@ -21,6 +23,8 @@ export function extractListProps({
21
23
  pinBottom,
22
24
  dataFiltered,
23
25
  loading,
26
+ footer,
27
+ widthStrategy,
24
28
  trigger: 'clickAndFocusVisible',
25
29
  placement: 'bottom',
26
30
  'data-test-id': 'field-select__list',