@apia/components 3.0.10 → 3.0.12

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.js CHANGED
@@ -1354,22 +1354,37 @@ const OpenModal = (props) => {
1354
1354
  if (previousOpenProp.current !== props.isOpen && !props.isOpen) {
1355
1355
  modalProps.hide();
1356
1356
  }
1357
+ const hasConfirmed = useRef(false);
1357
1358
  const confirmProps = props.confirmProps;
1358
1359
  if (props.onConfirm || props.onCancel) {
1359
- return /* @__PURE__ */ jsx(Modal, { ...props, ...modalProps, children: /* @__PURE__ */ jsx(
1360
- Confirm,
1360
+ return /* @__PURE__ */ jsx(
1361
+ Modal,
1361
1362
  {
1362
- ...confirmProps,
1363
- onConfirm: () => {
1364
- props.onConfirm?.();
1365
- modalProps.hide();
1366
- },
1367
- onCancel: () => {
1368
- modalProps.hide();
1363
+ ...props,
1364
+ ...modalProps,
1365
+ onExited: () => {
1366
+ props.onClose?.();
1367
+ if (!hasConfirmed.current) {
1368
+ props.onCancel?.();
1369
+ }
1369
1370
  },
1370
- children: props.children
1371
+ children: /* @__PURE__ */ jsx(
1372
+ Confirm,
1373
+ {
1374
+ ...confirmProps,
1375
+ onConfirm: () => {
1376
+ hasConfirmed.current = true;
1377
+ props.onConfirm?.();
1378
+ modalProps.hide();
1379
+ },
1380
+ onCancel: () => {
1381
+ modalProps.hide();
1382
+ },
1383
+ children: props.children
1384
+ }
1385
+ )
1371
1386
  }
1372
- ) });
1387
+ );
1373
1388
  }
1374
1389
  return /* @__PURE__ */ jsx(Modal, { ...props, ...modalProps });
1375
1390
  };
@@ -2063,7 +2078,7 @@ class TabsController {
2063
2078
  const openIndex = tabsList.findIndex(
2064
2079
  (current) => current === this.activeTab
2065
2080
  );
2066
- if (openIndex < 0)
2081
+ if (openIndex == tabsList.length - 1)
2067
2082
  return null;
2068
2083
  const newOpenIndex = openIndex + 1;
2069
2084
  this.openTab(tabsList[newOpenIndex].id);
@@ -5101,16 +5116,18 @@ const AutoEllipsis = ({
5101
5116
  unsuscribe.current();
5102
5117
  function showBox() {
5103
5118
  clone.current = el.cloneNode(true);
5104
- Object.entries(window.getComputedStyle(findParent?.(el) ?? el)).forEach(
5105
- ([name, value]) => {
5106
- if (name.match(/webkit/))
5107
- return;
5108
- try {
5119
+ const target = findParent?.(el) ?? el;
5120
+ const styles = window.getComputedStyle(target);
5121
+ for (let i = 0; i < styles.length; i++) {
5122
+ try {
5123
+ const name = styles[i];
5124
+ const value = styles[name];
5125
+ if (!name.match(/webkit/)) {
5109
5126
  clone.current.style[name] = value;
5110
- } catch (e) {
5111
5127
  }
5128
+ } catch (e) {
5112
5129
  }
5113
- );
5130
+ }
5114
5131
  const bound = el.getBoundingClientRect();
5115
5132
  clone.current.style.position = "fixed";
5116
5133
  clone.current.style.left = `${bound.left - 1}px`;
@@ -5127,16 +5144,19 @@ const AutoEllipsis = ({
5127
5144
  clone.current.style.height = "auto";
5128
5145
  clone.current.style.fill = "var(--theme-ui-colors-palette-text-primary)";
5129
5146
  clone.current.style.pointerEvents = "none";
5147
+ clone.current.style.wordBreak = "break-all";
5130
5148
  const overridenStyles = overrideStyles?.(el);
5131
5149
  if (overridenStyles) {
5132
- Object.entries(overridenStyles).forEach(([name, value]) => {
5133
- if (name.match(/webkit/))
5134
- return;
5150
+ for (let i = 0; i < (overridenStyles?.length ?? 0); i++) {
5135
5151
  try {
5136
- clone.current.style[name] = value;
5152
+ const name = overridenStyles[i];
5153
+ const value = overridenStyles[name];
5154
+ if (!name.match(/webkit/)) {
5155
+ clone.current.style[name] = value;
5156
+ }
5137
5157
  } catch (e) {
5138
5158
  }
5139
- });
5159
+ }
5140
5160
  }
5141
5161
  clone.current.addEventListener("mouseleave", (ev) => {
5142
5162
  if (isChild(
@@ -5147,8 +5167,6 @@ const AutoEllipsis = ({
5147
5167
  clone.current?.remove();
5148
5168
  });
5149
5169
  function close() {
5150
- clone.current?.remove();
5151
- document.removeEventListener("scroll", close);
5152
5170
  }
5153
5171
  document.addEventListener("scroll", close);
5154
5172
  document.body.append(clone.current);