@martinsura/ui 0.1.11 → 0.1.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/index.cjs +38 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +38 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -324,11 +324,11 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
324
324
|
variants: {
|
|
325
325
|
variant: {
|
|
326
326
|
filled: "",
|
|
327
|
-
default: "bg-white
|
|
328
|
-
subtle: "bg-(--ui-surface-subtle)
|
|
329
|
-
ghost: "
|
|
330
|
-
text: "
|
|
331
|
-
link: "
|
|
327
|
+
default: "bg-white border border-(--ui-border-strong) hover:bg-(--ui-surface-subtle) active:bg-(--ui-surface-muted)",
|
|
328
|
+
subtle: "bg-(--ui-surface-subtle) border border-transparent hover:bg-(--ui-surface-muted) active:bg-(--ui-surface-muted)",
|
|
329
|
+
ghost: "hover:bg-(--ui-surface-muted) active:bg-(--ui-surface-subtle)",
|
|
330
|
+
text: "px-0! bg-transparent",
|
|
331
|
+
link: "hover:underline p-0! h-auto!"
|
|
332
332
|
},
|
|
333
333
|
color: {
|
|
334
334
|
primary: "",
|
|
@@ -351,9 +351,30 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
353
|
compoundVariants: [
|
|
354
|
+
// filled
|
|
354
355
|
{ variant: "filled", color: "primary", class: "bg-(--ui-primary) text-(--ui-primary-text) hover:bg-(--ui-primary-hover) active:bg-(--ui-primary-active)" },
|
|
355
356
|
{ variant: "filled", color: "success", class: "bg-(--ui-success) text-(--ui-success-text) hover:bg-(--ui-success-hover) active:bg-(--ui-success-hover)" },
|
|
356
|
-
{ variant: "filled", color: "danger", class: "bg-(--ui-danger) text-(--ui-danger-text) hover:bg-(--ui-danger-hover) active:bg-(--ui-danger-hover)" }
|
|
357
|
+
{ variant: "filled", color: "danger", class: "bg-(--ui-danger) text-(--ui-danger-text) hover:bg-(--ui-danger-hover) active:bg-(--ui-danger-hover)" },
|
|
358
|
+
// default
|
|
359
|
+
{ variant: "default", color: "primary", class: "text-(--ui-text)" },
|
|
360
|
+
{ variant: "default", color: "success", class: "text-(--ui-success)" },
|
|
361
|
+
{ variant: "default", color: "danger", class: "text-(--ui-danger)" },
|
|
362
|
+
// subtle
|
|
363
|
+
{ variant: "subtle", color: "primary", class: "text-(--ui-text)" },
|
|
364
|
+
{ variant: "subtle", color: "success", class: "text-(--ui-success)" },
|
|
365
|
+
{ variant: "subtle", color: "danger", class: "text-(--ui-danger)" },
|
|
366
|
+
// ghost
|
|
367
|
+
{ variant: "ghost", color: "primary", class: "text-(--ui-text)" },
|
|
368
|
+
{ variant: "ghost", color: "success", class: "text-(--ui-success)" },
|
|
369
|
+
{ variant: "ghost", color: "danger", class: "text-(--ui-danger)" },
|
|
370
|
+
// text
|
|
371
|
+
{ variant: "text", color: "primary", class: "text-(--ui-text) hover:text-(--ui-text-strong) active:text-(--ui-text-strong)" },
|
|
372
|
+
{ variant: "text", color: "success", class: "text-(--ui-success)" },
|
|
373
|
+
{ variant: "text", color: "danger", class: "text-(--ui-danger)" },
|
|
374
|
+
// link
|
|
375
|
+
{ variant: "link", color: "primary", class: "text-(--ui-primary)" },
|
|
376
|
+
{ variant: "link", color: "success", class: "text-(--ui-success)" },
|
|
377
|
+
{ variant: "link", color: "danger", class: "text-(--ui-danger)" }
|
|
357
378
|
],
|
|
358
379
|
defaultVariants: {
|
|
359
380
|
variant: "filled",
|
|
@@ -383,10 +404,13 @@ var Button = ({
|
|
|
383
404
|
const IconComponent = props.icon ?? (props.iconType ? getIcon(props.iconType) : void 0);
|
|
384
405
|
const iconNode = IconComponent ? /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: iconSize, strokeWidth: 1.5, className: props.classNames?.icon }) : void 0;
|
|
385
406
|
const content = props.text ?? props.children;
|
|
386
|
-
const handleClick = () => {
|
|
387
|
-
if (props.
|
|
388
|
-
|
|
389
|
-
|
|
407
|
+
const handleClick = (e) => {
|
|
408
|
+
if (props.stopPropagation) e.stopPropagation();
|
|
409
|
+
if (props.disabled || props.loading) return;
|
|
410
|
+
props.onClick?.();
|
|
411
|
+
};
|
|
412
|
+
const handleConfirm = () => {
|
|
413
|
+
if (props.disabled || props.loading) return;
|
|
390
414
|
props.onClick?.();
|
|
391
415
|
};
|
|
392
416
|
const button = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -400,7 +424,7 @@ var Button = ({
|
|
|
400
424
|
props.iconOnly && "px-0!",
|
|
401
425
|
props.className
|
|
402
426
|
),
|
|
403
|
-
onClick: props.confirm ? void 0 : handleClick,
|
|
427
|
+
onClick: props.confirm ? props.stopPropagation ? (e) => e.stopPropagation() : void 0 : handleClick,
|
|
404
428
|
children: [
|
|
405
429
|
props.loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: iconSize, color: "current", className: props.classNames?.spinner }) : iconPosition === "left" && iconNode,
|
|
406
430
|
!props.iconOnly && content !== void 0 && content !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: props.classNames?.content, children: content }),
|
|
@@ -418,7 +442,7 @@ var Button = ({
|
|
|
418
442
|
confirmOk: props.confirm.confirmOk,
|
|
419
443
|
confirmCancel: props.confirm.confirmCancel,
|
|
420
444
|
confirmColor: props.confirm.confirmColor,
|
|
421
|
-
onConfirm:
|
|
445
|
+
onConfirm: handleConfirm,
|
|
422
446
|
children: button
|
|
423
447
|
}
|
|
424
448
|
);
|
|
@@ -1878,7 +1902,7 @@ var Grid = (props) => {
|
|
|
1878
1902
|
}
|
|
1879
1903
|
) }) : items.map((item, rowIdx) => {
|
|
1880
1904
|
const key = getKey2(item, items, props.rowKey);
|
|
1881
|
-
const isSelected = selectedKeys.has(key);
|
|
1905
|
+
const isSelected = selectedKeys.has(key) || !!props.isRowSelected?.(item);
|
|
1882
1906
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1883
1907
|
"tr",
|
|
1884
1908
|
{
|
|
@@ -1888,6 +1912,7 @@ var Grid = (props) => {
|
|
|
1888
1912
|
rowIdx % 2 === 1 && !isSelected && neutralSurfaceClasses.subtle,
|
|
1889
1913
|
isSelected && "bg-blue-50",
|
|
1890
1914
|
props.onRowClick && "cursor-pointer hover:bg-blue-50",
|
|
1915
|
+
props.rowClassName?.(item),
|
|
1891
1916
|
props.classNames?.bodyRow
|
|
1892
1917
|
),
|
|
1893
1918
|
children: [
|