@botiverse/raft-ui 0.21.1 → 0.22.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/CHANGELOG.md +60 -0
- package/dist/{inbox-item.recipe-DelZxRmY.mjs → inbox-item.recipe-3j4DHKZ2.mjs} +1572 -389
- package/dist/{index-jTmbN7ov.d.mts → index-DT1Hg5N-.d.mts} +246 -54
- package/dist/index.d.mts +35 -77
- package/dist/index.mjs +171 -466
- package/dist/styles.css +7 -6
- package/dist/wip.d.mts +153 -3
- package/dist/wip.mjs +126 -2
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -625,9 +625,9 @@ textarea:-webkit-autofill:disabled {
|
|
|
625
625
|
background-image: linear-gradient(var(--fill-medium), var(--fill-medium));
|
|
626
626
|
}
|
|
627
627
|
|
|
628
|
-
/* A mark that leads a line of text: the icon
|
|
629
|
-
|
|
630
|
-
text, centred on it, and stays there when the text wraps
|
|
628
|
+
/* A mark that leads a line of text: the icon at the start of a banner, a
|
|
629
|
+
toast or a panel notice, or the status light of a chip, sits on the first
|
|
630
|
+
line of its text, centred on it, and stays there when the text wraps
|
|
631
631
|
(design/foundations/alignment.md#a-mark-that-leads-text). In Space
|
|
632
632
|
Grotesk's metrics the centre of the line box is the centre of the cap
|
|
633
633
|
height (to 0.006em); Chromium's rounding can lift the letters 0.5px, which
|
|
@@ -641,9 +641,10 @@ textarea:-webkit-autofill:disabled {
|
|
|
641
641
|
|
|
642
642
|
`lead-dot` places a status light the same way, in a box one line tall,
|
|
643
643
|
and keeps it at its one size beside text, 9px with a 1.5px ink edge
|
|
644
|
-
(status.md#sizes). It is kept at 9px inside components (
|
|
645
|
-
|
|
646
|
-
|
|
644
|
+
(status.md#sizes). It is kept at 9px inside components (Badge,
|
|
645
|
+
PanelActivity, a panel header); when placing Status yourself, don't pass
|
|
646
|
+
a size. A notice never uses a status light to say what kind of notice
|
|
647
|
+
it is; it leads with its intent's icon (status.md#sizes). */
|
|
647
648
|
@utility lead-icon {
|
|
648
649
|
flex-shrink: 0;
|
|
649
650
|
align-self: start;
|
package/dist/wip.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as VariantProps, Aa as DropdownMenuLinkItemProps, Br as PreviewCardMetaProps, Ci as MobileNavServerPopoverRowBody, Cn as MessageItemDelegatedByProps, Cr as PreviewCardActions, Di as MobileNavServerPopoverRowLabel, Do as DialogFooterNoteProps, Dr as PreviewCardBody, E as MessageQuotedPreviewAuthorDelegatedByProps, Ei as MobileNavServerPopoverRowDescriptionProps, Eo as DialogFooterNote, Fr as PreviewCardFooter, Ir as PreviewCardFooterProps, Li as PopoverBody, Mi as PopoverActionsProps, Nr as PreviewCardEyebrow, Oi as MobileNavServerPopoverRowLabelProps, Or as PreviewCardBodyProps, Pr as PreviewCardEyebrowProps, Ri as PopoverBodyProps, Ro as DialogSheetBack, Si as MobileNavServerPopoverRow, Sn as MessageItemDelegatedByNameProps, So as DialogContentProps, T as MessageQuotedPreviewAuthorDelegatedBy, Ti as MobileNavServerPopoverRowDescription, Uo as DialogTitleProps, Wo as DialogTrigger, Yo as ButtonProps, _i as MobileNavServerPopoverGroup, _n as MessageItemDelegatedAvatarProps, a as MessageListJumpPillDismissProps, bi as MobileNavServerPopoverListProps, bn as MessageItemDelegatedByButtonProps, c as MessageListJumpPillProps, ci as MobileNavServerItem, di as MobileNavServerPopoverContent, dt as MessageReferenceIcon, es as DataAttributes, fi as MobileNavServerPopoverContentProps, fo as DialogCommit, ft as MessageReferenceIconProps, gi as MobileNavServerPopoverDestinationsProps, gn as MessageItemDelegatedAvatar, go as Dialog, hi as MobileNavServerPopoverDestinations, ho as DialogSheetContentProps, i as MessageListJumpPillDismiss, ji as PopoverActions, ka as DropdownMenuLinkItem, ki as MobileNavServerPopoverRowProps, li as MobileNavServerItemProps, mi as MobileNavServerPopoverDestinationProps, mo as DialogSheetContent, n as MessageListJumpControlsProps, o as MessageListJumpPillGroup, pi as MobileNavServerPopoverDestination, po as DialogCommitProps, r as MessageListJumpPill, s as MessageListJumpPillGroupProps, t as MessageListJumpControls, ts as StyledProps, ui as MobileNavServerPopover, uo as TextLinkProps, vi as MobileNavServerPopoverGroupProps, vn as MessageItemDelegatedBy, wi as MobileNavServerPopoverRowBodyProps, wr as PreviewCardActionsProps, xi as MobileNavServerPopoverProps, xn as MessageItemDelegatedByName, yi as MobileNavServerPopoverList, yn as MessageItemDelegatedByButton, yo as DialogClose, zo as DialogSheetBackProps, zr as PreviewCardMeta } from "./index-DT1Hg5N-.mjs";
|
|
2
2
|
import { CSSProperties, ComponentProps, ComponentPropsWithRef, PointerEvent, ReactNode, RefObject } from "react";
|
|
3
3
|
import { Button } from "@base-ui/react/button";
|
|
4
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
-
import { Combobox } from "@base-ui/react/combobox";
|
|
6
5
|
import { PointerSensor, TouchSensor, TouchSensorOptions } from "@dnd-kit/core";
|
|
6
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
7
|
+
import { Meter as Meter$1 } from "@base-ui/react/meter";
|
|
7
8
|
//#region src/components/combobox-select/combobox-select.types.d.ts
|
|
8
9
|
type ComboboxSelectValue = string | number;
|
|
9
10
|
interface ComboboxSelectOption {
|
|
@@ -391,4 +392,153 @@ type InboxItemLeadingBadgeProps = useRender.ComponentProps<"span">;
|
|
|
391
392
|
*/
|
|
392
393
|
export declare function InboxItemLeadingBadge({ className, render, ...props }: InboxItemLeadingBadgeProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
393
394
|
//#endregion
|
|
394
|
-
|
|
395
|
+
//#region src/components/meter/meter.d.ts
|
|
396
|
+
declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
397
|
+
level: {
|
|
398
|
+
plenty: {};
|
|
399
|
+
low: {
|
|
400
|
+
root: string[];
|
|
401
|
+
};
|
|
402
|
+
empty: {
|
|
403
|
+
root: string[];
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
size: {
|
|
407
|
+
sm: {};
|
|
408
|
+
md: {};
|
|
409
|
+
};
|
|
410
|
+
}, {
|
|
411
|
+
root: string[];
|
|
412
|
+
header: string[];
|
|
413
|
+
label: string[];
|
|
414
|
+
value: string[];
|
|
415
|
+
track: string[];
|
|
416
|
+
indicator: string[];
|
|
417
|
+
}, undefined, {
|
|
418
|
+
level: {
|
|
419
|
+
plenty: {};
|
|
420
|
+
low: {
|
|
421
|
+
root: string[];
|
|
422
|
+
};
|
|
423
|
+
empty: {
|
|
424
|
+
root: string[];
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
size: {
|
|
428
|
+
sm: {};
|
|
429
|
+
md: {};
|
|
430
|
+
};
|
|
431
|
+
}, {
|
|
432
|
+
root: string[];
|
|
433
|
+
header: string[];
|
|
434
|
+
label: string[];
|
|
435
|
+
value: string[];
|
|
436
|
+
track: string[];
|
|
437
|
+
indicator: string[];
|
|
438
|
+
}, import("tailwind-variants/lite").TVReturnTypeLike<{
|
|
439
|
+
level: {
|
|
440
|
+
plenty: {};
|
|
441
|
+
low: {
|
|
442
|
+
root: string[];
|
|
443
|
+
};
|
|
444
|
+
empty: {
|
|
445
|
+
root: string[];
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
size: {
|
|
449
|
+
sm: {};
|
|
450
|
+
md: {};
|
|
451
|
+
};
|
|
452
|
+
}, {
|
|
453
|
+
root: string[];
|
|
454
|
+
header: string[];
|
|
455
|
+
label: string[];
|
|
456
|
+
value: string[];
|
|
457
|
+
track: string[];
|
|
458
|
+
indicator: string[];
|
|
459
|
+
}>>;
|
|
460
|
+
type MeterProps = Omit<StyledProps<Meter$1.Root.Props>, "value" | "min" | "max" | "aria-valuetext" | "getAriaValueText" | "format" | "locale"> & Pick<VariantProps<typeof meter>, "size"> & {
|
|
461
|
+
/**
|
|
462
|
+
* How much of the allowance is used, as the provider reports it, from 0 to
|
|
463
|
+
* `max`. The meter draws and announces what is left: `max - used`.
|
|
464
|
+
*/
|
|
465
|
+
used: number;
|
|
466
|
+
/**
|
|
467
|
+
* The whole allowance, in the same units as `used`.
|
|
468
|
+
* @default 100
|
|
469
|
+
*/
|
|
470
|
+
max?: number;
|
|
471
|
+
/**
|
|
472
|
+
* When as much as this is left, or less, the meter is low and takes the
|
|
473
|
+
* warning color ("at or below", unlike HTML's `<meter low>`, which is
|
|
474
|
+
* strictly below). In the units of `max`, clamped to 0 to `max`.
|
|
475
|
+
* @default 20% of `max`
|
|
476
|
+
*/
|
|
477
|
+
low?: number;
|
|
478
|
+
/**
|
|
479
|
+
* What is left, in words: "38% left · resets in 3h". `MeterValue` shows it,
|
|
480
|
+
* and it is the meter's `aria-valuetext`, so the caller writes it once.
|
|
481
|
+
*/
|
|
482
|
+
valueText: string;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* How much of an allowance is left, such as a usage limit that resets. Takes
|
|
486
|
+
* what is `used`; the bar shows what is left, full to start and draining.
|
|
487
|
+
* The info fill, like Progress, until `low` or less is left, then the warning
|
|
488
|
+
* color; never danger, and no success color at full.
|
|
489
|
+
*/
|
|
490
|
+
export declare function Meter({ size, used, max, low, valueText, className, ...props }: MeterProps): import("react").JSX.Element;
|
|
491
|
+
type MeterHeaderProps = ComponentPropsWithRef<"div">;
|
|
492
|
+
export declare function MeterHeader({ className, ...props }: MeterHeaderProps): import("react").JSX.Element;
|
|
493
|
+
type MeterLabelProps = StyledProps<Meter$1.Label.Props>;
|
|
494
|
+
export declare function MeterLabel({ className, ...props }: MeterLabelProps): import("react").JSX.Element;
|
|
495
|
+
type MeterValueProps = Omit<StyledProps<Meter$1.Value.Props>, "children">;
|
|
496
|
+
/** Shows the meter's `valueText`, at the end of `MeterHeader`. */
|
|
497
|
+
export declare function MeterValue({ className, ...props }: MeterValueProps): import("react").JSX.Element;
|
|
498
|
+
type MeterTrackProps = StyledProps<Meter$1.Track.Props>;
|
|
499
|
+
export declare function MeterTrack({ className, ...props }: MeterTrackProps): import("react").JSX.Element;
|
|
500
|
+
type MeterIndicatorProps = StyledProps<Meter$1.Indicator.Props>;
|
|
501
|
+
export declare function MeterIndicator({ className, ...props }: MeterIndicatorProps): import("react").JSX.Element;
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/lib/overlay-depth.d.ts
|
|
504
|
+
/**
|
|
505
|
+
* A modal surface: a centred dialog (Dialog, AlertDialog, or an app's own
|
|
506
|
+
* modal) or a sheet (Drawer).
|
|
507
|
+
*/
|
|
508
|
+
type OverlayLayerKind = "dialog" | "drawer";
|
|
509
|
+
type OverlayLayerProviderProps = {
|
|
510
|
+
/**
|
|
511
|
+
* What the surface is. Use `"dialog"` for an app's own modal, whatever it
|
|
512
|
+
* looks like: `"drawer"` is for a Base UI Drawer, which nests under another
|
|
513
|
+
* drawer by itself and only draws its own scrim over a `"dialog"`.
|
|
514
|
+
*/
|
|
515
|
+
kind: OverlayLayerKind;
|
|
516
|
+
/** Whether it dims what is under it. A non-modal surface adds nothing. */
|
|
517
|
+
modal: boolean;
|
|
518
|
+
children?: ReactNode;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Tells everything under it that a modal surface is open, so a raft-ui
|
|
522
|
+
* Dialog, AlertDialog or Drawer opened from inside draws the lighter nested
|
|
523
|
+
* scrim (design/foundations/elevation.md#stacked-overlays). raft-ui's own
|
|
524
|
+
* roots add one by themselves; an app's own modal (its own backdrop, Esc and
|
|
525
|
+
* focus) wraps its scrim and its content in one to join the stack, and reads
|
|
526
|
+
* `useParentOverlayKind` inside it to pick its own scrim. Modal overlays only:
|
|
527
|
+
* a non-modal one passes `modal={false}`, adds nothing, and must not call
|
|
528
|
+
* `useParentOverlayKind` (it would read the layer below as its own).
|
|
529
|
+
*/
|
|
530
|
+
export declare function OverlayLayerProvider({ kind, modal, children }: OverlayLayerProviderProps): import("react").JSX.Element;
|
|
531
|
+
/**
|
|
532
|
+
* The modal surface this overlay's own surface was opened from, or null when
|
|
533
|
+
* it is the first. Call it inside the surface's own `OverlayLayerProvider`
|
|
534
|
+
* (for raft-ui's overlays, inside their root): the last entry is the surface
|
|
535
|
+
* itself and the one before it is its parent. Not null means the surface is
|
|
536
|
+
* stacked over another and draws `layer-backdrop-nested` instead of
|
|
537
|
+
* `layer-backdrop`. Modal overlays only: under `modal={false}` nothing is
|
|
538
|
+
* added, so the last entry is the parent and this returns the wrong layer. It reads React context, so it sees the surfaces whose
|
|
539
|
+
* tree this one is rendered in, portals included; one opened from outside
|
|
540
|
+
* that tree is not stacked on it here.
|
|
541
|
+
*/
|
|
542
|
+
export declare function useParentOverlayKind(): OverlayLayerKind | null;
|
|
543
|
+
//#endregion
|
|
544
|
+
export { Dialog as AnnouncementDialog, DialogClose as AnnouncementDialogClose, DialogTrigger as AnnouncementDialogTrigger, type ComboboxSelectGroup, type ComboboxSelectMessages, type ComboboxSelectOption, type ComboboxSelectProps, type ComboboxSelectSelection, type ComboboxSelectValue, type CommentCardMetaProps, type CommentCardProps, type CommentCardQuoteProps, type CommentCardTriggerProps, type CommentEntryAuthorProps, type CommentEntryBodyProps, type CommentEntryHeaderProps, type CommentEntryProps, type CommentEntryTimeProps, type CommentMarginItemProps, type CommentMarginLayout, type CommentMarginLayoutItem, type CommentMarginLayoutOptions, type CommentMarginProps, type CommentMarkerProps, DialogCommit, type DialogCommitProps, DialogFooterNote, type DialogFooterNoteProps, DialogSheetBack, type DialogSheetBackProps, DialogSheetContent, type DialogSheetContentProps, DropdownMenuLinkItem, type DropdownMenuLinkItemProps, type EllipsisProps, type EllipsisState, type EllipsisToggleProps, type HoldThenMoveOptions, type InboxItemLeadingBadgeProps, MessageItemDelegatedAvatar, type MessageItemDelegatedAvatarProps, MessageItemDelegatedBy, MessageItemDelegatedByButton, type MessageItemDelegatedByButtonProps, MessageItemDelegatedByName, type MessageItemDelegatedByNameProps, type MessageItemDelegatedByProps, MessageListJumpControls, type MessageListJumpControlsProps, MessageListJumpPill, MessageListJumpPillDismiss, type MessageListJumpPillDismissProps, MessageListJumpPillGroup, type MessageListJumpPillGroupProps, type MessageListJumpPillProps, MessageQuotedPreviewAuthorDelegatedBy, type MessageQuotedPreviewAuthorDelegatedByProps, MessageReferenceIcon, type MessageReferenceIconProps, type MeterHeaderProps, type MeterIndicatorProps, type MeterLabelProps, type MeterProps, type MeterTrackProps, type MeterValueProps, MobileNavServerItem, type MobileNavServerItemProps, MobileNavServerPopover, MobileNavServerPopoverContent, type MobileNavServerPopoverContentProps, MobileNavServerPopoverDestination, type MobileNavServerPopoverDestinationProps, MobileNavServerPopoverDestinations, type MobileNavServerPopoverDestinationsProps, MobileNavServerPopoverGroup, type MobileNavServerPopoverGroupProps, MobileNavServerPopoverList, type MobileNavServerPopoverListProps, type MobileNavServerPopoverProps, MobileNavServerPopoverRow, MobileNavServerPopoverRowBody, type MobileNavServerPopoverRowBodyProps, MobileNavServerPopoverRowDescription, type MobileNavServerPopoverRowDescriptionProps, MobileNavServerPopoverRowLabel, type MobileNavServerPopoverRowLabelProps, type MobileNavServerPopoverRowProps, type OverlayLayerKind, type OverlayLayerProviderProps, PopoverActions, type PopoverActionsProps, PopoverBody, type PopoverBodyProps, PreviewCardActions, type PreviewCardActionsProps, PreviewCardBody, type PreviewCardBodyProps, PreviewCardEyebrow, type PreviewCardEyebrowProps, PreviewCardFooter, type PreviewCardFooterProps, PreviewCardMeta, type PreviewCardMetaProps, type UseCommentMarginFitsOptions };
|
package/dist/wip.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Br as DialogFooterNote, Er as TooltipContent, Gr as DialogSheetBack, Gt as measureContent, In as useHoldThenMoveTouchSensor, Ir as DialogClose, Jr as DialogTrigger, Jt as readNow, Kt as measureElement, Lr as DialogContent, Mr as DialogSheetContent, Pr as Dialog, Qt as PreviewCardBody, Sn as PopoverActions, Tn as PopoverBody, Tr as Tooltip, Wt as useOverflowTitle, Xn as DropdownMenuLinkItem, Xt as PreviewCardActions, Zr as TextLink, _n as MobileNavServerPopoverRow, _t as MessageItemDelegatedByName, a as MessageListJumpPillGroup, ai as useParentOverlayKind, bn as MobileNavServerPopoverRowLabel, ci as useTheme, dn as MobileNavServerPopover, ei as Button$1, fn as MobileNavServerPopoverContent, gn as MobileNavServerPopoverList, gt as MessageItemDelegatedByButton, h as MessageQuotedPreviewAuthorDelegatedBy, hn as MobileNavServerPopoverGroup, ht as MessageItemDelegatedBy, i as MessageListJumpPillDismiss, ii as OverlayLayerProvider, in as PreviewCardMeta, jr as DialogCommit, kr as TooltipTrigger, mn as MobileNavServerPopoverDestinations, mt as MessageItemDelegatedAvatar, n as MessageListJumpControls, nn as PreviewCardFooter, pn as MobileNavServerPopoverDestination, qr as DialogTitle, qt as observeTruncation, r as MessageListJumpPill, ri as defaultNativeButton, si as useThemeScopeProps, t as inboxItem, tn as PreviewCardEyebrow, ui as tv, un as MobileNavServerItem, vn as MobileNavServerPopoverRowBody, yn as MobileNavServerPopoverRowDescription, z as MessageReferenceIcon } from "./inbox-item.recipe-3j4DHKZ2.mjs";
|
|
2
2
|
import { Check, ChevronDown, LoaderCircle, Plus, X } from "lucide-react";
|
|
3
3
|
import { createContext, use, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -6,6 +6,7 @@ import { Button } from "@base-ui/react/button";
|
|
|
6
6
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
7
|
import { useRender } from "@base-ui/react/use-render";
|
|
8
8
|
import { Combobox } from "@base-ui/react/combobox";
|
|
9
|
+
import { Meter as Meter$1 } from "@base-ui/react/meter";
|
|
9
10
|
//#region src/lib/phone-media.ts
|
|
10
11
|
/**
|
|
11
12
|
* A phone: a touch screen narrower than the desktop layout. The complement, on
|
|
@@ -1490,4 +1491,127 @@ function InboxItemLeadingBadge({ className, render, ...props }) {
|
|
|
1490
1491
|
});
|
|
1491
1492
|
}
|
|
1492
1493
|
//#endregion
|
|
1493
|
-
|
|
1494
|
+
//#region src/components/meter/meter.tsx
|
|
1495
|
+
const meter = tv({
|
|
1496
|
+
slots: {
|
|
1497
|
+
root: [
|
|
1498
|
+
"group/meter grid w-full min-w-0 gap-1.5",
|
|
1499
|
+
"[--meter-indicator:var(--info)]",
|
|
1500
|
+
"[--meter-track:var(--fill-muted)]",
|
|
1501
|
+
"[--meter-track-edge:transparent]",
|
|
1502
|
+
"[--meter-value:var(--foreground-muted)]",
|
|
1503
|
+
"font-sans"
|
|
1504
|
+
],
|
|
1505
|
+
header: ["flex min-w-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5"],
|
|
1506
|
+
label: ["min-w-0 truncate", "text-footnote font-semibold text-foreground"],
|
|
1507
|
+
value: ["shrink-0 text-right tabular-nums", "text-footnote text-(--meter-value)"],
|
|
1508
|
+
track: [
|
|
1509
|
+
"relative w-full overflow-hidden bg-(--meter-track)",
|
|
1510
|
+
"inset-ring-1 inset-ring-(--meter-track-edge)",
|
|
1511
|
+
"h-2 group-data-[size=sm]/meter:h-1.5",
|
|
1512
|
+
"rounded-sticker"
|
|
1513
|
+
],
|
|
1514
|
+
indicator: [
|
|
1515
|
+
"block h-full bg-(--meter-indicator)",
|
|
1516
|
+
"transition-[width,background-color] duration-200 ease-out",
|
|
1517
|
+
"rounded-[inherit] inset-ring-[1.5px] inset-ring-sticker-ink"
|
|
1518
|
+
]
|
|
1519
|
+
},
|
|
1520
|
+
variants: {
|
|
1521
|
+
level: {
|
|
1522
|
+
plenty: {},
|
|
1523
|
+
low: { root: ["[--meter-indicator:var(--warning)]", "[--meter-value:var(--warning-strong)]"] },
|
|
1524
|
+
empty: { root: [
|
|
1525
|
+
"[--meter-track:var(--warning-muted)]",
|
|
1526
|
+
"[--meter-track-edge:var(--warning)]",
|
|
1527
|
+
"[--meter-value:var(--warning-strong)]"
|
|
1528
|
+
] }
|
|
1529
|
+
},
|
|
1530
|
+
size: {
|
|
1531
|
+
sm: {},
|
|
1532
|
+
md: {}
|
|
1533
|
+
}
|
|
1534
|
+
},
|
|
1535
|
+
defaultVariants: {
|
|
1536
|
+
level: "plenty",
|
|
1537
|
+
size: "md"
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
const MeterTextContext = createContext("");
|
|
1541
|
+
function clamp(value, min, max) {
|
|
1542
|
+
return Math.min(max, Math.max(min, Number.isNaN(value) ? min : value));
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* How much of an allowance is left, such as a usage limit that resets. Takes
|
|
1546
|
+
* what is `used`; the bar shows what is left, full to start and draining.
|
|
1547
|
+
* The info fill, like Progress, until `low` or less is left, then the warning
|
|
1548
|
+
* color; never danger, and no success color at full.
|
|
1549
|
+
*/
|
|
1550
|
+
function Meter({ size = "md", used, max = 100, low, valueText, className, ...props }) {
|
|
1551
|
+
const left = max - clamp(used, 0, max);
|
|
1552
|
+
const lowAt = clamp(low ?? max * .2, 0, max);
|
|
1553
|
+
const level = left <= 0 ? "empty" : left <= lowAt ? "low" : "plenty";
|
|
1554
|
+
const { root } = meter({
|
|
1555
|
+
size,
|
|
1556
|
+
level
|
|
1557
|
+
});
|
|
1558
|
+
return /* @__PURE__ */ jsx(MeterTextContext.Provider, {
|
|
1559
|
+
value: valueText,
|
|
1560
|
+
children: /* @__PURE__ */ jsx(Meter$1.Root, {
|
|
1561
|
+
"data-slot": "meter",
|
|
1562
|
+
"data-size": size,
|
|
1563
|
+
"data-level": level,
|
|
1564
|
+
min: 0,
|
|
1565
|
+
max,
|
|
1566
|
+
value: left,
|
|
1567
|
+
"aria-valuetext": valueText,
|
|
1568
|
+
className: root({ className }),
|
|
1569
|
+
...props
|
|
1570
|
+
})
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
function MeterHeader({ className, ...props }) {
|
|
1574
|
+
const { header } = meter();
|
|
1575
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1576
|
+
"data-slot": "meter-header",
|
|
1577
|
+
className: header({ className }),
|
|
1578
|
+
...props
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
function MeterLabel({ className, ...props }) {
|
|
1582
|
+
const { label } = meter();
|
|
1583
|
+
return /* @__PURE__ */ jsx(Meter$1.Label, {
|
|
1584
|
+
"data-slot": "meter-label",
|
|
1585
|
+
className: label({ className }),
|
|
1586
|
+
...props
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
/** Shows the meter's `valueText`, at the end of `MeterHeader`. */
|
|
1590
|
+
function MeterValue({ className, ...props }) {
|
|
1591
|
+
const { value } = meter();
|
|
1592
|
+
const valueText = useContext(MeterTextContext);
|
|
1593
|
+
return /* @__PURE__ */ jsx(Meter$1.Value, {
|
|
1594
|
+
"data-slot": "meter-value",
|
|
1595
|
+
className: value({ className }),
|
|
1596
|
+
...props,
|
|
1597
|
+
children: () => valueText
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
function MeterTrack({ className, ...props }) {
|
|
1601
|
+
const { track } = meter();
|
|
1602
|
+
return /* @__PURE__ */ jsx(Meter$1.Track, {
|
|
1603
|
+
"data-slot": "meter-track",
|
|
1604
|
+
className: track({ className }),
|
|
1605
|
+
...props
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
function MeterIndicator({ className, ...props }) {
|
|
1609
|
+
const { indicator } = meter();
|
|
1610
|
+
return /* @__PURE__ */ jsx(Meter$1.Indicator, {
|
|
1611
|
+
"data-slot": "meter-indicator",
|
|
1612
|
+
className: indicator({ className }),
|
|
1613
|
+
...props
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
//#endregion
|
|
1617
|
+
export { Dialog as AnnouncementDialog, AnnouncementDialogAction, AnnouncementDialogBody, DialogClose as AnnouncementDialogClose, AnnouncementDialogContent, AnnouncementDialogFooter, AnnouncementDialogHeader, AnnouncementDialogLabel, AnnouncementDialogPicture, AnnouncementDialogSecondaryAction, AnnouncementDialogText, AnnouncementDialogTitle, DialogTrigger as AnnouncementDialogTrigger, COMMENT_HIGHLIGHT, COMMENT_HIGHLIGHT_ACTIVE, ComboboxSelect, CommentCard, CommentCardMeta, CommentCardQuote, CommentCardTrigger, CommentEntry, CommentEntryAuthor, CommentEntryBody, CommentEntryHeader, CommentEntryTime, CommentMargin, CommentMarginItem, CommentMarker, DialogCommit, DialogFooterNote, DialogSheetBack, DialogSheetContent, DropdownMenuLinkItem, Ellipsis, EllipsisToggle, InboxItemLeadingBadge, MessageItemDelegatedAvatar, MessageItemDelegatedBy, MessageItemDelegatedByButton, MessageItemDelegatedByName, MessageListJumpControls, MessageListJumpPill, MessageListJumpPillDismiss, MessageListJumpPillGroup, MessageQuotedPreviewAuthorDelegatedBy, MessageReferenceIcon, Meter, MeterHeader, MeterIndicator, MeterLabel, MeterTrack, MeterValue, MobileNavServerItem, MobileNavServerPopover, MobileNavServerPopoverContent, MobileNavServerPopoverDestination, MobileNavServerPopoverDestinations, MobileNavServerPopoverGroup, MobileNavServerPopoverList, MobileNavServerPopoverRow, MobileNavServerPopoverRowBody, MobileNavServerPopoverRowDescription, MobileNavServerPopoverRowLabel, OverlayLayerProvider, PopoverActions, PopoverBody, PreviewCardActions, PreviewCardBody, PreviewCardEyebrow, PreviewCardFooter, PreviewCardMeta, resolveCommentMarginLayout, setCommentHighlights, useCommentMarginFits, useHoldThenMoveTouchSensor, useParentOverlayKind, useTruncated };
|