@snack-uikit/list 0.9.2-preview-cc3d0341.0 → 0.9.2-preview-0f7b85a9.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.
@@ -31,7 +31,7 @@ export function BaseItem(_a) {
31
31
  const handleChange = () => {
32
32
  onChange === null || onChange === void 0 ? void 0 : onChange(id !== null && id !== void 0 ? id : '');
33
33
  };
34
- const handleItemClick = (e) => {
34
+ const handleItemMouseDown = (e) => {
35
35
  if (disabled)
36
36
  return;
37
37
  if (interactive) {
@@ -40,7 +40,7 @@ export function BaseItem(_a) {
40
40
  handleChange();
41
41
  }
42
42
  }
43
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
43
+ onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
44
44
  };
45
45
  const handleItemKeyDown = (e) => {
46
46
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
@@ -71,7 +71,7 @@ export function BaseItem(_a) {
71
71
  e.stopPropagation();
72
72
  };
73
73
  const props = extractSupportProps(rest);
74
- 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, { variant: contentTruncate === null || contentTruncate === void 0 ? void 0 : contentTruncate.variant, text: option, maxLines: (_b = contentTruncate === null || contentTruncate === void 0 ? void 0 : contentTruncate.option) !== null && _b !== void 0 ? _b : 1, "data-test-id": 'list__base-item-option' }) }), caption && _jsx("span", { className: styles.caption, children: caption })] }), description && (_jsx("div", { className: styles.description, children: _jsx(TruncateString, { text: description, maxLines: (_c = contentTruncate === null || contentTruncate === void 0 ? void 0 : contentTruncate.description) !== null && _c !== void 0 ? _c : 2, "data-test-id": 'list__base-item-description' }) }))] }), 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
+ const item = (_jsxs("li", { "data-type": 'outside', 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: onClick, onMouseDown: handleItemMouseDown, 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, { variant: contentTruncate === null || contentTruncate === void 0 ? void 0 : contentTruncate.variant, text: option, maxLines: (_b = contentTruncate === null || contentTruncate === void 0 ? void 0 : contentTruncate.option) !== null && _b !== void 0 ? _b : 1, "data-test-id": 'list__base-item-option' }) }), caption && _jsx("span", { className: styles.caption, children: caption })] }), description && (_jsx("div", { className: styles.description, children: _jsx(TruncateString, { text: description, maxLines: (_c = contentTruncate === null || contentTruncate === void 0 ? void 0 : contentTruncate.description) !== null && _c !== void 0 ? _c : 2, "data-test-id": 'list__base-item-description' }) }))] }), 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 })] }));
75
75
  if (!itemWrapRender) {
76
76
  return item;
77
77
  }
@@ -63,5 +63,5 @@ export function NextListItem(_a) {
63
63
  parentResetNestedIndex: resetNestedIndex,
64
64
  parentResetActiveFocusIndex: resetActiveFocusIndex,
65
65
  toggleOpenCollapsedItems: id => setOpenCollapsedItems(items => items.includes(id) ? items.filter(item => item !== id) : items.concat([id])),
66
- }, children: _jsx(ListPrivate, { onKeyDown: handleListKeyDown, items: items, nested: true, search: search, scroll: scroll, scrollRef: scrollRef, limitedScrollHeight: true }) }), trigger: 'hover', open: (open || parentIds[parentOpenNestedIndex] === id) && !disabled, onOpenChange: handleOpenChange, placement: placement, children: _jsx(BaseItem, Object.assign({}, option, { disabled: disabled, open: open, expandIcon: _jsx(ChevronRightSVG, {}), id: id, isParentNode: true, indeterminate: isIndeterminate && !checked, onSelect: handleOnSelect })) }));
66
+ }, children: _jsx(ListPrivate, { onKeyDown: handleListKeyDown, items: items, nested: true, search: search, scroll: scroll, scrollRef: scrollRef, limitedScrollHeight: true }) }), trigger: 'hover', open: (open || parentIds[parentOpenNestedIndex] === id) && !disabled, onOpenChange: handleOpenChange, placement: placement, widthStrategy: 'auto', children: _jsx(BaseItem, Object.assign({}, option, { disabled: disabled, open: open, expandIcon: _jsx(ChevronRightSVG, {}), id: id, isParentNode: true, indeterminate: isIndeterminate && !checked, onSelect: handleOnSelect })) }));
67
67
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "List",
7
- "version": "0.9.2-preview-cc3d0341.0",
7
+ "version": "0.9.2-preview-0f7b85a9.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": "607d11f81bc54f36f16e2c45f3df031eb904d5cd"
57
+ "gitHead": "a78053cb8d789880dfd67d78ced96c69d55fea42"
58
58
  }
@@ -50,7 +50,7 @@ export function BaseItem({
50
50
  onChange?.(id ?? '');
51
51
  };
52
52
 
53
- const handleItemClick = (e: MouseEvent<HTMLElement>) => {
53
+ const handleItemMouseDown = (e: MouseEvent<HTMLElement>) => {
54
54
  if (disabled) return;
55
55
 
56
56
  if (interactive) {
@@ -61,7 +61,7 @@ export function BaseItem({
61
61
  }
62
62
  }
63
63
 
64
- onClick?.(e);
64
+ onMouseDown?.(e);
65
65
  };
66
66
 
67
67
  const handleItemKeyDown = (e: KeyboardEvent<HTMLElement>) => {
@@ -102,13 +102,14 @@ export function BaseItem({
102
102
 
103
103
  const item = (
104
104
  <li
105
+ data-type='outside'
105
106
  role={'menuitem'}
106
107
  data-test-id={props['data-test-id'] || 'list__base-item_' + id}
107
108
  ref={itemRef as unknown as RefObject<HTMLLIElement>}
108
109
  className={cn(commonStyles.listItem, styles.droplistItem, className)}
109
110
  data-size={size}
110
- onClick={handleItemClick}
111
- onMouseDown={onMouseDown}
111
+ onClick={onClick}
112
+ onMouseDown={handleItemMouseDown}
112
113
  tabIndex={-1}
113
114
  data-non-pointer={inactive && !onClick}
114
115
  data-inactive={inactive || undefined}
@@ -116,6 +116,7 @@ export function NextListItem({
116
116
  open={(open || parentIds[parentOpenNestedIndex] === id) && !disabled}
117
117
  onOpenChange={handleOpenChange}
118
118
  placement={placement}
119
+ widthStrategy='auto'
119
120
  >
120
121
  <BaseItem
121
122
  {...option}