@botiverse/raft-ui 0.49.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 +19 -0
- package/dist/wip.d.mts +24 -30
- package/dist/wip.mjs +14 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [0.50.0](https://github.com/botiverse/raft-design/compare/v0.49.0...v0.50.0) (2026-10-29)
|
|
2
|
+
|
|
3
|
+
### Design System
|
|
4
|
+
|
|
5
|
+
- **Usage shows what is used:** a Meter fills with what is used, not what is left, and its text always says it ("62% used · resets in 3h", never a bare "62%"). It turns `warning` from 80% used, the same point as 20% left before, so the same data keeps its colour; used up is a full `warning` bar with "Used up". A remaining amount can go in a tooltip ("378 GB free of 994 GB"). Decided on 2026-10-29 (stdrc). ([#879](https://github.com/botiverse/raft-design/pull/879))
|
|
6
|
+
- Docs: https://raft-design.botiverse.build/components/meter/
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **Meter `warnAt`:** the share used (0–1, default 0.8) from which it warns. ([#879](https://github.com/botiverse/raft-design/pull/879))
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Meter** draws `used` of `max`; `aria-valuenow` is `used`. `low` (amount left) is deprecated but still honoured: `low={n}` is `warnAt={1 - n / max}`. ([#879](https://github.com/botiverse/raft-design/pull/879))
|
|
15
|
+
|
|
16
|
+
### Breaking
|
|
17
|
+
|
|
18
|
+
- **Meter `data-level`** is `normal` / `high` / `full` (was `plenty` / `low` / `empty`). Update selectors and tests that read it. ([#879](https://github.com/botiverse/raft-design/pull/879))
|
|
19
|
+
|
|
1
20
|
## [0.49.0](https://github.com/botiverse/raft-design/compare/v0.48.0...v0.49.0) (2026-10-29)
|
|
2
21
|
|
|
3
22
|
### Design System
|
package/dist/wip.d.mts
CHANGED
|
@@ -853,12 +853,8 @@ export declare function ListRowSkeleton({ variant, leading, description, classNa
|
|
|
853
853
|
//#endregion
|
|
854
854
|
//#region src/components/meter/meter.d.ts
|
|
855
855
|
declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
low: {
|
|
859
|
-
root: string[];
|
|
860
|
-
};
|
|
861
|
-
empty: {
|
|
856
|
+
warning: {
|
|
857
|
+
true: {
|
|
862
858
|
root: string[];
|
|
863
859
|
};
|
|
864
860
|
};
|
|
@@ -874,12 +870,8 @@ declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
|
874
870
|
track: string[];
|
|
875
871
|
indicator: string[];
|
|
876
872
|
}, undefined, {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
low: {
|
|
880
|
-
root: string[];
|
|
881
|
-
};
|
|
882
|
-
empty: {
|
|
873
|
+
warning: {
|
|
874
|
+
true: {
|
|
883
875
|
root: string[];
|
|
884
876
|
};
|
|
885
877
|
};
|
|
@@ -895,12 +887,8 @@ declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
|
895
887
|
track: string[];
|
|
896
888
|
indicator: string[];
|
|
897
889
|
}, import("tailwind-variants/lite").TVReturnTypeLike<{
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
low: {
|
|
901
|
-
root: string[];
|
|
902
|
-
};
|
|
903
|
-
empty: {
|
|
890
|
+
warning: {
|
|
891
|
+
true: {
|
|
904
892
|
root: string[];
|
|
905
893
|
};
|
|
906
894
|
};
|
|
@@ -919,7 +907,7 @@ declare const meter: import("tailwind-variants/lite").TVReturnType<{
|
|
|
919
907
|
type MeterProps = Omit<StyledProps<Meter$1.Root.Props>, "value" | "min" | "max" | "aria-valuetext" | "getAriaValueText" | "format" | "locale"> & Pick<VariantProps<typeof meter>, "size"> & {
|
|
920
908
|
/**
|
|
921
909
|
* How much of the allowance is used, as the provider reports it, from 0 to
|
|
922
|
-
* `max`. The
|
|
910
|
+
* `max`. The bar fills with it, and it is the meter's `aria-valuenow`.
|
|
923
911
|
*/
|
|
924
912
|
used: number;
|
|
925
913
|
/**
|
|
@@ -928,25 +916,31 @@ type MeterProps = Omit<StyledProps<Meter$1.Root.Props>, "value" | "min" | "max"
|
|
|
928
916
|
*/
|
|
929
917
|
max?: number;
|
|
930
918
|
/**
|
|
931
|
-
*
|
|
932
|
-
* warning color
|
|
933
|
-
*
|
|
934
|
-
|
|
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.
|
|
935
928
|
*/
|
|
936
929
|
low?: number;
|
|
937
930
|
/**
|
|
938
|
-
* What is
|
|
939
|
-
* 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.
|
|
940
934
|
*/
|
|
941
935
|
valueText: string;
|
|
942
936
|
};
|
|
943
937
|
/**
|
|
944
|
-
* How much of an allowance is
|
|
945
|
-
*
|
|
946
|
-
*
|
|
947
|
-
*
|
|
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.
|
|
948
942
|
*/
|
|
949
|
-
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;
|
|
950
944
|
type MeterHeaderProps = ComponentPropsWithRef<"div">;
|
|
951
945
|
export declare function MeterHeader({ className, ...props }: MeterHeaderProps): import("react").JSX.Element;
|
|
952
946
|
type MeterLabelProps = StyledProps<Meter$1.Label.Props>;
|
package/dist/wip.mjs
CHANGED
|
@@ -2008,8 +2008,6 @@ const meter = tv({
|
|
|
2008
2008
|
root: [
|
|
2009
2009
|
"group/meter grid w-full min-w-0 gap-1.5",
|
|
2010
2010
|
"[--meter-indicator:var(--info)]",
|
|
2011
|
-
"[--meter-track:var(--fill-muted)]",
|
|
2012
|
-
"[--meter-track-edge:transparent]",
|
|
2013
2011
|
"[--meter-value:var(--foreground-muted)]",
|
|
2014
2012
|
"font-sans"
|
|
2015
2013
|
],
|
|
@@ -2017,8 +2015,7 @@ const meter = tv({
|
|
|
2017
2015
|
label: ["min-w-0 truncate", "text-footnote font-semibold text-foreground"],
|
|
2018
2016
|
value: ["shrink-0 text-right tabular-nums", "text-footnote text-(--meter-value)"],
|
|
2019
2017
|
track: [
|
|
2020
|
-
"relative w-full overflow-hidden bg-(--
|
|
2021
|
-
"inset-ring-1 inset-ring-(--meter-track-edge)",
|
|
2018
|
+
"relative w-full overflow-hidden bg-(--fill-muted)",
|
|
2022
2019
|
"h-2 group-data-[size=sm]/meter:h-1.5",
|
|
2023
2020
|
"rounded-sticker"
|
|
2024
2021
|
],
|
|
@@ -2029,22 +2026,14 @@ const meter = tv({
|
|
|
2029
2026
|
]
|
|
2030
2027
|
},
|
|
2031
2028
|
variants: {
|
|
2032
|
-
|
|
2033
|
-
plenty: {},
|
|
2034
|
-
low: { root: ["[--meter-indicator:var(--warning)]", "[--meter-value:var(--warning-strong)]"] },
|
|
2035
|
-
empty: { root: [
|
|
2036
|
-
"[--meter-track:var(--warning-muted)]",
|
|
2037
|
-
"[--meter-track-edge:var(--warning)]",
|
|
2038
|
-
"[--meter-value:var(--warning-strong)]"
|
|
2039
|
-
] }
|
|
2040
|
-
},
|
|
2029
|
+
warning: { true: { root: ["[--meter-indicator:var(--warning)]", "[--meter-value:var(--warning-strong)]"] } },
|
|
2041
2030
|
size: {
|
|
2042
2031
|
sm: {},
|
|
2043
2032
|
md: {}
|
|
2044
2033
|
}
|
|
2045
2034
|
},
|
|
2046
2035
|
defaultVariants: {
|
|
2047
|
-
|
|
2036
|
+
warning: false,
|
|
2048
2037
|
size: "md"
|
|
2049
2038
|
}
|
|
2050
2039
|
});
|
|
@@ -2053,18 +2042,19 @@ function clamp(value, min, max) {
|
|
|
2053
2042
|
return Math.min(max, Math.max(min, Number.isNaN(value) ? min : value));
|
|
2054
2043
|
}
|
|
2055
2044
|
/**
|
|
2056
|
-
* How much of an allowance is
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
*
|
|
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.
|
|
2060
2049
|
*/
|
|
2061
|
-
function Meter({ size = "md", used, max = 100, low, valueText, className, ...props }) {
|
|
2062
|
-
const
|
|
2063
|
-
const
|
|
2064
|
-
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";
|
|
2065
2055
|
const { root } = meter({
|
|
2066
2056
|
size,
|
|
2067
|
-
level
|
|
2057
|
+
warning: level !== "normal"
|
|
2068
2058
|
});
|
|
2069
2059
|
return /* @__PURE__ */ jsx(MeterTextContext.Provider, {
|
|
2070
2060
|
value: valueText,
|
|
@@ -2074,7 +2064,7 @@ function Meter({ size = "md", used, max = 100, low, valueText, className, ...pro
|
|
|
2074
2064
|
"data-level": level,
|
|
2075
2065
|
min: 0,
|
|
2076
2066
|
max,
|
|
2077
|
-
value
|
|
2067
|
+
value,
|
|
2078
2068
|
"aria-valuetext": valueText,
|
|
2079
2069
|
className: root({ className }),
|
|
2080
2070
|
...props
|