@adsgency_npm/adsgency-ads-ui 0.1.0-alpha.11 → 0.1.0-alpha.13
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/chunk-YJFQM6IB.js.map +1 -0
- package/dist/index.cjs +48 -4
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +48 -4
- package/dist/index.js.map +1 -0
- package/dist/tokens/designTokens.cjs.map +1 -0
- package/dist/tokens/designTokens.js.map +1 -0
- package/dist/tokens/tailwindPreset.cjs.map +1 -0
- package/dist/tokens/tailwindPreset.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tokens/designTokens.ts"],"sourcesContent":["export const designTokens = {\n background: \"#151619\",\n foreground: \"#fdfdfd\",\n card: \"#1b1c21\",\n cardForeground: \"#fdfdfd\",\n popover: \"#2a2b2f\",\n popoverForeground: \"#fdfdfd\",\n primary: \"#844fff\",\n primaryForeground: \"#fdfdfd\",\n secondary: \"#3f4043\",\n secondaryForeground: \"#fdfdfd\",\n muted: \"#3f4043\",\n mutedForeground: \"#7e7f81\",\n accent: \"#3f4043\",\n accentForeground: \"#fdfdfd\",\n destructive: \"#dc2626\",\n destructiveForeground: \"#ff9b9b\",\n border: \"#545558\",\n input: \"#151619\",\n ring: \"#a984ff\",\n brandSecondary: \"#af41ff\",\n brandSecondaryForeground: \"#151619\",\n brandGradientFrom: \"#6859ff\",\n brandGradientTo: \"#af41ff\",\n success: \"#008e61\",\n successForeground: \"#fdfdfd\",\n warning: \"#cd6c00\",\n warningForeground: \"#fdfdfd\",\n info: \"#844fff\",\n infoForeground: \"#fdfdfd\",\n borderMuted: \"#3f4043\",\n active: \"#422880\",\n activeForeground: \"#fdfdfd\",\n labelForeground: \"#a8a9aa\",\n icon: \"#939496\",\n iconMuted: \"#545558\",\n spacing: {\n xs: \"0.25rem\",\n sm: \"0.5rem\",\n md: \"0.75rem\",\n lg: \"1rem\",\n xl: \"1.5rem\",\n \"2xl\": \"2rem\",\n },\n radius: {\n sm: \"0.25rem\",\n md: \"0.375rem\",\n lg: \"0.5rem\",\n xl: \"0.75rem\",\n full: \"9999px\",\n },\n size: {\n controlHeight: \"2.5rem\",\n modalWidth: \"42rem\",\n sidebarWidth: \"17.5rem\",\n },\n zIndex: {\n toolbar: 30,\n overlay: 40,\n modal: 50,\n toast: 60,\n },\n} as const;\n\nexport type DesignTokens = typeof designTokens;\n"],"mappings":";;;AAAO,IAAM,eAAe;AAAA,EAC1B,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EACA,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -218,6 +218,7 @@ var adsDefaultMessages = {
|
|
|
218
218
|
collapseRow: "Collapse row",
|
|
219
219
|
expandRow: "Expand row",
|
|
220
220
|
filterColumn: "Filter column",
|
|
221
|
+
loadingRows: "Loading table rows",
|
|
221
222
|
noDataAvailable: "No data available",
|
|
222
223
|
selectAllRows: "Select all rows",
|
|
223
224
|
selectRow: "Select row",
|
|
@@ -267,6 +268,7 @@ var adsDefaultMessages = {
|
|
|
267
268
|
collapseRow: "\u6536\u8D77\u884C",
|
|
268
269
|
expandRow: "\u5C55\u5F00\u884C",
|
|
269
270
|
filterColumn: "\u7B5B\u9009\u5217",
|
|
271
|
+
loadingRows: "\u6B63\u5728\u52A0\u8F7D\u8868\u683C\u884C",
|
|
270
272
|
noDataAvailable: "\u6682\u65E0\u6570\u636E",
|
|
271
273
|
selectAllRows: "\u9009\u62E9\u5168\u90E8\u884C",
|
|
272
274
|
selectRow: "\u9009\u62E9\u884C",
|
|
@@ -825,7 +827,7 @@ var adsTextColorClassName = {
|
|
|
825
827
|
// src/components/AdsAlertDialog/index.tsx
|
|
826
828
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
827
829
|
var overlayClassName = "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";
|
|
828
|
-
var contentClassName = "fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-[512px] -translate-x-1/2 -translate-y-1/2 gap-lg rounded-radius-lg border
|
|
830
|
+
var contentClassName = "fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-[512px] -translate-x-1/2 -translate-y-1/2 gap-lg rounded-radius-lg border-0 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%]";
|
|
829
831
|
var actionClassName = "inline-flex h-9 items-center justify-center rounded-radius-md border-0 bg-brand-gradient px-lg py-sm text-sm font-medium leading-5 tracking-normal shadow-[0px_1px_2px_rgba(0,0,0,0.1)] transition-opacity hover:opacity-90 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 disabled:opacity-[0.65]";
|
|
830
832
|
var cancelClassName = "inline-flex h-9 items-center justify-center rounded-radius-md border border-border bg-card px-lg py-sm text-sm font-medium leading-5 tracking-normal shadow-[0px_1px_2px_rgba(0,0,0,0.1)] transition-colors hover:bg-accent 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 disabled:opacity-[0.65]";
|
|
831
833
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
@@ -4558,18 +4560,33 @@ var SKELETON_ROW_COUNT = 4;
|
|
|
4558
4560
|
var FLEX_WIDTH_UNIT = 160;
|
|
4559
4561
|
var sizeClassNames = {
|
|
4560
4562
|
small: {
|
|
4563
|
+
bodyHeight: 32,
|
|
4561
4564
|
cell: "py-1.5 text-xs leading-4",
|
|
4565
|
+
headHeight: 32,
|
|
4562
4566
|
head: "h-8 py-1.5 text-xs leading-4"
|
|
4563
4567
|
},
|
|
4564
4568
|
middle: {
|
|
4569
|
+
bodyHeight: 40,
|
|
4565
4570
|
cell: "py-2 text-sm leading-5",
|
|
4571
|
+
headHeight: 40,
|
|
4566
4572
|
head: "h-10 py-2 text-sm leading-5"
|
|
4567
4573
|
},
|
|
4568
4574
|
large: {
|
|
4575
|
+
bodyHeight: 48,
|
|
4569
4576
|
cell: "py-3 text-base leading-6",
|
|
4577
|
+
headHeight: 48,
|
|
4570
4578
|
head: "h-12 py-3 text-base leading-6"
|
|
4571
4579
|
}
|
|
4572
4580
|
};
|
|
4581
|
+
function getSpinnerLoadingHeight(scrollY, density) {
|
|
4582
|
+
if (typeof scrollY === "number") {
|
|
4583
|
+
return Math.max(scrollY - density.headHeight, density.bodyHeight * SKELETON_ROW_COUNT);
|
|
4584
|
+
}
|
|
4585
|
+
if (typeof scrollY === "string") {
|
|
4586
|
+
return `max(calc(${scrollY} - ${density.headHeight}px), ${density.bodyHeight * SKELETON_ROW_COUNT}px)`;
|
|
4587
|
+
}
|
|
4588
|
+
return density.bodyHeight * SKELETON_ROW_COUNT;
|
|
4589
|
+
}
|
|
4573
4590
|
function getColumnKey(column, index) {
|
|
4574
4591
|
if (column.key !== void 0) {
|
|
4575
4592
|
return String(column.key);
|
|
@@ -4780,6 +4797,8 @@ function AdsDataTable({
|
|
|
4780
4797
|
dataSource = [],
|
|
4781
4798
|
rowKey,
|
|
4782
4799
|
loading = false,
|
|
4800
|
+
loadingVariant = "skeleton",
|
|
4801
|
+
expandedRowSurface = "inset",
|
|
4783
4802
|
emptyText,
|
|
4784
4803
|
emptyState,
|
|
4785
4804
|
rowClassName,
|
|
@@ -4878,8 +4897,14 @@ function AdsDataTable({
|
|
|
4878
4897
|
const hasSelectionColumn = Boolean(rowSelection);
|
|
4879
4898
|
const hasExpandableColumn = Boolean(expandable?.expandedRowRender);
|
|
4880
4899
|
const density = sizeClassNames[size];
|
|
4900
|
+
const columnCount = resolvedColumns.length + Number(hasSelectionColumn) + Number(hasExpandableColumn);
|
|
4881
4901
|
const paginationMode = pagination === false ? "client" : pagination.mode ?? "client";
|
|
4882
4902
|
const allowsRowSelectionByClick = Boolean(rowSelection) && !suppressRowClickSelection;
|
|
4903
|
+
const spinnerLoadingHeight = React42.useMemo(
|
|
4904
|
+
() => getSpinnerLoadingHeight(scroll?.y, density),
|
|
4905
|
+
[density, scroll?.y]
|
|
4906
|
+
);
|
|
4907
|
+
const expandedRowContentClassName = expandedRowSurface === "plain" ? "bg-transparent p-4" : expandedRowSurface === "subtle" ? "mx-6 my-4 rounded-[20px] border border-border bg-transparent p-4" : "border-t border-border bg-popover/40 p-4";
|
|
4883
4908
|
const filterValues = React42.useMemo(
|
|
4884
4909
|
() => resolvedColumns.reduce((accumulator, column, index) => {
|
|
4885
4910
|
const columnKey = getColumnKey(column, index);
|
|
@@ -5235,7 +5260,26 @@ function AdsDataTable({
|
|
|
5235
5260
|
);
|
|
5236
5261
|
})
|
|
5237
5262
|
] }) }),
|
|
5238
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsTableBody, { children: loading
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsTableBody, { children: loading && loadingVariant === "spinner" ? [
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsTableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5265
|
+
AdsTableCell,
|
|
5266
|
+
{
|
|
5267
|
+
className: "p-0",
|
|
5268
|
+
colSpan: columnCount,
|
|
5269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5270
|
+
"div",
|
|
5271
|
+
{
|
|
5272
|
+
"aria-label": messages.table.loadingRows,
|
|
5273
|
+
"aria-live": "polite",
|
|
5274
|
+
className: "flex items-center justify-center px-6 py-8 text-foreground",
|
|
5275
|
+
role: "status",
|
|
5276
|
+
style: { minHeight: spinnerLoadingHeight },
|
|
5277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsSpinner, { size: "lg", tone: "foreground" })
|
|
5278
|
+
}
|
|
5279
|
+
)
|
|
5280
|
+
}
|
|
5281
|
+
) }, "spinner-row")
|
|
5282
|
+
] : loading ? Array.from({ length: SKELETON_ROW_COUNT }, (_, skeletonIndex) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(AdsTableRow, { children: [
|
|
5239
5283
|
hasSelectionColumn ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsTableCell, { className: "w-12 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsSkeleton, { className: "h-4 w-4 rounded-[4px]" }) }) : null,
|
|
5240
5284
|
hasExpandableColumn ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsTableCell, { className: "w-12 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsSkeleton, { className: "h-4 w-4 rounded-[4px]" }) }) : null,
|
|
5241
5285
|
resolvedColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
@@ -5338,7 +5382,7 @@ function AdsDataTable({
|
|
|
5338
5382
|
"div",
|
|
5339
5383
|
{
|
|
5340
5384
|
className: cn(
|
|
5341
|
-
|
|
5385
|
+
expandedRowContentClassName,
|
|
5342
5386
|
classNames?.expandedRowContent
|
|
5343
5387
|
),
|
|
5344
5388
|
children: expandable?.expandedRowRender?.(record, index)
|
|
@@ -5351,7 +5395,7 @@ function AdsDataTable({
|
|
|
5351
5395
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AdsTableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5352
5396
|
AdsTableCell,
|
|
5353
5397
|
{
|
|
5354
|
-
colSpan:
|
|
5398
|
+
colSpan: columnCount,
|
|
5355
5399
|
className: cn("p-0", classNames?.emptyRowCell),
|
|
5356
5400
|
children: renderedEmptyState
|
|
5357
5401
|
}
|