@snack-uikit/list 0.4.2-preview-da21d728.0 → 0.6.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,33 @@
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.6.0 (2024-02-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-4324:** fix onChange selection value in controlled ([0be6178](https://github.com/cloud-ru-tech/snack-uikit/commit/0be6178e51dc24ff4c367a420d61065d00d695fd))
12
+
13
+
14
+ ### Features
15
+
16
+ * **FF-4324:** add some exports ([7a62446](https://github.com/cloud-ru-tech/snack-uikit/commit/7a6244690288d279bbd4746280029f8f5ecda0b0))
17
+
18
+
19
+
20
+
21
+
22
+ # 0.5.0 (2024-02-27)
23
+
24
+
25
+ ### Features
26
+
27
+ * **FF-4237:** add onmousedown handling ([1d9347a](https://github.com/cloud-ru-tech/snack-uikit/commit/1d9347a73c24b439d09bde236ebee84cb3843cf4))
28
+
29
+
30
+
31
+
32
+
6
33
  ## 0.4.1 (2024-02-26)
7
34
 
8
35
  ### Only dependencies have been changed
@@ -5,5 +5,5 @@ type AllBaseItemProps = BaseItemProps & BaseItemPrivateProps & {
5
5
  onSelect?(): void;
6
6
  isParentNode?: boolean;
7
7
  };
8
- export declare function BaseItem({ beforeContent, afterContent, content, onClick, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive, itemWrapRender, ...rest }: AllBaseItemProps): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
8
+ export declare function BaseItem({ beforeContent, afterContent, content, onClick, onMouseDown, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive, itemWrapRender, ...rest }: AllBaseItemProps): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
9
9
  export {};
@@ -19,7 +19,7 @@ import commonStyles from '../styles.module.css';
19
19
  import { CHECKBOX_SIZE_MAP } from './constants';
20
20
  import styles from './styles.module.css';
21
21
  export function BaseItem(_a) {
22
- var { beforeContent, afterContent, content, onClick, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive, itemWrapRender } = _a, rest = __rest(_a, ["beforeContent", "afterContent", "content", "onClick", "id", "expandIcon", "disabled", "open", "itemRef", "switch", "onKeyDown", "onFocus", "indeterminate", "onSelect", "isParentNode", "className", "inactive", "itemWrapRender"]);
22
+ var { beforeContent, afterContent, content, onClick, onMouseDown, id, expandIcon, disabled, open, itemRef, switch: switchProp, onKeyDown, onFocus, indeterminate, onSelect, isParentNode, className, inactive, itemWrapRender } = _a, rest = __rest(_a, ["beforeContent", "afterContent", "content", "onClick", "onMouseDown", "id", "expandIcon", "disabled", "open", "itemRef", "switch", "onKeyDown", "onFocus", "indeterminate", "onSelect", "isParentNode", "className", "inactive", "itemWrapRender"]);
23
23
  const { option, caption, description } = content || {};
24
24
  const interactive = !inactive;
25
25
  const { parentResetActiveFocusIndex } = useParentListContext();
@@ -70,7 +70,7 @@ export function BaseItem(_a) {
70
70
  e.stopPropagation();
71
71
  };
72
72
  const props = extractSupportProps(rest);
73
- const item = (_jsxs("li", { role: 'menuitem', "data-test-id": props['data-test-id'] || 'list__base-item_' + id, ref: itemRef, className: cn(commonStyles.listItem, styles.droplistItem, className), "data-size": size, onClick: handleItemClick, tabIndex: -1, "data-non-pointer": inactive && !onClick, "data-inactive": inactive || undefined, "data-checked": (isParentNode && (indeterminate || isChecked)) || (isChecked && !switchProp) || undefined, "data-variant": mode || undefined, "data-open": open || undefined, "data-disabled": disabled || undefined, "aria-disabled": disabled || undefined, "data-parent": parent || 'list', onKeyDown: handleItemKeyDown, onFocus: handleItemFocus, style: { '--level': level }, children: [!switchProp && isSelectionSingle && marker && !isParentNode && interactive && (_jsx("div", { className: styles.markerContainer, "data-test-id": 'list__base-item-marker' })), !switchProp && isSelectionMultiple && interactive && (_jsx("div", { className: styles.checkbox, children: _jsx(Checkbox, { size: CHECKBOX_SIZE_MAP[size !== null && size !== void 0 ? size : 's'], disabled: disabled, tabIndex: -1, onChange: handleCheckboxChange, checked: isChecked, "data-test-id": 'list__base-item-checkbox', onClick: handleCheckboxClick, indeterminate: indeterminate }) })), beforeContent && _jsx("div", { className: styles.beforeContent, children: beforeContent }), _jsxs("div", { className: styles.content, children: [_jsxs("div", { className: styles.headline, children: [_jsx("span", { className: styles.option, children: _jsx(TruncateString, { text: option, maxLines: 1 }) }), caption && _jsx("span", { className: styles.caption, children: caption })] }), description && (_jsx("div", { className: styles.description, children: _jsx(TruncateString, { text: description, maxLines: 2 }) }))] }), afterContent, switchProp && interactive && (_jsx(Switch, { disabled: disabled, checked: isChecked, "data-test-id": 'list__base-item-switch' })), !switchProp && expandIcon && _jsx("span", { className: styles.expandableIcon, children: expandIcon })] }));
73
+ const item = (_jsxs("li", { role: 'menuitem', "data-test-id": props['data-test-id'] || 'list__base-item_' + id, ref: itemRef, className: cn(commonStyles.listItem, styles.droplistItem, className), "data-size": size, onClick: handleItemClick, onMouseDown: onMouseDown, tabIndex: -1, "data-non-pointer": inactive && !onClick, "data-inactive": inactive || undefined, "data-checked": (isParentNode && (indeterminate || isChecked)) || (isChecked && !switchProp) || undefined, "data-variant": mode || undefined, "data-open": open || undefined, "data-disabled": disabled || undefined, "aria-disabled": disabled || undefined, "data-parent": parent || 'list', onKeyDown: handleItemKeyDown, onFocus: handleItemFocus, style: { '--level': level }, children: [!switchProp && isSelectionSingle && marker && !isParentNode && interactive && (_jsx("div", { className: styles.markerContainer, "data-test-id": 'list__base-item-marker' })), !switchProp && isSelectionMultiple && interactive && (_jsx("div", { className: styles.checkbox, children: _jsx(Checkbox, { size: CHECKBOX_SIZE_MAP[size !== null && size !== void 0 ? size : 's'], disabled: disabled, tabIndex: -1, onChange: handleCheckboxChange, checked: isChecked, "data-test-id": 'list__base-item-checkbox', onClick: handleCheckboxClick, indeterminate: indeterminate }) })), beforeContent && _jsx("div", { className: styles.beforeContent, children: beforeContent }), _jsxs("div", { className: styles.content, children: [_jsxs("div", { className: styles.headline, children: [_jsx("span", { className: styles.option, children: _jsx(TruncateString, { text: option, maxLines: 1 }) }), caption && _jsx("span", { className: styles.caption, children: caption })] }), description && (_jsx("div", { className: styles.description, children: _jsx(TruncateString, { text: description, maxLines: 2 }) }))] }), afterContent, switchProp && interactive && (_jsx(Switch, { disabled: disabled, checked: isChecked, "data-test-id": 'list__base-item-switch' })), !switchProp && expandIcon && _jsx("span", { className: styles.expandableIcon, children: expandIcon })] }));
74
74
  if (!itemWrapRender) {
75
75
  return item;
76
76
  }
@@ -26,6 +26,8 @@ export type BaseItemProps = WithSupportProps<{
26
26
  content: ItemContentProps;
27
27
  /** Колбек обработки клика */
28
28
  onClick?(e: MouseEvent<HTMLElement>): void;
29
+ /** Колбек обработки нажатия кнопки мыши */
30
+ onMouseDown?(e: MouseEvent<HTMLElement>): void;
29
31
  /** Колбек обработки нажатия клавиши */
30
32
  onKeyDown?(e: KeyboardEvent<HTMLElement>): void;
31
33
  /** Колбек обработки фокуса */
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "List",
7
- "version": "0.4.2-preview-da21d728.0",
7
+ "version": "0.6.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -32,7 +32,7 @@
32
32
  "license": "Apache-2.0",
33
33
  "scripts": {},
34
34
  "dependencies": {
35
- "@snack-uikit/divider": "3.0.2-preview-da21d728.0",
35
+ "@snack-uikit/divider": "3.0.2",
36
36
  "@snack-uikit/dropdown": "0.2.0",
37
37
  "@snack-uikit/icons": "0.20.1",
38
38
  "@snack-uikit/info-block": "0.3.0",
@@ -54,5 +54,5 @@
54
54
  "peerDependencies": {
55
55
  "@snack-uikit/locale": "*"
56
56
  },
57
- "gitHead": "9451c0c01e3175ef35d07864f3189c690f73c268"
57
+ "gitHead": "559f1542bf57e8a3be174390e4bd1f2b8f799946"
58
58
  }
@@ -19,6 +19,7 @@ export function BaseItem({
19
19
  afterContent,
20
20
  content,
21
21
  onClick,
22
+ onMouseDown,
22
23
  id,
23
24
  expandIcon,
24
25
  disabled,
@@ -107,6 +108,7 @@ export function BaseItem({
107
108
  className={cn(commonStyles.listItem, styles.droplistItem, className)}
108
109
  data-size={size}
109
110
  onClick={handleItemClick}
111
+ onMouseDown={onMouseDown}
110
112
  tabIndex={-1}
111
113
  data-non-pointer={inactive && !onClick}
112
114
  data-inactive={inactive || undefined}
@@ -32,6 +32,8 @@ export type BaseItemProps = WithSupportProps<{
32
32
 
33
33
  /** Колбек обработки клика */
34
34
  onClick?(e: MouseEvent<HTMLElement>): void;
35
+ /** Колбек обработки нажатия кнопки мыши */
36
+ onMouseDown?(e: MouseEvent<HTMLElement>): void;
35
37
  /** Колбек обработки нажатия клавиши */
36
38
  onKeyDown?(e: KeyboardEvent<HTMLElement>): void;
37
39
  /** Колбек обработки фокуса */