@juspay/blend-design-system 0.0.37-beta.6 → 0.0.37-beta.7
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/components/DataTable/TableBody/types.d.ts +1 -0
- package/dist/components/DataTable/TableCell/types.d.ts +1 -0
- package/dist/components/DataTable/columnTypes.d.ts +5 -3
- package/dist/components/DataTable/dataTable.tokens.d.ts +4 -0
- package/dist/components/DataTable/types.d.ts +20 -2
- package/dist/components/DataTable/utils.d.ts +4 -3
- package/dist/components/Skeleton/hooks/useSkeletonBase.d.ts +7 -11
- package/dist/components/StatCardV2/StatCardV2.d.ts +1 -0
- package/dist/components/StatCardV2/StatCardV2NoData.d.ts +2 -2
- package/dist/components/StatCardV2/statcardV2.types.d.ts +1 -0
- package/dist/components/TabsV2/tabsV2.tokens.types.d.ts +3 -0
- package/dist/global-utils/GlobalUtils.d.ts +2 -1
- package/dist/main.js +24982 -24910
- package/dist/{node-CJ_Tft0g.js → node-C_DmV86X.js} +49 -25
- package/dist/node.js +1 -1
- package/dist/tokens.js +1 -1
- package/lib/components/Card/Card.tsx +1 -0
- package/lib/components/Charts/ChartHeader.tsx +4 -1
- package/lib/components/CodeBlock/CodeBlock.tsx +8 -4
- package/lib/components/DataTable/DataTable.tsx +2 -0
- package/lib/components/DataTable/TableBody/index.tsx +2 -0
- package/lib/components/DataTable/TableBody/types.ts +1 -0
- package/lib/components/DataTable/TableCell/index.tsx +45 -20
- package/lib/components/DataTable/TableCell/types.ts +1 -0
- package/lib/components/DataTable/columnTypes.ts +5 -3
- package/lib/components/DataTable/dataTable.tokens.ts +15 -0
- package/lib/components/DataTable/types.ts +33 -2
- package/lib/components/DataTable/utils.ts +91 -5
- package/lib/components/Skeleton/hooks/useSkeletonBase.ts +11 -1
- package/lib/components/StatCard/StatCard.tsx +10 -2
- package/lib/components/StatCardV2/StatCardV2.tsx +8 -6
- package/lib/components/StatCardV2/StatCardV2NoData.tsx +8 -6
- package/lib/components/StatCardV2/statcardV2.types.ts +1 -0
- package/lib/components/TabsV2/TabsV2List.tsx +5 -1
- package/lib/components/TabsV2/tabsV2.dark.tokens.ts +12 -0
- package/lib/components/TabsV2/tabsV2.light.tokens.ts +12 -0
- package/lib/components/TabsV2/tabsV2.tokens.types.ts +3 -0
- package/lib/global-utils/GlobalUtils.ts +10 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E = {
|
|
2
2
|
xs: "0px 1px 1px 0px rgba(5, 5, 6, 0.04)",
|
|
3
3
|
sm: "0px 2px 3px 0px rgba(5, 5, 6, 0.05)",
|
|
4
4
|
md: "0px 2px 8px 1px rgba(5, 5, 6, 0.07)",
|
|
@@ -265,7 +265,7 @@ const L = {
|
|
|
265
265
|
200: "200px",
|
|
266
266
|
350: "350px",
|
|
267
267
|
auto: "auto"
|
|
268
|
-
},
|
|
268
|
+
}, C = {
|
|
269
269
|
gray: {
|
|
270
270
|
0: "#FFFFFF",
|
|
271
271
|
25: "#FCFCFD",
|
|
@@ -361,7 +361,7 @@ const L = {
|
|
|
361
361
|
900: "#733E0A",
|
|
362
362
|
950: "#432004"
|
|
363
363
|
}
|
|
364
|
-
},
|
|
364
|
+
}, a = {
|
|
365
365
|
0: 0,
|
|
366
366
|
10: 10,
|
|
367
367
|
99: 99,
|
|
@@ -372,13 +372,13 @@ const L = {
|
|
|
372
372
|
1100: 1100,
|
|
373
373
|
1200: 1200
|
|
374
374
|
}, Ur = {
|
|
375
|
-
shadows:
|
|
375
|
+
shadows: E,
|
|
376
376
|
border: N,
|
|
377
377
|
font: H,
|
|
378
378
|
opacity: D,
|
|
379
379
|
unit: I,
|
|
380
|
-
colors:
|
|
381
|
-
zIndex:
|
|
380
|
+
colors: C,
|
|
381
|
+
zIndex: a
|
|
382
382
|
};
|
|
383
383
|
var h = /* @__PURE__ */ ((r) => (r.LIGHT = "light", r.DARK = "dark", r))(h || {});
|
|
384
384
|
const Xr = (r) => ({
|
|
@@ -2240,7 +2240,7 @@ const Xr = (r) => ({
|
|
|
2240
2240
|
}
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
|
-
}),
|
|
2243
|
+
}), G = (r) => ({
|
|
2244
2244
|
sm: {
|
|
2245
2245
|
gap: r.unit[10],
|
|
2246
2246
|
// Pattern: backgroundColor.[variant].[subType].[state]
|
|
@@ -3639,7 +3639,7 @@ const Xr = (r) => ({
|
|
|
3639
3639
|
}
|
|
3640
3640
|
}
|
|
3641
3641
|
}
|
|
3642
|
-
}), Vr = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ?
|
|
3642
|
+
}), Vr = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? G(r) : A(r), W = (r) => ({
|
|
3643
3643
|
sm: {
|
|
3644
3644
|
gap: r.unit[6],
|
|
3645
3645
|
backgroundColor: {
|
|
@@ -4309,7 +4309,7 @@ const Xr = (r) => ({
|
|
|
4309
4309
|
}
|
|
4310
4310
|
}
|
|
4311
4311
|
}
|
|
4312
|
-
}), qr = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ?
|
|
4312
|
+
}), qr = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? W(r) : B(r);
|
|
4313
4313
|
var M = /* @__PURE__ */ ((r) => (r.START = "start", r.CENTER = "center", r.END = "end", r))(M || {}), F = /* @__PURE__ */ ((r) => (r.TOP = "top", r.LEFT = "left", r.RIGHT = "right", r.BOTTOM = "bottom", r))(F || {}), m = /* @__PURE__ */ ((r) => (r.DEFAULT = "default", r.ACTION = "action", r))(m || {}), x = /* @__PURE__ */ ((r) => (r.PRIMARY = "primary", r.DANGER = "danger", r))(x || {});
|
|
4314
4314
|
const U = (r) => ({
|
|
4315
4315
|
sm: {
|
|
@@ -11649,7 +11649,7 @@ const $r = (r) => ({
|
|
|
11649
11649
|
}
|
|
11650
11650
|
}
|
|
11651
11651
|
}
|
|
11652
|
-
}), l0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? Rr(r) : Or(r),
|
|
11652
|
+
}), l0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? Rr(r) : Or(r), Lr = (r) => ({
|
|
11653
11653
|
sm: {
|
|
11654
11654
|
gap: r.unit[8],
|
|
11655
11655
|
group: {
|
|
@@ -11918,7 +11918,7 @@ const $r = (r) => ({
|
|
|
11918
11918
|
}
|
|
11919
11919
|
}
|
|
11920
11920
|
}
|
|
11921
|
-
}),
|
|
11921
|
+
}), Er = (r) => ({
|
|
11922
11922
|
sm: {
|
|
11923
11923
|
gap: r.unit[8],
|
|
11924
11924
|
group: {
|
|
@@ -12187,7 +12187,7 @@ const $r = (r) => ({
|
|
|
12187
12187
|
}
|
|
12188
12188
|
}
|
|
12189
12189
|
}
|
|
12190
|
-
}), s0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ?
|
|
12190
|
+
}), s0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? Er(r) : Lr(r), Nr = (r) => ({
|
|
12191
12191
|
sm: {
|
|
12192
12192
|
// background (size-independent)
|
|
12193
12193
|
background: r.colors.gray[0],
|
|
@@ -12738,6 +12738,12 @@ const Dr = (r) => ({
|
|
|
12738
12738
|
}
|
|
12739
12739
|
}
|
|
12740
12740
|
},
|
|
12741
|
+
borderBottom: {
|
|
12742
|
+
[l.UNDERLINE]: `${r.border.width[1]} solid ${r.colors.gray[200]}`,
|
|
12743
|
+
[l.BOXED]: "none",
|
|
12744
|
+
[l.FLOATING]: "none",
|
|
12745
|
+
[l.PILLS]: "none"
|
|
12746
|
+
},
|
|
12741
12747
|
activeIndicator: {
|
|
12742
12748
|
height: r.border.width[2],
|
|
12743
12749
|
color: r.colors.gray[700],
|
|
@@ -13051,6 +13057,12 @@ const Dr = (r) => ({
|
|
|
13051
13057
|
}
|
|
13052
13058
|
}
|
|
13053
13059
|
},
|
|
13060
|
+
borderBottom: {
|
|
13061
|
+
[l.UNDERLINE]: `${r.border.width[1]} solid ${r.colors.gray[200]}`,
|
|
13062
|
+
[l.BOXED]: "none",
|
|
13063
|
+
[l.FLOATING]: "none",
|
|
13064
|
+
[l.PILLS]: "none"
|
|
13065
|
+
},
|
|
13054
13066
|
activeIndicator: {
|
|
13055
13067
|
height: r.border.width[2],
|
|
13056
13068
|
color: r.colors.gray[700],
|
|
@@ -13365,6 +13377,12 @@ const Dr = (r) => ({
|
|
|
13365
13377
|
}
|
|
13366
13378
|
}
|
|
13367
13379
|
},
|
|
13380
|
+
borderBottom: {
|
|
13381
|
+
[l.UNDERLINE]: `${r.border.width[1]} solid ${r.colors.gray[700]}`,
|
|
13382
|
+
[l.BOXED]: "none",
|
|
13383
|
+
[l.FLOATING]: "none",
|
|
13384
|
+
[l.PILLS]: "none"
|
|
13385
|
+
},
|
|
13368
13386
|
activeIndicator: {
|
|
13369
13387
|
height: r.border.width[2],
|
|
13370
13388
|
color: r.colors.gray[200],
|
|
@@ -13678,6 +13696,12 @@ const Dr = (r) => ({
|
|
|
13678
13696
|
}
|
|
13679
13697
|
}
|
|
13680
13698
|
},
|
|
13699
|
+
borderBottom: {
|
|
13700
|
+
[l.UNDERLINE]: `${r.border.width[1]} solid ${r.colors.gray[700]}`,
|
|
13701
|
+
[l.BOXED]: "none",
|
|
13702
|
+
[l.FLOATING]: "none",
|
|
13703
|
+
[l.PILLS]: "none"
|
|
13704
|
+
},
|
|
13681
13705
|
activeIndicator: {
|
|
13682
13706
|
height: r.border.width[2],
|
|
13683
13707
|
color: r.colors.gray[200],
|
|
@@ -13881,10 +13905,10 @@ const Dr = (r) => ({
|
|
|
13881
13905
|
}
|
|
13882
13906
|
}
|
|
13883
13907
|
}), c0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? Ir(r) : Dr(r);
|
|
13884
|
-
var e = /* @__PURE__ */ ((r) => (r.ADDED = "added", r.REMOVED = "removed", r.UNCHANGED = "unchanged", r))(e || {}),
|
|
13885
|
-
const
|
|
13908
|
+
var e = /* @__PURE__ */ ((r) => (r.ADDED = "added", r.REMOVED = "removed", r.UNCHANGED = "unchanged", r))(e || {}), Cr = /* @__PURE__ */ ((r) => (r.DEFAULT = "default", r.NO_GUTTER = "no-gutter", r.DIFF = "diff", r))(Cr || {}), L = /* @__PURE__ */ ((r) => (r.LIGHT = "light", r.DARK = "dark", r))(L || {});
|
|
13909
|
+
const ar = (r) => ({
|
|
13886
13910
|
sm: {
|
|
13887
|
-
theme:
|
|
13911
|
+
theme: L.DARK,
|
|
13888
13912
|
backgroundColor: r.colors.gray[25],
|
|
13889
13913
|
border: `1px solid ${r.colors.gray[200]}`,
|
|
13890
13914
|
borderRadius: r.border.radius[8],
|
|
@@ -13961,7 +13985,7 @@ const Cr = (r) => ({
|
|
|
13961
13985
|
}
|
|
13962
13986
|
},
|
|
13963
13987
|
lg: {
|
|
13964
|
-
theme:
|
|
13988
|
+
theme: L.DARK,
|
|
13965
13989
|
backgroundColor: r.colors.gray[25],
|
|
13966
13990
|
border: `1px solid ${r.colors.gray[200]}`,
|
|
13967
13991
|
borderRadius: r.border.radius[8],
|
|
@@ -14043,7 +14067,7 @@ const Cr = (r) => ({
|
|
|
14043
14067
|
border: `1px solid ${r.colors.gray[200]}`,
|
|
14044
14068
|
borderRadius: r.border.radius[8],
|
|
14045
14069
|
boxShadow: "0px 2px 3px 0px rgba(5, 5, 6, 0.05)",
|
|
14046
|
-
theme:
|
|
14070
|
+
theme: L.LIGHT,
|
|
14047
14071
|
header: {
|
|
14048
14072
|
backgroundColor: r.colors.gray[50],
|
|
14049
14073
|
borderBottom: `1px solid ${r.colors.gray[200]}`,
|
|
@@ -14120,7 +14144,7 @@ const Cr = (r) => ({
|
|
|
14120
14144
|
border: `1px solid ${r.colors.gray[200]}`,
|
|
14121
14145
|
borderRadius: r.border.radius[8],
|
|
14122
14146
|
boxShadow: "0px 2px 3px 0px rgba(5, 5, 6, 0.05)",
|
|
14123
|
-
theme:
|
|
14147
|
+
theme: L.LIGHT,
|
|
14124
14148
|
header: {
|
|
14125
14149
|
backgroundColor: r.colors.gray[50],
|
|
14126
14150
|
borderBottom: `1px solid ${r.colors.gray[200]}`,
|
|
@@ -14192,9 +14216,9 @@ const Cr = (r) => ({
|
|
|
14192
14216
|
}
|
|
14193
14217
|
}
|
|
14194
14218
|
}
|
|
14195
|
-
}), t0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ?
|
|
14196
|
-
var b = /* @__PURE__ */ ((r) => (r.SM = "sm", r.MD = "md", r.LG = "lg", r))(b || {}),
|
|
14197
|
-
const
|
|
14219
|
+
}), t0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? ar(r) : Ar(r);
|
|
14220
|
+
var b = /* @__PURE__ */ ((r) => (r.SM = "sm", r.MD = "md", r.LG = "lg", r))(b || {}), Gr = /* @__PURE__ */ ((r) => (r.LINEAR = "linear", r.CIRCULAR = "circular", r))(Gr || {}), i = /* @__PURE__ */ ((r) => (r.SOLID = "solid", r.SEGMENTED = "segmented", r))(i || {});
|
|
14221
|
+
const Wr = (r) => ({
|
|
14198
14222
|
sm: {
|
|
14199
14223
|
linear: {
|
|
14200
14224
|
height: {
|
|
@@ -14576,7 +14600,7 @@ const Gr = (r) => ({
|
|
|
14576
14600
|
},
|
|
14577
14601
|
transition: "width 0.3s ease-in-out"
|
|
14578
14602
|
}
|
|
14579
|
-
}), i0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ?
|
|
14603
|
+
}), i0 = (r, c = h.LIGHT) => c === h.DARK || c === "dark" ? Wr(r) : Br(r), Mr = (r) => ({
|
|
14580
14604
|
sm: {
|
|
14581
14605
|
gap: r.unit[0],
|
|
14582
14606
|
item: {
|
|
@@ -14688,7 +14712,7 @@ export {
|
|
|
14688
14712
|
rr as I,
|
|
14689
14713
|
s as J,
|
|
14690
14714
|
z as K,
|
|
14691
|
-
|
|
14715
|
+
Gr as L,
|
|
14692
14716
|
m as M,
|
|
14693
14717
|
b as N,
|
|
14694
14718
|
u as O,
|
|
@@ -14702,8 +14726,8 @@ export {
|
|
|
14702
14726
|
l as W,
|
|
14703
14727
|
t as X,
|
|
14704
14728
|
R as Y,
|
|
14705
|
-
|
|
14706
|
-
|
|
14729
|
+
Cr as Z,
|
|
14730
|
+
L as _,
|
|
14707
14731
|
_r as a,
|
|
14708
14732
|
v as a0,
|
|
14709
14733
|
O as a1,
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as a, T as o, y as t, x as T, w as n, v as g, z as k, u as V, t as r, s as i, r as l, q as c, g as b, p as d, o as u, n as S, m as p, a as h, l as m, j as v, i as x, k as A, h as C, f as M, e as B, d as E, c as N, b as P } from "./node-
|
|
1
|
+
import { F as a, T as o, y as t, x as T, w as n, v as g, z as k, u as V, t as r, s as i, r as l, q as c, g as b, p as d, o as u, n as S, m as p, a as h, l as m, j as v, i as x, k as A, h as C, f as M, e as B, d as E, c as N, b as P } from "./node-C_DmV86X.js";
|
|
2
2
|
export {
|
|
3
3
|
a as FOUNDATION_THEME,
|
|
4
4
|
o as Theme,
|
package/dist/tokens.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as u, T as d, g as k, a as E, b as V, c as g, d as v, e as p, f as S, h, i as R, j as A, k as y, l as C, m as N, n as I, o as P, p as m, q as _, r as B, s as L, t as w, u as M, v as j, w as U, x as D, y as G, z as H } from "./node-
|
|
1
|
+
import { F as u, T as d, g as k, a as E, b as V, c as g, d as v, e as p, f as S, h, i as R, j as A, k as y, l as C, m as N, n as I, o as P, p as m, q as _, r as B, s as L, t as w, u as M, v as j, w as U, x as D, y as G, z as H } from "./node-C_DmV86X.js";
|
|
2
2
|
import { BRANCH_COLLECTION as ie, BRANCH_ID_PATTERN as ae, PRESETS as ce, PRESET_BLEND_DEFAULT as fe, PRESET_GREEN as le, PRESET_JUSPAY as Te, PRESET_ORANGE as ue, PRESET_PURPLE as de, RADIUS_PRESETS as Oe, SNAPSHOT_SUBCOLLECTION as ke, STORAGE_KEYS as Ee, TEAM_ROLE_PERMISSIONS as Ve, VERSION_PATTERN as ge, VERSION_SUBCOLLECTION as ve, analyzeContrast as pe, canUserPerformAction as Se, diffBrandConfigs as he, extractOverridePaths as Re, generateBranchId as Ae, generateColorScale as ye, getContrastRatio as Ce, getContrastRatioHex as Ne, getDefaultOnboardingState as Ie, getDefaultPreferences as Pe, getPreset as me, hexToRgb as _e, incrementVersion as Be, isValidHexColor as Le, listPresets as we, meetsWCAG as Me, parseBranchId as je, relativeLuminance as Ue, resolveWithInheritance as De, snapshotsPath as Ge, suggestForeground as He, validateAgainstLocks as xe, validateBranchId as Ke, validateBrandConfig as Fe, validatePaletteContrast as Je, validateVersion as $e, versionsPath as Ye } from "./tokens-server.js";
|
|
3
3
|
function O(e) {
|
|
4
4
|
const o = typeof structuredClone == "function" ? structuredClone(u) : JSON.parse(JSON.stringify(u));
|
|
@@ -108,6 +108,7 @@ const Card = forwardRef<HTMLDivElement, CardProps>(
|
|
|
108
108
|
borderRadius={cardToken.borderRadius}
|
|
109
109
|
backgroundColor={cardToken.backgroundColor}
|
|
110
110
|
boxShadow={cardToken.boxShadow}
|
|
111
|
+
overflow="hidden"
|
|
111
112
|
display="flex"
|
|
112
113
|
flexDirection="column"
|
|
113
114
|
onMouseEnter={handleMouseEnter}
|
|
@@ -55,8 +55,11 @@ const ChartHeader: React.FC<ChartHeaderProps> = ({
|
|
|
55
55
|
}
|
|
56
56
|
role="group"
|
|
57
57
|
aria-label="Chart header"
|
|
58
|
+
width="100%"
|
|
58
59
|
>
|
|
59
|
-
<Block data-element="chart-header-slot">
|
|
60
|
+
<Block data-element="chart-header-slot" width="100%" minWidth="0">
|
|
61
|
+
{chartHeaderSlot}
|
|
62
|
+
</Block>
|
|
60
63
|
<Block
|
|
61
64
|
display="flex"
|
|
62
65
|
alignItems="center"
|
|
@@ -265,7 +265,7 @@ const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(
|
|
|
265
265
|
)}
|
|
266
266
|
</Block>
|
|
267
267
|
|
|
268
|
-
{showCopyButton && (
|
|
268
|
+
{showCopyButton && !isDiffMode && (
|
|
269
269
|
<Button
|
|
270
270
|
data-element="copy-button"
|
|
271
271
|
type="button"
|
|
@@ -301,14 +301,18 @@ const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(
|
|
|
301
301
|
backgroundColor={tokens.body.backgroundColor}
|
|
302
302
|
overflow="auto"
|
|
303
303
|
position={
|
|
304
|
-
!showHeader && showCopyButton
|
|
304
|
+
!showHeader && showCopyButton && !isDiffMode
|
|
305
|
+
? 'relative'
|
|
306
|
+
: undefined
|
|
305
307
|
}
|
|
306
308
|
className={
|
|
307
|
-
!showHeader && showCopyButton
|
|
309
|
+
!showHeader && showCopyButton && !isDiffMode
|
|
310
|
+
? 'code-body'
|
|
311
|
+
: undefined
|
|
308
312
|
}
|
|
309
313
|
style={{ maxHeight: maxHeight || 'none' }}
|
|
310
314
|
>
|
|
311
|
-
{!showHeader && showCopyButton && (
|
|
315
|
+
{!showHeader && showCopyButton && !isDiffMode && (
|
|
312
316
|
<CopyOverlay>
|
|
313
317
|
<Button
|
|
314
318
|
data-element="copy-button"
|
|
@@ -159,6 +159,7 @@ const DataTable = forwardRef(
|
|
|
159
159
|
mobileColumnsToShow,
|
|
160
160
|
enablePivotTable = false,
|
|
161
161
|
pivotTableConfig,
|
|
162
|
+
dateLabel,
|
|
162
163
|
...rest
|
|
163
164
|
}: DataTableProps<T>,
|
|
164
165
|
ref: React.Ref<HTMLDivElement>
|
|
@@ -1975,6 +1976,7 @@ const DataTable = forwardRef(
|
|
|
1975
1976
|
>
|
|
1976
1977
|
| undefined
|
|
1977
1978
|
}
|
|
1979
|
+
dateLabel={dateLabel}
|
|
1978
1980
|
isLoading={
|
|
1979
1981
|
isLoading ||
|
|
1980
1982
|
(serverSidePagination &&
|
|
@@ -564,6 +564,7 @@ const TableBody = forwardRef<
|
|
|
564
564
|
getColumnWidth,
|
|
565
565
|
getRowStyle,
|
|
566
566
|
getDisplayValue,
|
|
567
|
+
dateLabel,
|
|
567
568
|
isLoading = false,
|
|
568
569
|
showSkeleton = false,
|
|
569
570
|
skeletonVariant = 'pulse',
|
|
@@ -1289,6 +1290,7 @@ const TableBody = forwardRef<
|
|
|
1289
1290
|
getDisplayValue={
|
|
1290
1291
|
getDisplayValue
|
|
1291
1292
|
}
|
|
1293
|
+
dateLabel={dateLabel}
|
|
1292
1294
|
/>
|
|
1293
1295
|
)
|
|
1294
1296
|
}
|
|
@@ -50,6 +50,7 @@ export type TableBodyProps<T extends Record<string, unknown>> = {
|
|
|
50
50
|
) => React.CSSProperties
|
|
51
51
|
getRowStyle?: (row: T, index: number) => React.CSSProperties
|
|
52
52
|
getDisplayValue?: (value: unknown, column: ColumnDefinition<T>) => unknown
|
|
53
|
+
dateLabel?: string
|
|
53
54
|
isLoading?: boolean
|
|
54
55
|
showSkeleton?: boolean
|
|
55
56
|
skeletonVariant?: SkeletonVariant
|
|
@@ -11,7 +11,12 @@ import { TableTokenType } from '../dataTable.tokens'
|
|
|
11
11
|
import Block from '../../Primitives/Block/Block'
|
|
12
12
|
import PrimitiveInput from '../../Primitives/PrimitiveInput/PrimitiveInput'
|
|
13
13
|
import { FOUNDATION_THEME } from '../../../tokens'
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ColumnType,
|
|
16
|
+
DropdownColumnProps,
|
|
17
|
+
DateColumnProps,
|
|
18
|
+
DateFormat,
|
|
19
|
+
} from '../types'
|
|
15
20
|
import SingleSelect from '../../SingleSelect/SingleSelect'
|
|
16
21
|
import { SelectMenuVariant } from '../../Select'
|
|
17
22
|
import { SelectMenuGroupType } from '../../Select/types'
|
|
@@ -19,7 +24,7 @@ import { useResponsiveTokens } from '../../../hooks/useResponsiveTokens'
|
|
|
19
24
|
import { useResizeObserver } from '../../../hooks/useResizeObserver'
|
|
20
25
|
import Tooltip from '../../Tooltip/Tooltip'
|
|
21
26
|
import { TooltipSize } from '../../Tooltip/types'
|
|
22
|
-
import { parseDateLike } from '../utils'
|
|
27
|
+
import { parseDateLike, formatDateString } from '../utils'
|
|
23
28
|
|
|
24
29
|
const StyledTableCell = styled.td<{
|
|
25
30
|
width?: React.CSSProperties
|
|
@@ -79,9 +84,13 @@ const isEmptyValue = (value: unknown, columnType?: ColumnType): boolean => {
|
|
|
79
84
|
const TruncatedTextWithTooltip = ({
|
|
80
85
|
text,
|
|
81
86
|
style = {},
|
|
87
|
+
suffix,
|
|
88
|
+
tableToken,
|
|
82
89
|
}: {
|
|
83
90
|
text: string
|
|
84
91
|
style?: React.CSSProperties
|
|
92
|
+
suffix?: string
|
|
93
|
+
tableToken?: TableTokenType
|
|
85
94
|
}) => {
|
|
86
95
|
const textRef = useRef<HTMLSpanElement>(null)
|
|
87
96
|
const [isTruncated, setIsTruncated] = useState(false)
|
|
@@ -125,16 +134,32 @@ const TruncatedTextWithTooltip = ({
|
|
|
125
134
|
<span
|
|
126
135
|
ref={textRef}
|
|
127
136
|
style={{
|
|
128
|
-
display: '
|
|
137
|
+
display: 'inline-flex',
|
|
138
|
+
alignItems: 'baseline',
|
|
129
139
|
width: '100%',
|
|
130
140
|
minWidth: 0,
|
|
131
141
|
overflow: 'hidden',
|
|
132
142
|
textOverflow: 'ellipsis',
|
|
133
143
|
whiteSpace: 'nowrap',
|
|
144
|
+
gap: '3px',
|
|
134
145
|
...style,
|
|
135
146
|
}}
|
|
136
147
|
>
|
|
137
148
|
{text}
|
|
149
|
+
{suffix != null && (
|
|
150
|
+
<span
|
|
151
|
+
style={{
|
|
152
|
+
fontSize:
|
|
153
|
+
tableToken?.dataTable.table.body.cell.dateLabel
|
|
154
|
+
.fontSize,
|
|
155
|
+
color: tableToken?.dataTable.table.body.cell.dateLabel
|
|
156
|
+
.color,
|
|
157
|
+
whiteSpace: 'nowrap',
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
{suffix}
|
|
161
|
+
</span>
|
|
162
|
+
)}
|
|
138
163
|
</span>
|
|
139
164
|
)
|
|
140
165
|
|
|
@@ -177,6 +202,7 @@ const TableCell = forwardRef<
|
|
|
177
202
|
hasCustomBackground,
|
|
178
203
|
onFieldChange,
|
|
179
204
|
getDisplayValue,
|
|
205
|
+
dateLabel,
|
|
180
206
|
'data-row-index': dataRowIndex,
|
|
181
207
|
'data-col-index': dataColIndex,
|
|
182
208
|
tabIndex: cellTabIndex,
|
|
@@ -455,23 +481,22 @@ const TableCell = forwardRef<
|
|
|
455
481
|
const date = parseDateLike(dateData.date)
|
|
456
482
|
const showTime = dateData.showTime || false
|
|
457
483
|
|
|
458
|
-
|
|
459
|
-
|
|
484
|
+
// Format string precedence: cell-level `DateColumnProps.format`
|
|
485
|
+
// beats column-level `dateFormat`. Falls back to a sensible
|
|
486
|
+
// default based on whether time should be shown.
|
|
487
|
+
const formatStr =
|
|
488
|
+
dateData.format ||
|
|
489
|
+
(column as { dateFormat?: DateFormat }).dateFormat ||
|
|
490
|
+
(showTime ? 'DD MMM YYYY, hh:mm A' : 'DD MMM YYYY')
|
|
460
491
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
492
|
+
const dateLabelStr =
|
|
493
|
+
dateData.dateLabel ||
|
|
494
|
+
(column as { dateLabel?: string }).dateLabel ||
|
|
495
|
+
dateLabel
|
|
466
496
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
return new Intl.DateTimeFormat('en-US', options).format(
|
|
473
|
-
date
|
|
474
|
-
)
|
|
497
|
+
const formatDate = (date: Date): string => {
|
|
498
|
+
if (isNaN(date.getTime())) return '-'
|
|
499
|
+
return formatDateString(date, formatStr)
|
|
475
500
|
}
|
|
476
501
|
|
|
477
502
|
return (
|
|
@@ -485,10 +510,10 @@ const TableCell = forwardRef<
|
|
|
485
510
|
<TruncatedTextWithTooltip
|
|
486
511
|
text={date ? formatDate(date) : '-'}
|
|
487
512
|
style={{
|
|
488
|
-
fontSize:
|
|
489
|
-
FOUNDATION_THEME.font.size.body.sm.fontSize,
|
|
490
513
|
color: FOUNDATION_THEME.colors.gray[700],
|
|
491
514
|
}}
|
|
515
|
+
suffix={dateLabelStr}
|
|
516
|
+
tableToken={tableToken}
|
|
492
517
|
/>
|
|
493
518
|
</Block>
|
|
494
519
|
)
|
|
@@ -15,6 +15,7 @@ export type TableCellProps<T extends Record<string, unknown>> = {
|
|
|
15
15
|
hasCustomBackground?: boolean
|
|
16
16
|
onFieldChange: (value: unknown) => void
|
|
17
17
|
getDisplayValue?: (value: unknown, column: ColumnDefinition<T>) => unknown
|
|
18
|
+
dateLabel?: string
|
|
18
19
|
'data-row-index'?: number
|
|
19
20
|
'data-col-index'?: number
|
|
20
21
|
tabIndex?: number
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilterType, ColumnType } from './types'
|
|
1
|
+
import { FilterType, ColumnType, DateFormat } from './types'
|
|
2
2
|
|
|
3
3
|
export type ColumnFilterOption = {
|
|
4
4
|
id: string
|
|
@@ -45,13 +45,15 @@ export type MultiSelectData = {
|
|
|
45
45
|
|
|
46
46
|
export type DateData = {
|
|
47
47
|
date: Date | string
|
|
48
|
-
format?:
|
|
48
|
+
format?: DateFormat
|
|
49
|
+
dateLabel?: string
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export type DateRangeData = {
|
|
52
53
|
startDate: Date | string
|
|
53
54
|
endDate: Date | string
|
|
54
|
-
format?:
|
|
55
|
+
format?: DateFormat
|
|
56
|
+
dateLabel?: string
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export type ColumnDataTypeMap = {
|
|
@@ -198,6 +198,11 @@ export type TableTokenType = BasicCSSProps & {
|
|
|
198
198
|
color: CSSObject['color']
|
|
199
199
|
fontSize: CSSObject['fontSize']
|
|
200
200
|
borderTop: CSSObject['borderTop']
|
|
201
|
+
|
|
202
|
+
dateLabel: {
|
|
203
|
+
fontSize: CSSObject['fontSize']
|
|
204
|
+
color: CSSObject['color']
|
|
205
|
+
}
|
|
201
206
|
expandable: {
|
|
202
207
|
padding: CSSObject['padding']
|
|
203
208
|
borderTop: CSSObject['borderTop']
|
|
@@ -467,6 +472,11 @@ export const getTableToken = (
|
|
|
467
472
|
fontSize:
|
|
468
473
|
foundationToken.font.size.body.md.fontSize,
|
|
469
474
|
borderTop: `1px solid ${foundationToken.colors.gray[150]}`,
|
|
475
|
+
dateLabel: {
|
|
476
|
+
fontSize:
|
|
477
|
+
foundationToken.font.size.body.xs.fontSize,
|
|
478
|
+
color: foundationToken.colors.gray[400],
|
|
479
|
+
},
|
|
470
480
|
expandable: {
|
|
471
481
|
padding: foundationToken.unit[16],
|
|
472
482
|
borderTop: `1px solid ${foundationToken.colors.gray[150]}`,
|
|
@@ -732,6 +742,11 @@ export const getTableToken = (
|
|
|
732
742
|
fontSize:
|
|
733
743
|
foundationToken.font.size.body.md.fontSize,
|
|
734
744
|
borderTop: `1px solid ${foundationToken.colors.gray[150]}`,
|
|
745
|
+
dateLabel: {
|
|
746
|
+
fontSize:
|
|
747
|
+
foundationToken.font.size.body.xs.fontSize,
|
|
748
|
+
color: foundationToken.colors.gray[400],
|
|
749
|
+
},
|
|
735
750
|
expandable: {
|
|
736
751
|
padding: foundationToken.unit[16],
|
|
737
752
|
borderTop: `1px solid ${foundationToken.colors.gray[150]}`,
|
|
@@ -88,10 +88,30 @@ export type DropdownColumnProps = {
|
|
|
88
88
|
onSelect?: (value: unknown) => void
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Format string for date display in DataTable DATE columns.
|
|
93
|
+
* @example 'DD MMM YYYY' → "24 Jun 2026"
|
|
94
|
+
* @example 'DD/MM/YYYY' → "24/06/2026"
|
|
95
|
+
* @example 'DD MMM YYYY, hh:mm A' → "24 Jun 2026, 10:30 AM"
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
export type DateFormat =
|
|
99
|
+
| 'DD MMM YYYY'
|
|
100
|
+
| 'DD/MM/YYYY'
|
|
101
|
+
| 'MM/DD/YYYY'
|
|
102
|
+
| 'YYYY-MM-DD'
|
|
103
|
+
| 'DD MMM YYYY, hh:mm A'
|
|
104
|
+
| 'DD MMM YYYY, HH:mm'
|
|
105
|
+
| 'MMM DD, YYYY'
|
|
106
|
+
| 'YYYY/MM/DD HH:mm'
|
|
107
|
+
| 'HH:mm:ss'
|
|
108
|
+
| (string & {})
|
|
109
|
+
|
|
91
110
|
export type DateColumnProps = {
|
|
92
111
|
date: Date | string
|
|
93
|
-
format?:
|
|
112
|
+
format?: DateFormat
|
|
94
113
|
showTime?: boolean
|
|
114
|
+
dateLabel?: string
|
|
95
115
|
}
|
|
96
116
|
|
|
97
117
|
export type SliderColumnProps = {
|
|
@@ -253,8 +273,13 @@ export type ColumnDefinition<T> =
|
|
|
253
273
|
row: T,
|
|
254
274
|
index: number
|
|
255
275
|
) => ReactNode
|
|
256
|
-
dateFormat?:
|
|
276
|
+
dateFormat?: DateFormat
|
|
257
277
|
showTime?: boolean
|
|
278
|
+
/**
|
|
279
|
+
* Optional label appended after the formatted date, e.g. "(IST)".
|
|
280
|
+
* Column-level value can be overridden per-cell via DateColumnProps.dateLabel.
|
|
281
|
+
*/
|
|
282
|
+
dateLabel?: string
|
|
258
283
|
})
|
|
259
284
|
| (BaseColumnDefinition<T> & {
|
|
260
285
|
type: ColumnType.SLIDER
|
|
@@ -457,6 +482,12 @@ export type DataTableProps<T extends Record<string, unknown>> = {
|
|
|
457
482
|
// Mobile configuration
|
|
458
483
|
mobileColumnsToShow?: number
|
|
459
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Optional label appended after formatted dates in DATE columns,
|
|
487
|
+
* e.g. "(IST)". Can be overridden per-column or per-cell.
|
|
488
|
+
*/
|
|
489
|
+
dateLabel?: string
|
|
490
|
+
|
|
460
491
|
// Internal pivot modal configuration
|
|
461
492
|
enablePivotTable?: boolean
|
|
462
493
|
pivotTableConfig?: {
|