@astra-kit/ui 0.0.0-stage → 1.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 +21 -0
- package/LICENSE.md +21 -0
- package/README.md +330 -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 +58 -0
- package/dist/components/dropdown-menu.js +135 -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 +17 -0
- package/dist/constants/dropdown-menu.js +48 -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,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/** Rolls a numeric value vertically when it changes, in the direction of the change. */
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
6
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { SPRING_POP } from "../motion/tokens.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/** Fraction of the line height the digits travel while rolling. */
|
|
11
|
+
const COUNT_ROLL_DISTANCE = "60%";
|
|
12
|
+
const COUNT_ROLL_DISTANCE_INVERTED = "-60%";
|
|
13
|
+
const INCREMENT_DIRECTION = 1;
|
|
14
|
+
const DECREMENT_DIRECTION = -1;
|
|
15
|
+
const COUNT_ROLL_VARIANTS = {
|
|
16
|
+
enter: (direction) => ({
|
|
17
|
+
y: direction > 0 ? COUNT_ROLL_DISTANCE : COUNT_ROLL_DISTANCE_INVERTED,
|
|
18
|
+
opacity: 0
|
|
19
|
+
}),
|
|
20
|
+
center: {
|
|
21
|
+
y: 0,
|
|
22
|
+
opacity: 1
|
|
23
|
+
},
|
|
24
|
+
exit: (direction) => ({
|
|
25
|
+
y: direction > 0 ? COUNT_ROLL_DISTANCE_INVERTED : COUNT_ROLL_DISTANCE,
|
|
26
|
+
opacity: 0
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Renders `value` and animates each change: increments roll up, decrements roll down.
|
|
31
|
+
* With reduced motion the new value replaces the previous one without travel.
|
|
32
|
+
* @param props - Current value, optional formatter and class name.
|
|
33
|
+
* @returns The animated number.
|
|
34
|
+
*/
|
|
35
|
+
export function AnimatedCount(t0) {
|
|
36
|
+
const $ = _c(13);
|
|
37
|
+
const { value, format, className } = t0;
|
|
38
|
+
const [previousValue, setPreviousValue] = useState(value);
|
|
39
|
+
const [direction, setDirection] = useState(INCREMENT_DIRECTION);
|
|
40
|
+
const shouldReduceMotion = usePrefersReducedMotion();
|
|
41
|
+
if (previousValue !== value) {
|
|
42
|
+
setDirection(value > previousValue ? INCREMENT_DIRECTION : DECREMENT_DIRECTION);
|
|
43
|
+
setPreviousValue(value);
|
|
44
|
+
}
|
|
45
|
+
let t1;
|
|
46
|
+
if ($[0] !== format || $[1] !== value) {
|
|
47
|
+
t1 = format ? format(value) : value;
|
|
48
|
+
$[0] = format;
|
|
49
|
+
$[1] = value;
|
|
50
|
+
$[2] = t1;
|
|
51
|
+
} else {
|
|
52
|
+
t1 = $[2];
|
|
53
|
+
}
|
|
54
|
+
const formattedValue = t1;
|
|
55
|
+
let t2;
|
|
56
|
+
if ($[3] !== className) {
|
|
57
|
+
t2 = cn("relative inline-flex overflow-hidden align-bottom tabular-nums", className);
|
|
58
|
+
$[3] = className;
|
|
59
|
+
$[4] = t2;
|
|
60
|
+
} else {
|
|
61
|
+
t2 = $[4];
|
|
62
|
+
}
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[5] !== direction || $[6] !== formattedValue || $[7] !== shouldReduceMotion || $[8] !== value) {
|
|
65
|
+
t3 = shouldReduceMotion ? /* @__PURE__ */ _jsx("span", {
|
|
66
|
+
className: "inline-block",
|
|
67
|
+
children: formattedValue
|
|
68
|
+
}) : /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
69
|
+
initial: false,
|
|
70
|
+
mode: "popLayout",
|
|
71
|
+
custom: direction,
|
|
72
|
+
children: /* @__PURE__ */ _jsx(motion.span, {
|
|
73
|
+
className: "inline-block",
|
|
74
|
+
custom: direction,
|
|
75
|
+
variants: COUNT_ROLL_VARIANTS,
|
|
76
|
+
initial: "enter",
|
|
77
|
+
animate: "center",
|
|
78
|
+
exit: "exit",
|
|
79
|
+
transition: SPRING_POP,
|
|
80
|
+
children: formattedValue
|
|
81
|
+
}, value)
|
|
82
|
+
});
|
|
83
|
+
$[5] = direction;
|
|
84
|
+
$[6] = formattedValue;
|
|
85
|
+
$[7] = shouldReduceMotion;
|
|
86
|
+
$[8] = value;
|
|
87
|
+
$[9] = t3;
|
|
88
|
+
} else {
|
|
89
|
+
t3 = $[9];
|
|
90
|
+
}
|
|
91
|
+
let t4;
|
|
92
|
+
if ($[10] !== t2 || $[11] !== t3) {
|
|
93
|
+
t4 = /* @__PURE__ */ _jsx("span", {
|
|
94
|
+
"data-slot": "animated-count",
|
|
95
|
+
className: t2,
|
|
96
|
+
children: t3
|
|
97
|
+
});
|
|
98
|
+
$[10] = t2;
|
|
99
|
+
$[11] = t3;
|
|
100
|
+
$[12] = t4;
|
|
101
|
+
} else {
|
|
102
|
+
t4 = $[12];
|
|
103
|
+
}
|
|
104
|
+
return t4;
|
|
105
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** List item that enters, leaves and reflows smoothly inside an `AnimatePresence`. */
|
|
2
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
declare const ANIMATED_LIST_ITEM_ELEMENTS: {
|
|
4
|
+
readonly li: import("motion/react").ForwardRefComponent<HTMLLIElement, import("motion/react").HTMLMotionProps<"li">>;
|
|
5
|
+
readonly div: import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>;
|
|
6
|
+
readonly article: import("motion/react").ForwardRefComponent<HTMLElement, import("motion/react").HTMLMotionProps<"article">>;
|
|
7
|
+
};
|
|
8
|
+
/** Native handlers whose names collide with Motion's animation and drag callbacks. */
|
|
9
|
+
type MotionConflictingHandlers = "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "onDrag" | "onDragStart" | "onDragEnd";
|
|
10
|
+
export type AnimatedListItemProps = Omit<HTMLAttributes<HTMLElement>, MotionConflictingHandlers> & {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
as?: keyof typeof ANIMATED_LIST_ITEM_ELEMENTS;
|
|
13
|
+
/** Reflow siblings with a spring when items are added, removed or reordered. */
|
|
14
|
+
layout?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Wrap the list in `<AnimatePresence initial={false}>` so only items added after the
|
|
18
|
+
* first render animate in, and removed items animate out before leaving the DOM.
|
|
19
|
+
* A leaving item turns inert and hidden from assistive technology, so it can no
|
|
20
|
+
* longer be focused, clicked or announced during its exit.
|
|
21
|
+
* @param props - Native attributes, element type and content.
|
|
22
|
+
* @returns The animated item.
|
|
23
|
+
*/
|
|
24
|
+
export declare function AnimatedListItem({ children, as, layout, className, ...elementProps }: AnimatedListItemProps): import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
import { motion, useIsPresent } from "motion/react";
|
|
4
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { ARC_BLUR } from "../motion/arc-tokens.js";
|
|
7
|
+
import { MOTION_EASE, MOTION_EASE_STANDARD, MOTION_TIMING, SPRING_PANEL } from "../motion/tokens.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/** Arc's rows settle 4px into place out of a subtle blur. */
|
|
10
|
+
const LIST_ITEM_RISE_PX = 4;
|
|
11
|
+
const LIST_ITEM_BLUR = `blur(${ARC_BLUR.subtle}px)`;
|
|
12
|
+
const ANIMATED_LIST_ITEM_ELEMENTS = {
|
|
13
|
+
li: motion.li,
|
|
14
|
+
div: motion.div,
|
|
15
|
+
article: motion.article
|
|
16
|
+
};
|
|
17
|
+
/** Arc's rows enter on the standard tween and reorder on the smooth spring, without overshoot. */
|
|
18
|
+
const LIST_ITEM_TRANSITION = {
|
|
19
|
+
duration: MOTION_TIMING.standard,
|
|
20
|
+
ease: MOTION_EASE,
|
|
21
|
+
layout: SPRING_PANEL
|
|
22
|
+
};
|
|
23
|
+
const LIST_ITEM_EXIT_TRANSITION = {
|
|
24
|
+
duration: MOTION_TIMING.exit,
|
|
25
|
+
ease: MOTION_EASE_STANDARD
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Wrap the list in `<AnimatePresence initial={false}>` so only items added after the
|
|
29
|
+
* first render animate in, and removed items animate out before leaving the DOM.
|
|
30
|
+
* A leaving item turns inert and hidden from assistive technology, so it can no
|
|
31
|
+
* longer be focused, clicked or announced during its exit.
|
|
32
|
+
* @param props - Native attributes, element type and content.
|
|
33
|
+
* @returns The animated item.
|
|
34
|
+
*/
|
|
35
|
+
export function AnimatedListItem(t0) {
|
|
36
|
+
const $ = _c(22);
|
|
37
|
+
let children;
|
|
38
|
+
let className;
|
|
39
|
+
let elementProps;
|
|
40
|
+
let t1;
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[0] !== t0) {
|
|
43
|
+
({children, as: t1, layout: t2, className, ...elementProps} = t0);
|
|
44
|
+
$[0] = t0;
|
|
45
|
+
$[1] = children;
|
|
46
|
+
$[2] = className;
|
|
47
|
+
$[3] = elementProps;
|
|
48
|
+
$[4] = t1;
|
|
49
|
+
$[5] = t2;
|
|
50
|
+
} else {
|
|
51
|
+
children = $[1];
|
|
52
|
+
className = $[2];
|
|
53
|
+
elementProps = $[3];
|
|
54
|
+
t1 = $[4];
|
|
55
|
+
t2 = $[5];
|
|
56
|
+
}
|
|
57
|
+
const as = t1 === undefined ? "li" : t1;
|
|
58
|
+
const layout = t2 === undefined ? true : t2;
|
|
59
|
+
const MotionElement = ANIMATED_LIST_ITEM_ELEMENTS[as];
|
|
60
|
+
const isPresent = useIsPresent();
|
|
61
|
+
const shouldReduceMotion = usePrefersReducedMotion();
|
|
62
|
+
const distance = shouldReduceMotion ? 0 : LIST_ITEM_RISE_PX;
|
|
63
|
+
const blur = shouldReduceMotion ? "blur(0px)" : LIST_ITEM_BLUR;
|
|
64
|
+
const t3 = isPresent ? elementProps["aria-hidden"] : true;
|
|
65
|
+
const t4 = !isPresent || undefined;
|
|
66
|
+
let t5;
|
|
67
|
+
if ($[6] !== className) {
|
|
68
|
+
t5 = cn("min-w-0", className);
|
|
69
|
+
$[6] = className;
|
|
70
|
+
$[7] = t5;
|
|
71
|
+
} else {
|
|
72
|
+
t5 = $[7];
|
|
73
|
+
}
|
|
74
|
+
const t6 = layout && !shouldReduceMotion ? "position" : false;
|
|
75
|
+
let t7;
|
|
76
|
+
if ($[8] !== blur || $[9] !== distance) {
|
|
77
|
+
t7 = {
|
|
78
|
+
opacity: 0,
|
|
79
|
+
y: distance,
|
|
80
|
+
filter: blur
|
|
81
|
+
};
|
|
82
|
+
$[8] = blur;
|
|
83
|
+
$[9] = distance;
|
|
84
|
+
$[10] = t7;
|
|
85
|
+
} else {
|
|
86
|
+
t7 = $[10];
|
|
87
|
+
}
|
|
88
|
+
let t8;
|
|
89
|
+
let t9;
|
|
90
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
91
|
+
t8 = {
|
|
92
|
+
opacity: 1,
|
|
93
|
+
y: 0,
|
|
94
|
+
filter: "blur(0px)"
|
|
95
|
+
};
|
|
96
|
+
t9 = {
|
|
97
|
+
opacity: 0,
|
|
98
|
+
transition: LIST_ITEM_EXIT_TRANSITION
|
|
99
|
+
};
|
|
100
|
+
$[11] = t8;
|
|
101
|
+
$[12] = t9;
|
|
102
|
+
} else {
|
|
103
|
+
t8 = $[11];
|
|
104
|
+
t9 = $[12];
|
|
105
|
+
}
|
|
106
|
+
let t10;
|
|
107
|
+
if ($[13] !== MotionElement || $[14] !== children || $[15] !== elementProps || $[16] !== t3 || $[17] !== t4 || $[18] !== t5 || $[19] !== t6 || $[20] !== t7) {
|
|
108
|
+
t10 = /* @__PURE__ */ _jsx(MotionElement, {
|
|
109
|
+
"data-slot": "animated-list-item",
|
|
110
|
+
...elementProps,
|
|
111
|
+
"aria-hidden": t3,
|
|
112
|
+
inert: t4,
|
|
113
|
+
className: t5,
|
|
114
|
+
layout: t6,
|
|
115
|
+
initial: t7,
|
|
116
|
+
animate: t8,
|
|
117
|
+
exit: t9,
|
|
118
|
+
transition: LIST_ITEM_TRANSITION,
|
|
119
|
+
children
|
|
120
|
+
});
|
|
121
|
+
$[13] = MotionElement;
|
|
122
|
+
$[14] = children;
|
|
123
|
+
$[15] = elementProps;
|
|
124
|
+
$[16] = t3;
|
|
125
|
+
$[17] = t4;
|
|
126
|
+
$[18] = t5;
|
|
127
|
+
$[19] = t6;
|
|
128
|
+
$[20] = t7;
|
|
129
|
+
$[21] = t10;
|
|
130
|
+
} else {
|
|
131
|
+
t10 = $[21];
|
|
132
|
+
}
|
|
133
|
+
return t10;
|
|
134
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ThemeMode, ResolvedTheme } from "../theme.js";
|
|
2
|
+
export interface AnimatedThemeTogglerProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated The trigger no longer turns when the theme changes: like Arc's theme switch, only its icon swaps.
|
|
5
|
+
* The value is ignored.
|
|
6
|
+
*/
|
|
7
|
+
duration?: number;
|
|
8
|
+
theme?: ThemeMode;
|
|
9
|
+
resolvedTheme?: ResolvedTheme;
|
|
10
|
+
onThemeChange?: (theme: ThemeMode) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const AnimatedThemeToggler: ({ className, duration: _duration, disabled, theme: controlledTheme, resolvedTheme: controlledResolvedTheme, onThemeChange: controlledOnThemeChange, ...props }: AnimatedThemeTogglerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
import { useSyncExternalStore } from "react";
|
|
4
|
+
import { Monitor, Moon, Sun, SunMoon } from "lucide-react";
|
|
5
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
6
|
+
import { useTheme } from "next-themes";
|
|
7
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "./primitives/dropdown-menu.js";
|
|
8
|
+
import { cn } from "../lib/utils.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const THEME_OPTIONS = [
|
|
11
|
+
{
|
|
12
|
+
icon: Sun,
|
|
13
|
+
label: "Claro",
|
|
14
|
+
value: "light"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
icon: Moon,
|
|
18
|
+
label: "Oscuro",
|
|
19
|
+
value: "dark"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
icon: Monitor,
|
|
23
|
+
label: "Sistema",
|
|
24
|
+
value: "system"
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
export const AnimatedThemeToggler = (t0) => {
|
|
28
|
+
const $ = _c(30);
|
|
29
|
+
let className;
|
|
30
|
+
let controlledOnThemeChange;
|
|
31
|
+
let controlledResolvedTheme;
|
|
32
|
+
let controlledTheme;
|
|
33
|
+
let disabled;
|
|
34
|
+
let props;
|
|
35
|
+
if ($[0] !== t0) {
|
|
36
|
+
const { className: t1, duration: _duration, disabled: t2, theme: t3, resolvedTheme: t4, onThemeChange: t5, ...t6 } = t0;
|
|
37
|
+
className = t1;
|
|
38
|
+
disabled = t2;
|
|
39
|
+
controlledTheme = t3;
|
|
40
|
+
controlledResolvedTheme = t4;
|
|
41
|
+
controlledOnThemeChange = t5;
|
|
42
|
+
props = t6;
|
|
43
|
+
$[0] = t0;
|
|
44
|
+
$[1] = className;
|
|
45
|
+
$[2] = controlledOnThemeChange;
|
|
46
|
+
$[3] = controlledResolvedTheme;
|
|
47
|
+
$[4] = controlledTheme;
|
|
48
|
+
$[5] = disabled;
|
|
49
|
+
$[6] = props;
|
|
50
|
+
} else {
|
|
51
|
+
className = $[1];
|
|
52
|
+
controlledOnThemeChange = $[2];
|
|
53
|
+
controlledResolvedTheme = $[3];
|
|
54
|
+
controlledTheme = $[4];
|
|
55
|
+
disabled = $[5];
|
|
56
|
+
props = $[6];
|
|
57
|
+
}
|
|
58
|
+
const providerTheme = useTheme();
|
|
59
|
+
const theme = controlledTheme ?? providerTheme.theme;
|
|
60
|
+
const resolvedTheme = controlledResolvedTheme ?? providerTheme.resolvedTheme;
|
|
61
|
+
const onThemeChange = controlledOnThemeChange ?? providerTheme.setTheme;
|
|
62
|
+
const isHydrated = useSyncExternalStore(_temp2, _temp3, _temp4);
|
|
63
|
+
const isThemeReady = isHydrated && (resolvedTheme === "light" || resolvedTheme === "dark");
|
|
64
|
+
const isDark = resolvedTheme === "dark";
|
|
65
|
+
const selectedTheme = theme === "light" || theme === "dark" || theme === "system" ? theme : "system";
|
|
66
|
+
const isDisabled = !isThemeReady || disabled;
|
|
67
|
+
let t1;
|
|
68
|
+
if ($[7] !== isDisabled || $[8] !== onThemeChange) {
|
|
69
|
+
t1 = (nextTheme) => {
|
|
70
|
+
if (isDisabled) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
onThemeChange(nextTheme);
|
|
74
|
+
};
|
|
75
|
+
$[7] = isDisabled;
|
|
76
|
+
$[8] = onThemeChange;
|
|
77
|
+
$[9] = t1;
|
|
78
|
+
} else {
|
|
79
|
+
t1 = $[9];
|
|
80
|
+
}
|
|
81
|
+
const selectTheme = t1;
|
|
82
|
+
let t2;
|
|
83
|
+
if ($[10] !== className) {
|
|
84
|
+
t2 = cn(className);
|
|
85
|
+
$[10] = className;
|
|
86
|
+
$[11] = t2;
|
|
87
|
+
} else {
|
|
88
|
+
t2 = $[11];
|
|
89
|
+
}
|
|
90
|
+
let t3;
|
|
91
|
+
if ($[12] !== isDark || $[13] !== isThemeReady) {
|
|
92
|
+
t3 = !isThemeReady ? /* @__PURE__ */ _jsx(SunMoon, { "aria-hidden": "true" }) : /* @__PURE__ */ _jsx(MotionSlot, {
|
|
93
|
+
kind: "icon-swap",
|
|
94
|
+
children: isDark ? /* @__PURE__ */ _jsx(Moon, { "aria-hidden": "true" }) : /* @__PURE__ */ _jsx(Sun, { "aria-hidden": "true" })
|
|
95
|
+
}, isDark ? "dark" : "light");
|
|
96
|
+
$[12] = isDark;
|
|
97
|
+
$[13] = isThemeReady;
|
|
98
|
+
$[14] = t3;
|
|
99
|
+
} else {
|
|
100
|
+
t3 = $[14];
|
|
101
|
+
}
|
|
102
|
+
let t4;
|
|
103
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
+
t4 = /* @__PURE__ */ _jsx("span", {
|
|
105
|
+
className: "sr-only",
|
|
106
|
+
children: "Alternar tema"
|
|
107
|
+
});
|
|
108
|
+
$[15] = t4;
|
|
109
|
+
} else {
|
|
110
|
+
t4 = $[15];
|
|
111
|
+
}
|
|
112
|
+
let t5;
|
|
113
|
+
if ($[16] !== isDisabled || $[17] !== props || $[18] !== t2 || $[19] !== t3) {
|
|
114
|
+
t5 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
|
|
115
|
+
asChild: true,
|
|
116
|
+
children: /* @__PURE__ */ _jsxs("button", {
|
|
117
|
+
type: "button",
|
|
118
|
+
disabled: isDisabled,
|
|
119
|
+
className: t2,
|
|
120
|
+
...props,
|
|
121
|
+
children: [t3, t4]
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
$[16] = isDisabled;
|
|
125
|
+
$[17] = props;
|
|
126
|
+
$[18] = t2;
|
|
127
|
+
$[19] = t3;
|
|
128
|
+
$[20] = t5;
|
|
129
|
+
} else {
|
|
130
|
+
t5 = $[20];
|
|
131
|
+
}
|
|
132
|
+
let t6;
|
|
133
|
+
if ($[21] !== selectTheme) {
|
|
134
|
+
t6 = (nextTheme_0) => {
|
|
135
|
+
selectTheme(nextTheme_0);
|
|
136
|
+
};
|
|
137
|
+
$[21] = selectTheme;
|
|
138
|
+
$[22] = t6;
|
|
139
|
+
} else {
|
|
140
|
+
t6 = $[22];
|
|
141
|
+
}
|
|
142
|
+
let t7;
|
|
143
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
144
|
+
t7 = THEME_OPTIONS.map(_temp5);
|
|
145
|
+
$[23] = t7;
|
|
146
|
+
} else {
|
|
147
|
+
t7 = $[23];
|
|
148
|
+
}
|
|
149
|
+
let t8;
|
|
150
|
+
if ($[24] !== selectedTheme || $[25] !== t6) {
|
|
151
|
+
t8 = /* @__PURE__ */ _jsx(DropdownMenuContent, {
|
|
152
|
+
"data-astra-theme-menu": true,
|
|
153
|
+
align: "end",
|
|
154
|
+
className: "w-44 rounded-xl p-2",
|
|
155
|
+
side: "bottom",
|
|
156
|
+
sideOffset: 8,
|
|
157
|
+
children: /* @__PURE__ */ _jsx(DropdownMenuRadioGroup, {
|
|
158
|
+
onValueChange: t6,
|
|
159
|
+
value: selectedTheme,
|
|
160
|
+
children: t7
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
$[24] = selectedTheme;
|
|
164
|
+
$[25] = t6;
|
|
165
|
+
$[26] = t8;
|
|
166
|
+
} else {
|
|
167
|
+
t8 = $[26];
|
|
168
|
+
}
|
|
169
|
+
let t9;
|
|
170
|
+
if ($[27] !== t5 || $[28] !== t8) {
|
|
171
|
+
t9 = /* @__PURE__ */ _jsxs(DropdownMenu, { children: [t5, t8] });
|
|
172
|
+
$[27] = t5;
|
|
173
|
+
$[28] = t8;
|
|
174
|
+
$[29] = t9;
|
|
175
|
+
} else {
|
|
176
|
+
t9 = $[29];
|
|
177
|
+
}
|
|
178
|
+
return t9;
|
|
179
|
+
};
|
|
180
|
+
function _temp() {}
|
|
181
|
+
function _temp2() {
|
|
182
|
+
return _temp;
|
|
183
|
+
}
|
|
184
|
+
function _temp3() {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
function _temp4() {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
function _temp5(t0) {
|
|
191
|
+
const { icon: Icon, label, value } = t0;
|
|
192
|
+
return /* @__PURE__ */ _jsxs(DropdownMenuRadioItem, {
|
|
193
|
+
className: "h-11 gap-3 px-3 pr-9 text-base",
|
|
194
|
+
value,
|
|
195
|
+
children: [/* @__PURE__ */ _jsx(Icon, {
|
|
196
|
+
"aria-hidden": "true",
|
|
197
|
+
className: "size-5"
|
|
198
|
+
}), /* @__PURE__ */ _jsx("span", { children: label })]
|
|
199
|
+
}, value);
|
|
200
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import type { AvatarGroupSize, AvatarSize, AvatarStatus } from "../constants/avatar.js";
|
|
3
|
+
export type { AvatarGroupSize, AvatarSize, AvatarStatus };
|
|
4
|
+
export type AvatarProps = Omit<ComponentProps<"span">, "children"> & {
|
|
5
|
+
/** Full name: the accessible name of the avatar and the source of its first two initials. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Photo URL, rendered through the provider's `Image` adapter. Falls back to the initials if it fails to load. */
|
|
8
|
+
src?: string | null;
|
|
9
|
+
/** Diameter: 24px (`sm`), 32px (`md`, default), 40px (`lg`) or Arc's 88px profile size (`xl`). */
|
|
10
|
+
size?: AvatarSize;
|
|
11
|
+
/** Adds a presence dot and appends the presence to the accessible name. */
|
|
12
|
+
status?: AvatarStatus;
|
|
13
|
+
/** Presence text appended to the accessible name; defaults to "En línea" or "Desconectado". */
|
|
14
|
+
statusLabel?: string;
|
|
15
|
+
/** Replaces the initials, for example with an icon. */
|
|
16
|
+
fallback?: ReactNode;
|
|
17
|
+
/** A custom corner badge; the presence dot moves to the top corner while it is shown. */
|
|
18
|
+
badge?: ReactNode;
|
|
19
|
+
/** Accessible text to use instead of `name`, when the photo needs a different description. */
|
|
20
|
+
alt?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A round portrait for one person, with initials as fallback and an optional presence dot.
|
|
24
|
+
* @param props - Name, photo, size, presence, optional fallback and badge, plus native span attributes for the root.
|
|
25
|
+
* @returns The avatar, announced as one image.
|
|
26
|
+
*/
|
|
27
|
+
declare function Avatar({ name, src, size, status, statusLabel, fallback, badge, alt, ...props }: AvatarProps): import("react").JSX.Element;
|
|
28
|
+
/** One person of an avatar group. */
|
|
29
|
+
export type AvatarGroupMember = {
|
|
30
|
+
/** Full name, shown on hover and used as the avatar's accessible name. */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Photo URL. */
|
|
33
|
+
src?: string | null;
|
|
34
|
+
/** Presence dot of the avatar. */
|
|
35
|
+
status?: AvatarStatus;
|
|
36
|
+
/** Stable key for members that share a name; defaults to `name`. */
|
|
37
|
+
key?: string;
|
|
38
|
+
};
|
|
39
|
+
export type AvatarGroupProps = Omit<ComponentProps<"div">, "children" | "role" | "aria-label"> & {
|
|
40
|
+
/**
|
|
41
|
+
* People in display order. Pass the whole list and let `max` collapse the rest, or a preview of it together with
|
|
42
|
+
* `total`.
|
|
43
|
+
*/
|
|
44
|
+
members: AvatarGroupMember[];
|
|
45
|
+
/**
|
|
46
|
+
* How many people the group has when `members` is only a preview of them. When it is larger than
|
|
47
|
+
* `members.length`, the +N chip counts the people left out against it. Defaults to `members.length`.
|
|
48
|
+
*/
|
|
49
|
+
total?: number;
|
|
50
|
+
/** Avatars shown before the rest collapse into the overflow count. */
|
|
51
|
+
max?: number;
|
|
52
|
+
/** Size of each avatar and of the overflow chip. */
|
|
53
|
+
size?: AvatarGroupSize;
|
|
54
|
+
/** Accessible name of the group, also used in the overflow label; defaults to "Integrantes". */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** Classes for the group. Native attributes such as `aria-hidden`, `style` or `data-*` also go to the root. */
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* An overlapping stack of avatars with a +N overflow chip.
|
|
61
|
+
* @param props - Members, optional total, how many to show, size, accessible label, classes and native root attributes.
|
|
62
|
+
* @returns The group.
|
|
63
|
+
*/
|
|
64
|
+
declare function AvatarGroup({ members, total, max, size, label, className, style, ...props }: AvatarGroupProps): import("react").JSX.Element;
|
|
65
|
+
export { Avatar, AvatarGroup };
|