@eifi1/ui-kit 0.7.0 → 0.8.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 +32 -17
- package/dist/chart.d.ts +3 -2
- package/dist/components/alert-banner.d.ts +59 -10
- package/dist/components/alert-banner.js +114 -8
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +5 -0
- package/dist/components/button-group.d.ts +26 -0
- package/dist/components/button-group.js +49 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/calculator.d.ts +5 -0
- package/dist/components/chart-zoom.d.ts +63 -14
- package/dist/components/chart-zoom.js +82 -16
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/chip.d.ts +67 -2
- package/dist/components/chip.js +73 -8
- package/dist/components/chip.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +120 -0
- package/dist/components/confirm-dialog.js +96 -0
- package/dist/components/confirm-dialog.js.map +1 -0
- package/dist/components/copy-button.d.ts +62 -0
- package/dist/components/copy-button.js +95 -0
- package/dist/components/copy-button.js.map +1 -0
- 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-pagination.d.ts +5 -1
- package/dist/components/data-table-pagination.js +71 -58
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-sort.d.ts +28 -5
- package/dist/components/data-table-sort.js +11 -7
- package/dist/components/data-table-sort.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +544 -423
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +51 -5
- package/dist/components/date-picker.js +152 -40
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.d.ts +60 -0
- package/dist/components/description-list.js +112 -0
- package/dist/components/description-list.js.map +1 -0
- package/dist/components/disclosure.d.ts +37 -2
- package/dist/components/disclosure.js +14 -5
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/facing-pair.d.ts +2 -0
- package/dist/components/file-button.d.ts +19 -1
- package/dist/components/file-button.js +8 -1
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +56 -9
- package/dist/components/file-dropzone.js +100 -70
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/floating-panel.d.ts +107 -0
- package/dist/components/floating-panel.js +206 -0
- package/dist/components/floating-panel.js.map +1 -0
- package/dist/components/full-bleed-dialog.d.ts +12 -1
- package/dist/components/full-bleed-dialog.js +26 -5
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/modal.d.ts +6 -2
- package/dist/components/modal.js +2 -1
- package/dist/components/modal.js.map +1 -1
- package/dist/components/number-field.d.ts +5 -0
- package/dist/components/number-input.d.ts +5 -0
- package/dist/components/numpad-sheet.d.ts +5 -0
- package/dist/components/progress-bar.d.ts +54 -0
- package/dist/components/progress-bar.js +94 -0
- package/dist/components/progress-bar.js.map +1 -0
- package/dist/components/scroll-area.d.ts +53 -0
- package/dist/components/scroll-area.js +86 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/separator.d.ts +23 -0
- package/dist/components/separator.js +24 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/series-chart-ticks.d.ts +34 -1
- package/dist/components/series-chart-ticks.js +83 -1
- package/dist/components/series-chart-ticks.js.map +1 -1
- package/dist/components/series-chart.d.ts +314 -19
- package/dist/components/series-chart.js +510 -120
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.d.ts +2 -0
- package/dist/components/skeleton.d.ts +36 -0
- package/dist/components/skeleton.js +35 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/stat-tile.d.ts +60 -6
- package/dist/components/stat-tile.js +60 -26
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/table.d.ts +83 -0
- package/dist/components/table.js +166 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/time-input.d.ts +2 -0
- package/dist/components/toggle-legend.d.ts +3 -2
- package/dist/components/toggle-legend.js +1 -1
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/tooltip.d.ts +10 -4
- package/dist/components/tooltip.js +23 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tree-view.d.ts +129 -0
- package/dist/components/tree-view.js +376 -0
- package/dist/components/tree-view.js.map +1 -0
- package/dist/components/treemap.d.ts +9 -2
- package/dist/components/treemap.js +2 -1
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/ui.d.ts +92 -14
- package/dist/components/ui.js +112 -30
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/{data-table-filters-noy0Abvi.d.ts → data-table-filters-CF1PXqjQ.d.ts} +73 -3
- package/dist/data-table.d.ts +2 -2
- package/dist/data-table.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +28 -0
- package/dist/hooks/use-copy-to-clipboard.js +81 -0
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
- package/dist/hooks/use-debounce.d.ts +43 -0
- package/dist/hooks/use-debounce.js +56 -0
- package/dist/hooks/use-debounce.js.map +1 -0
- package/dist/hooks/use-file-drop.d.ts +72 -0
- package/dist/hooks/use-file-drop.js +57 -0
- package/dist/hooks/use-file-drop.js.map +1 -0
- package/dist/i18n/defaults.d.ts +5 -0
- package/dist/i18n/defaults.js +7 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +17 -0
- package/dist/i18n/kit-labels.js +6 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/de-CH-informal.d.ts +43 -0
- package/dist/i18n/locales/de-CH-informal.js +8 -0
- package/dist/i18n/locales/de-CH-informal.js.map +1 -0
- package/dist/i18n/locales/de-CH.d.ts +5 -0
- package/dist/i18n/locales/de-CH.js +1 -14
- package/dist/i18n/locales/de-CH.js.map +1 -1
- package/dist/i18n/locales/de-informal.d.ts +64 -0
- package/dist/i18n/locales/de-informal.js +37 -0
- package/dist/i18n/locales/de-informal.js.map +1 -0
- package/dist/i18n/locales/de.d.ts +5 -0
- package/dist/i18n/locales/de.js +25 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +5 -0
- package/dist/i18n/locales/es.js +25 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +5 -0
- package/dist/i18n/locales/fr.js +25 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +5 -0
- package/dist/i18n/locales/hu.js +25 -0
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +5 -0
- package/dist/i18n/locales/it.js +25 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +5 -0
- package/dist/i18n/locales/zh.js +25 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/swiss.d.ts +13 -0
- package/dist/i18n/swiss.js +19 -0
- package/dist/i18n/swiss.js.map +1 -0
- package/dist/index.d.ts +26 -11
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/dates.d.ts +37 -1
- package/dist/lib/dates.js +19 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/rhf/form.d.ts +2 -0
- package/dist/rhf.d.ts +2 -0
- package/dist/search/command-palette.d.ts +15 -1
- package/dist/search/command-palette.js +10 -2
- package/dist/search/command-palette.js.map +1 -1
- package/dist/shell/app-shell.js +2 -2
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +35 -2
- package/dist/wizard/stepper-nav.js +54 -22
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +107 -5
- package/dist/wizard/types.js +2 -1
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.js +141 -21
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/wizard-summary.d.ts +10 -2
- package/dist/wizard/wizard-summary.js +3 -1
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +4 -1
- package/dist/wizard.js.map +1 -1
- package/package.json +1 -1
- package/src/components/alert-banner.tsx +211 -20
- package/src/components/button-group.tsx +75 -0
- package/src/components/chart-zoom.tsx +158 -20
- package/src/components/chip.tsx +160 -9
- package/src/components/confirm-dialog.tsx +242 -0
- package/src/components/copy-button.tsx +158 -0
- package/src/components/data-table-pagination.tsx +19 -6
- package/src/components/data-table-sort.ts +49 -10
- package/src/components/data-table.tsx +293 -24
- package/src/components/date-picker.tsx +262 -57
- package/src/components/description-list.tsx +174 -0
- package/src/components/disclosure.tsx +58 -5
- package/src/components/file-button.tsx +22 -2
- package/src/components/file-dropzone.tsx +198 -100
- package/src/components/floating-panel.tsx +341 -0
- package/src/components/full-bleed-dialog.tsx +48 -5
- package/src/components/modal.tsx +9 -2
- package/src/components/progress-bar.tsx +163 -0
- package/src/components/scroll-area.tsx +129 -0
- package/src/components/separator.tsx +37 -0
- package/src/components/series-chart-ticks.ts +135 -0
- package/src/components/series-chart.tsx +934 -67
- package/src/components/skeleton.tsx +65 -0
- package/src/components/stat-tile.tsx +160 -27
- package/src/components/table.tsx +263 -0
- package/src/components/toggle-legend.tsx +4 -3
- package/src/components/tooltip.tsx +40 -12
- package/src/components/tree-view.tsx +589 -0
- package/src/components/treemap.tsx +10 -2
- package/src/components/ui.tsx +268 -42
- package/src/data-table.ts +2 -0
- package/src/hooks/use-copy-to-clipboard.ts +122 -0
- package/src/hooks/use-debounce.ts +105 -0
- package/src/hooks/use-file-drop.ts +123 -0
- package/src/i18n/defaults.ts +6 -0
- package/src/i18n/kit-labels.tsx +19 -0
- package/src/i18n/locales/de-CH-informal.ts +10 -0
- package/src/i18n/locales/de-CH.ts +1 -16
- package/src/i18n/locales/de-informal.ts +61 -0
- package/src/i18n/locales/de.ts +25 -0
- package/src/i18n/locales/es.ts +25 -0
- package/src/i18n/locales/fr.ts +25 -0
- package/src/i18n/locales/hu.ts +25 -0
- package/src/i18n/locales/it.ts +25 -0
- package/src/i18n/locales/zh.ts +25 -0
- package/src/i18n/swiss.ts +25 -0
- package/src/index.ts +29 -0
- package/src/lib/dates.ts +48 -0
- package/src/search/command-palette.tsx +29 -3
- package/src/shell/app-shell.tsx +2 -2
- package/src/wizard/stepper-nav.tsx +102 -28
- package/src/wizard/types.ts +106 -4
- package/src/wizard/use-wizard.ts +211 -31
- package/src/wizard/wizard-summary.tsx +24 -12
- package/src/wizard.ts +3 -2
|
@@ -13,8 +13,22 @@ import { createPortal } from "react-dom";
|
|
|
13
13
|
import { cn } from "../lib/cn";
|
|
14
14
|
import { useEscapeKey } from "../hooks/use-dismiss";
|
|
15
15
|
import { useAnchoredRect, type AnchorRect } from "../hooks/use-anchored-rect";
|
|
16
|
+
import { dirOf, type Direction } from "../lib/direction";
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
/** Where the bubble sits. `start` / `end` follow the reading direction — `end` is the
|
|
19
|
+
* right in LTR and the left in RTL — and are what a layout that mirrors should ask
|
|
20
|
+
* for. `left` / `right` stay physical, for a bubble tied to something that does not
|
|
21
|
+
* mirror (a chart axis, a map). */
|
|
22
|
+
export type TooltipSide = "top" | "bottom" | "left" | "right" | "start" | "end";
|
|
23
|
+
|
|
24
|
+
/** The placement the maths works in: a logical side resolved against the trigger. */
|
|
25
|
+
type PhysicalSide = "top" | "bottom" | "left" | "right";
|
|
26
|
+
|
|
27
|
+
function physicalSide(side: TooltipSide, dir: Direction): PhysicalSide {
|
|
28
|
+
if (side === "start") return dir === "rtl" ? "right" : "left";
|
|
29
|
+
if (side === "end") return dir === "rtl" ? "left" : "right";
|
|
30
|
+
return side;
|
|
31
|
+
}
|
|
18
32
|
|
|
19
33
|
/** The floating bubble itself. Uses the shared surface/border/text tokens so it
|
|
20
34
|
* reads as part of the app's chrome (like the top bar and cards) rather than the
|
|
@@ -37,6 +51,10 @@ const sidePositionClass: Record<TooltipSide, string> = {
|
|
|
37
51
|
bottom: "top-full left-1/2 -translate-x-1/2 mt-1",
|
|
38
52
|
left: "right-full top-1/2 -translate-y-1/2 mr-1",
|
|
39
53
|
right: "left-full top-1/2 -translate-y-1/2 ml-1",
|
|
54
|
+
// Logical insets, so CSS resolves the side from the inherited direction with no
|
|
55
|
+
// JavaScript: `end-full` pins the bubble's END edge to the trigger's start.
|
|
56
|
+
start: "end-full top-1/2 -translate-y-1/2 me-1",
|
|
57
|
+
end: "start-full top-1/2 -translate-y-1/2 ms-1",
|
|
40
58
|
};
|
|
41
59
|
|
|
42
60
|
/**
|
|
@@ -248,7 +266,7 @@ const TOOLTIP_GAP = 4;
|
|
|
248
266
|
* against the glass reads as clipped even when every character is on screen. */
|
|
249
267
|
const TOOLTIP_MARGIN = 4;
|
|
250
268
|
|
|
251
|
-
const portalTransformBySide: Record<
|
|
269
|
+
const portalTransformBySide: Record<PhysicalSide, string> = {
|
|
252
270
|
right: "translate(0, -50%)",
|
|
253
271
|
left: "translate(-100%, -50%)",
|
|
254
272
|
top: "translate(-50%, -100%)",
|
|
@@ -259,7 +277,7 @@ const portalTransformBySide: Record<TooltipSide, string> = {
|
|
|
259
277
|
* with {@link portalTransformBySide}, which shifts the box onto that point. */
|
|
260
278
|
function tooltipAnchor(
|
|
261
279
|
r: AnchorRect,
|
|
262
|
-
side:
|
|
280
|
+
side: PhysicalSide,
|
|
263
281
|
): { left: number; top: number } {
|
|
264
282
|
switch (side) {
|
|
265
283
|
case "right":
|
|
@@ -287,10 +305,10 @@ export interface TooltipPlacement {
|
|
|
287
305
|
left: number;
|
|
288
306
|
top: number;
|
|
289
307
|
/** Which side it ended up on, which need not be the one that was asked for. */
|
|
290
|
-
side:
|
|
308
|
+
side: PhysicalSide;
|
|
291
309
|
}
|
|
292
310
|
|
|
293
|
-
const opposite: Record<
|
|
311
|
+
const opposite: Record<PhysicalSide, PhysicalSide> = {
|
|
294
312
|
left: "right",
|
|
295
313
|
right: "left",
|
|
296
314
|
top: "bottom",
|
|
@@ -300,7 +318,7 @@ const opposite: Record<TooltipSide, TooltipSide> = {
|
|
|
300
318
|
/** Whether the bubble clears the viewport edge on `side` of the trigger. */
|
|
301
319
|
function roomOn(
|
|
302
320
|
r: AnchorRect,
|
|
303
|
-
side:
|
|
321
|
+
side: PhysicalSide,
|
|
304
322
|
size: TooltipSize,
|
|
305
323
|
viewport: TooltipViewport,
|
|
306
324
|
): boolean {
|
|
@@ -359,7 +377,7 @@ function clamp(value: number, low: number, high: number): number {
|
|
|
359
377
|
*/
|
|
360
378
|
export function placeTooltip(
|
|
361
379
|
r: AnchorRect,
|
|
362
|
-
side:
|
|
380
|
+
side: PhysicalSide,
|
|
363
381
|
size: TooltipSize,
|
|
364
382
|
viewport: TooltipViewport,
|
|
365
383
|
): TooltipPlacement {
|
|
@@ -394,6 +412,14 @@ function PortalTooltip({
|
|
|
394
412
|
const triggerRef = useRef<HTMLSpanElement | null>(null);
|
|
395
413
|
const bubbleRef = useRef<HTMLSpanElement | null>(null);
|
|
396
414
|
const [visible, setVisible] = useState(false);
|
|
415
|
+
// The trigger's reading direction, read when the bubble is asked for (an event, not a
|
|
416
|
+
// render): it resolves `start` / `end`, and the portalled bubble — which has left the
|
|
417
|
+
// subtree it would have inherited `dir` from — carries it too.
|
|
418
|
+
const [dir, setDir] = useState<Direction>("ltr");
|
|
419
|
+
const show = (el: Element) => {
|
|
420
|
+
setDir(dirOf(el));
|
|
421
|
+
setVisible(true);
|
|
422
|
+
};
|
|
397
423
|
const id = useId();
|
|
398
424
|
// Escape closes it outright, since this variant's bubble only exists while it is
|
|
399
425
|
// shown. The next mouseenter/focus brings it back, which is the behaviour WCAG
|
|
@@ -424,11 +450,12 @@ function PortalTooltip({
|
|
|
424
450
|
});
|
|
425
451
|
}, [visible, rect, label]);
|
|
426
452
|
|
|
427
|
-
const
|
|
453
|
+
const physical = physicalSide(side, dir);
|
|
454
|
+
const point = rect ? tooltipAnchor(rect, physical) : null;
|
|
428
455
|
// Unmeasured on the very first pass, where the anchor point plus the side's
|
|
429
456
|
// own transform is exactly what this always did. One layout effect later the
|
|
430
457
|
// size is known and the placement is decided properly.
|
|
431
|
-
const placed = rect && room ? placeTooltip(rect,
|
|
458
|
+
const placed = rect && room ? placeTooltip(rect, physical, room.size, room.viewport) : null;
|
|
432
459
|
|
|
433
460
|
return (
|
|
434
461
|
<>
|
|
@@ -440,9 +467,9 @@ function PortalTooltip({
|
|
|
440
467
|
{...rest}
|
|
441
468
|
ref={triggerRef}
|
|
442
469
|
className={cn("relative inline-flex", className)}
|
|
443
|
-
onMouseEnter={() =>
|
|
470
|
+
onMouseEnter={(e) => show(e.currentTarget)}
|
|
444
471
|
onMouseLeave={() => setVisible(false)}
|
|
445
|
-
onFocus={() =>
|
|
472
|
+
onFocus={(e) => show(e.currentTarget)}
|
|
446
473
|
onBlur={() => setVisible(false)}
|
|
447
474
|
>
|
|
448
475
|
{describedBy(children, visible ? id : undefined)}
|
|
@@ -455,6 +482,7 @@ function PortalTooltip({
|
|
|
455
482
|
ref={bubbleRef}
|
|
456
483
|
id={id}
|
|
457
484
|
role="tooltip"
|
|
485
|
+
dir={dir}
|
|
458
486
|
data-private={redact ? "" : undefined}
|
|
459
487
|
style={
|
|
460
488
|
placed
|
|
@@ -463,7 +491,7 @@ function PortalTooltip({
|
|
|
463
491
|
position: "fixed",
|
|
464
492
|
left: point.left,
|
|
465
493
|
top: point.top,
|
|
466
|
-
transform: portalTransformBySide[
|
|
494
|
+
transform: portalTransformBySide[physical],
|
|
467
495
|
}
|
|
468
496
|
}
|
|
469
497
|
className={cn(TOOLTIP_SURFACE, "pointer-events-none z-50")}
|