@vuer-ai/vuer-uikit 0.0.96 → 0.0.98
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 +106 -7
- package/cli/dial-cli.js +49 -7
- package/dist/SyncScroll/SyncScroll.cjs +10 -10
- package/dist/SyncScroll/SyncScroll.mjs +3 -3
- package/dist/SyncScroll/index.cjs +10 -10
- package/dist/SyncScroll/index.mjs +3 -3
- package/dist/chunk-3HEZVWRW.mjs +62 -0
- package/dist/chunk-4KWGGESI.cjs +494 -0
- package/dist/{chunk-CCMKL2OA.cjs → chunk-7GWDO25E.cjs} +2 -2
- package/dist/chunk-A5LCX2UQ.cjs +208 -0
- package/dist/chunk-BEJIZ56L.mjs +300 -0
- package/dist/chunk-C7VGRU3O.mjs +283 -0
- package/dist/{chunk-LONOMMFA.cjs → chunk-LJMNHTTG.cjs} +21 -21
- package/dist/chunk-O66RESRR.cjs +285 -0
- package/dist/{chunk-RINTUFYQ.cjs → chunk-RMK6W774.cjs} +24 -19
- package/dist/{chunk-BFQ2WL5U.mjs → chunk-TTYSYGVE.mjs} +2 -2
- package/dist/chunk-VA3PEYFM.mjs +489 -0
- package/dist/chunk-VBBJSIY7.cjs +308 -0
- package/dist/{chunk-AIINOWEH.mjs → chunk-W4JCKCW7.mjs} +5 -5
- package/dist/chunk-WWGF6TBZ.mjs +206 -0
- package/dist/chunk-ZGN4UEJR.cjs +679 -0
- package/dist/chunk-ZQLRMOUW.mjs +661 -0
- package/dist/dial/DialPanel.cjs +24 -24
- package/dist/dial/DialPanel.mjs +23 -23
- package/dist/dial/DialProvider.cjs +3 -3
- package/dist/dial/DialProvider.d.cts +1 -0
- package/dist/dial/DialProvider.d.ts +1 -0
- package/dist/dial/DialProvider.example.cjs +72 -0
- package/dist/dial/DialProvider.example.d.cts +7 -0
- package/dist/dial/DialProvider.example.d.ts +7 -0
- package/dist/dial/DialProvider.example.mjs +68 -0
- package/dist/dial/DialProvider.mjs +1 -1
- package/dist/dial/index.cjs +42 -42
- package/dist/dial/index.mjs +23 -23
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +27 -27
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +23 -23
- package/dist/dial/wrapped-inputs/DialInputs.cjs +34 -34
- package/dist/dial/wrapped-inputs/DialInputs.mjs +23 -23
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +24 -24
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +23 -23
- package/dist/dial/wrapped-inputs/index.cjs +39 -39
- package/dist/dial/wrapped-inputs/index.mjs +23 -23
- package/dist/highlight-cursor/cursor-provider.cjs +3 -3
- package/dist/highlight-cursor/cursor-provider.mjs +2 -2
- package/dist/highlight-cursor/enhanced-components.cjs +10 -10
- package/dist/highlight-cursor/enhanced-components.mjs +5 -5
- package/dist/highlight-cursor/index.cjs +16 -16
- package/dist/highlight-cursor/index.mjs +6 -6
- package/dist/hooks/index.cjs +5 -5
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.cjs +190 -190
- package/dist/index.mjs +23 -23
- package/dist/ui/UIKitBadge.cjs +6 -6
- package/dist/ui/UIKitBadge.mjs +2 -2
- package/dist/ui/avatar.cjs +1 -1
- package/dist/ui/avatar.mjs +1 -1
- package/dist/ui/badge.cjs +1 -1
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.mjs +1 -1
- package/dist/ui/button.cjs +1 -1
- package/dist/ui/button.mjs +1 -1
- package/dist/ui/card.cjs +1 -1
- package/dist/ui/card.mjs +1 -1
- package/dist/ui/checkbox.cjs +1 -1
- package/dist/ui/checkbox.mjs +1 -1
- package/dist/ui/collapsible.cjs +1 -1
- package/dist/ui/collapsible.mjs +1 -1
- package/dist/ui/drawer.cjs +1 -1
- package/dist/ui/drawer.mjs +1 -1
- package/dist/ui/dropdown.cjs +1 -1
- package/dist/ui/dropdown.mjs +1 -1
- package/dist/ui/index.cjs +107 -107
- package/dist/ui/index.mjs +17 -17
- package/dist/ui/inputs/color-input.cjs +1 -1
- package/dist/ui/inputs/color-input.mjs +1 -1
- package/dist/ui/inputs/index.cjs +11 -11
- package/dist/ui/inputs/index.mjs +3 -3
- package/dist/ui/inputs/input-numbers.cjs +1 -1
- package/dist/ui/inputs/input-numbers.mjs +1 -1
- package/dist/ui/inputs/input.cjs +1 -1
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/inputs/input.mjs +1 -1
- package/dist/ui/inputs/number-inputs/CmInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/CmInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/DegInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/DegInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerDegInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerDegInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerRadInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerRadInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/InchInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/InchInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/IntInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/IntInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/KVectorInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/KVectorInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/QuaternionInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/QuaternionInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/RadInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/RadInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/TimeInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/TimeInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/Vec3Input.cjs +1 -1
- package/dist/ui/inputs/number-inputs/Vec3Input.mjs +1 -1
- package/dist/ui/inputs/number-inputs/VectorInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/VectorInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/index.cjs +11 -11
- package/dist/ui/inputs/number-inputs/index.mjs +3 -3
- package/dist/ui/inputs/presets-input.cjs +1 -1
- package/dist/ui/inputs/presets-input.mjs +1 -1
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.mjs +1 -1
- package/dist/ui/layout.cjs +1 -1
- package/dist/ui/layout.mjs +1 -1
- package/dist/ui/layouts/dock-layout/DockLayoutView.cjs +1 -1
- package/dist/ui/layouts/dock-layout/DockLayoutView.mjs +1 -1
- package/dist/ui/layouts/dock-layout/LayoutSlots.cjs +1 -1
- package/dist/ui/layouts/dock-layout/LayoutSlots.mjs +1 -1
- package/dist/ui/layouts/dock-layout/index.cjs +1 -1
- package/dist/ui/layouts/dock-layout/index.mjs +1 -1
- package/dist/ui/layouts/index.cjs +2 -2
- package/dist/ui/layouts/index.mjs +2 -2
- package/dist/ui/layouts/liquid-layout/LayoutSlots.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/LayoutSlots.mjs +1 -1
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.mjs +1 -1
- package/dist/ui/layouts/liquid-layout/index.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/index.mjs +1 -1
- package/dist/ui/modal.cjs +1 -1
- package/dist/ui/modal.mjs +1 -1
- package/dist/ui/navigation.cjs +1 -1
- package/dist/ui/navigation.mjs +1 -1
- package/dist/ui/pagination.cjs +1 -1
- package/dist/ui/pagination.mjs +1 -1
- package/dist/ui/panel.cjs +1 -1
- package/dist/ui/panel.mjs +1 -1
- package/dist/ui/popover.cjs +1 -1
- package/dist/ui/popover.mjs +1 -1
- package/dist/ui/radio-group.cjs +1 -1
- package/dist/ui/radio-group.mjs +1 -1
- package/dist/ui/resizable.cjs +1 -1
- package/dist/ui/resizable.mjs +1 -1
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/select.mjs +1 -1
- package/dist/ui/separator.cjs +1 -1
- package/dist/ui/separator.mjs +1 -1
- package/dist/ui/sheet.cjs +1 -1
- package/dist/ui/sheet.mjs +1 -1
- package/dist/ui/sidebar.cjs +26 -26
- package/dist/ui/sidebar.mjs +2 -2
- package/dist/ui/simple-tree-view.cjs +1 -1
- package/dist/ui/simple-tree-view.mjs +1 -1
- package/dist/ui/skeleton.cjs +1 -1
- package/dist/ui/skeleton.mjs +1 -1
- package/dist/ui/slider.cjs +1 -1
- package/dist/ui/slider.mjs +1 -1
- package/dist/ui/switch.cjs +1 -1
- package/dist/ui/switch.mjs +1 -1
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.mjs +1 -1
- package/dist/ui/tabs.cjs +1 -1
- package/dist/ui/tabs.mjs +1 -1
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/textarea.mjs +1 -1
- package/dist/ui/theme/ThemeToggles.cjs +1 -1
- package/dist/ui/theme/ThemeToggles.mjs +1 -1
- package/dist/ui/theme/index.cjs +1 -1
- package/dist/ui/theme/index.mjs +1 -1
- package/dist/ui/toggle-buttons.cjs +1 -1
- package/dist/ui/toggle-buttons.mjs +1 -1
- package/dist/ui/toggle-group.cjs +1 -1
- package/dist/ui/toggle-group.mjs +1 -1
- package/dist/ui/toggle.cjs +1 -1
- package/dist/ui/toggle.mjs +1 -1
- package/dist/ui/toolbar.cjs +1 -1
- package/dist/ui/toolbar.mjs +1 -1
- package/dist/ui/tooltip.cjs +1 -1
- package/dist/ui/tooltip.mjs +1 -1
- package/dist/ui/tree-view/TreeSearchBar.cjs +1 -1
- package/dist/ui/tree-view/TreeSearchBar.mjs +1 -1
- package/dist/ui/tree-view/TreeView.cjs +1 -1
- package/dist/ui/tree-view/TreeView.mjs +1 -1
- package/dist/ui/tree-view/index.cjs +6 -6
- package/dist/ui/tree-view/index.mjs +2 -2
- package/dist/ui/tree-view-legacy.cjs +9 -9
- package/dist/ui/tree-view-legacy.mjs +5 -5
- package/dist/ui/waterfall/CursorOverlay.cjs +1 -1
- package/dist/ui/waterfall/CursorOverlay.mjs +1 -1
- package/dist/ui/waterfall/TimelineEvent.cjs +1 -1
- package/dist/ui/waterfall/TimelineEvent.mjs +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.cjs +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.mjs +1 -1
- package/dist/ui/waterfall/Wedges.cjs +1 -1
- package/dist/ui/waterfall/Wedges.mjs +1 -1
- package/dist/ui/waterfall/index.cjs +8 -8
- package/dist/ui/waterfall/index.mjs +7 -7
- package/package.json +28 -2
- package/src/SyncScroll/README.md +283 -0
- package/src/SyncScroll/SyncScroll.tsx +361 -0
- package/src/SyncScroll/index.ts +22 -0
- package/src/SyncScroll/useSyncScroll.tsx +226 -0
- package/src/cli/dial-cli.ts +1133 -0
- package/src/dial/DialPanel.tsx +208 -0
- package/src/dial/DialProvider.example.tsx +80 -0
- package/src/dial/DialProvider.tsx +138 -0
- package/src/dial/index.ts +26 -0
- package/src/dial/wrapped-inputs/ControlledInputs.tsx +176 -0
- package/src/dial/wrapped-inputs/DialInputs.tsx +401 -0
- package/src/dial/wrapped-inputs/DialVectorInput.tsx +125 -0
- package/src/dial/wrapped-inputs/index.ts +25 -0
- package/src/highlight-cursor/cursor-context.tsx +23 -0
- package/src/highlight-cursor/cursor-provider.tsx +264 -0
- package/src/highlight-cursor/enhanced-components.tsx +16 -0
- package/src/highlight-cursor/index.ts +21 -0
- package/src/highlight-cursor/tabs-cursor-context.tsx +121 -0
- package/src/highlight-cursor/types.ts +40 -0
- package/src/highlight-cursor/with-cursor.tsx +144 -0
- package/src/hooks/clientOnly.tsx +54 -0
- package/src/hooks/cn.ts +33 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useDocument.tsx +18 -0
- package/src/hooks/useDragSelect.ts +116 -0
- package/src/hooks/useIsMobile.ts +35 -0
- package/src/hooks/useLocalStorage.ts +122 -0
- package/src/hooks/useLocation.tsx +95 -0
- package/src/hooks/useQueryParams.tsx +31 -0
- package/src/hooks/useWindow.tsx +18 -0
- package/src/index.css +5 -0
- package/src/index.ts +5 -0
- package/src/styles/.editorconfig +0 -0
- package/src/styles/theme.css +152 -0
- package/src/styles/toast.css +67 -0
- package/src/styles/variables.css +229 -0
- package/src/ui/UIKitBadge.tsx +171 -0
- package/src/ui/avatar.tsx +221 -0
- package/src/ui/badge.tsx +74 -0
- package/src/ui/button.tsx +143 -0
- package/src/ui/card.tsx +146 -0
- package/src/ui/checkbox.tsx +78 -0
- package/src/ui/collapsible.tsx +43 -0
- package/src/ui/drag-selectable/DragSelectProvider.tsx +178 -0
- package/src/ui/drag-selectable/createSelectable.tsx +43 -0
- package/src/ui/drag-selectable/index.ts +2 -0
- package/src/ui/drawer.tsx +137 -0
- package/src/ui/dropdown.tsx +707 -0
- package/src/ui/icons/MouseCursorIcons.tsx +39 -0
- package/src/ui/icons/cursor.tsx +38 -0
- package/src/ui/icons/index.ts +2 -0
- package/src/ui/index.ts +45 -0
- package/src/ui/inputs/color-input.tsx +61 -0
- package/src/ui/inputs/index.tsx +5 -0
- package/src/ui/inputs/input-numbers.tsx +394 -0
- package/src/ui/inputs/input.tsx +155 -0
- package/src/ui/inputs/number-inputs/CmInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/DegInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/EulerDegInput.tsx +14 -0
- package/src/ui/inputs/number-inputs/EulerInput.tsx +30 -0
- package/src/ui/inputs/number-inputs/EulerRadInput.tsx +14 -0
- package/src/ui/inputs/number-inputs/InchInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/IntInput.tsx +46 -0
- package/src/ui/inputs/number-inputs/KVectorInput.tsx +20 -0
- package/src/ui/inputs/number-inputs/QuaternionInput.tsx +27 -0
- package/src/ui/inputs/number-inputs/RadInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/TimeInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/Vec3Input.tsx +26 -0
- package/src/ui/inputs/number-inputs/VectorInput.tsx +38 -0
- package/src/ui/inputs/number-inputs/index.ts +38 -0
- package/src/ui/inputs/presets-input.tsx +59 -0
- package/src/ui/label.tsx +35 -0
- package/src/ui/layout.tsx +43 -0
- package/src/ui/layouts/dock-layout/DockLayoutView.tsx +128 -0
- package/src/ui/layouts/dock-layout/LayoutSlots.tsx +85 -0
- package/src/ui/layouts/dock-layout/index.tsx +2 -0
- package/src/ui/layouts/index.ts +2 -0
- package/src/ui/layouts/liquid-layout/LayoutSlots.tsx +82 -0
- package/src/ui/layouts/liquid-layout/LiquidLayoutView.tsx +76 -0
- package/src/ui/layouts/liquid-layout/index.ts +1 -0
- package/src/ui/modal.tsx +211 -0
- package/src/ui/navigation.tsx +86 -0
- package/src/ui/pagination.tsx +129 -0
- package/src/ui/panel.tsx +146 -0
- package/src/ui/popover.tsx +112 -0
- package/src/ui/radio-group.tsx +63 -0
- package/src/ui/resizable.tsx +52 -0
- package/src/ui/select.tsx +365 -0
- package/src/ui/separator.tsx +26 -0
- package/src/ui/sheet.tsx +257 -0
- package/src/ui/sidebar.tsx +695 -0
- package/src/ui/simple-tree-view.tsx +604 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slider.tsx +204 -0
- package/src/ui/switch.tsx +45 -0
- package/src/ui/table.tsx +99 -0
- package/src/ui/tabs.tsx +192 -0
- package/src/ui/textarea.tsx +55 -0
- package/src/ui/theme/ThemeProvider.tsx +319 -0
- package/src/ui/theme/ThemeToggles.tsx +84 -0
- package/src/ui/theme/index.ts +21 -0
- package/src/ui/theme/themeScript.tsx +179 -0
- package/src/ui/theme/types.ts +61 -0
- package/src/ui/toast.tsx +30 -0
- package/src/ui/toggle-buttons.tsx +290 -0
- package/src/ui/toggle-group.tsx +236 -0
- package/src/ui/toggle.tsx +94 -0
- package/src/ui/toolbar.tsx +54 -0
- package/src/ui/tooltip.tsx +171 -0
- package/src/ui/tree-view/TreeSearchBar.tsx +88 -0
- package/src/ui/tree-view/TreeView.tsx +232 -0
- package/src/ui/tree-view/hooks.tsx +289 -0
- package/src/ui/tree-view/index.ts +4 -0
- package/src/ui/tree-view/types.ts +23 -0
- package/src/ui/tree-view-legacy.tsx +644 -0
- package/src/ui/version-badge.tsx +0 -0
- package/src/ui/waterfall/CursorOverlay.tsx +96 -0
- package/src/ui/waterfall/NavigationControls.tsx +42 -0
- package/src/ui/waterfall/Tick.tsx +51 -0
- package/src/ui/waterfall/TimeRuleEventDot.tsx +19 -0
- package/src/ui/waterfall/TimelineEvent.tsx +60 -0
- package/src/ui/waterfall/TimelineProcessBar.tsx +207 -0
- package/src/ui/waterfall/Wedges.tsx +67 -0
- package/src/ui/waterfall/WheelZoomContext.tsx +128 -0
- package/src/ui/waterfall/hooks/useTimelineState.tsx +134 -0
- package/src/ui/waterfall/hooks/useViewport.tsx +293 -0
- package/src/ui/waterfall/index.tsx +326 -0
- package/src/ui/waterfall/types.ts +20 -0
- package/src/ui/waterfall/utils.ts +91 -0
- package/dist/chunk-W2YAQV5N.mjs +0 -57
- package/dist/{chunk-QLCEHV4Q.mjs → chunk-2OZK5DY5.mjs} +2 -2
- package/dist/{chunk-Z35DNFRZ.cjs → chunk-7IS37C3P.cjs} +2 -2
- package/dist/{chunk-4AOAH77D.mjs → chunk-A2PCEL5S.mjs} +2 -2
- package/dist/{chunk-K4VD5PPY.mjs → chunk-BIUDC66P.mjs} +1 -1
- package/dist/{chunk-RKJR6RZU.cjs → chunk-OYNLQTHW.cjs} +1 -1
- package/dist/{chunk-VE3XLQLO.cjs → chunk-QUFZWF4E.cjs} +2 -2
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* themes - light */
|
|
3
|
+
--brand-primary: var(--blue-6);
|
|
4
|
+
--brand-hover: var(--blue-5);
|
|
5
|
+
--brand-pressed: var(--blue-8);
|
|
6
|
+
--alt-primary: var(--gray-1);
|
|
7
|
+
--alt-hover: var(--gray-2);
|
|
8
|
+
--alt-pressed: var(--gray-1);
|
|
9
|
+
--group-primary: var(--white-1);
|
|
10
|
+
--group-hover: var(--gray-1);
|
|
11
|
+
--group-pressed: var(--gray-2);
|
|
12
|
+
--text-highlight: var(--black-1);
|
|
13
|
+
--text-primary: var(--gray-9);
|
|
14
|
+
--text-secondary: var(--gray-7);
|
|
15
|
+
--text-tertiary: var(--gray-5);
|
|
16
|
+
--text-withbg: var(--white-1);
|
|
17
|
+
--bg-highlight: var(--black-1);
|
|
18
|
+
--bg-primary: var(--white-1);
|
|
19
|
+
--bg-secondary: var(--white-alpha-1);
|
|
20
|
+
--bg-tertiary: var(--gray-2);
|
|
21
|
+
--bg-quaternary: var(--gray-3);
|
|
22
|
+
--bg-mask: var(--black-alpha-5);
|
|
23
|
+
--icon-highlight: var(--black-1);
|
|
24
|
+
--icon-primary: var(--gray-8);
|
|
25
|
+
--icon-secondary: var(--gray-6);
|
|
26
|
+
--icon-tertiary: var(--gray-4);
|
|
27
|
+
--icon-withbg: var(--white-1);
|
|
28
|
+
--danger-primary: var(--red-6);
|
|
29
|
+
--danger-secondary: var(--red-4);
|
|
30
|
+
--danger-tertiary: var(--red-8);
|
|
31
|
+
--accent-warning: var(--yellow-6);
|
|
32
|
+
--accent-success: var(--green-6);
|
|
33
|
+
--line-primary: var(--gray-2);
|
|
34
|
+
--line-secondary: var(--gray-1);
|
|
35
|
+
--shadow-primary: var(--black-alpha-3);
|
|
36
|
+
--shadow-secondary: var(--black-alpha-4);
|
|
37
|
+
--shadow-tertiary: var(--black-alpha-4);
|
|
38
|
+
--select-secondary: var(--white-alpha-1);
|
|
39
|
+
|
|
40
|
+
/* color - scheme */
|
|
41
|
+
--black-1: rgba(0, 0, 0, 1);
|
|
42
|
+
--black-2: rgba(0, 0, 0, 0.9);
|
|
43
|
+
--black-3: rgba(0, 0, 0, 0.7);
|
|
44
|
+
--black-4: rgba(0, 0, 0, 0.5);
|
|
45
|
+
--black-alpha-1: rgba(0, 0, 0, 0.6);
|
|
46
|
+
--black-alpha-2: rgba(0, 0, 0, 0.2);
|
|
47
|
+
--black-alpha-3: rgba(0, 0, 0, 0.1);
|
|
48
|
+
--black-alpha-4: rgba(0, 0, 0, 0.06);
|
|
49
|
+
--black-alpha-5: rgba(56, 57, 59, 0.5);
|
|
50
|
+
--black-alpha-6: rgba(90, 93, 98, 0.3);
|
|
51
|
+
--black-alpha-7: rgba(75, 77, 83, 0.5);
|
|
52
|
+
--white-1: rgba(255, 255, 255, 1);
|
|
53
|
+
--white-alpha-1: rgba(227, 230, 235, 0.6);
|
|
54
|
+
--white-alpha-2: rgba(173, 176, 183, 0.6);
|
|
55
|
+
--white-alpha-3: rgba(246, 247, 248, 0.8);
|
|
56
|
+
--blue-1: rgba(230, 246, 255, 1);
|
|
57
|
+
--blue-2: rgba(163, 220, 255, 1);
|
|
58
|
+
--blue-3: rgba(122, 200, 255, 1);
|
|
59
|
+
--blue-4: rgba(82, 177, 255, 1);
|
|
60
|
+
--blue-5: rgba(41, 151, 255, 1);
|
|
61
|
+
--blue-6: rgba(0, 123, 255, 1);
|
|
62
|
+
--blue-7: rgba(0, 98, 217, 1);
|
|
63
|
+
--blue-8: rgba(0, 74, 179, 1);
|
|
64
|
+
--blue-9: rgba(0, 54, 140, 1);
|
|
65
|
+
--blue-10: rgba(0, 36, 102, 1);
|
|
66
|
+
--gray-1: rgba(245, 245, 245, 1);
|
|
67
|
+
--gray-2: rgba(220, 222, 229, 1);
|
|
68
|
+
--gray-3: rgba(202, 206, 217, 1);
|
|
69
|
+
--gray-4: rgba(181, 184, 196, 1);
|
|
70
|
+
--gray-5: rgba(147, 150, 159, 1);
|
|
71
|
+
--gray-6: rgba(121, 124, 131, 1);
|
|
72
|
+
--gray-7: rgba(87, 90, 96, 1);
|
|
73
|
+
--gray-8: rgba(75, 77, 83, 1);
|
|
74
|
+
--gray-9: rgba(52, 53, 56, 1);
|
|
75
|
+
--gray-10: rgba(29, 29, 30, 1);
|
|
76
|
+
--red-1: rgba(255, 240, 240, 1);
|
|
77
|
+
--red-2: rgba(255, 232, 232, 1);
|
|
78
|
+
--red-3: rgba(255, 191, 192, 1);
|
|
79
|
+
--red-4: rgba(255, 150, 156, 1);
|
|
80
|
+
--red-5: rgba(255, 110, 122, 1);
|
|
81
|
+
--red-6: rgba(255, 69, 91, 1);
|
|
82
|
+
--red-7: rgba(217, 48, 73, 1);
|
|
83
|
+
--red-8: rgba(179, 30, 58, 1);
|
|
84
|
+
--red-9: rgba(140, 17, 44, 1);
|
|
85
|
+
--red-10: rgba(102, 11, 34, 1);
|
|
86
|
+
--yellow-1: rgba(255, 253, 240, 1);
|
|
87
|
+
--yellow-2: rgba(255, 248, 214, 1);
|
|
88
|
+
--yellow-3: rgba(255, 237, 173, 1);
|
|
89
|
+
--yellow-4: rgba(255, 224, 133, 1);
|
|
90
|
+
--yellow-5: rgba(255, 209, 92, 1);
|
|
91
|
+
--yellow-6: rgba(251, 187, 49, 1);
|
|
92
|
+
--yellow-7: rgba(212, 149, 32, 1);
|
|
93
|
+
--yellow-8: rgba(173, 114, 17, 1);
|
|
94
|
+
--yellow-9: rgba(135, 82, 7, 1);
|
|
95
|
+
--yellow-10: rgba(97, 55, 4, 1);
|
|
96
|
+
--green-1: rgba(240, 255, 243, 1);
|
|
97
|
+
--green-2: rgba(228, 242, 231, 1);
|
|
98
|
+
--green-3: rgba(211, 230, 216, 1);
|
|
99
|
+
--green-4: rgba(165, 217, 181, 1);
|
|
100
|
+
--green-5: rgba(122, 204, 151, 1);
|
|
101
|
+
--green-6: rgba(84, 190, 125, 1);
|
|
102
|
+
--green-7: rgba(60, 153, 99, 1);
|
|
103
|
+
--green-8: rgba(39, 115, 73, 1);
|
|
104
|
+
--green-9: rgba(22, 77, 48, 1);
|
|
105
|
+
--green-10: rgba(11, 38, 25, 1);
|
|
106
|
+
|
|
107
|
+
--radius: 0.25rem; /* 4px */
|
|
108
|
+
--spacing: 0.25rem; /* 4px */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dark {
|
|
112
|
+
color-scheme: dark;
|
|
113
|
+
--brand-primary: var(--blue-6);
|
|
114
|
+
--brand-hover: var(--blue-5);
|
|
115
|
+
--brand-pressed: var(--blue-8);
|
|
116
|
+
--alt-primary: var(--gray-9);
|
|
117
|
+
--alt-hover: var(--gray-7);
|
|
118
|
+
--alt-pressed: var(--gray-8);
|
|
119
|
+
--group-primary: var(--black-1);
|
|
120
|
+
--group-hover: var(--gray-9);
|
|
121
|
+
--group-pressed: var(--gray-10);
|
|
122
|
+
--text-highlight: var(--white-1);
|
|
123
|
+
--text-primary: var(--gray-2);
|
|
124
|
+
--text-secondary: var(--gray-5);
|
|
125
|
+
--text-tertiary: var(--gray-6);
|
|
126
|
+
--text-withbg: var(--white-1);
|
|
127
|
+
--bg-highlight: var(--white-1);
|
|
128
|
+
--bg-primary: var(--gray-10);
|
|
129
|
+
--bg-secondary: var(--black-alpha-6);
|
|
130
|
+
--bg-tertiary: var(--gray-8);
|
|
131
|
+
--bg-quaternary: var(--gray-7);
|
|
132
|
+
--bg-mask: var(--black-alpha-5);
|
|
133
|
+
--icon-highlight: var(--white-1);
|
|
134
|
+
--icon-primary: var(--gray-2);
|
|
135
|
+
--icon-secondary: var(--gray-5);
|
|
136
|
+
--icon-tertiary: var(--gray-6);
|
|
137
|
+
--icon-withbg: var(--white-1);
|
|
138
|
+
--danger-primary: var(--red-6);
|
|
139
|
+
--danger-secondary: var(--red-4);
|
|
140
|
+
--danger-tertiary: var(--red-8);
|
|
141
|
+
--accent-warning: var(--yellow-6);
|
|
142
|
+
--accent-success: var(--green-6);
|
|
143
|
+
--line-primary: var(--gray-8);
|
|
144
|
+
--line-secondary: var(--gray-9);
|
|
145
|
+
--shadow-primary: var(--black-alpha-1);
|
|
146
|
+
--shadow-secondary: var(--black-alpha-2);
|
|
147
|
+
--shadow-tertiary: var(--black-alpha-6);
|
|
148
|
+
--select-secondary: var(--black-alpha-5);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.liquid-light {
|
|
152
|
+
color-scheme: light;
|
|
153
|
+
--brand-primary: var(--blue-6);
|
|
154
|
+
--brand-hover: var(--blue-5);
|
|
155
|
+
--brand-pressed: var(--blue-8);
|
|
156
|
+
--alt-primary: var(--gray-1);
|
|
157
|
+
--alt-hover: var(--gray-2);
|
|
158
|
+
--alt-pressed: var(--gray-1);
|
|
159
|
+
--group-primary: var(--white-1);
|
|
160
|
+
--group-hover: var(--gray-1);
|
|
161
|
+
--group-pressed: var(--gray-2);
|
|
162
|
+
--text-highlight: var(--black-1);
|
|
163
|
+
--text-primary: var(--gray-9);
|
|
164
|
+
--text-secondary: var(--gray-7);
|
|
165
|
+
--text-tertiary: var(--gray-5);
|
|
166
|
+
--text-withbg: var(--white-1);
|
|
167
|
+
--bg-highlight: var(--black-1);
|
|
168
|
+
--bg-primary: var(--white-1);
|
|
169
|
+
--bg-secondary: var(--white-alpha-1);
|
|
170
|
+
--bg-tertiary: var(--gray-2);
|
|
171
|
+
--bg-quaternary: var(--gray-3);
|
|
172
|
+
--bg-mask: var(--white-alpha-3);
|
|
173
|
+
--icon-highlight: var(--black-1);
|
|
174
|
+
--icon-primary: var(--gray-8);
|
|
175
|
+
--icon-secondary: var(--gray-6);
|
|
176
|
+
--icon-tertiary: var(--gray-4);
|
|
177
|
+
--icon-withbg: var(--white-1);
|
|
178
|
+
--danger-primary: var(--red-6);
|
|
179
|
+
--danger-secondary: var(--red-4);
|
|
180
|
+
--danger-tertiary: var(--red-8);
|
|
181
|
+
--accent-warning: var(--yellow-6);
|
|
182
|
+
--accent-success: var(--green-6);
|
|
183
|
+
--line-primary: var(--white-alpha-2);
|
|
184
|
+
--line-secondary: var(--gray-1);
|
|
185
|
+
--shadow-primary: var(--black-alpha-3);
|
|
186
|
+
--shadow-secondary: var(--black-alpha-4);
|
|
187
|
+
--shadow-tertiary: var(--black-alpha-4);
|
|
188
|
+
--select-secondary: var(--white-alpha-1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.liquid-dark {
|
|
192
|
+
color-scheme: dark;
|
|
193
|
+
--brand-primary: var(--blue-6);
|
|
194
|
+
--brand-hover: var(--blue-5);
|
|
195
|
+
--brand-pressed: var(--blue-8);
|
|
196
|
+
--alt-primary: var(--gray-9);
|
|
197
|
+
--alt-hover: var(--gray-7);
|
|
198
|
+
--alt-pressed: var(--gray-8);
|
|
199
|
+
--group-primary: var(--white-1);
|
|
200
|
+
--group-hover: var(--gray-9);
|
|
201
|
+
--group-pressed: var(--gray-2);
|
|
202
|
+
--text-highlight: var(--white-1);
|
|
203
|
+
--text-primary: var(--gray-2);
|
|
204
|
+
--text-secondary: var(--gray-5);
|
|
205
|
+
--text-tertiary: var(--gray-6);
|
|
206
|
+
--text-withbg: var(--white-1);
|
|
207
|
+
--bg-highlight: var(--white-1);
|
|
208
|
+
--bg-primary: var(--gray-10);
|
|
209
|
+
--bg-secondary: var(--black-alpha-6);
|
|
210
|
+
--bg-tertiary: var(--gray-8);
|
|
211
|
+
--bg-quaternary: var(--gray-7);
|
|
212
|
+
--bg-mask: var(--black-alpha-5);
|
|
213
|
+
--icon-highlight: var(--white-1);
|
|
214
|
+
--icon-primary: var(--gray-2);
|
|
215
|
+
--icon-secondary: var(--gray-5);
|
|
216
|
+
--icon-tertiary: var(--gray-6);
|
|
217
|
+
--icon-withbg: var(--white-1);
|
|
218
|
+
--danger-primary: var(--red-6);
|
|
219
|
+
--danger-secondary: var(--red-4);
|
|
220
|
+
--danger-tertiary: var(--red-8);
|
|
221
|
+
--accent-warning: var(--yellow-6);
|
|
222
|
+
--accent-success: var(--green-6);
|
|
223
|
+
--line-primary: var(--black-alpha-7);
|
|
224
|
+
--line-secondary: var(--gray-9);
|
|
225
|
+
--shadow-primary: var(--black-alpha-1);
|
|
226
|
+
--shadow-secondary: var(--black-alpha-2);
|
|
227
|
+
--shadow-tertiary: var(--black-alpha-6);
|
|
228
|
+
--select-secondary: var(--black-alpha-5);
|
|
229
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { GitBranch } from "lucide-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
// Version info - fallback to direct import if build-time replacement fails
|
|
5
|
+
import packageJson from "../../package.json";
|
|
6
|
+
import { cn } from "../hooks";
|
|
7
|
+
|
|
8
|
+
declare const __PACKAGE_VERSION__: string;
|
|
9
|
+
declare const __PACKAGE_NAME__: string;
|
|
10
|
+
declare const __GIT_HASH__: string;
|
|
11
|
+
|
|
12
|
+
const PACKAGE_VERSION =
|
|
13
|
+
typeof __PACKAGE_VERSION__ !== "undefined" ? __PACKAGE_VERSION__ : packageJson.version;
|
|
14
|
+
const PACKAGE_NAME = typeof __PACKAGE_NAME__ !== "undefined" ? __PACKAGE_NAME__ : packageJson.name;
|
|
15
|
+
const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : "unknown";
|
|
16
|
+
|
|
17
|
+
interface PackageBadgeProps {
|
|
18
|
+
/**
|
|
19
|
+
* Additional CSS classes to apply to the badge
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Package name to display (e.g., "vuer", "uikit")
|
|
24
|
+
*/
|
|
25
|
+
packageName?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Full package name for npm link (e.g., "@vuer-ai/vuer-uikit")
|
|
28
|
+
*/
|
|
29
|
+
packageFullName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Version string to display (e.g., "v0.0.72" or "0.0.72")
|
|
32
|
+
*/
|
|
33
|
+
versionText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the version should be clickable (links to npm)
|
|
36
|
+
*/
|
|
37
|
+
linkable?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Git hash to display (if provided)
|
|
40
|
+
*/
|
|
41
|
+
gitHash?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Low-level badge component that displays package information with provided values
|
|
46
|
+
*/
|
|
47
|
+
function PackageBadge({
|
|
48
|
+
className,
|
|
49
|
+
packageName,
|
|
50
|
+
packageFullName,
|
|
51
|
+
versionText,
|
|
52
|
+
linkable = true,
|
|
53
|
+
gitHash,
|
|
54
|
+
}: PackageBadgeProps) {
|
|
55
|
+
const npmUrl =
|
|
56
|
+
packageFullName && versionText
|
|
57
|
+
? `https://www.npmjs.com/package/${packageFullName}/v/${versionText.replace("v", "")}`
|
|
58
|
+
: undefined;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className={`rounded-uk-xs rounded-r-uk-xs text-uk-sm bg-icon-withbg inline-flex items-center ${className || ""}`}
|
|
63
|
+
style={linkable ? { cursor: "pointer" } : undefined}
|
|
64
|
+
>
|
|
65
|
+
{(packageName || versionText) && (
|
|
66
|
+
<div className="rounded-uk-xs inline-flex items-center overflow-hidden">
|
|
67
|
+
{packageName && (
|
|
68
|
+
<span
|
|
69
|
+
className="pl-sm pr-xs py-xxxs bg-brand-primary text-text-withbg text-uk-xs"
|
|
70
|
+
style={{
|
|
71
|
+
backgroundColor: "var(--color-brand-primary, var(--brand-primary))",
|
|
72
|
+
color: "white",
|
|
73
|
+
textShadow: "0 1px 2px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.1)",
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{packageName}
|
|
77
|
+
</span>
|
|
78
|
+
)}
|
|
79
|
+
{versionText && (
|
|
80
|
+
<a
|
|
81
|
+
href={linkable && npmUrl ? npmUrl : undefined}
|
|
82
|
+
className={cn(
|
|
83
|
+
"pl-xs pr-sm py-xxxs rounded-r-uk-xs",
|
|
84
|
+
"bg-alt-primary",
|
|
85
|
+
"text-text-secondary",
|
|
86
|
+
"text-text-primary text-uk-xs",
|
|
87
|
+
linkable && "hover:text-brand-primary",
|
|
88
|
+
)}
|
|
89
|
+
style={{
|
|
90
|
+
textShadow:
|
|
91
|
+
"0 1px 1px rgba(0, 0, 0, 0.2), inset 0 -1px 0 rgba(255, 255, 255, 0.05)",
|
|
92
|
+
}}
|
|
93
|
+
onClick={!linkable ? (e: React.MouseEvent) => e.preventDefault() : undefined}
|
|
94
|
+
>
|
|
95
|
+
{versionText}
|
|
96
|
+
</a>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
{gitHash && gitHash !== "unknown" && (
|
|
101
|
+
<a
|
|
102
|
+
href={linkable ? `https://github.com/vuer-ai/vuer-uikit/commit/${gitHash}` : undefined}
|
|
103
|
+
className="px-md rounded-uk-ssx font-number-input text-text-tertiary text-uk-xs ml-[0px] bg-transparent py-[0px]"
|
|
104
|
+
onClick={!linkable ? (e: React.MouseEvent) => e.preventDefault() : undefined}
|
|
105
|
+
>
|
|
106
|
+
<GitBranch className="mr-[2px] inline-block size-2" />
|
|
107
|
+
{gitHash}
|
|
108
|
+
</a>
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface UIKitBadgeProps {
|
|
115
|
+
/**
|
|
116
|
+
* Additional CSS classes to apply to the badge
|
|
117
|
+
*/
|
|
118
|
+
className?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether to show the package name
|
|
121
|
+
*/
|
|
122
|
+
package?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Whether to show just the version or include "v" prefix
|
|
125
|
+
*/
|
|
126
|
+
prefix?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the badge should be clickable (links to npm/github)
|
|
129
|
+
*/
|
|
130
|
+
linkable?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether to show the version
|
|
133
|
+
*/
|
|
134
|
+
version?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether to show the git hash
|
|
137
|
+
*/
|
|
138
|
+
hash?: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* High-level badge component that displays the current package version with boolean flags
|
|
143
|
+
* Format: [ vuer | v0.0.72 ] hash
|
|
144
|
+
*/
|
|
145
|
+
function UIKitBadge({
|
|
146
|
+
className,
|
|
147
|
+
package: showPackage = false,
|
|
148
|
+
prefix = false,
|
|
149
|
+
linkable = false,
|
|
150
|
+
version = false,
|
|
151
|
+
hash = false,
|
|
152
|
+
}: UIKitBadgeProps) {
|
|
153
|
+
const packageShortName = PACKAGE_NAME.split("/").pop() || PACKAGE_NAME;
|
|
154
|
+
|
|
155
|
+
const versionText = version ? (prefix ? `v${PACKAGE_VERSION}` : PACKAGE_VERSION) : undefined;
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<PackageBadge
|
|
159
|
+
className={className}
|
|
160
|
+
packageName={showPackage ? packageShortName : undefined}
|
|
161
|
+
packageFullName={PACKAGE_NAME}
|
|
162
|
+
versionText={versionText}
|
|
163
|
+
linkable={linkable}
|
|
164
|
+
gitHash={hash ? GIT_HASH : undefined}
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Export version and git hash for external use
|
|
170
|
+
export { PACKAGE_VERSION, GIT_HASH, PackageBadge, UIKitBadge };
|
|
171
|
+
export type { PackageBadgeProps, UIKitBadgeProps };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
2
|
+
import React, { ComponentProps } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn, createClientOnlyComponent } from "../hooks";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Avatar root component that displays a user's profile image with fallback support.
|
|
8
|
+
* Based on Radix UI Avatar primitive with default styling for a circular avatar.
|
|
9
|
+
*
|
|
10
|
+
* @param className - Additional CSS classes to apply
|
|
11
|
+
* @param props - All standard Radix Avatar.Root props are supported
|
|
12
|
+
*/
|
|
13
|
+
export const AvatarRoot = ({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: ComponentProps<typeof AvatarPrimitive.Root>) => (
|
|
17
|
+
<AvatarPrimitive.Root
|
|
18
|
+
data-slot="avatar"
|
|
19
|
+
className={cn("relative flex size-[24px] shrink-0 overflow-hidden rounded-full", className)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* SSR fallback component for Avatar when client-side rendering is not available.
|
|
26
|
+
* @param className - Additional CSS classes to apply
|
|
27
|
+
*/
|
|
28
|
+
export const AvatarSSRFallback = ({ className }: { className?: string }) => (
|
|
29
|
+
<span
|
|
30
|
+
data-slot="avatar"
|
|
31
|
+
className={cn("relative flex size-[24px] shrink-0 overflow-hidden rounded-full", className)}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Main Avatar component with client-side rendering support and SSR fallback.
|
|
37
|
+
* Use this as the container for AvatarImage and AvatarFallback components.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Avatar>
|
|
42
|
+
* <AvatarImage src="/avatar.jpg" alt="User" />
|
|
43
|
+
* <AvatarFallback>JD</AvatarFallback>
|
|
44
|
+
* </Avatar>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export const Avatar = createClientOnlyComponent(AvatarRoot, AvatarSSRFallback);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Avatar image component for displaying the actual user image.
|
|
51
|
+
* If the image fails to load, it will automatically fall back to AvatarFallback.
|
|
52
|
+
*
|
|
53
|
+
* @param src - Image source URL
|
|
54
|
+
* @param alt - Alternative text for the image
|
|
55
|
+
* @param className - Additional CSS classes to apply
|
|
56
|
+
* @param props - All standard img element props are supported
|
|
57
|
+
*/
|
|
58
|
+
export const AvatarImageRoot = ({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: ComponentProps<typeof AvatarPrimitive.Image>) => (
|
|
62
|
+
<AvatarPrimitive.Image
|
|
63
|
+
data-slot="avatar-image"
|
|
64
|
+
className={cn("aspect-square size-full", className)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* SSR fallback component for AvatarImage when client-side rendering is not available.
|
|
71
|
+
* @param className - Additional CSS classes to apply
|
|
72
|
+
*/
|
|
73
|
+
export const AvatarImageFallback = ({ className }: { className?: string }) => (
|
|
74
|
+
<span data-slot="avatar-image" className={cn("aspect-square size-full", className)} />
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Avatar image component with client-side rendering support and SSR fallback.
|
|
79
|
+
* Displays the user's profile image with automatic fallback support.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <AvatarImage src="/user-avatar.jpg" alt="John Doe" />
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export const AvatarImage = createClientOnlyComponent(AvatarImageRoot, AvatarImageFallback);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Avatar fallback component that displays when the image fails to load.
|
|
90
|
+
* Typically contains user initials or a default icon.
|
|
91
|
+
*
|
|
92
|
+
* @param className - Additional CSS classes to apply
|
|
93
|
+
* @param children - Content to display (usually initials)
|
|
94
|
+
* @param props - All standard Radix Avatar.Fallback props are supported
|
|
95
|
+
*/
|
|
96
|
+
export const AvatarFallbackRoot = ({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: ComponentProps<typeof AvatarPrimitive.Fallback>) => (
|
|
100
|
+
<AvatarPrimitive.Fallback
|
|
101
|
+
data-slot="avatar-fallback"
|
|
102
|
+
className={cn(
|
|
103
|
+
"bg-bg-tertiary flex size-full items-center justify-center rounded-full",
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* SSR fallback component for AvatarFallback when client-side rendering is not available.
|
|
112
|
+
* @param className - Additional CSS classes to apply
|
|
113
|
+
* @param children - Content to display (usually initials)
|
|
114
|
+
*/
|
|
115
|
+
export const AvatarFallbackSSR = ({
|
|
116
|
+
className,
|
|
117
|
+
...props
|
|
118
|
+
}: {
|
|
119
|
+
className?: string;
|
|
120
|
+
children?: React.ReactNode;
|
|
121
|
+
}) => (
|
|
122
|
+
<span
|
|
123
|
+
data-slot="avatar-fallback"
|
|
124
|
+
className={cn(
|
|
125
|
+
"bg-bg-tertiary flex size-full items-center justify-center rounded-full",
|
|
126
|
+
className,
|
|
127
|
+
)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Avatar fallback component with client-side rendering support and SSR fallback.
|
|
134
|
+
* Displays fallback content when the avatar image fails to load.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```tsx
|
|
138
|
+
* <AvatarFallback>JD</AvatarFallback>
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export const AvatarFallback = createClientOnlyComponent(AvatarFallbackRoot, AvatarFallbackSSR);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Props for the AvatarGroup component.
|
|
145
|
+
*/
|
|
146
|
+
export interface AvatarGroupProps {
|
|
147
|
+
/** Avatar components to display in the group */
|
|
148
|
+
children: React.ReactNode;
|
|
149
|
+
/** Additional CSS classes to apply */
|
|
150
|
+
className?: string;
|
|
151
|
+
/** Spacing between avatars in the group */
|
|
152
|
+
spacing?: "tight" | "normal" | "loose";
|
|
153
|
+
/** Maximum number of avatars to show before adding a "+N" indicator */
|
|
154
|
+
max?: number;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Avatar group component for displaying multiple avatars in a stacked layout.
|
|
159
|
+
* Supports configurable spacing and a maximum count with overflow indicator.
|
|
160
|
+
*
|
|
161
|
+
* @param children - Avatar components to display
|
|
162
|
+
* @param className - Additional CSS classes to apply
|
|
163
|
+
* @param spacing - Spacing between avatars ("tight" | "normal" | "loose"), defaults to "normal"
|
|
164
|
+
* @param max - Maximum number of avatars to show, remaining count will be shown as "+N"
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <AvatarGroup spacing="tight" max={3}>
|
|
169
|
+
* <Avatar>
|
|
170
|
+
* <AvatarImage src="/user1.jpg" alt="User 1" />
|
|
171
|
+
* <AvatarFallback>U1</AvatarFallback>
|
|
172
|
+
* </Avatar>
|
|
173
|
+
* <Avatar>
|
|
174
|
+
* <AvatarImage src="/user2.jpg" alt="User 2" />
|
|
175
|
+
* <AvatarFallback>U2</AvatarFallback>
|
|
176
|
+
* </Avatar>
|
|
177
|
+
* </AvatarGroup>
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export function AvatarGroup({ children, className, spacing = "normal", max }: AvatarGroupProps) {
|
|
181
|
+
const spacingClasses = {
|
|
182
|
+
tight: "-space-x-1.5",
|
|
183
|
+
normal: "-space-x-1",
|
|
184
|
+
loose: "-space-x-0.45",
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const childrenArray = React.Children.toArray(children);
|
|
188
|
+
const displayChildren = max ? childrenArray.slice(0, max) : childrenArray;
|
|
189
|
+
const remainingCount = max && childrenArray.length > max ? childrenArray.length - max : 0;
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<div className={cn("flex flex-row-reverse justify-end", spacingClasses[spacing], className)}>
|
|
193
|
+
{remainingCount > 0 && (
|
|
194
|
+
<Avatar
|
|
195
|
+
className={cn(
|
|
196
|
+
"ring-background relative cursor-default ring-2 transition-all duration-200 ease-in-out hover:z-[100] hover:scale-120",
|
|
197
|
+
)}
|
|
198
|
+
>
|
|
199
|
+
<AvatarFallback>+{remainingCount}</AvatarFallback>
|
|
200
|
+
</Avatar>
|
|
201
|
+
)}
|
|
202
|
+
{displayChildren.reverse().map((child) => {
|
|
203
|
+
if (React.isValidElement(child)) {
|
|
204
|
+
return React.cloneElement(
|
|
205
|
+
child as React.ReactElement<{
|
|
206
|
+
className?: string;
|
|
207
|
+
style?: React.CSSProperties;
|
|
208
|
+
}>,
|
|
209
|
+
{
|
|
210
|
+
className: cn(
|
|
211
|
+
`ring-background relative ring-2 transition-all duration-200 ease-in-out hover:z-[100] hover:scale-120`,
|
|
212
|
+
(child.props as { className?: string })?.className,
|
|
213
|
+
),
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
return child;
|
|
218
|
+
})}
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
}
|
package/src/ui/badge.tsx
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../hooks";
|
|
6
|
+
|
|
7
|
+
const badgeVariants = cva(
|
|
8
|
+
[
|
|
9
|
+
"inline-flex",
|
|
10
|
+
"items-center",
|
|
11
|
+
"justify-center",
|
|
12
|
+
"rounded-uk-xs",
|
|
13
|
+
"px-md",
|
|
14
|
+
"py-xxs",
|
|
15
|
+
"align-middle",
|
|
16
|
+
"text-uk-sm",
|
|
17
|
+
"leading-uk-sm",
|
|
18
|
+
"w-fit",
|
|
19
|
+
"whitespace-nowrap",
|
|
20
|
+
"shrink-0",
|
|
21
|
+
"[&>svg]:size-3",
|
|
22
|
+
"[&>svg]:pointer-events-none",
|
|
23
|
+
"transition-[color,box-shadow]",
|
|
24
|
+
"overflow-hidden",
|
|
25
|
+
"text-text-withbg",
|
|
26
|
+
],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
default: "bg-brand-primary",
|
|
31
|
+
secondary: "bg-bg-secondary text-text-primary",
|
|
32
|
+
destructive: "bg-danger-primary",
|
|
33
|
+
success: "bg-accent-success",
|
|
34
|
+
warning: "bg-accent-warning",
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
default: "",
|
|
38
|
+
circle: "size-[18px] !rounded-full",
|
|
39
|
+
dot: "size-[6px] rounded-full !px-0 !py-0 text-transparent",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
variant: "default",
|
|
44
|
+
type: "default",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
function Badge({
|
|
50
|
+
className,
|
|
51
|
+
variant,
|
|
52
|
+
type,
|
|
53
|
+
asChild = false,
|
|
54
|
+
...props
|
|
55
|
+
}: ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
56
|
+
const Comp = asChild ? Slot : "span";
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Inline status badge.
|
|
60
|
+
*
|
|
61
|
+
* @param variant - Visual variant (default | secondary | destructive | success | warning | accent)
|
|
62
|
+
* @param type - Shape type (default | circle | dot)
|
|
63
|
+
* @param asChild - Render child element instead of span when true
|
|
64
|
+
*/
|
|
65
|
+
return (
|
|
66
|
+
<Comp
|
|
67
|
+
data-slot="badge"
|
|
68
|
+
className={cn(badgeVariants({ variant, type }), className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Badge, badgeVariants };
|