@hilum/ui 3.4.0 → 3.5.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 +4 -0
- package/dist/{chunk-MAHPAP65.js → chunk-RI6QJR2L.js} +6 -3
- package/dist/chunk-RI6QJR2L.js.map +1 -0
- package/dist/index.d.ts +789 -115
- package/dist/index.js +10404 -1099
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +17 -0
- package/dist/tokens.d.ts +3 -0
- package/dist/tokens.js +1 -1
- package/llms.txt +18 -4
- package/package.json +19 -1
- package/src/components/accordion.tsx +746 -58
- package/src/components/alert-dialog.tsx +11 -5
- package/src/components/ask-user-questions.tsx +1366 -0
- package/src/components/badge.tsx +105 -24
- package/src/components/button.tsx +207 -38
- package/src/components/card.tsx +3 -2
- package/src/components/chat-message.tsx +116 -0
- package/src/components/checkbox-group.tsx +403 -0
- package/src/components/checkbox.tsx +6 -3
- package/src/components/color-input.tsx +3 -1
- package/src/components/color-picker.tsx +1992 -80
- package/src/components/dialog.tsx +141 -81
- package/src/components/dropdown-menu.tsx +21 -13
- package/src/components/dropdown.tsx +245 -0
- package/src/components/file-thumbnail.tsx +156 -0
- package/src/components/hover-card.tsx +2 -0
- package/src/components/input-copy.tsx +307 -0
- package/src/components/input-group.tsx +303 -108
- package/src/components/input-message.tsx +883 -0
- package/src/components/input.tsx +6 -3
- package/src/components/menu-item.tsx +156 -0
- package/src/components/mobile-drawer.tsx +50 -0
- package/src/components/nav-item.tsx +43 -0
- package/src/components/nav-menu.tsx +47 -0
- package/src/components/popover.tsx +3 -1
- package/src/components/radio-group.tsx +381 -35
- package/src/components/scroll-area.tsx +9 -2
- package/src/components/select.tsx +708 -121
- package/src/components/sheet.tsx +15 -6
- package/src/components/slider.tsx +1583 -20
- package/src/components/status-badge.tsx +2 -0
- package/src/components/switch.tsx +245 -28
- package/src/components/table.tsx +191 -77
- package/src/components/tabs-subtle.tsx +411 -0
- package/src/components/tabs.tsx +459 -49
- package/src/components/textarea.tsx +7 -3
- package/src/components/thinking-indicator.tsx +106 -0
- package/src/components/thinking-steps.tsx +382 -0
- package/src/components/tooltip.tsx +158 -33
- package/src/hooks/use-merge-split.tsx +359 -0
- package/src/hooks/use-proximity-hover.ts +208 -0
- package/src/index.ts +14 -0
- package/src/lib/elevated.tsx +52 -0
- package/src/lib/font-weight.ts +18 -0
- package/src/lib/icon-context.tsx +98 -0
- package/src/lib/icon-map.tsx +669 -0
- package/src/lib/interaction.ts +102 -0
- package/src/lib/scroll-fade.tsx +241 -0
- package/src/lib/shape-context.tsx +121 -0
- package/src/lib/springs.ts +30 -0
- package/src/lib/surface-classes.ts +43 -0
- package/src/lib/surface-context.tsx +17 -0
- package/src/tokens/tokens.ts +3 -0
- package/dist/chunk-MAHPAP65.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Inter (variable) weight tokens for `fontVariationSettings`.
|
|
2
|
+
//
|
|
3
|
+
// Each weight is paired with an optical-size (`opsz`) value so that animating
|
|
4
|
+
// between weights keeps the text's advance width nearly constant: a heavier
|
|
5
|
+
// `wght` widens the text, and a tighter (higher) `opsz` pulls it back. The
|
|
6
|
+
// opsz values below were measured against the 400/opsz-14 baseline and hold
|
|
7
|
+
// the closed→bold width delta to within ~0.6px (≈±0.5%), centered on zero,
|
|
8
|
+
// down from ~3px with no compensation. A single opsz value can't zero every
|
|
9
|
+
// string (glyph mixes scale differently), so a sub-pixel residual remains.
|
|
10
|
+
//
|
|
11
|
+
// Setting `opsz` explicitly here overrides `font-optical-sizing: auto`, which
|
|
12
|
+
// is intended — we want weight, not font-size, to drive optical size.
|
|
13
|
+
export const fontWeights = {
|
|
14
|
+
normal: "'wght' 400, 'opsz' 14",
|
|
15
|
+
medium: "'wght' 450, 'opsz' 15",
|
|
16
|
+
semibold: "'wght' 550, 'opsz' 20",
|
|
17
|
+
bold: "'wght' 700, 'opsz' 25",
|
|
18
|
+
} as const;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useState,
|
|
7
|
+
useCallback,
|
|
8
|
+
useEffect,
|
|
9
|
+
useMemo,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
} from "react";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
iconMap,
|
|
15
|
+
iconLibraryOrder,
|
|
16
|
+
type IconLibrary,
|
|
17
|
+
type IconName,
|
|
18
|
+
type IconComponent,
|
|
19
|
+
} from "./icon-map";
|
|
20
|
+
|
|
21
|
+
// Re-export types for consumers
|
|
22
|
+
export type { IconComponent, IconName, IconLibrary } from "./icon-map";
|
|
23
|
+
export { iconLibraryOrder, iconLibraryLabels } from "./icon-map";
|
|
24
|
+
|
|
25
|
+
interface IconContextValue {
|
|
26
|
+
iconLibrary: IconLibrary;
|
|
27
|
+
setIconLibrary: (lib: IconLibrary) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const IconContext = createContext<IconContextValue | null>(null);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the current icon library and setter.
|
|
34
|
+
* Throws if used outside IconProvider.
|
|
35
|
+
*/
|
|
36
|
+
function useIconLibrary() {
|
|
37
|
+
const ctx = useContext(IconContext);
|
|
38
|
+
if (!ctx) throw new Error("useIconLibrary must be used within an IconProvider");
|
|
39
|
+
return ctx;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns a single icon component for the given name.
|
|
44
|
+
* Falls back to Lucide if no provider is present.
|
|
45
|
+
*/
|
|
46
|
+
function useIcon(name: IconName): IconComponent {
|
|
47
|
+
const ctx = useContext(IconContext);
|
|
48
|
+
if (!ctx) return iconMap.lucide[name];
|
|
49
|
+
return iconMap[ctx.iconLibrary][name];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the full icon map for the current library.
|
|
54
|
+
* Falls back to Lucide if no provider is present.
|
|
55
|
+
*/
|
|
56
|
+
function useIcons(): Record<IconName, IconComponent> {
|
|
57
|
+
const ctx = useContext(IconContext);
|
|
58
|
+
const lib = ctx?.iconLibrary ?? "lucide";
|
|
59
|
+
return useMemo(() => iconMap[lib], [lib]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function IconProvider({
|
|
63
|
+
children,
|
|
64
|
+
defaultLibrary = "lucide",
|
|
65
|
+
}: {
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
defaultLibrary?: IconLibrary;
|
|
68
|
+
}) {
|
|
69
|
+
const [iconLibrary, setIconLibraryState] = useState<IconLibrary>(defaultLibrary);
|
|
70
|
+
|
|
71
|
+
const setIconLibrary = useCallback((next: IconLibrary) => {
|
|
72
|
+
setIconLibraryState(next);
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
// Global keyboard shortcut: I to cycle icon library
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
78
|
+
if (e.key !== "i" && e.key !== "I") return;
|
|
79
|
+
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
80
|
+
const tag = (e.target as HTMLElement)?.tagName;
|
|
81
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || (e.target as HTMLElement)?.isContentEditable)
|
|
82
|
+
return;
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
setIconLibraryState((prev) => {
|
|
85
|
+
const idx = iconLibraryOrder.indexOf(prev);
|
|
86
|
+
return iconLibraryOrder[(idx + 1) % iconLibraryOrder.length];
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
document.addEventListener("keydown", onKeyDown);
|
|
90
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
91
|
+
}, []);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<IconContext.Provider value={{ iconLibrary, setIconLibrary }}>{children}</IconContext.Provider>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { IconProvider, useIcon, useIcons, useIconLibrary };
|