@orderly.network/ui 3.0.4 → 3.1.0

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
@@ -815,7 +815,7 @@ var BaseButton = React73__namespace.default.forwardRef(
815
815
  }, [size, icon]);
816
816
  const content = React73.useMemo(() => {
817
817
  if (!leading && !trailing && !iconElement) return children;
818
- return /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", itemAlign: "center", className: "oui-space-x-1", children: [
818
+ return /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", itemAlign: "center", className: "oui-gap-x-1", children: [
819
819
  leading,
820
820
  iconElement,
821
821
  /* @__PURE__ */ jsxRuntime.jsx("span", { children }),
@@ -1528,7 +1528,7 @@ var TokenIcon = (props) => {
1528
1528
  var CombineIcon = (props) => {
1529
1529
  const { secondary } = props;
1530
1530
  const subElement = React73.useMemo(() => {
1531
- const className = "oui-bg-base-6 oui-absolute oui-bottom-0 oui-right-0 oui-outline oui-outline-2 oui-outline-base-1 oui-z-10";
1531
+ const className = "oui-bg-base-6 oui-absolute oui-bottom-0 oui-end-0 oui-outline oui-outline-2 oui-outline-base-1 oui-z-10";
1532
1532
  if (secondary.component) {
1533
1533
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindVariants.cnBase(className, secondary?.className), children: secondary.component });
1534
1534
  }
@@ -4618,6 +4618,7 @@ var Numeral = (props) => {
4618
4618
  {
4619
4619
  ...rest,
4620
4620
  color: colorName,
4621
+ dir: "ltr",
4621
4622
  className: tailwindVariants.cnBase("oui-tabular-nums", className),
4622
4623
  children: childWithUnit
4623
4624
  }
@@ -4960,6 +4961,31 @@ var useThemeAttribute = () => {
4960
4961
  }, []);
4961
4962
  return themeAttribute;
4962
4963
  };
4964
+ function subscribeDocumentDir(listener) {
4965
+ if (typeof document === "undefined") {
4966
+ return () => {
4967
+ };
4968
+ }
4969
+ const observer = new MutationObserver(listener);
4970
+ observer.observe(document.documentElement, {
4971
+ attributes: true,
4972
+ attributeFilter: ["dir"]
4973
+ });
4974
+ return () => observer.disconnect();
4975
+ }
4976
+ function getDocumentDirection() {
4977
+ if (typeof document === "undefined") {
4978
+ return "ltr";
4979
+ }
4980
+ return document.documentElement.dir === "rtl" ? "rtl" : "ltr";
4981
+ }
4982
+ function useDocumentDirection() {
4983
+ return React73.useSyncExternalStore(
4984
+ subscribeDocumentDir,
4985
+ getDocumentDirection,
4986
+ () => "ltr"
4987
+ );
4988
+ }
4963
4989
  var popoverVariants = tv({
4964
4990
  base: [
4965
4991
  "oui-popover-content",
@@ -5153,7 +5179,7 @@ var SymbolBadge = (props) => {
5153
5179
  const { badge, fullName } = props;
5154
5180
  const { isMobile } = useScreen();
5155
5181
  if (!badge) return null;
5156
- const badgeEl = /* @__PURE__ */ jsxRuntime.jsx(Badge, { color: "neutral", size: "xs", className: "oui-ml-1", children: badge });
5182
+ const badgeEl = /* @__PURE__ */ jsxRuntime.jsx(Badge, { color: "neutral", size: "xs", className: "oui-ms-1", children: badge });
5157
5183
  if (!fullName) return badgeEl;
5158
5184
  const isTruncated = badge.endsWith("...");
5159
5185
  if (isMobile) {
@@ -5508,6 +5534,9 @@ var inputVariants = tv(
5508
5534
  box: ["oui-bg-base-5"]
5509
5535
  }
5510
5536
  },
5537
+ // RTL-EXCLUDE: Keep `pl` / `pr` variants mapped to physical padding.
5538
+ // These variant names are part of the Input API and callers use them to
5539
+ // reserve explicit left/right space for prefix/suffix layouts.
5511
5540
  pl: {
5512
5541
  true: {
5513
5542
  box: "oui-pl-3"
@@ -5534,10 +5563,10 @@ var inputVariants = tv(
5534
5563
  input: "oui-text-center"
5535
5564
  },
5536
5565
  left: {
5537
- input: "oui-text-left"
5566
+ input: "oui-text-start"
5538
5567
  },
5539
5568
  right: {
5540
- input: "oui-text-right"
5569
+ input: "oui-text-end"
5541
5570
  }
5542
5571
  }
5543
5572
  },
@@ -5671,7 +5700,7 @@ var scrollAreaVariants = tv({
5671
5700
  variants: {
5672
5701
  orientation: {
5673
5702
  vertical: {
5674
- bar: "oui-h-full oui-w-2 oui-border-l oui-border-l-transparent oui-p-[1px]"
5703
+ bar: "oui-h-full oui-w-2 oui-border-s oui-border-s-transparent oui-p-[1px]"
5675
5704
  },
5676
5705
  horizontal: {
5677
5706
  bar: "oui-h-2 oui-flex-col oui-border-t oui-border-t-transparent oui-p-[1px]"
@@ -5737,7 +5766,7 @@ var selectVariants = tv(
5737
5766
  "oui-rounded-md",
5738
5767
  "oui-px-2",
5739
5768
  // "oui-py-2",
5740
- "oui-space-x-1",
5769
+ "oui-gap-x-1",
5741
5770
  // "oui-text-sm",
5742
5771
  "oui-shadow-sm",
5743
5772
  // "oui-ring-offset-background",
@@ -5788,8 +5817,8 @@ var selectVariants = tv(
5788
5817
  "oui-items-center",
5789
5818
  "oui-rounded-sm",
5790
5819
  "oui-py-1",
5791
- "oui-pl-2",
5792
- "oui-pr-8",
5820
+ "oui-ps-2",
5821
+ "oui-pe-8",
5793
5822
  "oui-text-sm",
5794
5823
  "oui-text-base-contrast-54",
5795
5824
  "oui-outline-none",
@@ -6170,7 +6199,7 @@ var defaultOptionRenderer = (option, currentValue) => {
6170
6199
  height: 4,
6171
6200
  gradient: "brand",
6172
6201
  r: "full",
6173
- className: "oui-absolute oui-right-2 oui-top-1/2 -oui-translate-y-1/2"
6202
+ className: "oui-absolute oui-end-2 oui-top-1/2 -oui-translate-y-1/2"
6174
6203
  }
6175
6204
  )
6176
6205
  ]
@@ -6252,7 +6281,7 @@ var Option = (props) => {
6252
6281
  value,
6253
6282
  className: item({
6254
6283
  size,
6255
- className: "oui-space-x-1 oui-flex oui-flex-row oui-items-center"
6284
+ className: "oui-gap-x-1 oui-flex oui-flex-row oui-items-center"
6256
6285
  }),
6257
6286
  children: [
6258
6287
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -6554,7 +6583,7 @@ var textFieldVariants = tv({
6554
6583
  root: "oui-flex-col oui-space-y-1"
6555
6584
  },
6556
6585
  row: {
6557
- root: "oui-flex-row oui-space-x-3 "
6586
+ root: "oui-flex-row oui-gap-x-3 "
6558
6587
  }
6559
6588
  }
6560
6589
  },
@@ -6767,7 +6796,16 @@ var Switch = React73__namespace.default.forwardRef(({ className, color, ...props
6767
6796
  className,
6768
6797
  color
6769
6798
  });
6770
- return /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitives__namespace.Root, { className: root({ className }), ...props, ref, children: /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitives__namespace.Thumb, { className: thumb() }) });
6799
+ return /* @__PURE__ */ jsxRuntime.jsx(
6800
+ SwitchPrimitives__namespace.Root,
6801
+ {
6802
+ className: root({ className }),
6803
+ ...props,
6804
+ ref,
6805
+ dir: "ltr",
6806
+ children: /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitives__namespace.Thumb, { className: thumb() })
6807
+ }
6808
+ );
6771
6809
  });
6772
6810
  Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
6773
6811
  var Logo = React73__namespace.default.forwardRef(({ src, alt, href }, ref) => {
@@ -6792,38 +6830,115 @@ function useInit(params) {
6792
6830
  }, [loading, ignoreLoadingCheck, dataSource, initialized]);
6793
6831
  return initialized;
6794
6832
  }
6833
+ var SCROLL_EPSILON = 1;
6834
+ var cachedRTLScrollType = null;
6795
6835
  function useScroll(deps) {
6796
6836
  const scrollRef = React73.useRef(null);
6797
6837
  const [showLeftShadow, setShowLeftShadow] = React73.useState(false);
6798
6838
  const [showRightShadow, setShowRightShadow] = React73.useState(false);
6839
+ const [isRTL, setIsRTL] = React73.useState(false);
6799
6840
  React73.useEffect(() => {
6800
6841
  if (!scrollRef.current) {
6801
6842
  return;
6802
6843
  }
6803
- scrollRef.current.addEventListener("scroll", function(e) {
6804
- setShowLeftShadow(scrollRef.current.scrollLeft > 0);
6805
- setShowRightShadow(!isScrolledToRight(scrollRef.current));
6844
+ const target = scrollRef.current;
6845
+ const updateState = () => {
6846
+ const direction = window.getComputedStyle(target).direction;
6847
+ const rtl = direction === "rtl";
6848
+ setIsRTL(rtl);
6849
+ const scrollAble = hasHorizontalScroll(target);
6850
+ const { fromStart, fromEnd } = getHorizontalScrollOffset(target);
6851
+ setShowLeftShadow(scrollAble && fromStart > SCROLL_EPSILON);
6852
+ setShowRightShadow(scrollAble && fromEnd > SCROLL_EPSILON);
6853
+ };
6854
+ updateState();
6855
+ target.addEventListener("scroll", updateState);
6856
+ const nearestDirElement = target.closest("[dir]");
6857
+ const dirObserveTarget = nearestDirElement || document.documentElement;
6858
+ const mutationObserver = new MutationObserver(updateState);
6859
+ mutationObserver.observe(dirObserveTarget, {
6860
+ attributes: true,
6861
+ attributeFilter: ["dir"]
6806
6862
  });
6807
- }, [scrollRef]);
6808
- React73.useEffect(() => {
6809
- if (!scrollRef.current) {
6810
- return;
6863
+ let resizeObserver;
6864
+ if (typeof ResizeObserver !== "undefined") {
6865
+ resizeObserver = new ResizeObserver(updateState);
6866
+ resizeObserver.observe(target);
6811
6867
  }
6812
- const scrollAble = hasHorizontalScroll(scrollRef.current);
6813
- const scrollEnd = isScrolledToRight(scrollRef.current);
6814
- setShowRightShadow(scrollAble && !scrollEnd);
6868
+ return () => {
6869
+ target.removeEventListener("scroll", updateState);
6870
+ mutationObserver.disconnect();
6871
+ resizeObserver?.disconnect();
6872
+ };
6815
6873
  }, [scrollRef, ...deps]);
6816
6874
  return {
6817
6875
  scrollRef,
6818
6876
  showLeftShadow,
6819
- showRightShadow
6877
+ showRightShadow,
6878
+ isRTL
6820
6879
  };
6821
6880
  }
6822
- function isScrolledToRight(element) {
6823
- return element.scrollLeft + element.clientWidth >= element.scrollWidth;
6824
- }
6825
6881
  function hasHorizontalScroll(element) {
6826
- return element.scrollWidth > element.clientWidth;
6882
+ return element.scrollWidth - element.clientWidth > SCROLL_EPSILON;
6883
+ }
6884
+ function getHorizontalScrollOffset(element) {
6885
+ const max = element.scrollWidth - element.clientWidth;
6886
+ if (max <= 0) {
6887
+ return { fromStart: 0, fromEnd: 0 };
6888
+ }
6889
+ const direction = window.getComputedStyle(element).direction;
6890
+ if (direction !== "rtl") {
6891
+ return {
6892
+ fromStart: Math.max(0, element.scrollLeft),
6893
+ fromEnd: Math.max(0, max - element.scrollLeft)
6894
+ };
6895
+ }
6896
+ const scrollType = getRTLScrollType();
6897
+ const scrollLeft = element.scrollLeft;
6898
+ let fromStart = 0;
6899
+ if (scrollType === "negative") {
6900
+ fromStart = -scrollLeft;
6901
+ } else if (scrollType === "reverse") {
6902
+ fromStart = scrollLeft;
6903
+ } else {
6904
+ fromStart = max - scrollLeft;
6905
+ }
6906
+ return {
6907
+ fromStart: Math.max(0, fromStart),
6908
+ fromEnd: Math.max(0, max - fromStart)
6909
+ };
6910
+ }
6911
+ function getRTLScrollType() {
6912
+ if (cachedRTLScrollType) {
6913
+ return cachedRTLScrollType;
6914
+ }
6915
+ if (typeof document === "undefined" || !document.body) {
6916
+ cachedRTLScrollType = "negative";
6917
+ return cachedRTLScrollType;
6918
+ }
6919
+ const outer = document.createElement("div");
6920
+ const inner = document.createElement("div");
6921
+ outer.style.width = "4px";
6922
+ outer.style.height = "1px";
6923
+ outer.style.overflow = "scroll";
6924
+ outer.style.visibility = "hidden";
6925
+ outer.style.position = "absolute";
6926
+ outer.style.top = "-9999px";
6927
+ outer.dir = "rtl";
6928
+ inner.style.width = "8px";
6929
+ inner.style.height = "1px";
6930
+ outer.appendChild(inner);
6931
+ document.body.appendChild(outer);
6932
+ let type;
6933
+ if (outer.scrollLeft > 0) {
6934
+ type = "default";
6935
+ } else {
6936
+ outer.scrollLeft = 1;
6937
+ type = outer.scrollLeft === 0 ? "negative" : "reverse";
6938
+ }
6939
+ document.body.removeChild(outer);
6940
+ cachedRTLScrollType = type;
6941
+ return type;
6827
6942
  }
6828
6943
  function useShowHeader(params) {
6829
6944
  const { dataSource, loading } = params;
@@ -6889,9 +7004,11 @@ function useWrap(deps) {
6889
7004
  var alignVariants = tailwindVariants.tv({
6890
7005
  variants: {
6891
7006
  align: {
6892
- left: "oui-text-left",
7007
+ left: "oui-text-start",
7008
+ start: "oui-text-start",
6893
7009
  center: "oui-text-center",
6894
- right: "oui-text-right"
7010
+ right: "oui-text-end",
7011
+ end: "oui-text-end"
6895
7012
  }
6896
7013
  },
6897
7014
  defaultVariants: {
@@ -6921,13 +7038,16 @@ var TableCell = (props) => {
6921
7038
  }
6922
7039
  return reactTable.flexRender(cell.column.columnDef.cell, cell.getContext());
6923
7040
  };
6924
- function getColumnPinningProps(column, isHeader) {
7041
+ function getColumnPinningProps(column, isRTL) {
6925
7042
  const isPinned = column.getIsPinned();
6926
7043
  const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
6927
7044
  const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
6928
7045
  const style = {
6929
- left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
6930
- right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
7046
+ // Keep logical inset here. TanStack pinning still reports left/right
7047
+ // groups, but sticky offsets must follow the scroll container direction;
7048
+ // physical left/right breaks fixed columns in RTL tables.
7049
+ insetInlineStart: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
7050
+ insetInlineEnd: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
6931
7051
  width: column.getSize()
6932
7052
  };
6933
7053
  const contentCls = tailwindVariants.cnBase(
@@ -6941,8 +7061,18 @@ function getColumnPinningProps(column, isHeader) {
6941
7061
  "before:oui-top-0 before:oui-z-[-1]",
6942
7062
  "before:oui-bg-[linear-gradient(90deg,rgba(var(--oui-color-base-10)_/_0.80)_0%,rgba(var(--oui-color-base-10)_/_0.36)_65%,rgba(var(--oui-color-base-10)_/_0.00)_100%)]"
6943
7063
  );
6944
- const leftShadow = isLastLeftPinnedColumn && tailwindVariants.cnBase(shadowCls, "before:oui-right-[-32px]");
6945
- const rightShadow = isFirstRightPinnedColumn && tailwindVariants.cnBase(shadowCls, "before:oui-left-[-32px] before:oui-rotate-180");
7064
+ const leftShadow = isLastLeftPinnedColumn && tailwindVariants.cnBase(
7065
+ shadowCls,
7066
+ // The shadow sits on the logical outer edge of the pinned group.
7067
+ "before:oui-end-[-32px]",
7068
+ isRTL && "before:oui-rotate-180"
7069
+ );
7070
+ const rightShadow = isFirstRightPinnedColumn && tailwindVariants.cnBase(
7071
+ shadowCls,
7072
+ // Do not replace with physical left/right; this mirrors with RTL pinning.
7073
+ "before:oui-start-[-32px]",
7074
+ !isRTL && "before:oui-rotate-180"
7075
+ );
6946
7076
  return {
6947
7077
  style,
6948
7078
  classNames: {
@@ -6964,7 +7094,7 @@ var TableBody = (props) => {
6964
7094
  "data-testid": props.testId,
6965
7095
  children: props.rows.map((row) => {
6966
7096
  const { className, onClick, ...rest } = typeof props.onRow === "function" ? props.onRow(row.original, row.index, row) || {} : {};
6967
- const expandView = row.getIsExpanded() && /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "oui-table-expand-tr oui-z-0 [&>td:first-child]:oui-pl-3 [&>td:last-child]:oui-pr-3", children: /* @__PURE__ */ jsxRuntime.jsx(
7097
+ const expandView = row.getIsExpanded() && /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "oui-table-expand-tr oui-z-0 [&>td:first-child]:oui-ps-3 [&>td:last-child]:oui-pe-3", children: /* @__PURE__ */ jsxRuntime.jsx(
6968
7098
  "td",
6969
7099
  {
6970
7100
  className: "oui-table-expand-td",
@@ -6978,7 +7108,7 @@ var TableBody = (props) => {
6978
7108
  {
6979
7109
  className: tailwindVariants.cnBase(
6980
7110
  "oui-table-tbody-tr oui-group oui-h-10",
6981
- "[&>td:first-child]:oui-pl-3 [&>td:last-child]:oui-pr-3",
7111
+ "[&>td:first-child]:oui-ps-3 [&>td:last-child]:oui-pe-3",
6982
7112
  typeof onClick === "function" && "oui-cursor-pointer",
6983
7113
  props.bordered && "oui-border-b oui-border-b-line-4",
6984
7114
  className
@@ -6987,7 +7117,7 @@ var TableBody = (props) => {
6987
7117
  ...rest,
6988
7118
  children: row.getVisibleCells().map((cell) => {
6989
7119
  const column = cell.column;
6990
- const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column);
7120
+ const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column, !!props.isRTL);
6991
7121
  const { align, className: rowClassName } = column.columnDef.meta || {};
6992
7122
  const {
6993
7123
  style: cellStyle,
@@ -7045,7 +7175,7 @@ var CellHover = ({ selected, isFirst, isLast }) => {
7045
7175
  "div",
7046
7176
  {
7047
7177
  className: tailwindVariants.cnBase(
7048
- "oui-absolute oui-left-0 oui-top-0 oui-z-[-1]",
7178
+ "oui-absolute oui-start-0 oui-top-0 oui-z-[-1]",
7049
7179
  "oui-size-full",
7050
7180
  "group-hover:oui-bg-line-4",
7051
7181
  selected && "oui-bg-line-6 group-hover:oui-bg-line-6",
@@ -7220,7 +7350,7 @@ var TableHeader = (props) => {
7220
7350
  className: tailwindVariants.cnBase(
7221
7351
  "oui-table-thead-tr",
7222
7352
  "oui-h-10",
7223
- "[&>th:first-child]:oui-pl-3 [&>th:last-child]:oui-pr-3",
7353
+ "[&>th:first-child]:oui-ps-3 [&>th:last-child]:oui-pe-3",
7224
7354
  props.className
7225
7355
  ),
7226
7356
  children: headerGroup.headers.map((header) => {
@@ -7230,7 +7360,7 @@ var TableHeader = (props) => {
7230
7360
  className: rowClassName,
7231
7361
  title
7232
7362
  } = column.columnDef.meta || {};
7233
- const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column);
7363
+ const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column, !!props.isRTL);
7234
7364
  const canSort = column.getCanSort();
7235
7365
  const isSorted = column.getIsSorted();
7236
7366
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -7241,7 +7371,7 @@ var TableHeader = (props) => {
7241
7371
  "oui-table-thead-th",
7242
7372
  "oui-whitespace-nowrap",
7243
7373
  "oui-px-1",
7244
- props.bordered && "after:oui-absolute after:oui-left-0 after:oui-top-0 after:oui-z-[-1] after:oui-block after:oui-size-full after:oui-border-b after:oui-border-line",
7374
+ props.bordered && "after:oui-absolute after:oui-start-0 after:oui-top-0 after:oui-z-[-1] after:oui-block after:oui-size-full after:oui-border-b after:oui-border-line",
7245
7375
  // use border-b will show bottom element content
7246
7376
  // props.bordered && "oui-border-b oui-border-line"
7247
7377
  alignVariants({ align }),
@@ -7390,9 +7520,9 @@ var PaginationPrevious = ({
7390
7520
  PaginationLink,
7391
7521
  {
7392
7522
  "aria-label": "Go to previous page",
7393
- className: tailwindVariants.cnBase("oui-gap-1 oui-pl-2.5", className),
7523
+ className: tailwindVariants.cnBase("oui-gap-1 oui-ps-2.5", className),
7394
7524
  ...props,
7395
- children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { className: "oui-h-4 oui-w-4", color: "white" })
7525
+ children: /* @__PURE__ */ jsxRuntime.jsx(PaginationPreviousIcon, {})
7396
7526
  }
7397
7527
  );
7398
7528
  PaginationPrevious.displayName = "PaginationPrevious";
@@ -7403,12 +7533,22 @@ var PaginationNext = ({
7403
7533
  PaginationLink,
7404
7534
  {
7405
7535
  "aria-label": "Go to next page",
7406
- className: tailwindVariants.cnBase("oui-gap-1 oui-pr-2.5", className),
7536
+ className: tailwindVariants.cnBase("oui-gap-1 oui-pe-2.5", className),
7407
7537
  ...props,
7408
- children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { className: "oui-h-4 oui-w-4", color: "white" })
7538
+ children: /* @__PURE__ */ jsxRuntime.jsx(PaginationNextIcon, {})
7409
7539
  }
7410
7540
  );
7411
7541
  PaginationNext.displayName = "PaginationNext";
7542
+ var PaginationPreviousIcon = () => {
7543
+ const dir = useDocumentDirection();
7544
+ const Icon4 = dir === "rtl" ? ChevronRightIcon : ChevronLeftIcon;
7545
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon4, { className: "oui-h-4 oui-w-4", color: "white" });
7546
+ };
7547
+ var PaginationNextIcon = () => {
7548
+ const dir = useDocumentDirection();
7549
+ const Icon4 = dir === "rtl" ? ChevronLeftIcon : ChevronRightIcon;
7550
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon4, { className: "oui-h-4 oui-w-4", color: "white" });
7551
+ };
7412
7552
  var Paginations = (props) => {
7413
7553
  const {
7414
7554
  classNames,
@@ -7419,14 +7559,14 @@ var Paginations = (props) => {
7419
7559
  } = props;
7420
7560
  const [locale] = useLocale("pagination");
7421
7561
  return /* @__PURE__ */ jsxRuntime.jsxs(Pagination, { className: tailwindVariants.cnBase(classNames?.pagination, className), children: [
7422
- !hideRowsPerPage ? /* @__PURE__ */ jsxRuntime.jsxs(Flex, { mr: 4, children: [
7562
+ !hideRowsPerPage ? /* @__PURE__ */ jsxRuntime.jsxs(Flex, { className: "oui-me-4", children: [
7423
7563
  /* @__PURE__ */ jsxRuntime.jsx(
7424
7564
  Text,
7425
7565
  {
7426
7566
  as: "div",
7427
7567
  size: "2xs",
7428
7568
  intensity: 54,
7429
- className: "oui-text-nowrap oui-mr-2",
7569
+ className: "oui-text-nowrap oui-me-2",
7430
7570
  children: locale.rowsPerPage
7431
7571
  }
7432
7572
  ),
@@ -7593,6 +7733,18 @@ var TablePlaceholder = (props) => {
7593
7733
  }
7594
7734
  );
7595
7735
  };
7736
+ function resolveFixedDirection(fixed, isRTL) {
7737
+ if (!fixed) {
7738
+ return null;
7739
+ }
7740
+ if (fixed === "left" || fixed === "right") {
7741
+ return fixed;
7742
+ }
7743
+ if (fixed === "start") {
7744
+ return isRTL ? "right" : "left";
7745
+ }
7746
+ return isRTL ? "left" : "right";
7747
+ }
7596
7748
  var compareValues = (aValue, bValue) => {
7597
7749
  if (aValue == null && bValue == null) return 0;
7598
7750
  if (aValue == null) return 1;
@@ -7712,13 +7864,14 @@ var Transform = {
7712
7864
  );
7713
7865
  return sortedData;
7714
7866
  },
7715
- columnPinning: (columns) => {
7867
+ columnPinning: (columns, isRTL = false) => {
7716
7868
  const left = [];
7717
7869
  const right = [];
7718
7870
  columns?.map((column) => {
7719
- if (column.fixed === "left") {
7871
+ const fixed = resolveFixedDirection(column.fixed, isRTL);
7872
+ if (fixed === "left") {
7720
7873
  left.push(column.dataIndex);
7721
- } else if (column.fixed === "right") {
7874
+ } else if (fixed === "right") {
7722
7875
  right.push(column.dataIndex);
7723
7876
  }
7724
7877
  });
@@ -7813,9 +7966,14 @@ function DataTable(props) {
7813
7966
  () => Transform.columns(columns, sorting, setSorting),
7814
7967
  [columns, sorting, setSorting]
7815
7968
  );
7969
+ const wrapRef = useWrap([className, classNames?.root]);
7970
+ const { scrollRef, showLeftShadow, showRightShadow, isRTL } = useScroll([
7971
+ dataSource?.length,
7972
+ columns?.length
7973
+ ]);
7816
7974
  const columnPinning = React73.useMemo(
7817
- () => Transform.columnPinning(columns),
7818
- [columns]
7975
+ () => Transform.columnPinning(columns, isRTL),
7976
+ [columns, isRTL]
7819
7977
  );
7820
7978
  const rowSelection = React73.useMemo(
7821
7979
  () => props.rowSelection || {},
@@ -7865,10 +8023,6 @@ function DataTable(props) {
7865
8023
  React73.useEffect(() => {
7866
8024
  props.getTableInstance?.(table);
7867
8025
  }, [table]);
7868
- const wrapRef = useWrap([className, classNames?.root]);
7869
- const { scrollRef, showLeftShadow, showRightShadow } = useScroll([
7870
- dataSource?.length
7871
- ]);
7872
8026
  const rows = table.getRowModel().rows;
7873
8027
  const showPlaceholder = initialized && (rows.length === 0 || loading);
7874
8028
  const showHeader = useShowHeader({
@@ -7926,6 +8080,7 @@ function DataTable(props) {
7926
8080
  bordered: props.bordered,
7927
8081
  showLeftShadow,
7928
8082
  showRightShadow,
8083
+ isRTL,
7929
8084
  sorting
7930
8085
  }
7931
8086
  ),
@@ -7941,6 +8096,7 @@ function DataTable(props) {
7941
8096
  onCell: props.onCell,
7942
8097
  showLeftShadow,
7943
8098
  showRightShadow,
8099
+ isRTL,
7944
8100
  testId: props.testIds?.body
7945
8101
  }
7946
8102
  )
@@ -7991,23 +8147,23 @@ function Calendar({
7991
8147
  showOutsideDays,
7992
8148
  className: tailwindVariants.cnBase("oui-p-3 oui-bg-base-7 oui-rounded", className),
7993
8149
  classNames: {
7994
- months: "oui-flex oui-flex-col sm:oui-flex-row oui-space-y-4 sm:oui-space-x-4 sm:oui-space-y-0",
8150
+ months: "oui-flex oui-flex-col sm:oui-flex-row oui-space-y-4 sm:oui-gap-x-4 sm:oui-space-y-0",
7995
8151
  month: "oui-space-y-4",
7996
8152
  caption: "oui-flex oui-justify-center oui-pt-1 oui-relative oui-items-center",
7997
8153
  caption_label: "oui-text-sm oui-font-medium ",
7998
- nav: "oui-space-x-1 oui-flex oui-items-center",
8154
+ nav: "oui-gap-x-1 oui-flex oui-items-center",
7999
8155
  nav_button: tailwindVariants.cnBase(
8000
8156
  "oui-h-7 oui-w-7 oui-bg-transparent oui-p-0 oui-opacity-50 hover:oui-opacity-100"
8001
8157
  ),
8002
- nav_button_previous: "oui-absolute oui-left-1",
8003
- nav_button_next: "oui-absolute oui-right-1",
8158
+ nav_button_previous: "oui-absolute oui-start-1",
8159
+ nav_button_next: "oui-absolute oui-end-1",
8004
8160
  table: "oui-w-full oui-border-collapse oui-space-y-1",
8005
8161
  head_row: "oui-flex",
8006
8162
  head_cell: "oui-text-base-contrast-80 oui-rounded-md oui-w-7 oui-font-normal oui-text-[0.8rem] oui-opacity-30",
8007
8163
  row: "oui-flex oui-w-full oui-mt-2",
8008
8164
  cell: tailwindVariants.cnBase(
8009
- "oui-relative oui-day-cell oui-p-0 oui-text-center oui-text-2xs focus-within:oui-relative focus-within:oui-z-20 [&:has([aria-selected])]:oui-bg-base-4 [&:has([aria-selected].day-outside)]:oui-bg-base-4/50 [&:has([aria-selected].day-range-end)]:oui-rounded-r-md",
8010
- props.mode === "range" ? "[&:has(>.oui-day-range-end)]:oui-rounded-r-md [&:has(>.oui-day-range-start)]:oui-rounded-l-md first:[&:has([aria-selected])]:oui-rounded-l-md last:[&:has([aria-selected])]:oui-rounded-r-md" : "[&:has([aria-selected])]:oui-rounded-md"
8165
+ "oui-relative oui-day-cell oui-p-0 oui-text-center oui-text-2xs focus-within:oui-relative focus-within:oui-z-20 [&:has([aria-selected])]:oui-bg-base-4 [&:has([aria-selected].day-outside)]:oui-bg-base-4/50 [&:has([aria-selected].day-range-end)]:oui-rounded-e-md",
8166
+ props.mode === "range" ? "[&:has(>.oui-day-range-end)]:oui-rounded-e-md [&:has(>.oui-day-range-start)]:oui-rounded-s-md first:[&:has([aria-selected])]:oui-rounded-s-md last:[&:has([aria-selected])]:oui-rounded-e-md" : "[&:has([aria-selected])]:oui-rounded-md"
8011
8167
  ),
8012
8168
  day: tailwindVariants.cnBase(
8013
8169
  // buttonVariants({ variant: "ghost" }),
@@ -8275,14 +8431,26 @@ var sheetVariants = tailwindVariants.tv({
8275
8431
  side: {
8276
8432
  top: "oui-inset-x-0 oui-top-0 oui-border-b data-[state=closed]:oui-slide-out-to-top data-[state=open]:oui-slide-in-from-top",
8277
8433
  bottom: "oui-inset-x-0 oui-bottom-0 oui-rounded-t-2xl data-[state=closed]:oui-slide-out-to-bottom data-[state=open]:oui-slide-in-from-bottom",
8278
- left: "oui-inset-y-0 oui-left-0 oui-h-full oui-w-3/4 data-[state=closed]:oui-slide-out-to-left data-[state=open]:oui-slide-in-from-left sm:oui-max-w-sm",
8279
- right: "oui-inset-y-0 oui-right-0 oui-h-full oui-w-3/4 oui-border-l data-[state=closed]:oui-slide-out-to-right data-[state=open]:oui-slide-in-from-right sm:oui-max-w-sm"
8434
+ // Keep left/right sides on logical start/end. In RTL, callers expect
8435
+ // side="left" to attach to the visual start side; physical left/right
8436
+ // places drawers on the opposite side from their trigger.
8437
+ left: "oui-inset-y-0 oui-start-0 oui-h-full oui-w-3/4 sm:oui-max-w-sm",
8438
+ right: "oui-inset-y-0 oui-end-0 oui-h-full oui-w-3/4 oui-border-s sm:oui-max-w-sm"
8280
8439
  }
8281
8440
  },
8282
8441
  defaultVariants: {
8283
8442
  side: "bottom"
8284
8443
  }
8285
8444
  });
8445
+ function getLogicalSideAnimationClass(side, direction) {
8446
+ if (side === "left") {
8447
+ return direction === "rtl" ? "data-[state=closed]:oui-slide-out-to-right data-[state=open]:oui-slide-in-from-right" : "data-[state=closed]:oui-slide-out-to-left data-[state=open]:oui-slide-in-from-left";
8448
+ }
8449
+ if (side === "right") {
8450
+ return direction === "rtl" ? "data-[state=closed]:oui-slide-out-to-left data-[state=open]:oui-slide-in-from-left" : "data-[state=closed]:oui-slide-out-to-right data-[state=open]:oui-slide-in-from-right";
8451
+ }
8452
+ return void 0;
8453
+ }
8286
8454
  var SheetContent = React73__namespace.forwardRef(
8287
8455
  ({
8288
8456
  side = "bottom",
@@ -8293,43 +8461,54 @@ var SheetContent = React73__namespace.forwardRef(
8293
8461
  overlayClassName,
8294
8462
  children,
8295
8463
  ...props
8296
- }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
8297
- /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, { className: overlayClassName }),
8298
- /* @__PURE__ */ jsxRuntime.jsxs(
8299
- SheetPrimitive__namespace.Content,
8300
- {
8301
- ref,
8302
- className: tailwindVariants.cnBase(sheetVariants({ side }), className),
8303
- onOpenAutoFocus: (e) => e.preventDefault(),
8304
- onCloseAutoFocus: (e) => e.preventDefault(),
8305
- ...props,
8306
- children: [
8307
- closeable && /* @__PURE__ */ jsxRuntime.jsxs(
8308
- SheetPrimitive__namespace.Close,
8309
- {
8310
- className: tailwindVariants.cnBase(
8311
- "oui-sheet-close-btn oui-ring-offset-base-700 focus:oui-ring-ring oui-absolute oui-right-4 oui-top-4 oui-z-10 oui-rounded-sm oui-transition-opacity focus:oui-outline-none focus:oui-ring-2 focus:oui-ring-offset-2 active:oui-outline-none focus:orderly-outline-none disabled:oui-pointer-events-none data-[state=open]:oui-bg-secondary",
8312
- props?.closeClassName
8313
- ),
8314
- children: [
8315
- /* @__PURE__ */ jsxRuntime.jsx(
8316
- CloseIcon,
8317
- {
8318
- size: closeableSize,
8319
- color: "white",
8320
- opacity: closeOpacity,
8321
- onClick: props?.onClose
8322
- }
8323
- ),
8324
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "oui-sr-only", children: "Close" })
8325
- ]
8326
- }
8464
+ }, ref) => {
8465
+ const direction = useDocumentDirection();
8466
+ const sideAnimationClassName = getLogicalSideAnimationClass(
8467
+ side,
8468
+ direction
8469
+ );
8470
+ return /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
8471
+ /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, { className: overlayClassName }),
8472
+ /* @__PURE__ */ jsxRuntime.jsxs(
8473
+ SheetPrimitive__namespace.Content,
8474
+ {
8475
+ ref,
8476
+ className: tailwindVariants.cnBase(
8477
+ sheetVariants({ side }),
8478
+ sideAnimationClassName,
8479
+ className
8327
8480
  ),
8328
- children
8329
- ]
8330
- }
8331
- )
8332
- ] })
8481
+ onOpenAutoFocus: (e) => e.preventDefault(),
8482
+ onCloseAutoFocus: (e) => e.preventDefault(),
8483
+ ...props,
8484
+ children: [
8485
+ closeable && /* @__PURE__ */ jsxRuntime.jsxs(
8486
+ SheetPrimitive__namespace.Close,
8487
+ {
8488
+ className: tailwindVariants.cnBase(
8489
+ "oui-sheet-close-btn oui-ring-offset-base-700 focus:oui-ring-ring oui-absolute oui-end-4 oui-top-4 oui-z-10 oui-rounded-sm oui-transition-opacity focus:oui-outline-none focus:oui-ring-2 focus:oui-ring-offset-2 active:oui-outline-none focus:orderly-outline-none disabled:oui-pointer-events-none data-[state=open]:oui-bg-secondary",
8490
+ props?.closeClassName
8491
+ ),
8492
+ children: [
8493
+ /* @__PURE__ */ jsxRuntime.jsx(
8494
+ CloseIcon,
8495
+ {
8496
+ size: closeableSize,
8497
+ color: "white",
8498
+ opacity: closeOpacity,
8499
+ onClick: props?.onClose
8500
+ }
8501
+ ),
8502
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "oui-sr-only", children: "Close" })
8503
+ ]
8504
+ }
8505
+ ),
8506
+ children
8507
+ ]
8508
+ }
8509
+ )
8510
+ ] });
8511
+ }
8333
8512
  );
8334
8513
  SheetContent.displayName = SheetPrimitive__namespace.Content.displayName;
8335
8514
  var SheetHeader = ({
@@ -8372,7 +8551,7 @@ var SheetFooter = ({
8372
8551
  "div",
8373
8552
  {
8374
8553
  className: tailwindVariants.cnBase(
8375
- "oui-sheet-footer oui-flex oui-flex-col-reverse sm:oui-flex-row sm:oui-justify-end sm:oui-space-x-2",
8554
+ "oui-sheet-footer oui-flex oui-flex-col-reverse sm:oui-flex-row sm:oui-justify-end sm:oui-gap-x-2",
8376
8555
  className
8377
8556
  ),
8378
8557
  ...props
@@ -8758,7 +8937,7 @@ var dividerVariants = tv({
8758
8937
  },
8759
8938
  direction: {
8760
8939
  horizontal: ["oui-border-b"],
8761
- vertical: ["oui-border-l"]
8940
+ vertical: ["oui-border-s"]
8762
8941
  },
8763
8942
  lineStyle: {
8764
8943
  // solid: "oui-border-solid",
@@ -8855,6 +9034,9 @@ var dialogVariants = tailwindVariants.tv({
8855
9034
  content: [
8856
9035
  "oui-dialog-content",
8857
9036
  "oui-fixed",
9037
+ // RTL-EXCLUDE: Do not replace with `start-[50%]`.
9038
+ // Keep physical left centering here: start maps to right in RTL, which
9039
+ // breaks centering with translate-x-[-50%].
8858
9040
  "oui-left-[50%]",
8859
9041
  "oui-top-[50%]",
8860
9042
  "oui-z-50",
@@ -8885,7 +9067,7 @@ var dialogVariants = tailwindVariants.tv({
8885
9067
  close: [
8886
9068
  "oui-dialog-close-btn",
8887
9069
  "oui-absolute",
8888
- "oui-right-4",
9070
+ "oui-end-4",
8889
9071
  "oui-top-4",
8890
9072
  // "oui-opacity-70",
8891
9073
  "oui-ring-offset-background",
@@ -8906,7 +9088,8 @@ var dialogVariants = tailwindVariants.tv({
8906
9088
  "oui-flex",
8907
9089
  "oui-flex-row",
8908
9090
  "oui-justify-end",
8909
- "oui-space-x-2",
9091
+ // Use gap instead of space-x so spacing works in both LTR and RTL.
9092
+ "oui-gap-2",
8910
9093
  "oui-pb-5",
8911
9094
  "oui-pt-2 lg:oui-pt-3"
8912
9095
  // "has-[&>*:nth-child(1)]:oui-bg-red-400",
@@ -9672,7 +9855,7 @@ var Picker = React73.forwardRef(
9672
9855
  "div",
9673
9856
  {
9674
9857
  className: tailwindVariants.cnBase(
9675
- "oui-space-x-1",
9858
+ "oui-gap-x-1",
9676
9859
  "oui-text-base-contrast-54",
9677
9860
  "oui-rounded-md",
9678
9861
  "oui-bg-base-8",
@@ -9927,7 +10110,8 @@ var tabsVariants = tv({
9927
10110
  "oui-text-base-contrast-36 hover:oui-text-base-contrast-54",
9928
10111
  "oui-ring-offset-background",
9929
10112
  "oui-transition-all",
9930
- "oui-space-x-1",
10113
+ /** `gap-x` mirrors correctly in RTL; `space-x` uses asymmetric margins that can overlap pill corners. */
10114
+ "oui-gap-x-1",
9931
10115
  "focus-visible:oui-outline-none",
9932
10116
  "focus-visible:oui-ring-2",
9933
10117
  "focus-visible:oui-ring-ring",
@@ -9940,12 +10124,7 @@ var tabsVariants = tv({
9940
10124
  variants: {
9941
10125
  variant: {
9942
10126
  text: {
9943
- list: [
9944
- "oui-space-x-6",
9945
- "oui-border-b",
9946
- "oui-border-line-6",
9947
- "oui-px-1"
9948
- ],
10127
+ list: ["oui-gap-x-6", "oui-border-b", "oui-border-line-6", "oui-px-1"],
9949
10128
  trigger: [
9950
10129
  "oui-group",
9951
10130
  "oui-pb-2",
@@ -9958,15 +10137,16 @@ var tabsVariants = tv({
9958
10137
  "data-[state=active]:after:oui-absolute",
9959
10138
  "data-[state=active]:after:oui-rounded-full",
9960
10139
  "data-[state=active]:after:-oui-bottom-0",
9961
- "data-[state=active]:after:oui-left-0",
9962
- "data-[state=active]:after:oui-right-0"
10140
+ "data-[state=active]:after:oui-start-0",
10141
+ "data-[state=active]:after:oui-end-0"
9963
10142
  ]
9964
10143
  },
9965
10144
  contained: {
9966
- list: ["oui-space-x-[6px]"],
10145
+ list: ["oui-gap-x-[6px]"],
9967
10146
  trigger: [
9968
10147
  "oui-group",
9969
- "oui-rounded",
10148
+ /** `!rounded` defeats host/segment overrides that strip one physical corner under `[dir="rtl"]` + `:first-child`. */
10149
+ "!oui-rounded",
9970
10150
  "oui-px-3",
9971
10151
  "oui-bg-base-7 hover:oui-bg-base-5",
9972
10152
  "oui-text-base-contrast-36",
@@ -10020,7 +10200,7 @@ var tabsVariants = tv({
10020
10200
  size: "sm",
10021
10201
  variant: "contained",
10022
10202
  className: {
10023
- list: ["oui-space-x-1"],
10203
+ list: ["oui-gap-x-1"],
10024
10204
  trigger: ["oui-text-2xs", "oui-h-6"],
10025
10205
  icon: ["oui-w-[10px]", "oui-h-[10px]"]
10026
10206
  }
@@ -10038,7 +10218,7 @@ var tabsVariants = tv({
10038
10218
  size: "lg",
10039
10219
  variant: "contained",
10040
10220
  className: {
10041
- trigger: ["oui-text-sm", "oui-h-8", "oui-rounded-md"],
10221
+ trigger: ["oui-text-sm", "oui-h-8", "!oui-rounded-md"],
10042
10222
  icon: ["oui-w-[14px]", "oui-h-[14px]"]
10043
10223
  }
10044
10224
  },
@@ -10046,7 +10226,7 @@ var tabsVariants = tv({
10046
10226
  size: "xl",
10047
10227
  variant: "contained",
10048
10228
  className: {
10049
- trigger: ["oui-text-base", "oui-h-9", "oui-rounded-md"],
10229
+ trigger: ["oui-text-base", "oui-h-9", "!oui-rounded-md"],
10050
10230
  icon: ["oui-w-4", "oui-h-4"]
10051
10231
  }
10052
10232
  }
@@ -10100,22 +10280,138 @@ var OrderlyThemeContext = React73.createContext(
10100
10280
  var useOrderlyTheme = () => {
10101
10281
  return React73.useContext(OrderlyThemeContext);
10102
10282
  };
10283
+ var cachedRtlScrollType;
10284
+ function getRtlScrollType() {
10285
+ if (cachedRtlScrollType) {
10286
+ return cachedRtlScrollType;
10287
+ }
10288
+ if (typeof document === "undefined") {
10289
+ cachedRtlScrollType = "negative";
10290
+ return cachedRtlScrollType;
10291
+ }
10292
+ const outer = document.createElement("div");
10293
+ const inner = document.createElement("div");
10294
+ outer.dir = "rtl";
10295
+ outer.style.width = "4px";
10296
+ outer.style.height = "1px";
10297
+ outer.style.overflow = "scroll";
10298
+ outer.style.position = "absolute";
10299
+ outer.style.top = "-1000px";
10300
+ inner.style.width = "8px";
10301
+ inner.style.height = "1px";
10302
+ outer.appendChild(inner);
10303
+ document.body.appendChild(outer);
10304
+ if (outer.scrollLeft > 0) {
10305
+ cachedRtlScrollType = "default";
10306
+ } else {
10307
+ outer.scrollLeft = 1;
10308
+ cachedRtlScrollType = outer.scrollLeft === 0 ? "negative" : "reverse";
10309
+ }
10310
+ document.body.removeChild(outer);
10311
+ return cachedRtlScrollType;
10312
+ }
10313
+ function getMaxScrollLeft(container) {
10314
+ return Math.max(container.scrollWidth - container.clientWidth, 0);
10315
+ }
10316
+ function getScrollOffsetFromStart(container) {
10317
+ const maxScrollLeft = getMaxScrollLeft(container);
10318
+ if (getComputedStyle(container).direction !== "rtl") {
10319
+ return container.scrollLeft;
10320
+ }
10321
+ switch (getRtlScrollType()) {
10322
+ case "negative":
10323
+ return -container.scrollLeft;
10324
+ case "default":
10325
+ return maxScrollLeft - container.scrollLeft;
10326
+ case "reverse":
10327
+ return container.scrollLeft;
10328
+ }
10329
+ }
10330
+ function getScrollLeftForOffsetFromStart(container, offsetFromStart) {
10331
+ const maxScrollLeft = getMaxScrollLeft(container);
10332
+ const nextOffset = Math.min(Math.max(offsetFromStart, 0), maxScrollLeft);
10333
+ if (getComputedStyle(container).direction !== "rtl") {
10334
+ return nextOffset;
10335
+ }
10336
+ switch (getRtlScrollType()) {
10337
+ case "negative":
10338
+ return -nextOffset;
10339
+ case "default":
10340
+ return maxScrollLeft - nextOffset;
10341
+ case "reverse":
10342
+ return nextOffset;
10343
+ }
10344
+ }
10345
+ function useScroll2() {
10346
+ const [leadingVisible, setLeadingVisible] = React73.useState(false);
10347
+ const [tailingVisible, setTailingVisible] = React73.useState(false);
10348
+ const [isRTL, setIsRTL] = React73.useState(false);
10349
+ const containerRef = React73.useRef(null);
10350
+ const updateScrollVisibility = React73.useCallback(() => {
10351
+ const container = containerRef.current;
10352
+ if (!container) return;
10353
+ const maxScrollLeft = getMaxScrollLeft(container);
10354
+ const offsetFromStart = getScrollOffsetFromStart(container);
10355
+ const nextIsRTL = getComputedStyle(container).direction === "rtl";
10356
+ setIsRTL(nextIsRTL);
10357
+ setLeadingVisible(offsetFromStart > 1);
10358
+ setTailingVisible(offsetFromStart < maxScrollLeft - 1);
10359
+ }, []);
10360
+ React73.useEffect(() => {
10361
+ const container = containerRef.current;
10362
+ if (!container) return;
10363
+ container.addEventListener("scroll", updateScrollVisibility);
10364
+ const intersectionObserver = new IntersectionObserver((entries) => {
10365
+ entries.forEach((entry) => {
10366
+ if (entry.isIntersecting) {
10367
+ updateScrollVisibility();
10368
+ }
10369
+ });
10370
+ });
10371
+ const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(updateScrollVisibility) : void 0;
10372
+ intersectionObserver.observe(container);
10373
+ resizeObserver?.observe(container);
10374
+ updateScrollVisibility();
10375
+ return () => {
10376
+ container.removeEventListener("scroll", updateScrollVisibility);
10377
+ intersectionObserver.disconnect();
10378
+ resizeObserver?.disconnect();
10379
+ };
10380
+ }, [updateScrollVisibility]);
10381
+ const onScoll = (direction) => {
10382
+ const container = containerRef.current;
10383
+ if (!container) return;
10384
+ const currentOffset = getScrollOffsetFromStart(container);
10385
+ const delta = direction === "leading" ? -100 : 100;
10386
+ const left = getScrollLeftForOffsetFromStart(
10387
+ container,
10388
+ currentOffset + delta
10389
+ );
10390
+ container.scrollTo({ left, behavior: "smooth" });
10391
+ };
10392
+ return { containerRef, leadingVisible, tailingVisible, isRTL, onScoll };
10393
+ }
10394
+
10395
+ // src/scrollIndicator/hooks/useDrag.ts
10103
10396
  function useDrag(containerRef) {
10104
10397
  const [isDragging, setIsDragging] = React73.useState(false);
10105
10398
  const [startX, setStartX] = React73.useState(0);
10106
- const [scrollLeft, setScrollLeft] = React73.useState(0);
10399
+ const [scrollOffsetFromStart, setScrollOffsetFromStart] = React73.useState(0);
10107
10400
  const handleMouseDown = (e) => {
10108
10401
  if (!containerRef.current) return;
10109
10402
  setIsDragging(true);
10110
10403
  setStartX(e.pageX - containerRef.current.offsetLeft);
10111
- setScrollLeft(containerRef.current.scrollLeft);
10404
+ setScrollOffsetFromStart(getScrollOffsetFromStart(containerRef.current));
10112
10405
  };
10113
10406
  const handleMouseMove = (e) => {
10114
10407
  if (!isDragging || !containerRef.current) return;
10115
10408
  e.preventDefault();
10116
10409
  const x = e.pageX - containerRef.current.offsetLeft;
10117
10410
  const walk = x - startX;
10118
- containerRef.current.scrollLeft = scrollLeft - walk;
10411
+ containerRef.current.scrollLeft = getScrollLeftForOffsetFromStart(
10412
+ containerRef.current,
10413
+ scrollOffsetFromStart - walk
10414
+ );
10119
10415
  };
10120
10416
  const handleMouseUp = () => {
10121
10417
  setIsDragging(false);
@@ -10127,58 +10423,9 @@ function useDrag(containerRef) {
10127
10423
  isDragging
10128
10424
  };
10129
10425
  }
10130
- function useScroll2() {
10131
- const [leadingVisible, setLeadingVisible] = React73.useState(false);
10132
- const [tailingVisible, setTailingVisible] = React73.useState(false);
10133
- const containerRef = React73.useRef(null);
10134
- React73.useEffect(() => {
10135
- if (!containerRef.current) return;
10136
- const handleScroll = () => {
10137
- const container2 = containerRef.current;
10138
- if (!container2) return;
10139
- setLeadingVisible(container2.scrollLeft > 0);
10140
- setTailingVisible(
10141
- container2.scrollLeft + container2.clientWidth < container2.scrollWidth
10142
- );
10143
- };
10144
- const intersectionObserver = new IntersectionObserver((entries) => {
10145
- entries.forEach((entry) => {
10146
- if (entry.isIntersecting) {
10147
- handleScroll();
10148
- }
10149
- });
10150
- });
10151
- const container = containerRef.current;
10152
- container.addEventListener("scroll", handleScroll);
10153
- intersectionObserver.observe(container);
10154
- return () => {
10155
- container.removeEventListener("scroll", handleScroll);
10156
- intersectionObserver.disconnect();
10157
- };
10158
- }, []);
10159
- React73.useEffect(() => {
10160
- if (!containerRef.current) return;
10161
- const intersectionObserver = new IntersectionObserver((entries) => {
10162
- entries.forEach((entry) => {
10163
- if (entry.isIntersecting) ;
10164
- });
10165
- });
10166
- intersectionObserver.observe(containerRef.current);
10167
- return () => {
10168
- intersectionObserver.disconnect();
10169
- };
10170
- }, []);
10171
- const onScoll = (direction) => {
10172
- if (direction === "left") {
10173
- containerRef.current?.scrollBy({ left: -100, behavior: "smooth" });
10174
- } else {
10175
- containerRef.current?.scrollBy({ left: 100, behavior: "smooth" });
10176
- }
10177
- };
10178
- return { containerRef, leadingVisible, tailingVisible, onScoll };
10179
- }
10180
10426
  var ScrolButton = (props) => {
10181
- const { visible, leading, tailing, onClick } = props;
10427
+ const { visible, leading, tailing, isRTL, onClick } = props;
10428
+ const isLeftEdge = isRTL ? tailing : leading;
10182
10429
  if (!visible) {
10183
10430
  return null;
10184
10431
  }
@@ -10186,14 +10433,18 @@ var ScrolButton = (props) => {
10186
10433
  "button",
10187
10434
  {
10188
10435
  onClick: () => {
10189
- onClick?.(leading ? "left" : "right");
10436
+ onClick?.(leading ? "leading" : "tailing");
10437
+ },
10438
+ style: {
10439
+ direction: "ltr",
10440
+ left: isLeftEdge ? 0 : void 0,
10441
+ right: isLeftEdge ? void 0 : 0
10190
10442
  },
10191
10443
  className: tailwindVariants.cnBase(
10192
10444
  leading ? "oui-scroll-indicator-leading" : "oui-scroll-indicator-tailing",
10193
10445
  "oui-group oui-flex",
10194
10446
  "oui-absolute oui-top-0 oui-bottom-0",
10195
- leading && "oui-left-0 oui-flex-row-reverse",
10196
- tailing && "oui-right-0"
10447
+ isLeftEdge && "oui-flex-row-reverse"
10197
10448
  ),
10198
10449
  children: [
10199
10450
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10202,7 +10453,7 @@ var ScrolButton = (props) => {
10202
10453
  className: tailwindVariants.cnBase(
10203
10454
  "oui-w-6 oui-h-full",
10204
10455
  "oui-bg-[linear-gradient(90deg,rgba(var(--oui-color-base-9)_/_0)_0%,rgba(var(--oui-color-base-9)_/_1)_100%)]",
10205
- leading && "oui-rotate-180"
10456
+ isLeftEdge && "oui-rotate-180"
10206
10457
  )
10207
10458
  }
10208
10459
  ),
@@ -10218,7 +10469,7 @@ var ScrolButton = (props) => {
10218
10469
  {
10219
10470
  className: tailwindVariants.cnBase(
10220
10471
  "oui-text-base-contrast-54 group-hover:oui-text-base-contrast",
10221
- leading && "oui-rotate-180"
10472
+ isLeftEdge && "oui-rotate-180"
10222
10473
  )
10223
10474
  }
10224
10475
  )
@@ -10241,14 +10492,14 @@ var ArrowRightIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
10241
10492
  }
10242
10493
  );
10243
10494
  var ScrollIndicator = (props) => {
10244
- const { containerRef, leadingVisible, tailingVisible, onScoll } = useScroll2();
10495
+ const { containerRef, leadingVisible, tailingVisible, isRTL, onScoll } = useScroll2();
10245
10496
  const { handleMouseDown, handleMouseMove, handleMouseUp, isDragging } = useDrag(containerRef);
10246
10497
  return /* @__PURE__ */ jsxRuntime.jsxs(
10247
10498
  "div",
10248
10499
  {
10249
10500
  className: tailwindVariants.cnBase(
10250
10501
  "oui-scroll-indicator",
10251
- "oui-relative oui-select-none oui-overflow-hidden",
10502
+ "oui-relative oui-min-w-0 oui-flex-1 oui-select-none oui-overflow-hidden",
10252
10503
  props.className
10253
10504
  ),
10254
10505
  children: [
@@ -10267,13 +10518,33 @@ var ScrollIndicator = (props) => {
10267
10518
  children: props.children
10268
10519
  }
10269
10520
  ),
10270
- /* @__PURE__ */ jsxRuntime.jsx(ScrolButton, { leading: true, onClick: onScoll, visible: leadingVisible }),
10271
- /* @__PURE__ */ jsxRuntime.jsx(ScrolButton, { tailing: true, onClick: onScoll, visible: tailingVisible })
10521
+ /* @__PURE__ */ jsxRuntime.jsx(
10522
+ ScrolButton,
10523
+ {
10524
+ leading: true,
10525
+ isRTL,
10526
+ onClick: onScoll,
10527
+ visible: leadingVisible
10528
+ }
10529
+ ),
10530
+ /* @__PURE__ */ jsxRuntime.jsx(
10531
+ ScrolButton,
10532
+ {
10533
+ tailing: true,
10534
+ isRTL,
10535
+ onClick: onScoll,
10536
+ visible: tailingVisible
10537
+ }
10538
+ )
10272
10539
  ]
10273
10540
  }
10274
10541
  );
10275
10542
  };
10276
10543
  var TabsContext = React73.createContext({});
10544
+ function useResolvedTabsDir(propDir) {
10545
+ const fromDocument = useDocumentDirection();
10546
+ return propDir ?? fromDocument;
10547
+ }
10277
10548
  var Tabs = (props) => {
10278
10549
  const { getComponentTheme } = useOrderlyTheme();
10279
10550
  const {
@@ -10282,8 +10553,10 @@ var Tabs = (props) => {
10282
10553
  variant,
10283
10554
  showScrollIndicator,
10284
10555
  value,
10556
+ dir: dirProp,
10285
10557
  ...rest
10286
10558
  } = props;
10559
+ const dir = useResolvedTabsDir(dirProp);
10287
10560
  const tabsOverrides = getComponentTheme("tabs", {
10288
10561
  variant: variant ?? "contained"
10289
10562
  });
@@ -10337,7 +10610,7 @@ var Tabs = (props) => {
10337
10610
  };
10338
10611
  return /* @__PURE__ */ jsxRuntime.jsxs(TabsContext.Provider, { value: memoizedValue, children: [
10339
10612
  props.children,
10340
- /* @__PURE__ */ jsxRuntime.jsxs(TabsBase, { value, ...rest, children: [
10613
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsBase, { value, ...rest, dir, children: [
10341
10614
  /* @__PURE__ */ jsxRuntime.jsxs(
10342
10615
  Flex,
10343
10616
  {
@@ -10585,7 +10858,7 @@ var sliderVariants = tv({
10585
10858
  "data-[disabled]:oui-hidden"
10586
10859
  ],
10587
10860
  track: "oui-relative oui-h-[8px] oui-w-full oui-grow oui-overflow-hidden oui-rounded-full",
10588
- trackInner: "oui-absolute oui-left-0 oui-right-0 oui-h-[2px] oui-top-[3px] oui-pointer-events-none oui-bg-base-2",
10861
+ trackInner: "oui-absolute oui-start-0 oui-end-0 oui-h-[2px] oui-top-[3px] oui-pointer-events-none oui-bg-base-2",
10589
10862
  range: "oui-absolute oui-h-[2px] oui-top-[3px] oui-bg-primary data-[disabled]:oui-bg-base-2",
10590
10863
  mark: "oui-absolute oui-top-[1px] oui-w-[6px] oui-h-[6px] oui-rounded oui-border oui-border-base-2 oui-bg-base-6 oui-pointer-events-none oui-translate-x-[-50%]",
10591
10864
  tips: [
@@ -11151,7 +11424,7 @@ var ListViewInner = (props, ref) => {
11151
11424
  {
11152
11425
  className: tailwindVariants.cn(
11153
11426
  "oui-space-y-3 oui-h-full oui-w-full",
11154
- emptyDataSouce && "oui-absolute oui-bottom-0 oui-left-0 oui-right-0 oui-top-0",
11427
+ emptyDataSouce && "oui-absolute oui-bottom-0 oui-start-0 oui-end-0 oui-top-0",
11155
11428
  props.contentClassName
11156
11429
  )({ twMerge: true }),
11157
11430
  children: listViewElement
@@ -11386,7 +11659,7 @@ var dropdownMenuVariants = tailwindVariants.tv({
11386
11659
  ],
11387
11660
  label: "oui-px-2 oui-py-1.5 oui-text-sm oui-font-semibold",
11388
11661
  separator: "-oui-mx-1 oui-my-1 oui-h-px oui-bg-muted",
11389
- shortcut: "oui-ml-auto oui-text-xs oui-tracking-widest oui-opacity-60"
11662
+ shortcut: "oui-ms-auto oui-text-xs oui-tracking-widest oui-opacity-60"
11390
11663
  },
11391
11664
  variants: {
11392
11665
  size: {
@@ -11431,8 +11704,8 @@ var dropdownMenuVariants = tailwindVariants.tv({
11431
11704
  },
11432
11705
  inset: {
11433
11706
  true: {
11434
- item: ["oui-pl-8"],
11435
- label: ["oui-pl-8"]
11707
+ item: ["oui-ps-8"],
11708
+ label: ["oui-ps-8"]
11436
11709
  }
11437
11710
  }
11438
11711
  },
@@ -12252,6 +12525,7 @@ exports.startViewTransition = startViewTransition;
12252
12525
  exports.statisticVariants = statisticVariants;
12253
12526
  exports.textVariants = textVariants;
12254
12527
  exports.tv = tv;
12528
+ exports.useDocumentDirection = useDocumentDirection;
12255
12529
  exports.useLocale = useLocale;
12256
12530
  exports.useLongPress = useLongPress;
12257
12531
  exports.useMediaQuery = useMediaQuery;