@yuno-payments/dashboard-design-system 2.0.2 → 2.0.4-beta.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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * List of icon names that represent directional concepts and should be
3
+ * automatically mirrored in RTL (right-to-left) layouts.
4
+ *
5
+ * These icons point left/right or imply horizontal direction, so they need
6
+ * to be flipped when the UI direction changes from LTR to RTL.
7
+ *
8
+ * @example
9
+ * - ArrowLeft in LTR → points left (back)
10
+ * - ArrowLeft in RTL → should point right (still means "back")
11
+ */
12
+ export declare const DIRECTIONAL_ICONS: Set<string>;
@@ -0,0 +1,38 @@
1
+ const r = /* @__PURE__ */ new Set([
2
+ // Arrows - horizontal direction
3
+ "ArrowLeft",
4
+ "ArrowRight",
5
+ "ArrowCircleLeft",
6
+ "ArrowCircleRight",
7
+ "ArrowCircleUpLeft",
8
+ "ArrowBendUpLeft",
9
+ "ArrowBendUpRight",
10
+ "ArrowElbowDownRight",
11
+ "ArrowUpRight",
12
+ "ArrowSquareIn",
13
+ // Carets - horizontal direction
14
+ "CaretLeft",
15
+ "CaretRight",
16
+ "CaretDoubleLeft",
17
+ "CaretDoubleRight",
18
+ "CaretCircleRight",
19
+ // Actions with implied direction
20
+ "SignOut",
21
+ "Export",
22
+ "PhoneOutgoing",
23
+ // Toggle switches (thumb position implies direction)
24
+ "ToggleLeft",
25
+ "ToggleRight",
26
+ // Trend indicators (arrow direction)
27
+ "TrendUp",
28
+ "TrendDown",
29
+ // Sort indicators
30
+ "SortAscending",
31
+ "SortDescending",
32
+ // Play control (points right in LTR)
33
+ "Play",
34
+ "PlayCircle"
35
+ ]);
36
+ export {
37
+ r as DIRECTIONAL_ICONS
38
+ };
@@ -30,6 +30,12 @@ interface IconProps extends Omit<PhosphorIconProps, "size">, VariantProps<typeof
30
30
  * Additional props to pass to the Tooltip component
31
31
  */
32
32
  tooltipProps?: Partial<TooltipProps>;
33
+ /**
34
+ * Auto-mirror icon in RTL layouts.
35
+ * Defaults to `true` for directional icons (arrows, chevrons, carets, etc.)
36
+ * Set to `false` to disable auto-mirroring for a specific icon.
37
+ */
38
+ autoMirrorRtl?: boolean;
33
39
  }
34
40
  /**
35
41
  * Icon component using Phosphor Icons with size variants and optional tooltip.
@@ -1,10 +1,11 @@
1
- import { j as s } from "../../../_virtual/jsx-runtime.js";
2
- import { forwardRef as p } from "react";
3
- import { cva as u } from "../../../node_modules/class-variance-authority/dist/index.js";
4
- import { cn as x } from "../../../lib/utils.js";
5
- import { IconList as z } from "./icon-list.js";
6
- import { Tooltip as d } from "../tooltip/tooltip.js";
7
- const j = u("inline-flex items-center justify-center shrink-0", {
1
+ import { j as t } from "../../../_virtual/jsx-runtime.js";
2
+ import { forwardRef as d } from "react";
3
+ import { cva as z } from "../../../node_modules/class-variance-authority/dist/index.js";
4
+ import { cn as I } from "../../../lib/utils.js";
5
+ import { IconList as h } from "./icon-list.js";
6
+ import { Tooltip as j } from "../tooltip/tooltip.js";
7
+ import { DIRECTIONAL_ICONS as C } from "./directional-icons.js";
8
+ const N = z("inline-flex items-center justify-center shrink-0", {
8
9
  variants: {
9
10
  size: {
10
11
  xs: "size-3",
@@ -17,34 +18,39 @@ const j = u("inline-flex items-center justify-center shrink-0", {
17
18
  defaultVariants: {
18
19
  size: "md"
19
20
  }
20
- }), g = p(
21
+ }), g = d(
21
22
  ({
22
23
  name: r,
23
- weight: t = "light",
24
+ weight: n = "light",
24
25
  size: e,
25
26
  className: c,
26
27
  color: l,
27
- tooltip: i,
28
+ tooltip: o,
28
29
  tooltipProps: m,
29
- ...a
30
- }, f) => {
30
+ autoMirrorRtl: a,
31
+ ...f
32
+ }, u) => {
31
33
  if (!r)
32
34
  return null;
33
- const o = z?.[r];
34
- if (!o)
35
+ const i = h?.[r];
36
+ if (!i)
35
37
  return console.error("Missing icon", r), null;
36
- const n = /* @__PURE__ */ s.jsx(
37
- o,
38
+ const p = C.has(r), x = a ?? p, s = /* @__PURE__ */ t.jsx(
39
+ i,
38
40
  {
39
- ref: f,
41
+ ref: u,
40
42
  "aria-label": r,
41
- className: x(j({ size: e }), c),
43
+ className: I(
44
+ N({ size: e }),
45
+ x && "rtl:scale-x-[-1]",
46
+ c
47
+ ),
42
48
  color: l || "currentColor",
43
- weight: t,
44
- ...a
49
+ weight: n,
50
+ ...f
45
51
  }
46
52
  );
47
- return i ? /* @__PURE__ */ s.jsx(d, { content: i, ...m, children: n }) : n;
53
+ return o ? /* @__PURE__ */ t.jsx(j, { content: o, ...m, children: s }) : s;
48
54
  }
49
55
  );
50
56
  g.displayName = "Icon";
@@ -1,2 +1,3 @@
1
1
  export { Icon, type IconProps } from './icon';
2
2
  export { IconList, type IconName } from './icon-list';
3
+ export { DIRECTIONAL_ICONS } from './directional-icons';
@@ -1,7 +1,7 @@
1
1
  import { j as r } from "../../../_virtual/jsx-runtime.js";
2
2
  import { RadioGroupItem as d } from "../../../vendor/shadcn/radio-group.js";
3
- import { cn as l } from "../../../lib/utils.js";
4
- import { Label as a } from "../label/label.js";
3
+ import { cn as a } from "../../../lib/utils.js";
4
+ import { Label as l } from "../label/label.js";
5
5
  const o = ({
6
6
  option: e,
7
7
  radioId: s,
@@ -22,23 +22,23 @@ const o = ({
22
22
  ),
23
23
  t ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
24
24
  /* @__PURE__ */ r.jsx(
25
- a,
25
+ l,
26
26
  {
27
27
  htmlFor: s,
28
- className: l(
28
+ className: a(
29
29
  "cursor-pointer",
30
30
  e.disabled && "text-muted-foreground"
31
31
  ),
32
32
  children: e.label
33
33
  }
34
34
  ),
35
- e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground ml-auto", children: e.description })
35
+ e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground ms-auto", children: e.description })
36
36
  ] }) : /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-1.5 flex-1", children: [
37
37
  /* @__PURE__ */ r.jsx(
38
- a,
38
+ l,
39
39
  {
40
40
  htmlFor: s,
41
- className: l(
41
+ className: a(
42
42
  "cursor-pointer",
43
43
  e.disabled && "text-muted-foreground"
44
44
  ),
@@ -222,7 +222,7 @@ export declare function getCellStyles<TData, TValue>(column: Column<TData, TValu
222
222
  maxHeight?: import("csstype").Property.MaxHeight<string | number> | undefined;
223
223
  maxInlineSize?: import("csstype").Property.MaxInlineSize<string | number> | undefined;
224
224
  maxLines?: import("csstype").Property.MaxLines | undefined;
225
- maxWidth?: import("csstype").Property.MaxWidth<string | number> | undefined;
225
+ maxWidth?: string | number | undefined;
226
226
  minBlockSize?: import("csstype").Property.MinBlockSize<string | number> | undefined;
227
227
  minHeight?: import("csstype").Property.MinHeight<string | number> | undefined;
228
228
  minInlineSize?: import("csstype").Property.MinInlineSize<string | number> | undefined;
@@ -1874,11 +1874,11 @@ export declare function getCellStyles<TData, TValue>(column: Column<TData, TValu
1874
1874
  maxHeight?: import("csstype").Property.MaxHeight<string | number> | undefined;
1875
1875
  maxInlineSize?: import("csstype").Property.MaxInlineSize<string | number> | undefined;
1876
1876
  maxLines?: import("csstype").Property.MaxLines | undefined;
1877
- maxWidth?: import("csstype").Property.MaxWidth<string | number> | undefined;
1877
+ maxWidth?: string | number | undefined;
1878
1878
  minBlockSize?: import("csstype").Property.MinBlockSize<string | number> | undefined;
1879
1879
  minHeight?: import("csstype").Property.MinHeight<string | number> | undefined;
1880
1880
  minInlineSize?: import("csstype").Property.MinInlineSize<string | number> | undefined;
1881
- minWidth?: import("csstype").Property.MinWidth<string | number> | undefined;
1881
+ minWidth?: string | number | undefined;
1882
1882
  mixBlendMode?: import("csstype").Property.MixBlendMode | undefined;
1883
1883
  motionDistance?: import("csstype").Property.OffsetDistance<string | number> | undefined;
1884
1884
  motionPath?: import("csstype").Property.OffsetPath | undefined;
@@ -1,38 +1,35 @@
1
1
  import { cn as o } from "../../../../lib/utils.js";
2
- import { getPinnedStyles as p } from "./data-table-utils.js";
3
- import { PINNED_SHADOW_CLASS as l } from "./data-table-constants.js";
4
- function f(t, r, d) {
5
- const s = t.getIsPinned(), e = t.getSize(), i = t.id === "_spacer", a = t.columnDef.enableResizing === !1 && !i;
2
+ import { getPinnedStyles as f } from "./data-table-utils.js";
3
+ import { PINNED_SHADOW_CLASS as p } from "./data-table-constants.js";
4
+ function l(t, i, e) {
5
+ return t ? { width: "auto", minWidth: 0 } : i ? {
6
+ width: `${e}px`,
7
+ minWidth: `${e}px`,
8
+ maxWidth: `${e}px`
9
+ } : { width: `${e}px` };
10
+ }
11
+ function m(t, i, e) {
12
+ const s = t.getIsPinned(), d = t.getSize(), n = t.id === "_spacer", a = t.columnDef.enableResizing === !1 && !n;
6
13
  return {
7
14
  style: {
8
- // Spacer column should not have a fixed width, let it absorb remaining space
9
- ...i ? {
10
- width: "auto",
11
- minWidth: 0
12
- } : a ? {
13
- width: `${e}px`,
14
- minWidth: `${e}px`,
15
- maxWidth: `${e}px`
16
- } : {
17
- width: `${e}px`
18
- },
19
- ...p(
15
+ ...l(n, a, d),
16
+ ...f(
20
17
  s,
21
- (n) => t.getStart(n),
22
- (n) => t.getAfter(n),
23
- d
18
+ (r) => t.getStart(r),
19
+ (r) => t.getAfter(r),
20
+ e
24
21
  )
25
22
  },
26
23
  className: o(
27
- r,
28
- s && l,
24
+ i,
25
+ s && p,
29
26
  // Add a class to identify fixed-size columns
30
27
  a && "data-table-fixed-column",
31
28
  // Hide spacer column visually
32
- i && "data-table-spacer"
29
+ n && "data-table-spacer"
33
30
  )
34
31
  };
35
32
  }
36
33
  export {
37
- f as getCellStyles
34
+ m as getCellStyles
38
35
  };
@@ -1,20 +1,23 @@
1
- function f(e) {
1
+ function r(e) {
2
2
  return typeof e == "object" && e !== null && "title" in e && typeof e.title == "string";
3
3
  }
4
- function n(e) {
4
+ function f(e) {
5
5
  return typeof e.columnDef.header == "string" ? e.columnDef.header : e.columnDef.header && typeof e.columnDef.header == "object" && "title" in e.columnDef.header ? e.columnDef.header.title : e.id;
6
6
  }
7
- function o(e, t, i, r) {
7
+ function o(e, t, i, n) {
8
8
  return e ? {
9
9
  position: "sticky",
10
- left: e === "left" ? `${t("left")}px` : void 0,
11
- right: e === "right" ? `${i("right")}px` : void 0,
10
+ // Use logical properties so pinned columns work in both LTR and RTL.
11
+ // "left"-pinned columns stick to the inline-start edge,
12
+ // "right"-pinned columns (e.g. actions) stick to the inline-end edge.
13
+ insetInlineStart: e === "left" ? `${t("left")}px` : void 0,
14
+ insetInlineEnd: e === "right" ? `${i("right")}px` : void 0,
12
15
  zIndex: 10,
13
- backgroundColor: r
16
+ backgroundColor: n
14
17
  } : {};
15
18
  }
16
19
  export {
17
- n as getColumnDisplayName,
20
+ f as getColumnDisplayName,
18
21
  o as getPinnedStyles,
19
- f as isHeaderConfig
22
+ r as isHeaderConfig
20
23
  };