@eifi1/ui-kit 0.14.1 → 0.15.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 +4 -3
- package/dist/components/alert-banner.js +5 -2
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +9 -1
- package/dist/components/amount-input.js +10 -4
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.js +9 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/bulk-action-bar.js +6 -3
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/calculator.d.ts +1 -1
- package/dist/components/calendar-heatmap.js +5 -5
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/copy-button.d.ts +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-filter-popover.js +3 -3
- package/dist/components/data-table-filter-popover.js.map +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 +12 -4
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/error-boundary.js +2 -1
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/field.js +4 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +1 -1
- package/dist/components/file-dropzone.d.ts +1 -1
- package/dist/components/form-actions.d.ts +1 -1
- package/dist/components/image-grid.d.ts +8 -1
- package/dist/components/image-grid.js +16 -3
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/measured-grid.js +2 -2
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/money-field.d.ts +92 -0
- package/dist/components/money-field.js +40 -0
- package/dist/components/money-field.js.map +1 -0
- package/dist/components/multi-select.js +3 -0
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-field.d.ts +13 -2
- package/dist/components/number-field.js +4 -0
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +5 -2
- package/dist/components/number-input.js +11 -3
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +1 -1
- package/dist/components/page-header.js +29 -3
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/series-chart.js +37 -8
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.d.ts +1 -1
- package/dist/components/stat-tile.js +3 -3
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/text-link.d.ts +1 -1
- package/dist/components/text-link.js +2 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/time-input.d.ts +1 -1
- package/dist/components/treemap.d.ts +3 -2
- package/dist/components/treemap.js +14 -3
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/ui.d.ts +1 -1
- package/dist/components/ui.js +44 -10
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/{data-table-Drun8Fk9.d.ts → data-table-CfVXtCeG.d.ts} +4 -3
- package/dist/data-table.d.ts +1 -1
- package/dist/feedback/feedback-dialog.d.ts +10 -1
- package/dist/feedback/feedback-dialog.js +13 -3
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-thread.js +31 -12
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/hooks/use-file-drop.d.ts +1 -1
- package/dist/i18n/defaults.d.ts +1 -1
- package/dist/i18n/kit-labels.d.ts +1 -1
- package/dist/i18n/locales/de-CH-informal.d.ts +1 -1
- package/dist/i18n/locales/de-CH.d.ts +1 -1
- package/dist/i18n/locales/de-informal.d.ts +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +1 -1
- package/dist/i18n/locales/hu.js +1 -0
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -1
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -1
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/{kit-labels-Mz8zZHIF.d.ts → kit-labels-BHfRBbHs.d.ts} +5 -1
- package/dist/lib/document-navigation.d.ts +15 -0
- package/dist/lib/document-navigation.js +13 -0
- package/dist/lib/document-navigation.js.map +1 -0
- package/dist/lib/strip-fade.d.ts +31 -0
- package/dist/lib/strip-fade.js +54 -0
- package/dist/lib/strip-fade.js.map +1 -0
- package/dist/rhf/fields.d.ts +1 -1
- package/dist/rhf/form.d.ts +1 -1
- package/dist/rhf/form.js +1 -1
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf.d.ts +1 -1
- package/dist/shell/app-shell.d.ts +11 -2
- package/dist/shell/app-shell.js +20 -4
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +1 -1
- package/dist/shell.d.ts +1 -1
- package/dist/wizard/stepper-nav.d.ts +1 -1
- package/dist/wizard/stepper-nav.js +14 -2
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard.d.ts +1 -1
- package/package.json +7 -4
- package/src/components/alert-banner.tsx +10 -2
- package/src/components/amount-input.tsx +18 -4
- package/src/components/autocomplete.tsx +10 -1
- package/src/components/bulk-action-bar.tsx +12 -3
- package/src/components/calendar-heatmap.tsx +10 -5
- package/src/components/data-table-filter-popover.tsx +6 -3
- package/src/components/data-table.tsx +21 -7
- package/src/components/error-boundary.tsx +2 -1
- package/src/components/field.tsx +4 -1
- package/src/components/image-grid.tsx +30 -2
- package/src/components/measured-grid.tsx +3 -2
- package/src/components/money-field.tsx +75 -0
- package/src/components/multi-select.tsx +3 -0
- package/src/components/number-field.tsx +14 -0
- package/src/components/number-input.tsx +23 -4
- package/src/components/page-header.tsx +38 -3
- package/src/components/series-chart.tsx +56 -8
- package/src/components/stat-tile.tsx +8 -3
- package/src/components/text-link.tsx +2 -1
- package/src/components/treemap.tsx +30 -5
- package/src/components/ui.tsx +91 -11
- package/src/feedback/feedback-dialog.tsx +20 -2
- package/src/feedback/feedback-thread.tsx +36 -13
- package/src/i18n/locales/de.ts +1 -0
- package/src/i18n/locales/es.ts +1 -0
- package/src/i18n/locales/fr.ts +1 -0
- package/src/i18n/locales/hu.ts +1 -0
- package/src/i18n/locales/it.ts +1 -0
- package/src/i18n/locales/zh.ts +1 -0
- package/src/index.ts +1 -0
- package/src/lib/document-navigation.ts +17 -0
- package/src/lib/strip-fade.ts +82 -0
- package/src/rhf/form.tsx +3 -1
- package/src/shell/app-shell.tsx +34 -7
- package/src/wizard/stepper-nav.tsx +23 -2
package/dist/components/ui.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef, 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
|
+
import { scrollIntoStrip, useStripFade } from "../lib/strip-fade.js";
|
|
6
7
|
import { horizontalStep } from "../lib/direction.js";
|
|
7
8
|
import { useMediaQuery } from "../hooks/use-media-query.js";
|
|
8
9
|
import { Tooltip } from "./tooltip.js";
|
|
@@ -546,7 +547,8 @@ const PHONE_QUERY = "(max-width: 767px)";
|
|
|
546
547
|
const FIELD_DISPLAY = "block w-full border-x-0 border-t-0 border-b border-[var(--border)] bg-transparent px-0 pt-0 pb-1 text-[var(--text-primary)] shadow-none placeholder:text-[var(--text-placeholder)] focus:border-[var(--brand)] focus:outline-none focus:ring-0 disabled:opacity-60";
|
|
547
548
|
const FIELD_TRIGGER = cn(
|
|
548
549
|
FIELD_BASE,
|
|
549
|
-
"relative flex items-center justify-between gap-2 text-start hover:bg-[var(--bg-hover)]"
|
|
550
|
+
"relative flex items-center justify-between gap-2 text-start hover:bg-[var(--bg-hover)]",
|
|
551
|
+
"[&>:first-child]:min-h-[1lh]"
|
|
550
552
|
);
|
|
551
553
|
function FieldChevron({ className, ...rest }) {
|
|
552
554
|
return /* @__PURE__ */ jsx(
|
|
@@ -808,16 +810,24 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
808
810
|
const listBox = nativeSize !== void 0 && nativeSize > 1 || Boolean(rest.multiple);
|
|
809
811
|
const small = size === "sm" && label === void 0;
|
|
810
812
|
const fieldId = id ?? generated;
|
|
813
|
+
const hintId = useId();
|
|
814
|
+
const textHint = typeof hint === "string" && hint !== "" || typeof hint === "number";
|
|
811
815
|
const { isInvalid, describedBy, errorEl } = useFieldError(
|
|
812
816
|
error,
|
|
813
817
|
invalid,
|
|
814
|
-
|
|
818
|
+
// The caption goes in BEFORE the error — the standing advice first, the news
|
|
819
|
+
// second, the order useFieldError keeps for a caller's own description.
|
|
820
|
+
textHint ? rest["aria-describedby"] ? `${rest["aria-describedby"]} ${hintId}` : hintId : rest["aria-describedby"],
|
|
815
821
|
rest["aria-invalid"]
|
|
816
822
|
);
|
|
823
|
+
const below = textHint || errorEl !== null ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
824
|
+
textHint && /* @__PURE__ */ jsx("p", { id: hintId, className: "mt-1 text-[11px] leading-tight text-[var(--text-muted)]", children: hint }),
|
|
825
|
+
errorEl
|
|
826
|
+
] }) : null;
|
|
817
827
|
const chevron = rest.disabled || listBox ? null : /* @__PURE__ */ jsx(FieldChevron, { className: small ? "end-1.5 size-3.5" : void 0 });
|
|
818
|
-
const dress = listBox ? "overflow-y-auto" : "appearance-none pe-9";
|
|
828
|
+
const dress = listBox ? "overflow-y-auto [&_option]:py-1" : "appearance-none pe-9";
|
|
819
829
|
if (label === void 0) {
|
|
820
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
830
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
821
831
|
/* @__PURE__ */ jsx(
|
|
822
832
|
"select",
|
|
823
833
|
{
|
|
@@ -830,6 +840,7 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
830
840
|
className: cn(
|
|
831
841
|
FIELD_BASE,
|
|
832
842
|
dress,
|
|
843
|
+
listBox && "py-0",
|
|
833
844
|
small && SELECT_SM,
|
|
834
845
|
selectClassName,
|
|
835
846
|
isInvalid && FIELD_INVALID
|
|
@@ -840,7 +851,7 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
840
851
|
chevron
|
|
841
852
|
] }) });
|
|
842
853
|
}
|
|
843
|
-
return /* @__PURE__ */ jsx(FieldGroup, { errorEl, children: /* @__PURE__ */ jsxs(FloatingField, { className, htmlFor: fieldId, label, staticLabel: true, hint, children: [
|
|
854
|
+
return /* @__PURE__ */ jsx(FieldGroup, { errorEl: below, children: /* @__PURE__ */ jsxs(FloatingField, { className, htmlFor: fieldId, label, staticLabel: true, hint: textHint ? void 0 : hint, children: [
|
|
844
855
|
/* @__PURE__ */ jsx(
|
|
845
856
|
"select",
|
|
846
857
|
{
|
|
@@ -853,8 +864,9 @@ const Select = forwardRef(function Select2({ className, label, id, children, inv
|
|
|
853
864
|
className: cn(
|
|
854
865
|
FIELD_BASE,
|
|
855
866
|
// The floated label takes the top strip of a list box too, so its first
|
|
856
|
-
// row starts under the label rather than behind it.
|
|
857
|
-
|
|
867
|
+
// row starts under the label rather than behind it. No bottom padding — see
|
|
868
|
+
// `dress`.
|
|
869
|
+
listBox ? "pt-5 pb-0" : FIELD_FLOATING_PAD,
|
|
858
870
|
"peer",
|
|
859
871
|
dress,
|
|
860
872
|
selectClassName,
|
|
@@ -1131,6 +1143,7 @@ const TAB_REMOVABLE_CLASSES = "pe-8 md:pe-8";
|
|
|
1131
1143
|
const TAB_EMPTY_CLASSES = "-mx-1.5 rounded border border-dashed border-[var(--border-strong)] px-1.5";
|
|
1132
1144
|
const TAB_ADD_CLASSES = "inline-flex items-center gap-1 whitespace-nowrap rounded-md px-3 py-2 text-sm font-medium text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)] focus:outline-none focus:ring-2 focus:ring-[var(--border-strong)] disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:size-4";
|
|
1133
1145
|
const TAB_ADD_WRAP_CLASSES = "px-2.5 text-xs md:px-3 md:text-sm";
|
|
1146
|
+
const TAB_ADD_PHONE_CLASSES = "relative max-md:px-2";
|
|
1134
1147
|
function Tabs({
|
|
1135
1148
|
tabs,
|
|
1136
1149
|
active,
|
|
@@ -1153,6 +1166,12 @@ function Tabs({
|
|
|
1153
1166
|
const phone = useMediaQuery(PHONE_QUERY, false);
|
|
1154
1167
|
const vertical = orientation === "vertical" && !phone;
|
|
1155
1168
|
const stripRef = useRef(null);
|
|
1169
|
+
const fade = useStripFade(stripRef);
|
|
1170
|
+
useLayoutEffect(() => {
|
|
1171
|
+
const strip = stripRef.current;
|
|
1172
|
+
const tab = strip?.querySelector('[role="tab"][aria-selected="true"]');
|
|
1173
|
+
if (strip && tab) scrollIntoStrip(strip, tab);
|
|
1174
|
+
}, [active]);
|
|
1156
1175
|
const isRemovable = (tab) => onRemove !== void 0 && tab.removable !== false;
|
|
1157
1176
|
const deletesOnKey = (tab) => isRemovable(tab) && (removeOn === "every" || tab.id === active);
|
|
1158
1177
|
const nameOf = (tab) => tab.name ?? (typeof tab.label === "string" ? tab.label : tab.id);
|
|
@@ -1203,6 +1222,8 @@ function Tabs({
|
|
|
1203
1222
|
role: "tablist",
|
|
1204
1223
|
"aria-label": ariaLabel ?? label,
|
|
1205
1224
|
"aria-orientation": vertical ? "vertical" : void 0,
|
|
1225
|
+
style: fade.mask ? { ...rest.style, maskImage: fade.mask, WebkitMaskImage: fade.mask } : rest.style,
|
|
1226
|
+
"data-overflow": fade.overflow,
|
|
1206
1227
|
className: cn(
|
|
1207
1228
|
vertical ? TABLIST_VERTICAL_CLASSES : wrap ? TABLIST_WRAP_CLASSES : TABLIST_CLASSES,
|
|
1208
1229
|
onAdd ? "min-w-0" : className
|
|
@@ -1255,7 +1276,20 @@ function Tabs({
|
|
|
1255
1276
|
tab.detail != null ? /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-start text-start", children: [
|
|
1256
1277
|
/* @__PURE__ */ jsx("span", { children: tab.label }),
|
|
1257
1278
|
" ",
|
|
1258
|
-
/* @__PURE__ */ jsx(
|
|
1279
|
+
/* @__PURE__ */ jsx(
|
|
1280
|
+
"span",
|
|
1281
|
+
{
|
|
1282
|
+
className: cn(
|
|
1283
|
+
"text-[11px] font-normal leading-tight text-[var(--text-muted)]",
|
|
1284
|
+
// On a wrapped strip's filled chip (below `md`) the muted grey
|
|
1285
|
+
// was dark text on the brand fill — "loop 2" all but vanished
|
|
1286
|
+
// under the one label that most needed reading. It takes the
|
|
1287
|
+
// chip's own ink instead, as the label and the × already do.
|
|
1288
|
+
wrap && isActive && !vertical && "text-[var(--brand-contrast)] md:text-[var(--text-muted)]"
|
|
1289
|
+
),
|
|
1290
|
+
children: tab.detail
|
|
1291
|
+
}
|
|
1292
|
+
)
|
|
1259
1293
|
] }) : tab.label,
|
|
1260
1294
|
tab.badge != null ? vertical ? /* @__PURE__ */ jsx("span", { className: "ms-auto flex shrink-0 items-center", children: tab.badge }) : tab.badge : null
|
|
1261
1295
|
]
|
|
@@ -1345,10 +1379,10 @@ function Tabs({
|
|
|
1345
1379
|
type: "button",
|
|
1346
1380
|
onClick: onAdd,
|
|
1347
1381
|
disabled: busy,
|
|
1348
|
-
className: cn(TAB_ADD_CLASSES, wrap
|
|
1382
|
+
className: cn(TAB_ADD_CLASSES, wrap ? TAB_ADD_WRAP_CLASSES : TAB_ADD_PHONE_CLASSES),
|
|
1349
1383
|
children: [
|
|
1350
1384
|
/* @__PURE__ */ jsx(Plus, { "aria-hidden": true }),
|
|
1351
|
-
addLabel ?? text.add
|
|
1385
|
+
/* @__PURE__ */ jsx("span", { className: wrap ? void 0 : "max-md:sr-only", children: addLabel ?? text.add })
|
|
1352
1386
|
]
|
|
1353
1387
|
}
|
|
1354
1388
|
)
|