sales-frontend-design-system 0.0.138 → 0.0.140

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.
@@ -16,6 +16,11 @@
16
16
  &.is-disabled {
17
17
  cursor: not-allowed;
18
18
  }
19
+
20
+ .button-content {
21
+ display: inline-flex;
22
+ align-items: center;
23
+ }
19
24
  }
20
25
 
21
26
  .button-size-large {
package/dist/index.cjs.js CHANGED
@@ -1619,7 +1619,7 @@ const ComboBoxItem = ({
1619
1619
  ref: inputRef,
1620
1620
  type: type ?? "text",
1621
1621
  name,
1622
- readOnly,
1622
+ readOnly: true,
1623
1623
  onClick: handleClick(handleOnClick),
1624
1624
  onKeyDown: handleKeyDown(handleKeyDownEvent),
1625
1625
  role: "combobox",
@@ -3402,7 +3402,6 @@ const TabRoot = ({ ref, ...props }) => {
3402
3402
  const { className, children, scroll, onValueChange, variant, size, defaultValue, ...rest } = props;
3403
3403
  const tabProps = useTab(props);
3404
3404
  const containerRef = React.useRef(null);
3405
- const prevValueRef = React.useRef(null);
3406
3405
  const [underlineStyle, setUnderlineStyle] = React.useState({ left: 0, width: 0 });
3407
3406
  const updateUnderlinePosition = React.useCallback(() => {
3408
3407
  if (variant === "sub" && containerRef.current && tabProps.value) {
@@ -3434,30 +3433,36 @@ const TabRoot = ({ ref, ...props }) => {
3434
3433
  if (scroll === "scrollable" && containerRef.current && tabProps.value) {
3435
3434
  const container = containerRef.current;
3436
3435
  const activeTab = container.querySelector(`[data-value="${tabProps.value}"]`);
3437
- const prevTab = prevValueRef.current ? container.querySelector(`[data-value="${prevValueRef.current}"]`) : null;
3438
3436
  if (activeTab) {
3439
3437
  const containerRect = container.getBoundingClientRect();
3440
3438
  const tabRect = activeTab.getBoundingClientRect();
3441
- const isTabHidden = tabRect.left < containerRect.left || tabRect.right > containerRect.right;
3442
- if (isTabHidden) {
3443
- const isMovingLeft = prevTab ? activeTab.offsetLeft < prevTab.offsetLeft : false;
3444
- const beforeStyle = getComputedStyle(container, "::before");
3445
- const isBeforeVisible = beforeStyle.display !== "none";
3446
- const scrollPadding = isBeforeVisible ? parseFloat(beforeStyle.width) || 0 : 0;
3447
- if (isMovingLeft) {
3448
- container.scrollTo({
3449
- left: Math.max(0, activeTab.offsetLeft - scrollPadding),
3450
- behavior: "smooth"
3451
- });
3439
+ const shiftAmount = container.clientWidth * 0.2;
3440
+ const currentScroll = container.scrollLeft;
3441
+ const maxScroll = container.scrollWidth - container.clientWidth;
3442
+ const isHiddenLeft = tabRect.left < containerRect.left;
3443
+ const isHiddenRight = tabRect.right > containerRect.right;
3444
+ let newScroll;
3445
+ if (isHiddenLeft) {
3446
+ newScroll = Math.max(0, activeTab.offsetLeft - shiftAmount);
3447
+ } else if (isHiddenRight) {
3448
+ newScroll = Math.min(
3449
+ maxScroll,
3450
+ activeTab.offsetLeft + activeTab.offsetWidth + shiftAmount - container.clientWidth
3451
+ );
3452
+ } else {
3453
+ const tabCenter = tabRect.left + tabRect.width / 2;
3454
+ const containerCenter = containerRect.left + containerRect.width / 2;
3455
+ if (tabCenter < containerCenter) {
3456
+ newScroll = Math.max(0, currentScroll - shiftAmount);
3452
3457
  } else {
3453
- container.scrollTo({
3454
- left: activeTab.offsetLeft + activeTab.offsetWidth + scrollPadding - container.clientWidth,
3455
- behavior: "smooth"
3456
- });
3458
+ newScroll = Math.min(maxScroll, currentScroll + shiftAmount);
3457
3459
  }
3458
3460
  }
3461
+ container.scrollTo({
3462
+ left: newScroll,
3463
+ behavior: "smooth"
3464
+ });
3459
3465
  }
3460
- prevValueRef.current = tabProps.value;
3461
3466
  }
3462
3467
  }, [tabProps.value, scroll]);
3463
3468
  return /* @__PURE__ */ jsxRuntime.jsx(TabRootContext.Provider, { value: tabProps, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx$h("tab-container", `tab-container-variant-${props.variant}`), children: /* @__PURE__ */ jsxRuntime.jsx("div", { role: "tablist", ref, className: cx$h("tab-root", className), ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(