@botiverse/raft-ui 0.48.0 → 0.50.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 +35 -0
- package/dist/foundation.css +20 -0
- package/dist/{inbox-item-VkYFHY84.d.mts → inbox-item-B4nNvpp1.d.mts} +37 -13
- package/dist/{inbox-item-DbZusMRA.mjs → inbox-item-DHJOrxB8.mjs} +89 -36
- package/dist/index.d.mts +23 -3
- package/dist/index.mjs +124 -66
- package/dist/styles.css +93 -4
- package/dist/tokens.json +45 -0
- package/dist/wip.d.mts +27 -32
- package/dist/wip.mjs +18 -27
- package/package.json +1 -1
package/dist/tokens.json
CHANGED
|
@@ -1567,6 +1567,51 @@
|
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
+
},
|
|
1571
|
+
"cell-hover": {
|
|
1572
|
+
"$description": "A list cell's hover and its menu-open fill (lib/list-cell.ts), drawn on the cell's inset shape. fill-subtle in light. In dark it steps up to 7.5% ink, so the rounded shape reads on a dark surface, where fill-subtle's 3% barely shows. Rows only: the global tiers don't change.",
|
|
1573
|
+
"$value": "{fill.subtle}",
|
|
1574
|
+
"$extensions": {
|
|
1575
|
+
"build.botiverse.raft": {
|
|
1576
|
+
"modes": {
|
|
1577
|
+
"dark": {
|
|
1578
|
+
"colorSpace": "oklch",
|
|
1579
|
+
"components": [0.9843, 0.004, 106.47],
|
|
1580
|
+
"alpha": 0.075
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
},
|
|
1586
|
+
"cell-press": {
|
|
1587
|
+
"$description": "A list cell's press fill, the same with a mouse and on a touch screen. fill-medium in light. In dark 12% ink, a clear step over the cell's dark hover.",
|
|
1588
|
+
"$value": "{fill.medium}",
|
|
1589
|
+
"$extensions": {
|
|
1590
|
+
"build.botiverse.raft": {
|
|
1591
|
+
"modes": {
|
|
1592
|
+
"dark": {
|
|
1593
|
+
"colorSpace": "oklch",
|
|
1594
|
+
"components": [0.9843, 0.004, 106.47],
|
|
1595
|
+
"alpha": 0.12
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
},
|
|
1601
|
+
"cell-selected": {
|
|
1602
|
+
"$description": "A list cell that is selected or open beside its list (an active InboxItem, a selected ListRow), and the located highlight on a cell. info-soft in light. In dark the cyan at 38% instead of 18%, so a selected cell stands out from a hovered one.",
|
|
1603
|
+
"$value": "{info.soft}",
|
|
1604
|
+
"$extensions": {
|
|
1605
|
+
"build.botiverse.raft": {
|
|
1606
|
+
"modes": {
|
|
1607
|
+
"dark": {
|
|
1608
|
+
"colorSpace": "oklch",
|
|
1609
|
+
"components": [0.452, 0.0862, 225.67],
|
|
1610
|
+
"alpha": 0.38
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1570
1615
|
}
|
|
1571
1616
|
},
|
|
1572
1617
|
"line": {
|
package/dist/wip.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as MessageListJumpPillProps, Ai as PreviewCardFooter, As as TextLinkProps, B as DragMessages, C as InboxItemProps, Ca as MobileNavServerPopoverRowLabelProps, Ci as PreviewCardBodyProps, Da as PopoverActionsProps, Ea as PopoverActions, Fi as PreviewCardMetaProps, Fs as DialogSheetContentProps, G as dragMessages, H as DragPlace, Hs as DialogContentProps, Is as Dialog, J as MessageListJumpPill, K as MessageListJumpControls, Ks as DialogFooterNote, Ma as PopoverBody, Ms as DialogCommit, Na as PopoverBodyProps, Ns as DialogCommitProps, Oi as PreviewCardEyebrow, Pi as PreviewCardMeta, Ps as DialogSheetContent, Q as MessageListJumpPillGroupProps, R as DEFAULT_DRAG_MESSAGES, Sa as MobileNavServerPopoverRowLabel, Si as PreviewCardBody, To as DropdownMenuLinkItemProps, U as createDragAnnouncements, V as DragNamed, W as dragInstructions, X as MessageListJumpPillDismissProps, Y as MessageListJumpPillDismiss, Z as MessageListJumpPillGroup, _a as MobileNavServerPopoverRow, _t as MessageQuotedPreviewAuthorDelegatedByProps, aa as MobileNavServerPopover, ac as DialogSheetBackProps, ba as MobileNavServerPopoverRowDescription, bc as DataAttributes, ca as MobileNavServerPopoverDestination, ci as AvatarGroupButton, da as MobileNavServerPopoverDestinationsProps, dn as MessageReferenceReadMarkProps, dr as MessageItemDelegatedBy, fa as MobileNavServerPopoverGroup, fr as MessageItemDelegatedByButton, ga as MobileNavServerPopoverProps, gr as MessageItemDelegatedByProps, gt as MessageQuotedPreviewAuthorDelegatedBy, ha as MobileNavServerPopoverListProps, hc as ButtonProps, hr as MessageItemDelegatedByNameProps, ia as MobileNavServerItemProps, ic as DialogSheetBack, ji as PreviewCardFooterProps, ki as PreviewCardEyebrowProps, la as MobileNavServerPopoverDestinationProps, lc as DialogTitleProps, li as AvatarGroupButtonProps, lr as MessageItemDelegatedAvatar, ma as MobileNavServerPopoverList, mr as MessageItemDelegatedByName, nn as MessageReferenceIcon, oa as MobileNavServerPopoverContent, pa as MobileNavServerPopoverGroupProps, pr as MessageItemDelegatedByButtonProps, q as MessageListJumpControlsProps, qs as DialogFooterNoteProps, ra as MobileNavServerItem, rn as MessageReferenceIconProps, sa as MobileNavServerPopoverContentProps, u as InboxItemDensity, ua as MobileNavServerPopoverDestinations, uc as DialogTrigger, un as MessageReferenceReadMark, ur as MessageItemDelegatedAvatarProps, va as MobileNavServerPopoverRowBody, vi as PreviewCardActions, wa as MobileNavServerPopoverRowProps, wo as DropdownMenuLinkItem, xa as MobileNavServerPopoverRowDescriptionProps, xc as StyledProps, ya as MobileNavServerPopoverRowBodyProps, yc as VariantProps, yi as PreviewCardActionsProps, ys as ListRowProps, z as DragAnnouncementSource, zs as DialogClose } from "./inbox-item-
|
|
1
|
+
import { $ as MessageListJumpPillProps, Ai as PreviewCardFooter, As as TextLinkProps, B as DragMessages, C as InboxItemProps, Ca as MobileNavServerPopoverRowLabelProps, Ci as PreviewCardBodyProps, Da as PopoverActionsProps, Ea as PopoverActions, Fi as PreviewCardMetaProps, Fs as DialogSheetContentProps, G as dragMessages, H as DragPlace, Hs as DialogContentProps, Is as Dialog, J as MessageListJumpPill, K as MessageListJumpControls, Ks as DialogFooterNote, Ma as PopoverBody, Ms as DialogCommit, Na as PopoverBodyProps, Ns as DialogCommitProps, Oi as PreviewCardEyebrow, Pi as PreviewCardMeta, Ps as DialogSheetContent, Q as MessageListJumpPillGroupProps, R as DEFAULT_DRAG_MESSAGES, Sa as MobileNavServerPopoverRowLabel, Si as PreviewCardBody, To as DropdownMenuLinkItemProps, U as createDragAnnouncements, V as DragNamed, W as dragInstructions, X as MessageListJumpPillDismissProps, Y as MessageListJumpPillDismiss, Z as MessageListJumpPillGroup, _a as MobileNavServerPopoverRow, _t as MessageQuotedPreviewAuthorDelegatedByProps, aa as MobileNavServerPopover, ac as DialogSheetBackProps, ba as MobileNavServerPopoverRowDescription, bc as DataAttributes, ca as MobileNavServerPopoverDestination, ci as AvatarGroupButton, da as MobileNavServerPopoverDestinationsProps, dn as MessageReferenceReadMarkProps, dr as MessageItemDelegatedBy, fa as MobileNavServerPopoverGroup, fr as MessageItemDelegatedByButton, ga as MobileNavServerPopoverProps, gr as MessageItemDelegatedByProps, gt as MessageQuotedPreviewAuthorDelegatedBy, ha as MobileNavServerPopoverListProps, hc as ButtonProps, hr as MessageItemDelegatedByNameProps, ia as MobileNavServerItemProps, ic as DialogSheetBack, ji as PreviewCardFooterProps, ki as PreviewCardEyebrowProps, la as MobileNavServerPopoverDestinationProps, lc as DialogTitleProps, li as AvatarGroupButtonProps, lr as MessageItemDelegatedAvatar, ma as MobileNavServerPopoverList, mr as MessageItemDelegatedByName, nn as MessageReferenceIcon, oa as MobileNavServerPopoverContent, pa as MobileNavServerPopoverGroupProps, pr as MessageItemDelegatedByButtonProps, q as MessageListJumpControlsProps, qs as DialogFooterNoteProps, ra as MobileNavServerItem, rn as MessageReferenceIconProps, sa as MobileNavServerPopoverContentProps, u as InboxItemDensity, ua as MobileNavServerPopoverDestinations, uc as DialogTrigger, un as MessageReferenceReadMark, ur as MessageItemDelegatedAvatarProps, va as MobileNavServerPopoverRowBody, vi as PreviewCardActions, wa as MobileNavServerPopoverRowProps, wo as DropdownMenuLinkItem, xa as MobileNavServerPopoverRowDescriptionProps, xc as StyledProps, ya as MobileNavServerPopoverRowBodyProps, yc as VariantProps, yi as PreviewCardActionsProps, ys as ListRowProps, z as DragAnnouncementSource, zs as DialogClose } from "./inbox-item-B4nNvpp1.mjs";
|
|
2
2
|
import { CSSProperties, ComponentProps, ComponentPropsWithRef, ReactNode, RefObject } from "react";
|
|
3
3
|
import { Button } from "@base-ui/react/button";
|
|
4
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
@@ -822,7 +822,8 @@ type InboxItemSkeletonListProps = useRender.ComponentProps<"div"> & InboxItemSke
|
|
|
822
822
|
/**
|
|
823
823
|
* The list of `InboxItemSkeleton` rows that stands in for a list of
|
|
824
824
|
* `InboxItem` rows while it loads, with nothing between or around the rows
|
|
825
|
-
* that the loaded list doesn't have (no
|
|
825
|
+
* that the loaded list doesn't have (no border, no card): only the list's
|
|
826
|
+
* 2px gap, which the loaded list has too (design/patterns/lists.md). Renders
|
|
826
827
|
* `count` rows of the given shape, or its children, once `delay` (1 second by
|
|
827
828
|
* default) has passed. It isn't `aria-busy` itself: it goes away when the
|
|
828
829
|
* content arrives, so mark the region that stays, such as the list's panel or
|
|
@@ -852,12 +853,8 @@ export declare function ListRowSkeleton({ variant, leading, description, classNa
|
|
|
852
853
|
//#endregion
|
|
853
854
|
//#region src/components/meter/meter.d.ts
|
|
854
855
|
declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
low: {
|
|
858
|
-
root: string[];
|
|
859
|
-
};
|
|
860
|
-
empty: {
|
|
856
|
+
warning: {
|
|
857
|
+
true: {
|
|
861
858
|
root: string[];
|
|
862
859
|
};
|
|
863
860
|
};
|
|
@@ -873,12 +870,8 @@ declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
|
873
870
|
track: string[];
|
|
874
871
|
indicator: string[];
|
|
875
872
|
}, undefined, {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
low: {
|
|
879
|
-
root: string[];
|
|
880
|
-
};
|
|
881
|
-
empty: {
|
|
873
|
+
warning: {
|
|
874
|
+
true: {
|
|
882
875
|
root: string[];
|
|
883
876
|
};
|
|
884
877
|
};
|
|
@@ -894,12 +887,8 @@ declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
|
894
887
|
track: string[];
|
|
895
888
|
indicator: string[];
|
|
896
889
|
}, import("tailwind-variants/lite").TVReturnTypeLike<{
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
low: {
|
|
900
|
-
root: string[];
|
|
901
|
-
};
|
|
902
|
-
empty: {
|
|
890
|
+
warning: {
|
|
891
|
+
true: {
|
|
903
892
|
root: string[];
|
|
904
893
|
};
|
|
905
894
|
};
|
|
@@ -918,7 +907,7 @@ declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
|
918
907
|
type MeterProps = Omit<StyledProps<Meter$1.Root.Props>, "value" | "min" | "max" | "aria-valuetext" | "getAriaValueText" | "format" | "locale"> & Pick<VariantProps<typeof meter>, "size"> & {
|
|
919
908
|
/**
|
|
920
909
|
* How much of the allowance is used, as the provider reports it, from 0 to
|
|
921
|
-
* `max`. The
|
|
910
|
+
* `max`. The bar fills with it, and it is the meter's `aria-valuenow`.
|
|
922
911
|
*/
|
|
923
912
|
used: number;
|
|
924
913
|
/**
|
|
@@ -927,25 +916,31 @@ type MeterProps = Omit<StyledProps<Meter$1.Root.Props>, "value" | "min" | "max"
|
|
|
927
916
|
*/
|
|
928
917
|
max?: number;
|
|
929
918
|
/**
|
|
930
|
-
*
|
|
931
|
-
* warning color
|
|
932
|
-
*
|
|
933
|
-
|
|
919
|
+
* The share of `max` used, from 0 to 1, at which the meter takes the
|
|
920
|
+
* warning color: at or above it. Clamped to 0 to 1.
|
|
921
|
+
* @default 0.8
|
|
922
|
+
*/
|
|
923
|
+
warnAt?: number;
|
|
924
|
+
/**
|
|
925
|
+
* @deprecated Use `warnAt`, the share used: `low={20}` of 100 is
|
|
926
|
+
* `warnAt={0.8}`. The amount left, in the units of `max`, at or below
|
|
927
|
+
* which the meter warns. Ignored when `warnAt` is set.
|
|
934
928
|
*/
|
|
935
929
|
low?: number;
|
|
936
930
|
/**
|
|
937
|
-
* What is
|
|
938
|
-
* and it is the meter's `aria-valuetext`, so the
|
|
931
|
+
* What is used, in words, with the word: "62% used · resets in 3h".
|
|
932
|
+
* `MeterValue` shows it, and it is the meter's `aria-valuetext`, so the
|
|
933
|
+
* caller writes it once.
|
|
939
934
|
*/
|
|
940
935
|
valueText: string;
|
|
941
936
|
};
|
|
942
937
|
/**
|
|
943
|
-
* How much of an allowance is
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
*
|
|
938
|
+
* How much of an allowance is used, such as a usage limit that resets. The bar
|
|
939
|
+
* fills as it is used: the info fill, like Progress, until `warnAt` of `max`
|
|
940
|
+
* is used (80% unless set), then the warning color, and a full warning bar
|
|
941
|
+
* when used up; never danger, and no success color.
|
|
947
942
|
*/
|
|
948
|
-
export declare function Meter({ size, used, max, low, valueText, className, ...props }: MeterProps): import("react").JSX.Element;
|
|
943
|
+
export declare function Meter({ size, used, max, warnAt, low, valueText, className, ...props }: MeterProps): import("react").JSX.Element;
|
|
949
944
|
type MeterHeaderProps = ComponentPropsWithRef<"div">;
|
|
950
945
|
export declare function MeterHeader({ className, ...props }: MeterHeaderProps): import("react").JSX.Element;
|
|
951
946
|
type MeterLabelProps = StyledProps<Meter$1.Label.Props>;
|
package/dist/wip.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn } from "./cn.mjs";
|
|
2
|
-
import { $ as MessageListJumpPillGroup, $n as PreviewCardActions, A as useDragSensors, Aa as
|
|
2
|
+
import { $ as MessageListJumpPillGroup, $n as PreviewCardActions, A as useDragSensors, Aa as OverlayLayerProvider, Ai as Checkbox, B as keepGrabInside, Bi as ListRowMeta, Bn as RadioGroup, Br as MouseOnlyPointerSensor, C as DragRefusalHint, Cr as MobileNavServerPopoverRowLabel, D as MOUSE_DRAG_DISTANCE_PX, E as DragRemeasure, Ea as Button$1, F as DRAG_SIBLING_TRANSITION, Fi as ListRowBottom, G as DEFAULT_DRAG_MESSAGES, Gn as InputGroupAddon, Gr as useMouseOnlyPointerSensor, Hi as ListRowTop, Hn as RadioGroupItem, Hr as TOUCH_DRAG_HOLD_MS, I as DROP_GLIDE, Ia as tv, J as dragInstructions, Ji as TooltipContent, Jn as measureContent, K as SILENT_DRAG_ANNOUNCEMENTS, Kn as InputGroupInput, L as DragLift, Li as ListRowDescription, Ln as AvatarGroupButton, Lt as MessageReferenceReadMark, M as DRAG_KEYBOARD_OFFSET_PX, N as DRAG_LIFT_Z_INDEX, Na as useThemeScopeProps, Ni as ListRow, Nt as MessageReferenceIcon, O as listKeyboardCoordinates, Oa as Spinner, Or as PopoverBody, P as DRAG_SETTLE, Pa as useTheme, Pi as ListRowBody, Q as MessageListJumpPillDismiss, Qi as usePopupCollisionPadding, R as ORIGIN_OPACITY, S as Skeleton, Sa as TextLink, Sr as MobileNavServerPopoverRowDescription, T as DRAG_KEYBOARD_CODES, Tr as PopoverActions, U as LIFT_CLASS, Un as chipRemoveBase, Ur as TOUCH_DRAG_TOLERANCE_PX, V as useDragSiblingTransition, Vi as ListRowTitle, Vr as TOUCH_DRAG_DISTANCE_PX, Wn as InputGroup, Wr as useHoldThenMoveTouchSensor, X as MessageListJumpControls, Xn as observeTruncation, Y as dragMessages, Yn as measureElement, Z as MessageListJumpPill, Zi as TooltipTrigger, Zn as readNow, _ as InboxItemTrailing, _a as DialogTrigger, _r as MobileNavServerPopoverDestinations, a as InboxItemContext, aa as DialogClose, ar as PreviewCardFooter, b as useLatestRef, br as MobileNavServerPopoverRow, c as InboxItemLeading, dn as MessageItemDelegatedByButton, ea as DialogCommit, fn as MessageItemDelegatedByName, g as InboxItemTitle, ga as DialogTitle, gr as MobileNavServerPopoverDestination, h as InboxItemTimestamp, hr as MobileNavServerPopoverContent, i as InboxItemContent, ii as DropdownMenuLinkItem, ir as PreviewCardEyebrow, j as DRAG_AUTO_SCROLL_ZONE_PX, ja as useParentOverlayKind, k as useDragAcrossLists, ka as defaultNativeButton, la as DialogFooterNote, ln as MessageItemDelegatedAvatar, lt as MessageQuotedPreviewAuthorDelegatedBy, ma as DialogSheetBack, mr as MobileNavServerPopover, o as InboxItemHeading, oa as DialogContent, pr as MobileNavServerItem, q as createDragAnnouncements, qi as Tooltip, qn as useOverflowTitle, r as InboxItemBody, ra as Dialog, sr as PreviewCardMeta, t as InboxItem, ta as DialogSheetContent, tr as PreviewCardBody, un as MessageItemDelegatedBy, vr as MobileNavServerPopoverGroup, w as DropPlaceholder, x as hudTextAction, xr as MobileNavServerPopoverRowBody, y as inboxItem, yr as MobileNavServerPopoverList, z as cancelDrag, zr as HoldThenMoveTouchSensor } from "./inbox-item-DHJOrxB8.mjs";
|
|
3
3
|
import { Check, ChevronDown, LoaderCircle, Plus, Search, X } from "lucide-react";
|
|
4
4
|
import { createContext, use, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1867,7 +1867,7 @@ function InboxItemLeadingBadge({ className, render, ...props }) {
|
|
|
1867
1867
|
//#endregion
|
|
1868
1868
|
//#region src/components/inbox-item/inbox-item-skeleton.recipe.ts
|
|
1869
1869
|
const inboxItemSkeleton = tv({ slots: {
|
|
1870
|
-
list: ["flex min-w-0 flex-col"],
|
|
1870
|
+
list: ["flex min-w-0 flex-col gap-0.5"],
|
|
1871
1871
|
row: [
|
|
1872
1872
|
"[--inbox-item-skeleton-context:5rem] [--inbox-item-skeleton-title:60%] [--inbox-item-skeleton-body:80%]",
|
|
1873
1873
|
"nth-[3n+2]:[--inbox-item-skeleton-context:4rem] nth-[3n+2]:[--inbox-item-skeleton-title:45%] nth-[3n+2]:[--inbox-item-skeleton-body:70%]",
|
|
@@ -1927,7 +1927,8 @@ function InboxItemSkeleton({ density, leading = false, context = false, ...props
|
|
|
1927
1927
|
/**
|
|
1928
1928
|
* The list of `InboxItemSkeleton` rows that stands in for a list of
|
|
1929
1929
|
* `InboxItem` rows while it loads, with nothing between or around the rows
|
|
1930
|
-
* that the loaded list doesn't have (no
|
|
1930
|
+
* that the loaded list doesn't have (no border, no card): only the list's
|
|
1931
|
+
* 2px gap, which the loaded list has too (design/patterns/lists.md). Renders
|
|
1931
1932
|
* `count` rows of the given shape, or its children, once `delay` (1 second by
|
|
1932
1933
|
* default) has passed. It isn't `aria-busy` itself: it goes away when the
|
|
1933
1934
|
* content arrives, so mark the region that stays, such as the list's panel or
|
|
@@ -2007,8 +2008,6 @@ const meter = tv({
|
|
|
2007
2008
|
root: [
|
|
2008
2009
|
"group/meter grid w-full min-w-0 gap-1.5",
|
|
2009
2010
|
"[--meter-indicator:var(--info)]",
|
|
2010
|
-
"[--meter-track:var(--fill-muted)]",
|
|
2011
|
-
"[--meter-track-edge:transparent]",
|
|
2012
2011
|
"[--meter-value:var(--foreground-muted)]",
|
|
2013
2012
|
"font-sans"
|
|
2014
2013
|
],
|
|
@@ -2016,8 +2015,7 @@ const meter = tv({
|
|
|
2016
2015
|
label: ["min-w-0 truncate", "text-footnote font-semibold text-foreground"],
|
|
2017
2016
|
value: ["shrink-0 text-right tabular-nums", "text-footnote text-(--meter-value)"],
|
|
2018
2017
|
track: [
|
|
2019
|
-
"relative w-full overflow-hidden bg-(--
|
|
2020
|
-
"inset-ring-1 inset-ring-(--meter-track-edge)",
|
|
2018
|
+
"relative w-full overflow-hidden bg-(--fill-muted)",
|
|
2021
2019
|
"h-2 group-data-[size=sm]/meter:h-1.5",
|
|
2022
2020
|
"rounded-sticker"
|
|
2023
2021
|
],
|
|
@@ -2028,22 +2026,14 @@ const meter = tv({
|
|
|
2028
2026
|
]
|
|
2029
2027
|
},
|
|
2030
2028
|
variants: {
|
|
2031
|
-
|
|
2032
|
-
plenty: {},
|
|
2033
|
-
low: { root: ["[--meter-indicator:var(--warning)]", "[--meter-value:var(--warning-strong)]"] },
|
|
2034
|
-
empty: { root: [
|
|
2035
|
-
"[--meter-track:var(--warning-muted)]",
|
|
2036
|
-
"[--meter-track-edge:var(--warning)]",
|
|
2037
|
-
"[--meter-value:var(--warning-strong)]"
|
|
2038
|
-
] }
|
|
2039
|
-
},
|
|
2029
|
+
warning: { true: { root: ["[--meter-indicator:var(--warning)]", "[--meter-value:var(--warning-strong)]"] } },
|
|
2040
2030
|
size: {
|
|
2041
2031
|
sm: {},
|
|
2042
2032
|
md: {}
|
|
2043
2033
|
}
|
|
2044
2034
|
},
|
|
2045
2035
|
defaultVariants: {
|
|
2046
|
-
|
|
2036
|
+
warning: false,
|
|
2047
2037
|
size: "md"
|
|
2048
2038
|
}
|
|
2049
2039
|
});
|
|
@@ -2052,18 +2042,19 @@ function clamp(value, min, max) {
|
|
|
2052
2042
|
return Math.min(max, Math.max(min, Number.isNaN(value) ? min : value));
|
|
2053
2043
|
}
|
|
2054
2044
|
/**
|
|
2055
|
-
* How much of an allowance is
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2045
|
+
* How much of an allowance is used, such as a usage limit that resets. The bar
|
|
2046
|
+
* fills as it is used: the info fill, like Progress, until `warnAt` of `max`
|
|
2047
|
+
* is used (80% unless set), then the warning color, and a full warning bar
|
|
2048
|
+
* when used up; never danger, and no success color.
|
|
2059
2049
|
*/
|
|
2060
|
-
function Meter({ size = "md", used, max = 100, low, valueText, className, ...props }) {
|
|
2061
|
-
const
|
|
2062
|
-
const
|
|
2063
|
-
const
|
|
2050
|
+
function Meter({ size = "md", used, max = 100, warnAt, low, valueText, className, ...props }) {
|
|
2051
|
+
const value = clamp(used, 0, max);
|
|
2052
|
+
const share = max > 0 ? value / max : 1;
|
|
2053
|
+
const warnFrom = warnAt !== void 0 ? clamp(warnAt, 0, 1) : low !== void 0 && max > 0 ? 1 - clamp(low, 0, max) / max : .8;
|
|
2054
|
+
const level = share >= 1 ? "full" : share >= warnFrom ? "high" : "normal";
|
|
2064
2055
|
const { root } = meter({
|
|
2065
2056
|
size,
|
|
2066
|
-
level
|
|
2057
|
+
warning: level !== "normal"
|
|
2067
2058
|
});
|
|
2068
2059
|
return /* @__PURE__ */ jsx(MeterTextContext.Provider, {
|
|
2069
2060
|
value: valueText,
|
|
@@ -2073,7 +2064,7 @@ function Meter({ size = "md", used, max = 100, low, valueText, className, ...pro
|
|
|
2073
2064
|
"data-level": level,
|
|
2074
2065
|
min: 0,
|
|
2075
2066
|
max,
|
|
2076
|
-
value
|
|
2067
|
+
value,
|
|
2077
2068
|
"aria-valuetext": valueText,
|
|
2078
2069
|
className: root({ className }),
|
|
2079
2070
|
...props
|