@adsgency_npm/adsgency-ads-ui 0.1.0-alpha.6 → 0.1.0-alpha.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/index.cjs +808 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -6
- package/dist/index.d.ts +83 -6
- package/dist/index.js +799 -182
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ __export(src_exports, {
|
|
|
64
64
|
AdsCheckbox: () => AdsCheckbox,
|
|
65
65
|
AdsDataPagination: () => AdsDataPagination,
|
|
66
66
|
AdsDataTable: () => AdsDataTable,
|
|
67
|
+
AdsDataTableToolbar: () => AdsDataTableToolbar,
|
|
67
68
|
AdsDatePicker: () => AdsDatePicker,
|
|
68
69
|
AdsDateTimePicker: () => AdsDateTimePicker,
|
|
69
70
|
AdsDialog: () => AdsDialog,
|
|
@@ -172,6 +173,7 @@ __export(src_exports, {
|
|
|
172
173
|
AdsTooltipContent: () => AdsTooltipContent,
|
|
173
174
|
AdsTooltipProvider: () => AdsTooltipProvider,
|
|
174
175
|
AdsTooltipTrigger: () => AdsTooltipTrigger,
|
|
176
|
+
AdsViewCustomersDataTable: () => AdsViewCustomersDataTable,
|
|
175
177
|
adsDefaultMessages: () => adsDefaultMessages,
|
|
176
178
|
designTokens: () => designTokens,
|
|
177
179
|
useAdsI18n: () => useAdsI18n
|
|
@@ -213,12 +215,16 @@ var adsDefaultMessages = {
|
|
|
213
215
|
clearSort: "Clear sort",
|
|
214
216
|
collapseRow: "Collapse row",
|
|
215
217
|
expandRow: "Expand row",
|
|
218
|
+
filterColumn: "Filter column",
|
|
216
219
|
noDataAvailable: "No data available",
|
|
220
|
+
selectAllRows: "Select all rows",
|
|
217
221
|
selectRow: "Select row",
|
|
218
222
|
sortAscending: "Sort ascending",
|
|
219
223
|
sortDescending: "Sort descending"
|
|
220
224
|
},
|
|
221
225
|
pagination: {
|
|
226
|
+
first: "First",
|
|
227
|
+
last: "Last",
|
|
222
228
|
previous: "Previous",
|
|
223
229
|
next: "Next",
|
|
224
230
|
morePages: "More pages",
|
|
@@ -226,7 +232,9 @@ var adsDefaultMessages = {
|
|
|
226
232
|
itemsPerPage: "Items per page",
|
|
227
233
|
itemsPerPageOption: "{{value}} / page",
|
|
228
234
|
jumpTo: "Jump to page",
|
|
229
|
-
total: "Showing {{start}}-{{end}} of {{total}}"
|
|
235
|
+
total: "Showing {{start}}-{{end}} of {{total}}",
|
|
236
|
+
compactTotal: "Total: {{total}}",
|
|
237
|
+
pageStatus: "Page {{page}} of {{pages}}"
|
|
230
238
|
}
|
|
231
239
|
},
|
|
232
240
|
zh: {
|
|
@@ -256,12 +264,16 @@ var adsDefaultMessages = {
|
|
|
256
264
|
clearSort: "\u6E05\u9664\u6392\u5E8F",
|
|
257
265
|
collapseRow: "\u6536\u8D77\u884C",
|
|
258
266
|
expandRow: "\u5C55\u5F00\u884C",
|
|
267
|
+
filterColumn: "\u7B5B\u9009\u5217",
|
|
259
268
|
noDataAvailable: "\u6682\u65E0\u6570\u636E",
|
|
269
|
+
selectAllRows: "\u9009\u62E9\u5168\u90E8\u884C",
|
|
260
270
|
selectRow: "\u9009\u62E9\u884C",
|
|
261
271
|
sortAscending: "\u5347\u5E8F\u6392\u5E8F",
|
|
262
272
|
sortDescending: "\u964D\u5E8F\u6392\u5E8F"
|
|
263
273
|
},
|
|
264
274
|
pagination: {
|
|
275
|
+
first: "\u7B2C\u4E00\u9875",
|
|
276
|
+
last: "\u6700\u540E\u4E00\u9875",
|
|
265
277
|
previous: "\u4E0A\u4E00\u9875",
|
|
266
278
|
next: "\u4E0B\u4E00\u9875",
|
|
267
279
|
morePages: "\u66F4\u591A\u9875\u7801",
|
|
@@ -269,7 +281,9 @@ var adsDefaultMessages = {
|
|
|
269
281
|
itemsPerPage: "\u6BCF\u9875\u6761\u6570",
|
|
270
282
|
itemsPerPageOption: "{{value}} / \u9875",
|
|
271
283
|
jumpTo: "\u8DF3\u8F6C\u9875\u7801",
|
|
272
|
-
total: "\u663E\u793A\u7B2C {{start}}-{{end}} \u6761\uFF0C\u5171 {{total}} \u6761"
|
|
284
|
+
total: "\u663E\u793A\u7B2C {{start}}-{{end}} \u6761\uFF0C\u5171 {{total}} \u6761",
|
|
285
|
+
compactTotal: "\u603B\u6570: {{total}}",
|
|
286
|
+
pageStatus: "\u7B2C {{page}} / {{pages}} \u9875"
|
|
273
287
|
}
|
|
274
288
|
}
|
|
275
289
|
};
|
|
@@ -3592,8 +3606,10 @@ function AdsDataPagination({
|
|
|
3592
3606
|
pageSizeOptions = [10, 20, 50, 100],
|
|
3593
3607
|
onPageSizeChange,
|
|
3594
3608
|
showQuickJumper = false,
|
|
3609
|
+
showFirstLast = false,
|
|
3595
3610
|
siblingCount = 1,
|
|
3596
3611
|
boundaryCount = 1,
|
|
3612
|
+
variant = "default",
|
|
3597
3613
|
disabled = false,
|
|
3598
3614
|
className,
|
|
3599
3615
|
classNames,
|
|
@@ -3693,6 +3709,158 @@ function AdsDataPagination({
|
|
|
3693
3709
|
end: rangeEnd,
|
|
3694
3710
|
total
|
|
3695
3711
|
}) : null;
|
|
3712
|
+
const compactTotalContent = interpolate(messages.pagination.compactTotal, { total });
|
|
3713
|
+
const pageStatus = interpolate(messages.pagination.pageStatus, {
|
|
3714
|
+
page: mergedCurrent,
|
|
3715
|
+
pages: totalPages
|
|
3716
|
+
});
|
|
3717
|
+
const shouldShowFirstLast = variant === "compact" || showFirstLast;
|
|
3718
|
+
const navigationLabel = ariaLabel ?? messages.pagination.navigation;
|
|
3719
|
+
const previousDisabled = disabled || mergedCurrent <= 1;
|
|
3720
|
+
const nextDisabled = disabled || mergedCurrent >= totalPages;
|
|
3721
|
+
const navButtonClassName = cn(
|
|
3722
|
+
paginationButtonBaseClassName,
|
|
3723
|
+
paginationButtonInactiveClassName,
|
|
3724
|
+
"gap-1 px-md py-sm"
|
|
3725
|
+
);
|
|
3726
|
+
const renderPageNavigation = () => {
|
|
3727
|
+
if (variant === "compact") {
|
|
3728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-sm", children: [
|
|
3729
|
+
shouldShowFirstLast ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3730
|
+
Button,
|
|
3731
|
+
{
|
|
3732
|
+
"aria-label": messages.pagination.first,
|
|
3733
|
+
className: navButtonClassName,
|
|
3734
|
+
disabled: previousDisabled,
|
|
3735
|
+
onClick: () => commitPageChange(1),
|
|
3736
|
+
size: "sm",
|
|
3737
|
+
type: "button",
|
|
3738
|
+
variant: "ghost",
|
|
3739
|
+
children: messages.pagination.first
|
|
3740
|
+
}
|
|
3741
|
+
) : null,
|
|
3742
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3743
|
+
Button,
|
|
3744
|
+
{
|
|
3745
|
+
"aria-label": messages.pagination.previous,
|
|
3746
|
+
className: navButtonClassName,
|
|
3747
|
+
disabled: previousDisabled,
|
|
3748
|
+
onClick: () => commitPageChange(mergedCurrent - 1),
|
|
3749
|
+
size: "sm",
|
|
3750
|
+
type: "button",
|
|
3751
|
+
variant: "ghost",
|
|
3752
|
+
children: messages.pagination.previous
|
|
3753
|
+
}
|
|
3754
|
+
),
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3756
|
+
"span",
|
|
3757
|
+
{
|
|
3758
|
+
"aria-current": "page",
|
|
3759
|
+
className: "inline-flex h-9 items-center rounded-radius-md border border-transparent px-sm text-sm font-medium text-foreground",
|
|
3760
|
+
children: pageStatus
|
|
3761
|
+
}
|
|
3762
|
+
),
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3764
|
+
Button,
|
|
3765
|
+
{
|
|
3766
|
+
"aria-label": messages.pagination.next,
|
|
3767
|
+
className: navButtonClassName,
|
|
3768
|
+
disabled: nextDisabled,
|
|
3769
|
+
onClick: () => commitPageChange(mergedCurrent + 1),
|
|
3770
|
+
size: "sm",
|
|
3771
|
+
type: "button",
|
|
3772
|
+
variant: "ghost",
|
|
3773
|
+
children: messages.pagination.next
|
|
3774
|
+
}
|
|
3775
|
+
),
|
|
3776
|
+
shouldShowFirstLast ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3777
|
+
Button,
|
|
3778
|
+
{
|
|
3779
|
+
"aria-label": messages.pagination.last,
|
|
3780
|
+
className: navButtonClassName,
|
|
3781
|
+
disabled: nextDisabled,
|
|
3782
|
+
onClick: () => commitPageChange(totalPages),
|
|
3783
|
+
size: "sm",
|
|
3784
|
+
type: "button",
|
|
3785
|
+
variant: "ghost",
|
|
3786
|
+
children: messages.pagination.last
|
|
3787
|
+
}
|
|
3788
|
+
) : null
|
|
3789
|
+
] });
|
|
3790
|
+
}
|
|
3791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPagination, { "aria-label": navigationLabel, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(AdsPaginationContent, { children: [
|
|
3792
|
+
shouldShowFirstLast ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3793
|
+
Button,
|
|
3794
|
+
{
|
|
3795
|
+
"aria-label": messages.pagination.first,
|
|
3796
|
+
className: navButtonClassName,
|
|
3797
|
+
disabled: previousDisabled,
|
|
3798
|
+
onClick: () => commitPageChange(1),
|
|
3799
|
+
size: "sm",
|
|
3800
|
+
type: "button",
|
|
3801
|
+
variant: "ghost",
|
|
3802
|
+
children: messages.pagination.first
|
|
3803
|
+
}
|
|
3804
|
+
) }) : null,
|
|
3805
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3806
|
+
Button,
|
|
3807
|
+
{
|
|
3808
|
+
"aria-label": messages.pagination.previous,
|
|
3809
|
+
className: navButtonClassName,
|
|
3810
|
+
disabled: previousDisabled,
|
|
3811
|
+
onClick: () => commitPageChange(mergedCurrent - 1),
|
|
3812
|
+
size: "sm",
|
|
3813
|
+
type: "button",
|
|
3814
|
+
variant: "ghost",
|
|
3815
|
+
children: messages.pagination.previous
|
|
3816
|
+
}
|
|
3817
|
+
) }),
|
|
3818
|
+
paginationRange.map(
|
|
3819
|
+
(token, index) => token === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationEllipsis, { label: messages.pagination.morePages }) }, `ellipsis-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3820
|
+
Button,
|
|
3821
|
+
{
|
|
3822
|
+
"aria-current": token === mergedCurrent ? "page" : void 0,
|
|
3823
|
+
className: cn(
|
|
3824
|
+
paginationButtonBaseClassName,
|
|
3825
|
+
token === mergedCurrent ? paginationButtonActiveClassName : paginationButtonInactiveClassName
|
|
3826
|
+
),
|
|
3827
|
+
disabled,
|
|
3828
|
+
onClick: () => commitPageChange(token),
|
|
3829
|
+
size: "sm",
|
|
3830
|
+
type: "button",
|
|
3831
|
+
variant: "ghost",
|
|
3832
|
+
children: token
|
|
3833
|
+
}
|
|
3834
|
+
) }, token)
|
|
3835
|
+
),
|
|
3836
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3837
|
+
Button,
|
|
3838
|
+
{
|
|
3839
|
+
"aria-label": messages.pagination.next,
|
|
3840
|
+
className: navButtonClassName,
|
|
3841
|
+
disabled: nextDisabled,
|
|
3842
|
+
onClick: () => commitPageChange(mergedCurrent + 1),
|
|
3843
|
+
size: "sm",
|
|
3844
|
+
type: "button",
|
|
3845
|
+
variant: "ghost",
|
|
3846
|
+
children: messages.pagination.next
|
|
3847
|
+
}
|
|
3848
|
+
) }),
|
|
3849
|
+
shouldShowFirstLast ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3850
|
+
Button,
|
|
3851
|
+
{
|
|
3852
|
+
"aria-label": messages.pagination.last,
|
|
3853
|
+
className: navButtonClassName,
|
|
3854
|
+
disabled: nextDisabled,
|
|
3855
|
+
onClick: () => commitPageChange(totalPages),
|
|
3856
|
+
size: "sm",
|
|
3857
|
+
type: "button",
|
|
3858
|
+
variant: "ghost",
|
|
3859
|
+
children: messages.pagination.last
|
|
3860
|
+
}
|
|
3861
|
+
) }) : null
|
|
3862
|
+
] }) });
|
|
3863
|
+
};
|
|
3696
3864
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
3697
3865
|
"div",
|
|
3698
3866
|
{
|
|
@@ -3704,7 +3872,7 @@ function AdsDataPagination({
|
|
|
3704
3872
|
),
|
|
3705
3873
|
children: [
|
|
3706
3874
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-md text-sm leading-5 text-muted-foreground", children: [
|
|
3707
|
-
totalContent ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: classNames?.total, children: totalContent }) : null,
|
|
3875
|
+
variant === "compact" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: classNames?.total, children: compactTotalContent }) : totalContent ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: classNames?.total, children: totalContent }) : null,
|
|
3708
3876
|
showSizeChanger ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cn("flex items-center gap-sm", classNames?.pageSizeChanger), children: [
|
|
3709
3877
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: messages.pagination.itemsPerPage }),
|
|
3710
3878
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
@@ -3729,58 +3897,7 @@ function AdsDataPagination({
|
|
|
3729
3897
|
] }) : null
|
|
3730
3898
|
] }),
|
|
3731
3899
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-md sm:flex-row sm:items-center sm:justify-end", children: [
|
|
3732
|
-
|
|
3733
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3734
|
-
Button,
|
|
3735
|
-
{
|
|
3736
|
-
className: cn(
|
|
3737
|
-
paginationButtonBaseClassName,
|
|
3738
|
-
paginationButtonInactiveClassName,
|
|
3739
|
-
"gap-1 px-md py-sm"
|
|
3740
|
-
),
|
|
3741
|
-
disabled: disabled || mergedCurrent <= 1,
|
|
3742
|
-
onClick: () => commitPageChange(mergedCurrent - 1),
|
|
3743
|
-
size: "sm",
|
|
3744
|
-
type: "button",
|
|
3745
|
-
variant: "ghost",
|
|
3746
|
-
children: messages.pagination.previous
|
|
3747
|
-
}
|
|
3748
|
-
) }),
|
|
3749
|
-
paginationRange.map(
|
|
3750
|
-
(token, index) => token === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationEllipsis, { label: messages.pagination.morePages }) }, `ellipsis-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3751
|
-
Button,
|
|
3752
|
-
{
|
|
3753
|
-
"aria-current": token === mergedCurrent ? "page" : void 0,
|
|
3754
|
-
className: cn(
|
|
3755
|
-
paginationButtonBaseClassName,
|
|
3756
|
-
token === mergedCurrent ? paginationButtonActiveClassName : paginationButtonInactiveClassName
|
|
3757
|
-
),
|
|
3758
|
-
disabled,
|
|
3759
|
-
onClick: () => commitPageChange(token),
|
|
3760
|
-
size: "sm",
|
|
3761
|
-
type: "button",
|
|
3762
|
-
variant: "ghost",
|
|
3763
|
-
children: token
|
|
3764
|
-
}
|
|
3765
|
-
) }, token)
|
|
3766
|
-
),
|
|
3767
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AdsPaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3768
|
-
Button,
|
|
3769
|
-
{
|
|
3770
|
-
className: cn(
|
|
3771
|
-
paginationButtonBaseClassName,
|
|
3772
|
-
paginationButtonInactiveClassName,
|
|
3773
|
-
"gap-1 px-md py-sm"
|
|
3774
|
-
),
|
|
3775
|
-
disabled: disabled || mergedCurrent >= totalPages,
|
|
3776
|
-
onClick: () => commitPageChange(mergedCurrent + 1),
|
|
3777
|
-
size: "sm",
|
|
3778
|
-
type: "button",
|
|
3779
|
-
variant: "ghost",
|
|
3780
|
-
children: messages.pagination.next
|
|
3781
|
-
}
|
|
3782
|
-
) })
|
|
3783
|
-
] }) }),
|
|
3900
|
+
renderPageNavigation(),
|
|
3784
3901
|
showQuickJumper ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
3785
3902
|
"label",
|
|
3786
3903
|
{
|
|
@@ -3819,6 +3936,7 @@ function AdsDataPagination({
|
|
|
3819
3936
|
|
|
3820
3937
|
// src/components/AdsDataTable/index.tsx
|
|
3821
3938
|
var React41 = __toESM(require("react"), 1);
|
|
3939
|
+
var import_lucide_react17 = require("lucide-react");
|
|
3822
3940
|
|
|
3823
3941
|
// src/components/AdsEmpty/index.tsx
|
|
3824
3942
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
@@ -4434,6 +4552,7 @@ AdsTableExpandCell.displayName = "AdsTableExpandCell";
|
|
|
4434
4552
|
// src/components/AdsDataTable/index.tsx
|
|
4435
4553
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4436
4554
|
var SKELETON_ROW_COUNT = 4;
|
|
4555
|
+
var FLEX_WIDTH_UNIT = 160;
|
|
4437
4556
|
var sizeClassNames = {
|
|
4438
4557
|
small: {
|
|
4439
4558
|
cell: "py-1.5 text-xs leading-4",
|
|
@@ -4452,6 +4571,9 @@ function getColumnKey(column, index) {
|
|
|
4452
4571
|
if (column.key !== void 0) {
|
|
4453
4572
|
return String(column.key);
|
|
4454
4573
|
}
|
|
4574
|
+
if (column.field) {
|
|
4575
|
+
return column.field;
|
|
4576
|
+
}
|
|
4455
4577
|
if (Array.isArray(column.dataIndex)) {
|
|
4456
4578
|
return column.dataIndex.join(".");
|
|
4457
4579
|
}
|
|
@@ -4460,6 +4582,17 @@ function getColumnKey(column, index) {
|
|
|
4460
4582
|
}
|
|
4461
4583
|
return `column-${index}`;
|
|
4462
4584
|
}
|
|
4585
|
+
function getValueByFieldPath(record, field) {
|
|
4586
|
+
if (!field) {
|
|
4587
|
+
return void 0;
|
|
4588
|
+
}
|
|
4589
|
+
return field.split(".").reduce((value, key) => {
|
|
4590
|
+
if (value && typeof value === "object") {
|
|
4591
|
+
return value[key];
|
|
4592
|
+
}
|
|
4593
|
+
return void 0;
|
|
4594
|
+
}, record);
|
|
4595
|
+
}
|
|
4463
4596
|
function getColumnValue(record, dataIndex) {
|
|
4464
4597
|
if (dataIndex === void 0) {
|
|
4465
4598
|
return void 0;
|
|
@@ -4493,10 +4626,45 @@ function compareValues(valueA, valueB) {
|
|
|
4493
4626
|
}
|
|
4494
4627
|
return String(valueA ?? "").localeCompare(String(valueB ?? ""));
|
|
4495
4628
|
}
|
|
4496
|
-
function
|
|
4497
|
-
|
|
4629
|
+
function toPixelWidth(value) {
|
|
4630
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4631
|
+
return value;
|
|
4632
|
+
}
|
|
4633
|
+
if (typeof value === "string") {
|
|
4634
|
+
const matched = Number.parseFloat(value);
|
|
4635
|
+
return Number.isFinite(matched) ? matched : void 0;
|
|
4636
|
+
}
|
|
4637
|
+
return void 0;
|
|
4638
|
+
}
|
|
4639
|
+
function normalizeFilterValue(value) {
|
|
4640
|
+
if (value === null || value === void 0) {
|
|
4641
|
+
return "";
|
|
4642
|
+
}
|
|
4643
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
4644
|
+
return String(value);
|
|
4645
|
+
}
|
|
4646
|
+
return JSON.stringify(value);
|
|
4647
|
+
}
|
|
4648
|
+
function getResolvedColumnWidth(column, overrideWidth) {
|
|
4649
|
+
if (overrideWidth !== void 0) {
|
|
4650
|
+
return overrideWidth;
|
|
4651
|
+
}
|
|
4498
4652
|
if (column.width !== void 0) {
|
|
4499
|
-
|
|
4653
|
+
return column.width;
|
|
4654
|
+
}
|
|
4655
|
+
if (column.flex !== void 0 && Number.isFinite(column.flex) && column.flex > 0) {
|
|
4656
|
+
return `${Math.max(column.flex, 1) * FLEX_WIDTH_UNIT}px`;
|
|
4657
|
+
}
|
|
4658
|
+
return void 0;
|
|
4659
|
+
}
|
|
4660
|
+
function getCellStyle(column, overrideWidth) {
|
|
4661
|
+
const style = {};
|
|
4662
|
+
const resolvedWidth = getResolvedColumnWidth(column, overrideWidth);
|
|
4663
|
+
if (resolvedWidth !== void 0) {
|
|
4664
|
+
style.width = resolvedWidth;
|
|
4665
|
+
}
|
|
4666
|
+
if (column.minWidth !== void 0) {
|
|
4667
|
+
style.minWidth = column.minWidth;
|
|
4500
4668
|
}
|
|
4501
4669
|
if (column.align !== void 0) {
|
|
4502
4670
|
style.textAlign = column.align;
|
|
@@ -4504,16 +4672,79 @@ function getCellStyle(column) {
|
|
|
4504
4672
|
return Object.keys(style).length > 0 ? style : void 0;
|
|
4505
4673
|
}
|
|
4506
4674
|
function renderCellValue(value, ellipsis) {
|
|
4507
|
-
if (React41.isValidElement(value)
|
|
4508
|
-
return value
|
|
4675
|
+
if (React41.isValidElement(value)) {
|
|
4676
|
+
return value;
|
|
4677
|
+
}
|
|
4678
|
+
if (value === null || value === void 0) {
|
|
4679
|
+
return "";
|
|
4509
4680
|
}
|
|
4510
4681
|
const stringValue = typeof value === "string" || typeof value === "number" ? String(value) : JSON.stringify(value);
|
|
4511
4682
|
if (ellipsis) {
|
|
4512
4683
|
const shouldShowTitle = typeof ellipsis === "object" ? ellipsis.showTitle !== false : true;
|
|
4513
|
-
|
|
4684
|
+
const maxWidth = typeof ellipsis === "object" ? ellipsis.maxWidth : void 0;
|
|
4685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4686
|
+
"div",
|
|
4687
|
+
{
|
|
4688
|
+
className: "truncate",
|
|
4689
|
+
style: maxWidth !== void 0 ? { maxWidth } : void 0,
|
|
4690
|
+
title: shouldShowTitle ? stringValue : void 0,
|
|
4691
|
+
children: stringValue
|
|
4692
|
+
}
|
|
4693
|
+
);
|
|
4514
4694
|
}
|
|
4515
4695
|
return stringValue;
|
|
4516
4696
|
}
|
|
4697
|
+
function getColumnHeader(column, columnKey) {
|
|
4698
|
+
return column.title ?? column.headerName ?? columnKey;
|
|
4699
|
+
}
|
|
4700
|
+
function getColumnRawValue(column, record, index) {
|
|
4701
|
+
if (column.valueGetter) {
|
|
4702
|
+
return column.valueGetter(record, index);
|
|
4703
|
+
}
|
|
4704
|
+
if (column.field) {
|
|
4705
|
+
return getValueByFieldPath(record, column.field);
|
|
4706
|
+
}
|
|
4707
|
+
return getColumnValue(record, column.dataIndex);
|
|
4708
|
+
}
|
|
4709
|
+
function resolveRenderedCellContent(column, record, index) {
|
|
4710
|
+
const rawValue = getColumnRawValue(column, record, index);
|
|
4711
|
+
const formattedValue = column.valueFormatter ? column.valueFormatter(rawValue, record, index) : rawValue;
|
|
4712
|
+
if (column.render) {
|
|
4713
|
+
return column.render(formattedValue, record, index);
|
|
4714
|
+
}
|
|
4715
|
+
if (column.cellRenderer) {
|
|
4716
|
+
return column.cellRenderer({
|
|
4717
|
+
value: rawValue,
|
|
4718
|
+
formattedValue,
|
|
4719
|
+
record,
|
|
4720
|
+
data: record,
|
|
4721
|
+
index,
|
|
4722
|
+
column
|
|
4723
|
+
});
|
|
4724
|
+
}
|
|
4725
|
+
return formattedValue;
|
|
4726
|
+
}
|
|
4727
|
+
function shouldIgnoreRowClick(event) {
|
|
4728
|
+
const target = event.target;
|
|
4729
|
+
if (!(target instanceof HTMLElement)) {
|
|
4730
|
+
return false;
|
|
4731
|
+
}
|
|
4732
|
+
return Boolean(
|
|
4733
|
+
target.closest(
|
|
4734
|
+
[
|
|
4735
|
+
"a",
|
|
4736
|
+
"button",
|
|
4737
|
+
"input",
|
|
4738
|
+
"select",
|
|
4739
|
+
"textarea",
|
|
4740
|
+
"[role='checkbox']",
|
|
4741
|
+
"[role='radio']",
|
|
4742
|
+
"[role='button']",
|
|
4743
|
+
"[data-ads-row-click-stop]"
|
|
4744
|
+
].join(",")
|
|
4745
|
+
)
|
|
4746
|
+
);
|
|
4747
|
+
}
|
|
4517
4748
|
function getInitialSortState(columns) {
|
|
4518
4749
|
const columnIndex = columns.findIndex((column2) => column2.defaultSortOrder !== void 0);
|
|
4519
4750
|
if (columnIndex === -1) {
|
|
@@ -4530,6 +4761,16 @@ function getInitialSortState(columns) {
|
|
|
4530
4761
|
order
|
|
4531
4762
|
};
|
|
4532
4763
|
}
|
|
4764
|
+
function getInitialFilterValues(columns) {
|
|
4765
|
+
return columns.reduce((accumulator, column, index) => {
|
|
4766
|
+
const columnKey = getColumnKey(column, index);
|
|
4767
|
+
const value = column.filterValue ?? column.defaultFilterValue;
|
|
4768
|
+
if (value !== void 0) {
|
|
4769
|
+
accumulator[columnKey] = value;
|
|
4770
|
+
}
|
|
4771
|
+
return accumulator;
|
|
4772
|
+
}, {});
|
|
4773
|
+
}
|
|
4533
4774
|
function AdsDataTable({
|
|
4534
4775
|
className,
|
|
4535
4776
|
columns,
|
|
@@ -4549,7 +4790,9 @@ function AdsDataTable({
|
|
|
4549
4790
|
footer,
|
|
4550
4791
|
tableClassName,
|
|
4551
4792
|
classNames,
|
|
4552
|
-
onSortChange
|
|
4793
|
+
onSortChange,
|
|
4794
|
+
onRowClick,
|
|
4795
|
+
suppressRowClickSelection = true
|
|
4553
4796
|
}) {
|
|
4554
4797
|
const { messages } = useAdsI18n();
|
|
4555
4798
|
const resolvedColumns = React41.useMemo(() => columns.filter(Boolean), [columns]);
|
|
@@ -4559,15 +4802,20 @@ function AdsDataTable({
|
|
|
4559
4802
|
const [internalSelectedKeys, setInternalSelectedKeys] = React41.useState(
|
|
4560
4803
|
rowSelection?.defaultSelectedRowKeys ?? rowSelection?.selectedRowKeys ?? []
|
|
4561
4804
|
);
|
|
4805
|
+
const [internalFilterValues, setInternalFilterValues] = React41.useState(
|
|
4806
|
+
() => getInitialFilterValues(resolvedColumns)
|
|
4807
|
+
);
|
|
4562
4808
|
const [internalExpandedKeys, setInternalExpandedKeys] = React41.useState(
|
|
4563
4809
|
expandable?.defaultExpandedRowKeys ?? expandable?.expandedRowKeys ?? []
|
|
4564
4810
|
);
|
|
4811
|
+
const [internalColumnWidths, setInternalColumnWidths] = React41.useState({});
|
|
4565
4812
|
const [internalCurrentPage, setInternalCurrentPage] = React41.useState(
|
|
4566
4813
|
pagination !== false ? pagination.defaultCurrent ?? pagination.current ?? 1 : 1
|
|
4567
4814
|
);
|
|
4568
4815
|
const [internalPageSize, setInternalPageSize] = React41.useState(
|
|
4569
4816
|
pagination !== false ? pagination.defaultPageSize ?? pagination.pageSize ?? 10 : 10
|
|
4570
4817
|
);
|
|
4818
|
+
const [activeResize, setActiveResize] = React41.useState(null);
|
|
4571
4819
|
React41.useEffect(() => {
|
|
4572
4820
|
if (rowSelection?.selectedRowKeys !== void 0) {
|
|
4573
4821
|
setInternalSelectedKeys(rowSelection.selectedRowKeys);
|
|
@@ -4588,6 +4836,27 @@ function AdsDataTable({
|
|
|
4588
4836
|
setInternalPageSize(pagination.pageSize);
|
|
4589
4837
|
}
|
|
4590
4838
|
}, [pagination]);
|
|
4839
|
+
React41.useEffect(() => {
|
|
4840
|
+
setInternalFilterValues((previous) => {
|
|
4841
|
+
const next = { ...previous };
|
|
4842
|
+
let hasChanged = false;
|
|
4843
|
+
resolvedColumns.forEach((column, index) => {
|
|
4844
|
+
const columnKey = getColumnKey(column, index);
|
|
4845
|
+
if (column.filterValue !== void 0) {
|
|
4846
|
+
if (next[columnKey] !== column.filterValue) {
|
|
4847
|
+
next[columnKey] = column.filterValue;
|
|
4848
|
+
hasChanged = true;
|
|
4849
|
+
}
|
|
4850
|
+
return;
|
|
4851
|
+
}
|
|
4852
|
+
if (!(columnKey in next) && column.defaultFilterValue !== void 0) {
|
|
4853
|
+
next[columnKey] = column.defaultFilterValue;
|
|
4854
|
+
hasChanged = true;
|
|
4855
|
+
}
|
|
4856
|
+
});
|
|
4857
|
+
return hasChanged ? next : previous;
|
|
4858
|
+
});
|
|
4859
|
+
}, [resolvedColumns]);
|
|
4591
4860
|
const controlledSortState = React41.useMemo(() => {
|
|
4592
4861
|
const columnIndex = resolvedColumns.findIndex((column2) => column2.sortOrder !== void 0);
|
|
4593
4862
|
if (columnIndex === -1) {
|
|
@@ -4606,22 +4875,56 @@ function AdsDataTable({
|
|
|
4606
4875
|
const hasSelectionColumn = Boolean(rowSelection);
|
|
4607
4876
|
const hasExpandableColumn = Boolean(expandable?.expandedRowRender);
|
|
4608
4877
|
const density = sizeClassNames[size];
|
|
4878
|
+
const paginationMode = pagination === false ? "client" : pagination.mode ?? "client";
|
|
4879
|
+
const allowsRowSelectionByClick = Boolean(rowSelection) && !suppressRowClickSelection;
|
|
4880
|
+
const filterValues = React41.useMemo(
|
|
4881
|
+
() => resolvedColumns.reduce((accumulator, column, index) => {
|
|
4882
|
+
const columnKey = getColumnKey(column, index);
|
|
4883
|
+
accumulator[columnKey] = column.filterValue ?? internalFilterValues[columnKey] ?? "";
|
|
4884
|
+
return accumulator;
|
|
4885
|
+
}, {}),
|
|
4886
|
+
[internalFilterValues, resolvedColumns]
|
|
4887
|
+
);
|
|
4888
|
+
const filteredData = React41.useMemo(() => {
|
|
4889
|
+
const filterableColumns = resolvedColumns.filter((column) => column.filter);
|
|
4890
|
+
if (filterableColumns.length === 0) {
|
|
4891
|
+
return dataSource;
|
|
4892
|
+
}
|
|
4893
|
+
return dataSource.filter(
|
|
4894
|
+
(record, index) => filterableColumns.every((column) => {
|
|
4895
|
+
const columnKey = getColumnKey(column, resolvedColumns.indexOf(column));
|
|
4896
|
+
const filterValue = filterValues[columnKey]?.trim();
|
|
4897
|
+
if (!filterValue || column.filterMode === "server") {
|
|
4898
|
+
return true;
|
|
4899
|
+
}
|
|
4900
|
+
const rawValue = getColumnRawValue(column, record, index);
|
|
4901
|
+
if (typeof column.filter === "function") {
|
|
4902
|
+
return column.filter(filterValue, record, index, rawValue);
|
|
4903
|
+
}
|
|
4904
|
+
return normalizeFilterValue(rawValue).toLowerCase().includes(filterValue.toLowerCase());
|
|
4905
|
+
})
|
|
4906
|
+
);
|
|
4907
|
+
}, [dataSource, filterValues, resolvedColumns]);
|
|
4609
4908
|
const sortedData = React41.useMemo(() => {
|
|
4610
4909
|
if (!sortState || !sortState.column || sortState.order === null) {
|
|
4611
|
-
return
|
|
4910
|
+
return filteredData;
|
|
4612
4911
|
}
|
|
4613
4912
|
const column = sortState.column;
|
|
4614
4913
|
const sortable = column.sorter;
|
|
4615
4914
|
if (!sortable) {
|
|
4616
|
-
return
|
|
4915
|
+
return filteredData;
|
|
4617
4916
|
}
|
|
4618
|
-
const sorterFn = typeof sortable === "function" ? sortable : (a, b) =>
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4917
|
+
const sorterFn = typeof sortable === "function" ? sortable : (a, b) => {
|
|
4918
|
+
const indexA = filteredData.indexOf(a);
|
|
4919
|
+
const indexB = filteredData.indexOf(b);
|
|
4920
|
+
return compareValues(
|
|
4921
|
+
getColumnRawValue(column, a, indexA),
|
|
4922
|
+
getColumnRawValue(column, b, indexB)
|
|
4923
|
+
);
|
|
4924
|
+
};
|
|
4925
|
+
const nextData = [...filteredData].sort(sorterFn);
|
|
4623
4926
|
return sortState.order === "descend" ? nextData.reverse() : nextData;
|
|
4624
|
-
}, [
|
|
4927
|
+
}, [filteredData, sortState]);
|
|
4625
4928
|
const resolvedTotal = pagination === false ? sortedData.length : pagination.total ?? sortedData.length;
|
|
4626
4929
|
const currentPageSize = pagination === false ? Math.max(sortedData.length, 1) : Math.max(1, pagination.pageSize ?? internalPageSize);
|
|
4627
4930
|
const totalPages = pagination === false ? 1 : Math.max(1, Math.ceil(Math.max(resolvedTotal, 0) / currentPageSize));
|
|
@@ -4638,12 +4941,12 @@ function AdsDataTable({
|
|
|
4638
4941
|
}
|
|
4639
4942
|
}, [currentPage, internalCurrentPage, pagination]);
|
|
4640
4943
|
const paginatedData = React41.useMemo(() => {
|
|
4641
|
-
if (pagination === false) {
|
|
4944
|
+
if (pagination === false || paginationMode === "server") {
|
|
4642
4945
|
return sortedData;
|
|
4643
4946
|
}
|
|
4644
4947
|
const start = (currentPage - 1) * currentPageSize;
|
|
4645
4948
|
return sortedData.slice(start, start + currentPageSize);
|
|
4646
|
-
}, [currentPage, currentPageSize, pagination, sortedData]);
|
|
4949
|
+
}, [currentPage, currentPageSize, pagination, paginationMode, sortedData]);
|
|
4647
4950
|
const handleSortChange = React41.useCallback(
|
|
4648
4951
|
(column, columnKey, nextOrder) => {
|
|
4649
4952
|
const nextSortState = nextOrder === null ? null : {
|
|
@@ -4658,6 +4961,21 @@ function AdsDataTable({
|
|
|
4658
4961
|
},
|
|
4659
4962
|
[controlledSortState, onSortChange]
|
|
4660
4963
|
);
|
|
4964
|
+
const handleFilterChange = React41.useCallback(
|
|
4965
|
+
(column, columnKey, nextValue) => {
|
|
4966
|
+
if (column.filterValue === void 0) {
|
|
4967
|
+
setInternalFilterValues((previous) => ({
|
|
4968
|
+
...previous,
|
|
4969
|
+
[columnKey]: nextValue
|
|
4970
|
+
}));
|
|
4971
|
+
}
|
|
4972
|
+
if (pagination !== false && pagination.current === void 0) {
|
|
4973
|
+
setInternalCurrentPage(1);
|
|
4974
|
+
}
|
|
4975
|
+
column.onFilterChange?.(nextValue);
|
|
4976
|
+
},
|
|
4977
|
+
[pagination]
|
|
4978
|
+
);
|
|
4661
4979
|
const updateSelection = React41.useCallback(
|
|
4662
4980
|
(nextKeys) => {
|
|
4663
4981
|
if (!rowSelection) {
|
|
@@ -4673,6 +4991,20 @@ function AdsDataTable({
|
|
|
4673
4991
|
},
|
|
4674
4992
|
[dataSource, rowKey, rowSelection]
|
|
4675
4993
|
);
|
|
4994
|
+
const toggleSelectionFromRowClick = React41.useCallback(
|
|
4995
|
+
(record, recordKey) => {
|
|
4996
|
+
if (!allowsRowSelectionByClick || !rowSelection) {
|
|
4997
|
+
return;
|
|
4998
|
+
}
|
|
4999
|
+
if (rowSelection.type === "radio") {
|
|
5000
|
+
updateSelection([recordKey]);
|
|
5001
|
+
return;
|
|
5002
|
+
}
|
|
5003
|
+
const nextKeys = selectedKeys.includes(recordKey) ? selectedKeys.filter((key) => key !== recordKey) : [...selectedKeys, recordKey];
|
|
5004
|
+
updateSelection(Array.from(new Set(nextKeys)));
|
|
5005
|
+
},
|
|
5006
|
+
[allowsRowSelectionByClick, rowSelection, selectedKeys, updateSelection]
|
|
5007
|
+
);
|
|
4676
5008
|
const toggleExpanded = React41.useCallback(
|
|
4677
5009
|
(record, recordKey) => {
|
|
4678
5010
|
if (!expandable?.expandedRowRender) {
|
|
@@ -4724,6 +5056,136 @@ function AdsDataTable({
|
|
|
4724
5056
|
},
|
|
4725
5057
|
[pagination]
|
|
4726
5058
|
);
|
|
5059
|
+
const visibleRowEntries = React41.useMemo(
|
|
5060
|
+
() => paginatedData.map((record, index) => ({
|
|
5061
|
+
key: resolveRowKey(record, index, rowKey),
|
|
5062
|
+
record
|
|
5063
|
+
})),
|
|
5064
|
+
[paginatedData, rowKey]
|
|
5065
|
+
);
|
|
5066
|
+
const visibleSelectableKeys = React41.useMemo(
|
|
5067
|
+
() => visibleRowEntries.map((entry) => entry.key),
|
|
5068
|
+
[visibleRowEntries]
|
|
5069
|
+
);
|
|
5070
|
+
const selectedVisibleCount = React41.useMemo(
|
|
5071
|
+
() => visibleSelectableKeys.filter((key) => selectedKeys.includes(key)).length,
|
|
5072
|
+
[selectedKeys, visibleSelectableKeys]
|
|
5073
|
+
);
|
|
5074
|
+
const allVisibleRowsSelected = visibleSelectableKeys.length > 0 && selectedVisibleCount === visibleSelectableKeys.length;
|
|
5075
|
+
const someVisibleRowsSelected = selectedVisibleCount > 0 && selectedVisibleCount < visibleSelectableKeys.length;
|
|
5076
|
+
const getColumnWidthOverride = React41.useCallback(
|
|
5077
|
+
(column, columnKey) => internalColumnWidths[columnKey] ?? getResolvedColumnWidth(column),
|
|
5078
|
+
[internalColumnWidths]
|
|
5079
|
+
);
|
|
5080
|
+
const startColumnResize = React41.useCallback(
|
|
5081
|
+
(event, column, columnKey) => {
|
|
5082
|
+
event.preventDefault();
|
|
5083
|
+
event.stopPropagation();
|
|
5084
|
+
const startWidth = toPixelWidth(internalColumnWidths[columnKey]) ?? toPixelWidth(getResolvedColumnWidth(column)) ?? toPixelWidth(column.minWidth) ?? FLEX_WIDTH_UNIT;
|
|
5085
|
+
const minWidth = Math.max(toPixelWidth(column.minWidth) ?? 96, 48);
|
|
5086
|
+
const resizeState = {
|
|
5087
|
+
columnKey,
|
|
5088
|
+
minWidth,
|
|
5089
|
+
startWidth,
|
|
5090
|
+
startX: event.clientX
|
|
5091
|
+
};
|
|
5092
|
+
setActiveResize(resizeState);
|
|
5093
|
+
const handleMouseMove = (nextEvent) => {
|
|
5094
|
+
const delta = nextEvent.clientX - resizeState.startX;
|
|
5095
|
+
const nextWidth = Math.max(resizeState.minWidth, resizeState.startWidth + delta);
|
|
5096
|
+
setInternalColumnWidths((previous) => ({
|
|
5097
|
+
...previous,
|
|
5098
|
+
[resizeState.columnKey]: nextWidth
|
|
5099
|
+
}));
|
|
5100
|
+
};
|
|
5101
|
+
const handleMouseUp = () => {
|
|
5102
|
+
setActiveResize(null);
|
|
5103
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
5104
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
5105
|
+
};
|
|
5106
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
5107
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
5108
|
+
},
|
|
5109
|
+
[internalColumnWidths]
|
|
5110
|
+
);
|
|
5111
|
+
const renderColumnHeader = React41.useCallback(
|
|
5112
|
+
(column, columnKey, columnSortOrder) => {
|
|
5113
|
+
const headerTitle = getColumnHeader(column, columnKey);
|
|
5114
|
+
const hasSorter = Boolean(column.sorter);
|
|
5115
|
+
const hasFilter = Boolean(column.filter);
|
|
5116
|
+
const hasResizeHandle = Boolean(column.resizable);
|
|
5117
|
+
if (!hasSorter && !hasFilter && !hasResizeHandle) {
|
|
5118
|
+
return headerTitle;
|
|
5119
|
+
}
|
|
5120
|
+
const nextOrder = columnSortOrder === null ? "ascend" : columnSortOrder === "ascend" ? "descend" : null;
|
|
5121
|
+
const actionLabel = nextOrder === "ascend" ? messages.table.sortAscending : nextOrder === "descend" ? messages.table.sortDescending : messages.table.clearSort;
|
|
5122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "relative flex min-w-0 items-center gap-2 pr-3", children: [
|
|
5123
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex min-w-0 flex-1 items-center justify-between gap-2", children: [
|
|
5124
|
+
hasSorter ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
5125
|
+
Button,
|
|
5126
|
+
{
|
|
5127
|
+
"aria-label": `${headerTitle} ${actionLabel}`,
|
|
5128
|
+
className: cn(
|
|
5129
|
+
"h-8 min-w-0 flex-1 justify-between rounded-radius-md border-0 bg-transparent px-0 text-left shadow-none hover:bg-transparent focus-visible:ring-0",
|
|
5130
|
+
"hover:text-[var(--card-foreground)]"
|
|
5131
|
+
),
|
|
5132
|
+
onClick: () => handleSortChange(column, columnKey, nextOrder),
|
|
5133
|
+
size: "sm",
|
|
5134
|
+
type: "button",
|
|
5135
|
+
variant: "ghost",
|
|
5136
|
+
children: [
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "truncate", children: headerTitle }),
|
|
5138
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "inline-flex h-4 w-4 items-center justify-center text-icon-muted", children: columnSortOrder === "ascend" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react17.ChevronDown, { className: "h-4 w-4 rotate-180" }) : columnSortOrder === "descend" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react17.ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react17.ChevronDown, { className: "h-4 w-4 opacity-60" }) })
|
|
5139
|
+
]
|
|
5140
|
+
}
|
|
5141
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "truncate", children: headerTitle }),
|
|
5142
|
+
hasFilter ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AdsPopover, { children: [
|
|
5143
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsPopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5144
|
+
Button,
|
|
5145
|
+
{
|
|
5146
|
+
"aria-label": `${headerTitle} ${messages.table.filterColumn}`,
|
|
5147
|
+
className: cn(
|
|
5148
|
+
"h-6 w-6 shrink-0 rounded-[6px] border border-border bg-card/80 px-0 shadow-none hover:bg-accent focus-visible:ring-0",
|
|
5149
|
+
filterValues[columnKey] ? "text-primary" : "text-icon-muted hover:text-[var(--card-foreground)]"
|
|
5150
|
+
),
|
|
5151
|
+
"data-ads-column-filter-trigger": "true",
|
|
5152
|
+
size: "sm",
|
|
5153
|
+
type: "button",
|
|
5154
|
+
variant: "ghost",
|
|
5155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react17.Filter, { className: "h-3.5 w-3.5" })
|
|
5156
|
+
}
|
|
5157
|
+
) }),
|
|
5158
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsPopoverContent, { align: "end", className: "w-64", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5159
|
+
AdsInput,
|
|
5160
|
+
{
|
|
5161
|
+
clearable: true,
|
|
5162
|
+
onChange: (event) => handleFilterChange(column, columnKey, event.currentTarget.value),
|
|
5163
|
+
onClear: () => handleFilterChange(column, columnKey, ""),
|
|
5164
|
+
placeholder: column.filterPlaceholder,
|
|
5165
|
+
size: "sm",
|
|
5166
|
+
value: filterValues[columnKey] ?? ""
|
|
5167
|
+
}
|
|
5168
|
+
) })
|
|
5169
|
+
] }) : null
|
|
5170
|
+
] }),
|
|
5171
|
+
hasResizeHandle ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5172
|
+
"span",
|
|
5173
|
+
{
|
|
5174
|
+
"aria-label": `Resize ${headerTitle} column`,
|
|
5175
|
+
className: cn(
|
|
5176
|
+
"absolute inset-y-1 -right-1 z-20 flex w-2 cursor-col-resize items-center justify-center rounded-full transition-colors",
|
|
5177
|
+
"before:block before:h-5 before:w-px before:rounded-full before:bg-[#4A4C55]",
|
|
5178
|
+
"hover:before:bg-[#6B6E78]",
|
|
5179
|
+
activeResize?.columnKey === columnKey ? "before:bg-[#8B8E99]" : void 0
|
|
5180
|
+
),
|
|
5181
|
+
onMouseDown: (event) => startColumnResize(event, column, columnKey),
|
|
5182
|
+
role: "separator"
|
|
5183
|
+
}
|
|
5184
|
+
) : null
|
|
5185
|
+
] });
|
|
5186
|
+
},
|
|
5187
|
+
[activeResize?.columnKey, filterValues, handleFilterChange, handleSortChange, messages.table, startColumnResize]
|
|
5188
|
+
);
|
|
4727
5189
|
const tableNode = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AdsTableSurface, { className: cn("flex min-h-0 flex-1 flex-col", className), children: [
|
|
4728
5190
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsTableScrollArea, { fill, stickyHeader: sticky, x: scroll?.x, y: scroll?.y, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AdsTableRoot, { className: tableClassName, children: [
|
|
4729
5191
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AdsTableColGroup, { children: [
|
|
@@ -4732,36 +5194,39 @@ function AdsDataTable({
|
|
|
4732
5194
|
resolvedColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4733
5195
|
AdsTableCol,
|
|
4734
5196
|
{
|
|
4735
|
-
style: column
|
|
5197
|
+
style: getCellStyle(column, getColumnWidthOverride(column, getColumnKey(column, index)))
|
|
4736
5198
|
},
|
|
4737
5199
|
getColumnKey(column, index)
|
|
4738
5200
|
))
|
|
4739
5201
|
] }),
|
|
4740
5202
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsTableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AdsTableRow, { children: [
|
|
4741
|
-
hasSelectionColumn ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsTableHead, { className: "w-12 p-2"
|
|
5203
|
+
hasSelectionColumn ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsTableHead, { className: "w-12 p-2", children: rowSelection?.type !== "radio" && !rowSelection?.hideSelectAll ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5204
|
+
Checkbox2,
|
|
5205
|
+
{
|
|
5206
|
+
"aria-label": messages.table.selectAllRows,
|
|
5207
|
+
checked: allVisibleRowsSelected ? true : someVisibleRowsSelected ? "indeterminate" : false,
|
|
5208
|
+
disabled: visibleSelectableKeys.length === 0,
|
|
5209
|
+
onCheckedChange: (nextChecked) => {
|
|
5210
|
+
const shouldSelectAll = Boolean(nextChecked);
|
|
5211
|
+
const remainingKeys = selectedKeys.filter(
|
|
5212
|
+
(key) => !visibleSelectableKeys.includes(key)
|
|
5213
|
+
);
|
|
5214
|
+
const nextKeys = shouldSelectAll ? Array.from(/* @__PURE__ */ new Set([...remainingKeys, ...visibleSelectableKeys])) : remainingKeys;
|
|
5215
|
+
updateSelection(nextKeys);
|
|
5216
|
+
},
|
|
5217
|
+
onClick: (event) => event.stopPropagation()
|
|
5218
|
+
}
|
|
5219
|
+
) }) : null }) : null,
|
|
4742
5220
|
hasExpandableColumn ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AdsTableHead, { className: "w-12 p-2" }) : null,
|
|
4743
5221
|
resolvedColumns.map((column, index) => {
|
|
4744
5222
|
const columnKey = getColumnKey(column, index);
|
|
4745
5223
|
const columnSortOrder = sortState?.columnKey === columnKey ? sortState.order : column.sortOrder ?? null;
|
|
4746
|
-
if (column.sorter) {
|
|
4747
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4748
|
-
AdsTableSortHeader,
|
|
4749
|
-
{
|
|
4750
|
-
className: cn(density.head, column.className),
|
|
4751
|
-
onToggleSort: (nextOrder) => handleSortChange(column, columnKey, nextOrder),
|
|
4752
|
-
sortOrder: columnSortOrder,
|
|
4753
|
-
style: getCellStyle(column),
|
|
4754
|
-
title: column.title ?? columnKey
|
|
4755
|
-
},
|
|
4756
|
-
columnKey
|
|
4757
|
-
);
|
|
4758
|
-
}
|
|
4759
5224
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4760
5225
|
AdsTableHead,
|
|
4761
5226
|
{
|
|
4762
|
-
className: cn(density.head, column.className),
|
|
4763
|
-
style: getCellStyle(column),
|
|
4764
|
-
children: column
|
|
5227
|
+
className: cn(density.head, column.className, column.headerClassName),
|
|
5228
|
+
style: getCellStyle(column, getColumnWidthOverride(column, columnKey)),
|
|
5229
|
+
children: renderColumnHeader(column, columnKey, columnSortOrder)
|
|
4765
5230
|
},
|
|
4766
5231
|
columnKey
|
|
4767
5232
|
);
|
|
@@ -4786,12 +5251,24 @@ function AdsDataTable({
|
|
|
4786
5251
|
const row = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
4787
5252
|
AdsTableRow,
|
|
4788
5253
|
{
|
|
4789
|
-
className: cn(
|
|
5254
|
+
className: cn(
|
|
5255
|
+
dataRowClassName,
|
|
5256
|
+
onRowClick ? "cursor-pointer" : void 0
|
|
5257
|
+
),
|
|
4790
5258
|
"data-state": selectedKeys.includes(recordKey) ? "selected" : void 0,
|
|
4791
|
-
onClick: () => {
|
|
5259
|
+
onClick: (event) => {
|
|
5260
|
+
if (shouldIgnoreRowClick(event)) {
|
|
5261
|
+
return;
|
|
5262
|
+
}
|
|
5263
|
+
if (onRowClick) {
|
|
5264
|
+
toggleSelectionFromRowClick(record, recordKey);
|
|
5265
|
+
onRowClick(record, index, event);
|
|
5266
|
+
return;
|
|
5267
|
+
}
|
|
4792
5268
|
if (expandable?.expandRowByClick && canExpand) {
|
|
4793
5269
|
toggleExpanded(record, recordKey);
|
|
4794
5270
|
}
|
|
5271
|
+
toggleSelectionFromRowClick(record, recordKey);
|
|
4795
5272
|
},
|
|
4796
5273
|
children: [
|
|
4797
5274
|
hasSelectionColumn ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
@@ -4819,13 +5296,22 @@ function AdsDataTable({
|
|
|
4819
5296
|
}
|
|
4820
5297
|
) : null,
|
|
4821
5298
|
resolvedColumns.map((column, columnIndex) => {
|
|
4822
|
-
const
|
|
4823
|
-
|
|
5299
|
+
const renderedValue = renderCellValue(
|
|
5300
|
+
resolveRenderedCellContent(column, record, index),
|
|
5301
|
+
column.ellipsis
|
|
5302
|
+
);
|
|
4824
5303
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4825
5304
|
AdsTableCell,
|
|
4826
5305
|
{
|
|
4827
|
-
className: cn(
|
|
4828
|
-
|
|
5306
|
+
className: cn(
|
|
5307
|
+
density.cell,
|
|
5308
|
+
column.className,
|
|
5309
|
+
column.cellClassName
|
|
5310
|
+
),
|
|
5311
|
+
style: getCellStyle(
|
|
5312
|
+
column,
|
|
5313
|
+
getColumnWidthOverride(column, getColumnKey(column, columnIndex))
|
|
5314
|
+
),
|
|
4829
5315
|
children: renderedValue
|
|
4830
5316
|
},
|
|
4831
5317
|
`${String(recordKey)}-${getColumnKey(column, columnIndex)}`
|
|
@@ -4882,10 +5368,12 @@ function AdsDataTable({
|
|
|
4882
5368
|
onPageSizeChange: handlePageSizeChange,
|
|
4883
5369
|
pageSize: currentPageSize,
|
|
4884
5370
|
pageSizeOptions: pagination.pageSizeOptions,
|
|
5371
|
+
showFirstLast: pagination.showFirstLast,
|
|
4885
5372
|
showQuickJumper: pagination.showQuickJumper,
|
|
4886
5373
|
showSizeChanger: pagination.showSizeChanger,
|
|
4887
5374
|
showTotal: pagination.showTotal,
|
|
4888
|
-
total: resolvedTotal
|
|
5375
|
+
total: resolvedTotal,
|
|
5376
|
+
variant: pagination.variant
|
|
4889
5377
|
}
|
|
4890
5378
|
) }) : null
|
|
4891
5379
|
] });
|
|
@@ -4910,21 +5398,150 @@ function AdsDataTable({
|
|
|
4910
5398
|
return tableNode;
|
|
4911
5399
|
}
|
|
4912
5400
|
|
|
5401
|
+
// src/components/AdsDataTableToolbar/index.tsx
|
|
5402
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5403
|
+
function AdsDataTableToolbar({
|
|
5404
|
+
action,
|
|
5405
|
+
className,
|
|
5406
|
+
searchClassName,
|
|
5407
|
+
searchPlaceholder,
|
|
5408
|
+
searchValue = "",
|
|
5409
|
+
title,
|
|
5410
|
+
titleClassName,
|
|
5411
|
+
onSearchChange,
|
|
5412
|
+
onSearchClear
|
|
5413
|
+
}) {
|
|
5414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5415
|
+
"div",
|
|
5416
|
+
{
|
|
5417
|
+
className: cn(
|
|
5418
|
+
"flex flex-col gap-md px-6 pb-4 pt-6 md:flex-row md:items-center md:justify-between",
|
|
5419
|
+
className
|
|
5420
|
+
),
|
|
5421
|
+
children: [
|
|
5422
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "min-w-0 flex-1", children: title ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { className: cn("truncate text-xl font-medium text-white", titleClassName), children: title }) : null }),
|
|
5423
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex w-full flex-col gap-sm md:min-w-0 md:flex-1 md:flex-row md:items-center md:justify-end", children: [
|
|
5424
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "min-w-0 md:max-w-[440px] md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5425
|
+
AdsInput,
|
|
5426
|
+
{
|
|
5427
|
+
className: cn(
|
|
5428
|
+
"border-[#27282F] bg-[#27282F] text-white placeholder:text-[#848484]",
|
|
5429
|
+
searchClassName
|
|
5430
|
+
),
|
|
5431
|
+
clearable: true,
|
|
5432
|
+
onChange: (event) => onSearchChange?.(event.target.value),
|
|
5433
|
+
onClear: onSearchClear,
|
|
5434
|
+
placeholder: searchPlaceholder,
|
|
5435
|
+
value: searchValue
|
|
5436
|
+
}
|
|
5437
|
+
) }),
|
|
5438
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "shrink-0", children: action }) : null
|
|
5439
|
+
] })
|
|
5440
|
+
]
|
|
5441
|
+
}
|
|
5442
|
+
);
|
|
5443
|
+
}
|
|
5444
|
+
|
|
5445
|
+
// src/components/AdsViewCustomersDataTable/index.tsx
|
|
5446
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5447
|
+
function resolveHeight(value) {
|
|
5448
|
+
if (value === void 0) {
|
|
5449
|
+
return 500;
|
|
5450
|
+
}
|
|
5451
|
+
return value;
|
|
5452
|
+
}
|
|
5453
|
+
function AdsViewCustomersDataTable({
|
|
5454
|
+
columns,
|
|
5455
|
+
dataSource = [],
|
|
5456
|
+
emptyState,
|
|
5457
|
+
error = false,
|
|
5458
|
+
errorDescription = "Try again or adjust the current query.",
|
|
5459
|
+
errorState,
|
|
5460
|
+
errorTitle = "Unable to load records",
|
|
5461
|
+
height = 500,
|
|
5462
|
+
loading = false,
|
|
5463
|
+
pagination = false,
|
|
5464
|
+
retryLabel = "Retry",
|
|
5465
|
+
rowKey,
|
|
5466
|
+
scroll,
|
|
5467
|
+
searchPlaceholder = "Search customers",
|
|
5468
|
+
searchValue = "",
|
|
5469
|
+
sticky = true,
|
|
5470
|
+
title,
|
|
5471
|
+
toolbarAction,
|
|
5472
|
+
onRetry,
|
|
5473
|
+
onSearchChange,
|
|
5474
|
+
onSearchClear,
|
|
5475
|
+
...props
|
|
5476
|
+
}) {
|
|
5477
|
+
const tableHeight = resolveHeight(height);
|
|
5478
|
+
const resolvedErrorState = errorState ?? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex min-h-[500px] flex-col items-center justify-center gap-3 px-6 py-12 text-center", children: [
|
|
5479
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-sm font-medium text-white", children: errorTitle }),
|
|
5480
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "max-w-md text-sm text-[#848484]", children: errorDescription }),
|
|
5481
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AdsButton, { intent: "primary", onClick: onRetry, children: retryLabel }) : null
|
|
5482
|
+
] });
|
|
5483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "overflow-hidden rounded-xl border border-[#27282F] bg-[#1B1C21]", children: [
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5485
|
+
AdsDataTableToolbar,
|
|
5486
|
+
{
|
|
5487
|
+
action: toolbarAction,
|
|
5488
|
+
onSearchChange,
|
|
5489
|
+
onSearchClear,
|
|
5490
|
+
searchPlaceholder,
|
|
5491
|
+
searchValue,
|
|
5492
|
+
title
|
|
5493
|
+
}
|
|
5494
|
+
),
|
|
5495
|
+
error ? resolvedErrorState : null,
|
|
5496
|
+
!error ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5497
|
+
AdsDataTable,
|
|
5498
|
+
{
|
|
5499
|
+
...props,
|
|
5500
|
+
className: cn(
|
|
5501
|
+
"rounded-none border-0 bg-[#1B1C21]",
|
|
5502
|
+
"[&_thead_th]:border-b-[#27282F] [&_thead_th]:bg-[#27282F] [&_thead_th]:text-[14px] [&_thead_th]:leading-5",
|
|
5503
|
+
"[&_tbody_td]:border-b-[#27282F] [&_tbody_td]:text-[14px] [&_tbody_td]:leading-5",
|
|
5504
|
+
"[&_tbody_tr:hover]:!bg-[#333333]",
|
|
5505
|
+
"[&_[data-slot='ads-table-root']]:bg-[#1B1C21]",
|
|
5506
|
+
"[&_[data-slot='ads-table-root']]:text-white",
|
|
5507
|
+
"[&_[data-slot='ads-table-scroll-area']]:bg-[#1B1C21]"
|
|
5508
|
+
),
|
|
5509
|
+
columns,
|
|
5510
|
+
dataSource,
|
|
5511
|
+
emptyState,
|
|
5512
|
+
loading,
|
|
5513
|
+
pagination: pagination === false ? false : {
|
|
5514
|
+
...pagination,
|
|
5515
|
+
showFirstLast: true,
|
|
5516
|
+
variant: "compact"
|
|
5517
|
+
},
|
|
5518
|
+
rowKey,
|
|
5519
|
+
scroll: {
|
|
5520
|
+
...scroll,
|
|
5521
|
+
y: scroll?.y ?? tableHeight
|
|
5522
|
+
},
|
|
5523
|
+
sticky,
|
|
5524
|
+
tableClassName: "[&_td]:text-white [&_th]:text-white"
|
|
5525
|
+
}
|
|
5526
|
+
) : null
|
|
5527
|
+
] });
|
|
5528
|
+
}
|
|
5529
|
+
|
|
4913
5530
|
// src/components/AdsProgress/index.tsx
|
|
4914
5531
|
var React43 = __toESM(require("react"), 1);
|
|
4915
5532
|
|
|
4916
5533
|
// src/primitives/progress.tsx
|
|
4917
5534
|
var React42 = __toESM(require("react"), 1);
|
|
4918
5535
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"), 1);
|
|
4919
|
-
var
|
|
4920
|
-
var Progress = React42.forwardRef(({ className, indicatorClassName, value, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5536
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5537
|
+
var Progress = React42.forwardRef(({ className, indicatorClassName, value, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4921
5538
|
ProgressPrimitive.Root,
|
|
4922
5539
|
{
|
|
4923
5540
|
className: cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className),
|
|
4924
5541
|
ref,
|
|
4925
5542
|
value,
|
|
4926
5543
|
...props,
|
|
4927
|
-
children: /* @__PURE__ */ (0,
|
|
5544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4928
5545
|
ProgressPrimitive.Indicator,
|
|
4929
5546
|
{
|
|
4930
5547
|
className: cn("h-full w-full flex-1 bg-primary transition-all", indicatorClassName),
|
|
@@ -4936,13 +5553,13 @@ var Progress = React42.forwardRef(({ className, indicatorClassName, value, ...pr
|
|
|
4936
5553
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
4937
5554
|
|
|
4938
5555
|
// src/components/AdsProgress/index.tsx
|
|
4939
|
-
var
|
|
5556
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4940
5557
|
var progressBaseClassName = "h-2 rounded-radius-full bg-[color:color-mix(in_srgb,var(--primary)_20%,transparent)]";
|
|
4941
5558
|
var progressIndicatorVariantClassName = {
|
|
4942
5559
|
ai: "bg-brand-gradient",
|
|
4943
5560
|
default: "bg-primary"
|
|
4944
5561
|
};
|
|
4945
|
-
var Progress2 = React43.forwardRef(({ className, indicatorClassName, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5562
|
+
var Progress2 = React43.forwardRef(({ className, indicatorClassName, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4946
5563
|
Progress,
|
|
4947
5564
|
{
|
|
4948
5565
|
className: cn(progressBaseClassName, className),
|
|
@@ -4971,12 +5588,12 @@ var AdsProgress = React43.forwardRef(
|
|
|
4971
5588
|
id
|
|
4972
5589
|
});
|
|
4973
5590
|
const labelId = label ? `${description.inputId}-label` : void 0;
|
|
4974
|
-
const helperNode = helperText ? /* @__PURE__ */ (0,
|
|
4975
|
-
const errorNode = errorText ? /* @__PURE__ */ (0,
|
|
4976
|
-
return /* @__PURE__ */ (0,
|
|
4977
|
-
label ? /* @__PURE__ */ (0,
|
|
5591
|
+
const helperNode = helperText ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AdsFieldDescription, { id: description.helperId, children: helperText }) : null;
|
|
5592
|
+
const errorNode = errorText ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AdsFieldError, { id: description.errorId, children: errorText }) : null;
|
|
5593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(AdsFieldItem, { children: [
|
|
5594
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AdsFieldLabel, { id: labelId, children: label }) : null,
|
|
4978
5595
|
descriptionPlacement === "above" ? helperNode : null,
|
|
4979
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4980
5597
|
Progress,
|
|
4981
5598
|
{
|
|
4982
5599
|
"aria-describedby": description.describedBy,
|
|
@@ -5005,8 +5622,8 @@ var React45 = __toESM(require("react"), 1);
|
|
|
5005
5622
|
// src/primitives/slider.tsx
|
|
5006
5623
|
var React44 = __toESM(require("react"), 1);
|
|
5007
5624
|
var SliderPrimitive = __toESM(require("@radix-ui/react-slider"), 1);
|
|
5008
|
-
var
|
|
5009
|
-
var Slider = React44.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5625
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5626
|
+
var Slider = React44.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
5010
5627
|
SliderPrimitive.Root,
|
|
5011
5628
|
{
|
|
5012
5629
|
ref,
|
|
@@ -5016,10 +5633,10 @@ var Slider = React44.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5016
5633
|
),
|
|
5017
5634
|
...props,
|
|
5018
5635
|
children: [
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5636
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
|
|
5020
5637
|
Array.from({
|
|
5021
5638
|
length: Array.isArray(props.value) ? props.value.length : Array.isArray(props.defaultValue) ? props.defaultValue.length : 1
|
|
5022
|
-
}).map((_, index) => /* @__PURE__ */ (0,
|
|
5639
|
+
}).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5023
5640
|
SliderPrimitive.Thumb,
|
|
5024
5641
|
{
|
|
5025
5642
|
className: "block h-5 w-5 rounded-full border border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
@@ -5032,9 +5649,9 @@ var Slider = React44.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5032
5649
|
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
5033
5650
|
|
|
5034
5651
|
// src/components/AdsSlider/index.tsx
|
|
5035
|
-
var
|
|
5652
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5036
5653
|
var sliderBaseClassName = "py-1";
|
|
5037
|
-
var Slider2 = React45.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5654
|
+
var Slider2 = React45.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Slider, { className: cn(sliderBaseClassName, className), ref, ...props }));
|
|
5038
5655
|
Slider2.displayName = "Slider";
|
|
5039
5656
|
var AdsSlider = React45.forwardRef(
|
|
5040
5657
|
({
|
|
@@ -5051,12 +5668,12 @@ var AdsSlider = React45.forwardRef(
|
|
|
5051
5668
|
helperText,
|
|
5052
5669
|
id
|
|
5053
5670
|
});
|
|
5054
|
-
const helperNode = helperText ? /* @__PURE__ */ (0,
|
|
5055
|
-
const errorNode = errorText ? /* @__PURE__ */ (0,
|
|
5056
|
-
return /* @__PURE__ */ (0,
|
|
5057
|
-
label ? /* @__PURE__ */ (0,
|
|
5671
|
+
const helperNode = helperText ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(AdsFieldDescription, { id: description.helperId, children: helperText }) : null;
|
|
5672
|
+
const errorNode = errorText ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(AdsFieldError, { id: description.errorId, children: errorText }) : null;
|
|
5673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(AdsFieldItem, { children: [
|
|
5674
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(AdsFieldLabel, { children: label }) : null,
|
|
5058
5675
|
descriptionPlacement === "above" ? helperNode : null,
|
|
5059
|
-
/* @__PURE__ */ (0,
|
|
5676
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5060
5677
|
Slider2,
|
|
5061
5678
|
{
|
|
5062
5679
|
"aria-describedby": description.describedBy,
|
|
@@ -5078,8 +5695,8 @@ var React47 = __toESM(require("react"), 1);
|
|
|
5078
5695
|
// src/primitives/switch.tsx
|
|
5079
5696
|
var React46 = __toESM(require("react"), 1);
|
|
5080
5697
|
var SwitchPrimitives = __toESM(require("@radix-ui/react-switch"), 1);
|
|
5081
|
-
var
|
|
5082
|
-
var Switch = React46.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5698
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5699
|
+
var Switch = React46.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5083
5700
|
SwitchPrimitives.Root,
|
|
5084
5701
|
{
|
|
5085
5702
|
className: cn(
|
|
@@ -5088,7 +5705,7 @@ var Switch = React46.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5088
5705
|
),
|
|
5089
5706
|
...props,
|
|
5090
5707
|
ref,
|
|
5091
|
-
children: /* @__PURE__ */ (0,
|
|
5708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5092
5709
|
SwitchPrimitives.Thumb,
|
|
5093
5710
|
{
|
|
5094
5711
|
className: cn(
|
|
@@ -5101,15 +5718,15 @@ var Switch = React46.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5101
5718
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
5102
5719
|
|
|
5103
5720
|
// src/components/AdsSwitch/index.tsx
|
|
5104
|
-
var
|
|
5721
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5105
5722
|
var switchBaseClassName = "h-6 w-11 border border-transparent bg-muted shadow-[0px_1px_2px_rgba(0,0,0,0.1)] focus-visible:ring-[3px] focus-visible:ring-[rgba(161,161,161,0.5)] focus-visible:ring-offset-0 data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted";
|
|
5106
|
-
var Switch2 = React47.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5723
|
+
var Switch2 = React47.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Switch, { className: cn(switchBaseClassName, className), ref, ...props }));
|
|
5107
5724
|
Switch2.displayName = "Switch";
|
|
5108
5725
|
var AdsSwitch = React47.forwardRef(({ className, description, id, label, switchClassName, wrapperClassName, ...props }, ref) => {
|
|
5109
5726
|
const generatedId = React47.useId();
|
|
5110
5727
|
const inputId = id ?? generatedId;
|
|
5111
5728
|
if (!label) {
|
|
5112
|
-
return /* @__PURE__ */ (0,
|
|
5729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5113
5730
|
Switch2,
|
|
5114
5731
|
{
|
|
5115
5732
|
className: cn(className, switchClassName),
|
|
@@ -5119,12 +5736,12 @@ var AdsSwitch = React47.forwardRef(({ className, description, id, label, switchC
|
|
|
5119
5736
|
}
|
|
5120
5737
|
);
|
|
5121
5738
|
}
|
|
5122
|
-
return /* @__PURE__ */ (0,
|
|
5123
|
-
/* @__PURE__ */ (0,
|
|
5124
|
-
/* @__PURE__ */ (0,
|
|
5125
|
-
description ? /* @__PURE__ */ (0,
|
|
5739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: cn("block w-full cursor-pointer", wrapperClassName), htmlFor: inputId, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex w-full items-start gap-3", children: [
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5 pt-0.5", children: [
|
|
5741
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "text-sm font-medium leading-5 text-foreground", children: label }),
|
|
5742
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(AdsFieldDescription, { className: "text-sm leading-5", children: description }) : null
|
|
5126
5743
|
] }),
|
|
5127
|
-
/* @__PURE__ */ (0,
|
|
5744
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5128
5745
|
Switch2,
|
|
5129
5746
|
{
|
|
5130
5747
|
className: cn(className, switchClassName),
|
|
@@ -5143,9 +5760,9 @@ var React49 = __toESM(require("react"), 1);
|
|
|
5143
5760
|
// src/primitives/tabs.tsx
|
|
5144
5761
|
var React48 = __toESM(require("react"), 1);
|
|
5145
5762
|
var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
5146
|
-
var
|
|
5763
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5147
5764
|
var Tabs = TabsPrimitive.Root;
|
|
5148
|
-
var TabsList = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5765
|
+
var TabsList = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5149
5766
|
TabsPrimitive.List,
|
|
5150
5767
|
{
|
|
5151
5768
|
className: cn("inline-flex items-center", className),
|
|
@@ -5154,7 +5771,7 @@ var TabsList = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
5154
5771
|
}
|
|
5155
5772
|
));
|
|
5156
5773
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
5157
|
-
var TabsTrigger = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5774
|
+
var TabsTrigger = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5158
5775
|
TabsPrimitive.Trigger,
|
|
5159
5776
|
{
|
|
5160
5777
|
className: cn(
|
|
@@ -5166,7 +5783,7 @@ var TabsTrigger = React48.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5166
5783
|
}
|
|
5167
5784
|
));
|
|
5168
5785
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
5169
|
-
var TabsContent = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5786
|
+
var TabsContent = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5170
5787
|
TabsPrimitive.Content,
|
|
5171
5788
|
{
|
|
5172
5789
|
className: cn("focus-visible:outline-none", className),
|
|
@@ -5177,9 +5794,9 @@ var TabsContent = React48.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5177
5794
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
5178
5795
|
|
|
5179
5796
|
// src/components/AdsTabs/index.tsx
|
|
5180
|
-
var
|
|
5797
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5181
5798
|
var AdsTabs = Tabs;
|
|
5182
|
-
var AdsTabsList = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5799
|
+
var AdsTabsList = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5183
5800
|
TabsList,
|
|
5184
5801
|
{
|
|
5185
5802
|
className: cn(
|
|
@@ -5191,7 +5808,7 @@ var AdsTabsList = React49.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5191
5808
|
}
|
|
5192
5809
|
));
|
|
5193
5810
|
AdsTabsList.displayName = "AdsTabsList";
|
|
5194
|
-
var AdsTabsTrigger = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5811
|
+
var AdsTabsTrigger = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5195
5812
|
TabsTrigger,
|
|
5196
5813
|
{
|
|
5197
5814
|
className: cn(
|
|
@@ -5203,7 +5820,7 @@ var AdsTabsTrigger = React49.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
5203
5820
|
}
|
|
5204
5821
|
));
|
|
5205
5822
|
AdsTabsTrigger.displayName = "AdsTabsTrigger";
|
|
5206
|
-
var AdsTabsContent = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5823
|
+
var AdsTabsContent = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5207
5824
|
TabsContent,
|
|
5208
5825
|
{
|
|
5209
5826
|
className: cn(
|
|
@@ -5222,8 +5839,8 @@ var React51 = __toESM(require("react"), 1);
|
|
|
5222
5839
|
// src/primitives/toggle.tsx
|
|
5223
5840
|
var React50 = __toESM(require("react"), 1);
|
|
5224
5841
|
var TogglePrimitive = __toESM(require("@radix-ui/react-toggle"), 1);
|
|
5225
|
-
var
|
|
5226
|
-
var Toggle = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5842
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5843
|
+
var Toggle = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5227
5844
|
TogglePrimitive.Root,
|
|
5228
5845
|
{
|
|
5229
5846
|
className: cn(
|
|
@@ -5237,7 +5854,7 @@ var Toggle = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5237
5854
|
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
5238
5855
|
|
|
5239
5856
|
// src/components/AdsToggle/index.tsx
|
|
5240
|
-
var
|
|
5857
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5241
5858
|
var sizeClassName3 = {
|
|
5242
5859
|
sm: "!h-8 px-[6px] text-sm",
|
|
5243
5860
|
md: "!h-9 px-md text-sm",
|
|
@@ -5255,7 +5872,7 @@ var variantClassName = {
|
|
|
5255
5872
|
var AdsToggle = React51.forwardRef(({ children, className, size = "md", variant = "default", ...props }, ref) => {
|
|
5256
5873
|
const childCount = React51.Children.count(children);
|
|
5257
5874
|
const isIconOnly = childCount === 1 && React51.isValidElement(children);
|
|
5258
|
-
return /* @__PURE__ */ (0,
|
|
5875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5259
5876
|
Toggle,
|
|
5260
5877
|
{
|
|
5261
5878
|
className: cn(
|
|
@@ -5279,8 +5896,8 @@ var React53 = __toESM(require("react"), 1);
|
|
|
5279
5896
|
// src/primitives/toggle-group.tsx
|
|
5280
5897
|
var React52 = __toESM(require("react"), 1);
|
|
5281
5898
|
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"), 1);
|
|
5282
|
-
var
|
|
5283
|
-
var ToggleGroup = React52.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5899
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5900
|
+
var ToggleGroup = React52.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5284
5901
|
ToggleGroupPrimitive.Root,
|
|
5285
5902
|
{
|
|
5286
5903
|
className: cn("inline-flex items-center justify-start", className),
|
|
@@ -5289,7 +5906,7 @@ var ToggleGroup = React52.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5289
5906
|
}
|
|
5290
5907
|
));
|
|
5291
5908
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
5292
|
-
var ToggleGroupItem = React52.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5909
|
+
var ToggleGroupItem = React52.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5293
5910
|
ToggleGroupPrimitive.Item,
|
|
5294
5911
|
{
|
|
5295
5912
|
className: cn(
|
|
@@ -5303,7 +5920,7 @@ var ToggleGroupItem = React52.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
5303
5920
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
5304
5921
|
|
|
5305
5922
|
// src/components/AdsToggleGroup/index.tsx
|
|
5306
|
-
var
|
|
5923
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5307
5924
|
var sizeClassName4 = {
|
|
5308
5925
|
sm: "h-8 min-w-7 px-[6px] text-sm",
|
|
5309
5926
|
md: "h-9 min-w-[34px] px-md text-sm",
|
|
@@ -5322,7 +5939,7 @@ var AdsToggleGroup = React53.forwardRef(
|
|
|
5322
5939
|
size = "md",
|
|
5323
5940
|
variant = "default",
|
|
5324
5941
|
...props
|
|
5325
|
-
}, ref) => /* @__PURE__ */ (0,
|
|
5942
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(AdsToggleGroupContext.Provider, { value: { orientation, size, variant }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5326
5943
|
ToggleGroup,
|
|
5327
5944
|
{
|
|
5328
5945
|
className: cn(
|
|
@@ -5343,7 +5960,7 @@ var AdsToggleGroupItem = React53.forwardRef(({ className, size, variant, ...prop
|
|
|
5343
5960
|
const resolvedOrientation = context?.orientation ?? "horizontal";
|
|
5344
5961
|
const resolvedSize = size ?? context?.size ?? "md";
|
|
5345
5962
|
const resolvedVariant = variant ?? context?.variant ?? "default";
|
|
5346
|
-
return /* @__PURE__ */ (0,
|
|
5963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5347
5964
|
ToggleGroupItem,
|
|
5348
5965
|
{
|
|
5349
5966
|
className: cn(
|
|
@@ -5362,7 +5979,7 @@ AdsToggleGroupItem.displayName = "AdsToggleGroupItem";
|
|
|
5362
5979
|
|
|
5363
5980
|
// src/components/AdsTextarea/index.tsx
|
|
5364
5981
|
var React54 = __toESM(require("react"), 1);
|
|
5365
|
-
var
|
|
5982
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5366
5983
|
var textareaBaseClassName = "w-full rounded-radius-md border border-border bg-card px-md py-md text-base leading-6 shadow-[0px_1px_2px_rgba(0,0,0,0.1)] placeholder:text-[var(--muted-foreground)] focus-visible:border-border-focus focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[rgba(161,161,161,0.5)] focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50";
|
|
5367
5984
|
var AdsTextarea = React54.forwardRef(
|
|
5368
5985
|
({
|
|
@@ -5383,12 +6000,12 @@ var AdsTextarea = React54.forwardRef(
|
|
|
5383
6000
|
helperText,
|
|
5384
6001
|
id
|
|
5385
6002
|
});
|
|
5386
|
-
const helperNode = helperText ? /* @__PURE__ */ (0,
|
|
5387
|
-
const errorNode = errorText ? /* @__PURE__ */ (0,
|
|
5388
|
-
return /* @__PURE__ */ (0,
|
|
5389
|
-
label ? /* @__PURE__ */ (0,
|
|
6003
|
+
const helperNode = helperText ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(AdsFieldDescription, { id: description.helperId, children: helperText }) : null;
|
|
6004
|
+
const errorNode = errorText ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(AdsFieldError, { id: description.errorId, children: errorText }) : null;
|
|
6005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(AdsFieldItem, { children: [
|
|
6006
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(AdsFieldLabel, { htmlFor: description.inputId, children: label }) : null,
|
|
5390
6007
|
descriptionPlacement === "above" ? helperNode : null,
|
|
5391
|
-
/* @__PURE__ */ (0,
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5392
6009
|
Textarea,
|
|
5393
6010
|
{
|
|
5394
6011
|
"aria-describedby": description.describedBy,
|
|
@@ -5406,7 +6023,7 @@ var AdsTextarea = React54.forwardRef(
|
|
|
5406
6023
|
...props
|
|
5407
6024
|
}
|
|
5408
6025
|
),
|
|
5409
|
-
action ? /* @__PURE__ */ (0,
|
|
6026
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "w-full [&>*]:w-full", children: action }) : null,
|
|
5410
6027
|
descriptionPlacement === "below" ? helperNode : null,
|
|
5411
6028
|
errorNode
|
|
5412
6029
|
] });
|
|
@@ -5420,12 +6037,12 @@ var React56 = __toESM(require("react"), 1);
|
|
|
5420
6037
|
// src/primitives/tooltip.tsx
|
|
5421
6038
|
var React55 = __toESM(require("react"), 1);
|
|
5422
6039
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
5423
|
-
var
|
|
6040
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5424
6041
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
5425
6042
|
var Tooltip = TooltipPrimitive.Root;
|
|
5426
6043
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
5427
6044
|
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
5428
|
-
var TooltipContent = React55.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6045
|
+
var TooltipContent = React55.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5429
6046
|
TooltipPrimitive.Content,
|
|
5430
6047
|
{
|
|
5431
6048
|
className: cn(
|
|
@@ -5440,12 +6057,12 @@ var TooltipContent = React55.forwardRef(({ className, sideOffset = 4, ...props }
|
|
|
5440
6057
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
5441
6058
|
|
|
5442
6059
|
// src/components/AdsTooltip/index.tsx
|
|
5443
|
-
var
|
|
6060
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5444
6061
|
var tooltipContentClassName = "z-50 rounded-[6px] border-0 bg-[#844fff] px-3 py-2 text-sm font-normal leading-5 text-[#fdfdfd] shadow-[0px_8px_24px_rgba(0,0,0,0.22)]";
|
|
5445
6062
|
var AdsTooltipProvider = TooltipProvider;
|
|
5446
6063
|
var AdsTooltip = Tooltip;
|
|
5447
6064
|
var AdsTooltipTrigger = TooltipTrigger;
|
|
5448
|
-
var AdsTooltipContent = React56.forwardRef(({ align = "center", className, sideOffset = 10, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6065
|
+
var AdsTooltipContent = React56.forwardRef(({ align = "center", className, sideOffset = 10, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5449
6066
|
TooltipContent,
|
|
5450
6067
|
{
|
|
5451
6068
|
align,
|
|
@@ -5456,7 +6073,7 @@ var AdsTooltipContent = React56.forwardRef(({ align = "center", className, sideO
|
|
|
5456
6073
|
}
|
|
5457
6074
|
));
|
|
5458
6075
|
AdsTooltipContent.displayName = "AdsTooltipContent";
|
|
5459
|
-
var AdsTooltipArrow = React56.forwardRef(({ className, height = 5, width = 10, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6076
|
+
var AdsTooltipArrow = React56.forwardRef(({ className, height = 5, width = 10, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5460
6077
|
TooltipArrow,
|
|
5461
6078
|
{
|
|
5462
6079
|
className: cn("fill-[#844fff]", className),
|
|
@@ -5470,15 +6087,15 @@ AdsTooltipArrow.displayName = "AdsTooltipArrow";
|
|
|
5470
6087
|
|
|
5471
6088
|
// src/components/AdsToast/index.tsx
|
|
5472
6089
|
var React57 = __toESM(require("react"), 1);
|
|
5473
|
-
var
|
|
6090
|
+
var import_lucide_react18 = require("lucide-react");
|
|
5474
6091
|
var import_sonner = require("sonner");
|
|
5475
|
-
var
|
|
6092
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
5476
6093
|
var adsToastIconMap = {
|
|
5477
|
-
success:
|
|
5478
|
-
info:
|
|
5479
|
-
warning:
|
|
5480
|
-
error:
|
|
5481
|
-
loading:
|
|
6094
|
+
success: import_lucide_react18.CircleCheck,
|
|
6095
|
+
info: import_lucide_react18.Info,
|
|
6096
|
+
warning: import_lucide_react18.TriangleAlert,
|
|
6097
|
+
error: import_lucide_react18.OctagonX,
|
|
6098
|
+
loading: import_lucide_react18.LoaderCircle
|
|
5482
6099
|
};
|
|
5483
6100
|
function resolveToastIcon(intent, icon) {
|
|
5484
6101
|
if (icon) {
|
|
@@ -5488,7 +6105,7 @@ function resolveToastIcon(intent, icon) {
|
|
|
5488
6105
|
return null;
|
|
5489
6106
|
}
|
|
5490
6107
|
const Icon2 = adsToastIconMap[intent];
|
|
5491
|
-
return /* @__PURE__ */ (0,
|
|
6108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5492
6109
|
Icon2,
|
|
5493
6110
|
{
|
|
5494
6111
|
"aria-hidden": true,
|
|
@@ -5512,7 +6129,7 @@ var AdsToast = React57.forwardRef(
|
|
|
5512
6129
|
...props
|
|
5513
6130
|
}, ref) => {
|
|
5514
6131
|
const resolvedIcon = resolveToastIcon(intent, icon);
|
|
5515
|
-
return /* @__PURE__ */ (0,
|
|
6132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
5516
6133
|
"div",
|
|
5517
6134
|
{
|
|
5518
6135
|
className: cn(
|
|
@@ -5527,8 +6144,8 @@ var AdsToast = React57.forwardRef(
|
|
|
5527
6144
|
...props,
|
|
5528
6145
|
children: [
|
|
5529
6146
|
resolvedIcon,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
6147
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
6148
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5532
6149
|
"p",
|
|
5533
6150
|
{
|
|
5534
6151
|
className: cn(
|
|
@@ -5538,7 +6155,7 @@ var AdsToast = React57.forwardRef(
|
|
|
5538
6155
|
children: title
|
|
5539
6156
|
}
|
|
5540
6157
|
),
|
|
5541
|
-
description ? /* @__PURE__ */ (0,
|
|
6158
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5542
6159
|
"p",
|
|
5543
6160
|
{
|
|
5544
6161
|
className: cn(
|
|
@@ -5549,7 +6166,7 @@ var AdsToast = React57.forwardRef(
|
|
|
5549
6166
|
}
|
|
5550
6167
|
) : null
|
|
5551
6168
|
] }),
|
|
5552
|
-
action ? /* @__PURE__ */ (0,
|
|
6169
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5553
6170
|
AdsButton,
|
|
5554
6171
|
{
|
|
5555
6172
|
className: "shrink-0 rounded-radius-lg",
|
|
@@ -5575,7 +6192,7 @@ function AdsToaster({
|
|
|
5575
6192
|
...props
|
|
5576
6193
|
}) {
|
|
5577
6194
|
const { messages } = useAdsI18n();
|
|
5578
|
-
return /* @__PURE__ */ (0,
|
|
6195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5579
6196
|
import_sonner.Toaster,
|
|
5580
6197
|
{
|
|
5581
6198
|
closeButton: false,
|
|
@@ -5593,7 +6210,7 @@ function AdsToaster({
|
|
|
5593
6210
|
);
|
|
5594
6211
|
}
|
|
5595
6212
|
function toStageNode(intent, title, options) {
|
|
5596
|
-
return /* @__PURE__ */ (0,
|
|
6213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5597
6214
|
AdsToast,
|
|
5598
6215
|
{
|
|
5599
6216
|
action: options?.action,
|
|
@@ -5607,7 +6224,7 @@ function toStageNode(intent, title, options) {
|
|
|
5607
6224
|
function showAdsToast(intent, title, options) {
|
|
5608
6225
|
const { action, description, icon, ...toastOptions } = options ?? {};
|
|
5609
6226
|
return import_sonner.toast.custom(
|
|
5610
|
-
(id) => /* @__PURE__ */ (0,
|
|
6227
|
+
(id) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5611
6228
|
AdsToast,
|
|
5612
6229
|
{
|
|
5613
6230
|
action: action ? {
|
|
@@ -5663,15 +6280,15 @@ var AdsToastManager = Object.assign(
|
|
|
5663
6280
|
// src/components/AdsDialog/index.tsx
|
|
5664
6281
|
var React58 = __toESM(require("react"), 1);
|
|
5665
6282
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
5666
|
-
var
|
|
5667
|
-
var
|
|
6283
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6284
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
5668
6285
|
var overlayClassName2 = "fixed inset-0 z-50 bg-black/80 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0";
|
|
5669
6286
|
var contentClassName2 = "fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-[423px] -translate-x-1/2 -translate-y-1/2 gap-lg rounded-radius-md border border-border bg-card p-xl shadow-[0px_4px_6px_-4px_rgba(0,0,0,0.1),0px_10px_15px_-3px_rgba(0,0,0,0.1)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]";
|
|
5670
6287
|
var closeButtonClassName = "absolute right-xl top-xl inline-flex h-6 w-6 items-center justify-center rounded-sm opacity-80 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:pointer-events-none";
|
|
5671
6288
|
var Dialog = DialogPrimitive.Root;
|
|
5672
6289
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5673
6290
|
var DialogPortal = DialogPrimitive.Portal;
|
|
5674
|
-
var DialogOverlay = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6291
|
+
var DialogOverlay = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5675
6292
|
DialogPrimitive.Overlay,
|
|
5676
6293
|
{
|
|
5677
6294
|
className: cn(overlayClassName2, className),
|
|
@@ -5680,7 +6297,7 @@ var DialogOverlay = React58.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5680
6297
|
}
|
|
5681
6298
|
));
|
|
5682
6299
|
DialogOverlay.displayName = "DialogOverlay";
|
|
5683
|
-
var DialogClose = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6300
|
+
var DialogClose = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5684
6301
|
DialogPrimitive.Close,
|
|
5685
6302
|
{
|
|
5686
6303
|
className: cn(
|
|
@@ -5696,9 +6313,9 @@ var DialogContent = React58.forwardRef(
|
|
|
5696
6313
|
({ children, className, closeLabel, hideCloseButton = false, ...props }, ref) => {
|
|
5697
6314
|
const { messages } = useAdsI18n();
|
|
5698
6315
|
const resolvedCloseLabel = closeLabel ?? messages.dialog.close;
|
|
5699
|
-
return /* @__PURE__ */ (0,
|
|
5700
|
-
/* @__PURE__ */ (0,
|
|
5701
|
-
/* @__PURE__ */ (0,
|
|
6316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DialogPortal, { children: [
|
|
6317
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DialogOverlay, {}),
|
|
6318
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
5702
6319
|
DialogPrimitive.Content,
|
|
5703
6320
|
{
|
|
5704
6321
|
className: cn(
|
|
@@ -5710,14 +6327,14 @@ var DialogContent = React58.forwardRef(
|
|
|
5710
6327
|
...props,
|
|
5711
6328
|
children: [
|
|
5712
6329
|
children,
|
|
5713
|
-
!hideCloseButton ? /* @__PURE__ */ (0,
|
|
6330
|
+
!hideCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
5714
6331
|
DialogPrimitive.Close,
|
|
5715
6332
|
{
|
|
5716
6333
|
"aria-label": resolvedCloseLabel,
|
|
5717
6334
|
className: cn(closeButtonClassName, adsTextColorClassName.card),
|
|
5718
6335
|
children: [
|
|
5719
|
-
/* @__PURE__ */ (0,
|
|
5720
|
-
/* @__PURE__ */ (0,
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react19.X, { "aria-hidden": true, className: "h-4 w-4" }),
|
|
6337
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "sr-only", children: resolvedCloseLabel })
|
|
5721
6338
|
]
|
|
5722
6339
|
}
|
|
5723
6340
|
) : null
|
|
@@ -5729,7 +6346,7 @@ var DialogContent = React58.forwardRef(
|
|
|
5729
6346
|
);
|
|
5730
6347
|
DialogContent.displayName = "DialogContent";
|
|
5731
6348
|
var DialogHeader = React58.forwardRef(
|
|
5732
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6349
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5733
6350
|
"div",
|
|
5734
6351
|
{
|
|
5735
6352
|
className: cn("flex flex-col gap-sm pr-8 text-left", className),
|
|
@@ -5740,7 +6357,7 @@ var DialogHeader = React58.forwardRef(
|
|
|
5740
6357
|
);
|
|
5741
6358
|
DialogHeader.displayName = "DialogHeader";
|
|
5742
6359
|
var DialogFooter = React58.forwardRef(
|
|
5743
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6360
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5744
6361
|
"div",
|
|
5745
6362
|
{
|
|
5746
6363
|
className: cn(
|
|
@@ -5753,7 +6370,7 @@ var DialogFooter = React58.forwardRef(
|
|
|
5753
6370
|
)
|
|
5754
6371
|
);
|
|
5755
6372
|
DialogFooter.displayName = "DialogFooter";
|
|
5756
|
-
var DialogTitle = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6373
|
+
var DialogTitle = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5757
6374
|
DialogPrimitive.Title,
|
|
5758
6375
|
{
|
|
5759
6376
|
className: cn(
|
|
@@ -5766,7 +6383,7 @@ var DialogTitle = React58.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5766
6383
|
}
|
|
5767
6384
|
));
|
|
5768
6385
|
DialogTitle.displayName = "DialogTitle";
|
|
5769
|
-
var DialogDescription = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
6386
|
+
var DialogDescription = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5770
6387
|
DialogPrimitive.Description,
|
|
5771
6388
|
{
|
|
5772
6389
|
className: cn("text-sm leading-5", adsTextColorClassName.muted, className),
|
|
@@ -5884,6 +6501,7 @@ var designTokens = {
|
|
|
5884
6501
|
AdsCheckbox,
|
|
5885
6502
|
AdsDataPagination,
|
|
5886
6503
|
AdsDataTable,
|
|
6504
|
+
AdsDataTableToolbar,
|
|
5887
6505
|
AdsDatePicker,
|
|
5888
6506
|
AdsDateTimePicker,
|
|
5889
6507
|
AdsDialog,
|
|
@@ -5992,6 +6610,7 @@ var designTokens = {
|
|
|
5992
6610
|
AdsTooltipContent,
|
|
5993
6611
|
AdsTooltipProvider,
|
|
5994
6612
|
AdsTooltipTrigger,
|
|
6613
|
+
AdsViewCustomersDataTable,
|
|
5995
6614
|
adsDefaultMessages,
|
|
5996
6615
|
designTokens,
|
|
5997
6616
|
useAdsI18n
|