klun-ui 0.3.0 → 0.4.1

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.
@@ -1,6 +1,9 @@
1
1
  import { cx } from './chunk-T225J6LV.js';
2
2
  import { createContext, forwardRef, useState, useRef, useEffect, Children, useCallback, useMemo, useLayoutEffect, Fragment as Fragment$1, createElement, useContext, isValidElement, cloneElement, useSyncExternalStore } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCorners, useDroppable, closestCenter } from '@dnd-kit/core';
5
+ import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
6
+ import { CSS } from '@dnd-kit/utilities';
4
7
  import { createPortal } from 'react-dom';
5
8
  import { createRoot } from 'react-dom/client';
6
9
 
@@ -3342,6 +3345,256 @@ var DiffViewer = forwardRef(function DiffViewer2({
3342
3345
  );
3343
3346
  });
3344
3347
  DiffViewer.displayName = "DiffViewer";
3348
+ function draggedCenterY(active, delta) {
3349
+ const translated = active.rect.current.translated;
3350
+ if (translated) return translated.top + translated.height / 2;
3351
+ const initial = active.rect.current.initial;
3352
+ return initial ? initial.top + delta.y + initial.height / 2 : null;
3353
+ }
3354
+ function resolveMove(columns, activeId, overId, after) {
3355
+ if (activeId === overId) return null;
3356
+ const from = columns.find((c) => c.cards.some((k2) => k2.id === activeId));
3357
+ if (!from) return null;
3358
+ const overCard = columns.flatMap((c) => c.cards).find((k2) => k2.id === overId);
3359
+ const to = overCard ? columns.find((c) => c.cards.some((k2) => k2.id === overCard.id)) : columns.find((c) => c.id === overId);
3360
+ if (!to) return null;
3361
+ const rest = to.cards.filter((k2) => k2.id !== activeId);
3362
+ const toIndex = overCard ? rest.findIndex((k2) => k2.id === overCard.id) + (after ? 1 : 0) : rest.length;
3363
+ if (to.id === from.id && from.cards.findIndex((k2) => k2.id === activeId) === toIndex) {
3364
+ return null;
3365
+ }
3366
+ return { fromColumn: from.id, toColumn: to.id, toIndex };
3367
+ }
3368
+ var Kanban = forwardRef(function Kanban2({
3369
+ columns = [],
3370
+ onMove,
3371
+ onCardClick,
3372
+ renderCard,
3373
+ columnFooter,
3374
+ columnWidth = 280,
3375
+ className,
3376
+ style,
3377
+ ...props
3378
+ }, ref) {
3379
+ const [over, setOver] = useState(null);
3380
+ const sensors = useSensors(
3381
+ useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
3382
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
3383
+ );
3384
+ const columnOf = (cardId) => columns.find((c) => c.cards.some((k2) => k2.id === cardId));
3385
+ const computeOver = ({
3386
+ active,
3387
+ delta,
3388
+ over: o
3389
+ }) => {
3390
+ if (!o) return null;
3391
+ const overId = String(o.id);
3392
+ const column = columnOf(overId);
3393
+ if (!column) return { columnId: overId };
3394
+ const centerY = draggedCenterY(active, delta);
3395
+ return {
3396
+ columnId: column.id,
3397
+ cardId: overId,
3398
+ after: centerY != null && centerY > o.rect.top + o.rect.height / 2
3399
+ };
3400
+ };
3401
+ const handleDragEnd = ({ active, delta, over: o }) => {
3402
+ setOver(null);
3403
+ if (!o) return;
3404
+ const overId = String(o.id);
3405
+ const column = columnOf(overId);
3406
+ const centerY = column ? draggedCenterY(active, delta) : null;
3407
+ const after = centerY != null && centerY > o.rect.top + o.rect.height / 2;
3408
+ const target = resolveMove(columns, String(active.id), overId, after);
3409
+ if (target) {
3410
+ onMove?.(String(active.id), target.fromColumn, target.toColumn, target.toIndex);
3411
+ }
3412
+ };
3413
+ return /* @__PURE__ */ jsx(
3414
+ "div",
3415
+ {
3416
+ ref,
3417
+ className: cx("klun-kanban", className),
3418
+ style: { ...style, ["--klun-kanban-col"]: `${columnWidth}px` },
3419
+ ...props,
3420
+ children: /* @__PURE__ */ jsx(
3421
+ DndContext,
3422
+ {
3423
+ sensors,
3424
+ collisionDetection: closestCorners,
3425
+ onDragOver: (e) => setOver(computeOver(e)),
3426
+ onDragMove: (e) => setOver(computeOver(e)),
3427
+ onDragEnd: handleDragEnd,
3428
+ children: columns.map((column) => /* @__PURE__ */ jsx(
3429
+ KanbanColumnView,
3430
+ {
3431
+ column,
3432
+ over,
3433
+ onCardClick,
3434
+ renderCard,
3435
+ columnFooter
3436
+ },
3437
+ column.id
3438
+ ))
3439
+ }
3440
+ )
3441
+ }
3442
+ );
3443
+ });
3444
+ Kanban.displayName = "Kanban";
3445
+ function KanbanColumnView({
3446
+ column,
3447
+ over,
3448
+ onCardClick,
3449
+ renderCard,
3450
+ columnFooter
3451
+ }) {
3452
+ const { setNodeRef } = useDroppable({ id: column.id });
3453
+ const isOver = over?.columnId === column.id;
3454
+ const full = column.limit !== void 0 && column.cards.length >= column.limit;
3455
+ return /* @__PURE__ */ jsxs("section", { className: cx("klun-kanban__column", isOver && "klun-kanban__column--over"), children: [
3456
+ /* @__PURE__ */ jsxs("header", { className: "klun-kanban__header", children: [
3457
+ column.accent ? /* @__PURE__ */ jsx("span", { className: "klun-kanban__dot", style: { background: column.accent } }) : null,
3458
+ /* @__PURE__ */ jsx("span", { className: "klun-kanban__title", children: column.title }),
3459
+ /* @__PURE__ */ jsxs("span", { className: cx("klun-kanban__count", full && "klun-kanban__count--full"), children: [
3460
+ column.cards.length,
3461
+ column.limit !== void 0 ? ` / ${column.limit}` : ""
3462
+ ] })
3463
+ ] }),
3464
+ /* @__PURE__ */ jsxs("div", { ref: setNodeRef, className: "klun-kanban__list", children: [
3465
+ /* @__PURE__ */ jsx(
3466
+ SortableContext,
3467
+ {
3468
+ items: column.cards.map((c) => c.id),
3469
+ strategy: verticalListSortingStrategy,
3470
+ children: column.cards.map((card) => /* @__PURE__ */ jsx(
3471
+ KanbanCardView,
3472
+ {
3473
+ card,
3474
+ columnId: column.id,
3475
+ dropBefore: isOver && over?.cardId === card.id && over?.after === false,
3476
+ dropAfter: isOver && over?.cardId === card.id && over?.after === true,
3477
+ onCardClick,
3478
+ renderCard
3479
+ },
3480
+ card.id
3481
+ ))
3482
+ }
3483
+ ),
3484
+ column.cards.length === 0 ? /* @__PURE__ */ jsx("div", { className: "klun-kanban__empty", children: "Drop a card here" }) : null
3485
+ ] }),
3486
+ columnFooter ? /* @__PURE__ */ jsx("div", { className: "klun-kanban__footer", children: columnFooter(column) }) : null
3487
+ ] });
3488
+ }
3489
+ function KanbanCardView({
3490
+ card,
3491
+ columnId,
3492
+ dropBefore,
3493
+ dropAfter,
3494
+ onCardClick,
3495
+ renderCard
3496
+ }) {
3497
+ const {
3498
+ attributes,
3499
+ listeners: listeners2,
3500
+ setNodeRef,
3501
+ transform,
3502
+ transition,
3503
+ isDragging
3504
+ } = useSortable({ id: card.id });
3505
+ return /* @__PURE__ */ jsx(
3506
+ "article",
3507
+ {
3508
+ ref: setNodeRef,
3509
+ ...attributes,
3510
+ ...listeners2,
3511
+ onClick: () => onCardClick?.(card, columnId),
3512
+ className: cx(
3513
+ "klun-kanban__card",
3514
+ isDragging && "klun-kanban__card--dragging",
3515
+ dropBefore && "klun-kanban__card--dropbefore",
3516
+ dropAfter && "klun-kanban__card--dropafter"
3517
+ ),
3518
+ style: {
3519
+ transform: CSS.Transform.toString(transform),
3520
+ transition,
3521
+ ...card.accent ? { boxShadow: `inset 3px 0 0 ${card.accent}` } : null
3522
+ },
3523
+ children: renderCard ? renderCard(card, columnId) : /* @__PURE__ */ jsxs(Fragment, { children: [
3524
+ /* @__PURE__ */ jsx("div", { className: "klun-kanban__card-title", children: card.title }),
3525
+ card.description ? /* @__PURE__ */ jsx("div", { className: "klun-kanban__card-desc", children: card.description }) : null,
3526
+ card.tags?.length ? /* @__PURE__ */ jsx("div", { className: "klun-kanban__card-tags", children: card.tags.map((t, i) => /* @__PURE__ */ jsx("span", { children: t }, i)) }) : null,
3527
+ card.meta ? /* @__PURE__ */ jsx("div", { className: "klun-kanban__card-meta", children: card.meta }) : null
3528
+ ] })
3529
+ }
3530
+ );
3531
+ }
3532
+ function VirtualTable({
3533
+ rows = [],
3534
+ columns = [],
3535
+ rowHeight = 40,
3536
+ height = 420,
3537
+ getRowId,
3538
+ onRowClick,
3539
+ overscan = 8,
3540
+ zebra = true,
3541
+ empty,
3542
+ className,
3543
+ style,
3544
+ ...props
3545
+ }) {
3546
+ const [scrollTop, setScrollTop] = useState(0);
3547
+ const total = rows.length;
3548
+ const template = useMemo(
3549
+ () => columns.map((c) => c.width ? `${c.width}px` : "minmax(0, 1fr)").join(" "),
3550
+ [columns]
3551
+ );
3552
+ const bodyHeight = Math.max(0, height - 36);
3553
+ const start = Math.max(0, Math.floor(scrollTop / rowHeight) - overscan);
3554
+ const end = Math.min(total, Math.ceil((scrollTop + bodyHeight) / rowHeight) + overscan);
3555
+ const slice = rows.slice(start, end);
3556
+ return /* @__PURE__ */ jsxs("div", { ref: void 0, className: cx("klun-vtable", className), style: { ...style, height }, ...props, children: [
3557
+ /* @__PURE__ */ jsx("div", { className: "klun-vtable__head", style: { gridTemplateColumns: template }, children: columns.map((c) => /* @__PURE__ */ jsx("div", { className: cx("klun-vtable__th", c.align && `klun-vtable__th--${c.align}`), children: c.header }, c.key)) }),
3558
+ /* @__PURE__ */ jsx(
3559
+ "div",
3560
+ {
3561
+ className: "klun-vtable__body",
3562
+ onScroll: (e) => setScrollTop(e.target.scrollTop),
3563
+ style: { maxHeight: bodyHeight },
3564
+ children: total === 0 ? /* @__PURE__ */ jsx("div", { className: "klun-vtable__empty", children: empty ?? "No rows" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3565
+ /* @__PURE__ */ jsx("div", { style: { height: start * rowHeight } }),
3566
+ slice.map((row, i) => {
3567
+ const index = start + i;
3568
+ const id = getRowId?.(row, index) ?? index;
3569
+ return /* @__PURE__ */ jsx(
3570
+ "div",
3571
+ {
3572
+ role: onRowClick ? "button" : void 0,
3573
+ tabIndex: onRowClick ? 0 : void 0,
3574
+ onClick: () => onRowClick?.(row, index),
3575
+ className: cx(
3576
+ "klun-vtable__row",
3577
+ zebra && index % 2 === 1 && "klun-vtable__row--zebra",
3578
+ onRowClick && "klun-vtable__row--clickable"
3579
+ ),
3580
+ style: { gridTemplateColumns: template, height: rowHeight },
3581
+ children: columns.map((c) => /* @__PURE__ */ jsx("div", { className: cx("klun-vtable__td", c.align && `klun-vtable__td--${c.align}`), children: c.render ? c.render(row, index) : String(row[c.key] ?? "") }, c.key))
3582
+ },
3583
+ id
3584
+ );
3585
+ }),
3586
+ /* @__PURE__ */ jsx("div", { style: { height: Math.max(0, (total - end) * rowHeight) } })
3587
+ ] })
3588
+ }
3589
+ ),
3590
+ /* @__PURE__ */ jsxs("div", { className: "klun-vtable__foot", children: [
3591
+ total.toLocaleString("en-US"),
3592
+ " rows \xB7 rendering ",
3593
+ slice.length
3594
+ ] })
3595
+ ] });
3596
+ }
3597
+ VirtualTable.displayName = "VirtualTable";
3345
3598
  var Kbd = forwardRef(function Kbd2({ className, children, ...props }, ref) {
3346
3599
  return /* @__PURE__ */ jsx("kbd", { ref, className: cx("klun-kbd", className), ...props, children });
3347
3600
  });
@@ -3870,6 +4123,16 @@ function rowsToCsv(columns, rows) {
3870
4123
  const body = rows.map((r) => cols.map((c) => csvCell(c.copyValue ? c.copyValue(r) : r[c.key])).join(",")).join("\n");
3871
4124
  return head + "\n" + body;
3872
4125
  }
4126
+ function reorderRows(rows, fromId, toId, getRowId) {
4127
+ const ids = rows.map(getRowId);
4128
+ const from = ids.indexOf(fromId);
4129
+ const to = ids.indexOf(toId);
4130
+ if (from < 0 || to < 0 || from === to) return null;
4131
+ const next = rows.slice();
4132
+ const [moved] = next.splice(from, 1);
4133
+ next.splice(to, 0, moved);
4134
+ return { next, from, to };
4135
+ }
3873
4136
  function downloadCsv(filename, csv) {
3874
4137
  const blob = new Blob(["\uFEFF" + csv], { type: "text/csv;charset=utf-8;" });
3875
4138
  const url = URL.createObjectURL(blob);
@@ -4432,351 +4695,387 @@ function TableHead({
4432
4695
  })
4433
4696
  ] }) });
4434
4697
  }
4435
- function TableBody({
4436
- loading,
4437
- loadingRows,
4698
+ function TableRow(props) {
4699
+ if (!props.dragCol) return /* @__PURE__ */ jsx(RowBase, { ...props });
4700
+ return /* @__PURE__ */ jsx(SortableRow, { ...props });
4701
+ }
4702
+ function SortableRow(props) {
4703
+ const {
4704
+ attributes,
4705
+ listeners: listeners2,
4706
+ setNodeRef,
4707
+ setActivatorNodeRef,
4708
+ transform,
4709
+ transition,
4710
+ isDragging
4711
+ } = useSortable({ id: props.node.id });
4712
+ return /* @__PURE__ */ jsx(
4713
+ RowBase,
4714
+ {
4715
+ ...props,
4716
+ sortable: {
4717
+ attributes,
4718
+ listeners: listeners2,
4719
+ setNodeRef,
4720
+ setActivatorNodeRef,
4721
+ isDragging,
4722
+ style: { transform: CSS.Transform.toString(transform), transition }
4723
+ }
4724
+ }
4725
+ );
4726
+ }
4727
+ function RowBase({
4728
+ sortable,
4729
+ node,
4730
+ index,
4438
4731
  dragCol,
4439
- expandCol,
4440
- selectable,
4441
- visibleColumns,
4442
- pageRows,
4443
- colCount,
4444
- empty,
4445
- displayRows,
4446
- treeOpen,
4447
- setTreeOpen,
4732
+ tree,
4733
+ indentSize,
4734
+ zebra,
4448
4735
  selected,
4736
+ rowStatus,
4449
4737
  onRowClick,
4450
4738
  rowHref,
4739
+ expandCol,
4740
+ expandable,
4451
4741
  expanded,
4452
4742
  setExpanded,
4453
- expandable,
4454
- rowStatus,
4455
- drag,
4456
- setDrag,
4457
- reorder,
4458
- zebra,
4459
- contextMenu,
4460
- copyable,
4461
- copyRow,
4462
- setMenu,
4463
- leftFixed,
4464
- vBorderClass,
4743
+ treeOpen,
4744
+ setTreeOpen,
4745
+ selectable,
4465
4746
  selectionType,
4466
4747
  onSelectRow,
4748
+ visibleColumns,
4749
+ leftFixed,
4750
+ vBorderClass,
4467
4751
  fixedCell,
4468
4752
  editing,
4469
4753
  setEditing,
4470
4754
  startEdit,
4471
4755
  commitEdit,
4472
4756
  cancelEdit,
4473
- tree,
4474
- indentSize,
4757
+ contextMenu,
4758
+ copyable,
4759
+ copyRow,
4760
+ setMenu,
4761
+ colCount,
4475
4762
  onCopy
4476
4763
  }) {
4477
4764
  const { table } = useLocale();
4478
- const skel = /* @__PURE__ */ jsx("span", { className: "klun-table__skel" });
4479
- return /* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: loadingRows }).map((_, i) => /* @__PURE__ */ jsxs("tr", { className: i ? "klun-table__row--bordered" : void 0, children: [
4480
- dragCol ? /* @__PURE__ */ jsx("td", { className: "klun-table__td" }) : null,
4481
- expandCol ? /* @__PURE__ */ jsx("td", { className: "klun-table__td", children: skel }) : null,
4482
- selectable ? /* @__PURE__ */ jsx("td", { className: "klun-table__td", children: skel }) : null,
4483
- visibleColumns.map((c) => /* @__PURE__ */ jsx("td", { className: "klun-table__td", children: skel }, c.key))
4484
- ] }, "sk" + i)) : pageRows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, className: "klun-table__empty-cell", children: empty != null ? empty : /* @__PURE__ */ jsxs("span", { className: "klun-table__empty", children: [
4485
- /* @__PURE__ */ jsx("i", { className: "ri-inbox-line klun-table__empty-icon" }),
4486
- table.noData
4487
- ] }) }) }) : displayRows.map((node, i) => {
4488
- const row = node.row;
4489
- const id = node.id;
4490
- const depth = node.depth;
4491
- const treeHasKids = node.hasChildren;
4492
- const treeIsOpen = treeOpen.has(id);
4493
- const toggleTree = () => {
4494
- const n = new Set(treeOpen);
4495
- n.has(id) ? n.delete(id) : n.add(id);
4496
- setTreeOpen(n);
4497
- };
4498
- const on = selected.includes(id);
4499
- const clickable = !!(onRowClick || rowHref);
4500
- const isOpen = expanded.has(id);
4501
- const canExpand = expandCol && (!expandable.rowExpandable || expandable.rowExpandable(row));
4502
- const toggleRow = () => {
4503
- const next = new Set(expanded);
4504
- next.has(id) ? next.delete(id) : next.add(id);
4505
- setExpanded(next);
4506
- expandable?.onExpand?.(row, !isOpen);
4507
- };
4508
- const st = rowStatus ? rowStatus(row) : null;
4509
- const dragging = !!(drag && drag.id === id);
4510
- const dropOver = !!(drag && drag.overId === id && drag.id !== id);
4511
- const borderTop = i > 0;
4512
- const tdBorder = borderTop ? "klun-table__td--bordered" : "";
4513
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
4514
- /* @__PURE__ */ jsxs(
4515
- "tr",
4516
- {
4517
- className: cx(
4518
- "klun-table__row",
4519
- on && "klun-table__row--selected",
4520
- zebra && i % 2 === 1 && "klun-table__row--zebra",
4521
- st && `klun-table__row--status-${st}`,
4522
- clickable && "klun-table__row--clickable",
4523
- dragging && "klun-table__row--dragging",
4524
- dropOver && "klun-table__row--dropover",
4525
- dropOver && drag.after && "klun-table__row--dropover-after"
4526
- ),
4527
- onClick: clickable ? () => rowHref ? window.location.href = rowHref(row) : onRowClick(row) : void 0,
4528
- onDragOver: dragCol && drag ? (e) => {
4529
- e.preventDefault();
4530
- const r = e.currentTarget.getBoundingClientRect();
4531
- const after = e.clientY - r.top > r.height / 2;
4532
- if (drag.overId !== id || drag.after !== after)
4533
- setDrag((dd) => dd ? { ...dd, overId: id, after } : dd);
4534
- } : void 0,
4535
- onDrop: dragCol && drag ? (e) => {
4765
+ const row = node.row;
4766
+ const id = node.id;
4767
+ const depth = node.depth;
4768
+ const treeHasKids = node.hasChildren;
4769
+ const treeIsOpen = treeOpen.has(id);
4770
+ const toggleTree = () => {
4771
+ const n = new Set(treeOpen);
4772
+ n.has(id) ? n.delete(id) : n.add(id);
4773
+ setTreeOpen(n);
4774
+ };
4775
+ const on = selected.includes(id);
4776
+ const clickable = !!(onRowClick || rowHref);
4777
+ const isOpen = expanded.has(id);
4778
+ const canExpand = expandCol && (!expandable.rowExpandable || expandable.rowExpandable(row));
4779
+ const toggleRow = () => {
4780
+ const next = new Set(expanded);
4781
+ next.has(id) ? next.delete(id) : next.add(id);
4782
+ setExpanded(next);
4783
+ expandable?.onExpand?.(row, !isOpen);
4784
+ };
4785
+ const st = rowStatus ? rowStatus(row) : null;
4786
+ const tdBorder = index > 0 ? "klun-table__td--bordered" : "";
4787
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
4788
+ /* @__PURE__ */ jsxs(
4789
+ "tr",
4790
+ {
4791
+ ref: sortable?.setNodeRef,
4792
+ style: sortable?.style,
4793
+ className: cx(
4794
+ "klun-table__row",
4795
+ on && "klun-table__row--selected",
4796
+ zebra && index % 2 === 1 && "klun-table__row--zebra",
4797
+ st && `klun-table__row--status-${st}`,
4798
+ clickable && "klun-table__row--clickable",
4799
+ sortable?.isDragging && "klun-table__row--dragging"
4800
+ ),
4801
+ onClick: clickable ? () => rowHref ? window.location.href = rowHref(row) : onRowClick(row) : void 0,
4802
+ onContextMenu: contextMenu || copyable ? (e) => {
4803
+ const custom = contextMenu ? contextMenu(row, { copyRow, copyText }) : null;
4804
+ const items2 = custom && custom.length ? custom : [
4805
+ {
4806
+ label: table.copyRow,
4807
+ icon: "ri-file-copy-line",
4808
+ onClick: () => copyRow(row)
4809
+ }
4810
+ ];
4811
+ if (items2 && items2.length) {
4536
4812
  e.preventDefault();
4537
- reorder(drag.id, id, drag.after);
4538
- setDrag(null);
4539
- } : void 0,
4540
- onContextMenu: contextMenu || copyable ? (e) => {
4541
- const custom = contextMenu ? contextMenu(row, { copyRow, copyText }) : null;
4542
- const items2 = custom && custom.length ? custom : [
4543
- {
4544
- label: table.copyRow,
4545
- icon: "ri-file-copy-line",
4546
- onClick: () => copyRow(row)
4547
- }
4548
- ];
4549
- if (items2 && items2.length) {
4550
- e.preventDefault();
4551
- setMenu({ x: e.clientX, y: e.clientY, items: items2 });
4813
+ setMenu({ x: e.clientX, y: e.clientY, items: items2 });
4814
+ }
4815
+ } : void 0,
4816
+ children: [
4817
+ dragCol ? /* @__PURE__ */ jsx(
4818
+ "td",
4819
+ {
4820
+ ref: sortable?.setActivatorNodeRef,
4821
+ ...sortable?.attributes,
4822
+ ...sortable?.listeners,
4823
+ onClick: (e) => e.stopPropagation(),
4824
+ "aria-label": table.dragToReorder,
4825
+ title: table.dragToReorder,
4826
+ className: cx("klun-table__td", "klun-table__td--util", tdBorder),
4827
+ children: /* @__PURE__ */ jsx("span", { className: "klun-table__draghandle", children: /* @__PURE__ */ jsx("i", { className: "ri-draggable" }) })
4552
4828
  }
4553
- } : void 0,
4554
- children: [
4555
- dragCol ? /* @__PURE__ */ jsx("td", { className: cx("klun-table__td", "klun-table__td--util", tdBorder), children: /* @__PURE__ */ jsx(
4829
+ ) : null,
4830
+ expandCol ? /* @__PURE__ */ jsx(
4831
+ "td",
4832
+ {
4833
+ className: cx(
4834
+ "klun-table__td",
4835
+ "klun-table__td--lead",
4836
+ tdBorder,
4837
+ (leftFixed.length || selectable) && "klun-table__cell--fixed klun-table__cell--fixed-body"
4838
+ ),
4839
+ style: leftFixed.length || selectable ? { left: 0 } : void 0,
4840
+ children: canExpand ? /* @__PURE__ */ jsx(
4841
+ "button",
4842
+ {
4843
+ type: "button",
4844
+ "aria-label": isOpen ? table.collapse : table.expand,
4845
+ "aria-expanded": isOpen,
4846
+ onClick: (e) => {
4847
+ e.stopPropagation();
4848
+ toggleRow();
4849
+ },
4850
+ className: "klun-table__expand-btn",
4851
+ children: /* @__PURE__ */ jsx(
4852
+ "i",
4853
+ {
4854
+ className: cx(
4855
+ "ri-arrow-right-s-line",
4856
+ "klun-table__chevron",
4857
+ isOpen && "klun-table__chevron--open"
4858
+ )
4859
+ }
4860
+ )
4861
+ }
4862
+ ) : null
4863
+ }
4864
+ ) : null,
4865
+ selectable ? /* @__PURE__ */ jsx(
4866
+ "td",
4867
+ {
4868
+ className: cx(
4869
+ "klun-table__td",
4870
+ tdBorder,
4871
+ vBorderClass,
4872
+ leftFixed.length && "klun-table__cell--fixed klun-table__cell--fixed-body"
4873
+ ),
4874
+ style: leftFixed.length ? { left: expandCol ? 44 : 0 } : void 0,
4875
+ children: selectionType === "radio" ? /* @__PURE__ */ jsx(
4876
+ "button",
4877
+ {
4878
+ type: "button",
4879
+ role: "radio",
4880
+ "aria-checked": on,
4881
+ onClick: (e) => {
4882
+ e.stopPropagation();
4883
+ onSelectRow?.(id);
4884
+ },
4885
+ className: cx("klun-table__radio", on && "klun-table__radio--on"),
4886
+ children: on ? /* @__PURE__ */ jsx("span", { className: "klun-table__radio-dot" }) : null
4887
+ }
4888
+ ) : /* @__PURE__ */ jsx(Check, { checked: on, onChange: () => onSelectRow?.(id) })
4889
+ }
4890
+ ) : null,
4891
+ visibleColumns.map((c, ci) => {
4892
+ const fx = fixedCell(c, false);
4893
+ const last = ci === visibleColumns.length - 1;
4894
+ const content = c.render ? c.render(row) : row[c.key];
4895
+ const inner = c.copyable ? /* @__PURE__ */ jsxs(
4556
4896
  "span",
4557
4897
  {
4558
- draggable: true,
4559
- onDragStart: (e) => {
4560
- e.stopPropagation();
4561
- setDrag({ id, overId: id, after: false });
4562
- try {
4563
- e.dataTransfer.effectAllowed = "move";
4564
- e.dataTransfer.setData("text/plain", String(id));
4565
- } catch (x) {
4566
- }
4898
+ className: "klun-table__copycell",
4899
+ onMouseEnter: (e) => {
4900
+ const b = e.currentTarget.querySelector(
4901
+ "[data-copy]"
4902
+ );
4903
+ if (b) b.style.opacity = "1";
4904
+ },
4905
+ onMouseLeave: (e) => {
4906
+ const b = e.currentTarget.querySelector(
4907
+ "[data-copy]"
4908
+ );
4909
+ if (b) b.style.opacity = "0";
4567
4910
  },
4568
- onDragEnd: () => setDrag(null),
4911
+ children: [
4912
+ /* @__PURE__ */ jsx("span", { className: c.ellipsis ? "klun-table__ellipsis" : void 0, children: content }),
4913
+ /* @__PURE__ */ jsx(
4914
+ "button",
4915
+ {
4916
+ type: "button",
4917
+ "data-copy": true,
4918
+ "aria-label": table.copy,
4919
+ onClick: (e) => {
4920
+ e.stopPropagation();
4921
+ copyText(c.copyValue ? c.copyValue(row) : row[c.key]);
4922
+ onCopy?.("cell", row, c.key);
4923
+ },
4924
+ className: "klun-table__copybtn",
4925
+ children: /* @__PURE__ */ jsx("i", { className: "ri-file-copy-line" })
4926
+ }
4927
+ )
4928
+ ]
4929
+ }
4930
+ ) : content;
4931
+ const isEditing = editing && editing.id === id && editing.key === c.key;
4932
+ const editor = isEditing ? c.editor === "select" ? /* @__PURE__ */ jsx(
4933
+ "select",
4934
+ {
4935
+ autoFocus: true,
4936
+ value: editing.value ?? "",
4569
4937
  onClick: (e) => e.stopPropagation(),
4570
- "aria-label": table.dragToReorder,
4571
- title: table.dragToReorder,
4572
- className: "klun-table__draghandle",
4573
- children: /* @__PURE__ */ jsx("i", { className: "ri-draggable" })
4938
+ onChange: (e) => setEditing((ed) => ed ? { ...ed, value: e.target.value } : ed),
4939
+ onBlur: commitEdit,
4940
+ onKeyDown: (e) => {
4941
+ if (e.key === "Enter") commitEdit();
4942
+ if (e.key === "Escape") cancelEdit();
4943
+ },
4944
+ className: "klun-table__editor",
4945
+ children: (c.options || []).map((o) => {
4946
+ const ov = typeof o === "object" ? o.value : o;
4947
+ const ol = typeof o === "object" ? o.label : o;
4948
+ return /* @__PURE__ */ jsx("option", { value: ov, children: ol }, ov);
4949
+ })
4574
4950
  }
4575
- ) }) : null,
4576
- expandCol ? /* @__PURE__ */ jsx(
4577
- "td",
4951
+ ) : /* @__PURE__ */ jsx(
4952
+ "input",
4578
4953
  {
4579
- className: cx(
4580
- "klun-table__td",
4581
- "klun-table__td--lead",
4582
- tdBorder,
4583
- (leftFixed.length || selectable) && "klun-table__cell--fixed klun-table__cell--fixed-body"
4584
- ),
4585
- style: leftFixed.length || selectable ? { left: 0 } : void 0,
4586
- children: canExpand ? /* @__PURE__ */ jsx(
4587
- "button",
4588
- {
4589
- type: "button",
4590
- "aria-label": isOpen ? table.collapse : table.expand,
4591
- "aria-expanded": isOpen,
4592
- onClick: (e) => {
4593
- e.stopPropagation();
4594
- toggleRow();
4595
- },
4596
- className: "klun-table__expand-btn",
4597
- children: /* @__PURE__ */ jsx(
4598
- "i",
4599
- {
4600
- className: cx(
4601
- "ri-arrow-right-s-line",
4602
- "klun-table__chevron",
4603
- isOpen && "klun-table__chevron--open"
4604
- )
4605
- }
4606
- )
4607
- }
4608
- ) : null
4954
+ autoFocus: true,
4955
+ type: c.editor === "number" ? "number" : "text",
4956
+ value: editing.value ?? "",
4957
+ onClick: (e) => e.stopPropagation(),
4958
+ onChange: (e) => setEditing((ed) => ed ? { ...ed, value: e.target.value } : ed),
4959
+ onBlur: commitEdit,
4960
+ onKeyDown: (e) => {
4961
+ if (e.key === "Enter") commitEdit();
4962
+ if (e.key === "Escape") cancelEdit();
4963
+ },
4964
+ className: "klun-table__editor",
4965
+ style: { textAlign: c.align || "left" }
4609
4966
  }
4610
- ) : null,
4611
- selectable ? /* @__PURE__ */ jsx(
4967
+ ) : null;
4968
+ return /* @__PURE__ */ jsx(
4612
4969
  "td",
4613
4970
  {
4971
+ onDoubleClick: c.editable && !isEditing ? (e) => {
4972
+ e.stopPropagation();
4973
+ startEdit(id, c, row);
4974
+ } : void 0,
4614
4975
  className: cx(
4615
4976
  "klun-table__td",
4616
4977
  tdBorder,
4617
- vBorderClass,
4618
- leftFixed.length && "klun-table__cell--fixed klun-table__cell--fixed-body"
4978
+ isEditing && "klun-table__td--editing",
4979
+ (c.nowrap || c.ellipsis) && "klun-table__td--nowrap",
4980
+ c.ellipsis && "klun-table__td--ellipsis",
4981
+ c.editable && !isEditing && "klun-table__td--editable",
4982
+ !last && vBorderClass,
4983
+ fx.cls
4619
4984
  ),
4620
- style: leftFixed.length ? { left: expandCol ? 44 : 0 } : void 0,
4621
- children: selectionType === "radio" ? /* @__PURE__ */ jsx(
4622
- "button",
4623
- {
4624
- type: "button",
4625
- role: "radio",
4626
- "aria-checked": on,
4627
- onClick: (e) => {
4628
- e.stopPropagation();
4629
- onSelectRow?.(id);
4630
- },
4631
- className: cx("klun-table__radio", on && "klun-table__radio--on"),
4632
- children: on ? /* @__PURE__ */ jsx("span", { className: "klun-table__radio-dot" }) : null
4633
- }
4634
- ) : /* @__PURE__ */ jsx(Check, { checked: on, onChange: () => onSelectRow?.(id) })
4635
- }
4636
- ) : null,
4637
- visibleColumns.map((c, ci) => {
4638
- const fx = fixedCell(c, false);
4639
- const last = ci === visibleColumns.length - 1;
4640
- const content = c.render ? c.render(row) : row[c.key];
4641
- const inner = c.copyable ? /* @__PURE__ */ jsxs(
4642
- "span",
4643
- {
4644
- className: "klun-table__copycell",
4645
- onMouseEnter: (e) => {
4646
- const b = e.currentTarget.querySelector(
4647
- "[data-copy]"
4648
- );
4649
- if (b) b.style.opacity = "1";
4650
- },
4651
- onMouseLeave: (e) => {
4652
- const b = e.currentTarget.querySelector(
4653
- "[data-copy]"
4654
- );
4655
- if (b) b.style.opacity = "0";
4656
- },
4657
- children: [
4658
- /* @__PURE__ */ jsx("span", { className: c.ellipsis ? "klun-table__ellipsis" : void 0, children: content }),
4659
- /* @__PURE__ */ jsx(
4660
- "button",
4661
- {
4662
- type: "button",
4663
- "data-copy": true,
4664
- "aria-label": table.copy,
4665
- onClick: (e) => {
4666
- e.stopPropagation();
4667
- copyText(c.copyValue ? c.copyValue(row) : row[c.key]);
4668
- onCopy?.("cell", row, c.key);
4669
- },
4670
- className: "klun-table__copybtn",
4671
- children: /* @__PURE__ */ jsx("i", { className: "ri-file-copy-line" })
4672
- }
4673
- )
4674
- ]
4675
- }
4676
- ) : content;
4677
- const isEditing = editing && editing.id === id && editing.key === c.key;
4678
- const editor = isEditing ? c.editor === "select" ? /* @__PURE__ */ jsx(
4679
- "select",
4680
- {
4681
- autoFocus: true,
4682
- value: editing.value ?? "",
4683
- onClick: (e) => e.stopPropagation(),
4684
- onChange: (e) => setEditing((ed) => ed ? { ...ed, value: e.target.value } : ed),
4685
- onBlur: commitEdit,
4686
- onKeyDown: (e) => {
4687
- if (e.key === "Enter") commitEdit();
4688
- if (e.key === "Escape") cancelEdit();
4689
- },
4690
- className: "klun-table__editor",
4691
- children: (c.options || []).map((o) => {
4692
- const ov = typeof o === "object" ? o.value : o;
4693
- const ol = typeof o === "object" ? o.label : o;
4694
- return /* @__PURE__ */ jsx("option", { value: ov, children: ol }, ov);
4695
- })
4696
- }
4697
- ) : /* @__PURE__ */ jsx(
4698
- "input",
4699
- {
4700
- autoFocus: true,
4701
- type: c.editor === "number" ? "number" : "text",
4702
- value: editing.value ?? "",
4703
- onClick: (e) => e.stopPropagation(),
4704
- onChange: (e) => setEditing((ed) => ed ? { ...ed, value: e.target.value } : ed),
4705
- onBlur: commitEdit,
4706
- onKeyDown: (e) => {
4707
- if (e.key === "Enter") commitEdit();
4708
- if (e.key === "Escape") cancelEdit();
4709
- },
4710
- className: "klun-table__editor",
4711
- style: { textAlign: c.align || "left" }
4712
- }
4713
- ) : null;
4714
- return /* @__PURE__ */ jsx(
4715
- "td",
4716
- {
4717
- onDoubleClick: c.editable && !isEditing ? (e) => {
4718
- e.stopPropagation();
4719
- startEdit(id, c, row);
4720
- } : void 0,
4721
- className: cx(
4722
- "klun-table__td",
4723
- tdBorder,
4724
- isEditing && "klun-table__td--editing",
4725
- (c.nowrap || c.ellipsis) && "klun-table__td--nowrap",
4726
- c.ellipsis && "klun-table__td--ellipsis",
4727
- c.editable && !isEditing && "klun-table__td--editable",
4728
- !last && vBorderClass,
4729
- fx.cls
4730
- ),
4731
- style: {
4732
- textAlign: c.align || "left",
4733
- ...c.ellipsis ? { maxWidth: c.width || 200 } : null,
4734
- ...fx.style
4735
- },
4736
- title: c.editable && !isEditing ? table.editHint : c.ellipsis && typeof content === "string" ? content : void 0,
4737
- children: isEditing ? editor : tree && ci === 0 ? /* @__PURE__ */ jsxs("span", { className: "klun-table__tree-cell", children: [
4738
- /* @__PURE__ */ jsx(
4739
- "span",
4740
- {
4741
- className: "klun-table__tree-indent",
4742
- style: { width: depth * indentSize }
4743
- }
4744
- ),
4745
- treeHasKids ? /* @__PURE__ */ jsx(
4746
- "button",
4747
- {
4748
- type: "button",
4749
- "aria-label": treeIsOpen ? table.collapse : table.expand,
4750
- "aria-expanded": treeIsOpen,
4751
- onClick: (e) => {
4752
- e.stopPropagation();
4753
- toggleTree();
4754
- },
4755
- className: "klun-table__tree-toggle",
4756
- children: /* @__PURE__ */ jsx(
4757
- "i",
4758
- {
4759
- className: cx(
4760
- "ri-arrow-right-s-line",
4761
- "klun-table__chevron",
4762
- treeIsOpen && "klun-table__chevron--open"
4763
- )
4764
- }
4765
- )
4766
- }
4767
- ) : /* @__PURE__ */ jsx("span", { className: "klun-table__tree-spacer" }),
4768
- inner
4769
- ] }) : inner
4985
+ style: {
4986
+ textAlign: c.align || "left",
4987
+ ...c.ellipsis ? { maxWidth: c.width || 200 } : null,
4988
+ ...fx.style
4770
4989
  },
4771
- c.key
4772
- );
4773
- })
4774
- ]
4775
- }
4776
- ),
4777
- expandCol && isOpen ? /* @__PURE__ */ jsx("tr", { className: "klun-table__expand-row", children: /* @__PURE__ */ jsx("td", { colSpan: colCount, className: "klun-table__expand-cell", children: /* @__PURE__ */ jsx("div", { className: "klun-table__expand-panel", children: expandable.render(row) }) }) }) : null
4778
- ] }, id);
4779
- }) });
4990
+ title: c.editable && !isEditing ? table.editHint : c.ellipsis && typeof content === "string" ? content : void 0,
4991
+ children: isEditing ? editor : tree && ci === 0 ? /* @__PURE__ */ jsxs("span", { className: "klun-table__tree-cell", children: [
4992
+ /* @__PURE__ */ jsx(
4993
+ "span",
4994
+ {
4995
+ className: "klun-table__tree-indent",
4996
+ style: { width: depth * indentSize }
4997
+ }
4998
+ ),
4999
+ treeHasKids ? /* @__PURE__ */ jsx(
5000
+ "button",
5001
+ {
5002
+ type: "button",
5003
+ "aria-label": treeIsOpen ? table.collapse : table.expand,
5004
+ "aria-expanded": treeIsOpen,
5005
+ onClick: (e) => {
5006
+ e.stopPropagation();
5007
+ toggleTree();
5008
+ },
5009
+ className: "klun-table__tree-toggle",
5010
+ children: /* @__PURE__ */ jsx(
5011
+ "i",
5012
+ {
5013
+ className: cx(
5014
+ "ri-arrow-right-s-line",
5015
+ "klun-table__chevron",
5016
+ treeIsOpen && "klun-table__chevron--open"
5017
+ )
5018
+ }
5019
+ )
5020
+ }
5021
+ ) : /* @__PURE__ */ jsx("span", { className: "klun-table__tree-spacer" }),
5022
+ inner
5023
+ ] }) : inner
5024
+ },
5025
+ c.key
5026
+ );
5027
+ })
5028
+ ]
5029
+ }
5030
+ ),
5031
+ expandCol && isOpen ? /* @__PURE__ */ jsx("tr", { className: "klun-table__expand-row", children: /* @__PURE__ */ jsx("td", { colSpan: colCount, className: "klun-table__expand-cell", children: /* @__PURE__ */ jsx("div", { className: "klun-table__expand-panel", children: expandable.render(row) }) }) }) : null
5032
+ ] });
5033
+ }
5034
+ function TableBody({
5035
+ loading,
5036
+ loadingRows,
5037
+ pageRows,
5038
+ empty,
5039
+ displayRows,
5040
+ dragCol,
5041
+ expandCol,
5042
+ selectable,
5043
+ visibleColumns,
5044
+ colCount,
5045
+ ...row
5046
+ }) {
5047
+ const { table } = useLocale();
5048
+ const skel = /* @__PURE__ */ jsx("span", { className: "klun-table__skel" });
5049
+ const bodyRows = displayRows.map((node, index) => /* @__PURE__ */ jsx(
5050
+ TableRow,
5051
+ {
5052
+ node,
5053
+ index,
5054
+ dragCol,
5055
+ expandCol,
5056
+ selectable,
5057
+ visibleColumns,
5058
+ colCount,
5059
+ ...row
5060
+ },
5061
+ node.id
5062
+ ));
5063
+ return /* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: loadingRows }).map((_, i) => /* @__PURE__ */ jsxs("tr", { className: i ? "klun-table__row--bordered" : void 0, children: [
5064
+ dragCol ? /* @__PURE__ */ jsx("td", { className: "klun-table__td" }) : null,
5065
+ expandCol ? /* @__PURE__ */ jsx("td", { className: "klun-table__td", children: skel }) : null,
5066
+ selectable ? /* @__PURE__ */ jsx("td", { className: "klun-table__td", children: skel }) : null,
5067
+ visibleColumns.map((c) => /* @__PURE__ */ jsx("td", { className: "klun-table__td", children: skel }, c.key))
5068
+ ] }, "sk" + i)) : pageRows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, className: "klun-table__empty-cell", children: empty != null ? empty : /* @__PURE__ */ jsxs("span", { className: "klun-table__empty", children: [
5069
+ /* @__PURE__ */ jsx("i", { className: "ri-inbox-line klun-table__empty-icon" }),
5070
+ table.noData
5071
+ ] }) }) }) : dragCol ? /* @__PURE__ */ jsx(
5072
+ SortableContext,
5073
+ {
5074
+ items: displayRows.map((n) => n.id),
5075
+ strategy: verticalListSortingStrategy,
5076
+ children: bodyRows
5077
+ }
5078
+ ) : bodyRows });
4780
5079
  }
4781
5080
  function TableFooter({
4782
5081
  summary,
@@ -4979,28 +5278,6 @@ function useExpandedRows({
4979
5278
  }, [tree, pageRows, treeOpen, childrenKey, getRowId]);
4980
5279
  return { treeOpen, setTreeOpen, expanded, setExpanded, displayRows };
4981
5280
  }
4982
- function useRowReorder({
4983
- rows,
4984
- getRowId,
4985
- onReorder
4986
- }) {
4987
- const [drag, setDrag] = useState(null);
4988
- const reorder = (fromId, toId, after) => {
4989
- if (fromId === toId) return;
4990
- const ids = rows.map(getRowId);
4991
- const from = ids.indexOf(fromId);
4992
- const to = ids.indexOf(toId);
4993
- if (from < 0 || to < 0) return;
4994
- const next = rows.slice();
4995
- const [moved] = next.splice(from, 1);
4996
- let insert = rows.findIndex((r, i) => getRowId(r, i) === toId);
4997
- if (after) insert += 1;
4998
- if (from < insert) insert -= 1;
4999
- next.splice(insert, 0, moved);
5000
- onReorder?.(next, from, insert);
5001
- };
5002
- return { drag, setDrag, reorder };
5003
- }
5004
5281
  function useCellEdit({
5005
5282
  columns,
5006
5283
  rows,
@@ -5024,6 +5301,27 @@ function useCellEdit({
5024
5301
  const cancelEdit = () => setEditing(null);
5025
5302
  return { editing, setEditing, startEdit, commitEdit, cancelEdit };
5026
5303
  }
5304
+ var dragModifiers = [({ transform }) => ({ ...transform, x: 0 })];
5305
+ function RowsDnd({
5306
+ enabled,
5307
+ sensors,
5308
+ onDragEnd,
5309
+ instructions,
5310
+ children
5311
+ }) {
5312
+ if (!enabled) return /* @__PURE__ */ jsx(Fragment, { children });
5313
+ return /* @__PURE__ */ jsx(
5314
+ DndContext,
5315
+ {
5316
+ sensors,
5317
+ collisionDetection: closestCenter,
5318
+ modifiers: dragModifiers,
5319
+ onDragEnd,
5320
+ accessibility: { screenReaderInstructions: { draggable: instructions } },
5321
+ children
5322
+ }
5323
+ );
5324
+ }
5027
5325
  var DENSITY = {
5028
5326
  compact: "klun-table--compact",
5029
5327
  comfortable: "klun-table--comfortable",
@@ -5170,7 +5468,16 @@ function Table({
5170
5468
  );
5171
5469
  const showToolbar = title != null || toolbar != null || !!exportable || columnSettings;
5172
5470
  const clearSelection = () => onSelectAll && onSelectAll([]);
5173
- const { drag, setDrag, reorder } = useRowReorder({ rows, getRowId, onReorder });
5471
+ const { table: t } = useLocale();
5472
+ const sensors = useSensors(
5473
+ useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
5474
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
5475
+ );
5476
+ const handleDragEnd = ({ active, over }) => {
5477
+ if (!over) return;
5478
+ const moved = reorderRows(rows, active.id, over.id, getRowId);
5479
+ if (moved) onReorder?.(moved.next, moved.from, moved.to);
5480
+ };
5174
5481
  const { editing, setEditing, startEdit, commitEdit, cancelEdit } = useCellEdit({
5175
5482
  columns,
5176
5483
  rows,
@@ -5213,113 +5520,119 @@ function Table({
5213
5520
  }
5214
5521
  ),
5215
5522
  /* @__PURE__ */ jsx(
5216
- "div",
5523
+ RowsDnd,
5217
5524
  {
5218
- className: "klun-table__scroller",
5219
- style: stickyHeader ? {
5220
- ["--klun-table-max-height"]: `${style && style.maxHeight || 420}${typeof (style && style.maxHeight) === "number" ? "px" : ""}`
5221
- } : void 0,
5222
- children: /* @__PURE__ */ jsxs(
5223
- "table",
5525
+ enabled: dragCol,
5526
+ sensors,
5527
+ onDragEnd: handleDragEnd,
5528
+ instructions: t.dragToReorder,
5529
+ children: /* @__PURE__ */ jsx(
5530
+ "div",
5224
5531
  {
5225
- className: cx(
5226
- "klun-table__table",
5227
- Object.keys(colW).length && "klun-table__table--fixed-layout"
5228
- ),
5229
- children: [
5230
- /* @__PURE__ */ jsxs("colgroup", { children: [
5231
- dragCol ? /* @__PURE__ */ jsx("col", { className: "klun-table__col-util" }) : null,
5232
- expandCol ? /* @__PURE__ */ jsx("col", { className: "klun-table__col-lead" }) : null,
5233
- selectable ? /* @__PURE__ */ jsx("col", { className: "klun-table__col-lead" }) : null,
5234
- columns.map((c) => {
5235
- const w = widthOf(c);
5236
- return hiddenCols.has(c.key) ? null : /* @__PURE__ */ jsx("col", { style: w ? { width: w } : void 0 }, c.key);
5237
- })
5238
- ] }),
5239
- caption ? /* @__PURE__ */ jsx("caption", { className: "klun-table__caption", children: caption }) : null,
5240
- /* @__PURE__ */ jsx(
5241
- TableHead,
5242
- {
5243
- dragCol,
5244
- expandCol,
5245
- selectable,
5246
- leftFixed,
5247
- vBorderClass,
5248
- selectionType,
5249
- allOn,
5250
- someOn,
5251
- toggleAll,
5252
- visibleColumns,
5253
- sortable,
5254
- activeSort,
5255
- resizable,
5256
- widthOf,
5257
- fixedCell,
5258
- setSort,
5259
- activeFilters,
5260
- setFilter,
5261
- startResize
5262
- }
5263
- ),
5264
- /* @__PURE__ */ jsx(
5265
- TableBody,
5266
- {
5267
- loading,
5268
- loadingRows,
5269
- dragCol,
5270
- expandCol,
5271
- selectable,
5272
- visibleColumns,
5273
- pageRows,
5274
- colCount,
5275
- empty,
5276
- displayRows,
5277
- treeOpen,
5278
- setTreeOpen,
5279
- selected,
5280
- onRowClick,
5281
- rowHref,
5282
- expanded,
5283
- setExpanded,
5284
- expandable,
5285
- rowStatus,
5286
- drag,
5287
- setDrag,
5288
- reorder,
5289
- zebra,
5290
- contextMenu,
5291
- copyable,
5292
- copyRow,
5293
- setMenu,
5294
- leftFixed,
5295
- vBorderClass,
5296
- selectionType,
5297
- onSelectRow,
5298
- fixedCell,
5299
- editing,
5300
- setEditing,
5301
- startEdit,
5302
- commitEdit,
5303
- cancelEdit,
5304
- tree,
5305
- indentSize,
5306
- onCopy
5307
- }
5308
- ),
5309
- /* @__PURE__ */ jsx(
5310
- TableFooter,
5311
- {
5312
- summary,
5313
- expandCol,
5314
- selectable,
5315
- pageRows,
5316
- visibleColumns,
5317
- vBorderClass,
5318
- footer,
5319
- colCount
5320
- }
5321
- )
5322
- ]
5532
+ className: "klun-table__scroller",
5533
+ style: stickyHeader ? {
5534
+ ["--klun-table-max-height"]: `${style && style.maxHeight || 420}${typeof (style && style.maxHeight) === "number" ? "px" : ""}`
5535
+ } : void 0,
5536
+ children: /* @__PURE__ */ jsxs(
5537
+ "table",
5538
+ {
5539
+ className: cx(
5540
+ "klun-table__table",
5541
+ Object.keys(colW).length && "klun-table__table--fixed-layout"
5542
+ ),
5543
+ children: [
5544
+ /* @__PURE__ */ jsxs("colgroup", { children: [
5545
+ dragCol ? /* @__PURE__ */ jsx("col", { className: "klun-table__col-util" }) : null,
5546
+ expandCol ? /* @__PURE__ */ jsx("col", { className: "klun-table__col-lead" }) : null,
5547
+ selectable ? /* @__PURE__ */ jsx("col", { className: "klun-table__col-lead" }) : null,
5548
+ columns.map((c) => {
5549
+ const w = widthOf(c);
5550
+ return hiddenCols.has(c.key) ? null : /* @__PURE__ */ jsx("col", { style: w ? { width: w } : void 0 }, c.key);
5551
+ })
5552
+ ] }),
5553
+ caption ? /* @__PURE__ */ jsx("caption", { className: "klun-table__caption", children: caption }) : null,
5554
+ /* @__PURE__ */ jsx(
5555
+ TableHead,
5556
+ {
5557
+ dragCol,
5558
+ expandCol,
5559
+ selectable,
5560
+ leftFixed,
5561
+ vBorderClass,
5562
+ selectionType,
5563
+ allOn,
5564
+ someOn,
5565
+ toggleAll,
5566
+ visibleColumns,
5567
+ sortable,
5568
+ activeSort,
5569
+ resizable,
5570
+ widthOf,
5571
+ fixedCell,
5572
+ setSort,
5573
+ activeFilters,
5574
+ setFilter,
5575
+ startResize
5576
+ }
5577
+ ),
5578
+ /* @__PURE__ */ jsx(
5579
+ TableBody,
5580
+ {
5581
+ loading,
5582
+ loadingRows,
5583
+ dragCol,
5584
+ expandCol,
5585
+ selectable,
5586
+ visibleColumns,
5587
+ pageRows,
5588
+ colCount,
5589
+ empty,
5590
+ displayRows,
5591
+ treeOpen,
5592
+ setTreeOpen,
5593
+ selected,
5594
+ onRowClick,
5595
+ rowHref,
5596
+ expanded,
5597
+ setExpanded,
5598
+ expandable,
5599
+ rowStatus,
5600
+ zebra,
5601
+ contextMenu,
5602
+ copyable,
5603
+ copyRow,
5604
+ setMenu,
5605
+ leftFixed,
5606
+ vBorderClass,
5607
+ selectionType,
5608
+ onSelectRow,
5609
+ fixedCell,
5610
+ editing,
5611
+ setEditing,
5612
+ startEdit,
5613
+ commitEdit,
5614
+ cancelEdit,
5615
+ tree,
5616
+ indentSize,
5617
+ onCopy
5618
+ }
5619
+ ),
5620
+ /* @__PURE__ */ jsx(
5621
+ TableFooter,
5622
+ {
5623
+ summary,
5624
+ expandCol,
5625
+ selectable,
5626
+ pageRows,
5627
+ visibleColumns,
5628
+ vBorderClass,
5629
+ footer,
5630
+ colCount
5631
+ }
5632
+ )
5633
+ ]
5634
+ }
5635
+ )
5323
5636
  }
5324
5637
  )
5325
5638
  }
@@ -7497,6 +7810,149 @@ var CompactSelectForInput = forwardRef(function CompactSelectForInput2({
7497
7810
  );
7498
7811
  });
7499
7812
  CompactSelectForInput.displayName = "CompactSelectForInput";
7813
+ var CRON_PRESETS = [
7814
+ { label: "Every 5 minutes", value: "*/5 * * * *" },
7815
+ { label: "Every 15 minutes", value: "*/15 * * * *" },
7816
+ { label: "Hourly", value: "0 * * * *" },
7817
+ { label: "Every day at 03:00", value: "0 3 * * *" },
7818
+ { label: "Weekdays at 09:00", value: "0 9 * * 1-5" },
7819
+ { label: "Mondays at 09:00", value: "0 9 * * 1" },
7820
+ { label: "1st of the month", value: "0 6 1 * *" }
7821
+ ];
7822
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
7823
+ var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
7824
+ var pad = (n) => n.padStart(2, "0");
7825
+ function describeCron(cron) {
7826
+ const parts = cron.trim().split(/\s+/);
7827
+ if (parts.length !== 5) return cron;
7828
+ const [min, hour, day, month, week] = parts;
7829
+ const everyMin = min.startsWith("*/") ? `every ${min.slice(2)} minutes` : min === "*" ? "every minute" : null;
7830
+ const at = hour === "*" ? "" : ` at ${pad(hour)}:${pad(min)}`;
7831
+ const dayPart = week === "*" && day === "*" ? month === "*" ? "every day" : `on day ${day} of month ${month}` : week !== "*" ? `on ${week.split(",").map((w) => w.includes("-") ? w.split("-").map((x) => DAYS[Number(x)] ?? x).join("\u2013") : DAYS[Number(w)] ?? w).join(", ")}` : `on day ${day} of the month`;
7832
+ if (everyMin) return `${everyMin.charAt(0).toUpperCase()}${everyMin.slice(1)}${at}`;
7833
+ if (min !== "*" && hour !== "*" && day === "*" && week === "*") {
7834
+ return `${month === "*" ? "Every day" : `On day ${day} of month ${MONTHS[Number(month) - 1] ?? month}`}${at}`;
7835
+ }
7836
+ return `${dayPart.charAt(0).toUpperCase()}${dayPart.slice(1)}${at}`;
7837
+ }
7838
+ function parse(cron) {
7839
+ const p = cron.trim().split(/\s+/);
7840
+ return [p[0] ?? "*", p[1] ?? "*", p[2] ?? "*", p[3] ?? "*", p[4] ?? "*"];
7841
+ }
7842
+ var CronEditor = forwardRef(function CronEditor2({
7843
+ value,
7844
+ defaultValue = "0 3 * * *",
7845
+ onChange,
7846
+ hidePresets = false,
7847
+ disabled = false,
7848
+ size: sizeProp,
7849
+ labels,
7850
+ className,
7851
+ style,
7852
+ ...props
7853
+ }, ref) {
7854
+ const size = useSize(sizeProp) === "small" ? "small" : "medium";
7855
+ const text = {
7856
+ minute: "Minute",
7857
+ hour: "Hour",
7858
+ day: "Day",
7859
+ month: "Month",
7860
+ weekday: "Weekday",
7861
+ every: "Every",
7862
+ expression: "Expression",
7863
+ ...labels
7864
+ };
7865
+ const [inner, setInner] = useState(defaultValue);
7866
+ const current = value ?? inner;
7867
+ const [fields, setFields] = useState(parse(current));
7868
+ useEffect(() => {
7869
+ setFields(parse(current));
7870
+ }, [current]);
7871
+ const commit = (next) => {
7872
+ if (value === void 0) setInner(next);
7873
+ onChange?.(next);
7874
+ };
7875
+ const setField = (index, next) => {
7876
+ const copy = [...fields];
7877
+ copy[index] = next;
7878
+ setFields(copy);
7879
+ commit(copy.join(" "));
7880
+ };
7881
+ const options = useMemo(
7882
+ () => ({
7883
+ minute: ["*", "*/5", "*/10", "*/15", "*/30", "0", "15", "30", "45"],
7884
+ hour: ["*", ...Array.from({ length: 24 }, (_, i) => String(i))],
7885
+ day: ["*", ...Array.from({ length: 31 }, (_, i) => String(i + 1))],
7886
+ month: ["*", ...Array.from({ length: 12 }, (_, i) => String(i + 1))],
7887
+ weekday: ["*", "1-5", "0", "1", "2", "3", "4", "5", "6"]
7888
+ }),
7889
+ []
7890
+ );
7891
+ const fieldLabel = (key, v) => {
7892
+ if (v === "*") return text.every;
7893
+ if (key === "month") return MONTHS[Number(v) - 1] ?? v;
7894
+ if (key === "weekday") return v.includes("-") ? "Mon\u2013Fri" : DAYS[Number(v)] ?? v;
7895
+ if (key === "hour") return `${pad(v)}:00`;
7896
+ return v;
7897
+ };
7898
+ const desc = describeCron(current);
7899
+ return /* @__PURE__ */ jsxs(
7900
+ "div",
7901
+ {
7902
+ ref,
7903
+ className: cx("klun-cron", `klun-cron--${size}`, disabled && "klun-cron--disabled", className),
7904
+ style,
7905
+ ...props,
7906
+ children: [
7907
+ !hidePresets ? /* @__PURE__ */ jsx("div", { className: "klun-cron__presets", children: CRON_PRESETS.map((p) => /* @__PURE__ */ jsx(
7908
+ "button",
7909
+ {
7910
+ type: "button",
7911
+ disabled,
7912
+ onClick: () => commit(p.value),
7913
+ "data-active": current === p.value || void 0,
7914
+ className: "klun-cron__preset",
7915
+ children: p.label
7916
+ },
7917
+ p.value
7918
+ )) }) : null,
7919
+ /* @__PURE__ */ jsx("div", { className: "klun-cron__fields", children: ["minute", "hour", "day", "month", "weekday"].map((key, i) => /* @__PURE__ */ jsxs("label", { className: "klun-cron__field", children: [
7920
+ /* @__PURE__ */ jsx("span", { className: "klun-cron__field-label", children: text[key] }),
7921
+ /* @__PURE__ */ jsx(
7922
+ "select",
7923
+ {
7924
+ disabled,
7925
+ value: fields[i],
7926
+ onChange: (e) => setField(i, e.target.value),
7927
+ className: "klun-cron__select",
7928
+ children: options[key].map((v) => /* @__PURE__ */ jsx("option", { value: v, children: fieldLabel(key, v) }, v))
7929
+ }
7930
+ )
7931
+ ] }, key)) }),
7932
+ /* @__PURE__ */ jsxs("div", { className: "klun-cron__footer", children: [
7933
+ /* @__PURE__ */ jsxs("label", { className: "klun-cron__raw", children: [
7934
+ /* @__PURE__ */ jsx("span", { className: "klun-cron__field-label", children: text.expression }),
7935
+ /* @__PURE__ */ jsx(
7936
+ "input",
7937
+ {
7938
+ disabled,
7939
+ value: current,
7940
+ onChange: (e) => commit(e.target.value),
7941
+ spellCheck: false,
7942
+ className: "klun-cron__input"
7943
+ }
7944
+ )
7945
+ ] }),
7946
+ /* @__PURE__ */ jsxs("div", { className: "klun-cron__preview", children: [
7947
+ /* @__PURE__ */ jsx("i", { className: "ri-time-line" }),
7948
+ desc
7949
+ ] })
7950
+ ] })
7951
+ ]
7952
+ }
7953
+ );
7954
+ });
7955
+ CronEditor.displayName = "CronEditor";
7500
7956
  var CounterInput = forwardRef(function CounterInput2({
7501
7957
  value = 0,
7502
7958
  min = -Infinity,
@@ -7926,7 +8382,7 @@ var DateRangePicker = forwardRef(
7926
8382
  }
7927
8383
  );
7928
8384
  DateRangePicker.displayName = "DateRangePicker";
7929
- var pad = (n) => String(n).padStart(2, "0");
8385
+ var pad2 = (n) => String(n).padStart(2, "0");
7930
8386
  var TimePicker = forwardRef(
7931
8387
  function TimePicker2({ value = "09:00", onChange, className, style, ...props }, ref) {
7932
8388
  const t = useLocale();
@@ -7936,7 +8392,7 @@ var TimePicker = forwardRef(
7936
8392
  const set = (nh, nm, nmer) => {
7937
8393
  let hh = nh % 12;
7938
8394
  if (nmer === "PM") hh += 12;
7939
- onChange?.(`${pad(hh)}:${pad(nm)}`);
8395
+ onChange?.(`${pad2(hh)}:${pad2(nm)}`);
7940
8396
  };
7941
8397
  const [open, setOpen] = useState(null);
7942
8398
  const rootRef = useRef(null);
@@ -7955,11 +8411,11 @@ var TimePicker = forwardRef(
7955
8411
  }, [open]);
7956
8412
  const hourOpts = Array.from({ length: 12 }, (_, i) => ({
7957
8413
  value: String(i + 1),
7958
- label: pad(i + 1)
8414
+ label: pad2(i + 1)
7959
8415
  }));
7960
8416
  const minOpts = Array.from({ length: 60 }, (_, i) => ({
7961
8417
  value: String(i),
7962
- label: pad(i)
8418
+ label: pad2(i)
7963
8419
  }));
7964
8420
  const merOpts = [
7965
8421
  { value: "AM", label: t.timePicker.am },
@@ -8126,7 +8582,7 @@ function TimeColumn({
8126
8582
  ] });
8127
8583
  }
8128
8584
  TimePicker.displayName = "TimePicker";
8129
- var pad2 = (n) => String(n).padStart(2, "0");
8585
+ var pad3 = (n) => String(n).padStart(2, "0");
8130
8586
  var DEFAULT_FORMAT3 = {
8131
8587
  year: "numeric",
8132
8588
  month: "short",
@@ -8135,7 +8591,7 @@ var DEFAULT_FORMAT3 = {
8135
8591
  minute: "2-digit"
8136
8592
  };
8137
8593
  function DateTimePanel({ value, onChange }) {
8138
- const hhmm = value ? `${pad2(value.getHours())}:${pad2(value.getMinutes())}` : "09:00";
8594
+ const hhmm = value ? `${pad3(value.getHours())}:${pad3(value.getMinutes())}` : "09:00";
8139
8595
  const setDate = (d) => {
8140
8596
  const next = new Date(d);
8141
8597
  if (value) next.setHours(value.getHours(), value.getMinutes(), 0, 0);
@@ -9118,6 +9574,192 @@ var RichEditorToolbar = forwardRef(
9118
9574
  }
9119
9575
  );
9120
9576
  RichEditorToolbar.displayName = "RichEditorToolbar";
9577
+ var Textarea = forwardRef(function Textarea2({ error = false, disabled = false, readOnly = false, size: sizeProp, rows = 4, className, style, ...props }, ref) {
9578
+ const size = useSize(sizeProp);
9579
+ return /* @__PURE__ */ jsx(
9580
+ "div",
9581
+ {
9582
+ className: cx(
9583
+ "klun-textarea",
9584
+ `klun-textarea--${size}`,
9585
+ error && "klun-textarea--error",
9586
+ disabled && "klun-textarea--disabled",
9587
+ readOnly && "klun-textarea--readonly",
9588
+ className
9589
+ ),
9590
+ style,
9591
+ children: /* @__PURE__ */ jsx(
9592
+ "textarea",
9593
+ {
9594
+ ref,
9595
+ className: "klun-textarea__field",
9596
+ rows,
9597
+ disabled,
9598
+ readOnly,
9599
+ ...props
9600
+ }
9601
+ )
9602
+ }
9603
+ );
9604
+ });
9605
+ Textarea.displayName = "Textarea";
9606
+ function runCommand(id) {
9607
+ const exec = (cmd, arg) => document.execCommand(cmd, false, arg);
9608
+ if (typeof document.execCommand !== "function") return;
9609
+ switch (id) {
9610
+ case "bold":
9611
+ case "italic":
9612
+ case "underline":
9613
+ case "strikeThrough":
9614
+ exec(id);
9615
+ break;
9616
+ case "strike":
9617
+ exec("strikeThrough");
9618
+ break;
9619
+ case "h1":
9620
+ exec("formatBlock", "<h1>");
9621
+ break;
9622
+ case "h2":
9623
+ exec("formatBlock", "<h2>");
9624
+ break;
9625
+ case "quote":
9626
+ exec("formatBlock", "<blockquote>");
9627
+ break;
9628
+ case "code":
9629
+ exec("formatBlock", "<pre>");
9630
+ break;
9631
+ case "ul":
9632
+ exec("insertUnorderedList");
9633
+ break;
9634
+ case "ol":
9635
+ exec("insertOrderedList");
9636
+ break;
9637
+ case "link": {
9638
+ const url = typeof window !== "undefined" ? window.prompt("Link URL", "https://") : null;
9639
+ if (url) exec("createLink", url);
9640
+ break;
9641
+ }
9642
+ case "image": {
9643
+ const url = typeof window !== "undefined" ? window.prompt("Image URL", "https://") : null;
9644
+ if (url) exec("insertImage", url);
9645
+ break;
9646
+ }
9647
+ }
9648
+ }
9649
+ var RichEditor = forwardRef(function RichEditor2({
9650
+ value,
9651
+ defaultValue = "",
9652
+ onChange,
9653
+ placeholder = "Write something\u2026",
9654
+ disabled = false,
9655
+ hideToolbar = false,
9656
+ minHeight = 160,
9657
+ maxHeight,
9658
+ allowSource = true,
9659
+ editorLabel = "Rich text editor",
9660
+ className,
9661
+ style,
9662
+ ...props
9663
+ }, ref) {
9664
+ const editorRef = useRef(null);
9665
+ const [active, setActive] = useState([]);
9666
+ const [source, setSource] = useState(false);
9667
+ const [html, setHtml] = useState(value ?? defaultValue);
9668
+ useEffect(() => {
9669
+ const el = editorRef.current;
9670
+ if (!el) return;
9671
+ const next = value ?? html;
9672
+ if (document.activeElement !== el && el.innerHTML !== next) el.innerHTML = next;
9673
+ }, [value]);
9674
+ useEffect(() => {
9675
+ if (disabled || typeof document.execCommand !== "function") return;
9676
+ document.execCommand("defaultParagraphSeparator", false, "p");
9677
+ }, [disabled]);
9678
+ const emit2 = () => {
9679
+ const next = editorRef.current?.innerHTML ?? "";
9680
+ setHtml(next);
9681
+ onChange?.(next);
9682
+ };
9683
+ const syncActive = () => {
9684
+ if (typeof document.queryCommandState !== "function") return;
9685
+ const next = [];
9686
+ ["bold", "italic", "underline"].forEach((c) => {
9687
+ if (document.queryCommandState(c)) next.push(c);
9688
+ });
9689
+ setActive(next);
9690
+ };
9691
+ const onAction = (id) => {
9692
+ if (disabled) return;
9693
+ editorRef.current?.focus();
9694
+ runCommand(id);
9695
+ emit2();
9696
+ syncActive();
9697
+ };
9698
+ const setRefs = (node) => {
9699
+ editorRef.current = node;
9700
+ if (typeof ref === "function") ref(node);
9701
+ else if (ref) ref.current = node;
9702
+ };
9703
+ return /* @__PURE__ */ jsxs(
9704
+ "div",
9705
+ {
9706
+ className: cx("klun-rich-editor", disabled && "klun-rich-editor--disabled", className),
9707
+ style,
9708
+ ...props,
9709
+ children: [
9710
+ !hideToolbar ? /* @__PURE__ */ jsxs("div", { className: "klun-rich-editor__bar", children: [
9711
+ /* @__PURE__ */ jsx(RichEditorToolbar, { active, onAction }),
9712
+ allowSource ? /* @__PURE__ */ jsxs(
9713
+ "button",
9714
+ {
9715
+ type: "button",
9716
+ className: "klun-rich-editor__source",
9717
+ onClick: () => setSource((s) => !s),
9718
+ "data-active": source || void 0,
9719
+ "aria-pressed": source,
9720
+ children: [
9721
+ /* @__PURE__ */ jsx("i", { className: "ri-code-s-slash-line" }),
9722
+ "HTML"
9723
+ ]
9724
+ }
9725
+ ) : null
9726
+ ] }) : null,
9727
+ source && allowSource ? /* @__PURE__ */ jsx("div", { className: "klun-rich-editor__sourcearea", children: /* @__PURE__ */ jsx(
9728
+ Textarea,
9729
+ {
9730
+ rows: Math.max(4, Math.round(minHeight / 22)),
9731
+ value: html,
9732
+ style: { border: "none", boxShadow: "none", fontFamily: "var(--klun-font-mono, monospace)" },
9733
+ onChange: (e) => {
9734
+ setHtml(e.target.value);
9735
+ onChange?.(e.target.value);
9736
+ if (editorRef.current) editorRef.current.innerHTML = e.target.value;
9737
+ }
9738
+ }
9739
+ ) }) : null,
9740
+ /* @__PURE__ */ jsx(
9741
+ "div",
9742
+ {
9743
+ ref: setRefs,
9744
+ role: "textbox",
9745
+ "aria-multiline": "true",
9746
+ "aria-label": editorLabel,
9747
+ contentEditable: !disabled,
9748
+ suppressContentEditableWarning: true,
9749
+ "data-placeholder": placeholder,
9750
+ className: "klun-rich-editor__area",
9751
+ style: { minHeight, maxHeight, overflowY: maxHeight ? "auto" : void 0 },
9752
+ onInput: emit2,
9753
+ onBlur: emit2,
9754
+ onKeyUp: syncActive,
9755
+ onMouseUp: syncActive
9756
+ }
9757
+ )
9758
+ ]
9759
+ }
9760
+ );
9761
+ });
9762
+ RichEditor.displayName = "RichEditor";
9121
9763
  var Select = forwardRef(function Select2({
9122
9764
  size: sizeProp,
9123
9765
  placeholder,
@@ -9397,35 +10039,6 @@ var Switch = forwardRef(function Switch2({ disabled = false, size: sizeProp, onC
9397
10039
  );
9398
10040
  });
9399
10041
  Switch.displayName = "Switch";
9400
- var Textarea = forwardRef(function Textarea2({ error = false, disabled = false, readOnly = false, size: sizeProp, rows = 4, className, style, ...props }, ref) {
9401
- const size = useSize(sizeProp);
9402
- return /* @__PURE__ */ jsx(
9403
- "div",
9404
- {
9405
- className: cx(
9406
- "klun-textarea",
9407
- `klun-textarea--${size}`,
9408
- error && "klun-textarea--error",
9409
- disabled && "klun-textarea--disabled",
9410
- readOnly && "klun-textarea--readonly",
9411
- className
9412
- ),
9413
- style,
9414
- children: /* @__PURE__ */ jsx(
9415
- "textarea",
9416
- {
9417
- ref,
9418
- className: "klun-textarea__field",
9419
- rows,
9420
- disabled,
9421
- readOnly,
9422
- ...props
9423
- }
9424
- )
9425
- }
9426
- );
9427
- });
9428
- Textarea.displayName = "Textarea";
9429
10042
  var Card = forwardRef(function Card2({ variant = "stroke", padding, className, style, children, ...props }, ref) {
9430
10043
  return /* @__PURE__ */ jsx(
9431
10044
  "div",
@@ -11627,6 +12240,6 @@ var Popconfirm = forwardRef(function Popconfirm2({
11627
12240
  });
11628
12241
  Popconfirm.displayName = "Popconfirm";
11629
12242
 
11630
- export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, CheckboxGroup, Chip, CircularProgress, CodeViewer, Col, Collapse, ColorDot, ColorPicker, ColorSlider, CommandMenu, CompactSelect, CompactSelectForInput, ConfigProvider, Confirm, ContentLabel, ContextMenu2 as ContextMenu, CopyButton, CounterInput, CrossRefBadge, DatePicker, DateRangePicker, DateTimePicker, Descriptions, DiffViewer, DigitInput, Divider, Drawer, Dropdown, EmptyState, ExpiryCountdown, FileUpload, Flex, Form, FormItem, FormList, Format, GaugeBar, Grid, Hint, HorizontalFilter, ImageUpload, ImageViewer, InlineInput, InlineSelect, Input, Kbd, KeyIcon, Label, Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider, List, ListItem, LiveDot, LogViewer, Markdown, Masonry, Menu, Message, Modal, Money, Notification, PageHeader, Pagination, PasswordStrength, Popconfirm, Popover, ProgressBar, Radio, RadioCard, RangeSlider, Rating, RelativeTime, Result, RichEditorToolbar, Row, SegmentedControl, SegmentedProgress, Select, SelectMenu, Skeleton, Slider, Space, Spinner2 as Spinner, Splitter2 as Splitter, SplitterPanel, StatCard, Statistic, StatusBadge, StatusDot, StepIndicator, Switch, Table, Tabs, Tag, Textarea, TimePicker, Timeline, Toast, Toaster, Tooltip, Tree, Wizard, arSA, deDE, enUS, esES, fmt, frFR, idID, itIT, jaJP, koKR, locales, nlNL, parsePatch, plPL, primaryColorVars, ptBR, renderMarkdown, ruRU, toast, trTR, useBreakpoint, useConfig, useContextMenu, useForm, useLocale, useMappedSize, useMessage, useNotification, useSize, viVN, zhCN, zhTW };
11631
- //# sourceMappingURL=chunk-I4OHTBZQ.js.map
11632
- //# sourceMappingURL=chunk-I4OHTBZQ.js.map
12243
+ export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, CRON_PRESETS, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, CheckboxGroup, Chip, CircularProgress, CodeViewer, Col, Collapse, ColorDot, ColorPicker, ColorSlider, CommandMenu, CompactSelect, CompactSelectForInput, ConfigProvider, Confirm, ContentLabel, ContextMenu2 as ContextMenu, CopyButton, CounterInput, CronEditor, CrossRefBadge, DatePicker, DateRangePicker, DateTimePicker, Descriptions, DiffViewer, DigitInput, Divider, Drawer, Dropdown, EmptyState, ExpiryCountdown, FileUpload, Flex, Form, FormItem, FormList, Format, GaugeBar, Grid, Hint, HorizontalFilter, ImageUpload, ImageViewer, InlineInput, InlineSelect, Input, Kanban, Kbd, KeyIcon, Label, Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider, List, ListItem, LiveDot, LogViewer, Markdown, Masonry, Menu, Message, Modal, Money, Notification, PageHeader, Pagination, PasswordStrength, Popconfirm, Popover, ProgressBar, Radio, RadioCard, RangeSlider, Rating, RelativeTime, Result, RichEditor, RichEditorToolbar, Row, SegmentedControl, SegmentedProgress, Select, SelectMenu, Skeleton, Slider, Space, Spinner2 as Spinner, Splitter2 as Splitter, SplitterPanel, StatCard, Statistic, StatusBadge, StatusDot, StepIndicator, Switch, Table, Tabs, Tag, Textarea, TimePicker, Timeline, Toast, Toaster, Tooltip, Tree, VirtualTable, Wizard, arSA, deDE, describeCron, enUS, esES, fmt, frFR, idID, itIT, jaJP, koKR, locales, nlNL, parsePatch, plPL, primaryColorVars, ptBR, renderMarkdown, ruRU, toast, trTR, useBreakpoint, useConfig, useContextMenu, useForm, useLocale, useMappedSize, useMessage, useNotification, useSize, viVN, zhCN, zhTW };
12244
+ //# sourceMappingURL=chunk-MBL2CDDG.js.map
12245
+ //# sourceMappingURL=chunk-MBL2CDDG.js.map