@vamos-ui/react 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/blocks/block-heading.js +1 -1
- package/dist/blocks/block-link.js +1 -1
- package/dist/blocks/index.d.ts +3 -3
- package/dist/blocks/index.js +3 -3
- package/dist/blocks/labels.d.ts +8 -0
- package/dist/blocks/labels.js +60 -0
- package/dist/blocks/section-header.js +1 -1
- package/dist/blocks/section.js +2 -2
- package/dist/blocks/site/feature-tabs.js +1 -1
- package/dist/blocks/site/footer.d.ts +10 -1
- package/dist/blocks/site/footer.js +28 -4
- package/dist/blocks/site/registry-2.js +3 -1
- package/dist/blocks/site/shared/labels-2.d.ts +8 -0
- package/dist/blocks/site/shared/labels-2.js +808 -0
- package/dist/blocks/site/site-shell.js +3 -3
- package/dist/business/approval-flow.js +2 -2
- package/dist/business/import-wizard.js +1 -1
- package/dist/business/line-items.js +1 -1
- package/dist/business/multi-step-form.js +2 -2
- package/dist/business/permission-matrix.js +1 -1
- package/dist/business/setup-checklist.js +2 -2
- package/dist/business/signer-status.js +1 -1
- package/dist/charts/bar-list.js +1 -1
- package/dist/charts/chart-shell.js +1 -1
- package/dist/charts/donut-chart.js +1 -1
- package/dist/charts/funnel.js +1 -1
- package/dist/charts/gauge.js +2 -2
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +8 -8
- package/dist/components/activity-timeline.js +6 -6
- package/dist/components/address-field.js +3 -3
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +8 -8
- package/dist/components/alert.js +2 -2
- package/dist/components/app-shell.js +3 -3
- package/dist/components/aspect-ratio.js +2 -2
- package/dist/components/attachment-list.js +2 -2
- package/dist/components/audit-log.js +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/avatar.js +8 -8
- package/dist/components/backup-codes.js +1 -1
- package/dist/components/badge.js +3 -3
- package/dist/components/breadcrumb.js +10 -9
- package/dist/components/button-group.js +4 -4
- package/dist/components/button.js +4 -4
- package/dist/components/calendar.js +5 -5
- package/dist/components/card.js +8 -8
- package/dist/components/carousel.js +9 -9
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +6 -6
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +4 -4
- package/dist/components/color-picker.js +3 -3
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.js +9 -9
- package/dist/components/comment-thread.js +3 -3
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.js +9 -9
- package/dist/components/currency-input.js +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/description-list.js +2 -2
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +9 -9
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.js +9 -9
- package/dist/components/editor-layout.js +9 -9
- package/dist/components/empty-state.js +2 -2
- package/dist/components/entity-card.js +1 -1
- package/dist/components/file-upload.js +5 -5
- package/dist/components/formatted-input.js +3 -3
- package/dist/components/hierarchy-chart.js +1 -1
- package/dist/components/hover-card.d.ts +1 -1
- package/dist/components/hover-card.js +3 -3
- package/dist/components/iban-input.js +1 -1
- package/dist/components/id-input.js +3 -3
- package/dist/components/image.js +5 -5
- package/dist/components/input-otp.js +6 -6
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +6 -6
- package/dist/components/item.js +4 -4
- package/dist/components/kbd.js +3 -3
- package/dist/components/list-layout.js +9 -9
- package/dist/components/menubar.d.ts +1 -1
- package/dist/components/menubar.js +12 -12
- package/dist/components/native-select.js +1 -1
- package/dist/components/navigation-menu.d.ts +1 -1
- package/dist/components/navigation-menu.js +12 -11
- package/dist/components/notification-center.js +4 -4
- package/dist/components/page-header.js +3 -3
- package/dist/components/pagination.js +9 -9
- package/dist/components/phone-input.js +1 -1
- package/dist/components/pin-map.js +1 -1
- package/dist/components/placeholder-art.js +1 -1
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +7 -7
- package/dist/components/progress.js +3 -3
- package/dist/components/qr-code.js +1 -1
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/radio-group.js +4 -4
- package/dist/components/record-detail-layout.js +10 -10
- package/dist/components/record-picker.js +2 -2
- package/dist/components/resizable.js +2 -2
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area.js +4 -4
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +10 -10
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -3
- package/dist/components/settings-layout.js +6 -6
- package/dist/components/sheet.js +3 -3
- package/dist/components/sidebar.js +12 -11
- package/dist/components/signature-pad.js +1 -1
- package/dist/components/skeleton.js +5 -5
- package/dist/components/sla-timer.js +2 -2
- package/dist/components/slider.d.ts +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slug-input.js +1 -1
- package/dist/components/sparkline.js +1 -1
- package/dist/components/spinner.js +2 -2
- package/dist/components/stat.js +5 -5
- package/dist/components/status-picker.js +2 -2
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +3 -3
- package/dist/components/table.js +10 -10
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +11 -11
- package/dist/components/tag-input.js +1 -1
- package/dist/components/task-list.js +1 -1
- package/dist/components/time-picker.js +3 -3
- package/dist/components/toggle.d.ts +2 -1
- package/dist/components/toggle.js +7 -6
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +5 -4
- package/dist/components/top-bar.js +4 -4
- package/dist/components/tour.js +1 -1
- package/dist/components/tree-select.js +2 -2
- package/dist/components/tree-view.js +3 -3
- package/dist/components/typography.js +11 -11
- package/dist/components/user-picker.js +2 -2
- package/dist/components/version-history.js +3 -3
- package/dist/data-table/data-table.js +1 -1
- package/dist/data-table/filter-bar.js +2 -2
- package/dist/data-table/index.d.ts +15 -8
- package/dist/data-table/index.js +9 -8
- package/dist/data-table/saved-views.js +1 -1
- package/dist/editor/block-editor.js +1 -1
- package/dist/editor/context.js +1 -1
- package/dist/editor/menus.js +1 -1
- package/dist/fonts/font-picker.js +3 -3
- package/dist/fonts/pairing-picker.js +1 -1
- package/dist/fonts/provider.js +1 -1
- package/dist/index.d.ts +188 -94
- package/dist/index.js +94 -94
- package/dist/lib/data-islands.js +1 -1
- package/dist/lib/field-context.js +1 -1
- package/dist/lib/floating-arrow.js +1 -1
- package/dist/lib/islands.js +1 -1
- package/dist/lib/layer.js +3 -3
- package/dist/lib/locale.js +2 -2
- package/dist/lib/menu.js +2 -2
- package/dist/lib/provider.js +4 -4
- package/dist/lib/theme-scope.js +4 -3
- package/dist/lib/variants.js +2 -2
- package/dist/media/focal-point.js +1 -1
- package/dist/media/gallery.js +1 -1
- package/dist/media/image-cropper.js +1 -1
- package/dist/media/image-field.js +2 -2
- package/dist/media/lightbox.js +4 -3
- package/dist/media/link-preview.js +3 -3
- package/dist/media/media-library.js +3 -3
- package/dist/media/media-picker.js +1 -1
- package/dist/media/media-provider.js +1 -1
- package/dist/media/video-player.js +4 -4
- package/dist/motion/count-up.js +1 -1
- package/dist/motion/motion-scope.js +2 -2
- package/dist/motion/page-transition.js +1 -1
- package/dist/motion/parallax.js +2 -2
- package/dist/motion/pointer.js +3 -3
- package/dist/motion/reveal.js +3 -3
- package/dist/motion/skeleton-swap.js +1 -1
- package/dist/motion/text-reveal.js +1 -1
- package/dist/motion/ticker.js +1 -1
- package/dist/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/dist/scheduler/gantt.js +2 -2
- package/dist/scheduler/resource-calendar.js +2 -2
- package/dist/scheduler/scheduler.js +3 -3
- package/dist/scheduler/time-tracker.js +4 -4
- package/dist/sortable/kanban.js +2 -2
- package/dist/sortable/sortable-list.js +2 -2
- package/dist/sortable/sortable.js +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as ContextMenuPrimitive from "radix-ui/context-menu";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { usePortalContainer } from "../lib/theme-scope.js";
|
|
7
7
|
import { Layer } from "../lib/layer.js";
|
|
@@ -12,34 +12,34 @@ export const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
|
12
12
|
export const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
13
13
|
export const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
14
14
|
/** The menu panel, opened at the pointer. Portals into the nearest `ThemeScope`. */
|
|
15
|
-
export const ContextMenuContent = React.forwardRef(function ContextMenuContent({ className, size = "md", collisionPadding = 12, ...props }, ref) {
|
|
15
|
+
export const ContextMenuContent = /*#__PURE__*/ React.forwardRef(function ContextMenuContent({ className, size = "md", collisionPadding = 12, ...props }, ref) {
|
|
16
16
|
const container = usePortalContainer();
|
|
17
17
|
return (_jsx(ContextMenuPrimitive.Portal, { container: container, children: _jsx(MenuSizeContext.Provider, { value: size, children: _jsx(Layer, { asChild: true, children: _jsx(ContextMenuPrimitive.Content, { ref: ref, "data-slot": "context-menu-content", collisionPadding: collisionPadding, className: cn(menuContentVariants({ size }), "max-h-(--radix-context-menu-content-available-height)", className), ...props }) }) }) }));
|
|
18
18
|
});
|
|
19
19
|
/** One action. Same API as `DropdownMenuItem`. */
|
|
20
|
-
export const ContextMenuItem = React.forwardRef(function ContextMenuItem({ className, icon, description, shortcut, badge, tone = "default", inset, asChild, children, ...props }, ref) {
|
|
20
|
+
export const ContextMenuItem = /*#__PURE__*/ React.forwardRef(function ContextMenuItem({ className, icon, description, shortcut, badge, tone = "default", inset, asChild, children, ...props }, ref) {
|
|
21
21
|
const size = React.useContext(MenuSizeContext);
|
|
22
22
|
return (_jsx(ContextMenuPrimitive.Item, { ref: ref, "data-slot": "context-menu-item", "data-tone": tone, asChild: asChild, className: menuItemClass({ size, tone, inset, className }), ...props, children: asChild ? (children) : (_jsx(MenuItemContent, { icon: icon, description: description, shortcut: shortcut, badge: badge, children: children })) }));
|
|
23
23
|
});
|
|
24
|
-
export const ContextMenuCheckboxItem = React.forwardRef(function ContextMenuCheckboxItem({ className, shortcut, description, children, ...props }, ref) {
|
|
24
|
+
export const ContextMenuCheckboxItem = /*#__PURE__*/ React.forwardRef(function ContextMenuCheckboxItem({ className, shortcut, description, children, ...props }, ref) {
|
|
25
25
|
const size = React.useContext(MenuSizeContext);
|
|
26
26
|
return (_jsxs(ContextMenuPrimitive.CheckboxItem, { ref: ref, "data-slot": "context-menu-checkbox-item", className: menuItemClass({ size, inset: true, className }), ...props, children: [_jsx("span", { className: menuIndicatorClass, children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(MenuCheckIcon, {}) }) }), _jsx(MenuItemContent, { shortcut: shortcut, description: description, children: children })] }));
|
|
27
27
|
});
|
|
28
|
-
export const ContextMenuRadioItem = React.forwardRef(function ContextMenuRadioItem({ className, shortcut, description, children, ...props }, ref) {
|
|
28
|
+
export const ContextMenuRadioItem = /*#__PURE__*/ React.forwardRef(function ContextMenuRadioItem({ className, shortcut, description, children, ...props }, ref) {
|
|
29
29
|
const size = React.useContext(MenuSizeContext);
|
|
30
30
|
return (_jsxs(ContextMenuPrimitive.RadioItem, { ref: ref, "data-slot": "context-menu-radio-item", className: menuItemClass({ size, inset: true, className }), ...props, children: [_jsx("span", { className: menuIndicatorClass, children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(MenuRadioDot, {}) }) }), _jsx(MenuItemContent, { shortcut: shortcut, description: description, children: children })] }));
|
|
31
31
|
});
|
|
32
|
-
export const ContextMenuLabel = React.forwardRef(function ContextMenuLabel({ className, inset, ...props }, ref) {
|
|
32
|
+
export const ContextMenuLabel = /*#__PURE__*/ React.forwardRef(function ContextMenuLabel({ className, inset, ...props }, ref) {
|
|
33
33
|
return _jsx(ContextMenuPrimitive.Label, { ref: ref, "data-slot": "context-menu-label", className: cn(menuLabelClass, inset && "ps-8", className), ...props });
|
|
34
34
|
});
|
|
35
|
-
export const ContextMenuSeparator = React.forwardRef(function ContextMenuSeparator({ className, ...props }, ref) {
|
|
35
|
+
export const ContextMenuSeparator = /*#__PURE__*/ React.forwardRef(function ContextMenuSeparator({ className, ...props }, ref) {
|
|
36
36
|
return _jsx(ContextMenuPrimitive.Separator, { ref: ref, "data-slot": "context-menu-separator", className: cn(menuSeparatorClass, className), ...props });
|
|
37
37
|
});
|
|
38
|
-
export const ContextMenuSubTrigger = React.forwardRef(function ContextMenuSubTrigger({ className, icon, inset, children, ...props }, ref) {
|
|
38
|
+
export const ContextMenuSubTrigger = /*#__PURE__*/ React.forwardRef(function ContextMenuSubTrigger({ className, icon, inset, children, ...props }, ref) {
|
|
39
39
|
const size = React.useContext(MenuSizeContext);
|
|
40
40
|
return (_jsx(ContextMenuPrimitive.SubTrigger, { ref: ref, "data-slot": "context-menu-sub-trigger", className: menuItemClass({ size, inset, className: cn("data-[state=open]:bg-hover", className) }), ...props, children: _jsx(MenuItemContent, { icon: icon, chevron: true, children: children }) }));
|
|
41
41
|
});
|
|
42
|
-
export const ContextMenuSubContent = React.forwardRef(function ContextMenuSubContent({ className, size: sizeProp, sideOffset = 4, collisionPadding = 12, ...props }, ref) {
|
|
42
|
+
export const ContextMenuSubContent = /*#__PURE__*/ React.forwardRef(function ContextMenuSubContent({ className, size: sizeProp, sideOffset = 4, collisionPadding = 12, ...props }, ref) {
|
|
43
43
|
const container = usePortalContainer();
|
|
44
44
|
const parentSize = React.useContext(MenuSizeContext);
|
|
45
45
|
const size = sizeProp ?? parentSize;
|
|
@@ -32,7 +32,7 @@ export function currencyAffix(locale, currency, display = "narrowSymbol") {
|
|
|
32
32
|
* <CurrencyInput currency="TRY" min="0.01" align="end" onValueChange={(v) => setAmount(v)} />
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
export const CurrencyInput = React.forwardRef(function CurrencyInput(props, forwardedRef) {
|
|
35
|
+
export const CurrencyInput = /*#__PURE__*/ React.forwardRef(function CurrencyInput(props, forwardedRef) {
|
|
36
36
|
const { currency: currencyProp, precision: precisionProp, min, max, allowNegative = false, currencyDisplay = "narrowSymbol", symbol, align = "start", value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono, labels, name, invalid, leading, trailing, inputClassName, onBlur, onKeyDown, disabled, ...rest } = props;
|
|
37
37
|
const { locale, currency: providerCurrency, format: f } = useLocale();
|
|
38
38
|
const currency = (currencyProp ?? providerCurrency).toUpperCase();
|
|
@@ -119,7 +119,7 @@ const iconButton = "inline-flex size-[calc(var(--control-h)-0.75rem)] shrink-0 i
|
|
|
119
119
|
* <DatePicker trigger="button" placeholder="Any date" clearable />
|
|
120
120
|
* ```
|
|
121
121
|
*/
|
|
122
|
-
export const DatePicker = React.forwardRef(function DatePicker(rawProps, forwardedRef) {
|
|
122
|
+
export const DatePicker = /*#__PURE__*/ React.forwardRef(function DatePicker(rawProps, forwardedRef) {
|
|
123
123
|
const { value: valueProp, defaultValue, onValueChange, trigger = "input", displayFormat = "long", placeholder, min, max, disabledDays, clearable, showToday = true, name, size = "md", invalid, align = "start", open: openProp, defaultOpen, onOpenChange, onInputError, calendarProps, className, labels, calendarLabels, onBlur, ...rest } = rawProps;
|
|
124
124
|
const control = useFieldControl({ ...rest, "aria-invalid": invalid ? true : undefined });
|
|
125
125
|
const t = useLabels("datePicker", datePickerLabels, labels);
|
|
@@ -208,7 +208,7 @@ function zoneLabel(timeZone, locale) {
|
|
|
208
208
|
* <DateTimePicker value={publishAt} onValueChange={setPublishAt} timeZone="Europe/Istanbul" />
|
|
209
209
|
* ```
|
|
210
210
|
*/
|
|
211
|
-
export const DateTimePicker = React.forwardRef(function DateTimePicker({ value: valueProp, defaultValue, onValueChange, defaultTime = "09:00", step = 15, hourCycle, minTime, maxTime, timeZone, name, timeLabels, labels, className, size = "md", ...dateProps }, ref) {
|
|
211
|
+
export const DateTimePicker = /*#__PURE__*/ React.forwardRef(function DateTimePicker({ value: valueProp, defaultValue, onValueChange, defaultTime = "09:00", step = 15, hourCycle, minTime, maxTime, timeZone, name, timeLabels, labels, className, size = "md", ...dateProps }, ref) {
|
|
212
212
|
const t = useLabels("datePicker", datePickerLabels, labels);
|
|
213
213
|
const { locale } = useLocale();
|
|
214
214
|
const field = useFieldContext();
|
|
@@ -51,7 +51,7 @@ const sameRange = (a, b) => (a?.from ?? null) === (b?.from ?? null) && (a?.to ??
|
|
|
51
51
|
* <DateRangePicker commit="apply" maxDays={31} min={todayIso()} />
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
export const DateRangePicker = React.forwardRef(function DateRangePicker(rawProps, ref) {
|
|
54
|
+
export const DateRangePicker = /*#__PURE__*/ React.forwardRef(function DateRangePicker(rawProps, ref) {
|
|
55
55
|
const { value: valueProp, defaultValue, onValueChange, presets: presetsProp = false, numberOfMonths = 2, commit = "immediate", minDays, maxDays, min, max, disabledDays, excludeDisabled, trigger = "button", nameFrom, nameTo, placeholder, clearable, size = "md", invalid, align = "start", open: openProp, defaultOpen, onOpenChange, onInputError, calendarProps, className, labels, inputLabels, calendarLabels, ...rest } = rawProps;
|
|
56
56
|
const control = useFieldControl({ ...rest, "aria-invalid": invalid ? true : undefined });
|
|
57
57
|
const t = useLabels("dateRangePicker", dateRangePickerLabels, labels);
|
|
@@ -17,7 +17,7 @@ const gridCols = { 1: "", 2: "@lg/dl:grid-cols-2", 3: "@lg/dl:grid-cols-2 @3xl/d
|
|
|
17
17
|
* ]} />
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
export const DescriptionList = React.forwardRef(function DescriptionList({ items, layout = "horizontal", columns = 2, labelWidth, divided, size = "md", emptyValue, onEdit, loading, labels, className, style, children, ...props }, ref) {
|
|
20
|
+
export const DescriptionList = /*#__PURE__*/ React.forwardRef(function DescriptionList({ items, layout = "horizontal", columns = 2, labelWidth, divided, size = "md", emptyValue, onEdit, loading, labels, className, style, children, ...props }, ref) {
|
|
21
21
|
const isDivided = divided ?? layout === "horizontal";
|
|
22
22
|
const rows = loading ? (Array.from({ length: typeof loading === "number" ? loading : 4 }, (_, i) => (_jsxs("div", { "data-slot": "description-item", "aria-hidden": true, className: "ui-dl-row", children: [_jsx("dt", { children: _jsx(Skeleton, { shape: "text", className: "h-3 w-20" }) }), _jsx("dd", { children: _jsx(Skeleton, { shape: "text", className: "h-3", style: { width: `${70 - ((i * 13) % 35)}%` } }) })] }, i)))) : items ? (items.map((it) => (_jsx(DescriptionItem, { label: it.label, hint: it.hint, span: it.span, copyable: it.copyable, emptyValue: emptyValue, labels: labels, edit: it.editable && onEdit ? (_jsx(DescriptionEditable, { value: it.editValue ?? (typeof it.value === "string" || typeof it.value === "number" ? String(it.value) : ""), display: renderValue(it.value, it.format), label: typeof it.label === "string" ? it.label : it.key, inputType: it.inputType, labels: labels, onSave: (v) => onEdit(it.key, v) })) : undefined, children: renderValue(it.value, it.format) }, it.key)))) : (children);
|
|
23
23
|
return (_jsx("dl", { ref: ref, "data-slot": "description-list", "data-layout": layout, "data-divided": isDivided ? "" : undefined, "data-size": size, "aria-busy": loading ? true : undefined, className: cn("ui-dl @container/dl m-0 grid min-w-0", size === "sm" ? "text-[12.5px]" : "text-[13px]", layout === "grid" ? cn("grid-cols-1 gap-x-6 gap-y-4", gridCols[columns]) : null, className), style: labelWidth ? { ["--dl-label-w"]: labelWidth, ...style } : style, ...props, children: rows }));
|
|
@@ -29,7 +29,7 @@ function renderValue(value, format) {
|
|
|
29
29
|
}
|
|
30
30
|
const isEmpty = (v) => v === null || v === undefined || v === "" || v === false;
|
|
31
31
|
/** One label/value pair (`<div><dt/><dd/></div>`). */
|
|
32
|
-
export const DescriptionItem = React.forwardRef(function DescriptionItem({ label, children, hint, copyable, span, emptyValue, edit, action, labels, className, ...props }, ref) {
|
|
32
|
+
export const DescriptionItem = /*#__PURE__*/ React.forwardRef(function DescriptionItem({ label, children, hint, copyable, span, emptyValue, edit, action, labels, className, ...props }, ref) {
|
|
33
33
|
const empty = isEmpty(children);
|
|
34
34
|
const copyText = typeof copyable === "string" ? copyable : copyable && (typeof children === "string" || typeof children === "number") ? String(children) : undefined;
|
|
35
35
|
const labelText = typeof label === "string" ? label : "value";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as DialogPrimitive from "radix-ui/dialog";
|
|
3
3
|
type SlotComponent = React.ComponentType<React.HTMLAttributes<HTMLElement> & {
|
|
4
4
|
asChild?: boolean;
|
|
5
5
|
children?: React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as DialogPrimitive from "radix-ui/dialog";
|
|
5
5
|
import { X } from "lucide-react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { useLabels } from "../lib/labels.js";
|
|
@@ -11,7 +11,7 @@ import { usePortalContainer } from "../lib/theme-scope.js";
|
|
|
11
11
|
import { IconButton } from "./button.js";
|
|
12
12
|
const PlainTitle = ({ asChild: _a, ...props }) => _jsx("h2", { ...props });
|
|
13
13
|
const PlainDescription = ({ asChild: _a, ...props }) => _jsx("p", { ...props });
|
|
14
|
-
const LayerPartsContext = React.createContext({ Title: PlainTitle, Description: PlainDescription });
|
|
14
|
+
const LayerPartsContext = /*#__PURE__*/ React.createContext({ Title: PlainTitle, Description: PlainDescription });
|
|
15
15
|
/** Lets a layer (Dialog, Alert Dialog, Sheet…) plug its accessible Title/Description into the shared header. */
|
|
16
16
|
export function LayerPartsProvider({ value, children }) {
|
|
17
17
|
return _jsx(LayerPartsContext.Provider, { value: value, children: children });
|
|
@@ -25,7 +25,7 @@ function LayerDescriptionMount() {
|
|
|
25
25
|
* The fixed top of a layer: title, optional description, icon and action. Shared by Dialog,
|
|
26
26
|
* Alert Dialog, Sheet and Drawer (exported under each name: `DialogHeader`, `SheetHeader`…).
|
|
27
27
|
*/
|
|
28
|
-
export const LayerHeader = React.forwardRef(function LayerHeader({ title, description, icon, action, srOnly, className, children, ...props }, ref) {
|
|
28
|
+
export const LayerHeader = /*#__PURE__*/ React.forwardRef(function LayerHeader({ title, description, icon, action, srOnly, className, children, ...props }, ref) {
|
|
29
29
|
const { Title, Description } = React.useContext(LayerPartsContext);
|
|
30
30
|
const text = (_jsxs(_Fragment, { children: [_jsx(Title, { "data-slot": "layer-title", className: cn("font-display text-[1.3rem] leading-[1.2] text-balance text-fg", srOnly && "sr-only"), children: title }), description ? (_jsx(Description, { "data-slot": "layer-description", className: cn("mt-1 text-[13.5px] leading-relaxed text-pretty text-fg-muted", srOnly && "sr-only"), children: description })) : null, description ? _jsx(LayerDescriptionMount, {}) : null] }));
|
|
31
31
|
if (srOnly)
|
|
@@ -33,7 +33,7 @@ export const LayerHeader = React.forwardRef(function LayerHeader({ title, descri
|
|
|
33
33
|
return (_jsxs("div", { ref: ref, "data-slot": "layer-header", className: cn("vui-layer-header flex flex-none items-start gap-3.5 px-6 pt-5 pb-4 [[data-has-close]_&]:pe-14", className), ...props, children: [icon ? _jsx("div", { className: "flex flex-none items-center", children: icon }) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [text, children] }), action ? _jsx("div", { className: "flex flex-none items-center gap-1.5 self-center", children: action }) : null] }));
|
|
34
34
|
});
|
|
35
35
|
/** The scrolling middle of a layer. Header and footer stay fixed; only the body scrolls. */
|
|
36
|
-
export const LayerBody = React.forwardRef(function LayerBody({ flush, className, onScroll, ...props }, ref) {
|
|
36
|
+
export const LayerBody = /*#__PURE__*/ React.forwardRef(function LayerBody({ flush, className, onScroll, ...props }, ref) {
|
|
37
37
|
const [scrolled, setScrolled] = React.useState(false);
|
|
38
38
|
return (_jsx("div", { ref: ref, "data-slot": "layer-body", "data-scrolled": scrolled ? "" : undefined, onScroll: (e) => {
|
|
39
39
|
onScroll?.(e);
|
|
@@ -41,10 +41,10 @@ export const LayerBody = React.forwardRef(function LayerBody({ flush, className,
|
|
|
41
41
|
}, className: cn("vui-layer-body content-start text-sm text-fg", !flush && "px-6 pt-5 pb-5 [[data-slot=layer-header]+&]:pt-0", className), ...props }));
|
|
42
42
|
});
|
|
43
43
|
/** The fixed bottom of a layer: actions, primary last. Stacks (primary on top) inside a mobile sheet. */
|
|
44
|
-
export const LayerFooter = React.forwardRef(function LayerFooter({ align = "end", className, ...props }, ref) {
|
|
44
|
+
export const LayerFooter = /*#__PURE__*/ React.forwardRef(function LayerFooter({ align = "end", className, ...props }, ref) {
|
|
45
45
|
return (_jsx("div", { ref: ref, "data-slot": "layer-footer", className: cn("vui-layer-footer flex flex-none flex-wrap items-center gap-2 border-t border-line px-6 py-3.5", align === "end" && "justify-end", align === "between" && "justify-end [&>:first-child]:me-auto", align === "stretch" && "[&>*]:flex-1", className), ...props }));
|
|
46
46
|
});
|
|
47
|
-
const DialogRootContext = React.createContext(null);
|
|
47
|
+
const DialogRootContext = /*#__PURE__*/ React.createContext(null);
|
|
48
48
|
/** Read the nearest Dialog/Sheet/Drawer root — e.g. to close it from custom code (`requestOpenChange(false)`). */
|
|
49
49
|
export function useDialogRoot() {
|
|
50
50
|
const ctx = React.useContext(DialogRootContext);
|
|
@@ -99,7 +99,7 @@ export const DialogPortal = DialogPrimitive.Portal;
|
|
|
99
99
|
export const DialogTitle = DialogPrimitive.Title;
|
|
100
100
|
export const DialogDescription = DialogPrimitive.Description;
|
|
101
101
|
/** The dimmed backdrop. `DialogContent` renders its own; export for custom layers. */
|
|
102
|
-
export const DialogOverlay = React.forwardRef(function DialogOverlay({ className, blurred = true, ...props }, ref) {
|
|
102
|
+
export const DialogOverlay = /*#__PURE__*/ React.forwardRef(function DialogOverlay({ className, blurred = true, ...props }, ref) {
|
|
103
103
|
return (_jsx(DialogPrimitive.Overlay, { ref: ref, "data-slot": "dialog-overlay", "data-overlay-blurred": blurred ? "" : undefined, className: cn("vui-overlay ui-fade", className), ...props }));
|
|
104
104
|
});
|
|
105
105
|
const dialogLabels = { close: "Close" };
|
|
@@ -107,7 +107,7 @@ const dialogLabels = { close: "Close" };
|
|
|
107
107
|
* Internal: portal + overlay + layer depth + close guard + × button around a Radix Dialog.Content.
|
|
108
108
|
* Exported so other layers (Sheet, Drawer, Notification panel) share one implementation.
|
|
109
109
|
*/
|
|
110
|
-
export const LayerContentShell = React.forwardRef(function LayerContentShell({ dismissible = true, onBeforeClose, hideClose, container, labels, overlayClassName, className, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) {
|
|
110
|
+
export const LayerContentShell = /*#__PURE__*/ React.forwardRef(function LayerContentShell({ dismissible = true, onBeforeClose, hideClose, container, labels, overlayClassName, className, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) {
|
|
111
111
|
const root = React.useContext(DialogRootContext);
|
|
112
112
|
// What had focus when the panel opened. Radix returns focus only to a Dialog.Trigger; a
|
|
113
113
|
// controlled dialog opened from a plain button (or a menu) would drop focus to <body> on close.
|
|
@@ -174,7 +174,7 @@ export const LayerContentShell = React.forwardRef(function LayerContentShell({ d
|
|
|
174
174
|
* The dialog panel. Renders its own portal and overlay, traps focus, closes on Esc, returns
|
|
175
175
|
* focus to the trigger. Initial focus goes to `[data-autofocus]` if present, else the first field.
|
|
176
176
|
*/
|
|
177
|
-
export const DialogContent = React.forwardRef(function DialogContent({ size = "md", mobile = "sheet", className, ...props }, ref) {
|
|
177
|
+
export const DialogContent = /*#__PURE__*/ React.forwardRef(function DialogContent({ size = "md", mobile = "sheet", className, ...props }, ref) {
|
|
178
178
|
return (_jsx(LayerContentShell, { ref: ref, "data-slot": "dialog-content", "data-size": size, "data-mobile": mobile, className: cn("vui-dialog ui-dialog", className), ...props }));
|
|
179
179
|
});
|
|
180
180
|
/** `LayerHeader` for dialogs. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as DropdownMenuPrimitive from "radix-ui/dropdown-menu";
|
|
3
3
|
import type { MenuEntry } from "../lib/variants.js";
|
|
4
4
|
/** Root. Controlled (`open` / `onOpenChange`) or uncontrolled. */
|
|
5
5
|
export declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as DropdownMenuPrimitive from "radix-ui/dropdown-menu";
|
|
5
5
|
import { MoreHorizontal } from "lucide-react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { usePortalContainer } from "../lib/theme-scope.js";
|
|
@@ -15,7 +15,7 @@ export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
|
15
15
|
export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
16
16
|
export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
17
17
|
/** The menu panel. Portals into the nearest `ThemeScope`; only the first layer blurs in glass mode. */
|
|
18
|
-
export const DropdownMenuContent = React.forwardRef(function DropdownMenuContent({ className, size = "md", sideOffset = 6, collisionPadding = 12, align = "start", ...props }, ref) {
|
|
18
|
+
export const DropdownMenuContent = /*#__PURE__*/ React.forwardRef(function DropdownMenuContent({ className, size = "md", sideOffset = 6, collisionPadding = 12, align = "start", ...props }, ref) {
|
|
19
19
|
const container = usePortalContainer();
|
|
20
20
|
return (_jsx(DropdownMenuPrimitive.Portal, { container: container, children: _jsx(MenuSizeContext.Provider, { value: size, children: _jsx(Layer, { asChild: true, children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, "data-slot": "dropdown-menu-content", sideOffset: sideOffset, collisionPadding: collisionPadding, align: align, className: cn(menuContentVariants({ size }), "max-h-(--radix-dropdown-menu-content-available-height)", className), ...props }) }) }) }));
|
|
21
21
|
});
|
|
@@ -24,25 +24,25 @@ export const DropdownMenuContent = React.forwardRef(function DropdownMenuContent
|
|
|
24
24
|
* `event.preventDefault()` in `onSelect` to keep it open (async actions).
|
|
25
25
|
* With `asChild` the child (a link) is rendered as the item and must hold its own content.
|
|
26
26
|
*/
|
|
27
|
-
export const DropdownMenuItem = React.forwardRef(function DropdownMenuItem({ className, icon, description, shortcut, badge, tone = "default", inset, asChild, children, ...props }, ref) {
|
|
27
|
+
export const DropdownMenuItem = /*#__PURE__*/ React.forwardRef(function DropdownMenuItem({ className, icon, description, shortcut, badge, tone = "default", inset, asChild, children, ...props }, ref) {
|
|
28
28
|
const size = React.useContext(MenuSizeContext);
|
|
29
29
|
return (_jsx(DropdownMenuPrimitive.Item, { ref: ref, "data-slot": "dropdown-menu-item", "data-tone": tone, asChild: asChild, className: menuItemClass({ size, tone, inset, className }), ...props, children: asChild ? (children) : (_jsx(MenuItemContent, { icon: icon, description: description, shortcut: shortcut, badge: badge, children: children })) }));
|
|
30
30
|
});
|
|
31
31
|
/** A toggle (`menuitemcheckbox`). Selecting closes the menu; call `event.preventDefault()` in `onSelect` to keep it open (column toggles). */
|
|
32
|
-
export const DropdownMenuCheckboxItem = React.forwardRef(function DropdownMenuCheckboxItem({ className, shortcut, description, children, ...props }, ref) {
|
|
32
|
+
export const DropdownMenuCheckboxItem = /*#__PURE__*/ React.forwardRef(function DropdownMenuCheckboxItem({ className, shortcut, description, children, ...props }, ref) {
|
|
33
33
|
const size = React.useContext(MenuSizeContext);
|
|
34
34
|
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref, "data-slot": "dropdown-menu-checkbox-item", className: menuItemClass({ size, inset: true, className }), ...props, children: [_jsx("span", { className: menuIndicatorClass, children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(MenuCheckIcon, {}) }) }), _jsx(MenuItemContent, { shortcut: shortcut, description: description, children: children })] }));
|
|
35
35
|
});
|
|
36
36
|
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
37
37
|
/** One choice inside a `DropdownMenuRadioGroup` (`menuitemradio`). */
|
|
38
|
-
export const DropdownMenuRadioItem = React.forwardRef(function DropdownMenuRadioItem({ className, shortcut, description, children, ...props }, ref) {
|
|
38
|
+
export const DropdownMenuRadioItem = /*#__PURE__*/ React.forwardRef(function DropdownMenuRadioItem({ className, shortcut, description, children, ...props }, ref) {
|
|
39
39
|
const size = React.useContext(MenuSizeContext);
|
|
40
40
|
return (_jsxs(DropdownMenuPrimitive.RadioItem, { ref: ref, "data-slot": "dropdown-menu-radio-item", className: menuItemClass({ size, inset: true, className }), ...props, children: [_jsx("span", { className: menuIndicatorClass, children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(MenuRadioDot, {}) }) }), _jsx(MenuItemContent, { shortcut: shortcut, description: description, children: children })] }));
|
|
41
41
|
});
|
|
42
|
-
export const DropdownMenuLabel = React.forwardRef(function DropdownMenuLabel({ className, inset, ...props }, ref) {
|
|
42
|
+
export const DropdownMenuLabel = /*#__PURE__*/ React.forwardRef(function DropdownMenuLabel({ className, inset, ...props }, ref) {
|
|
43
43
|
return _jsx(DropdownMenuPrimitive.Label, { ref: ref, "data-slot": "dropdown-menu-label", className: cn(menuLabelClass, inset && "ps-8", className), ...props });
|
|
44
44
|
});
|
|
45
|
-
export const DropdownMenuSeparator = React.forwardRef(function DropdownMenuSeparator({ className, ...props }, ref) {
|
|
45
|
+
export const DropdownMenuSeparator = /*#__PURE__*/ React.forwardRef(function DropdownMenuSeparator({ className, ...props }, ref) {
|
|
46
46
|
return _jsx(DropdownMenuPrimitive.Separator, { ref: ref, "data-slot": "dropdown-menu-separator", className: cn(menuSeparatorClass, className), ...props });
|
|
47
47
|
});
|
|
48
48
|
/** Trailing text hint (when you don't want keycaps). */
|
|
@@ -50,12 +50,12 @@ export function DropdownMenuShortcut({ className, ...props }) {
|
|
|
50
50
|
return _jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn("ms-auto ps-4 font-mono text-[11px] tracking-wide text-fg-subtle", className), ...props });
|
|
51
51
|
}
|
|
52
52
|
/** Opens a submenu on hover, Enter, Space or → (← in RTL). */
|
|
53
|
-
export const DropdownMenuSubTrigger = React.forwardRef(function DropdownMenuSubTrigger({ className, icon, inset, children, ...props }, ref) {
|
|
53
|
+
export const DropdownMenuSubTrigger = /*#__PURE__*/ React.forwardRef(function DropdownMenuSubTrigger({ className, icon, inset, children, ...props }, ref) {
|
|
54
54
|
const size = React.useContext(MenuSizeContext);
|
|
55
55
|
return (_jsx(DropdownMenuPrimitive.SubTrigger, { ref: ref, "data-slot": "dropdown-menu-sub-trigger", className: menuItemClass({ size, inset, className: cn("data-[state=open]:bg-hover", className) }), ...props, children: _jsx(MenuItemContent, { icon: icon, chevron: true, children: children }) }));
|
|
56
56
|
});
|
|
57
57
|
/** A submenu panel. It is one layer deeper, so it is opaque in glass mode. */
|
|
58
|
-
export const DropdownMenuSubContent = React.forwardRef(function DropdownMenuSubContent({ className, size: sizeProp, sideOffset = 4, collisionPadding = 12, ...props }, ref) {
|
|
58
|
+
export const DropdownMenuSubContent = /*#__PURE__*/ React.forwardRef(function DropdownMenuSubContent({ className, size: sizeProp, sideOffset = 4, collisionPadding = 12, ...props }, ref) {
|
|
59
59
|
const container = usePortalContainer();
|
|
60
60
|
const parentSize = React.useContext(MenuSizeContext);
|
|
61
61
|
const size = sizeProp ?? parentSize;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as Collapsible from "radix-ui/collapsible";
|
|
5
5
|
import { ArrowLeft, Check, ChevronDown, CloudOff, PanelRight, TriangleAlert } from "lucide-react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { useLabels } from "../lib/labels.js";
|
|
@@ -40,7 +40,7 @@ const editorLabels = {
|
|
|
40
40
|
};
|
|
41
41
|
/** Below this container width (44rem) the side panel becomes a sheet. Matches navigation.css. */
|
|
42
42
|
const NARROW = 704;
|
|
43
|
-
const EditorLayoutContext = React.createContext(null);
|
|
43
|
+
const EditorLayoutContext = /*#__PURE__*/ React.createContext(null);
|
|
44
44
|
function useEditorLayout() {
|
|
45
45
|
return React.useContext(EditorLayoutContext);
|
|
46
46
|
}
|
|
@@ -61,7 +61,7 @@ function useEditorLayout() {
|
|
|
61
61
|
* </EditorLayout>
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export const EditorLayout = React.forwardRef(function EditorLayout({ panelOpen: panelOpenProp, defaultPanelOpen = true, onPanelOpenChange, panelWidth: panelWidthProp, defaultPanelWidth = 320, onPanelWidthChange, resizable = false, focusMode: focusModeProp, defaultFocusMode = false, onFocusModeChange, readOnly = false, scroll = "page", stickyTop, shortcuts = true, labels, className, style, children, ...props }, ref) {
|
|
64
|
+
export const EditorLayout = /*#__PURE__*/ React.forwardRef(function EditorLayout({ panelOpen: panelOpenProp, defaultPanelOpen = true, onPanelOpenChange, panelWidth: panelWidthProp, defaultPanelWidth = 320, onPanelWidthChange, resizable = false, focusMode: focusModeProp, defaultFocusMode = false, onFocusModeChange, readOnly = false, scroll = "page", stickyTop, shortcuts = true, labels, className, style, children, ...props }, ref) {
|
|
65
65
|
const { ref: measureRef, width } = useContainerWidth();
|
|
66
66
|
const composed = useComposedRefs(ref, measureRef);
|
|
67
67
|
const narrow = width !== undefined && width < NARROW;
|
|
@@ -113,7 +113,7 @@ export const EditorLayout = React.forwardRef(function EditorLayout({ panelOpen:
|
|
|
113
113
|
return (_jsx(EditorLayoutContext.Provider, { value: ctx, children: _jsx("div", { ref: composed, "data-slot": "editor-layout", "data-scroll": scroll, "data-focus-mode": focusMode ? "" : undefined, "data-read-only": readOnly ? "" : undefined, className: cn("@container/editor relative w-full min-w-0", scroll === "panes" && "h-full min-h-0", className), style: { "--editor-panel-w": `${panelWidth}px`, ...(top !== undefined ? { "--editor-sticky-top": top } : null), ...style }, ...props, children: _jsx("div", { className: "vui-editor-grid", "data-panel": ctx.panelOpen && !narrow ? "open" : "closed", "data-scroll": scroll, children: children }) }) }));
|
|
114
114
|
});
|
|
115
115
|
/** The sticky publish bar: back, title, save status, actions, panel toggle. */
|
|
116
|
-
export const EditorBar = React.forwardRef(function EditorBar({ back, title, status, actions, secondaryActions, menu, panelToggle = true, focusToggle = false, labels, className, children, ...props }, ref) {
|
|
116
|
+
export const EditorBar = /*#__PURE__*/ React.forwardRef(function EditorBar({ back, title, status, actions, secondaryActions, menu, panelToggle = true, focusToggle = false, labels, className, children, ...props }, ref) {
|
|
117
117
|
const ctx = useEditorLayout();
|
|
118
118
|
const t = useLabels("editor", editorLabels, labels ?? ctx?.labels);
|
|
119
119
|
const readOnly = ctx?.readOnly ?? false;
|
|
@@ -128,7 +128,7 @@ const UNITS = [
|
|
|
128
128
|
* Where the document's changes are: "Unsaved changes" · "Saving…" · "Saved 2 min ago" ·
|
|
129
129
|
* "Couldn't save · Retry" · "Offline · changes kept locally". A polite status; the error is an alert.
|
|
130
130
|
*/
|
|
131
|
-
export const SaveStatus = React.forwardRef(function SaveStatus({ state, at, onRetry, guard = true, now: nowProp, labels, className, ...props }, ref) {
|
|
131
|
+
export const SaveStatus = /*#__PURE__*/ React.forwardRef(function SaveStatus({ state, at, onRetry, guard = true, now: nowProp, labels, className, ...props }, ref) {
|
|
132
132
|
const ctx = useEditorLayout();
|
|
133
133
|
const t = useLabels("editor", editorLabels, labels ?? ctx?.labels);
|
|
134
134
|
const { locale } = useLocale();
|
|
@@ -172,13 +172,13 @@ export const SaveStatus = React.forwardRef(function SaveStatus({ state, at, onRe
|
|
|
172
172
|
/* ------------------------------------------------------------------ */
|
|
173
173
|
const canvasWidth = { prose: "max-w-[720px]", wide: "max-w-[1080px]", full: "max-w-none" };
|
|
174
174
|
/** The writing area: a centred column with generous margins. */
|
|
175
|
-
export const EditorCanvas = React.forwardRef(function EditorCanvas({ width = "prose", tone = "surface", notice, loading, labels, className, children, ...props }, ref) {
|
|
175
|
+
export const EditorCanvas = /*#__PURE__*/ React.forwardRef(function EditorCanvas({ width = "prose", tone = "surface", notice, loading, labels, className, children, ...props }, ref) {
|
|
176
176
|
const ctx = useEditorLayout();
|
|
177
177
|
const t = useLabels("editor", editorLabels, labels ?? ctx?.labels);
|
|
178
178
|
return (_jsx("div", { ref: ref, "data-slot": "editor-canvas", "data-tone": tone, "aria-busy": loading || undefined, className: cn("vui-editor-canvas min-w-0 px-[var(--gutter,1.5rem)] py-8 @3xl/editor:py-12", tone === "surface" ? "bg-surface" : "bg-transparent", className), ...props, children: _jsxs("div", { className: cn("mx-auto flex w-full flex-col gap-6", canvasWidth[width]), children: [notice, loading ? (_jsxs("div", { role: "status", "aria-label": t("loading"), className: "grid gap-6", children: [_jsx(Skeleton, { className: "h-10 w-3/4 rounded-ui-sm" }), _jsx(SkeletonText, { lines: 4 }), _jsx(SkeletonText, { lines: 5 })] })) : (children)] }) }));
|
|
179
179
|
});
|
|
180
180
|
/** The side panel: `<aside>` of collapsible settings sections; a non-modal sheet on narrow layouts. */
|
|
181
|
-
export const EditorPanel = React.forwardRef(function EditorPanel({ tabs, value: valueProp, defaultValue, onValueChange, footer, labels, className, children, ...props }, ref) {
|
|
181
|
+
export const EditorPanel = /*#__PURE__*/ React.forwardRef(function EditorPanel({ tabs, value: valueProp, defaultValue, onValueChange, footer, labels, className, children, ...props }, ref) {
|
|
182
182
|
const ctx = useEditorLayout();
|
|
183
183
|
const t = useLabels("editor", editorLabels, labels ?? ctx?.labels);
|
|
184
184
|
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? tabs?.[0]?.id ?? "", onChange: onValueChange, name: "EditorPanel" });
|
|
@@ -194,7 +194,7 @@ export const EditorPanel = React.forwardRef(function EditorPanel({ tabs, value:
|
|
|
194
194
|
return (_jsxs("aside", { ref: ref, id: ctx?.panelId, "aria-label": label, hidden: ctx ? !ctx.panelOpen : undefined, "data-slot": "editor-panel", className: cn("vui-editor-panel relative flex min-w-0 flex-col border-s border-line bg-surface", className), ...props, children: [ctx?.resizable ? (_jsx(SidePaneHandle, { "aria-label": t("resizePanel"), edge: "start", value: ctx.panelWidth, min: 280, max: 520, defaultValue: ctx.defaultPanelWidth, onValueChange: ctx.setPanelWidth, className: "-start-1" })) : null, body] }));
|
|
195
195
|
});
|
|
196
196
|
/** The sections of one panel tab (`value` matches a tab `id`). */
|
|
197
|
-
export const EditorPanelContent = React.forwardRef(function EditorPanelContent({ className, ...props }, ref) {
|
|
197
|
+
export const EditorPanelContent = /*#__PURE__*/ React.forwardRef(function EditorPanelContent({ className, ...props }, ref) {
|
|
198
198
|
return _jsx(TabsContent, { ref: ref, className: cn("mt-0", className), ...props });
|
|
199
199
|
});
|
|
200
200
|
const storageKey = (id) => `vui:editor-section:${id}`;
|
|
@@ -210,7 +210,7 @@ function readStored(id) {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
/** A folding meta box in the panel: Status, Permalink, Categories, Featured image, SEO. */
|
|
213
|
-
export const EditorPanelSection = React.forwardRef(function EditorPanelSection({ id, title, summary, defaultOpen = false, open: openProp, onOpenChange, actions, headingLevel = 2, className, children, ...props }, ref) {
|
|
213
|
+
export const EditorPanelSection = /*#__PURE__*/ React.forwardRef(function EditorPanelSection({ id, title, summary, defaultOpen = false, open: openProp, onOpenChange, actions, headingLevel = 2, className, children, ...props }, ref) {
|
|
214
214
|
const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange, name: "EditorPanelSection" });
|
|
215
215
|
// Restore after mount (SSR renders the default).
|
|
216
216
|
React.useEffect(() => {
|
|
@@ -19,7 +19,7 @@ const KIND = {
|
|
|
19
19
|
forbidden: { icon: LockKeyhole, label: "forbidden", well: "surface-2 text-fg-muted" },
|
|
20
20
|
done: { icon: CircleCheck, label: "done", well: "tone-success tone-soft" },
|
|
21
21
|
};
|
|
22
|
-
export const emptyStateVariants = cva("vui-empty flex w-full flex-col items-center text-center", {
|
|
22
|
+
export const emptyStateVariants = /*#__PURE__*/ cva("vui-empty flex w-full flex-col items-center text-center", {
|
|
23
23
|
variants: {
|
|
24
24
|
size: {
|
|
25
25
|
/** Inside a table, card or popover. */
|
|
@@ -48,7 +48,7 @@ export const emptyStateVariants = cva("vui-empty flex w-full flex-col items-cent
|
|
|
48
48
|
* <EmptyState kind="no-results" size="sm" actions={<Button size="sm" onClick={clear}>Clear filters</Button>} />
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export const EmptyState = React.forwardRef(function EmptyState({ kind = "first-use", size = "md", icon, illustration, title, description, actions, framed, as = "h3", className, children, role, ...props }, ref) {
|
|
51
|
+
export const EmptyState = /*#__PURE__*/ React.forwardRef(function EmptyState({ kind = "first-use", size = "md", icon, illustration, title, description, actions, framed, as = "h3", className, children, role, ...props }, ref) {
|
|
52
52
|
const k = KIND[kind];
|
|
53
53
|
const Icon = k.icon;
|
|
54
54
|
return (_jsxs("div", { ref: ref, "data-slot": "empty-state", "data-kind": kind, "data-size": size, role: role ?? (kind === "no-results" ? "status" : undefined), className: cn(emptyStateVariants({ size, framed }), className), ...props, children: [illustration ? (_jsx("div", { "data-slot": "empty-state-illustration", className: cn("mb-1 flex justify-center text-fg-subtle", size === "lg" ? "max-w-72" : "max-w-48"), children: illustration })) : icon === false ? null : (_jsx(EmptyStateIcon, { className: cn(k.well, size === "sm" ? "mb-1" : "mb-2"), children: icon ?? _jsx(Icon, { "aria-hidden": true }) })), _jsx(EmptyStateTitle, { as: as, size: size, children: title ?? _jsx(LocalizedText, { namespace: "empty", id: k.label, defaults: emptyLabels }) }), description ? _jsx(EmptyStateDescription, { size: size, children: description }) : null, children, actions ? _jsx(EmptyStateActions, { className: size === "sm" ? "mt-1" : "mt-2", children: actions }) : null] }));
|
|
@@ -52,7 +52,7 @@ function ContactActions({ name, contact, t, size = "sm" }) {
|
|
|
52
52
|
* />
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export const EntityCard = React.forwardRef(function EntityCard({ kind = "person", name, subtitle, media, badges, status, fields, stats, actions, contact, description, href, variant = "card", headingAs, archived, selected, loading, labels, className, ...props }, ref) {
|
|
55
|
+
export const EntityCard = /*#__PURE__*/ React.forwardRef(function EntityCard({ kind = "person", name, subtitle, media, badges, status, fields, stats, actions, contact, description, href, variant = "card", headingAs, archived, selected, loading, labels, className, ...props }, ref) {
|
|
56
56
|
const t = useLabels("entityCard", entityCardLabels, labels);
|
|
57
57
|
const H = headingAs ?? (variant === "header" ? "h1" : "h3");
|
|
58
58
|
const headingId = React.useId();
|
|
@@ -360,7 +360,7 @@ function useSyncNativeFiles(inputRef, files, enabled) {
|
|
|
360
360
|
* <FileUpload name="cv" accept=".pdf" maxFiles={1} /> // no upload → sent with the form
|
|
361
361
|
* ```
|
|
362
362
|
*/
|
|
363
|
-
export const FileUpload = React.forwardRef(function FileUpload(props, ref) {
|
|
363
|
+
export const FileUpload = /*#__PURE__*/ React.forwardRef(function FileUpload(props, ref) {
|
|
364
364
|
const { accept, maxSize, minSize, maxFiles, multiple: multipleProp, value, defaultValue, onValueChange, upload, concurrency = 3, onReject, variant = "dropzone", hint: hintProp, showList = true, name, id, disabled: disabledProp, invalid, required, labels, className, "aria-describedby": describedBy, ...rest } = props;
|
|
365
365
|
const control = useFieldControl({ id, name, disabled: disabledProp, required, "aria-describedby": describedBy, "aria-invalid": invalid ? true : undefined });
|
|
366
366
|
const disabled = control.disabled;
|
|
@@ -418,18 +418,18 @@ function f_names(files) {
|
|
|
418
418
|
return files.map((x) => x.name).join(", ");
|
|
419
419
|
}
|
|
420
420
|
/** `FileUpload` with `variant="button"`. */
|
|
421
|
-
export const FileUploadButton = React.forwardRef(function FileUploadButton(props, ref) {
|
|
421
|
+
export const FileUploadButton = /*#__PURE__*/ React.forwardRef(function FileUploadButton(props, ref) {
|
|
422
422
|
return _jsx(FileUpload, { ref: ref, variant: "button", ...props });
|
|
423
423
|
});
|
|
424
424
|
/* ------------------------------------------------------------------ */
|
|
425
425
|
/* List + item */
|
|
426
426
|
/* ------------------------------------------------------------------ */
|
|
427
427
|
/** The list of files under a FileUpload (usable alone for attachment lists). */
|
|
428
|
-
export const FileUploadList = React.forwardRef(function FileUploadList({ className, ...props }, ref) {
|
|
428
|
+
export const FileUploadList = /*#__PURE__*/ React.forwardRef(function FileUploadList({ className, ...props }, ref) {
|
|
429
429
|
return _jsx("ul", { ref: ref, "data-slot": "file-upload-list", className: cn("grid gap-1.5", className), ...props });
|
|
430
430
|
});
|
|
431
431
|
/** One file row: thumbnail or type icon, name, size, status, progress and actions. */
|
|
432
|
-
export const FileUploadItem = React.forwardRef(function FileUploadItem({ file, onRemove, onRetry, formMode, labels, className, ...props }, ref) {
|
|
432
|
+
export const FileUploadItem = /*#__PURE__*/ React.forwardRef(function FileUploadItem({ file, onRemove, onRetry, formMode, labels, className, ...props }, ref) {
|
|
433
433
|
const t = useLabels("upload", uploadLabels, labels);
|
|
434
434
|
const f = useFormat();
|
|
435
435
|
const Icon = iconFor(file.type, file.name);
|
|
@@ -447,7 +447,7 @@ export const FileUploadItem = React.forwardRef(function FileUploadItem({ file, o
|
|
|
447
447
|
* <Field label="Cover image"><ImageUpload aspect="16/9" maxSize={5_000_000} upload={uploadImage} /></Field>
|
|
448
448
|
* ```
|
|
449
449
|
*/
|
|
450
|
-
export const ImageUpload = React.forwardRef(function ImageUpload(props, ref) {
|
|
450
|
+
export const ImageUpload = /*#__PURE__*/ React.forwardRef(function ImageUpload(props, ref) {
|
|
451
451
|
const { value, defaultValue, onValueChange, aspect = "16/9", accept = "image/png,image/jpeg,image/webp", maxSize, upload, onReject, hint: hintProp, fit = "cover", name, id, disabled: disabledProp, invalid, required, labels, className, style, "aria-describedby": describedBy, ...rest } = props;
|
|
452
452
|
const control = useFieldControl({ id, name, disabled: disabledProp, required, "aria-describedby": describedBy, "aria-invalid": invalid ? true : undefined });
|
|
453
453
|
const disabled = control.disabled;
|
|
@@ -247,7 +247,7 @@ const formattedInputLabels = {
|
|
|
247
247
|
* <FormattedInput mask="AA-####-##" uppercase placeholder="TR-2026-01" />
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
|
-
export const FormattedInput = React.forwardRef(function FormattedInput({ mask, formatter, uppercase, valueFormat = "unmasked", value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono, labels, name, invalid, className, inputClassName, onBlur, onKeyDown, placeholder, ...rest }, forwardedRef) {
|
|
250
|
+
export const FormattedInput = /*#__PURE__*/ React.forwardRef(function FormattedInput({ mask, formatter, uppercase, valueFormat = "unmasked", value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono, labels, name, invalid, className, inputClassName, onBlur, onKeyDown, placeholder, ...rest }, forwardedRef) {
|
|
251
251
|
const t = useLabels("formattedInput", formattedInputLabels, labels);
|
|
252
252
|
const fmt = React.useMemo(() => formatter ?? maskFormatter(mask ?? "", { uppercase }), [formatter, mask, uppercase]);
|
|
253
253
|
const slotCount = mask ? [...mask].filter((c) => SLOT[c]).length : 0;
|
|
@@ -307,7 +307,7 @@ const decimalsOf = (n) => {
|
|
|
307
307
|
* <NumberInput defaultValue={12} min={1} max={500} stepper aria-label="Quantity" />
|
|
308
308
|
* ```
|
|
309
309
|
*/
|
|
310
|
-
export const NumberInput = React.forwardRef(function NumberInput(props, forwardedRef) {
|
|
310
|
+
export const NumberInput = /*#__PURE__*/ React.forwardRef(function NumberInput(props, forwardedRef) {
|
|
311
311
|
const { min, max, step = 1, precision, stepper, grouping = true, value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono, labels, name, invalid, className, inputClassName, onBlur, onKeyDown, trailing, size, disabled, readOnly, ...rest } = props;
|
|
312
312
|
const { locale, format: f } = useLocale();
|
|
313
313
|
const t = useLabels("numberInput", numberInputLabels, labels);
|
|
@@ -391,7 +391,7 @@ export function percentSignPosition(locale) {
|
|
|
391
391
|
* Percent entry (discounts, tax rates, commission). The value is in percent units (`12.5` =
|
|
392
392
|
* 12.5%), the sign sits where the locale puts it. Default range 0–100, two decimals.
|
|
393
393
|
*/
|
|
394
|
-
export const PercentInput = React.forwardRef(function PercentInput({ min = 0, max = 100, precision = 2, trailing, ...props }, ref) {
|
|
394
|
+
export const PercentInput = /*#__PURE__*/ React.forwardRef(function PercentInput({ min = 0, max = 100, precision = 2, trailing, ...props }, ref) {
|
|
395
395
|
const { locale } = useLocale();
|
|
396
396
|
const sign = _jsx("span", { "aria-hidden": true, className: "font-medium text-fg-subtle", children: "%" });
|
|
397
397
|
const start = percentSignPosition(locale) === "start";
|
|
@@ -827,7 +827,7 @@ function HierarchyChartInner(props, ref) {
|
|
|
827
827
|
* />
|
|
828
828
|
* ```
|
|
829
829
|
*/
|
|
830
|
-
export const HierarchyChart = React.forwardRef(HierarchyChartInner);
|
|
830
|
+
export const HierarchyChart = /*#__PURE__*/ React.forwardRef(HierarchyChartInner);
|
|
831
831
|
function toTreeData(nodes, byId, getLabel, getDescription, descendants) {
|
|
832
832
|
const kids = new Map();
|
|
833
833
|
for (const n of nodes) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as HoverCardPrimitive from "radix-ui/hover-card";
|
|
3
3
|
import { type VariantProps } from "class-variance-authority";
|
|
4
4
|
export interface HoverCardProps extends React.ComponentProps<typeof HoverCardPrimitive.Root> {
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as HoverCardPrimitive from "radix-ui/hover-card";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { usePortalContainer } from "../lib/theme-scope.js";
|
|
@@ -16,7 +16,7 @@ export function HoverCard({ openDelay = 500, closeDelay = 150, ...props }) {
|
|
|
16
16
|
return _jsx(HoverCardPrimitive.Root, { openDelay: openDelay, closeDelay: closeDelay, ...props });
|
|
17
17
|
}
|
|
18
18
|
export const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
19
|
-
export const hoverCardContentVariants = cva("surface-popover ui-pop z-(--z-popover) rounded-ui-lg p-[calc(var(--gap)*0.85)] outline-none max-w-[calc(100vw-1.5rem)]", {
|
|
19
|
+
export const hoverCardContentVariants = /*#__PURE__*/ cva("surface-popover ui-pop z-(--z-popover) rounded-ui-lg p-[calc(var(--gap)*0.85)] outline-none max-w-[calc(100vw-1.5rem)]", {
|
|
20
20
|
variants: {
|
|
21
21
|
size: {
|
|
22
22
|
sm: "w-64",
|
|
@@ -26,7 +26,7 @@ export const hoverCardContentVariants = cva("surface-popover ui-pop z-(--z-popov
|
|
|
26
26
|
defaultVariants: { size: "md" },
|
|
27
27
|
});
|
|
28
28
|
/** The preview panel. Portals into the nearest `ThemeScope` and follows the layer-depth glass rules. */
|
|
29
|
-
export const HoverCardContent = React.forwardRef(function HoverCardContent({ className, size, arrow = false, sideOffset = 8, collisionPadding = 12, children, ...props }, ref) {
|
|
29
|
+
export const HoverCardContent = /*#__PURE__*/ React.forwardRef(function HoverCardContent({ className, size, arrow = false, sideOffset = 8, collisionPadding = 12, children, ...props }, ref) {
|
|
30
30
|
const container = usePortalContainer();
|
|
31
31
|
return (_jsx(HoverCardPrimitive.Portal, { container: container, children: _jsx(Layer, { asChild: true, children: _jsxs(HoverCardPrimitive.Content, { ref: ref, "data-slot": "hover-card-content", sideOffset: sideOffset, collisionPadding: collisionPadding, className: cn(hoverCardContentVariants({ size }), className), ...props, children: [children, arrow ? (_jsx(HoverCardPrimitive.Arrow, { asChild: true, width: 14, height: 7, children: _jsx(FloatingArrow, {}) })) : null] }) }) }));
|
|
32
32
|
});
|
|
@@ -40,7 +40,7 @@ const accept = (ch) => /^[0-9A-Za-z]$/.test(ch);
|
|
|
40
40
|
* </Field>
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export const IbanInput = React.forwardRef(function IbanInput({ countries, rules = [trIbanRule], showBank = true, value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono = true, labels, name, invalid, trailing, inputClassName, onBlur, onKeyDown, disabled, placeholder, ...rest }, forwardedRef) {
|
|
43
|
+
export const IbanInput = /*#__PURE__*/ React.forwardRef(function IbanInput({ countries, rules = [trIbanRule], showBank = true, value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono = true, labels, name, invalid, trailing, inputClassName, onBlur, onKeyDown, disabled, placeholder, ...rest }, forwardedRef) {
|
|
44
44
|
const { locale } = useLocale();
|
|
45
45
|
const t = useLabels("ibanInput", ibanInputLabels, labels);
|
|
46
46
|
const v = useFormattedValidity(validateOn, onValidate);
|
|
@@ -56,7 +56,7 @@ const idInputLabels = {
|
|
|
56
56
|
* </Field>
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export const IdInput = React.forwardRef(function IdInput({ kind, masked = false, value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono = true, labels, name, invalid, inputClassName, onBlur, onFocus, onKeyDown, disabled, placeholder, ...rest }, forwardedRef) {
|
|
59
|
+
export const IdInput = /*#__PURE__*/ React.forwardRef(function IdInput({ kind, masked = false, value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono = true, labels, name, invalid, inputClassName, onBlur, onFocus, onKeyDown, disabled, placeholder, ...rest }, forwardedRef) {
|
|
60
60
|
const rule = typeof kind === "string" ? registry.get(kind) : kind;
|
|
61
61
|
if (!rule && process.env.NODE_ENV !== "production")
|
|
62
62
|
console.warn(`IdInput: no rule registered for "${String(kind)}".`);
|
|
@@ -121,10 +121,10 @@ export const IdInput = React.forwardRef(function IdInput({ kind, masked = false,
|
|
|
121
121
|
} }) }), submitName ? _jsx("input", { type: "hidden", name: submitName, value: engine.raw ?? "", disabled: disabled }) : null] }));
|
|
122
122
|
});
|
|
123
123
|
/** `IdInput` preset for personal IDs. Default kind `tr-tckn`. */
|
|
124
|
-
export const NationalIdInput = React.forwardRef(function NationalIdInput({ kind = "tr-tckn", ...props }, ref) {
|
|
124
|
+
export const NationalIdInput = /*#__PURE__*/ React.forwardRef(function NationalIdInput({ kind = "tr-tckn", ...props }, ref) {
|
|
125
125
|
return _jsx(IdInput, { ref: ref, kind: kind, ...props });
|
|
126
126
|
});
|
|
127
127
|
/** `IdInput` preset for tax numbers. Default kind `tr-tax-id` (VKN or a sole proprietor's TCKN). */
|
|
128
|
-
export const TaxIdInput = React.forwardRef(function TaxIdInput({ kind = "tr-tax-id", ...props }, ref) {
|
|
128
|
+
export const TaxIdInput = /*#__PURE__*/ React.forwardRef(function TaxIdInput({ kind = "tr-tax-id", ...props }, ref) {
|
|
129
129
|
return _jsx(IdInput, { ref: ref, kind: kind, ...props });
|
|
130
130
|
});
|
package/dist/components/image.js
CHANGED
|
@@ -56,7 +56,7 @@ export function getImageSources(source, options = {}) {
|
|
|
56
56
|
/* ------------------------------------------------------------------ */
|
|
57
57
|
/* Loader context */
|
|
58
58
|
/* ------------------------------------------------------------------ */
|
|
59
|
-
const ImageLoaderContext = React.createContext(undefined);
|
|
59
|
+
const ImageLoaderContext = /*#__PURE__*/ React.createContext(undefined);
|
|
60
60
|
/**
|
|
61
61
|
* Sets the image loader for every kit `Image` below (CDN URL builder). Same signature as the
|
|
62
62
|
* Next.js loader. The media adapter's `loader` is used when no provider sets one.
|
|
@@ -87,7 +87,7 @@ export function useImageSources(source, options = {}) {
|
|
|
87
87
|
/* ------------------------------------------------------------------ */
|
|
88
88
|
/* Image */
|
|
89
89
|
/* ------------------------------------------------------------------ */
|
|
90
|
-
export const imageVariants = cva("vui-image relative isolate block max-w-full overflow-hidden bg-skeleton", {
|
|
90
|
+
export const imageVariants = /*#__PURE__*/ cva("vui-image relative isolate block max-w-full overflow-hidden bg-skeleton", {
|
|
91
91
|
variants: {
|
|
92
92
|
rounded: { none: "", ui: "rounded-ui", "ui-lg": "rounded-ui-lg", full: "rounded-full" },
|
|
93
93
|
fit: { cover: "", contain: "" },
|
|
@@ -108,7 +108,7 @@ const FILENAME_ALT = /(^(img|dsc|pxl|screenshot)[-_ ]?\d+)|\.(jpe?g|png|gif|webp
|
|
|
108
108
|
* <Image src={asset} alt="Lobby of the Kadıköy office" aspect="16/9" sizes="(min-width: 1024px) 50vw, 100vw" rounded="ui" />
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
|
-
export const Image = React.forwardRef(function Image({ src: source, alt: altProp, width: widthProp, height: heightProp, aspect = "auto", fit = "cover", focal: focalProp, crop, sizes, widths, quality, priority, placeholder: placeholderProp, blurDataURL, seed, placeholderPattern, placeholderIcon, placeholderCaption, color: colorProp, loader, fallback, processing: processingProp, rounded, frame, className, imgClassName, style, labels, onLoad, onError, loading, decoding, ...props }, forwardedRef) {
|
|
111
|
+
export const Image = /*#__PURE__*/ React.forwardRef(function Image({ src: source, alt: altProp, width: widthProp, height: heightProp, aspect = "auto", fit = "cover", focal: focalProp, crop, sizes, widths, quality, priority, placeholder: placeholderProp, blurDataURL, seed, placeholderPattern, placeholderIcon, placeholderCaption, color: colorProp, loader, fallback, processing: processingProp, rounded, frame, className, imgClassName, style, labels, onLoad, onError, loading, decoding, ...props }, forwardedRef) {
|
|
112
112
|
const t = useLabels("image", imageLabels, labels);
|
|
113
113
|
const Bridge = useImage();
|
|
114
114
|
const empty = !source || (typeof source === "string" && !source.trim());
|
|
@@ -166,10 +166,10 @@ export const Image = React.forwardRef(function Image({ src: source, alt: altProp
|
|
|
166
166
|
}, children: [placeholder === "blur" && blur && state !== "error" ? (_jsx("img", { "aria-hidden": true, alt: "", src: blur, "data-slot": "image-blur", className: "vui-image-blur pointer-events-none absolute inset-0 size-full object-cover", style: imgStyle })) : null, placeholder === "skeleton" && state === "loading" ? _jsx("span", { "aria-hidden": true, "data-slot": "image-skeleton", className: "ui-shimmer absolute inset-0" }) : null, placeholder === "art" && state === "loading" ? art(true) : null, state === "error" ? (placeholder === "art" && !fallback ? (_jsx("span", { "data-slot": "image-fallback", title: t("error"), className: cn(positioned ? "absolute inset-0" : "relative block min-h-24"), children: art(false) })) : fallback ? (_jsx("span", { "data-slot": "image-fallback", className: cn(positioned ? "absolute inset-0" : "block min-h-24", "flex items-center justify-center"), children: fallback })) : (_jsx("span", { "data-slot": "image-fallback", ...(alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true }), title: t("error"), className: cn(positioned ? "absolute inset-0" : "block min-h-24", "flex items-center justify-center text-fg-subtle [&_svg]:size-6"), children: _jsx(ImageOff, { "aria-hidden": true, strokeWidth: 1.5 }) }))) : (img), processing ? (_jsxs("span", { "data-slot": "image-processing", className: "surface-popover absolute start-2 top-2 z-10 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium", children: [_jsx(Spinner, { size: "xs", tone: "accent" }), t("processing")] })) : null] }));
|
|
167
167
|
});
|
|
168
168
|
/** `<figure>` for a captioned image (blocks, galleries, articles). */
|
|
169
|
-
export const Figure = React.forwardRef(function Figure({ gap = "sm", className, ...props }, ref) {
|
|
169
|
+
export const Figure = /*#__PURE__*/ React.forwardRef(function Figure({ gap = "sm", className, ...props }, ref) {
|
|
170
170
|
return _jsx("figure", { ref: ref, "data-slot": "figure", className: cn("m-0 flex flex-col", gap === "sm" ? "gap-2" : "gap-3", className), ...props });
|
|
171
171
|
});
|
|
172
172
|
/** `<figcaption>`: caption text plus an optional credit. */
|
|
173
|
-
export const FigureCaption = React.forwardRef(function FigureCaption({ credit, className, children, ...props }, ref) {
|
|
173
|
+
export const FigureCaption = /*#__PURE__*/ React.forwardRef(function FigureCaption({ credit, className, children, ...props }, ref) {
|
|
174
174
|
return (_jsxs("figcaption", { ref: ref, "data-slot": "figure-caption", className: cn("text-[13px] leading-relaxed text-pretty text-fg-muted", className), ...props, children: [children, credit ? _jsx("span", { className: "ms-2 text-[11.5px] tracking-wide text-fg-subtle uppercase", children: credit }) : null] }));
|
|
175
175
|
});
|