@eifi1/ui-kit 0.16.1 → 0.18.0
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 +34 -9
- package/dist/chart.d.ts +10 -1
- package/dist/components/account-chips.d.ts +153 -0
- package/dist/components/account-chips.js +135 -0
- package/dist/components/account-chips.js.map +1 -0
- package/dist/components/account-settings-labels.d.ts +10 -2
- package/dist/components/account-settings-labels.js +3 -0
- package/dist/components/account-settings-labels.js.map +1 -1
- package/dist/components/amount-input.d.ts +18 -1
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/button-group.d.ts +10 -1
- package/dist/components/calculator.d.ts +10 -1
- package/dist/components/chip.d.ts +25 -1
- package/dist/components/chip.js +143 -6
- package/dist/components/chip.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +42 -1
- package/dist/components/confirm-dialog.js +36 -5
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button.d.ts +10 -1
- package/dist/components/danger-confirm.d.ts +55 -4
- package/dist/components/danger-confirm.js +67 -30
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +93 -3
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/facing-pair.d.ts +10 -1
- package/dist/components/file-button.d.ts +10 -1
- package/dist/components/file-dropzone.d.ts +10 -1
- package/dist/components/form-actions.d.ts +10 -1
- package/dist/components/form-actions.js +35 -1
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/line-items.d.ts +30 -6
- package/dist/components/line-items.js +77 -33
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +13 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/money-field.d.ts +10 -1
- package/dist/components/number-field.d.ts +11 -2
- package/dist/components/number-field.js +23 -22
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +10 -1
- package/dist/components/numpad-sheet.d.ts +10 -1
- package/dist/components/passkeys-setting.d.ts +27 -1
- package/dist/components/passkeys-setting.js +31 -5
- package/dist/components/passkeys-setting.js.map +1 -1
- package/dist/components/progress-bar.d.ts +25 -1
- package/dist/components/progress-bar.js +21 -4
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/reauth-dialog.d.ts +90 -0
- package/dist/components/reauth-dialog.js +158 -0
- package/dist/components/reauth-dialog.js.map +1 -0
- package/dist/components/series-chart.d.ts +10 -1
- package/dist/components/server-wake.d.ts +58 -0
- package/dist/components/server-wake.js +58 -0
- package/dist/components/server-wake.js.map +1 -0
- package/dist/components/settings-fields.d.ts +10 -1
- package/dist/components/share-card.d.ts +61 -0
- package/dist/components/share-card.js +350 -0
- package/dist/components/share-card.js.map +1 -0
- package/dist/components/signed-amount.d.ts +12 -3
- package/dist/components/signed-amount.js +6 -4
- package/dist/components/signed-amount.js.map +1 -1
- package/dist/components/status-dot.d.ts +2 -0
- package/dist/components/text-link.d.ts +10 -1
- package/dist/components/time-input.d.ts +10 -1
- package/dist/components/toast.d.ts +10 -1
- package/dist/components/toast.js +42 -2
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +5 -2
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/ui.d.ts +10 -1
- package/dist/components/ui.js +67 -30
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/components/user-avatar.d.ts +2 -0
- package/dist/components/write-lock.d.ts +68 -0
- package/dist/components/write-lock.js +33 -0
- package/dist/components/write-lock.js.map +1 -0
- package/dist/{data-table-CfVXtCeG.d.ts → data-table-3mi2R3so.d.ts} +59 -1
- package/dist/data-table.d.ts +1 -1
- package/dist/hooks/use-file-drop.d.ts +10 -1
- package/dist/hooks/use-overlay-history.js +16 -0
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/i18n/defaults.d.ts +10 -1
- package/dist/i18n/defaults.js +11 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +78 -0
- package/dist/i18n/{locales/de.js → german.js} +59 -9
- package/dist/i18n/german.js.map +1 -0
- package/dist/i18n/kit-labels.d.ts +10 -1
- package/dist/i18n/kit-labels.js +5 -0
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/de-CH.d.ts +23 -8
- package/dist/i18n/locales/de-CH.js +7 -3
- package/dist/i18n/locales/de-CH.js.map +1 -1
- package/dist/i18n/locales/{de.d.ts → en.d.ts} +24 -10
- package/dist/i18n/locales/en.js +95 -0
- package/dist/i18n/locales/en.js.map +1 -0
- package/dist/i18n/locales/es.d.ts +10 -1
- package/dist/i18n/locales/es.js +51 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +10 -1
- package/dist/i18n/locales/fr.js +51 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +10 -1
- package/dist/i18n/locales/hu.js +54 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +10 -1
- package/dist/i18n/locales/it.js +51 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +10 -1
- package/dist/i18n/locales/zh.js +50 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/swiss.d.ts +3 -3
- package/dist/i18n/swiss.js.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/dist/{kit-labels-DE--LmCk.d.ts → kit-labels-CPbsjlXr.d.ts} +282 -10
- package/dist/lib/server-wake.d.ts +130 -0
- package/dist/lib/server-wake.js +121 -0
- package/dist/lib/server-wake.js.map +1 -0
- package/dist/rhf/fields.d.ts +10 -1
- package/dist/rhf/form.d.ts +10 -1
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf.d.ts +10 -1
- package/dist/search/global-search.d.ts +24 -4
- package/dist/search/global-search.js +31 -3
- package/dist/search/global-search.js.map +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/shell/app-shell.d.ts +10 -1
- package/dist/shell/top-bar-brand.d.ts +10 -1
- package/dist/shell/topbar-action-menu.d.ts +2 -0
- package/dist/shell.d.ts +10 -1
- package/dist/wizard/stepper-nav.d.ts +10 -1
- package/dist/wizard.d.ts +10 -1
- package/package.json +1 -1
- package/src/components/account-chips.tsx +302 -0
- package/src/components/account-settings-labels.ts +16 -2
- package/src/components/amount-input.tsx +8 -0
- package/src/components/chip.tsx +239 -6
- package/src/components/confirm-dialog.tsx +82 -7
- package/src/components/danger-confirm.tsx +118 -33
- package/src/components/data-table.tsx +185 -3
- package/src/components/form-actions.tsx +93 -4
- package/src/components/line-items.tsx +116 -40
- package/src/components/list.tsx +13 -1
- package/src/components/number-field.tsx +32 -26
- package/src/components/passkeys-setting.tsx +68 -7
- package/src/components/progress-bar.tsx +40 -4
- package/src/components/reauth-dialog.tsx +273 -0
- package/src/components/server-wake.tsx +124 -0
- package/src/components/share-card.tsx +615 -0
- package/src/components/signed-amount.tsx +16 -5
- package/src/components/toast.tsx +72 -2
- package/src/components/toggle-group.tsx +5 -2
- package/src/components/ui.tsx +145 -34
- package/src/components/write-lock.tsx +96 -0
- package/src/hooks/use-overlay-history.ts +51 -0
- package/src/i18n/defaults.ts +10 -0
- package/src/i18n/{locales/de.ts → german.ts} +68 -13
- package/src/i18n/kit-labels.tsx +22 -2
- package/src/i18n/locales/de-CH.ts +17 -8
- package/src/i18n/locales/en.ts +116 -0
- package/src/i18n/locales/es.ts +51 -0
- package/src/i18n/locales/fr.ts +52 -0
- package/src/i18n/locales/hu.ts +55 -0
- package/src/i18n/locales/it.ts +51 -0
- package/src/i18n/locales/zh.ts +50 -0
- package/src/i18n/swiss.ts +3 -3
- package/src/index.ts +23 -1
- package/src/lib/server-wake.ts +270 -0
- package/src/rhf/line-items.tsx +2 -1
- package/src/search/global-search.tsx +59 -6
- package/dist/i18n/locales/de-CH-informal.d.ts +0 -61
- package/dist/i18n/locales/de-CH-informal.js +0 -8
- package/dist/i18n/locales/de-CH-informal.js.map +0 -1
- package/dist/i18n/locales/de-informal.d.ts +0 -82
- package/dist/i18n/locales/de-informal.js +0 -37
- package/dist/i18n/locales/de-informal.js.map +0 -1
- package/dist/i18n/locales/de.js.map +0 -1
- package/src/i18n/locales/de-CH-informal.ts +0 -10
- package/src/i18n/locales/de-informal.ts +0 -61
package/dist/components/ui.js
CHANGED
|
@@ -9,6 +9,7 @@ import { useMediaQuery } from "../hooks/use-media-query.js";
|
|
|
9
9
|
import { Tooltip } from "./tooltip.js";
|
|
10
10
|
import { DEFAULT_COMMON_LABELS, useKitLabels, useKitLink } from "../i18n/kit-labels.js";
|
|
11
11
|
import { pickLinkRenderer, replacingClick, routerLinkNavigation } from "./text-link.js";
|
|
12
|
+
import { useCommitReason } from "./write-lock.js";
|
|
12
13
|
const BUTTON_BASE = "inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
13
14
|
const BUTTON_SIZES = {
|
|
14
15
|
md: "gap-2 px-3 py-2 text-sm",
|
|
@@ -144,7 +145,8 @@ function ButtonElement({
|
|
|
144
145
|
stretch,
|
|
145
146
|
tone = "default",
|
|
146
147
|
pressed,
|
|
147
|
-
disabledReason,
|
|
148
|
+
disabledReason: ownDisabledReason,
|
|
149
|
+
commit,
|
|
148
150
|
pending,
|
|
149
151
|
className,
|
|
150
152
|
onClick,
|
|
@@ -157,6 +159,7 @@ function ButtonElement({
|
|
|
157
159
|
...rest
|
|
158
160
|
}) {
|
|
159
161
|
const reasonId = useId();
|
|
162
|
+
const disabledReason = useCommitReason(commit, ownDisabledReason);
|
|
160
163
|
const locked = hasContent(disabledReason);
|
|
161
164
|
const inert = locked || Boolean(pending);
|
|
162
165
|
const ownDescribedBy = rest["aria-describedby"];
|
|
@@ -486,7 +489,8 @@ function IconButtonElement({
|
|
|
486
489
|
tooltipSide,
|
|
487
490
|
tooltipPortal,
|
|
488
491
|
tooltipLazy = true,
|
|
489
|
-
disabledReason,
|
|
492
|
+
disabledReason: ownDisabledReason,
|
|
493
|
+
commit,
|
|
490
494
|
pending,
|
|
491
495
|
glyphSize,
|
|
492
496
|
badge,
|
|
@@ -507,6 +511,7 @@ function IconButtonElement({
|
|
|
507
511
|
const tone = toneProp ?? (toneColor !== void 0 ? "custom" : "default");
|
|
508
512
|
const keep = disabledStyle === "keep";
|
|
509
513
|
const reasonId = useId();
|
|
514
|
+
const disabledReason = useCommitReason(commit, ownDisabledReason);
|
|
510
515
|
const locked = hasContent(disabledReason);
|
|
511
516
|
const inert = locked || Boolean(pending);
|
|
512
517
|
const ownDescribedBy = rest["aria-describedby"];
|
|
@@ -742,8 +747,12 @@ function useFieldError(error, invalid, describedBy, ariaInvalid) {
|
|
|
742
747
|
errorEl: hasError ? /* @__PURE__ */ jsx("p", { id: errorId, className: FIELD_ERROR_CLASS, children: error }) : null
|
|
743
748
|
};
|
|
744
749
|
}
|
|
745
|
-
function FieldGroup({
|
|
746
|
-
|
|
750
|
+
function FieldGroup({
|
|
751
|
+
errorEl,
|
|
752
|
+
reserve = false,
|
|
753
|
+
children
|
|
754
|
+
}) {
|
|
755
|
+
if (errorEl === null && !reserve) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
747
756
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
748
757
|
children,
|
|
749
758
|
errorEl
|
|
@@ -758,19 +767,21 @@ function resolvePasswordRevealLabels(partial) {
|
|
|
758
767
|
return { ...DEFAULT_PASSWORD_REVEAL_LABELS, ...partial };
|
|
759
768
|
}
|
|
760
769
|
const PICKER_TYPES = /* @__PURE__ */ new Set(["date", "datetime-local", "month", "time", "week"]);
|
|
761
|
-
const Input = forwardRef(function Input2({
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
770
|
+
const Input = forwardRef(function Input2(props, ref) {
|
|
771
|
+
const {
|
|
772
|
+
className,
|
|
773
|
+
inputClassName,
|
|
774
|
+
label,
|
|
775
|
+
id,
|
|
776
|
+
placeholder,
|
|
777
|
+
type,
|
|
778
|
+
variant = "field",
|
|
779
|
+
invalid,
|
|
780
|
+
error,
|
|
781
|
+
passwordLabels,
|
|
782
|
+
...rest
|
|
783
|
+
} = props;
|
|
784
|
+
const reserve = "error" in props;
|
|
774
785
|
const generated = useId();
|
|
775
786
|
const fieldId = id ?? generated;
|
|
776
787
|
const { isInvalid, describedBy, errorEl } = useFieldError(
|
|
@@ -805,7 +816,7 @@ const Input = forwardRef(function Input2({
|
|
|
805
816
|
) : null;
|
|
806
817
|
if (label === void 0) {
|
|
807
818
|
if (!isPassword) {
|
|
808
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsx(
|
|
819
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, reserve, children: /* @__PURE__ */ jsx(
|
|
809
820
|
"input",
|
|
810
821
|
{
|
|
811
822
|
ref,
|
|
@@ -820,7 +831,7 @@ const Input = forwardRef(function Input2({
|
|
|
820
831
|
}
|
|
821
832
|
) });
|
|
822
833
|
}
|
|
823
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
834
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, reserve, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
824
835
|
/* @__PURE__ */ jsx(
|
|
825
836
|
"input",
|
|
826
837
|
{
|
|
@@ -837,7 +848,7 @@ const Input = forwardRef(function Input2({
|
|
|
837
848
|
revealToggle
|
|
838
849
|
] }) });
|
|
839
850
|
}
|
|
840
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsxs(FloatingField, { className, htmlFor: fieldId, label, srOnlyLabel: asDisplay, children: [
|
|
851
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, reserve, children: /* @__PURE__ */ jsxs(FloatingField, { className, htmlFor: fieldId, label, srOnlyLabel: asDisplay, children: [
|
|
841
852
|
/* @__PURE__ */ jsx(
|
|
842
853
|
"input",
|
|
843
854
|
{
|
|
@@ -862,7 +873,9 @@ const Input = forwardRef(function Input2({
|
|
|
862
873
|
});
|
|
863
874
|
Input.displayName = "Input";
|
|
864
875
|
const SELECT_SM = "h-7 py-0 ps-2 pe-7 text-xs";
|
|
865
|
-
const Select = forwardRef(function Select2(
|
|
876
|
+
const Select = forwardRef(function Select2(props, ref) {
|
|
877
|
+
const { className, label, id, children, invalid, error, hint, size, selectClassName, ...rest } = props;
|
|
878
|
+
const reserve = "error" in props;
|
|
866
879
|
const generated = useId();
|
|
867
880
|
const nativeSize = typeof size === "number" ? size : void 0;
|
|
868
881
|
const listBox = nativeSize !== void 0 && nativeSize > 1 || Boolean(rest.multiple);
|
|
@@ -906,7 +919,7 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
906
919
|
}
|
|
907
920
|
);
|
|
908
921
|
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: [
|
|
922
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, reserve, children: /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1.5", className), children: [
|
|
910
923
|
/* @__PURE__ */ jsxs("div", { className: "relative min-w-0 flex-1", children: [
|
|
911
924
|
select,
|
|
912
925
|
chevron
|
|
@@ -914,12 +927,12 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
914
927
|
/* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: hint })
|
|
915
928
|
] }) });
|
|
916
929
|
}
|
|
917
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
930
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, reserve, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
918
931
|
select,
|
|
919
932
|
chevron
|
|
920
933
|
] }) });
|
|
921
934
|
}
|
|
922
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, children: /* @__PURE__ */ jsxs(FloatingField, { className, htmlFor: fieldId, label, staticLabel: true, hint: textHint ? void 0 : hint, children: [
|
|
935
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, reserve, children: /* @__PURE__ */ jsxs(FloatingField, { className, htmlFor: fieldId, label, staticLabel: true, hint: textHint ? void 0 : hint, children: [
|
|
923
936
|
/* @__PURE__ */ jsx(
|
|
924
937
|
"select",
|
|
925
938
|
{
|
|
@@ -947,7 +960,9 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
947
960
|
] }) });
|
|
948
961
|
});
|
|
949
962
|
Select.displayName = "Select";
|
|
950
|
-
const Textarea = forwardRef(function Textarea2(
|
|
963
|
+
const Textarea = forwardRef(function Textarea2(props, ref) {
|
|
964
|
+
const { className, label, id, placeholder, invalid, error, ...rest } = props;
|
|
965
|
+
const reserve = "error" in props;
|
|
951
966
|
const generated = useId();
|
|
952
967
|
const fieldId = id ?? generated;
|
|
953
968
|
const { isInvalid, describedBy, errorEl } = useFieldError(
|
|
@@ -957,7 +972,7 @@ const Textarea = forwardRef(function Textarea2({ className, label, id, placehold
|
|
|
957
972
|
rest["aria-invalid"]
|
|
958
973
|
);
|
|
959
974
|
if (label === void 0) {
|
|
960
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsx(
|
|
975
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, reserve, children: /* @__PURE__ */ jsx(
|
|
961
976
|
"textarea",
|
|
962
977
|
{
|
|
963
978
|
ref,
|
|
@@ -970,7 +985,7 @@ const Textarea = forwardRef(function Textarea2({ className, label, id, placehold
|
|
|
970
985
|
}
|
|
971
986
|
) });
|
|
972
987
|
}
|
|
973
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsx(FloatingField, { className, htmlFor: fieldId, label, children: /* @__PURE__ */ jsx(
|
|
988
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, reserve, children: /* @__PURE__ */ jsx(FloatingField, { className, htmlFor: fieldId, label, children: /* @__PURE__ */ jsx(
|
|
974
989
|
"textarea",
|
|
975
990
|
{
|
|
976
991
|
ref,
|
|
@@ -1016,6 +1031,12 @@ const CARD_PADDING_STRONG = {
|
|
|
1016
1031
|
sm: "p-[11px]",
|
|
1017
1032
|
md: "p-[15px]"
|
|
1018
1033
|
};
|
|
1034
|
+
const CARD_TONE_WASH = {
|
|
1035
|
+
warning: "bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]",
|
|
1036
|
+
danger: "bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]",
|
|
1037
|
+
info: "bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]",
|
|
1038
|
+
success: "bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]"
|
|
1039
|
+
};
|
|
1019
1040
|
const CARD_TONES_STRONG = {
|
|
1020
1041
|
warning: "border-2 border-[var(--warning)]",
|
|
1021
1042
|
danger: "border-2 border-[var(--danger-border-strong)]",
|
|
@@ -1023,6 +1044,7 @@ const CARD_TONES_STRONG = {
|
|
|
1023
1044
|
success: "border-2 border-[var(--success)]"
|
|
1024
1045
|
};
|
|
1025
1046
|
const CardPaddedContext = createContext(false);
|
|
1047
|
+
const CardDensityContext = createContext("comfortable");
|
|
1026
1048
|
function Card({
|
|
1027
1049
|
className,
|
|
1028
1050
|
children,
|
|
@@ -1030,6 +1052,8 @@ function Card({
|
|
|
1030
1052
|
variant = "default",
|
|
1031
1053
|
tone,
|
|
1032
1054
|
toneStrength = "soft",
|
|
1055
|
+
toneFill = false,
|
|
1056
|
+
density = "comfortable",
|
|
1033
1057
|
padding,
|
|
1034
1058
|
...rest
|
|
1035
1059
|
}) {
|
|
@@ -1042,6 +1066,7 @@ function Card({
|
|
|
1042
1066
|
{
|
|
1043
1067
|
"data-tone": tone,
|
|
1044
1068
|
"data-tone-strength": strong ? "strong" : void 0,
|
|
1069
|
+
"data-density": density === "compact" ? "compact" : void 0,
|
|
1045
1070
|
...rest,
|
|
1046
1071
|
className: cn(
|
|
1047
1072
|
variant === "inset" ? "rounded-md bg-[var(--bg-surface-2)] p-3" : variant === "outline" ? (
|
|
@@ -1056,16 +1081,18 @@ function Card({
|
|
|
1056
1081
|
),
|
|
1057
1082
|
toned && (bordered ? toned.border : toned.fill),
|
|
1058
1083
|
strong && tone && CARD_TONES_STRONG[tone],
|
|
1084
|
+
toneFill && bordered && tone && CARD_TONE_WASH[tone],
|
|
1059
1085
|
toned?.title,
|
|
1060
1086
|
ownPadding && (strong ? CARD_PADDING_STRONG : CARD_PADDING)[ownPadding],
|
|
1061
1087
|
className
|
|
1062
1088
|
),
|
|
1063
|
-
children: /* @__PURE__ */ jsx(CardPaddedContext.Provider, { value: ownPadding !== void 0, children })
|
|
1089
|
+
children: /* @__PURE__ */ jsx(CardPaddedContext.Provider, { value: ownPadding !== void 0, children: /* @__PURE__ */ jsx(CardDensityContext.Provider, { value: density, children }) })
|
|
1064
1090
|
}
|
|
1065
1091
|
);
|
|
1066
1092
|
}
|
|
1067
1093
|
function CardHeader({ className, stackAction = false, ...props }) {
|
|
1068
1094
|
const padded = useContext(CardPaddedContext);
|
|
1095
|
+
const compact = useContext(CardDensityContext) === "compact";
|
|
1069
1096
|
return /* @__PURE__ */ jsx(
|
|
1070
1097
|
"div",
|
|
1071
1098
|
{
|
|
@@ -1085,6 +1112,7 @@ function CardHeader({ className, stackAction = false, ...props }) {
|
|
|
1085
1112
|
// never inherits an ancestor header's two columns.
|
|
1086
1113
|
"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
1114
|
padded ? "px-0 pt-0" : "px-6 pt-6",
|
|
1115
|
+
compact && "gap-0.5",
|
|
1088
1116
|
// One column under `sm`, and the action back into the flow (DOM order, so
|
|
1089
1117
|
// after the description when it is written after it), at the start edge.
|
|
1090
1118
|
// The descendant selector outranks CardAction's own placement classes.
|
|
@@ -1096,14 +1124,23 @@ function CardHeader({ className, stackAction = false, ...props }) {
|
|
|
1096
1124
|
);
|
|
1097
1125
|
}
|
|
1098
1126
|
function CardTitle({ className, as: Tag = "div", ...props }) {
|
|
1099
|
-
|
|
1127
|
+
const compact = useContext(CardDensityContext) === "compact";
|
|
1128
|
+
return /* @__PURE__ */ jsx(
|
|
1129
|
+
Tag,
|
|
1130
|
+
{
|
|
1131
|
+
"data-slot": "card-title",
|
|
1132
|
+
className: cn(compact ? "text-sm font-medium leading-snug" : "font-semibold leading-none", className),
|
|
1133
|
+
...props
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1100
1136
|
}
|
|
1101
1137
|
function CardDescription({ className, ...props }) {
|
|
1138
|
+
const compact = useContext(CardDensityContext) === "compact";
|
|
1102
1139
|
return /* @__PURE__ */ jsx(
|
|
1103
1140
|
"div",
|
|
1104
1141
|
{
|
|
1105
1142
|
"data-slot": "card-description",
|
|
1106
|
-
className: cn("text-sm text-[var(--text-muted)]", className),
|
|
1143
|
+
className: cn(compact ? "text-xs" : "text-sm", "text-[var(--text-muted)]", className),
|
|
1107
1144
|
...props
|
|
1108
1145
|
}
|
|
1109
1146
|
);
|