@nubitio/ui 0.6.5 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -109,7 +109,12 @@ const EN_UI_STRINGS = {
109
109
  confirm: "Confirm",
110
110
  back: "Back",
111
111
  previousYears: "Previous years",
112
- nextYears: "Next years"
112
+ nextYears: "Next years",
113
+ rowActions: "Actions",
114
+ view: "View",
115
+ pages: "Pages",
116
+ previousPage: "Previous page",
117
+ nextPage: "Next page"
113
118
  };
114
119
  const ES_UI_STRINGS = {
115
120
  close: "Cerrar",
@@ -132,7 +137,12 @@ const ES_UI_STRINGS = {
132
137
  confirm: "Confirmar",
133
138
  back: "Volver",
134
139
  previousYears: "Años anteriores",
135
- nextYears: "Años siguientes"
140
+ nextYears: "Años siguientes",
141
+ rowActions: "Acciones",
142
+ view: "Ver",
143
+ pages: "Páginas",
144
+ previousPage: "Página anterior",
145
+ nextPage: "Página siguiente"
136
146
  };
137
147
  const UiStringsContext = createContext(EN_UI_STRINGS);
138
148
  const UiStringsProvider = ({ strings, children }) => {
@@ -308,18 +318,35 @@ const AppToolbar = ({ title, additionalToolbarContent, showRefreshButton = true,
308
318
  });
309
319
  };
310
320
  //#endregion
321
+ //#region packages/ui/layoutUtils.ts
322
+ function joinClasses(...parts) {
323
+ return parts.filter(Boolean).join(" ");
324
+ }
325
+ function gapClass(prefix, gap) {
326
+ return gap ? `${prefix}--gap-${gap}` : "";
327
+ }
328
+ function colSpanClasses(span, spanSm, spanMd, spanLg) {
329
+ const classes = ["nb-col"];
330
+ if (span != null) classes.push(`nb-col--span-${span}`);
331
+ if (spanSm != null) classes.push(`nb-col--span-sm-${spanSm}`);
332
+ if (spanMd != null) classes.push(`nb-col--span-md-${spanMd}`);
333
+ if (spanLg != null) classes.push(`nb-col--span-lg-${spanLg}`);
334
+ return classes;
335
+ }
336
+ //#endregion
311
337
  //#region packages/ui/Card.tsx
312
- const Card = ({ title, description, children }) => {
338
+ const Card = ({ title, description, variant = "auth", className, children }) => {
339
+ const showHeader = Boolean(title || description);
313
340
  return /* @__PURE__ */ jsx("div", {
314
- className: "nb-card",
341
+ className: joinClasses("nb-card", variant === "panel" && "nb-card--panel", className),
315
342
  children: /* @__PURE__ */ jsxs("div", {
316
343
  className: "nb-card__content content",
317
- children: [/* @__PURE__ */ jsxs("div", {
344
+ children: [showHeader && /* @__PURE__ */ jsxs("div", {
318
345
  className: "header",
319
- children: [/* @__PURE__ */ jsx("div", {
346
+ children: [title && /* @__PURE__ */ jsx("div", {
320
347
  className: "title",
321
348
  children: title
322
- }), /* @__PURE__ */ jsx("div", {
349
+ }), description && /* @__PURE__ */ jsx("div", {
323
350
  className: "description",
324
351
  children: description
325
352
  })]
@@ -1342,6 +1369,39 @@ const Toggle = ({ checked, onChange, label, size = "md", disabled = false, "aria
1342
1369
  };
1343
1370
  //#endregion
1344
1371
  //#region packages/ui/ContextMenu.tsx
1372
+ const MENU_MIN_WIDTH = 190;
1373
+ function getDropdownStyle(anchor, align) {
1374
+ if (!anchor) return {
1375
+ position: "fixed",
1376
+ visibility: "hidden",
1377
+ margin: 0
1378
+ };
1379
+ const rect = anchor.getBoundingClientRect();
1380
+ const menuWidth = MENU_MIN_WIDTH;
1381
+ const left = align === "right" ? Math.max(8, Math.min(rect.right - menuWidth, window.innerWidth - menuWidth - 8)) : Math.max(8, Math.min(rect.left, window.innerWidth - menuWidth - 8));
1382
+ const spaceBelow = window.innerHeight - rect.bottom;
1383
+ const spaceAbove = rect.top;
1384
+ if (spaceBelow < 200 && spaceAbove > spaceBelow) return {
1385
+ position: "fixed",
1386
+ left: `${left}px`,
1387
+ width: `${menuWidth}px`,
1388
+ bottom: `${window.innerHeight - rect.top + 4}px`,
1389
+ top: "auto",
1390
+ margin: 0,
1391
+ zIndex: 1600,
1392
+ visibility: "visible"
1393
+ };
1394
+ return {
1395
+ position: "fixed",
1396
+ left: `${left}px`,
1397
+ width: `${menuWidth}px`,
1398
+ top: `${rect.bottom + 4}px`,
1399
+ bottom: "auto",
1400
+ margin: 0,
1401
+ zIndex: 1600,
1402
+ visibility: "visible"
1403
+ };
1404
+ }
1345
1405
  /**
1346
1406
  * Three-dot overflow context menu.
1347
1407
  * Replaces the legacy `shared/ui/library/card-menu/CardMenu` component.
@@ -1353,14 +1413,23 @@ const Toggle = ({ checked, onChange, label, size = "md", disabled = false, "aria
1353
1413
  * - Custom trigger slot
1354
1414
  * - Left/right alignment
1355
1415
  * - Click-outside + Escape to close
1416
+ * - Portalled dropdown (avoids clip inside scrollable tables)
1356
1417
  */
1357
1418
  const ContextMenu = ({ items, visible = true, trigger, triggerLabel = "Opciones", align = "right", className = "" }) => {
1358
1419
  const [open, setOpen] = useState(false);
1359
1420
  const containerRef = useRef(null);
1421
+ const menuRef = useRef(null);
1422
+ const [menuStyle, setMenuStyle] = useState({
1423
+ position: "fixed",
1424
+ visibility: "hidden",
1425
+ margin: 0
1426
+ });
1427
+ const computeMenuStyle = useCallback(() => getDropdownStyle(containerRef.current, align), [align]);
1360
1428
  useEffect(() => {
1361
1429
  if (!open) return;
1362
1430
  const onMouseDown = (e) => {
1363
- if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
1431
+ const target = e.target;
1432
+ if (!containerRef.current?.contains(target) && !menuRef.current?.contains(target)) setOpen(false);
1364
1433
  };
1365
1434
  const onKeyDown = (e) => {
1366
1435
  if (e.key === "Escape") setOpen(false);
@@ -1372,11 +1441,57 @@ const ContextMenu = ({ items, visible = true, trigger, triggerLabel = "Opciones"
1372
1441
  document.removeEventListener("keydown", onKeyDown);
1373
1442
  };
1374
1443
  }, [open]);
1444
+ useLayoutEffect(() => {
1445
+ if (!open) return;
1446
+ const update = () => {
1447
+ if (!containerRef.current) return;
1448
+ const rect = containerRef.current.getBoundingClientRect();
1449
+ if ((rect.width > 0 || rect.height > 0) && (rect.top >= window.innerHeight || rect.bottom <= 0)) {
1450
+ setOpen(false);
1451
+ return;
1452
+ }
1453
+ setMenuStyle(computeMenuStyle());
1454
+ };
1455
+ update();
1456
+ window.addEventListener("resize", update);
1457
+ window.addEventListener("scroll", update, {
1458
+ capture: true,
1459
+ passive: true
1460
+ });
1461
+ return () => {
1462
+ window.removeEventListener("resize", update);
1463
+ window.removeEventListener("scroll", update, { capture: true });
1464
+ };
1465
+ }, [open, computeMenuStyle]);
1375
1466
  if (!visible) return null;
1376
- const dropdownStyle = align === "left" ? {
1377
- right: "auto",
1378
- left: 0
1379
- } : {};
1467
+ const dropdown = open ? /* @__PURE__ */ jsx("ul", {
1468
+ ref: menuRef,
1469
+ className: "nb-context-menu__dropdown nb-context-menu__dropdown--portaled",
1470
+ role: "menu",
1471
+ style: menuStyle,
1472
+ children: items.map((item, idx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [item.separator && /* @__PURE__ */ jsx("li", {
1473
+ role: "none",
1474
+ "aria-hidden": "true",
1475
+ children: /* @__PURE__ */ jsx("div", { className: "nb-context-menu__separator" })
1476
+ }), /* @__PURE__ */ jsx("li", {
1477
+ role: "none",
1478
+ children: /* @__PURE__ */ jsxs("button", {
1479
+ type: "button",
1480
+ role: "menuitem",
1481
+ disabled: item.disabled,
1482
+ "aria-disabled": item.disabled,
1483
+ className: `nb-context-menu__item${item.danger ? " nb-context-menu__item--danger" : ""}`,
1484
+ onClick: () => {
1485
+ setOpen(false);
1486
+ item.onClick?.();
1487
+ },
1488
+ children: [item.icon && /* @__PURE__ */ jsx("i", {
1489
+ className: item.icon,
1490
+ "aria-hidden": "true"
1491
+ }), item.label]
1492
+ })
1493
+ })] }, idx))
1494
+ }) : null;
1380
1495
  return /* @__PURE__ */ jsxs("div", {
1381
1496
  ref: containerRef,
1382
1497
  className: `nb-context-menu${className ? ` ${className}` : ""}`,
@@ -1388,34 +1503,11 @@ const ContextMenu = ({ items, visible = true, trigger, triggerLabel = "Opciones"
1388
1503
  label: triggerLabel,
1389
1504
  "aria-haspopup": "menu",
1390
1505
  "aria-expanded": open,
1391
- onClick: () => setOpen((v) => !v)
1392
- }), open && /* @__PURE__ */ jsx("ul", {
1393
- className: "nb-context-menu__dropdown",
1394
- role: "menu",
1395
- style: dropdownStyle,
1396
- children: items.map((item, idx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [item.separator && /* @__PURE__ */ jsx("li", {
1397
- role: "none",
1398
- "aria-hidden": "true",
1399
- children: /* @__PURE__ */ jsx("div", { className: "nb-context-menu__separator" })
1400
- }), /* @__PURE__ */ jsx("li", {
1401
- role: "none",
1402
- children: /* @__PURE__ */ jsxs("button", {
1403
- type: "button",
1404
- role: "menuitem",
1405
- disabled: item.disabled,
1406
- "aria-disabled": item.disabled,
1407
- className: `nb-context-menu__item${item.danger ? " nb-context-menu__item--danger" : ""}`,
1408
- onClick: () => {
1409
- setOpen(false);
1410
- item.onClick?.();
1411
- },
1412
- children: [item.icon && /* @__PURE__ */ jsx("i", {
1413
- className: item.icon,
1414
- "aria-hidden": "true"
1415
- }), item.label]
1416
- })
1417
- })] }, idx))
1418
- })]
1506
+ onClick: () => {
1507
+ if (!open) setMenuStyle(computeMenuStyle());
1508
+ setOpen((v) => !v);
1509
+ }
1510
+ }), dropdown && createPortal(dropdown, document.body)]
1419
1511
  });
1420
1512
  };
1421
1513
  //#endregion
@@ -3066,4 +3158,306 @@ function Timeline({ variant = "stepper", orientation = "vertical", title, descri
3066
3158
  });
3067
3159
  }
3068
3160
  //#endregion
3069
- export { ACCENT_PRESETS, AppDialog, AppDropdown, AppToolbar, Avatar, Badge, Button, Card, Chip, CollapsibleSection, ConfirmDialog, ContextMenu, DatePicker, DateRangePicker, DensityContext, DensityProvider, Drawer, EN_UI_STRINGS, ES_UI_STRINGS, EmptyState, FeatureGate, FileDropzone, FilterPanel, FormField, HubPanel, IconButton, KpiMetricRow, OperationCardGrid, Popover, ScopeTabs, SearchableAppDropdown, SegmentedControl, SelectField, SettingsPanel, Skeleton, StatCard, TextAreaField, TextField, ThemeContext, ThemeProvider, ThemeSwitcher, Timeline, TimelineItem, Toggle, UiStringsProvider, getAvatarHue, getAvatarInitials, useAccentColor, useDensity, useFloatingPanel, useTheme, useUiStrings };
3161
+ //#region packages/ui/Page.tsx
3162
+ function Page({ children, fill, wide, narrow, gap = 5, className, ...props }) {
3163
+ return /* @__PURE__ */ jsx("div", {
3164
+ className: joinClasses("nb-page", fill && "nb-page--fill", wide && "nb-page--wide", narrow && "nb-page--narrow", gapClass("nb-page", gap), className),
3165
+ ...props,
3166
+ children
3167
+ });
3168
+ }
3169
+ //#endregion
3170
+ //#region packages/ui/PageHeader.tsx
3171
+ function PageHeader({ title, subtitle, breadcrumb, breadcrumbSlot, badge, actions, className }) {
3172
+ const breadcrumbNode = breadcrumbSlot ?? (breadcrumb ? /* @__PURE__ */ jsxs("a", {
3173
+ href: breadcrumb.href,
3174
+ className: "nb-page-header__breadcrumb",
3175
+ children: [/* @__PURE__ */ jsx("i", {
3176
+ className: "ph ph-arrow-left",
3177
+ "aria-hidden": true
3178
+ }), breadcrumb.label]
3179
+ }) : null);
3180
+ return /* @__PURE__ */ jsxs("header", {
3181
+ className: joinClasses("nb-page-header", className),
3182
+ children: [/* @__PURE__ */ jsxs("div", {
3183
+ className: "nb-page-header__main",
3184
+ children: [
3185
+ breadcrumbNode,
3186
+ /* @__PURE__ */ jsx("h1", {
3187
+ className: "nb-page-header__title",
3188
+ children: title
3189
+ }),
3190
+ subtitle && /* @__PURE__ */ jsx("p", {
3191
+ className: "nb-page-header__subtitle",
3192
+ children: subtitle
3193
+ })
3194
+ ]
3195
+ }), (badge || actions) && /* @__PURE__ */ jsxs("div", {
3196
+ className: "nb-page-header__aside",
3197
+ children: [badge && /* @__PURE__ */ jsx(Badge, {
3198
+ variant: badge.variant ?? "info",
3199
+ pill: true,
3200
+ children: badge.label
3201
+ }), actions]
3202
+ })]
3203
+ });
3204
+ }
3205
+ //#endregion
3206
+ //#region packages/ui/Stack.tsx
3207
+ function Stack({ children, gap = 4, align, justify, fill, className, ...props }) {
3208
+ return /* @__PURE__ */ jsx("div", {
3209
+ className: joinClasses("nb-stack", gapClass("nb-stack", gap), align && `nb-stack--align-${align}`, justify && `nb-stack--justify-${justify}`, fill && "nb-stack--fill", className),
3210
+ ...props,
3211
+ children
3212
+ });
3213
+ }
3214
+ //#endregion
3215
+ //#region packages/ui/Row.tsx
3216
+ function Row({ children, gap = 2, align, justify, wrap, fill, className, ...props }) {
3217
+ return /* @__PURE__ */ jsx("div", {
3218
+ className: joinClasses("nb-row", gapClass("nb-row", gap), align && `nb-row--align-${align}`, justify && `nb-row--justify-${justify}`, wrap && "nb-row--wrap", fill && "nb-row--fill", className),
3219
+ ...props,
3220
+ children
3221
+ });
3222
+ }
3223
+ //#endregion
3224
+ //#region packages/ui/Cluster.tsx
3225
+ /** Inline flex row that wraps — ideal for button groups and filter actions. */
3226
+ function Cluster({ children, gap = 2, className, ...props }) {
3227
+ return /* @__PURE__ */ jsx("div", {
3228
+ className: joinClasses("nb-cluster", gapClass("nb-cluster", gap), className),
3229
+ ...props,
3230
+ children
3231
+ });
3232
+ }
3233
+ //#endregion
3234
+ //#region packages/ui/Grid.tsx
3235
+ function Grid({ children, cols = 12, gap = 4, minColWidth, fill, className, style, ...props }) {
3236
+ const gridStyle = {
3237
+ ...style,
3238
+ ...minColWidth ? { "--nb-grid-min-col": minColWidth } : {}
3239
+ };
3240
+ return /* @__PURE__ */ jsx("div", {
3241
+ className: joinClasses("nb-grid", cols === 12 ? "nb-grid--cols-12" : cols === "auto" ? "nb-grid--cols-auto" : `nb-grid--cols-${cols}`, gapClass("nb-grid", gap), fill && "nb-grid--fill", className),
3242
+ style: gridStyle,
3243
+ ...props,
3244
+ children
3245
+ });
3246
+ }
3247
+ //#endregion
3248
+ //#region packages/ui/Col.tsx
3249
+ function Col({ children, span, spanSm, spanMd, spanLg, fullWidth, className, ...props }) {
3250
+ return /* @__PURE__ */ jsx("div", {
3251
+ className: joinClasses(...colSpanClasses(span, spanSm, spanMd, spanLg), fullWidth && "nb-span-full", className),
3252
+ ...props,
3253
+ children
3254
+ });
3255
+ }
3256
+ //#endregion
3257
+ //#region packages/ui/Section.tsx
3258
+ function Section({ title, children, className }) {
3259
+ return /* @__PURE__ */ jsxs("section", {
3260
+ className: joinClasses("nb-section", className),
3261
+ children: [/* @__PURE__ */ jsx("h2", {
3262
+ className: "nb-section__title",
3263
+ children: title
3264
+ }), children]
3265
+ });
3266
+ }
3267
+ //#endregion
3268
+ //#region packages/ui/FormLayout.tsx
3269
+ function FormLayout({ children, variant = "stack", minColWidth, className, style, ...props }) {
3270
+ const formStyle = {
3271
+ ...style,
3272
+ ...minColWidth ? { "--nb-form-min-col": minColWidth } : {}
3273
+ };
3274
+ return /* @__PURE__ */ jsx("form", {
3275
+ className: joinClasses("nb-form-layout", variant !== "stack" && `nb-form-layout--${variant}`, className),
3276
+ style: formStyle,
3277
+ ...props,
3278
+ children
3279
+ });
3280
+ }
3281
+ //#endregion
3282
+ //#region packages/ui/FormActions.tsx
3283
+ function FormActions({ children, className }) {
3284
+ return /* @__PURE__ */ jsx("div", {
3285
+ className: joinClasses("nb-form-actions", className),
3286
+ children
3287
+ });
3288
+ }
3289
+ //#endregion
3290
+ //#region packages/ui/Alert.tsx
3291
+ const ICONS = {
3292
+ danger: "ph-warning-circle",
3293
+ warning: "ph-warning",
3294
+ info: "ph-info"
3295
+ };
3296
+ function Alert({ tone = "info", children, className }) {
3297
+ return /* @__PURE__ */ jsxs("div", {
3298
+ className: joinClasses("nb-alert", `nb-alert--${tone}`, className),
3299
+ role: "alert",
3300
+ children: [/* @__PURE__ */ jsx("i", {
3301
+ className: `ph ${ICONS[tone]}`,
3302
+ "aria-hidden": true
3303
+ }), /* @__PURE__ */ jsx("span", { children })]
3304
+ });
3305
+ }
3306
+ //#endregion
3307
+ //#region packages/ui/DescriptionList.tsx
3308
+ function DescriptionList({ items, className }) {
3309
+ return /* @__PURE__ */ jsx("dl", {
3310
+ className: joinClasses("nb-description-list", className),
3311
+ children: items.map((item) => /* @__PURE__ */ jsxs("div", {
3312
+ className: "nb-description-list__row",
3313
+ children: [/* @__PURE__ */ jsx("dt", { children: item.term }), /* @__PURE__ */ jsx("dd", { children: item.value })]
3314
+ }, item.term))
3315
+ });
3316
+ }
3317
+ //#endregion
3318
+ //#region packages/ui/Code.tsx
3319
+ function Code({ children, className }) {
3320
+ return /* @__PURE__ */ jsx("code", {
3321
+ className: joinClasses("nb-code", className),
3322
+ children
3323
+ });
3324
+ }
3325
+ //#endregion
3326
+ //#region packages/ui/Text.tsx
3327
+ function Text({ children, tone = "default", as: Tag = "span", className, ...props }) {
3328
+ return /* @__PURE__ */ jsx(Tag, {
3329
+ className: joinClasses(tone === "muted" && "nb-text-muted", className),
3330
+ ...props,
3331
+ children
3332
+ });
3333
+ }
3334
+ //#endregion
3335
+ //#region packages/ui/Pagination.tsx
3336
+ function Pagination({ page, totalPages, onPageChange, ariaLabel, maxVisible = 7, className }) {
3337
+ const strings = useUiStrings();
3338
+ if (totalPages <= 1) return null;
3339
+ const windowSize = Math.min(maxVisible, totalPages);
3340
+ const start = Math.max(1, Math.min(page - Math.floor(windowSize / 2), totalPages - windowSize + 1));
3341
+ const pages = Array.from({ length: windowSize }, (_, index) => start + index).filter((value) => value <= totalPages);
3342
+ return /* @__PURE__ */ jsxs("nav", {
3343
+ className: joinClasses("nb-pagination", className),
3344
+ "aria-label": ariaLabel ?? strings.pages,
3345
+ children: [
3346
+ /* @__PURE__ */ jsx(Button, {
3347
+ type: "button",
3348
+ variant: "ghost",
3349
+ size: "sm",
3350
+ disabled: page <= 1,
3351
+ "aria-label": strings.previousPage,
3352
+ onClick: () => onPageChange(page - 1),
3353
+ children: "←"
3354
+ }),
3355
+ pages.map((value) => /* @__PURE__ */ jsx(Button, {
3356
+ type: "button",
3357
+ variant: value === page ? "primary" : "ghost",
3358
+ size: "sm",
3359
+ "aria-current": value === page ? "page" : void 0,
3360
+ onClick: () => onPageChange(value),
3361
+ children: value
3362
+ }, value)),
3363
+ /* @__PURE__ */ jsx(Button, {
3364
+ type: "button",
3365
+ variant: "ghost",
3366
+ size: "sm",
3367
+ disabled: page >= totalPages,
3368
+ "aria-label": strings.nextPage,
3369
+ onClick: () => onPageChange(page + 1),
3370
+ children: "→"
3371
+ })
3372
+ ]
3373
+ });
3374
+ }
3375
+ //#endregion
3376
+ //#region packages/ui/RowActions.tsx
3377
+ /** Context menu preset for table row overflow actions. */
3378
+ function RowActions({ items, triggerLabel, align = "right", className }) {
3379
+ const strings = useUiStrings();
3380
+ if (items.length === 0) return null;
3381
+ return /* @__PURE__ */ jsx(ContextMenu, {
3382
+ items,
3383
+ align,
3384
+ className,
3385
+ triggerLabel: triggerLabel ?? strings.rowActions,
3386
+ visible: true
3387
+ });
3388
+ }
3389
+ //#endregion
3390
+ //#region packages/ui/DataTable.tsx
3391
+ function alignClass(align) {
3392
+ if (align === "right") return "nb-data-table__cell--num";
3393
+ if (align === "center") return "nb-data-table__cell--center";
3394
+ }
3395
+ function cellClass(column) {
3396
+ return joinClasses(alignClass(column.align), column.muted && "nb-data-table__cell--muted", column.nowrap && "nb-data-table__cell--nowrap");
3397
+ }
3398
+ function renderCell(column, row, index) {
3399
+ if (column.render) return column.render(row, index);
3400
+ if (column.accessor) return column.accessor(row);
3401
+ return null;
3402
+ }
3403
+ function DataTable({ columns, rows, getRowKey, emptyMessage, fill, variant = "default", className, wrapClassName, testId, rowActions, rowActionsLabel, renderActions, pagination }) {
3404
+ const hasActions = Boolean(rowActions || renderActions);
3405
+ if (rows.length === 0) return emptyMessage ? /* @__PURE__ */ jsx(Text, {
3406
+ tone: "muted",
3407
+ children: emptyMessage
3408
+ }) : null;
3409
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
3410
+ className: joinClasses("nb-data-table-wrap", variant === "flush" && "nb-data-table-wrap--flush", fill && "nb-data-table-wrap--fill", wrapClassName),
3411
+ "data-testid": testId,
3412
+ children: /* @__PURE__ */ jsxs("table", {
3413
+ className: joinClasses("nb-data-table", hasActions && "nb-data-table--has-actions", className),
3414
+ children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [columns.map((column) => /* @__PURE__ */ jsx("th", {
3415
+ className: alignClass(column.align),
3416
+ children: column.header
3417
+ }, column.id)), hasActions && /* @__PURE__ */ jsx("th", {
3418
+ scope: "col",
3419
+ className: "nb-data-table__actions-head",
3420
+ ...rowActionsLabel ? { "aria-label": rowActionsLabel } : {}
3421
+ })] }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((row, index) => /* @__PURE__ */ jsxs("tr", { children: [columns.map((column) => /* @__PURE__ */ jsx("td", {
3422
+ className: cellClass(column),
3423
+ children: renderCell(column, row, index)
3424
+ }, column.id)), hasActions && /* @__PURE__ */ jsx("td", {
3425
+ className: "nb-data-table__actions",
3426
+ children: renderActions ? renderActions(row) : rowActions && /* @__PURE__ */ jsx(RowActions, {
3427
+ items: rowActions(row),
3428
+ triggerLabel: rowActionsLabel
3429
+ })
3430
+ })] }, getRowKey(row))) })]
3431
+ })
3432
+ }), pagination && /* @__PURE__ */ jsx(Pagination, { ...pagination })] });
3433
+ }
3434
+ //#endregion
3435
+ //#region packages/ui/useConfirm.tsx
3436
+ function useConfirm() {
3437
+ const strings = useUiStrings();
3438
+ const [pending, setPending] = useState(null);
3439
+ const ask = useCallback((request) => {
3440
+ setPending(request);
3441
+ }, []);
3442
+ const dismiss = useCallback(() => setPending(null), []);
3443
+ const ConfirmHost = () => /* @__PURE__ */ jsx(ConfirmDialog, {
3444
+ open: pending !== null,
3445
+ title: pending?.title ?? "",
3446
+ message: pending?.message ?? "",
3447
+ variant: pending?.variant,
3448
+ confirmLabel: pending?.confirmLabel ?? strings.confirm,
3449
+ cancelLabel: strings.cancel,
3450
+ onCancel: dismiss,
3451
+ onConfirm: () => {
3452
+ pending?.onConfirm();
3453
+ dismiss();
3454
+ }
3455
+ });
3456
+ return {
3457
+ ask,
3458
+ dismiss,
3459
+ ConfirmHost
3460
+ };
3461
+ }
3462
+ //#endregion
3463
+ export { ACCENT_PRESETS, Alert, AppDialog, AppDropdown, AppToolbar, Avatar, Badge, Button, Card, Chip, Cluster, Code, Col, CollapsibleSection, ConfirmDialog, ContextMenu, DataTable, DatePicker, DateRangePicker, DensityContext, DensityProvider, DescriptionList, Drawer, EN_UI_STRINGS, ES_UI_STRINGS, EmptyState, FeatureGate, FileDropzone, FilterPanel, FormActions, FormField, FormLayout, Grid, HubPanel, IconButton, KpiMetricRow, OperationCardGrid, Page, PageHeader, Pagination, Popover, Row, RowActions, ScopeTabs, SearchableAppDropdown, Section, SegmentedControl, SelectField, SettingsPanel, Skeleton, Stack, StatCard, Text, TextAreaField, TextField, ThemeContext, ThemeProvider, ThemeSwitcher, Timeline, TimelineItem, Toggle, UiStringsProvider, getAvatarHue, getAvatarInitials, useAccentColor, useConfirm, useDensity, useFloatingPanel, useTheme, useUiStrings };