@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,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc's Dropdown menu (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a labelled trigger that opens a
|
|
3
|
+
* focused list of actions on Arc's raised panel, with item rows, danger tone, separators, a staggered item entrance
|
|
4
|
+
* and a highlight that glides between items with the keyboard. It follows Arc's closed API: items are data, not
|
|
5
|
+
* children. @astra-kit/ui adds a custom trigger, link, checkbox and radio rows, trailing content, and placement and open
|
|
6
|
+
* state of the menu.
|
|
7
|
+
*/
|
|
8
|
+
import type { ReactElement, ReactNode } from "react";
|
|
9
|
+
import { type DropdownItem, type DropdownItemAttributes, type DropdownMenuSelection } from "./primitives/dropdown-menu-items.js";
|
|
10
|
+
/** Side of the trigger the menu prefers. */
|
|
11
|
+
export type DropdownMenuSide = "top" | "right" | "bottom" | "left";
|
|
12
|
+
/** Alignment of the menu against its trigger. */
|
|
13
|
+
export type DropdownMenuAlign = "start" | "center" | "end";
|
|
14
|
+
export type DropdownMenuProps = {
|
|
15
|
+
/**
|
|
16
|
+
* Text of the trigger Arc draws, and the accessible name of the menu. With a custom `trigger`, it only names the
|
|
17
|
+
* menu.
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/** Rows of the menu, in order. */
|
|
21
|
+
items: DropdownItem[];
|
|
22
|
+
/** Leading icon of the trigger Arc draws. */
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Your own trigger, rendered with `asChild` instead of Arc's labelled button, such as an icon button with its own
|
|
26
|
+
* `aria-label`. It must accept a ref and be focusable.
|
|
27
|
+
*/
|
|
28
|
+
trigger?: ReactElement;
|
|
29
|
+
/** Single selection: rows with a `value` render as radio items checked against `selection.value`. */
|
|
30
|
+
selection?: DropdownMenuSelection;
|
|
31
|
+
/** Preferred side of the trigger. Defaults to `bottom`. */
|
|
32
|
+
side?: DropdownMenuSide;
|
|
33
|
+
/** Alignment against the trigger. Defaults to `start`. */
|
|
34
|
+
align?: DropdownMenuAlign;
|
|
35
|
+
/** Class added to the menu panel. */
|
|
36
|
+
contentClassName?: string;
|
|
37
|
+
/** Accessible name of the menu when it should differ from `label`. */
|
|
38
|
+
contentLabel?: string;
|
|
39
|
+
/** Class added to the trigger Arc draws. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Controlled open state. */
|
|
42
|
+
open?: boolean;
|
|
43
|
+
/** Initial open state when uncontrolled. */
|
|
44
|
+
defaultOpen?: boolean;
|
|
45
|
+
/** Called when the menu opens or closes. */
|
|
46
|
+
onOpenChange?: (open: boolean) => void;
|
|
47
|
+
/** Blocks outside interaction and hides the rest of the page from assistive technology while open. Defaults to `true`. */
|
|
48
|
+
modal?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A focused list of actions anchored to a trigger.
|
|
52
|
+
* @param props - The label, the items and optional trigger, selection, placement and open state.
|
|
53
|
+
* @returns The trigger with its menu.
|
|
54
|
+
*/
|
|
55
|
+
declare function DropdownMenu({ label, items, icon, trigger, selection, side, align, contentClassName, contentLabel, className, open, defaultOpen, onOpenChange, modal, }: DropdownMenuProps): import("react").JSX.Element;
|
|
56
|
+
export { DropdownMenu };
|
|
57
|
+
export type { DropdownItem, DropdownItemAttributes, DropdownMenuSelection };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { DropdownMenu as DropdownMenuRoot, DropdownMenuContent, DropdownMenuTrigger } from "./primitives/dropdown-menu.js";
|
|
7
|
+
import { DropdownMenuItems } from "./primitives/dropdown-menu-items.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* A focused list of actions anchored to a trigger.
|
|
11
|
+
* @param props - The label, the items and optional trigger, selection, placement and open state.
|
|
12
|
+
* @returns The trigger with its menu.
|
|
13
|
+
*/
|
|
14
|
+
function DropdownMenu(t0) {
|
|
15
|
+
const $ = _c(23);
|
|
16
|
+
const { label, items, icon, trigger, selection, side, align, contentClassName, contentLabel, className, open, defaultOpen, onOpenChange, modal } = t0;
|
|
17
|
+
let t1;
|
|
18
|
+
if ($[0] !== className || $[1] !== icon || $[2] !== label || $[3] !== trigger) {
|
|
19
|
+
t1 = trigger ?? /* @__PURE__ */ _jsxs(Button, {
|
|
20
|
+
variant: "secondary",
|
|
21
|
+
className: cn("max-w-full", className),
|
|
22
|
+
children: [
|
|
23
|
+
icon,
|
|
24
|
+
/* @__PURE__ */ _jsx("span", {
|
|
25
|
+
className: "min-w-0 truncate",
|
|
26
|
+
children: label
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ _jsx(ChevronDownIcon, {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
strokeWidth: 1.75,
|
|
31
|
+
className: "text-text-muted"
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
$[0] = className;
|
|
36
|
+
$[1] = icon;
|
|
37
|
+
$[2] = label;
|
|
38
|
+
$[3] = trigger;
|
|
39
|
+
$[4] = t1;
|
|
40
|
+
} else {
|
|
41
|
+
t1 = $[4];
|
|
42
|
+
}
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[5] !== t1) {
|
|
45
|
+
t2 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
|
|
46
|
+
asChild: true,
|
|
47
|
+
children: t1
|
|
48
|
+
});
|
|
49
|
+
$[5] = t1;
|
|
50
|
+
$[6] = t2;
|
|
51
|
+
} else {
|
|
52
|
+
t2 = $[6];
|
|
53
|
+
}
|
|
54
|
+
const t3 = contentLabel ?? label;
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[7] !== items || $[8] !== selection) {
|
|
57
|
+
t4 = /* @__PURE__ */ _jsx(DropdownMenuItems, {
|
|
58
|
+
items,
|
|
59
|
+
selection
|
|
60
|
+
});
|
|
61
|
+
$[7] = items;
|
|
62
|
+
$[8] = selection;
|
|
63
|
+
$[9] = t4;
|
|
64
|
+
} else {
|
|
65
|
+
t4 = $[9];
|
|
66
|
+
}
|
|
67
|
+
let t5;
|
|
68
|
+
if ($[10] !== align || $[11] !== contentClassName || $[12] !== side || $[13] !== t3 || $[14] !== t4) {
|
|
69
|
+
t5 = /* @__PURE__ */ _jsx(DropdownMenuContent, {
|
|
70
|
+
side,
|
|
71
|
+
align,
|
|
72
|
+
className: contentClassName,
|
|
73
|
+
"aria-label": t3,
|
|
74
|
+
"aria-labelledby": undefined,
|
|
75
|
+
children: t4
|
|
76
|
+
});
|
|
77
|
+
$[10] = align;
|
|
78
|
+
$[11] = contentClassName;
|
|
79
|
+
$[12] = side;
|
|
80
|
+
$[13] = t3;
|
|
81
|
+
$[14] = t4;
|
|
82
|
+
$[15] = t5;
|
|
83
|
+
} else {
|
|
84
|
+
t5 = $[15];
|
|
85
|
+
}
|
|
86
|
+
let t6;
|
|
87
|
+
if ($[16] !== defaultOpen || $[17] !== modal || $[18] !== onOpenChange || $[19] !== open || $[20] !== t2 || $[21] !== t5) {
|
|
88
|
+
t6 = /* @__PURE__ */ _jsxs(DropdownMenuRoot, {
|
|
89
|
+
open,
|
|
90
|
+
defaultOpen,
|
|
91
|
+
onOpenChange,
|
|
92
|
+
modal,
|
|
93
|
+
children: [t2, t5]
|
|
94
|
+
});
|
|
95
|
+
$[16] = defaultOpen;
|
|
96
|
+
$[17] = modal;
|
|
97
|
+
$[18] = onOpenChange;
|
|
98
|
+
$[19] = open;
|
|
99
|
+
$[20] = t2;
|
|
100
|
+
$[21] = t5;
|
|
101
|
+
$[22] = t6;
|
|
102
|
+
} else {
|
|
103
|
+
t6 = $[22];
|
|
104
|
+
}
|
|
105
|
+
return t6;
|
|
106
|
+
}
|
|
107
|
+
export { DropdownMenu };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { AriaAttributes, ReactNode } from "react";
|
|
2
|
+
/** Copy that turns a bare control into a labelled field. */
|
|
3
|
+
export type FieldCopyProps = {
|
|
4
|
+
/** Visible label, tied to the control with `htmlFor`. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Helper copy under the control, linked through `aria-describedby`; counts in it roll their digits. */
|
|
7
|
+
description?: string;
|
|
8
|
+
/** Error copy: sets `aria-invalid` and renders in a `role="alert"` row that rewords in place. */
|
|
9
|
+
error?: string;
|
|
10
|
+
};
|
|
11
|
+
type FieldAriaOptions = FieldCopyProps & {
|
|
12
|
+
id?: string;
|
|
13
|
+
"aria-describedby"?: string;
|
|
14
|
+
"aria-invalid"?: AriaAttributes["aria-invalid"];
|
|
15
|
+
};
|
|
16
|
+
/** Ids and ARIA wiring a labelled field passes to its control. */
|
|
17
|
+
export type FieldAria = {
|
|
18
|
+
controlId: string;
|
|
19
|
+
descriptionId: string;
|
|
20
|
+
errorId: string;
|
|
21
|
+
"aria-describedby"?: string;
|
|
22
|
+
"aria-invalid"?: AriaAttributes["aria-invalid"];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the control id (the caller's or a generated one) and merges the helper and error ids into the caller's
|
|
26
|
+
* `aria-describedby`. An error always marks the control invalid.
|
|
27
|
+
* @param options - Field copy and the caller's id and ARIA attributes.
|
|
28
|
+
* @returns The ids and ARIA attributes for the control.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useFieldAria({ id, description, error, ...aria }: FieldAriaOptions): FieldAria;
|
|
31
|
+
/**
|
|
32
|
+
* Tells whether a control renders as a labelled field. It looks at which props were passed, not at their values, so a
|
|
33
|
+
* field whose error or description comes and goes keeps the same tree and its control never remounts (losing an
|
|
34
|
+
* uncontrolled value or the focus) when validation appears.
|
|
35
|
+
* @param props - Props passed to the control.
|
|
36
|
+
* @returns `true` when the caller passed `label`, `description` or `error`, even as `undefined`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function usesFieldCopy(props: FieldCopyProps): boolean;
|
|
39
|
+
type FieldProps = Omit<FieldCopyProps, "label"> & {
|
|
40
|
+
label?: string;
|
|
41
|
+
/** Keeps the label for assistive technology only, for layouts that already show their own label. */
|
|
42
|
+
hideLabel?: boolean;
|
|
43
|
+
aria: FieldAria;
|
|
44
|
+
className?: string;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Arc's field layout: label, control, then the helper and error rows. There is no row gap, because grid tracks clamp
|
|
49
|
+
* a negative margin at zero and a closed row would still pay it; each row carries its own space instead. The wrapper
|
|
50
|
+
* keeps the bare control's full-width contract, so a field fills a flex row like the control alone does.
|
|
51
|
+
*/
|
|
52
|
+
export declare function Field({ label, hideLabel, description, error, aria, className, children }: FieldProps): import("react").JSX.Element;
|
|
53
|
+
export {};
|