@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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React73 from 'react';
2
- import React73__default, { forwardRef, useMemo, useRef, useCallback, useState, useEffect, useId, createContext, Fragment as Fragment$1, memo, useImperativeHandle, useContext, useReducer, createElement } from 'react';
2
+ import React73__default, { forwardRef, useMemo, useRef, useCallback, useState, useEffect, useId, createContext, Fragment as Fragment$1, memo, useSyncExternalStore, useImperativeHandle, useContext, useReducer, createElement } from 'react';
3
3
  import { createTV, tv as tv$1, cnBase, cn } from 'tailwind-variants';
4
4
  export { cnBase as cn } from 'tailwind-variants';
5
5
  import { Slot } from '@radix-ui/react-slot';
@@ -783,7 +783,7 @@ var BaseButton = React73__default.forwardRef(
783
783
  }, [size, icon]);
784
784
  const content = useMemo(() => {
785
785
  if (!leading && !trailing && !iconElement) return children;
786
- return /* @__PURE__ */ jsxs(Flex, { as: "span", itemAlign: "center", className: "oui-space-x-1", children: [
786
+ return /* @__PURE__ */ jsxs(Flex, { as: "span", itemAlign: "center", className: "oui-gap-x-1", children: [
787
787
  leading,
788
788
  iconElement,
789
789
  /* @__PURE__ */ jsx("span", { children }),
@@ -1496,7 +1496,7 @@ var TokenIcon = (props) => {
1496
1496
  var CombineIcon = (props) => {
1497
1497
  const { secondary } = props;
1498
1498
  const subElement = useMemo(() => {
1499
- 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";
1499
+ 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";
1500
1500
  if (secondary.component) {
1501
1501
  return /* @__PURE__ */ jsx("div", { className: cnBase(className, secondary?.className), children: secondary.component });
1502
1502
  }
@@ -4586,6 +4586,7 @@ var Numeral = (props) => {
4586
4586
  {
4587
4587
  ...rest,
4588
4588
  color: colorName,
4589
+ dir: "ltr",
4589
4590
  className: cnBase("oui-tabular-nums", className),
4590
4591
  children: childWithUnit
4591
4592
  }
@@ -4928,6 +4929,31 @@ var useThemeAttribute = () => {
4928
4929
  }, []);
4929
4930
  return themeAttribute;
4930
4931
  };
4932
+ function subscribeDocumentDir(listener) {
4933
+ if (typeof document === "undefined") {
4934
+ return () => {
4935
+ };
4936
+ }
4937
+ const observer = new MutationObserver(listener);
4938
+ observer.observe(document.documentElement, {
4939
+ attributes: true,
4940
+ attributeFilter: ["dir"]
4941
+ });
4942
+ return () => observer.disconnect();
4943
+ }
4944
+ function getDocumentDirection() {
4945
+ if (typeof document === "undefined") {
4946
+ return "ltr";
4947
+ }
4948
+ return document.documentElement.dir === "rtl" ? "rtl" : "ltr";
4949
+ }
4950
+ function useDocumentDirection() {
4951
+ return useSyncExternalStore(
4952
+ subscribeDocumentDir,
4953
+ getDocumentDirection,
4954
+ () => "ltr"
4955
+ );
4956
+ }
4931
4957
  var popoverVariants = tv({
4932
4958
  base: [
4933
4959
  "oui-popover-content",
@@ -5121,7 +5147,7 @@ var SymbolBadge = (props) => {
5121
5147
  const { badge, fullName } = props;
5122
5148
  const { isMobile } = useScreen();
5123
5149
  if (!badge) return null;
5124
- const badgeEl = /* @__PURE__ */ jsx(Badge, { color: "neutral", size: "xs", className: "oui-ml-1", children: badge });
5150
+ const badgeEl = /* @__PURE__ */ jsx(Badge, { color: "neutral", size: "xs", className: "oui-ms-1", children: badge });
5125
5151
  if (!fullName) return badgeEl;
5126
5152
  const isTruncated = badge.endsWith("...");
5127
5153
  if (isMobile) {
@@ -5476,6 +5502,9 @@ var inputVariants = tv(
5476
5502
  box: ["oui-bg-base-5"]
5477
5503
  }
5478
5504
  },
5505
+ // RTL-EXCLUDE: Keep `pl` / `pr` variants mapped to physical padding.
5506
+ // These variant names are part of the Input API and callers use them to
5507
+ // reserve explicit left/right space for prefix/suffix layouts.
5479
5508
  pl: {
5480
5509
  true: {
5481
5510
  box: "oui-pl-3"
@@ -5502,10 +5531,10 @@ var inputVariants = tv(
5502
5531
  input: "oui-text-center"
5503
5532
  },
5504
5533
  left: {
5505
- input: "oui-text-left"
5534
+ input: "oui-text-start"
5506
5535
  },
5507
5536
  right: {
5508
- input: "oui-text-right"
5537
+ input: "oui-text-end"
5509
5538
  }
5510
5539
  }
5511
5540
  },
@@ -5639,7 +5668,7 @@ var scrollAreaVariants = tv({
5639
5668
  variants: {
5640
5669
  orientation: {
5641
5670
  vertical: {
5642
- bar: "oui-h-full oui-w-2 oui-border-l oui-border-l-transparent oui-p-[1px]"
5671
+ bar: "oui-h-full oui-w-2 oui-border-s oui-border-s-transparent oui-p-[1px]"
5643
5672
  },
5644
5673
  horizontal: {
5645
5674
  bar: "oui-h-2 oui-flex-col oui-border-t oui-border-t-transparent oui-p-[1px]"
@@ -5705,7 +5734,7 @@ var selectVariants = tv(
5705
5734
  "oui-rounded-md",
5706
5735
  "oui-px-2",
5707
5736
  // "oui-py-2",
5708
- "oui-space-x-1",
5737
+ "oui-gap-x-1",
5709
5738
  // "oui-text-sm",
5710
5739
  "oui-shadow-sm",
5711
5740
  // "oui-ring-offset-background",
@@ -5756,8 +5785,8 @@ var selectVariants = tv(
5756
5785
  "oui-items-center",
5757
5786
  "oui-rounded-sm",
5758
5787
  "oui-py-1",
5759
- "oui-pl-2",
5760
- "oui-pr-8",
5788
+ "oui-ps-2",
5789
+ "oui-pe-8",
5761
5790
  "oui-text-sm",
5762
5791
  "oui-text-base-contrast-54",
5763
5792
  "oui-outline-none",
@@ -6138,7 +6167,7 @@ var defaultOptionRenderer = (option, currentValue) => {
6138
6167
  height: 4,
6139
6168
  gradient: "brand",
6140
6169
  r: "full",
6141
- className: "oui-absolute oui-right-2 oui-top-1/2 -oui-translate-y-1/2"
6170
+ className: "oui-absolute oui-end-2 oui-top-1/2 -oui-translate-y-1/2"
6142
6171
  }
6143
6172
  )
6144
6173
  ]
@@ -6220,7 +6249,7 @@ var Option = (props) => {
6220
6249
  value,
6221
6250
  className: item({
6222
6251
  size,
6223
- className: "oui-space-x-1 oui-flex oui-flex-row oui-items-center"
6252
+ className: "oui-gap-x-1 oui-flex oui-flex-row oui-items-center"
6224
6253
  }),
6225
6254
  children: [
6226
6255
  /* @__PURE__ */ jsx(
@@ -6522,7 +6551,7 @@ var textFieldVariants = tv({
6522
6551
  root: "oui-flex-col oui-space-y-1"
6523
6552
  },
6524
6553
  row: {
6525
- root: "oui-flex-row oui-space-x-3 "
6554
+ root: "oui-flex-row oui-gap-x-3 "
6526
6555
  }
6527
6556
  }
6528
6557
  },
@@ -6735,7 +6764,16 @@ var Switch = React73__default.forwardRef(({ className, color, ...props }, ref) =
6735
6764
  className,
6736
6765
  color
6737
6766
  });
6738
- return /* @__PURE__ */ jsx(SwitchPrimitives.Root, { className: root({ className }), ...props, ref, children: /* @__PURE__ */ jsx(SwitchPrimitives.Thumb, { className: thumb() }) });
6767
+ return /* @__PURE__ */ jsx(
6768
+ SwitchPrimitives.Root,
6769
+ {
6770
+ className: root({ className }),
6771
+ ...props,
6772
+ ref,
6773
+ dir: "ltr",
6774
+ children: /* @__PURE__ */ jsx(SwitchPrimitives.Thumb, { className: thumb() })
6775
+ }
6776
+ );
6739
6777
  });
6740
6778
  Switch.displayName = SwitchPrimitives.Root.displayName;
6741
6779
  var Logo = React73__default.forwardRef(({ src, alt, href }, ref) => {
@@ -6760,38 +6798,115 @@ function useInit(params) {
6760
6798
  }, [loading, ignoreLoadingCheck, dataSource, initialized]);
6761
6799
  return initialized;
6762
6800
  }
6801
+ var SCROLL_EPSILON = 1;
6802
+ var cachedRTLScrollType = null;
6763
6803
  function useScroll(deps) {
6764
6804
  const scrollRef = useRef(null);
6765
6805
  const [showLeftShadow, setShowLeftShadow] = useState(false);
6766
6806
  const [showRightShadow, setShowRightShadow] = useState(false);
6807
+ const [isRTL, setIsRTL] = useState(false);
6767
6808
  useEffect(() => {
6768
6809
  if (!scrollRef.current) {
6769
6810
  return;
6770
6811
  }
6771
- scrollRef.current.addEventListener("scroll", function(e) {
6772
- setShowLeftShadow(scrollRef.current.scrollLeft > 0);
6773
- setShowRightShadow(!isScrolledToRight(scrollRef.current));
6812
+ const target = scrollRef.current;
6813
+ const updateState = () => {
6814
+ const direction = window.getComputedStyle(target).direction;
6815
+ const rtl = direction === "rtl";
6816
+ setIsRTL(rtl);
6817
+ const scrollAble = hasHorizontalScroll(target);
6818
+ const { fromStart, fromEnd } = getHorizontalScrollOffset(target);
6819
+ setShowLeftShadow(scrollAble && fromStart > SCROLL_EPSILON);
6820
+ setShowRightShadow(scrollAble && fromEnd > SCROLL_EPSILON);
6821
+ };
6822
+ updateState();
6823
+ target.addEventListener("scroll", updateState);
6824
+ const nearestDirElement = target.closest("[dir]");
6825
+ const dirObserveTarget = nearestDirElement || document.documentElement;
6826
+ const mutationObserver = new MutationObserver(updateState);
6827
+ mutationObserver.observe(dirObserveTarget, {
6828
+ attributes: true,
6829
+ attributeFilter: ["dir"]
6774
6830
  });
6775
- }, [scrollRef]);
6776
- useEffect(() => {
6777
- if (!scrollRef.current) {
6778
- return;
6831
+ let resizeObserver;
6832
+ if (typeof ResizeObserver !== "undefined") {
6833
+ resizeObserver = new ResizeObserver(updateState);
6834
+ resizeObserver.observe(target);
6779
6835
  }
6780
- const scrollAble = hasHorizontalScroll(scrollRef.current);
6781
- const scrollEnd = isScrolledToRight(scrollRef.current);
6782
- setShowRightShadow(scrollAble && !scrollEnd);
6836
+ return () => {
6837
+ target.removeEventListener("scroll", updateState);
6838
+ mutationObserver.disconnect();
6839
+ resizeObserver?.disconnect();
6840
+ };
6783
6841
  }, [scrollRef, ...deps]);
6784
6842
  return {
6785
6843
  scrollRef,
6786
6844
  showLeftShadow,
6787
- showRightShadow
6845
+ showRightShadow,
6846
+ isRTL
6788
6847
  };
6789
6848
  }
6790
- function isScrolledToRight(element) {
6791
- return element.scrollLeft + element.clientWidth >= element.scrollWidth;
6792
- }
6793
6849
  function hasHorizontalScroll(element) {
6794
- return element.scrollWidth > element.clientWidth;
6850
+ return element.scrollWidth - element.clientWidth > SCROLL_EPSILON;
6851
+ }
6852
+ function getHorizontalScrollOffset(element) {
6853
+ const max = element.scrollWidth - element.clientWidth;
6854
+ if (max <= 0) {
6855
+ return { fromStart: 0, fromEnd: 0 };
6856
+ }
6857
+ const direction = window.getComputedStyle(element).direction;
6858
+ if (direction !== "rtl") {
6859
+ return {
6860
+ fromStart: Math.max(0, element.scrollLeft),
6861
+ fromEnd: Math.max(0, max - element.scrollLeft)
6862
+ };
6863
+ }
6864
+ const scrollType = getRTLScrollType();
6865
+ const scrollLeft = element.scrollLeft;
6866
+ let fromStart = 0;
6867
+ if (scrollType === "negative") {
6868
+ fromStart = -scrollLeft;
6869
+ } else if (scrollType === "reverse") {
6870
+ fromStart = scrollLeft;
6871
+ } else {
6872
+ fromStart = max - scrollLeft;
6873
+ }
6874
+ return {
6875
+ fromStart: Math.max(0, fromStart),
6876
+ fromEnd: Math.max(0, max - fromStart)
6877
+ };
6878
+ }
6879
+ function getRTLScrollType() {
6880
+ if (cachedRTLScrollType) {
6881
+ return cachedRTLScrollType;
6882
+ }
6883
+ if (typeof document === "undefined" || !document.body) {
6884
+ cachedRTLScrollType = "negative";
6885
+ return cachedRTLScrollType;
6886
+ }
6887
+ const outer = document.createElement("div");
6888
+ const inner = document.createElement("div");
6889
+ outer.style.width = "4px";
6890
+ outer.style.height = "1px";
6891
+ outer.style.overflow = "scroll";
6892
+ outer.style.visibility = "hidden";
6893
+ outer.style.position = "absolute";
6894
+ outer.style.top = "-9999px";
6895
+ outer.dir = "rtl";
6896
+ inner.style.width = "8px";
6897
+ inner.style.height = "1px";
6898
+ outer.appendChild(inner);
6899
+ document.body.appendChild(outer);
6900
+ let type;
6901
+ if (outer.scrollLeft > 0) {
6902
+ type = "default";
6903
+ } else {
6904
+ outer.scrollLeft = 1;
6905
+ type = outer.scrollLeft === 0 ? "negative" : "reverse";
6906
+ }
6907
+ document.body.removeChild(outer);
6908
+ cachedRTLScrollType = type;
6909
+ return type;
6795
6910
  }
6796
6911
  function useShowHeader(params) {
6797
6912
  const { dataSource, loading } = params;
@@ -6857,9 +6972,11 @@ function useWrap(deps) {
6857
6972
  var alignVariants = tv$1({
6858
6973
  variants: {
6859
6974
  align: {
6860
- left: "oui-text-left",
6975
+ left: "oui-text-start",
6976
+ start: "oui-text-start",
6861
6977
  center: "oui-text-center",
6862
- right: "oui-text-right"
6978
+ right: "oui-text-end",
6979
+ end: "oui-text-end"
6863
6980
  }
6864
6981
  },
6865
6982
  defaultVariants: {
@@ -6889,13 +7006,16 @@ var TableCell = (props) => {
6889
7006
  }
6890
7007
  return flexRender(cell.column.columnDef.cell, cell.getContext());
6891
7008
  };
6892
- function getColumnPinningProps(column, isHeader) {
7009
+ function getColumnPinningProps(column, isRTL) {
6893
7010
  const isPinned = column.getIsPinned();
6894
7011
  const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
6895
7012
  const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
6896
7013
  const style = {
6897
- left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
6898
- right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
7014
+ // Keep logical inset here. TanStack pinning still reports left/right
7015
+ // groups, but sticky offsets must follow the scroll container direction;
7016
+ // physical left/right breaks fixed columns in RTL tables.
7017
+ insetInlineStart: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
7018
+ insetInlineEnd: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
6899
7019
  width: column.getSize()
6900
7020
  };
6901
7021
  const contentCls = cnBase(
@@ -6909,8 +7029,18 @@ function getColumnPinningProps(column, isHeader) {
6909
7029
  "before:oui-top-0 before:oui-z-[-1]",
6910
7030
  "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%)]"
6911
7031
  );
6912
- const leftShadow = isLastLeftPinnedColumn && cnBase(shadowCls, "before:oui-right-[-32px]");
6913
- const rightShadow = isFirstRightPinnedColumn && cnBase(shadowCls, "before:oui-left-[-32px] before:oui-rotate-180");
7032
+ const leftShadow = isLastLeftPinnedColumn && cnBase(
7033
+ shadowCls,
7034
+ // The shadow sits on the logical outer edge of the pinned group.
7035
+ "before:oui-end-[-32px]",
7036
+ isRTL && "before:oui-rotate-180"
7037
+ );
7038
+ const rightShadow = isFirstRightPinnedColumn && cnBase(
7039
+ shadowCls,
7040
+ // Do not replace with physical left/right; this mirrors with RTL pinning.
7041
+ "before:oui-start-[-32px]",
7042
+ !isRTL && "before:oui-rotate-180"
7043
+ );
6914
7044
  return {
6915
7045
  style,
6916
7046
  classNames: {
@@ -6932,7 +7062,7 @@ var TableBody = (props) => {
6932
7062
  "data-testid": props.testId,
6933
7063
  children: props.rows.map((row) => {
6934
7064
  const { className, onClick, ...rest } = typeof props.onRow === "function" ? props.onRow(row.original, row.index, row) || {} : {};
6935
- const expandView = row.getIsExpanded() && /* @__PURE__ */ jsx("tr", { className: "oui-table-expand-tr oui-z-0 [&>td:first-child]:oui-pl-3 [&>td:last-child]:oui-pr-3", children: /* @__PURE__ */ jsx(
7065
+ const expandView = row.getIsExpanded() && /* @__PURE__ */ jsx("tr", { className: "oui-table-expand-tr oui-z-0 [&>td:first-child]:oui-ps-3 [&>td:last-child]:oui-pe-3", children: /* @__PURE__ */ jsx(
6936
7066
  "td",
6937
7067
  {
6938
7068
  className: "oui-table-expand-td",
@@ -6946,7 +7076,7 @@ var TableBody = (props) => {
6946
7076
  {
6947
7077
  className: cnBase(
6948
7078
  "oui-table-tbody-tr oui-group oui-h-10",
6949
- "[&>td:first-child]:oui-pl-3 [&>td:last-child]:oui-pr-3",
7079
+ "[&>td:first-child]:oui-ps-3 [&>td:last-child]:oui-pe-3",
6950
7080
  typeof onClick === "function" && "oui-cursor-pointer",
6951
7081
  props.bordered && "oui-border-b oui-border-b-line-4",
6952
7082
  className
@@ -6955,7 +7085,7 @@ var TableBody = (props) => {
6955
7085
  ...rest,
6956
7086
  children: row.getVisibleCells().map((cell) => {
6957
7087
  const column = cell.column;
6958
- const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column);
7088
+ const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column, !!props.isRTL);
6959
7089
  const { align, className: rowClassName } = column.columnDef.meta || {};
6960
7090
  const {
6961
7091
  style: cellStyle,
@@ -7013,7 +7143,7 @@ var CellHover = ({ selected, isFirst, isLast }) => {
7013
7143
  "div",
7014
7144
  {
7015
7145
  className: cnBase(
7016
- "oui-absolute oui-left-0 oui-top-0 oui-z-[-1]",
7146
+ "oui-absolute oui-start-0 oui-top-0 oui-z-[-1]",
7017
7147
  "oui-size-full",
7018
7148
  "group-hover:oui-bg-line-4",
7019
7149
  selected && "oui-bg-line-6 group-hover:oui-bg-line-6",
@@ -7188,7 +7318,7 @@ var TableHeader = (props) => {
7188
7318
  className: cnBase(
7189
7319
  "oui-table-thead-tr",
7190
7320
  "oui-h-10",
7191
- "[&>th:first-child]:oui-pl-3 [&>th:last-child]:oui-pr-3",
7321
+ "[&>th:first-child]:oui-ps-3 [&>th:last-child]:oui-pe-3",
7192
7322
  props.className
7193
7323
  ),
7194
7324
  children: headerGroup.headers.map((header) => {
@@ -7198,7 +7328,7 @@ var TableHeader = (props) => {
7198
7328
  className: rowClassName,
7199
7329
  title
7200
7330
  } = column.columnDef.meta || {};
7201
- const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column);
7331
+ const { style: pinStyle, classNames: pinClassNames } = getColumnPinningProps(column, !!props.isRTL);
7202
7332
  const canSort = column.getCanSort();
7203
7333
  const isSorted = column.getIsSorted();
7204
7334
  return /* @__PURE__ */ jsx(
@@ -7209,7 +7339,7 @@ var TableHeader = (props) => {
7209
7339
  "oui-table-thead-th",
7210
7340
  "oui-whitespace-nowrap",
7211
7341
  "oui-px-1",
7212
- 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",
7342
+ 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",
7213
7343
  // use border-b will show bottom element content
7214
7344
  // props.bordered && "oui-border-b oui-border-line"
7215
7345
  alignVariants({ align }),
@@ -7358,9 +7488,9 @@ var PaginationPrevious = ({
7358
7488
  PaginationLink,
7359
7489
  {
7360
7490
  "aria-label": "Go to previous page",
7361
- className: cnBase("oui-gap-1 oui-pl-2.5", className),
7491
+ className: cnBase("oui-gap-1 oui-ps-2.5", className),
7362
7492
  ...props,
7363
- children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "oui-h-4 oui-w-4", color: "white" })
7493
+ children: /* @__PURE__ */ jsx(PaginationPreviousIcon, {})
7364
7494
  }
7365
7495
  );
7366
7496
  PaginationPrevious.displayName = "PaginationPrevious";
@@ -7371,12 +7501,22 @@ var PaginationNext = ({
7371
7501
  PaginationLink,
7372
7502
  {
7373
7503
  "aria-label": "Go to next page",
7374
- className: cnBase("oui-gap-1 oui-pr-2.5", className),
7504
+ className: cnBase("oui-gap-1 oui-pe-2.5", className),
7375
7505
  ...props,
7376
- children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "oui-h-4 oui-w-4", color: "white" })
7506
+ children: /* @__PURE__ */ jsx(PaginationNextIcon, {})
7377
7507
  }
7378
7508
  );
7379
7509
  PaginationNext.displayName = "PaginationNext";
7510
+ var PaginationPreviousIcon = () => {
7511
+ const dir = useDocumentDirection();
7512
+ const Icon4 = dir === "rtl" ? ChevronRightIcon : ChevronLeftIcon;
7513
+ return /* @__PURE__ */ jsx(Icon4, { className: "oui-h-4 oui-w-4", color: "white" });
7514
+ };
7515
+ var PaginationNextIcon = () => {
7516
+ const dir = useDocumentDirection();
7517
+ const Icon4 = dir === "rtl" ? ChevronLeftIcon : ChevronRightIcon;
7518
+ return /* @__PURE__ */ jsx(Icon4, { className: "oui-h-4 oui-w-4", color: "white" });
7519
+ };
7380
7520
  var Paginations = (props) => {
7381
7521
  const {
7382
7522
  classNames,
@@ -7387,14 +7527,14 @@ var Paginations = (props) => {
7387
7527
  } = props;
7388
7528
  const [locale] = useLocale("pagination");
7389
7529
  return /* @__PURE__ */ jsxs(Pagination, { className: cnBase(classNames?.pagination, className), children: [
7390
- !hideRowsPerPage ? /* @__PURE__ */ jsxs(Flex, { mr: 4, children: [
7530
+ !hideRowsPerPage ? /* @__PURE__ */ jsxs(Flex, { className: "oui-me-4", children: [
7391
7531
  /* @__PURE__ */ jsx(
7392
7532
  Text,
7393
7533
  {
7394
7534
  as: "div",
7395
7535
  size: "2xs",
7396
7536
  intensity: 54,
7397
- className: "oui-text-nowrap oui-mr-2",
7537
+ className: "oui-text-nowrap oui-me-2",
7398
7538
  children: locale.rowsPerPage
7399
7539
  }
7400
7540
  ),
@@ -7561,6 +7701,18 @@ var TablePlaceholder = (props) => {
7561
7701
  }
7562
7702
  );
7563
7703
  };
7704
+ function resolveFixedDirection(fixed, isRTL) {
7705
+ if (!fixed) {
7706
+ return null;
7707
+ }
7708
+ if (fixed === "left" || fixed === "right") {
7709
+ return fixed;
7710
+ }
7711
+ if (fixed === "start") {
7712
+ return isRTL ? "right" : "left";
7713
+ }
7714
+ return isRTL ? "left" : "right";
7715
+ }
7564
7716
  var compareValues = (aValue, bValue) => {
7565
7717
  if (aValue == null && bValue == null) return 0;
7566
7718
  if (aValue == null) return 1;
@@ -7680,13 +7832,14 @@ var Transform = {
7680
7832
  );
7681
7833
  return sortedData;
7682
7834
  },
7683
- columnPinning: (columns) => {
7835
+ columnPinning: (columns, isRTL = false) => {
7684
7836
  const left = [];
7685
7837
  const right = [];
7686
7838
  columns?.map((column) => {
7687
- if (column.fixed === "left") {
7839
+ const fixed = resolveFixedDirection(column.fixed, isRTL);
7840
+ if (fixed === "left") {
7688
7841
  left.push(column.dataIndex);
7689
- } else if (column.fixed === "right") {
7842
+ } else if (fixed === "right") {
7690
7843
  right.push(column.dataIndex);
7691
7844
  }
7692
7845
  });
@@ -7781,9 +7934,14 @@ function DataTable(props) {
7781
7934
  () => Transform.columns(columns, sorting, setSorting),
7782
7935
  [columns, sorting, setSorting]
7783
7936
  );
7937
+ const wrapRef = useWrap([className, classNames?.root]);
7938
+ const { scrollRef, showLeftShadow, showRightShadow, isRTL } = useScroll([
7939
+ dataSource?.length,
7940
+ columns?.length
7941
+ ]);
7784
7942
  const columnPinning = useMemo(
7785
- () => Transform.columnPinning(columns),
7786
- [columns]
7943
+ () => Transform.columnPinning(columns, isRTL),
7944
+ [columns, isRTL]
7787
7945
  );
7788
7946
  const rowSelection = useMemo(
7789
7947
  () => props.rowSelection || {},
@@ -7833,10 +7991,6 @@ function DataTable(props) {
7833
7991
  useEffect(() => {
7834
7992
  props.getTableInstance?.(table);
7835
7993
  }, [table]);
7836
- const wrapRef = useWrap([className, classNames?.root]);
7837
- const { scrollRef, showLeftShadow, showRightShadow } = useScroll([
7838
- dataSource?.length
7839
- ]);
7840
7994
  const rows = table.getRowModel().rows;
7841
7995
  const showPlaceholder = initialized && (rows.length === 0 || loading);
7842
7996
  const showHeader = useShowHeader({
@@ -7894,6 +8048,7 @@ function DataTable(props) {
7894
8048
  bordered: props.bordered,
7895
8049
  showLeftShadow,
7896
8050
  showRightShadow,
8051
+ isRTL,
7897
8052
  sorting
7898
8053
  }
7899
8054
  ),
@@ -7909,6 +8064,7 @@ function DataTable(props) {
7909
8064
  onCell: props.onCell,
7910
8065
  showLeftShadow,
7911
8066
  showRightShadow,
8067
+ isRTL,
7912
8068
  testId: props.testIds?.body
7913
8069
  }
7914
8070
  )
@@ -7959,23 +8115,23 @@ function Calendar({
7959
8115
  showOutsideDays,
7960
8116
  className: cnBase("oui-p-3 oui-bg-base-7 oui-rounded", className),
7961
8117
  classNames: {
7962
- months: "oui-flex oui-flex-col sm:oui-flex-row oui-space-y-4 sm:oui-space-x-4 sm:oui-space-y-0",
8118
+ months: "oui-flex oui-flex-col sm:oui-flex-row oui-space-y-4 sm:oui-gap-x-4 sm:oui-space-y-0",
7963
8119
  month: "oui-space-y-4",
7964
8120
  caption: "oui-flex oui-justify-center oui-pt-1 oui-relative oui-items-center",
7965
8121
  caption_label: "oui-text-sm oui-font-medium ",
7966
- nav: "oui-space-x-1 oui-flex oui-items-center",
8122
+ nav: "oui-gap-x-1 oui-flex oui-items-center",
7967
8123
  nav_button: cnBase(
7968
8124
  "oui-h-7 oui-w-7 oui-bg-transparent oui-p-0 oui-opacity-50 hover:oui-opacity-100"
7969
8125
  ),
7970
- nav_button_previous: "oui-absolute oui-left-1",
7971
- nav_button_next: "oui-absolute oui-right-1",
8126
+ nav_button_previous: "oui-absolute oui-start-1",
8127
+ nav_button_next: "oui-absolute oui-end-1",
7972
8128
  table: "oui-w-full oui-border-collapse oui-space-y-1",
7973
8129
  head_row: "oui-flex",
7974
8130
  head_cell: "oui-text-base-contrast-80 oui-rounded-md oui-w-7 oui-font-normal oui-text-[0.8rem] oui-opacity-30",
7975
8131
  row: "oui-flex oui-w-full oui-mt-2",
7976
8132
  cell: cnBase(
7977
- "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",
7978
- 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"
8133
+ "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",
8134
+ 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"
7979
8135
  ),
7980
8136
  day: cnBase(
7981
8137
  // buttonVariants({ variant: "ghost" }),
@@ -8243,14 +8399,26 @@ var sheetVariants = tv$1({
8243
8399
  side: {
8244
8400
  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",
8245
8401
  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",
8246
- 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",
8247
- 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"
8402
+ // Keep left/right sides on logical start/end. In RTL, callers expect
8403
+ // side="left" to attach to the visual start side; physical left/right
8404
+ // places drawers on the opposite side from their trigger.
8405
+ left: "oui-inset-y-0 oui-start-0 oui-h-full oui-w-3/4 sm:oui-max-w-sm",
8406
+ right: "oui-inset-y-0 oui-end-0 oui-h-full oui-w-3/4 oui-border-s sm:oui-max-w-sm"
8248
8407
  }
8249
8408
  },
8250
8409
  defaultVariants: {
8251
8410
  side: "bottom"
8252
8411
  }
8253
8412
  });
8413
+ function getLogicalSideAnimationClass(side, direction) {
8414
+ if (side === "left") {
8415
+ 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";
8416
+ }
8417
+ if (side === "right") {
8418
+ 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";
8419
+ }
8420
+ return void 0;
8421
+ }
8254
8422
  var SheetContent = React73.forwardRef(
8255
8423
  ({
8256
8424
  side = "bottom",
@@ -8261,43 +8429,54 @@ var SheetContent = React73.forwardRef(
8261
8429
  overlayClassName,
8262
8430
  children,
8263
8431
  ...props
8264
- }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
8265
- /* @__PURE__ */ jsx(SheetOverlay, { className: overlayClassName }),
8266
- /* @__PURE__ */ jsxs(
8267
- SheetPrimitive.Content,
8268
- {
8269
- ref,
8270
- className: cnBase(sheetVariants({ side }), className),
8271
- onOpenAutoFocus: (e) => e.preventDefault(),
8272
- onCloseAutoFocus: (e) => e.preventDefault(),
8273
- ...props,
8274
- children: [
8275
- closeable && /* @__PURE__ */ jsxs(
8276
- SheetPrimitive.Close,
8277
- {
8278
- className: cnBase(
8279
- "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",
8280
- props?.closeClassName
8281
- ),
8282
- children: [
8283
- /* @__PURE__ */ jsx(
8284
- CloseIcon,
8285
- {
8286
- size: closeableSize,
8287
- color: "white",
8288
- opacity: closeOpacity,
8289
- onClick: props?.onClose
8290
- }
8291
- ),
8292
- /* @__PURE__ */ jsx("span", { className: "oui-sr-only", children: "Close" })
8293
- ]
8294
- }
8432
+ }, ref) => {
8433
+ const direction = useDocumentDirection();
8434
+ const sideAnimationClassName = getLogicalSideAnimationClass(
8435
+ side,
8436
+ direction
8437
+ );
8438
+ return /* @__PURE__ */ jsxs(SheetPortal, { children: [
8439
+ /* @__PURE__ */ jsx(SheetOverlay, { className: overlayClassName }),
8440
+ /* @__PURE__ */ jsxs(
8441
+ SheetPrimitive.Content,
8442
+ {
8443
+ ref,
8444
+ className: cnBase(
8445
+ sheetVariants({ side }),
8446
+ sideAnimationClassName,
8447
+ className
8295
8448
  ),
8296
- children
8297
- ]
8298
- }
8299
- )
8300
- ] })
8449
+ onOpenAutoFocus: (e) => e.preventDefault(),
8450
+ onCloseAutoFocus: (e) => e.preventDefault(),
8451
+ ...props,
8452
+ children: [
8453
+ closeable && /* @__PURE__ */ jsxs(
8454
+ SheetPrimitive.Close,
8455
+ {
8456
+ className: cnBase(
8457
+ "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",
8458
+ props?.closeClassName
8459
+ ),
8460
+ children: [
8461
+ /* @__PURE__ */ jsx(
8462
+ CloseIcon,
8463
+ {
8464
+ size: closeableSize,
8465
+ color: "white",
8466
+ opacity: closeOpacity,
8467
+ onClick: props?.onClose
8468
+ }
8469
+ ),
8470
+ /* @__PURE__ */ jsx("span", { className: "oui-sr-only", children: "Close" })
8471
+ ]
8472
+ }
8473
+ ),
8474
+ children
8475
+ ]
8476
+ }
8477
+ )
8478
+ ] });
8479
+ }
8301
8480
  );
8302
8481
  SheetContent.displayName = SheetPrimitive.Content.displayName;
8303
8482
  var SheetHeader = ({
@@ -8340,7 +8519,7 @@ var SheetFooter = ({
8340
8519
  "div",
8341
8520
  {
8342
8521
  className: cnBase(
8343
- "oui-sheet-footer oui-flex oui-flex-col-reverse sm:oui-flex-row sm:oui-justify-end sm:oui-space-x-2",
8522
+ "oui-sheet-footer oui-flex oui-flex-col-reverse sm:oui-flex-row sm:oui-justify-end sm:oui-gap-x-2",
8344
8523
  className
8345
8524
  ),
8346
8525
  ...props
@@ -8726,7 +8905,7 @@ var dividerVariants = tv({
8726
8905
  },
8727
8906
  direction: {
8728
8907
  horizontal: ["oui-border-b"],
8729
- vertical: ["oui-border-l"]
8908
+ vertical: ["oui-border-s"]
8730
8909
  },
8731
8910
  lineStyle: {
8732
8911
  // solid: "oui-border-solid",
@@ -8823,6 +9002,9 @@ var dialogVariants = tv$1({
8823
9002
  content: [
8824
9003
  "oui-dialog-content",
8825
9004
  "oui-fixed",
9005
+ // RTL-EXCLUDE: Do not replace with `start-[50%]`.
9006
+ // Keep physical left centering here: start maps to right in RTL, which
9007
+ // breaks centering with translate-x-[-50%].
8826
9008
  "oui-left-[50%]",
8827
9009
  "oui-top-[50%]",
8828
9010
  "oui-z-50",
@@ -8853,7 +9035,7 @@ var dialogVariants = tv$1({
8853
9035
  close: [
8854
9036
  "oui-dialog-close-btn",
8855
9037
  "oui-absolute",
8856
- "oui-right-4",
9038
+ "oui-end-4",
8857
9039
  "oui-top-4",
8858
9040
  // "oui-opacity-70",
8859
9041
  "oui-ring-offset-background",
@@ -8874,7 +9056,8 @@ var dialogVariants = tv$1({
8874
9056
  "oui-flex",
8875
9057
  "oui-flex-row",
8876
9058
  "oui-justify-end",
8877
- "oui-space-x-2",
9059
+ // Use gap instead of space-x so spacing works in both LTR and RTL.
9060
+ "oui-gap-2",
8878
9061
  "oui-pb-5",
8879
9062
  "oui-pt-2 lg:oui-pt-3"
8880
9063
  // "has-[&>*:nth-child(1)]:oui-bg-red-400",
@@ -9640,7 +9823,7 @@ var Picker = forwardRef(
9640
9823
  "div",
9641
9824
  {
9642
9825
  className: cnBase(
9643
- "oui-space-x-1",
9826
+ "oui-gap-x-1",
9644
9827
  "oui-text-base-contrast-54",
9645
9828
  "oui-rounded-md",
9646
9829
  "oui-bg-base-8",
@@ -9895,7 +10078,8 @@ var tabsVariants = tv({
9895
10078
  "oui-text-base-contrast-36 hover:oui-text-base-contrast-54",
9896
10079
  "oui-ring-offset-background",
9897
10080
  "oui-transition-all",
9898
- "oui-space-x-1",
10081
+ /** `gap-x` mirrors correctly in RTL; `space-x` uses asymmetric margins that can overlap pill corners. */
10082
+ "oui-gap-x-1",
9899
10083
  "focus-visible:oui-outline-none",
9900
10084
  "focus-visible:oui-ring-2",
9901
10085
  "focus-visible:oui-ring-ring",
@@ -9908,12 +10092,7 @@ var tabsVariants = tv({
9908
10092
  variants: {
9909
10093
  variant: {
9910
10094
  text: {
9911
- list: [
9912
- "oui-space-x-6",
9913
- "oui-border-b",
9914
- "oui-border-line-6",
9915
- "oui-px-1"
9916
- ],
10095
+ list: ["oui-gap-x-6", "oui-border-b", "oui-border-line-6", "oui-px-1"],
9917
10096
  trigger: [
9918
10097
  "oui-group",
9919
10098
  "oui-pb-2",
@@ -9926,15 +10105,16 @@ var tabsVariants = tv({
9926
10105
  "data-[state=active]:after:oui-absolute",
9927
10106
  "data-[state=active]:after:oui-rounded-full",
9928
10107
  "data-[state=active]:after:-oui-bottom-0",
9929
- "data-[state=active]:after:oui-left-0",
9930
- "data-[state=active]:after:oui-right-0"
10108
+ "data-[state=active]:after:oui-start-0",
10109
+ "data-[state=active]:after:oui-end-0"
9931
10110
  ]
9932
10111
  },
9933
10112
  contained: {
9934
- list: ["oui-space-x-[6px]"],
10113
+ list: ["oui-gap-x-[6px]"],
9935
10114
  trigger: [
9936
10115
  "oui-group",
9937
- "oui-rounded",
10116
+ /** `!rounded` defeats host/segment overrides that strip one physical corner under `[dir="rtl"]` + `:first-child`. */
10117
+ "!oui-rounded",
9938
10118
  "oui-px-3",
9939
10119
  "oui-bg-base-7 hover:oui-bg-base-5",
9940
10120
  "oui-text-base-contrast-36",
@@ -9988,7 +10168,7 @@ var tabsVariants = tv({
9988
10168
  size: "sm",
9989
10169
  variant: "contained",
9990
10170
  className: {
9991
- list: ["oui-space-x-1"],
10171
+ list: ["oui-gap-x-1"],
9992
10172
  trigger: ["oui-text-2xs", "oui-h-6"],
9993
10173
  icon: ["oui-w-[10px]", "oui-h-[10px]"]
9994
10174
  }
@@ -10006,7 +10186,7 @@ var tabsVariants = tv({
10006
10186
  size: "lg",
10007
10187
  variant: "contained",
10008
10188
  className: {
10009
- trigger: ["oui-text-sm", "oui-h-8", "oui-rounded-md"],
10189
+ trigger: ["oui-text-sm", "oui-h-8", "!oui-rounded-md"],
10010
10190
  icon: ["oui-w-[14px]", "oui-h-[14px]"]
10011
10191
  }
10012
10192
  },
@@ -10014,7 +10194,7 @@ var tabsVariants = tv({
10014
10194
  size: "xl",
10015
10195
  variant: "contained",
10016
10196
  className: {
10017
- trigger: ["oui-text-base", "oui-h-9", "oui-rounded-md"],
10197
+ trigger: ["oui-text-base", "oui-h-9", "!oui-rounded-md"],
10018
10198
  icon: ["oui-w-4", "oui-h-4"]
10019
10199
  }
10020
10200
  }
@@ -10068,22 +10248,138 @@ var OrderlyThemeContext = createContext(
10068
10248
  var useOrderlyTheme = () => {
10069
10249
  return useContext(OrderlyThemeContext);
10070
10250
  };
10251
+ var cachedRtlScrollType;
10252
+ function getRtlScrollType() {
10253
+ if (cachedRtlScrollType) {
10254
+ return cachedRtlScrollType;
10255
+ }
10256
+ if (typeof document === "undefined") {
10257
+ cachedRtlScrollType = "negative";
10258
+ return cachedRtlScrollType;
10259
+ }
10260
+ const outer = document.createElement("div");
10261
+ const inner = document.createElement("div");
10262
+ outer.dir = "rtl";
10263
+ outer.style.width = "4px";
10264
+ outer.style.height = "1px";
10265
+ outer.style.overflow = "scroll";
10266
+ outer.style.position = "absolute";
10267
+ outer.style.top = "-1000px";
10268
+ inner.style.width = "8px";
10269
+ inner.style.height = "1px";
10270
+ outer.appendChild(inner);
10271
+ document.body.appendChild(outer);
10272
+ if (outer.scrollLeft > 0) {
10273
+ cachedRtlScrollType = "default";
10274
+ } else {
10275
+ outer.scrollLeft = 1;
10276
+ cachedRtlScrollType = outer.scrollLeft === 0 ? "negative" : "reverse";
10277
+ }
10278
+ document.body.removeChild(outer);
10279
+ return cachedRtlScrollType;
10280
+ }
10281
+ function getMaxScrollLeft(container) {
10282
+ return Math.max(container.scrollWidth - container.clientWidth, 0);
10283
+ }
10284
+ function getScrollOffsetFromStart(container) {
10285
+ const maxScrollLeft = getMaxScrollLeft(container);
10286
+ if (getComputedStyle(container).direction !== "rtl") {
10287
+ return container.scrollLeft;
10288
+ }
10289
+ switch (getRtlScrollType()) {
10290
+ case "negative":
10291
+ return -container.scrollLeft;
10292
+ case "default":
10293
+ return maxScrollLeft - container.scrollLeft;
10294
+ case "reverse":
10295
+ return container.scrollLeft;
10296
+ }
10297
+ }
10298
+ function getScrollLeftForOffsetFromStart(container, offsetFromStart) {
10299
+ const maxScrollLeft = getMaxScrollLeft(container);
10300
+ const nextOffset = Math.min(Math.max(offsetFromStart, 0), maxScrollLeft);
10301
+ if (getComputedStyle(container).direction !== "rtl") {
10302
+ return nextOffset;
10303
+ }
10304
+ switch (getRtlScrollType()) {
10305
+ case "negative":
10306
+ return -nextOffset;
10307
+ case "default":
10308
+ return maxScrollLeft - nextOffset;
10309
+ case "reverse":
10310
+ return nextOffset;
10311
+ }
10312
+ }
10313
+ function useScroll2() {
10314
+ const [leadingVisible, setLeadingVisible] = useState(false);
10315
+ const [tailingVisible, setTailingVisible] = useState(false);
10316
+ const [isRTL, setIsRTL] = useState(false);
10317
+ const containerRef = useRef(null);
10318
+ const updateScrollVisibility = useCallback(() => {
10319
+ const container = containerRef.current;
10320
+ if (!container) return;
10321
+ const maxScrollLeft = getMaxScrollLeft(container);
10322
+ const offsetFromStart = getScrollOffsetFromStart(container);
10323
+ const nextIsRTL = getComputedStyle(container).direction === "rtl";
10324
+ setIsRTL(nextIsRTL);
10325
+ setLeadingVisible(offsetFromStart > 1);
10326
+ setTailingVisible(offsetFromStart < maxScrollLeft - 1);
10327
+ }, []);
10328
+ useEffect(() => {
10329
+ const container = containerRef.current;
10330
+ if (!container) return;
10331
+ container.addEventListener("scroll", updateScrollVisibility);
10332
+ const intersectionObserver = new IntersectionObserver((entries) => {
10333
+ entries.forEach((entry) => {
10334
+ if (entry.isIntersecting) {
10335
+ updateScrollVisibility();
10336
+ }
10337
+ });
10338
+ });
10339
+ const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(updateScrollVisibility) : void 0;
10340
+ intersectionObserver.observe(container);
10341
+ resizeObserver?.observe(container);
10342
+ updateScrollVisibility();
10343
+ return () => {
10344
+ container.removeEventListener("scroll", updateScrollVisibility);
10345
+ intersectionObserver.disconnect();
10346
+ resizeObserver?.disconnect();
10347
+ };
10348
+ }, [updateScrollVisibility]);
10349
+ const onScoll = (direction) => {
10350
+ const container = containerRef.current;
10351
+ if (!container) return;
10352
+ const currentOffset = getScrollOffsetFromStart(container);
10353
+ const delta = direction === "leading" ? -100 : 100;
10354
+ const left = getScrollLeftForOffsetFromStart(
10355
+ container,
10356
+ currentOffset + delta
10357
+ );
10358
+ container.scrollTo({ left, behavior: "smooth" });
10359
+ };
10360
+ return { containerRef, leadingVisible, tailingVisible, isRTL, onScoll };
10361
+ }
10362
+
10363
+ // src/scrollIndicator/hooks/useDrag.ts
10071
10364
  function useDrag(containerRef) {
10072
10365
  const [isDragging, setIsDragging] = useState(false);
10073
10366
  const [startX, setStartX] = useState(0);
10074
- const [scrollLeft, setScrollLeft] = useState(0);
10367
+ const [scrollOffsetFromStart, setScrollOffsetFromStart] = useState(0);
10075
10368
  const handleMouseDown = (e) => {
10076
10369
  if (!containerRef.current) return;
10077
10370
  setIsDragging(true);
10078
10371
  setStartX(e.pageX - containerRef.current.offsetLeft);
10079
- setScrollLeft(containerRef.current.scrollLeft);
10372
+ setScrollOffsetFromStart(getScrollOffsetFromStart(containerRef.current));
10080
10373
  };
10081
10374
  const handleMouseMove = (e) => {
10082
10375
  if (!isDragging || !containerRef.current) return;
10083
10376
  e.preventDefault();
10084
10377
  const x = e.pageX - containerRef.current.offsetLeft;
10085
10378
  const walk = x - startX;
10086
- containerRef.current.scrollLeft = scrollLeft - walk;
10379
+ containerRef.current.scrollLeft = getScrollLeftForOffsetFromStart(
10380
+ containerRef.current,
10381
+ scrollOffsetFromStart - walk
10382
+ );
10087
10383
  };
10088
10384
  const handleMouseUp = () => {
10089
10385
  setIsDragging(false);
@@ -10095,58 +10391,9 @@ function useDrag(containerRef) {
10095
10391
  isDragging
10096
10392
  };
10097
10393
  }
10098
- function useScroll2() {
10099
- const [leadingVisible, setLeadingVisible] = useState(false);
10100
- const [tailingVisible, setTailingVisible] = useState(false);
10101
- const containerRef = useRef(null);
10102
- useEffect(() => {
10103
- if (!containerRef.current) return;
10104
- const handleScroll = () => {
10105
- const container2 = containerRef.current;
10106
- if (!container2) return;
10107
- setLeadingVisible(container2.scrollLeft > 0);
10108
- setTailingVisible(
10109
- container2.scrollLeft + container2.clientWidth < container2.scrollWidth
10110
- );
10111
- };
10112
- const intersectionObserver = new IntersectionObserver((entries) => {
10113
- entries.forEach((entry) => {
10114
- if (entry.isIntersecting) {
10115
- handleScroll();
10116
- }
10117
- });
10118
- });
10119
- const container = containerRef.current;
10120
- container.addEventListener("scroll", handleScroll);
10121
- intersectionObserver.observe(container);
10122
- return () => {
10123
- container.removeEventListener("scroll", handleScroll);
10124
- intersectionObserver.disconnect();
10125
- };
10126
- }, []);
10127
- useEffect(() => {
10128
- if (!containerRef.current) return;
10129
- const intersectionObserver = new IntersectionObserver((entries) => {
10130
- entries.forEach((entry) => {
10131
- if (entry.isIntersecting) ;
10132
- });
10133
- });
10134
- intersectionObserver.observe(containerRef.current);
10135
- return () => {
10136
- intersectionObserver.disconnect();
10137
- };
10138
- }, []);
10139
- const onScoll = (direction) => {
10140
- if (direction === "left") {
10141
- containerRef.current?.scrollBy({ left: -100, behavior: "smooth" });
10142
- } else {
10143
- containerRef.current?.scrollBy({ left: 100, behavior: "smooth" });
10144
- }
10145
- };
10146
- return { containerRef, leadingVisible, tailingVisible, onScoll };
10147
- }
10148
10394
  var ScrolButton = (props) => {
10149
- const { visible, leading, tailing, onClick } = props;
10395
+ const { visible, leading, tailing, isRTL, onClick } = props;
10396
+ const isLeftEdge = isRTL ? tailing : leading;
10150
10397
  if (!visible) {
10151
10398
  return null;
10152
10399
  }
@@ -10154,14 +10401,18 @@ var ScrolButton = (props) => {
10154
10401
  "button",
10155
10402
  {
10156
10403
  onClick: () => {
10157
- onClick?.(leading ? "left" : "right");
10404
+ onClick?.(leading ? "leading" : "tailing");
10405
+ },
10406
+ style: {
10407
+ direction: "ltr",
10408
+ left: isLeftEdge ? 0 : void 0,
10409
+ right: isLeftEdge ? void 0 : 0
10158
10410
  },
10159
10411
  className: cnBase(
10160
10412
  leading ? "oui-scroll-indicator-leading" : "oui-scroll-indicator-tailing",
10161
10413
  "oui-group oui-flex",
10162
10414
  "oui-absolute oui-top-0 oui-bottom-0",
10163
- leading && "oui-left-0 oui-flex-row-reverse",
10164
- tailing && "oui-right-0"
10415
+ isLeftEdge && "oui-flex-row-reverse"
10165
10416
  ),
10166
10417
  children: [
10167
10418
  /* @__PURE__ */ jsx(
@@ -10170,7 +10421,7 @@ var ScrolButton = (props) => {
10170
10421
  className: cnBase(
10171
10422
  "oui-w-6 oui-h-full",
10172
10423
  "oui-bg-[linear-gradient(90deg,rgba(var(--oui-color-base-9)_/_0)_0%,rgba(var(--oui-color-base-9)_/_1)_100%)]",
10173
- leading && "oui-rotate-180"
10424
+ isLeftEdge && "oui-rotate-180"
10174
10425
  )
10175
10426
  }
10176
10427
  ),
@@ -10186,7 +10437,7 @@ var ScrolButton = (props) => {
10186
10437
  {
10187
10438
  className: cnBase(
10188
10439
  "oui-text-base-contrast-54 group-hover:oui-text-base-contrast",
10189
- leading && "oui-rotate-180"
10440
+ isLeftEdge && "oui-rotate-180"
10190
10441
  )
10191
10442
  }
10192
10443
  )
@@ -10209,14 +10460,14 @@ var ArrowRightIcon = (props) => /* @__PURE__ */ jsx(
10209
10460
  }
10210
10461
  );
10211
10462
  var ScrollIndicator = (props) => {
10212
- const { containerRef, leadingVisible, tailingVisible, onScoll } = useScroll2();
10463
+ const { containerRef, leadingVisible, tailingVisible, isRTL, onScoll } = useScroll2();
10213
10464
  const { handleMouseDown, handleMouseMove, handleMouseUp, isDragging } = useDrag(containerRef);
10214
10465
  return /* @__PURE__ */ jsxs(
10215
10466
  "div",
10216
10467
  {
10217
10468
  className: cnBase(
10218
10469
  "oui-scroll-indicator",
10219
- "oui-relative oui-select-none oui-overflow-hidden",
10470
+ "oui-relative oui-min-w-0 oui-flex-1 oui-select-none oui-overflow-hidden",
10220
10471
  props.className
10221
10472
  ),
10222
10473
  children: [
@@ -10235,13 +10486,33 @@ var ScrollIndicator = (props) => {
10235
10486
  children: props.children
10236
10487
  }
10237
10488
  ),
10238
- /* @__PURE__ */ jsx(ScrolButton, { leading: true, onClick: onScoll, visible: leadingVisible }),
10239
- /* @__PURE__ */ jsx(ScrolButton, { tailing: true, onClick: onScoll, visible: tailingVisible })
10489
+ /* @__PURE__ */ jsx(
10490
+ ScrolButton,
10491
+ {
10492
+ leading: true,
10493
+ isRTL,
10494
+ onClick: onScoll,
10495
+ visible: leadingVisible
10496
+ }
10497
+ ),
10498
+ /* @__PURE__ */ jsx(
10499
+ ScrolButton,
10500
+ {
10501
+ tailing: true,
10502
+ isRTL,
10503
+ onClick: onScoll,
10504
+ visible: tailingVisible
10505
+ }
10506
+ )
10240
10507
  ]
10241
10508
  }
10242
10509
  );
10243
10510
  };
10244
10511
  var TabsContext = createContext({});
10512
+ function useResolvedTabsDir(propDir) {
10513
+ const fromDocument = useDocumentDirection();
10514
+ return propDir ?? fromDocument;
10515
+ }
10245
10516
  var Tabs = (props) => {
10246
10517
  const { getComponentTheme } = useOrderlyTheme();
10247
10518
  const {
@@ -10250,8 +10521,10 @@ var Tabs = (props) => {
10250
10521
  variant,
10251
10522
  showScrollIndicator,
10252
10523
  value,
10524
+ dir: dirProp,
10253
10525
  ...rest
10254
10526
  } = props;
10527
+ const dir = useResolvedTabsDir(dirProp);
10255
10528
  const tabsOverrides = getComponentTheme("tabs", {
10256
10529
  variant: variant ?? "contained"
10257
10530
  });
@@ -10305,7 +10578,7 @@ var Tabs = (props) => {
10305
10578
  };
10306
10579
  return /* @__PURE__ */ jsxs(TabsContext.Provider, { value: memoizedValue, children: [
10307
10580
  props.children,
10308
- /* @__PURE__ */ jsxs(TabsBase, { value, ...rest, children: [
10581
+ /* @__PURE__ */ jsxs(TabsBase, { value, ...rest, dir, children: [
10309
10582
  /* @__PURE__ */ jsxs(
10310
10583
  Flex,
10311
10584
  {
@@ -10553,7 +10826,7 @@ var sliderVariants = tv({
10553
10826
  "data-[disabled]:oui-hidden"
10554
10827
  ],
10555
10828
  track: "oui-relative oui-h-[8px] oui-w-full oui-grow oui-overflow-hidden oui-rounded-full",
10556
- trackInner: "oui-absolute oui-left-0 oui-right-0 oui-h-[2px] oui-top-[3px] oui-pointer-events-none oui-bg-base-2",
10829
+ trackInner: "oui-absolute oui-start-0 oui-end-0 oui-h-[2px] oui-top-[3px] oui-pointer-events-none oui-bg-base-2",
10557
10830
  range: "oui-absolute oui-h-[2px] oui-top-[3px] oui-bg-primary data-[disabled]:oui-bg-base-2",
10558
10831
  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%]",
10559
10832
  tips: [
@@ -11119,7 +11392,7 @@ var ListViewInner = (props, ref) => {
11119
11392
  {
11120
11393
  className: cn(
11121
11394
  "oui-space-y-3 oui-h-full oui-w-full",
11122
- emptyDataSouce && "oui-absolute oui-bottom-0 oui-left-0 oui-right-0 oui-top-0",
11395
+ emptyDataSouce && "oui-absolute oui-bottom-0 oui-start-0 oui-end-0 oui-top-0",
11123
11396
  props.contentClassName
11124
11397
  )({ twMerge: true }),
11125
11398
  children: listViewElement
@@ -11354,7 +11627,7 @@ var dropdownMenuVariants = tv$1({
11354
11627
  ],
11355
11628
  label: "oui-px-2 oui-py-1.5 oui-text-sm oui-font-semibold",
11356
11629
  separator: "-oui-mx-1 oui-my-1 oui-h-px oui-bg-muted",
11357
- shortcut: "oui-ml-auto oui-text-xs oui-tracking-widest oui-opacity-60"
11630
+ shortcut: "oui-ms-auto oui-text-xs oui-tracking-widest oui-opacity-60"
11358
11631
  },
11359
11632
  variants: {
11360
11633
  size: {
@@ -11399,8 +11672,8 @@ var dropdownMenuVariants = tv$1({
11399
11672
  },
11400
11673
  inset: {
11401
11674
  true: {
11402
- item: ["oui-pl-8"],
11403
- label: ["oui-pl-8"]
11675
+ item: ["oui-ps-8"],
11676
+ label: ["oui-ps-8"]
11404
11677
  }
11405
11678
  }
11406
11679
  },
@@ -11882,6 +12155,6 @@ var LIGHT_THEME_CSS_VARS = {
11882
12155
  "--oui-spacing-xl": "33.75rem"
11883
12156
  };
11884
12157
 
11885
- export { ActionSheet, AddCircleIcon, AffiliateIcon, AlertDialog, ArrowDownShortIcon, ArrowDownSquareFillIcon, ArrowDownUpIcon, ArrowLeftRightIcon, ArrowLeftRightSquareFill, ArrowLeftShortIcon, ArrowRightShortIcon, ArrowRightUpSquareFillIcon, ArrowUpShortIcon, ArrowUpSquareFillIcon, AssetIcon, Avatar, Badge, BarChartIcon, BattleActiveIcon, BattleIcon, BattleInactiveIcon, BattleSolidActiveIcon, BattleSolidInactiveIcon, BellIcon, Box, Button, Calendar, CalendarIcon, CalendarMinusIcon, Card, CardBase, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CaretDownIcon, CaretLeftIcon, CaretRightIcon, CaretUpIcon, ChainIcon, CheckIcon, CheckSquareEmptyIcon, Checkbox, CheckedCircleFillIcon, CheckedSquareFillIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleOutlinedIcon, CloseCircleFillIcon, CloseIcon, CloseRoundFillIcon, CloseSquareFillIcon, collapse_default as Collapse, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ConfirmDialog, CopyIcon, DARK_THEME_CSS_VARS, DataFilter, DataTable, DatePicker2 as DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DotStatus, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, EVMAvatar, EarnActiveIcon, EarnIcon, EarnInactiveIcon, EditIcon, Either, EmptyDataState, EmptyStateIcon, EsOrderlyIcon, ExclamationFillIcon, EyeCloseIcon, EyeIcon, FeeTierIcon, Flex, GradientText, Grid2 as Grid, HoverCard, HoverCardContent, HoverCardRoot, HoverCardTrigger, Icon, IconButton, InfoCircleIcon, InjectableEmptyDataState, Input2 as Input, InputAdditional, LIGHT_THEME_CSS_VARS, LeaderboardActiveIcon, LeaderboardInactiveIcon, LeftNavVaultsIcon, ListView, LocaleContext, LocaleProvider, Logo, MarketsActiveIcon, MarketsInactiveIcon, Marquee, ModalContext, ModalIdContext, ModalProvider, MultiSortHeader, NewsFillIcon, tailwind_exports as OUITailwind, OrderlyIcon, OrderlyThemeProvider, PaginationItems, PeopleIcon, PerpsIcon, PersonIcon, Picker, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, PopupUnionIcon, PortfolioActiveIcon, PortfolioInactiveIcon, QuestionFillIcon, ReduceIcon, ReferralSolidIcon, RefreshIcon, RwaIcon, ScrollArea, ScrollBar, ScrollIndicator, Select2 as Select, SelectItem, SelectedChoicesFillIcon, ServerFillIcon, SettingFillIcon, SettingIcon, ShareIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleDialog, SimpleDialogFooter, SimpleDropdownMenu, SimpleSheet, Slider, SortingAscIcon, SortingDescIcon, SortingIcon, Spinner, SpotIcon, SquareOutlinedIcon, StarChildChatActiveIcon, StarChildChatInactiveIcon, Statistic, StatisticLabel, SwapHorizIcon, Switch, SymbolBadge, TabPanel, features_exports as TableFeatures, Tabs, TabsBase, TabsContent, TabsList, TabsTrigger, Text2 as Text, TextField, ThrottledButton, Tips, ToastTile, Toaster, TokenIcon, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TraderMobileIcon, TradingActiveIcon, TradingIcon, TradingInactiveIcon, TradingLeftNavIcon, TradingRewardsIcon, TriggerDialog, VaultsIcon, VectorIcon, WalletIcon, WarningIcon, WoofiStakeIcon, boxVariants, buttonVariants, capitalizeFirstLetter, convertValueToPercentage, dotStatusVariants, formatAddress, gradientTextVariants, iconButtonVariants, formatter_exports as inputFormatter, modal, parseNumber, registerSimpleDialog, registerSimpleSheet, scrollAreaVariants, startViewTransition, statisticVariants, textVariants, tv, useLocale, useLongPress, useMediaQuery, useModal, useMultiSort, useObserverElement, useOrderlyTheme, usePagination, useScreen, useThemeAttribute };
12158
+ export { ActionSheet, AddCircleIcon, AffiliateIcon, AlertDialog, ArrowDownShortIcon, ArrowDownSquareFillIcon, ArrowDownUpIcon, ArrowLeftRightIcon, ArrowLeftRightSquareFill, ArrowLeftShortIcon, ArrowRightShortIcon, ArrowRightUpSquareFillIcon, ArrowUpShortIcon, ArrowUpSquareFillIcon, AssetIcon, Avatar, Badge, BarChartIcon, BattleActiveIcon, BattleIcon, BattleInactiveIcon, BattleSolidActiveIcon, BattleSolidInactiveIcon, BellIcon, Box, Button, Calendar, CalendarIcon, CalendarMinusIcon, Card, CardBase, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CaretDownIcon, CaretLeftIcon, CaretRightIcon, CaretUpIcon, ChainIcon, CheckIcon, CheckSquareEmptyIcon, Checkbox, CheckedCircleFillIcon, CheckedSquareFillIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleOutlinedIcon, CloseCircleFillIcon, CloseIcon, CloseRoundFillIcon, CloseSquareFillIcon, collapse_default as Collapse, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ConfirmDialog, CopyIcon, DARK_THEME_CSS_VARS, DataFilter, DataTable, DatePicker2 as DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DotStatus, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, EVMAvatar, EarnActiveIcon, EarnIcon, EarnInactiveIcon, EditIcon, Either, EmptyDataState, EmptyStateIcon, EsOrderlyIcon, ExclamationFillIcon, EyeCloseIcon, EyeIcon, FeeTierIcon, Flex, GradientText, Grid2 as Grid, HoverCard, HoverCardContent, HoverCardRoot, HoverCardTrigger, Icon, IconButton, InfoCircleIcon, InjectableEmptyDataState, Input2 as Input, InputAdditional, LIGHT_THEME_CSS_VARS, LeaderboardActiveIcon, LeaderboardInactiveIcon, LeftNavVaultsIcon, ListView, LocaleContext, LocaleProvider, Logo, MarketsActiveIcon, MarketsInactiveIcon, Marquee, ModalContext, ModalIdContext, ModalProvider, MultiSortHeader, NewsFillIcon, tailwind_exports as OUITailwind, OrderlyIcon, OrderlyThemeProvider, PaginationItems, PeopleIcon, PerpsIcon, PersonIcon, Picker, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, PopupUnionIcon, PortfolioActiveIcon, PortfolioInactiveIcon, QuestionFillIcon, ReduceIcon, ReferralSolidIcon, RefreshIcon, RwaIcon, ScrollArea, ScrollBar, ScrollIndicator, Select2 as Select, SelectItem, SelectedChoicesFillIcon, ServerFillIcon, SettingFillIcon, SettingIcon, ShareIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleDialog, SimpleDialogFooter, SimpleDropdownMenu, SimpleSheet, Slider, SortingAscIcon, SortingDescIcon, SortingIcon, Spinner, SpotIcon, SquareOutlinedIcon, StarChildChatActiveIcon, StarChildChatInactiveIcon, Statistic, StatisticLabel, SwapHorizIcon, Switch, SymbolBadge, TabPanel, features_exports as TableFeatures, Tabs, TabsBase, TabsContent, TabsList, TabsTrigger, Text2 as Text, TextField, ThrottledButton, Tips, ToastTile, Toaster, TokenIcon, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TraderMobileIcon, TradingActiveIcon, TradingIcon, TradingInactiveIcon, TradingLeftNavIcon, TradingRewardsIcon, TriggerDialog, VaultsIcon, VectorIcon, WalletIcon, WarningIcon, WoofiStakeIcon, boxVariants, buttonVariants, capitalizeFirstLetter, convertValueToPercentage, dotStatusVariants, formatAddress, gradientTextVariants, iconButtonVariants, formatter_exports as inputFormatter, modal, parseNumber, registerSimpleDialog, registerSimpleSheet, scrollAreaVariants, startViewTransition, statisticVariants, textVariants, tv, useDocumentDirection, useLocale, useLongPress, useMediaQuery, useModal, useMultiSort, useObserverElement, useOrderlyTheme, usePagination, useScreen, useThemeAttribute };
11886
12159
  //# sourceMappingURL=index.mjs.map
11887
12160
  //# sourceMappingURL=index.mjs.map