@snack-uikit/list 0.28.1 → 0.29.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 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.29.0 (2025-05-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-6490:** list item before content min-size ([56732b0](https://github.com/cloud-ru-tech/snack-uikit/commit/56732b047edabe2617a614378dbc9413a0b60f9d))
12
+
13
+
14
+ ### Features
15
+
16
+ * **FF-6490:** pass List size prop to emptyStates ([07f5425](https://github.com/cloud-ru-tech/snack-uikit/commit/07f5425db9fcaf250a910a2cf8b1e572746933ab))
17
+
18
+
19
+
20
+
21
+
6
22
  ## 0.28.1 (2025-05-12)
7
23
 
8
24
  ### Only dependencies have been changed
@@ -14,8 +14,8 @@
14
14
  flex-shrink:0;
15
15
  align-items:center;
16
16
  justify-content:center;
17
- width:var(--size-icon-container-s, 24px);
18
- height:var(--size-icon-container-s, 24px);
17
+ min-width:var(--size-icon-container-s, 24px);
18
+ min-height:var(--size-icon-container-s, 24px);
19
19
  color:var(--sys-neutral-text-light, #8b8e9b);
20
20
  }
21
21
  .beforeContent svg{
@@ -132,10 +132,11 @@ exports.ListPrivate = (0, react_1.forwardRef)((_a, ref) => {
132
132
  dataError: dataError,
133
133
  emptyStates: emptyStates,
134
134
  hasNoItems: hasNoItems,
135
- dataFiltered: dataFiltered !== null && dataFiltered !== void 0 ? dataFiltered : Boolean(search === null || search === void 0 ? void 0 : search.value)
135
+ dataFiltered: dataFiltered !== null && dataFiltered !== void 0 ? dataFiltered : Boolean(search === null || search === void 0 ? void 0 : search.value),
136
+ size: size
136
137
  })]
137
138
  });
138
- }, [dataError, dataFiltered, emptyStates, hasNoItems, itemsJSX, loading, loadingJSX, search === null || search === void 0 ? void 0 : search.value, virtualItems, virtualized, virtualizer]);
139
+ }, [dataError, dataFiltered, emptyStates, hasNoItems, itemsJSX, loading, loadingJSX, search === null || search === void 0 ? void 0 : search.value, size, virtualItems, virtualized, virtualizer]);
139
140
  const onScrollInitialized = () => {
140
141
  var _a, _b;
141
142
  if (scrollToSelectedItem) {
@@ -1,5 +1,6 @@
1
1
  import { InfoBlockProps } from '@snack-uikit/info-block';
2
- export type EmptyStateProps = Pick<InfoBlockProps, 'description' | 'icon' | 'data-test-id' | 'footer'>;
2
+ import { ListPrivateProps } from '../../components/Lists/types';
3
+ export type EmptyStateProps = Pick<InfoBlockProps, 'description' | 'icon' | 'data-test-id' | 'footer' | 'className'>;
3
4
  export type ListEmptyState = {
4
5
  emptyStates: {
5
6
  noDataState: EmptyStateProps;
@@ -10,5 +11,6 @@ export type ListEmptyState = {
10
11
  dataError?: boolean;
11
12
  dataFiltered?: boolean;
12
13
  hasNoItems: boolean;
14
+ size: ListPrivateProps['size'];
13
15
  };
14
- export declare function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading }: ListEmptyState): import("react/jsx-runtime").JSX.Element | null;
16
+ export declare function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading, size }: ListEmptyState): import("react/jsx-runtime").JSX.Element | null;
@@ -18,7 +18,8 @@ function ListEmptyState(_ref) {
18
18
  dataFiltered,
19
19
  hasNoItems,
20
20
  emptyStates,
21
- loading
21
+ loading,
22
+ size
22
23
  } = _ref;
23
24
  if (loading) {
24
25
  return null;
@@ -27,7 +28,7 @@ function ListEmptyState(_ref) {
27
28
  return (0, jsx_runtime_1.jsx)("div", {
28
29
  className: styles_module_scss_1.default.listEmptyStateWrapper,
29
30
  children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, Object.assign({}, emptyStates.errorDataState, {
30
- size: 'm',
31
+ size: size,
31
32
  align: 'vertical'
32
33
  }))
33
34
  });
@@ -36,7 +37,7 @@ function ListEmptyState(_ref) {
36
37
  return (0, jsx_runtime_1.jsx)("div", {
37
38
  className: styles_module_scss_1.default.listEmptyStateWrapper,
38
39
  children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, Object.assign({}, emptyStates.noResultsState, {
39
- size: 'm',
40
+ size: size,
40
41
  align: 'vertical',
41
42
  "data-test-id": 'list__no-results'
42
43
  }))
@@ -46,7 +47,7 @@ function ListEmptyState(_ref) {
46
47
  return (0, jsx_runtime_1.jsx)("div", {
47
48
  className: styles_module_scss_1.default.listEmptyStateWrapper,
48
49
  children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, Object.assign({}, emptyStates.noDataState, {
49
- size: 'm',
50
+ size: size,
50
51
  align: 'vertical',
51
52
  "data-test-id": 'list__no-data'
52
53
  }))
@@ -14,8 +14,8 @@
14
14
  flex-shrink:0;
15
15
  align-items:center;
16
16
  justify-content:center;
17
- width:var(--size-icon-container-s, 24px);
18
- height:var(--size-icon-container-s, 24px);
17
+ min-width:var(--size-icon-container-s, 24px);
18
+ min-height:var(--size-icon-container-s, 24px);
19
19
  color:var(--sys-neutral-text-light, #8b8e9b);
20
20
  }
21
21
  .beforeContent svg{
@@ -46,7 +46,7 @@ export const ListPrivate = forwardRef((_a, ref) => {
46
46
  const loadingJSX = useMemo(() => loading && (_jsx("div", { role: 'spinbutton', tabIndex: -1, className: styles.loader, "data-size": size, "data-no-items": hasNoItems || undefined, "data-test-id": 'list__loader', children: _jsx(Spinner, { size: size === 'l' ? 's' : 'xs' }) })), [hasNoItems, loading, size]);
47
47
  const content = useMemo(() => {
48
48
  var _a, _b;
49
- return (_jsxs("div", { className: styles.content, children: [virtualized ? (_jsx("div", { className: styles.virtualizedContainer, style: { height: virtualizer.getTotalSize() }, tabIndex: -1, children: _jsx("div", { className: styles.virtualizedPositionBox, style: { transform: `translateY(${(_b = (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0}px)` }, tabIndex: -1, children: virtualItems.map(virtualRow => (_jsx("div", { "data-index": virtualRow.index, ref: virtualizer.measureElement, tabIndex: -1, children: itemsJSX[virtualRow.index] }, virtualRow.key))) }) })) : (itemsJSX), loadingJSX, _jsx(ListEmptyState, { loading: loading, dataError: dataError, emptyStates: emptyStates, hasNoItems: hasNoItems, dataFiltered: dataFiltered !== null && dataFiltered !== void 0 ? dataFiltered : Boolean(search === null || search === void 0 ? void 0 : search.value) })] }));
49
+ return (_jsxs("div", { className: styles.content, children: [virtualized ? (_jsx("div", { className: styles.virtualizedContainer, style: { height: virtualizer.getTotalSize() }, tabIndex: -1, children: _jsx("div", { className: styles.virtualizedPositionBox, style: { transform: `translateY(${(_b = (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0}px)` }, tabIndex: -1, children: virtualItems.map(virtualRow => (_jsx("div", { "data-index": virtualRow.index, ref: virtualizer.measureElement, tabIndex: -1, children: itemsJSX[virtualRow.index] }, virtualRow.key))) }) })) : (itemsJSX), loadingJSX, _jsx(ListEmptyState, { loading: loading, dataError: dataError, emptyStates: emptyStates, hasNoItems: hasNoItems, dataFiltered: dataFiltered !== null && dataFiltered !== void 0 ? dataFiltered : Boolean(search === null || search === void 0 ? void 0 : search.value), size: size })] }));
50
50
  }, [
51
51
  dataError,
52
52
  dataFiltered,
@@ -56,6 +56,7 @@ export const ListPrivate = forwardRef((_a, ref) => {
56
56
  loading,
57
57
  loadingJSX,
58
58
  search === null || search === void 0 ? void 0 : search.value,
59
+ size,
59
60
  virtualItems,
60
61
  virtualized,
61
62
  virtualizer,
@@ -1,5 +1,6 @@
1
1
  import { InfoBlockProps } from '@snack-uikit/info-block';
2
- export type EmptyStateProps = Pick<InfoBlockProps, 'description' | 'icon' | 'data-test-id' | 'footer'>;
2
+ import { ListPrivateProps } from '../../components/Lists/types';
3
+ export type EmptyStateProps = Pick<InfoBlockProps, 'description' | 'icon' | 'data-test-id' | 'footer' | 'className'>;
3
4
  export type ListEmptyState = {
4
5
  emptyStates: {
5
6
  noDataState: EmptyStateProps;
@@ -10,5 +11,6 @@ export type ListEmptyState = {
10
11
  dataError?: boolean;
11
12
  dataFiltered?: boolean;
12
13
  hasNoItems: boolean;
14
+ size: ListPrivateProps['size'];
13
15
  };
14
- export declare function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading }: ListEmptyState): import("react/jsx-runtime").JSX.Element | null;
16
+ export declare function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading, size }: ListEmptyState): import("react/jsx-runtime").JSX.Element | null;
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InfoBlock } from '@snack-uikit/info-block';
3
3
  import styles from './styles.module.css';
4
- export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading }) {
4
+ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading, size }) {
5
5
  if (loading) {
6
6
  return null;
7
7
  }
8
8
  if (dataError) {
9
- return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.errorDataState, { size: 'm', align: 'vertical' })) }));
9
+ return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.errorDataState, { size: size, align: 'vertical' })) }));
10
10
  }
11
11
  if (dataFiltered && hasNoItems) {
12
- return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noResultsState, { size: 'm', align: 'vertical', "data-test-id": 'list__no-results' })) }));
12
+ return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noResultsState, { size: size, align: 'vertical', "data-test-id": 'list__no-results' })) }));
13
13
  }
14
14
  if (!dataFiltered && hasNoItems) {
15
- return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noDataState, { size: 'm', align: 'vertical', "data-test-id": 'list__no-data' })) }));
15
+ return (_jsx("div", { className: styles.listEmptyStateWrapper, children: _jsx(InfoBlock, Object.assign({}, emptyStates.noDataState, { size: size, align: 'vertical', "data-test-id": 'list__no-data' })) }));
16
16
  }
17
17
  return null;
18
18
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "List",
7
- "version": "0.28.1",
7
+ "version": "0.29.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -54,5 +54,5 @@
54
54
  "peerDependencies": {
55
55
  "@snack-uikit/locale": "*"
56
56
  },
57
- "gitHead": "82c6f5f9fd1845d6752a3cb38e8b2e0fc3cc5c98"
57
+ "gitHead": "a39f56d39d7322c7de1880df9d4d7459ebb874f8"
58
58
  }
@@ -24,8 +24,8 @@ $sizes: 's', 'm', 'l';
24
24
  align-items: center;
25
25
  justify-content: center;
26
26
 
27
- width: styles-tokens-element.$icon-s;
28
- height: styles-tokens-element.$icon-s;
27
+ min-width: styles-tokens-element.$icon-s;
28
+ min-height: styles-tokens-element.$icon-s;
29
29
 
30
30
  color: styles-tokens-dropList.$sys-neutral-text-light;
31
31
 
@@ -124,6 +124,7 @@ export const ListPrivate = forwardRef(
124
124
  emptyStates={emptyStates}
125
125
  hasNoItems={hasNoItems}
126
126
  dataFiltered={dataFiltered ?? Boolean(search?.value)}
127
+ size={size}
127
128
  />
128
129
  </div>
129
130
  ),
@@ -136,6 +137,7 @@ export const ListPrivate = forwardRef(
136
137
  loading,
137
138
  loadingJSX,
138
139
  search?.value,
140
+ size,
139
141
  virtualItems,
140
142
  virtualized,
141
143
  virtualizer,
@@ -1,8 +1,9 @@
1
1
  import { InfoBlock, InfoBlockProps } from '@snack-uikit/info-block';
2
2
 
3
+ import { ListPrivateProps } from '../../components/Lists/types';
3
4
  import styles from './styles.module.scss';
4
5
 
5
- export type EmptyStateProps = Pick<InfoBlockProps, 'description' | 'icon' | 'data-test-id' | 'footer'>;
6
+ export type EmptyStateProps = Pick<InfoBlockProps, 'description' | 'icon' | 'data-test-id' | 'footer' | 'className'>;
6
7
 
7
8
  export type ListEmptyState = {
8
9
  emptyStates: {
@@ -14,9 +15,10 @@ export type ListEmptyState = {
14
15
  dataError?: boolean;
15
16
  dataFiltered?: boolean;
16
17
  hasNoItems: boolean;
18
+ size: ListPrivateProps['size'];
17
19
  };
18
20
 
19
- export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading }: ListEmptyState) {
21
+ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyStates, loading, size }: ListEmptyState) {
20
22
  if (loading) {
21
23
  return null;
22
24
  }
@@ -24,7 +26,7 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
24
26
  if (dataError) {
25
27
  return (
26
28
  <div className={styles.listEmptyStateWrapper}>
27
- <InfoBlock {...emptyStates.errorDataState} size='m' align='vertical' />
29
+ <InfoBlock {...emptyStates.errorDataState} size={size} align='vertical' />
28
30
  </div>
29
31
  );
30
32
  }
@@ -32,7 +34,7 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
32
34
  if (dataFiltered && hasNoItems) {
33
35
  return (
34
36
  <div className={styles.listEmptyStateWrapper}>
35
- <InfoBlock {...emptyStates.noResultsState} size='m' align='vertical' data-test-id='list__no-results' />
37
+ <InfoBlock {...emptyStates.noResultsState} size={size} align='vertical' data-test-id='list__no-results' />
36
38
  </div>
37
39
  );
38
40
  }
@@ -40,7 +42,7 @@ export function ListEmptyState({ dataError, dataFiltered, hasNoItems, emptyState
40
42
  if (!dataFiltered && hasNoItems) {
41
43
  return (
42
44
  <div className={styles.listEmptyStateWrapper}>
43
- <InfoBlock {...emptyStates.noDataState} size='m' align='vertical' data-test-id='list__no-data' />
45
+ <InfoBlock {...emptyStates.noDataState} size={size} align='vertical' data-test-id='list__no-data' />
44
46
  </div>
45
47
  );
46
48
  }