@ballistix.digital/react-components 9.8.0 → 9.8.1

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
@@ -4487,6 +4487,7 @@ const $06795e94e474e27d$var$List = (props)=>{
4487
4487
  const handleChangeSelect = (0, $iA2ta$react.useCallback)((e)=>{
4488
4488
  const key = e?.currentTarget?.value;
4489
4489
  const tab = (0, $iA2ta$react.Children).map(children, (child)=>child)?.find((child)=>child.props.accessor === key);
4490
+ if (tab?.props.isDisabled) return;
4490
4491
  if (tab?.props.href) window.location.href = tab.props.href;
4491
4492
  else if (tab?.props.onClick) setActive && setActive(tab?.props.accessor);
4492
4493
  }, [
@@ -4534,6 +4535,7 @@ const $06795e94e474e27d$var$List = (props)=>{
4534
4535
  if (child.props.isHidden) return null;
4535
4536
  return (0, $iA2ta$reactjsxruntime.jsx)("option", {
4536
4537
  value: child.props.accessor,
4538
+ disabled: child.props.isDisabled,
4537
4539
  children: child.props.label
4538
4540
  }, child?.props?.accessor);
4539
4541
  })
@@ -4551,7 +4553,7 @@ const $06795e94e474e27d$var$List = (props)=>{
4551
4553
  });
4552
4554
  };
4553
4555
  const $06795e94e474e27d$var$Item = (props)=>{
4554
- const { label: label, icon: icon, as: LinkComponent = 'a', type: type = 'underline', href: href, isCurrent: isCurrent, onClick: onClick, styles: stylesOverrides, isLoading: isLoading, isHidden: isHidden } = props;
4556
+ const { label: label, icon: icon, as: LinkComponent = 'a', type: type = 'underline', href: href, isCurrent: isCurrent, onClick: onClick, styles: stylesOverrides, isLoading: isLoading, isHidden: isHidden, isDisabled: isDisabled } = props;
4555
4557
  if (isHidden) return null;
4556
4558
  const handleGenerateStyle = ()=>{
4557
4559
  const result = (0, $f0c671820c340322$export$e2d2075c69d9100d)((0, $9420756208be2d43$export$2e2bcd8739ae039).base);
@@ -4562,18 +4564,31 @@ const $06795e94e474e27d$var$Item = (props)=>{
4562
4564
  return result;
4563
4565
  };
4564
4566
  const styles = handleGenerateStyle();
4567
+ const handleClickLink = (e)=>{
4568
+ if (isDisabled || isLoading || !onClick) {
4569
+ e.preventDefault();
4570
+ return;
4571
+ }
4572
+ onClick(e);
4573
+ };
4574
+ const handleClick = (e)=>{
4575
+ if (isDisabled || isLoading || !onClick) return;
4576
+ onClick(e);
4577
+ };
4565
4578
  if (href && LinkComponent) return (0, $iA2ta$reactjsxruntime.jsxs)(LinkComponent, {
4566
- href: href,
4567
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.tab.base, isCurrent ? styles.tab.active : styles.tab.inactive, isLoading && 'opacity-30 text-gray-300! cursor-default!', isLoading && styles.tab.inactive),
4568
- onClick: onClick,
4579
+ href: !isDisabled ? href : undefined,
4580
+ "aria-disabled": isDisabled,
4581
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.tab.base, isCurrent ? styles.tab.active : styles.tab.inactive, isLoading && 'opacity-30 text-gray-300! cursor-default!', isLoading && styles.tab.inactive, isDisabled && 'opacity-30 text-gray-300! cursor-not-allowed! pointer-events-none', isDisabled && styles.tab.inactive),
4582
+ onClick: handleClickLink,
4569
4583
  children: [
4570
4584
  icon,
4571
4585
  label
4572
4586
  ]
4573
4587
  });
4574
4588
  return (0, $iA2ta$reactjsxruntime.jsxs)("div", {
4575
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.tab.base, isCurrent ? styles.tab.active : styles.tab.inactive, isLoading && 'opacity-30 text-gray-300! cursor-default!', isLoading && styles.tab.inactive),
4576
- onClick: !isLoading ? onClick : ()=>null,
4589
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.tab.base, isCurrent ? styles.tab.active : styles.tab.inactive, isLoading && 'opacity-30 text-gray-300! cursor-default!', isLoading && styles.tab.inactive, isDisabled && 'opacity-30 text-gray-300! cursor-not-allowed!', isDisabled && styles.tab.inactive),
4590
+ "aria-disabled": isDisabled,
4591
+ onClick: handleClick,
4577
4592
  children: [
4578
4593
  icon,
4579
4594
  label