@astra-kit/ui 0.0.0-stage → 0.0.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 +15 -0
- package/LICENSE.md +21 -0
- package/README.md +384 -2
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/inter-LICENSE.txt +93 -0
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +98 -0
- package/dist/components/account-menu.d.ts +67 -0
- package/dist/components/account-menu.js +440 -0
- package/dist/components/action-button.d.ts +25 -0
- package/dist/components/action-button.js +264 -0
- package/dist/components/alert.d.ts +31 -0
- package/dist/components/alert.js +503 -0
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +170 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +134 -0
- package/dist/components/animated-theme-toggler.d.ts +12 -0
- package/dist/components/animated-theme-toggler.js +200 -0
- package/dist/components/avatar.d.ts +65 -0
- package/dist/components/avatar.js +463 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +297 -0
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +203 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +145 -0
- package/dist/components/calendar.d.ts +47 -0
- package/dist/components/calendar.js +155 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.js +904 -0
- package/dist/components/carousel.d.ts +71 -0
- package/dist/components/carousel.js +585 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +324 -0
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.d.ts +118 -0
- package/dist/components/data-table.js +895 -0
- package/dist/components/dialog-surface.d.ts +49 -0
- package/dist/components/dialog-surface.js +220 -0
- package/dist/components/dialog.d.ts +92 -0
- package/dist/components/dialog.js +320 -0
- package/dist/components/dropdown-menu.d.ts +57 -0
- package/dist/components/dropdown-menu.js +107 -0
- package/dist/components/field.d.ts +53 -0
- package/dist/components/field.js +710 -0
- package/dist/components/file-upload.d.ts +88 -0
- package/dist/components/file-upload.js +776 -0
- package/dist/components/filter-presets-bar.d.ts +73 -0
- package/dist/components/filter-presets-bar.js +510 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +881 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +875 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +330 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +152 -0
- package/dist/components/hover-card.d.ts +50 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +277 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +120 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +43 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +43 -0
- package/dist/components/morph-text.d.ts +14 -0
- package/dist/components/morph-text.js +210 -0
- package/dist/components/pagination.d.ts +59 -0
- package/dist/components/pagination.js +190 -0
- package/dist/components/popover.d.ts +17 -0
- package/dist/components/popover.js +40 -0
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +209 -0
- package/dist/components/primitives/alert-dialog.d.ts +68 -0
- package/dist/components/primitives/alert-dialog.js +629 -0
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +265 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +560 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +37 -0
- package/dist/components/primitives/select.js +428 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/radio-group.d.ts +34 -0
- package/dist/components/radio-group.js +392 -0
- package/dist/components/reaction-button.d.ts +30 -0
- package/dist/components/reaction-button.js +189 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.d.ts +55 -0
- package/dist/components/select.js +188 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/sheet.d.ts +19 -0
- package/dist/components/sheet.js +420 -0
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +195 -0
- package/dist/components/sidebar.js +2041 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +334 -0
- package/dist/components/split-button.d.ts +36 -0
- package/dist/components/split-button.js +306 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +14 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.js +444 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +298 -0
- package/dist/components/tabs.d.ts +36 -0
- package/dist/components/tabs.js +636 -0
- package/dist/components/textarea.d.ts +16 -0
- package/dist/components/textarea.js +111 -0
- package/dist/components/themed-toaster.d.ts +7 -0
- package/dist/components/themed-toaster.js +86 -0
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.js +62 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +389 -0
- package/dist/constants/action-button.d.ts +20 -0
- package/dist/constants/action-button.js +17 -0
- package/dist/constants/alert.d.ts +16 -0
- package/dist/constants/alert.js +13 -0
- package/dist/constants/avatar.d.ts +38 -0
- package/dist/constants/avatar.js +32 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/constants/calendar.d.ts +36 -0
- package/dist/constants/calendar.js +34 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +55 -0
- package/dist/constants/carousel.js +74 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +11 -0
- package/dist/constants/dialog.js +10 -0
- package/dist/constants/dropdown-menu.d.ts +10 -0
- package/dist/constants/dropdown-menu.js +37 -0
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/morph-text.d.ts +13 -0
- package/dist/constants/morph-text.js +13 -0
- package/dist/constants/motion.d.ts +12 -0
- package/dist/constants/motion.js +12 -0
- package/dist/constants/pagination.d.ts +20 -0
- package/dist/constants/pagination.js +20 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +33 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +7 -0
- package/dist/constants/select.js +34 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +17 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/split-button.d.ts +7 -0
- package/dist/constants/split-button.js +5 -0
- package/dist/constants/switch.d.ts +33 -0
- package/dist/constants/switch.js +41 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
- package/dist/hooks/use-sidebar-persistence.js +52 -0
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.js +11 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +69 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +46 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +177 -0
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-swap.d.ts +22 -0
- package/dist/motion/arc-swap.js +49 -0
- package/dist/motion/arc-tokens.d.ts +53 -0
- package/dist/motion/arc-tokens.js +73 -0
- package/dist/motion/glide-indicator.d.ts +69 -0
- package/dist/motion/glide-indicator.js +309 -0
- package/dist/motion/glide-slot.d.ts +9 -0
- package/dist/motion/glide-slot.js +71 -0
- package/dist/motion/motion-slot.d.ts +12 -0
- package/dist/motion/motion-slot.js +376 -0
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/motion/presence.d.ts +40 -0
- package/dist/motion/presence.js +101 -0
- package/dist/motion/surface-keyframes.d.ts +24 -0
- package/dist/motion/surface-keyframes.js +141 -0
- package/dist/motion/tokens.d.ts +81 -0
- package/dist/motion/tokens.js +67 -0
- package/dist/motion/use-attached-element.d.ts +7 -0
- package/dist/motion/use-attached-element.js +22 -0
- package/dist/motion/use-morph-width.d.ts +13 -0
- package/dist/motion/use-morph-width.js +59 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +79 -0
- package/dist/providers/astra-ui-provider.d.ts +27 -0
- package/dist/providers/astra-ui-provider.js +100 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +45 -0
- package/dist/sonner.d.ts +7 -0
- package/dist/sonner.js +8 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +50 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +450 -4
- package/styles.css +4 -0
- package/theme.css +248 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Internal primitive of Arc's Tooltip (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a short dark
|
|
5
|
+
* bubble on Arc's tokens that waits a moment, then rises a few pixels from its trigger. While a tooltip is open, and
|
|
6
|
+
* briefly after it closes, the next one opens at once and only fades. Internal: the Radix composition (`Tooltip`,
|
|
7
|
+
* `TooltipTrigger`, `TooltipContent`, `TooltipProvider`) behind the public closed `Tooltip` and @astra-kit/ui's composite
|
|
8
|
+
* components; the package does not export it.
|
|
9
|
+
*/
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
12
|
+
import { ArcFloatingSlot } from "../../motion/arc-floating-slot.js";
|
|
13
|
+
import { createOverlayWarmth, useOpenedWhileWarm } from "../../motion/overlay-warmth.js";
|
|
14
|
+
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../../motion/presence.js";
|
|
15
|
+
import { cn } from "../../lib/utils.js";
|
|
16
|
+
import { TOOLTIP_COLLISION_PADDING_PX, TOOLTIP_INSTANT_MOTION, TOOLTIP_MOTION, TOOLTIP_OPEN_DELAY_MS, TOOLTIP_SIDE_OFFSET_PX, TOOLTIP_SKIP_WINDOW_MS } from "../../constants/tooltip.js";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
/** Every tooltip on the page shares one skip window, whichever provider it belongs to. */
|
|
19
|
+
const tooltipWarmth = createOverlayWarmth(TOOLTIP_SKIP_WINDOW_MS);
|
|
20
|
+
/** Whether the page was already warm when the surrounding layer opened, so its entrance only fades. */
|
|
21
|
+
const TooltipOpenedWhileWarmContext = React.createContext(false);
|
|
22
|
+
/** Tells a `Tooltip` whether a `TooltipProvider` already wraps it. */
|
|
23
|
+
const TooltipProviderPresenceContext = React.createContext(false);
|
|
24
|
+
/**
|
|
25
|
+
* Shares the open delay among the tooltips it wraps.
|
|
26
|
+
* @param props - Radix provider properties. `delayDuration` defaults to Arc's 250ms.
|
|
27
|
+
* @returns The provider.
|
|
28
|
+
*/
|
|
29
|
+
function TooltipProvider(t0) {
|
|
30
|
+
const $ = _c(6);
|
|
31
|
+
let props;
|
|
32
|
+
let t1;
|
|
33
|
+
if ($[0] !== t0) {
|
|
34
|
+
({delayDuration: t1, ...props} = t0);
|
|
35
|
+
$[0] = t0;
|
|
36
|
+
$[1] = props;
|
|
37
|
+
$[2] = t1;
|
|
38
|
+
} else {
|
|
39
|
+
props = $[1];
|
|
40
|
+
t1 = $[2];
|
|
41
|
+
}
|
|
42
|
+
const delayDuration = t1 === undefined ? TOOLTIP_OPEN_DELAY_MS : t1;
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[3] !== delayDuration || $[4] !== props) {
|
|
45
|
+
t2 = /* @__PURE__ */ _jsx(TooltipProviderPresenceContext.Provider, {
|
|
46
|
+
value: true,
|
|
47
|
+
children: /* @__PURE__ */ _jsx(TooltipPrimitive.Provider, {
|
|
48
|
+
"data-slot": "tooltip-provider",
|
|
49
|
+
delayDuration,
|
|
50
|
+
...props
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
$[3] = delayDuration;
|
|
54
|
+
$[4] = props;
|
|
55
|
+
$[5] = t2;
|
|
56
|
+
} else {
|
|
57
|
+
t2 = $[5];
|
|
58
|
+
}
|
|
59
|
+
return t2;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Owns the open state of one tooltip. It works with or without a `TooltipProvider`: without one it brings its own,
|
|
63
|
+
* as Arc's Tooltip does. Within the shared skip window it opens without delay.
|
|
64
|
+
* @param props - Radix root properties.
|
|
65
|
+
* @returns The tooltip root.
|
|
66
|
+
*/
|
|
67
|
+
function Tooltip(t0) {
|
|
68
|
+
const $ = _c(20);
|
|
69
|
+
let delayDuration;
|
|
70
|
+
let props;
|
|
71
|
+
if ($[0] !== t0) {
|
|
72
|
+
({delayDuration, ...props} = t0);
|
|
73
|
+
$[0] = t0;
|
|
74
|
+
$[1] = delayDuration;
|
|
75
|
+
$[2] = props;
|
|
76
|
+
} else {
|
|
77
|
+
delayDuration = $[1];
|
|
78
|
+
props = $[2];
|
|
79
|
+
}
|
|
80
|
+
const [motionOpen, setMotionOpen] = useMotionOpenState(props);
|
|
81
|
+
const isWarm = React.useSyncExternalStore(tooltipWarmth.subscribe, tooltipWarmth.isWarm, tooltipWarmth.isWarmOnServer);
|
|
82
|
+
const openedWhileWarm = useOpenedWhileWarm(motionOpen, isWarm);
|
|
83
|
+
const hasProvider = React.useContext(TooltipProviderPresenceContext);
|
|
84
|
+
let t1;
|
|
85
|
+
let t2;
|
|
86
|
+
if ($[3] !== motionOpen) {
|
|
87
|
+
t1 = () => {
|
|
88
|
+
if (!motionOpen) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
return tooltipWarmth.open();
|
|
92
|
+
};
|
|
93
|
+
t2 = [motionOpen];
|
|
94
|
+
$[3] = motionOpen;
|
|
95
|
+
$[4] = t1;
|
|
96
|
+
$[5] = t2;
|
|
97
|
+
} else {
|
|
98
|
+
t1 = $[4];
|
|
99
|
+
t2 = $[5];
|
|
100
|
+
}
|
|
101
|
+
React.useEffect(t1, t2);
|
|
102
|
+
const t3 = isWarm ? 0 : delayDuration;
|
|
103
|
+
let t4;
|
|
104
|
+
if ($[6] !== motionOpen || $[7] !== props || $[8] !== setMotionOpen || $[9] !== t3) {
|
|
105
|
+
t4 = /* @__PURE__ */ _jsx(TooltipPrimitive.Root, {
|
|
106
|
+
"data-slot": "tooltip",
|
|
107
|
+
...props,
|
|
108
|
+
delayDuration: t3,
|
|
109
|
+
open: motionOpen,
|
|
110
|
+
onOpenChange: setMotionOpen
|
|
111
|
+
});
|
|
112
|
+
$[6] = motionOpen;
|
|
113
|
+
$[7] = props;
|
|
114
|
+
$[8] = setMotionOpen;
|
|
115
|
+
$[9] = t3;
|
|
116
|
+
$[10] = t4;
|
|
117
|
+
} else {
|
|
118
|
+
t4 = $[10];
|
|
119
|
+
}
|
|
120
|
+
let t5;
|
|
121
|
+
if ($[11] !== openedWhileWarm || $[12] !== t4) {
|
|
122
|
+
t5 = /* @__PURE__ */ _jsx(TooltipOpenedWhileWarmContext.Provider, {
|
|
123
|
+
value: openedWhileWarm,
|
|
124
|
+
children: t4
|
|
125
|
+
});
|
|
126
|
+
$[11] = openedWhileWarm;
|
|
127
|
+
$[12] = t4;
|
|
128
|
+
$[13] = t5;
|
|
129
|
+
} else {
|
|
130
|
+
t5 = $[13];
|
|
131
|
+
}
|
|
132
|
+
let t6;
|
|
133
|
+
if ($[14] !== motionOpen || $[15] !== t5) {
|
|
134
|
+
t6 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
|
|
135
|
+
scope: "tooltip",
|
|
136
|
+
open: motionOpen,
|
|
137
|
+
children: t5
|
|
138
|
+
});
|
|
139
|
+
$[14] = motionOpen;
|
|
140
|
+
$[15] = t5;
|
|
141
|
+
$[16] = t6;
|
|
142
|
+
} else {
|
|
143
|
+
t6 = $[16];
|
|
144
|
+
}
|
|
145
|
+
const root = t6;
|
|
146
|
+
let t7;
|
|
147
|
+
if ($[17] !== hasProvider || $[18] !== root) {
|
|
148
|
+
t7 = hasProvider ? root : /* @__PURE__ */ _jsx(TooltipProvider, { children: root });
|
|
149
|
+
$[17] = hasProvider;
|
|
150
|
+
$[18] = root;
|
|
151
|
+
$[19] = t7;
|
|
152
|
+
} else {
|
|
153
|
+
t7 = $[19];
|
|
154
|
+
}
|
|
155
|
+
return t7;
|
|
156
|
+
}
|
|
157
|
+
function TooltipTrigger(t0) {
|
|
158
|
+
const $ = _c(4);
|
|
159
|
+
let props;
|
|
160
|
+
if ($[0] !== t0) {
|
|
161
|
+
({...props} = t0);
|
|
162
|
+
$[0] = t0;
|
|
163
|
+
$[1] = props;
|
|
164
|
+
} else {
|
|
165
|
+
props = $[1];
|
|
166
|
+
}
|
|
167
|
+
let t1;
|
|
168
|
+
if ($[2] !== props) {
|
|
169
|
+
t1 = /* @__PURE__ */ _jsx(TooltipPrimitive.Trigger, {
|
|
170
|
+
"data-slot": "tooltip-trigger",
|
|
171
|
+
...props
|
|
172
|
+
});
|
|
173
|
+
$[2] = props;
|
|
174
|
+
$[3] = t1;
|
|
175
|
+
} else {
|
|
176
|
+
t1 = $[3];
|
|
177
|
+
}
|
|
178
|
+
return t1;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Renders Arc's bubble: inverted colors, a hairline border, the raised shadow and 15rem of maximum width.
|
|
182
|
+
* @param props - Radix content properties. `sideOffset` defaults to 8px and `collisionPadding` to 12px.
|
|
183
|
+
* @returns The portaled bubble.
|
|
184
|
+
*/
|
|
185
|
+
function TooltipContent(t0) {
|
|
186
|
+
const $ = _c(22);
|
|
187
|
+
let children;
|
|
188
|
+
let className;
|
|
189
|
+
let props;
|
|
190
|
+
let t1;
|
|
191
|
+
let t2;
|
|
192
|
+
if ($[0] !== t0) {
|
|
193
|
+
({className, sideOffset: t1, collisionPadding: t2, children, ...props} = t0);
|
|
194
|
+
$[0] = t0;
|
|
195
|
+
$[1] = children;
|
|
196
|
+
$[2] = className;
|
|
197
|
+
$[3] = props;
|
|
198
|
+
$[4] = t1;
|
|
199
|
+
$[5] = t2;
|
|
200
|
+
} else {
|
|
201
|
+
children = $[1];
|
|
202
|
+
className = $[2];
|
|
203
|
+
props = $[3];
|
|
204
|
+
t1 = $[4];
|
|
205
|
+
t2 = $[5];
|
|
206
|
+
}
|
|
207
|
+
const sideOffset = t1 === undefined ? TOOLTIP_SIDE_OFFSET_PX : t1;
|
|
208
|
+
const collisionPadding = t2 === undefined ? TOOLTIP_COLLISION_PADDING_PX : t2;
|
|
209
|
+
const openedWhileWarm = React.useContext(TooltipOpenedWhileWarmContext);
|
|
210
|
+
const t3 = props.forceMount;
|
|
211
|
+
let t4;
|
|
212
|
+
if ($[6] !== openedWhileWarm) {
|
|
213
|
+
t4 = () => openedWhileWarm ? TOOLTIP_INSTANT_MOTION : TOOLTIP_MOTION;
|
|
214
|
+
$[6] = openedWhileWarm;
|
|
215
|
+
$[7] = t4;
|
|
216
|
+
} else {
|
|
217
|
+
t4 = $[7];
|
|
218
|
+
}
|
|
219
|
+
let t5;
|
|
220
|
+
if ($[8] !== className) {
|
|
221
|
+
t5 = cn("z-50 inline-flex w-fit max-w-60 origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-(--radius-control) border border-[color-mix(in_oklab,var(--background)_14%,var(--foreground))] bg-foreground px-(--space-4) py-(--space-3) font-sans text-sm leading-(--leading-body) font-normal tracking-(--tracking-body) text-background shadow-(--shadow-raised) has-data-[slot=kbd]:pr-(--space-3) **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm", className);
|
|
222
|
+
$[8] = className;
|
|
223
|
+
$[9] = t5;
|
|
224
|
+
} else {
|
|
225
|
+
t5 = $[9];
|
|
226
|
+
}
|
|
227
|
+
let t6;
|
|
228
|
+
if ($[10] !== children || $[11] !== collisionPadding || $[12] !== props || $[13] !== sideOffset || $[14] !== t5) {
|
|
229
|
+
t6 = /* @__PURE__ */ _jsx(TooltipPrimitive.Content, {
|
|
230
|
+
forceMount: true,
|
|
231
|
+
"data-slot": "tooltip-content",
|
|
232
|
+
sideOffset,
|
|
233
|
+
collisionPadding,
|
|
234
|
+
className: t5,
|
|
235
|
+
...props,
|
|
236
|
+
children
|
|
237
|
+
});
|
|
238
|
+
$[10] = children;
|
|
239
|
+
$[11] = collisionPadding;
|
|
240
|
+
$[12] = props;
|
|
241
|
+
$[13] = sideOffset;
|
|
242
|
+
$[14] = t5;
|
|
243
|
+
$[15] = t6;
|
|
244
|
+
} else {
|
|
245
|
+
t6 = $[15];
|
|
246
|
+
}
|
|
247
|
+
let t7;
|
|
248
|
+
if ($[16] !== t4 || $[17] !== t6) {
|
|
249
|
+
t7 = /* @__PURE__ */ _jsx(ArcFloatingSlot, {
|
|
250
|
+
motion: t4,
|
|
251
|
+
children: t6
|
|
252
|
+
});
|
|
253
|
+
$[16] = t4;
|
|
254
|
+
$[17] = t6;
|
|
255
|
+
$[18] = t7;
|
|
256
|
+
} else {
|
|
257
|
+
t7 = $[18];
|
|
258
|
+
}
|
|
259
|
+
let t8;
|
|
260
|
+
if ($[19] !== props.forceMount || $[20] !== t7) {
|
|
261
|
+
t8 = /* @__PURE__ */ _jsx(TooltipPrimitive.Portal, {
|
|
262
|
+
forceMount: true,
|
|
263
|
+
children: /* @__PURE__ */ _jsx(MotionPresence, {
|
|
264
|
+
scope: "tooltip",
|
|
265
|
+
forceMount: t3,
|
|
266
|
+
children: t7
|
|
267
|
+
})
|
|
268
|
+
});
|
|
269
|
+
$[19] = props.forceMount;
|
|
270
|
+
$[20] = t7;
|
|
271
|
+
$[21] = t8;
|
|
272
|
+
} else {
|
|
273
|
+
t8 = $[21];
|
|
274
|
+
}
|
|
275
|
+
return t8;
|
|
276
|
+
}
|
|
277
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Compact circular progress indicator whose arc inherits the surrounding text color. */
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export interface ProgressRingProps extends Omit<ComponentProps<"svg">, "children"> {
|
|
4
|
+
/** Completion ratio in the `[0, 1]` range; values outside are clamped. */
|
|
5
|
+
fraction: number;
|
|
6
|
+
/** Rendered width and height in pixels. */
|
|
7
|
+
size?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Accessible name. Without it the ring is decorative (`aria-hidden`), which fits when an
|
|
10
|
+
* adjacent label such as `3 / 4` already conveys the value.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Draws a ring whose arc covers `fraction` of the circle. The arc uses `currentColor`, so the
|
|
16
|
+
* parent's text color (for example success or warning) styles it without extra props.
|
|
17
|
+
* @param props - Fraction, size, optional accessible name and SVG attributes.
|
|
18
|
+
* @returns The progress ring.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ProgressRing({ fraction, size, label, className, ...svgProps }: ProgressRingProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
const PROGRESS_RING_VIEWBOX_SIZE = 18;
|
|
4
|
+
const PROGRESS_RING_CENTER = PROGRESS_RING_VIEWBOX_SIZE / 2;
|
|
5
|
+
const PROGRESS_RING_RADIUS = 7;
|
|
6
|
+
const PROGRESS_RING_STROKE_WIDTH = 2.5;
|
|
7
|
+
const PROGRESS_RING_CIRCUMFERENCE = 2 * Math.PI * PROGRESS_RING_RADIUS;
|
|
8
|
+
const DEFAULT_PROGRESS_RING_SIZE_PX = 18;
|
|
9
|
+
/**
|
|
10
|
+
* Draws a ring whose arc covers `fraction` of the circle. The arc uses `currentColor`, so the
|
|
11
|
+
* parent's text color (for example success or warning) styles it without extra props.
|
|
12
|
+
* @param props - Fraction, size, optional accessible name and SVG attributes.
|
|
13
|
+
* @returns The progress ring.
|
|
14
|
+
*/
|
|
15
|
+
export function ProgressRing({ fraction, size = DEFAULT_PROGRESS_RING_SIZE_PX, label, className, ...svgProps }) {
|
|
16
|
+
const clampedFraction = Math.min(Math.max(Number.isFinite(fraction) ? fraction : 0, 0), 1);
|
|
17
|
+
const dashOffset = PROGRESS_RING_CIRCUMFERENCE * (1 - clampedFraction);
|
|
18
|
+
const accessibilityProps = label ? {
|
|
19
|
+
role: "progressbar",
|
|
20
|
+
"aria-label": label,
|
|
21
|
+
"aria-valuemin": 0,
|
|
22
|
+
"aria-valuemax": 100,
|
|
23
|
+
"aria-valuenow": Math.round(clampedFraction * 100)
|
|
24
|
+
} : { "aria-hidden": true };
|
|
25
|
+
return /* @__PURE__ */ _jsxs("svg", {
|
|
26
|
+
"data-slot": "progress-ring",
|
|
27
|
+
...accessibilityProps,
|
|
28
|
+
...svgProps,
|
|
29
|
+
className: cn("shrink-0 -rotate-90", className),
|
|
30
|
+
height: size,
|
|
31
|
+
viewBox: `0 0 ${PROGRESS_RING_VIEWBOX_SIZE} ${PROGRESS_RING_VIEWBOX_SIZE}`,
|
|
32
|
+
width: size,
|
|
33
|
+
children: [/* @__PURE__ */ _jsx("circle", {
|
|
34
|
+
className: "stroke-border/70",
|
|
35
|
+
cx: PROGRESS_RING_CENTER,
|
|
36
|
+
cy: PROGRESS_RING_CENTER,
|
|
37
|
+
fill: "none",
|
|
38
|
+
r: PROGRESS_RING_RADIUS,
|
|
39
|
+
strokeWidth: PROGRESS_RING_STROKE_WIDTH
|
|
40
|
+
}), clampedFraction > 0 ? /* @__PURE__ */ _jsx("circle", {
|
|
41
|
+
"data-slot": "progress-ring-indicator",
|
|
42
|
+
cx: PROGRESS_RING_CENTER,
|
|
43
|
+
cy: PROGRESS_RING_CENTER,
|
|
44
|
+
fill: "none",
|
|
45
|
+
r: PROGRESS_RING_RADIUS,
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeDasharray: PROGRESS_RING_CIRCUMFERENCE,
|
|
48
|
+
strokeDashoffset: dashOffset,
|
|
49
|
+
strokeLinecap: "round",
|
|
50
|
+
strokeWidth: PROGRESS_RING_STROKE_WIDTH
|
|
51
|
+
}) : null]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** One choice of a radio group. */
|
|
2
|
+
export type RadioGroupOption = {
|
|
3
|
+
/** Value reported to `onValueChange` and submitted with the form. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Visible option label, which also names the radio. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Helper copy under the label, linked through `aria-describedby`. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Keeps the option visible but not selectable. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type RadioGroupProps = {
|
|
13
|
+
/** Visible legend of the fieldset, which names the group. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Rows in order. Values double as keys, so keep them unique. */
|
|
16
|
+
options: RadioGroupOption[];
|
|
17
|
+
/** Selected value when controlled. */
|
|
18
|
+
value?: string;
|
|
19
|
+
/** Initial value when uncontrolled; a form reset restores it. */
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
/** Called with the chosen value. */
|
|
22
|
+
onValueChange?: (value: string) => void;
|
|
23
|
+
/** Name the chosen value is submitted under. Generated when omitted. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** Classes for the fieldset. */
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* A choice of one option from a visible set, controlled with `value` or uncontrolled with `defaultValue`.
|
|
30
|
+
* @param props - Legend, options, value, change handler, form name and classes.
|
|
31
|
+
* @returns The fieldset with its legend and option rows.
|
|
32
|
+
*/
|
|
33
|
+
declare function RadioGroup({ label, options, value, defaultValue, onValueChange, name, className }: RadioGroupProps): import("react").JSX.Element;
|
|
34
|
+
export { RadioGroup };
|