@apia/components 4.0.79 → 4.0.81

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/dist/index.d.ts CHANGED
@@ -923,7 +923,7 @@ declare class AutocompleteController {
923
923
  selectFocused(): void;
924
924
  setValue(value: string, props?: {
925
925
  fireOnChange?: boolean;
926
- force?: true;
926
+ force?: boolean;
927
927
  }): Promise<void>;
928
928
  tooltipRef: ApiaUtilTooltip | null;
929
929
  }
package/dist/index.js CHANGED
@@ -149,7 +149,7 @@ class AccordionHandler {
149
149
  udpateItem(itemId, updater) {
150
150
  const newProps = updater instanceof Function ? updater(this.itemsState[itemId]) : updater;
151
151
  Object.assign(this.itemsState[itemId], newProps);
152
- this.itemsStateListeners[itemId].forEach(
152
+ this.itemsStateListeners?.[itemId]?.forEach(
153
153
  (current) => current(this.itemsState[itemId])
154
154
  );
155
155
  }
@@ -3642,7 +3642,10 @@ const Autocomplete = (props) => {
3642
3642
  if (!shallowEqual$1(prevProps.current, props.properties) && handler?.state) {
3643
3643
  Object.assign(handler.state, props.properties);
3644
3644
  if (prevProps.current?.value !== props.properties?.value && props.properties?.value !== void 0) {
3645
- handler.setValue(props.properties.value, { fireOnChange: false });
3645
+ handler.setValue(props.properties.value, {
3646
+ fireOnChange: false,
3647
+ force: prevProps.current?.value === void 0
3648
+ });
3646
3649
  }
3647
3650
  }
3648
3651
  if (!handler) {
@@ -5585,7 +5588,6 @@ const ListboxItem = memo(
5585
5588
  ),
5586
5589
  onMouseDown: useCallback(
5587
5590
  (ev) => {
5588
- console.log("onMouseDown");
5589
5591
  onClickNode?.({
5590
5592
  ...ev,
5591
5593
  target: ev.target.closest(
@@ -6312,7 +6314,6 @@ function useIndexedChildren(children, listboxActions) {
6312
6314
  function useListboxAutofocus(storeId, getState) {
6313
6315
  return {
6314
6316
  onClick: useCallback(() => {
6315
- console.log("onMouseDown useListboxAutofocus");
6316
6317
  if (document.activeElement !== document.querySelector(`#${storeId} .listbox__list`)) {
6317
6318
  const el = document.querySelector(
6318
6319
  `#${storeId} .listbox__list`
@@ -6331,13 +6332,10 @@ function useListboxAutofocus(storeId, getState) {
6331
6332
  `#${storeId} .listbox__list .listbox__row:nth-child(${focusedRowId})`
6332
6333
  );
6333
6334
  if (focusedRow) {
6334
- focusedRow.scrollIntoView({
6335
- behavior: "auto",
6336
- block: "nearest",
6337
- inline: "nearest"
6338
- });
6339
6335
  const scrollContainer = findScrollContainer(focusedRow);
6340
- if (scrollContainer && scrollContainer !== document.body) {
6336
+ console.log(focusedRow, scrollContainer);
6337
+ if (scrollContainer && scrollContainer.classList.contains("listbox")) {
6338
+ console.log("scroll container into view");
6341
6339
  scrollContainer.scrollIntoView({
6342
6340
  behavior: "auto",
6343
6341
  block: "nearest",
@@ -6348,6 +6346,12 @@ function useListboxAutofocus(storeId, getState) {
6348
6346
  if (elRect.top - contRect.top < elRect.height)
6349
6347
  scrollContainer.scrollTop -= elRect.height;
6350
6348
  }
6349
+ console.log("scroll focusedRow into view");
6350
+ focusedRow.scrollIntoView({
6351
+ behavior: "auto",
6352
+ block: "nearest",
6353
+ inline: "nearest"
6354
+ });
6351
6355
  }
6352
6356
  }, [getState, storeId])
6353
6357
  };