@eifi1/ui-kit 0.15.5 → 0.16.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.
- package/README.md +17 -12
- package/dist/chart.d.ts +3 -3
- package/dist/components/amount-input.d.ts +10 -3
- package/dist/components/amount-input.js +165 -156
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/authed-image.d.ts +14 -3
- package/dist/components/authed-image.js +32 -23
- package/dist/components/authed-image.js.map +1 -1
- package/dist/components/button-group.d.ts +3 -3
- package/dist/components/calculator.d.ts +3 -3
- package/dist/components/copy-button.d.ts +3 -3
- package/dist/components/facing-pair.d.ts +3 -3
- package/dist/components/file-button.d.ts +3 -3
- package/dist/components/file-button.js +67 -31
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +3 -3
- package/dist/components/form-actions.d.ts +4 -4
- package/dist/components/form-actions.js +18 -6
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/line-items.d.ts +53 -2
- package/dist/components/line-items.js +73 -7
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +99 -5
- package/dist/components/list.js +103 -38
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-state.d.ts +19 -3
- package/dist/components/loading-state.js +14 -3
- package/dist/components/loading-state.js.map +1 -1
- package/dist/components/money-field.d.ts +3 -3
- package/dist/components/number-field.d.ts +3 -3
- package/dist/components/number-input.d.ts +3 -3
- package/dist/components/number-input.js +4 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +3 -3
- package/dist/components/passkeys-setting.d.ts +30 -10
- package/dist/components/passkeys-setting.js +19 -11
- package/dist/components/passkeys-setting.js.map +1 -1
- package/dist/components/progress-bar.d.ts +12 -3
- package/dist/components/progress-bar.js +21 -11
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/series-chart.d.ts +3 -3
- package/dist/components/settings-fields.d.ts +3 -3
- package/dist/components/signed-amount.d.ts +28 -4
- package/dist/components/signed-amount.js +17 -8
- package/dist/components/signed-amount.js.map +1 -1
- package/dist/components/stat-tile.d.ts +31 -2
- package/dist/components/stat-tile.js +37 -6
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +4 -1
- package/dist/components/status-dot.js +20 -1
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swatch-picker.d.ts +3 -1
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/table.d.ts +18 -13
- package/dist/components/table.js +20 -5
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +3 -3
- package/dist/components/time-input.d.ts +3 -3
- package/dist/components/toggle-legend.d.ts +12 -1
- package/dist/components/toggle-legend.js +6 -2
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/ui.d.ts +3 -3
- package/dist/components/ui.js +149 -45
- package/dist/components/ui.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +1 -1
- package/dist/feedback/feedback-attachment.js +24 -11
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.d.ts +1 -1
- package/dist/feedback/feedback-dialog.js +6 -5
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +1 -1
- package/dist/feedback/feedback-thread.d.ts +1 -1
- package/dist/{feedback-attachment-BYAHJMOr.d.ts → feedback-attachment-WFiXJ8We.d.ts} +21 -8
- package/dist/feedback.d.ts +1 -1
- package/dist/hooks/use-file-drop.d.ts +3 -3
- package/dist/i18n/defaults.d.ts +3 -3
- package/dist/i18n/kit-labels.d.ts +2 -2
- package/dist/i18n/locales/de-CH-informal.d.ts +3 -3
- package/dist/i18n/locales/de-CH.d.ts +3 -3
- package/dist/i18n/locales/de-informal.d.ts +3 -3
- package/dist/i18n/locales/de.d.ts +3 -3
- package/dist/i18n/locales/de.js +1 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +3 -3
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +3 -3
- package/dist/i18n/locales/fr.js +1 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +3 -3
- package/dist/i18n/locales/hu.js +1 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +3 -3
- package/dist/i18n/locales/it.js +1 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +3 -3
- package/dist/i18n/locales/zh.js +1 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/{kit-labels-BD2F7sOz.d.ts → kit-labels-DE--LmCk.d.ts} +153 -12
- package/dist/lib/format.d.ts +18 -3
- package/dist/lib/format.js +2 -1
- package/dist/lib/format.js.map +1 -1
- package/dist/rhf/fields.d.ts +3 -3
- package/dist/rhf/form.d.ts +3 -3
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf.d.ts +3 -3
- package/dist/shell/app-shell.d.ts +3 -3
- package/dist/shell/top-bar-brand.d.ts +3 -3
- package/dist/shell.d.ts +3 -3
- package/dist/wizard/stepper-nav.d.ts +3 -3
- package/dist/wizard.d.ts +3 -3
- package/package.json +1 -1
- package/src/components/amount-input.tsx +39 -15
- package/src/components/authed-image.tsx +20 -2
- package/src/components/file-button.tsx +85 -27
- package/src/components/form-actions.tsx +86 -8
- package/src/components/line-items.tsx +131 -14
- package/src/components/list.tsx +240 -50
- package/src/components/loading-state.tsx +35 -4
- package/src/components/number-input.tsx +18 -2
- package/src/components/passkeys-setting.tsx +45 -18
- package/src/components/progress-bar.tsx +46 -21
- package/src/components/signed-amount.tsx +47 -8
- package/src/components/stat-tile.tsx +76 -6
- package/src/components/status-dot.tsx +31 -0
- package/src/components/swatch-picker.tsx +3 -1
- package/src/components/table.tsx +42 -15
- package/src/components/toggle-legend.tsx +21 -4
- package/src/components/ui.tsx +273 -63
- package/src/feedback/feedback-attachment.tsx +45 -14
- package/src/feedback/feedback-dialog.tsx +31 -16
- package/src/i18n/locales/de.ts +1 -1
- package/src/i18n/locales/es.ts +1 -1
- package/src/i18n/locales/fr.ts +1 -1
- package/src/i18n/locales/hu.ts +1 -1
- package/src/i18n/locales/it.ts +1 -1
- package/src/i18n/locales/zh.ts +1 -1
- package/src/lib/format.ts +24 -3
- package/src/rhf/line-items.tsx +6 -0
package/dist/components/ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useId, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { createContext, forwardRef, useContext, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { ChevronDown, Eye, EyeOff, HelpCircle, Plus, X } from "lucide-react";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { scrollIntoStrip, useStripFade } from "../lib/strip-fade.js";
|
|
@@ -297,6 +297,23 @@ const ICON_BUTTON_GLYPH_SIZES = {
|
|
|
297
297
|
24: "[&_svg]:size-6",
|
|
298
298
|
28: "[&_svg]:size-7"
|
|
299
299
|
};
|
|
300
|
+
const ICON_BUTTON_SPINNER = {
|
|
301
|
+
"2xl": "size-7",
|
|
302
|
+
xl: "size-6",
|
|
303
|
+
lg: "size-5",
|
|
304
|
+
md: "size-5",
|
|
305
|
+
sm: "size-5",
|
|
306
|
+
xs: "size-4",
|
|
307
|
+
"2xs": "size-3.5"
|
|
308
|
+
};
|
|
309
|
+
const ICON_BUTTON_SPINNER_GLYPH = {
|
|
310
|
+
12: "size-3",
|
|
311
|
+
14: "size-3.5",
|
|
312
|
+
16: "size-4",
|
|
313
|
+
20: "size-5",
|
|
314
|
+
24: "size-6",
|
|
315
|
+
28: "size-7"
|
|
316
|
+
};
|
|
300
317
|
const ICON_BUTTON_TONE_PAIR = "[--icon-button-tone:var(--icon-button-tone-light)] dark:[--icon-button-tone:var(--icon-button-tone-dark)]";
|
|
301
318
|
function toneColorStyle(toneColor, style) {
|
|
302
319
|
if (toneColor === void 0) return style;
|
|
@@ -364,6 +381,7 @@ function IconButtonLink({
|
|
|
364
381
|
tooltip = true,
|
|
365
382
|
tooltipSide,
|
|
366
383
|
tooltipPortal,
|
|
384
|
+
tooltipLazy = true,
|
|
367
385
|
glyphSize,
|
|
368
386
|
badge,
|
|
369
387
|
className,
|
|
@@ -440,7 +458,17 @@ function IconButtonLink({
|
|
|
440
458
|
if (!tooltip || label === void 0 || label === "") return control;
|
|
441
459
|
return (
|
|
442
460
|
// A fragment, as on the button: the bubble says what `aria-label` already does.
|
|
443
|
-
/* @__PURE__ */ jsx(
|
|
461
|
+
/* @__PURE__ */ jsx(
|
|
462
|
+
Tooltip,
|
|
463
|
+
{
|
|
464
|
+
label,
|
|
465
|
+
side: tooltipSide,
|
|
466
|
+
portal: tooltipPortal,
|
|
467
|
+
lazy: tooltipLazy,
|
|
468
|
+
className: stretch ? "self-stretch" : void 0,
|
|
469
|
+
children: /* @__PURE__ */ jsx(Fragment, { children: control })
|
|
470
|
+
}
|
|
471
|
+
)
|
|
444
472
|
);
|
|
445
473
|
}
|
|
446
474
|
function IconButtonElement({
|
|
@@ -457,7 +485,9 @@ function IconButtonElement({
|
|
|
457
485
|
tooltip = true,
|
|
458
486
|
tooltipSide,
|
|
459
487
|
tooltipPortal,
|
|
488
|
+
tooltipLazy = true,
|
|
460
489
|
disabledReason,
|
|
490
|
+
pending,
|
|
461
491
|
glyphSize,
|
|
462
492
|
badge,
|
|
463
493
|
disabledStyle = "dim",
|
|
@@ -465,6 +495,7 @@ function IconButtonElement({
|
|
|
465
495
|
style,
|
|
466
496
|
onClick,
|
|
467
497
|
onKeyDown,
|
|
498
|
+
children,
|
|
468
499
|
href: _href,
|
|
469
500
|
renderLink: _renderLink,
|
|
470
501
|
external: _external,
|
|
@@ -477,21 +508,23 @@ function IconButtonElement({
|
|
|
477
508
|
const keep = disabledStyle === "keep";
|
|
478
509
|
const reasonId = useId();
|
|
479
510
|
const locked = hasContent(disabledReason);
|
|
511
|
+
const inert = locked || Boolean(pending);
|
|
480
512
|
const ownDescribedBy = rest["aria-describedby"];
|
|
481
513
|
const button = /* @__PURE__ */ jsx(
|
|
482
514
|
"button",
|
|
483
515
|
{
|
|
484
516
|
ref,
|
|
485
517
|
...rest,
|
|
486
|
-
disabled:
|
|
487
|
-
"aria-disabled":
|
|
518
|
+
disabled: inert ? void 0 : rest.disabled,
|
|
519
|
+
"aria-disabled": inert || rest["aria-disabled"],
|
|
520
|
+
"aria-busy": pending || rest["aria-busy"],
|
|
488
521
|
"aria-describedby": locked ? ownDescribedBy ? `${ownDescribedBy} ${reasonId}` : reasonId : ownDescribedBy,
|
|
489
522
|
"aria-label": rest["aria-label"] ?? label,
|
|
490
523
|
"aria-pressed": pressed ?? rest["aria-pressed"],
|
|
491
524
|
style: toneColorStyle(toneColor, style),
|
|
492
525
|
onClick: (e) => {
|
|
493
526
|
if (stopPropagation) e.stopPropagation();
|
|
494
|
-
if (
|
|
527
|
+
if (inert) {
|
|
495
528
|
e.preventDefault();
|
|
496
529
|
return;
|
|
497
530
|
}
|
|
@@ -507,8 +540,23 @@ function IconButtonElement({
|
|
|
507
540
|
// The disabled look for the focusable kind of disabled, as on Button.
|
|
508
541
|
locked && (keep ? "cursor-default" : "cursor-not-allowed opacity-50"),
|
|
509
542
|
keep && "disabled:cursor-default disabled:opacity-100",
|
|
543
|
+
pending && "cursor-progress",
|
|
510
544
|
className
|
|
511
|
-
)
|
|
545
|
+
),
|
|
546
|
+
children: pending ? (
|
|
547
|
+
// Decorative, as on Button: `aria-busy` says it. Sized to the glyph it stands
|
|
548
|
+
// in for, in the glyph's colour, so the swap does not change the button's look.
|
|
549
|
+
/* @__PURE__ */ jsx(
|
|
550
|
+
Spinner,
|
|
551
|
+
{
|
|
552
|
+
label: null,
|
|
553
|
+
className: cn(
|
|
554
|
+
"border-current/30 border-t-current",
|
|
555
|
+
glyphSize !== void 0 ? ICON_BUTTON_SPINNER_GLYPH[glyphSize] : ICON_BUTTON_SPINNER[size]
|
|
556
|
+
)
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
) : children
|
|
512
560
|
}
|
|
513
561
|
);
|
|
514
562
|
const control = withIconButtonBadge(button, badge, stretch);
|
|
@@ -534,8 +582,18 @@ function IconButtonElement({
|
|
|
534
582
|
if (!tooltip || label === void 0 || label === "") return control;
|
|
535
583
|
return (
|
|
536
584
|
// A fragment, so Tooltip leaves the button's description alone: the bubble says
|
|
537
|
-
// exactly what `aria-label` already does.
|
|
538
|
-
/* @__PURE__ */ jsx(
|
|
585
|
+
// exactly what `aria-label` already does. Lazy by default — see `tooltipLazy`.
|
|
586
|
+
/* @__PURE__ */ jsx(
|
|
587
|
+
Tooltip,
|
|
588
|
+
{
|
|
589
|
+
label,
|
|
590
|
+
side: tooltipSide,
|
|
591
|
+
portal: tooltipPortal,
|
|
592
|
+
lazy: tooltipLazy,
|
|
593
|
+
className: stretch ? "self-stretch" : void 0,
|
|
594
|
+
children: /* @__PURE__ */ jsx(Fragment, { children: control })
|
|
595
|
+
}
|
|
596
|
+
)
|
|
539
597
|
);
|
|
540
598
|
}
|
|
541
599
|
const FIELD_BASE = "block w-full rounded-md border border-[var(--border)] bg-[var(--bg-surface)] px-3 py-2 text-sm text-[var(--text-primary)] shadow-sm placeholder:text-[var(--text-placeholder)] focus:border-[var(--brand)] focus:ring-[var(--brand)] disabled:cursor-default disabled:bg-[var(--bg-surface-2)] disabled:text-[var(--text-muted)] [&[readonly]]:bg-[var(--bg-surface-2)] [&[readonly]]:text-[var(--text-muted)]";
|
|
@@ -827,27 +885,37 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
827
885
|
const chevron = rest.disabled || listBox ? null : /* @__PURE__ */ jsx(FieldChevron, { className: small ? "end-1.5 size-3.5" : void 0 });
|
|
828
886
|
const dress = listBox ? "overflow-y-auto [&_option]:py-1" : "appearance-none pe-9";
|
|
829
887
|
if (label === void 0) {
|
|
888
|
+
const select = /* @__PURE__ */ jsx(
|
|
889
|
+
"select",
|
|
890
|
+
{
|
|
891
|
+
ref,
|
|
892
|
+
id,
|
|
893
|
+
size: nativeSize,
|
|
894
|
+
...rest,
|
|
895
|
+
"aria-invalid": isInvalid || rest["aria-invalid"] || void 0,
|
|
896
|
+
"aria-describedby": describedBy,
|
|
897
|
+
className: cn(
|
|
898
|
+
FIELD_BASE,
|
|
899
|
+
dress,
|
|
900
|
+
listBox && "py-0",
|
|
901
|
+
small && SELECT_SM,
|
|
902
|
+
selectClassName,
|
|
903
|
+
isInvalid && FIELD_INVALID
|
|
904
|
+
),
|
|
905
|
+
children
|
|
906
|
+
}
|
|
907
|
+
);
|
|
908
|
+
if (hasContent(hint) && !textHint) {
|
|
909
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, children: /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1.5", className), children: [
|
|
910
|
+
/* @__PURE__ */ jsxs("div", { className: "relative min-w-0 flex-1", children: [
|
|
911
|
+
select,
|
|
912
|
+
chevron
|
|
913
|
+
] }),
|
|
914
|
+
/* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: hint })
|
|
915
|
+
] }) });
|
|
916
|
+
}
|
|
830
917
|
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
831
|
-
|
|
832
|
-
"select",
|
|
833
|
-
{
|
|
834
|
-
ref,
|
|
835
|
-
id,
|
|
836
|
-
size: nativeSize,
|
|
837
|
-
...rest,
|
|
838
|
-
"aria-invalid": isInvalid || rest["aria-invalid"] || void 0,
|
|
839
|
-
"aria-describedby": describedBy,
|
|
840
|
-
className: cn(
|
|
841
|
-
FIELD_BASE,
|
|
842
|
-
dress,
|
|
843
|
-
listBox && "py-0",
|
|
844
|
-
small && SELECT_SM,
|
|
845
|
-
selectClassName,
|
|
846
|
-
isInvalid && FIELD_INVALID
|
|
847
|
-
),
|
|
848
|
-
children
|
|
849
|
-
}
|
|
850
|
-
),
|
|
918
|
+
select,
|
|
851
919
|
chevron
|
|
852
920
|
] }) });
|
|
853
921
|
}
|
|
@@ -943,13 +1011,37 @@ const CARD_PADDING = {
|
|
|
943
1011
|
sm: "p-3",
|
|
944
1012
|
md: "p-4"
|
|
945
1013
|
};
|
|
946
|
-
|
|
1014
|
+
const CARD_PADDING_STRONG = {
|
|
1015
|
+
none: "p-0",
|
|
1016
|
+
sm: "p-[11px]",
|
|
1017
|
+
md: "p-[15px]"
|
|
1018
|
+
};
|
|
1019
|
+
const CARD_TONES_STRONG = {
|
|
1020
|
+
warning: "border-2 border-[var(--warning)]",
|
|
1021
|
+
danger: "border-2 border-[var(--danger-border-strong)]",
|
|
1022
|
+
info: "border-2 border-[var(--info)]",
|
|
1023
|
+
success: "border-2 border-[var(--success)]"
|
|
1024
|
+
};
|
|
1025
|
+
const CardPaddedContext = createContext(false);
|
|
1026
|
+
function Card({
|
|
1027
|
+
className,
|
|
1028
|
+
children,
|
|
1029
|
+
flush,
|
|
1030
|
+
variant = "default",
|
|
1031
|
+
tone,
|
|
1032
|
+
toneStrength = "soft",
|
|
1033
|
+
padding,
|
|
1034
|
+
...rest
|
|
1035
|
+
}) {
|
|
947
1036
|
const toned = tone ? CARD_TONES[tone] : void 0;
|
|
948
1037
|
const bordered = variant !== "inset";
|
|
1038
|
+
const strong = toned !== void 0 && bordered && toneStrength === "strong";
|
|
1039
|
+
const ownPadding = padding ?? (variant === "inset" ? "sm" : variant === "outline" ? "md" : void 0);
|
|
949
1040
|
return /* @__PURE__ */ jsx(
|
|
950
1041
|
"div",
|
|
951
1042
|
{
|
|
952
1043
|
"data-tone": tone,
|
|
1044
|
+
"data-tone-strength": strong ? "strong" : void 0,
|
|
953
1045
|
...rest,
|
|
954
1046
|
className: cn(
|
|
955
1047
|
variant === "inset" ? "rounded-md bg-[var(--bg-surface-2)] p-3" : variant === "outline" ? (
|
|
@@ -963,15 +1055,17 @@ function Card({ className, children, flush, variant = "default", tone, padding,
|
|
|
963
1055
|
flush ? "border-y border-[var(--border)] md:rounded-lg md:border md:shadow-sm" : "rounded-lg border border-[var(--border)] shadow-sm"
|
|
964
1056
|
),
|
|
965
1057
|
toned && (bordered ? toned.border : toned.fill),
|
|
1058
|
+
strong && tone && CARD_TONES_STRONG[tone],
|
|
966
1059
|
toned?.title,
|
|
967
|
-
|
|
1060
|
+
ownPadding && (strong ? CARD_PADDING_STRONG : CARD_PADDING)[ownPadding],
|
|
968
1061
|
className
|
|
969
1062
|
),
|
|
970
|
-
children
|
|
1063
|
+
children: /* @__PURE__ */ jsx(CardPaddedContext.Provider, { value: ownPadding !== void 0, children })
|
|
971
1064
|
}
|
|
972
1065
|
);
|
|
973
1066
|
}
|
|
974
|
-
function CardHeader({ className, ...props }) {
|
|
1067
|
+
function CardHeader({ className, stackAction = false, ...props }) {
|
|
1068
|
+
const padded = useContext(CardPaddedContext);
|
|
975
1069
|
return /* @__PURE__ */ jsx(
|
|
976
1070
|
"div",
|
|
977
1071
|
{
|
|
@@ -979,29 +1073,37 @@ function CardHeader({ className, ...props }) {
|
|
|
979
1073
|
className: cn(
|
|
980
1074
|
// Grid (not flex) so CardAction can occupy a top-right column; with no
|
|
981
1075
|
// action it collapses to one column and title/description stack.
|
|
982
|
-
|
|
1076
|
+
//
|
|
1077
|
+
// The two-column switch sets a VARIABLE, not `grid-template-columns`. As
|
|
1078
|
+
// `has-data-[slot=card-action]:grid-cols-[1fr_auto]` it was two classes of
|
|
1079
|
+
// specificity (the class plus the attribute inside `:has()`), and a caller's
|
|
1080
|
+
// `max-sm:grid-cols-1` — one class inside a media query — lost to it at every
|
|
1081
|
+
// width, so the action could never be stacked on a phone from outside. Now the
|
|
1082
|
+
// property itself is set by a plain one-class utility that any `grid-cols-*`
|
|
1083
|
+
// variant of the caller's outranks by coming later in the sheet; the `:has()`
|
|
1084
|
+
// rule only picks the value. The base `1fr` resets the variable so a header
|
|
1085
|
+
// never inherits an ancestor header's two columns.
|
|
1086
|
+
"grid auto-rows-min items-start gap-1.5 [--card-header-cols:1fr] has-data-[slot=card-action]:[--card-header-cols:1fr_auto] grid-cols-[var(--card-header-cols,1fr)]",
|
|
1087
|
+
padded ? "px-0 pt-0" : "px-6 pt-6",
|
|
1088
|
+
// One column under `sm`, and the action back into the flow (DOM order, so
|
|
1089
|
+
// after the description when it is written after it), at the start edge.
|
|
1090
|
+
// The descendant selector outranks CardAction's own placement classes.
|
|
1091
|
+
stackAction && "max-sm:grid-cols-1 max-sm:[&>[data-slot=card-action]]:col-start-1 max-sm:[&>[data-slot=card-action]]:row-span-1 max-sm:[&>[data-slot=card-action]]:row-start-auto max-sm:[&>[data-slot=card-action]]:justify-self-start",
|
|
983
1092
|
className
|
|
984
1093
|
),
|
|
985
1094
|
...props
|
|
986
1095
|
}
|
|
987
1096
|
);
|
|
988
1097
|
}
|
|
989
|
-
function CardTitle({ className, ...props }) {
|
|
990
|
-
return /* @__PURE__ */ jsx(
|
|
991
|
-
"div",
|
|
992
|
-
{
|
|
993
|
-
"data-slot": "card-title",
|
|
994
|
-
className: cn("font-semibold leading-none", className),
|
|
995
|
-
...props
|
|
996
|
-
}
|
|
997
|
-
);
|
|
1098
|
+
function CardTitle({ className, as: Tag = "div", ...props }) {
|
|
1099
|
+
return /* @__PURE__ */ jsx(Tag, { "data-slot": "card-title", className: cn("font-semibold leading-none", className), ...props });
|
|
998
1100
|
}
|
|
999
1101
|
function CardDescription({ className, ...props }) {
|
|
1000
1102
|
return /* @__PURE__ */ jsx(
|
|
1001
1103
|
"div",
|
|
1002
1104
|
{
|
|
1003
1105
|
"data-slot": "card-description",
|
|
1004
|
-
className: cn("text-sm text-[var(--
|
|
1106
|
+
className: cn("text-sm text-[var(--text-muted)]", className),
|
|
1005
1107
|
...props
|
|
1006
1108
|
}
|
|
1007
1109
|
);
|
|
@@ -1017,14 +1119,16 @@ function CardAction({ className, ...props }) {
|
|
|
1017
1119
|
);
|
|
1018
1120
|
}
|
|
1019
1121
|
function CardContent({ className, ...props }) {
|
|
1020
|
-
|
|
1122
|
+
const padded = useContext(CardPaddedContext);
|
|
1123
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "card-content", className: cn(!padded && "px-6 last:pb-6", className), ...props });
|
|
1021
1124
|
}
|
|
1022
1125
|
function CardFooter({ className, ...props }) {
|
|
1126
|
+
const padded = useContext(CardPaddedContext);
|
|
1023
1127
|
return /* @__PURE__ */ jsx(
|
|
1024
1128
|
"div",
|
|
1025
1129
|
{
|
|
1026
1130
|
"data-slot": "card-footer",
|
|
1027
|
-
className: cn("flex items-center px-6 pb-6", className),
|
|
1131
|
+
className: cn("flex items-center", !padded && "px-6 pb-6", className),
|
|
1028
1132
|
...props
|
|
1029
1133
|
}
|
|
1030
1134
|
);
|