sales-frontend-design-system 0.0.138 → 0.0.139

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
@@ -1591,11 +1591,12 @@ const ComboBoxItem = ({
1591
1591
  validator,
1592
1592
  value,
1593
1593
  onValueChange,
1594
+ inputMode = "none",
1594
1595
  ...props
1595
1596
  }) => {
1596
1597
  const inputRef = React.useRef(null);
1597
1598
  const { errorState, setForceUpdate } = useFormValidator({ validator, name });
1598
- const { disabled, error, readOnly, size, ...rest } = useFieldControl(props);
1599
+ const { disabled, error, readOnly = true, size, ...rest } = useFieldControl(props);
1599
1600
  const { handleClick, handleKeyDown } = usePreventInteraction({ disabled, readOnly });
1600
1601
  const handleKeyDownEvent = (e) => {
1601
1602
  if (e.key === " " || e.key === "Enter") {
@@ -1620,6 +1621,7 @@ const ComboBoxItem = ({
1620
1621
  type: type ?? "text",
1621
1622
  name,
1622
1623
  readOnly,
1624
+ inputMode,
1623
1625
  onClick: handleClick(handleOnClick),
1624
1626
  onKeyDown: handleKeyDown(handleKeyDownEvent),
1625
1627
  role: "combobox",
@@ -3402,7 +3404,6 @@ const TabRoot = ({ ref, ...props }) => {
3402
3404
  const { className, children, scroll, onValueChange, variant, size, defaultValue, ...rest } = props;
3403
3405
  const tabProps = useTab(props);
3404
3406
  const containerRef = React.useRef(null);
3405
- const prevValueRef = React.useRef(null);
3406
3407
  const [underlineStyle, setUnderlineStyle] = React.useState({ left: 0, width: 0 });
3407
3408
  const updateUnderlinePosition = React.useCallback(() => {
3408
3409
  if (variant === "sub" && containerRef.current && tabProps.value) {
@@ -3434,30 +3435,36 @@ const TabRoot = ({ ref, ...props }) => {
3434
3435
  if (scroll === "scrollable" && containerRef.current && tabProps.value) {
3435
3436
  const container = containerRef.current;
3436
3437
  const activeTab = container.querySelector(`[data-value="${tabProps.value}"]`);
3437
- const prevTab = prevValueRef.current ? container.querySelector(`[data-value="${prevValueRef.current}"]`) : null;
3438
3438
  if (activeTab) {
3439
3439
  const containerRect = container.getBoundingClientRect();
3440
3440
  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
- });
3441
+ const shiftAmount = container.clientWidth * 0.2;
3442
+ const currentScroll = container.scrollLeft;
3443
+ const maxScroll = container.scrollWidth - container.clientWidth;
3444
+ const isHiddenLeft = tabRect.left < containerRect.left;
3445
+ const isHiddenRight = tabRect.right > containerRect.right;
3446
+ let newScroll;
3447
+ if (isHiddenLeft) {
3448
+ newScroll = Math.max(0, activeTab.offsetLeft - shiftAmount);
3449
+ } else if (isHiddenRight) {
3450
+ newScroll = Math.min(
3451
+ maxScroll,
3452
+ activeTab.offsetLeft + activeTab.offsetWidth + shiftAmount - container.clientWidth
3453
+ );
3454
+ } else {
3455
+ const tabCenter = tabRect.left + tabRect.width / 2;
3456
+ const containerCenter = containerRect.left + containerRect.width / 2;
3457
+ if (tabCenter < containerCenter) {
3458
+ newScroll = Math.max(0, currentScroll - shiftAmount);
3452
3459
  } else {
3453
- container.scrollTo({
3454
- left: activeTab.offsetLeft + activeTab.offsetWidth + scrollPadding - container.clientWidth,
3455
- behavior: "smooth"
3456
- });
3460
+ newScroll = Math.min(maxScroll, currentScroll + shiftAmount);
3457
3461
  }
3458
3462
  }
3463
+ container.scrollTo({
3464
+ left: newScroll,
3465
+ behavior: "smooth"
3466
+ });
3459
3467
  }
3460
- prevValueRef.current = tabProps.value;
3461
3468
  }
3462
3469
  }, [tabProps.value, scroll]);
3463
3470
  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(