hazo_ui 6.8.0 → 6.9.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/CHANGE_LOG.md +44 -0
- package/dist/index.cjs +83 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +81 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGE_LOG.md
CHANGED
|
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## v6.9.0 (2026-08-06)
|
|
9
|
+
|
|
10
|
+
### Added — `Badge`, `StatusBadge`, `makeStatusBadge`
|
|
11
|
+
|
|
12
|
+
A generic, token-backed pill component plus a status-mapping layer built on
|
|
13
|
+
top of it:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Badge, StatusBadge, makeStatusBadge } from "hazo_ui";
|
|
17
|
+
|
|
18
|
+
<Badge tone="success" dot>Active</Badge>
|
|
19
|
+
|
|
20
|
+
<StatusBadge
|
|
21
|
+
status={order.status}
|
|
22
|
+
statusMap={{
|
|
23
|
+
pending: { label: "Pending", tone: "warning", dot: true, pulse: true },
|
|
24
|
+
shipped: { label: "Shipped", tone: "info" },
|
|
25
|
+
done: { label: "Done", tone: "success" },
|
|
26
|
+
}}
|
|
27
|
+
fallback={{ label: "Unknown", tone: "neutral" }}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
// Pre-bind a statusMap once per status enum:
|
|
31
|
+
const OrderStatusBadge = makeStatusBadge<OrderStatus>(orderStatusMap);
|
|
32
|
+
<OrderStatusBadge status={order.status} />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`Badge` is a `cva`-driven soft-fill pill (`button.tsx`'s pattern) with 8
|
|
36
|
+
semantic `tone`s (`neutral`/`primary`/`secondary`/`accent`/`success`/
|
|
37
|
+
`warning`/`destructive`/`info`), all mapped to existing theme tokens — no
|
|
38
|
+
hardcoded hex. Optional `dot`/`pulse` render a leading status dot, colored via
|
|
39
|
+
a literal-string tone→class lookup (a templated `bg-${tone}` would compile to
|
|
40
|
+
zero CSS under Tailwind's JIT scanner). `className` passthrough via `cn()`
|
|
41
|
+
lets consumers override pill size or add mono/uppercase/border styling —
|
|
42
|
+
v1 deliberately has no solid/outline `variant` axis.
|
|
43
|
+
|
|
44
|
+
`StatusBadge<S extends string>` resolves `statusMap[status] ?? fallback ??
|
|
45
|
+
{ label: String(status), tone: "neutral" }` and renders a `Badge`.
|
|
46
|
+
`makeStatusBadge(statusMap, fallback?)` pre-binds the map so call sites don't
|
|
47
|
+
repeat it. Generalises kinstripe/seo_monitor's per-app inline status-pill
|
|
48
|
+
duplication. New exports: `Badge`, `StatusBadge`, `makeStatusBadge`,
|
|
49
|
+
`badgeVariants`, and types `BadgeProps`, `BadgeTone`, `StatusBadgeItem`,
|
|
50
|
+
`StatusBadgeProps`.
|
|
51
|
+
|
|
8
52
|
## v6.8.0 (2026-08-03)
|
|
9
53
|
|
|
10
54
|
### Added — text prefixes: `PrefixConfig.insert_as_text` + `CommandItem.insert_text`
|
package/dist/index.cjs
CHANGED
|
@@ -12537,6 +12537,86 @@ function useScrollRestore(treeId, viewName, options) {
|
|
|
12537
12537
|
const load = React27.useCallback(() => loadScrollPos(key), [key]);
|
|
12538
12538
|
return { save, load };
|
|
12539
12539
|
}
|
|
12540
|
+
var badgeVariants = classVarianceAuthority.cva(
|
|
12541
|
+
"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap select-none",
|
|
12542
|
+
{
|
|
12543
|
+
variants: {
|
|
12544
|
+
tone: {
|
|
12545
|
+
neutral: "bg-muted text-muted-foreground",
|
|
12546
|
+
primary: "bg-primary/10 text-primary",
|
|
12547
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
12548
|
+
accent: "bg-accent text-accent-foreground",
|
|
12549
|
+
success: "bg-success/15 text-success",
|
|
12550
|
+
warning: "bg-warning/15 text-warning",
|
|
12551
|
+
destructive: "bg-destructive/15 text-destructive",
|
|
12552
|
+
info: "bg-info/15 text-info"
|
|
12553
|
+
}
|
|
12554
|
+
},
|
|
12555
|
+
defaultVariants: {
|
|
12556
|
+
tone: "neutral"
|
|
12557
|
+
}
|
|
12558
|
+
}
|
|
12559
|
+
);
|
|
12560
|
+
var TONE_DOT_CLASS = {
|
|
12561
|
+
neutral: "bg-muted-foreground",
|
|
12562
|
+
primary: "bg-primary",
|
|
12563
|
+
secondary: "bg-secondary-foreground",
|
|
12564
|
+
accent: "bg-accent-foreground",
|
|
12565
|
+
success: "bg-success",
|
|
12566
|
+
warning: "bg-warning",
|
|
12567
|
+
destructive: "bg-destructive",
|
|
12568
|
+
info: "bg-info"
|
|
12569
|
+
};
|
|
12570
|
+
var Badge = React27__namespace.forwardRef(
|
|
12571
|
+
({ className, tone, dot = false, pulse = false, children, ...props }, ref) => {
|
|
12572
|
+
const resolvedTone = tone ?? "neutral";
|
|
12573
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12574
|
+
"span",
|
|
12575
|
+
{
|
|
12576
|
+
ref,
|
|
12577
|
+
className: cn(badgeVariants({ tone: resolvedTone }), className),
|
|
12578
|
+
...props,
|
|
12579
|
+
children: [
|
|
12580
|
+
dot && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12581
|
+
"span",
|
|
12582
|
+
{
|
|
12583
|
+
"aria-hidden": true,
|
|
12584
|
+
className: cn(
|
|
12585
|
+
"inline-block h-1.5 w-1.5 rounded-full",
|
|
12586
|
+
TONE_DOT_CLASS[resolvedTone],
|
|
12587
|
+
pulse && "animate-pulse"
|
|
12588
|
+
)
|
|
12589
|
+
}
|
|
12590
|
+
),
|
|
12591
|
+
children
|
|
12592
|
+
]
|
|
12593
|
+
}
|
|
12594
|
+
);
|
|
12595
|
+
}
|
|
12596
|
+
);
|
|
12597
|
+
Badge.displayName = "Badge";
|
|
12598
|
+
function StatusBadgeInner({ status, statusMap, fallback, className, ...rest }, ref) {
|
|
12599
|
+
const meta = statusMap[status] ?? fallback ?? { label: String(status), tone: "neutral" };
|
|
12600
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12601
|
+
Badge,
|
|
12602
|
+
{
|
|
12603
|
+
ref,
|
|
12604
|
+
tone: meta.tone,
|
|
12605
|
+
dot: meta.dot,
|
|
12606
|
+
pulse: meta.pulse,
|
|
12607
|
+
className,
|
|
12608
|
+
...rest,
|
|
12609
|
+
children: meta.label
|
|
12610
|
+
}
|
|
12611
|
+
);
|
|
12612
|
+
}
|
|
12613
|
+
StatusBadgeInner.displayName = "StatusBadge";
|
|
12614
|
+
var StatusBadge = React27__namespace.forwardRef(StatusBadgeInner);
|
|
12615
|
+
function makeStatusBadge(statusMap, fallback) {
|
|
12616
|
+
const Component = React27__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { ref, ...props, statusMap, fallback }));
|
|
12617
|
+
Component.displayName = "StatusBadge(bound)";
|
|
12618
|
+
return Component;
|
|
12619
|
+
}
|
|
12540
12620
|
|
|
12541
12621
|
Object.defineProperty(exports, "rawToast", {
|
|
12542
12622
|
enumerable: true,
|
|
@@ -12580,6 +12660,7 @@ exports.AlertDialogTitle = AlertDialogTitle;
|
|
|
12580
12660
|
exports.AlertDialogTrigger = AlertDialogTrigger;
|
|
12581
12661
|
exports.AppFooter = AppFooter;
|
|
12582
12662
|
exports.AppHeader = AppHeader;
|
|
12663
|
+
exports.Badge = Badge;
|
|
12583
12664
|
exports.Button = Button;
|
|
12584
12665
|
exports.ButtonGroup = ButtonGroup;
|
|
12585
12666
|
exports.ButtonGroupSeparator = ButtonGroupSeparator;
|
|
@@ -12712,6 +12793,7 @@ exports.Slider = Slider;
|
|
|
12712
12793
|
exports.Sparkline = Sparkline;
|
|
12713
12794
|
exports.Spinner = Spinner;
|
|
12714
12795
|
exports.StackedBars = StackedBars;
|
|
12796
|
+
exports.StatusBadge = StatusBadge;
|
|
12715
12797
|
exports.Switch = Switch;
|
|
12716
12798
|
exports.Table = Table2;
|
|
12717
12799
|
exports.TableBody = TableBody;
|
|
@@ -12748,6 +12830,7 @@ exports.get_hazo_ui_config = get_hazo_ui_config;
|
|
|
12748
12830
|
exports.get_logger = get_logger;
|
|
12749
12831
|
exports.hasUrlParam = hasUrlParam;
|
|
12750
12832
|
exports.isLucideValue = isLucideValue;
|
|
12833
|
+
exports.makeStatusBadge = makeStatusBadge;
|
|
12751
12834
|
exports.median = median;
|
|
12752
12835
|
exports.parse_commands_from_text = parse_commands_from_text;
|
|
12753
12836
|
exports.permissionToast = permissionToast;
|