@yenio-pld/blocks 1.2.0-rc.7 → 1.2.0-rc.8
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/dist/index.cjs +289 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -71
- package/dist/index.d.ts +109 -71
- package/dist/index.js +208 -8
- package/dist/index.js.map +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React2 from 'react';
|
|
3
3
|
import { createContext, useContext, cloneElement, useState, useRef, useEffect, useId, useCallback, useLayoutEffect } from 'react';
|
|
4
4
|
import { Skeleton } from './ui/skeleton.js';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import { Loader2, AlertTriangle, Inbox, ChevronsUpDown, UserRound, LogOut, Bell, Moon, Sun, Monitor, Languages, XIcon, ChevronDownIcon, CheckIcon, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Pause, Play, BarChart3 } from 'lucide-react';
|
|
6
|
+
import { Loader2, AlertTriangle, Inbox, ChevronsUpDown, UserRound, LogOut, Bell, Moon, Sun, Monitor, Languages, XIcon, ChevronDownIcon, CheckIcon, Loader2Icon, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Pause, Play, BarChart3 } from 'lucide-react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import { Avatar, AvatarImage, AvatarFallback } from './ui/avatar.js';
|
|
@@ -2796,8 +2796,8 @@ function CountryPicker({
|
|
|
2796
2796
|
"aria-invalid": ariaInvalid
|
|
2797
2797
|
}) {
|
|
2798
2798
|
const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
|
|
2799
|
-
const items =
|
|
2800
|
-
const selected =
|
|
2799
|
+
const items = React2.useMemo(() => countryPickerItems(locale), [locale]);
|
|
2800
|
+
const selected = React2.useMemo(() => findItem(items, value), [items, value]);
|
|
2801
2801
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2802
2802
|
name ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
|
|
2803
2803
|
/* @__PURE__ */ jsxs(
|
|
@@ -2896,7 +2896,207 @@ function CountryPicker({
|
|
|
2896
2896
|
)
|
|
2897
2897
|
] });
|
|
2898
2898
|
}
|
|
2899
|
+
var INPUT_CLASS2 = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
|
|
2899
2900
|
var DEFAULT_LABELS = {
|
|
2901
|
+
placeholder: "Search\u2026",
|
|
2902
|
+
noResults: "No results",
|
|
2903
|
+
clear: "Clear",
|
|
2904
|
+
open: "Open list",
|
|
2905
|
+
loadMore: "Load more",
|
|
2906
|
+
loading: "Loading\u2026"
|
|
2907
|
+
};
|
|
2908
|
+
function resolveSelected(value, items, selectedItem) {
|
|
2909
|
+
const trimmed = value.trim();
|
|
2910
|
+
if (!trimmed) return null;
|
|
2911
|
+
if (selectedItem && selectedItem.value === trimmed) return selectedItem;
|
|
2912
|
+
return items.find((item) => item.value === trimmed) ?? selectedItem ?? null;
|
|
2913
|
+
}
|
|
2914
|
+
function PaginatedCombobox({
|
|
2915
|
+
value,
|
|
2916
|
+
onValueChange,
|
|
2917
|
+
items,
|
|
2918
|
+
selectedItem = null,
|
|
2919
|
+
onQueryChange,
|
|
2920
|
+
loading = false,
|
|
2921
|
+
loadingMore = false,
|
|
2922
|
+
nextCursor = null,
|
|
2923
|
+
onLoadMore,
|
|
2924
|
+
onOpenChange,
|
|
2925
|
+
debounceMs = 300,
|
|
2926
|
+
id,
|
|
2927
|
+
name,
|
|
2928
|
+
disabled,
|
|
2929
|
+
required,
|
|
2930
|
+
allowEmpty = true,
|
|
2931
|
+
className,
|
|
2932
|
+
labels: labelsProp,
|
|
2933
|
+
"aria-invalid": ariaInvalid
|
|
2934
|
+
}) {
|
|
2935
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
2936
|
+
const selected = React2.useMemo(
|
|
2937
|
+
() => resolveSelected(value, items, selectedItem),
|
|
2938
|
+
[value, items, selectedItem]
|
|
2939
|
+
);
|
|
2940
|
+
const listItems = React2.useMemo(() => {
|
|
2941
|
+
if (!selected) return items;
|
|
2942
|
+
if (items.some((item) => item.value === selected.value)) return items;
|
|
2943
|
+
return [selected, ...items];
|
|
2944
|
+
}, [items, selected]);
|
|
2945
|
+
const queryRef = React2.useRef("");
|
|
2946
|
+
const debounceRef = React2.useRef(null);
|
|
2947
|
+
React2.useEffect(() => {
|
|
2948
|
+
return () => {
|
|
2949
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2950
|
+
};
|
|
2951
|
+
}, []);
|
|
2952
|
+
function scheduleQuery(query) {
|
|
2953
|
+
queryRef.current = query;
|
|
2954
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2955
|
+
debounceRef.current = setTimeout(() => {
|
|
2956
|
+
onQueryChange(queryRef.current);
|
|
2957
|
+
}, debounceMs);
|
|
2958
|
+
}
|
|
2959
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2960
|
+
name ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value }) : null,
|
|
2961
|
+
/* @__PURE__ */ jsxs(
|
|
2962
|
+
Combobox.Root,
|
|
2963
|
+
{
|
|
2964
|
+
items: listItems,
|
|
2965
|
+
value: selected,
|
|
2966
|
+
filter: null,
|
|
2967
|
+
autoComplete: "none",
|
|
2968
|
+
onValueChange: (item) => {
|
|
2969
|
+
onValueChange(item?.value ?? "", item ?? null);
|
|
2970
|
+
},
|
|
2971
|
+
onInputValueChange: (inputValue, details) => {
|
|
2972
|
+
if (details.reason === "item-press" || details.reason === "clear-press" || details.reason === "input-clear") {
|
|
2973
|
+
return;
|
|
2974
|
+
}
|
|
2975
|
+
if (value.length > 0 && inputValue !== selected?.label) {
|
|
2976
|
+
onValueChange("", null);
|
|
2977
|
+
}
|
|
2978
|
+
scheduleQuery(inputValue);
|
|
2979
|
+
},
|
|
2980
|
+
onOpenChange: (open) => {
|
|
2981
|
+
onOpenChange?.(open);
|
|
2982
|
+
if (open) {
|
|
2983
|
+
onQueryChange(queryRef.current);
|
|
2984
|
+
}
|
|
2985
|
+
},
|
|
2986
|
+
disabled,
|
|
2987
|
+
itemToStringLabel: (item) => item.label,
|
|
2988
|
+
itemToStringValue: (item) => item.value,
|
|
2989
|
+
isItemEqualToValue: (item, current) => item.value === current.value,
|
|
2990
|
+
children: [
|
|
2991
|
+
/* @__PURE__ */ jsxs(
|
|
2992
|
+
Combobox.InputGroup,
|
|
2993
|
+
{
|
|
2994
|
+
className: cn("relative flex w-full items-center", className),
|
|
2995
|
+
children: [
|
|
2996
|
+
/* @__PURE__ */ jsx(
|
|
2997
|
+
Combobox.Input,
|
|
2998
|
+
{
|
|
2999
|
+
id,
|
|
3000
|
+
required,
|
|
3001
|
+
"aria-invalid": ariaInvalid,
|
|
3002
|
+
...labels.ariaLabel ? { "aria-label": labels.ariaLabel } : {},
|
|
3003
|
+
placeholder: labels.placeholder,
|
|
3004
|
+
className: cn(INPUT_CLASS2, "pr-16")
|
|
3005
|
+
}
|
|
3006
|
+
),
|
|
3007
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute inset-y-0 right-0 flex items-center gap-0.5 pr-1.5", children: [
|
|
3008
|
+
allowEmpty ? /* @__PURE__ */ jsx(
|
|
3009
|
+
Combobox.Clear,
|
|
3010
|
+
{
|
|
3011
|
+
className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3012
|
+
"aria-label": labels.clear,
|
|
3013
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-4", "aria-hidden": true })
|
|
3014
|
+
}
|
|
3015
|
+
) : null,
|
|
3016
|
+
/* @__PURE__ */ jsx(
|
|
3017
|
+
Combobox.Trigger,
|
|
3018
|
+
{
|
|
3019
|
+
className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3020
|
+
"aria-label": labels.open,
|
|
3021
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4", "aria-hidden": true })
|
|
3022
|
+
}
|
|
3023
|
+
)
|
|
3024
|
+
] })
|
|
3025
|
+
]
|
|
3026
|
+
}
|
|
3027
|
+
),
|
|
3028
|
+
/* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(
|
|
3029
|
+
Combobox.Positioner,
|
|
3030
|
+
{
|
|
3031
|
+
className: "pointer-events-auto isolate z-[60] outline-none",
|
|
3032
|
+
sideOffset: 4,
|
|
3033
|
+
children: /* @__PURE__ */ jsxs(
|
|
3034
|
+
Combobox.Popup,
|
|
3035
|
+
{
|
|
3036
|
+
className: cn(
|
|
3037
|
+
"pointer-events-auto z-[60] max-h-60 w-(--anchor-width) min-w-[16rem] overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10",
|
|
3038
|
+
"data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95"
|
|
3039
|
+
),
|
|
3040
|
+
children: [
|
|
3041
|
+
loading ? /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground", children: [
|
|
3042
|
+
/* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
3043
|
+
labels.loading
|
|
3044
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3045
|
+
/* @__PURE__ */ jsx(Combobox.Empty, { className: "px-3 py-2 text-sm text-muted-foreground", children: labels.noResults }),
|
|
3046
|
+
/* @__PURE__ */ jsx(
|
|
3047
|
+
Combobox.List,
|
|
3048
|
+
{
|
|
3049
|
+
className: "max-h-60 overflow-y-auto p-1 outline-none",
|
|
3050
|
+
onWheel: (event) => event.stopPropagation(),
|
|
3051
|
+
children: (item) => /* @__PURE__ */ jsxs(
|
|
3052
|
+
Combobox.Item,
|
|
3053
|
+
{
|
|
3054
|
+
value: item,
|
|
3055
|
+
className: cn(
|
|
3056
|
+
"relative flex cursor-default flex-col gap-0.5 rounded-md py-1.5 pr-2 pl-8 text-sm outline-none select-none",
|
|
3057
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground"
|
|
3058
|
+
),
|
|
3059
|
+
children: [
|
|
3060
|
+
/* @__PURE__ */ jsx(Combobox.ItemIndicator, { className: "absolute top-2 left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4", "aria-hidden": true }) }),
|
|
3061
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: item.label }),
|
|
3062
|
+
item.secondary ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.secondary }) : null
|
|
3063
|
+
]
|
|
3064
|
+
},
|
|
3065
|
+
item.value
|
|
3066
|
+
)
|
|
3067
|
+
}
|
|
3068
|
+
)
|
|
3069
|
+
] }),
|
|
3070
|
+
nextCursor && onLoadMore ? /* @__PURE__ */ jsx("div", { className: "border-t p-1", children: /* @__PURE__ */ jsxs(
|
|
3071
|
+
"button",
|
|
3072
|
+
{
|
|
3073
|
+
type: "button",
|
|
3074
|
+
disabled: loadingMore,
|
|
3075
|
+
className: "flex w-full items-center justify-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50",
|
|
3076
|
+
onClick: () => onLoadMore(),
|
|
3077
|
+
children: [
|
|
3078
|
+
loadingMore ? /* @__PURE__ */ jsx(
|
|
3079
|
+
Loader2Icon,
|
|
3080
|
+
{
|
|
3081
|
+
className: "size-4 animate-spin",
|
|
3082
|
+
"aria-hidden": true
|
|
3083
|
+
}
|
|
3084
|
+
) : null,
|
|
3085
|
+
labels.loadMore
|
|
3086
|
+
]
|
|
3087
|
+
}
|
|
3088
|
+
) }) : null
|
|
3089
|
+
]
|
|
3090
|
+
}
|
|
3091
|
+
)
|
|
3092
|
+
}
|
|
3093
|
+
) })
|
|
3094
|
+
]
|
|
3095
|
+
}
|
|
3096
|
+
)
|
|
3097
|
+
] });
|
|
3098
|
+
}
|
|
3099
|
+
var DEFAULT_LABELS2 = {
|
|
2900
3100
|
uploadAria: "Upload image",
|
|
2901
3101
|
uploadHint: "Click to upload",
|
|
2902
3102
|
uploadFormats: "PNG, JPG up to 10MB",
|
|
@@ -2923,7 +3123,7 @@ function AvatarEditor({
|
|
|
2923
3123
|
controlSize = "default",
|
|
2924
3124
|
labels
|
|
2925
3125
|
}) {
|
|
2926
|
-
const t = { ...
|
|
3126
|
+
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
2927
3127
|
const canvasRef = useRef(null);
|
|
2928
3128
|
const fileInputRef = useRef(null);
|
|
2929
3129
|
const containerRef = useRef(null);
|
|
@@ -4385,7 +4585,7 @@ function SparklineStat({
|
|
|
4385
4585
|
);
|
|
4386
4586
|
}
|
|
4387
4587
|
var TIME_RANGE_OPTIONS = ["day", "week", "month", "year"];
|
|
4388
|
-
var
|
|
4588
|
+
var DEFAULT_LABELS3 = {
|
|
4389
4589
|
day: "Day",
|
|
4390
4590
|
week: "Week",
|
|
4391
4591
|
month: "Month",
|
|
@@ -4397,7 +4597,7 @@ function TimeRangePicker({
|
|
|
4397
4597
|
labels,
|
|
4398
4598
|
className
|
|
4399
4599
|
}) {
|
|
4400
|
-
const copy = { ...
|
|
4600
|
+
const copy = { ...DEFAULT_LABELS3, ...labels };
|
|
4401
4601
|
return /* @__PURE__ */ jsx(
|
|
4402
4602
|
"div",
|
|
4403
4603
|
{
|
|
@@ -5305,6 +5505,6 @@ function MatchReview({
|
|
|
5305
5505
|
);
|
|
5306
5506
|
}
|
|
5307
5507
|
|
|
5308
|
-
export { AccountMenu, AppShell, AuditTimeline, AvatarEditor, AvatarEditorDialog, COOKIE_CONSENT_MAX_AGE, COOKIE_CONSENT_NAME, COOKIE_CONSENT_VALUES, COUNTRY_OPTIONS, ConfirmDestructiveDialog, CookieConsentBanner, CostBreakdownCard, CountryPicker, DATA_TABLE_ROW_CLASS, DEFAULT_AUDIT_TIMELINE_LABELS, DEFAULT_COOKIE_CONSENT_BANNER_LABELS, DEFAULT_EDITABLE_SECTION_LABELS, DEFAULT_ENTITY_GRAPH_LABELS, DEFAULT_FILE_DROPZONE_LABELS, DEFAULT_FILE_UPLOAD_LABELS, DEFAULT_FILE_UPLOAD_TRAY_LABELS, DEFAULT_LEGAL_ACCEPT_CHECKBOX_LABELS, DEFAULT_LEGAL_ACCEPT_DIALOG_LABELS, DEFAULT_MATCH_REVIEW_LABELS, DEFAULT_NOTIFICATION_BELL_LABELS, DEFAULT_RISK_BADGE_LABELS, DashboardSkeleton, DataList, DataListItem, DataTable, DataTableSkeleton, DetailPageSkeleton, DimensionBreakdownTable, EditableSection, Empty2 as Empty, EmptyContent2 as EmptyContent, EmptyDescription2 as EmptyDescription, EmptyHeader2 as EmptyHeader, EmptyMedia2 as EmptyMedia, EmptyState, EmptyTitle2 as EmptyTitle, EntityGraph, ErrorState, Field, FieldMessage, FileDropzone, FileUploadMenu, FileUploadTray, FormCardSkeleton, LanguageContext, LanguageSwitcher, LegalAcceptCheckbox, LegalAcceptDialog, LegalMarkdown, ListSkeleton, LoadingState, MatchReview, MetricChartCard, MetricEmptyState, MetricSkeleton, NavTabs, NavigationProgress, NotificationBell, PageContainer, PageTitle, PageTitleSkeleton, RiskBadge, RouteLoading, SafeImage, SparklineStat, StatHighlightCard, THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY, TIME_RANGE_OPTIONS, TableSkeleton, ThemeSwitcher, TimeRangePicker, avatarFallbackStyle, cn, cookieConsentAllowsReplay, cookieDomainFromHostname, countryLabel, countryPickerItems, createMultipartUploadController, defaultLanguages, fileMatchesAccept, filterCountries, formatCountryOptionLabel, getAvatarColors, getInitials, isCookieConsentValue, isEmbeddedWindow, isKnownCountryCode, matchClaimIsUnverified, parseCookieConsent, partRanges, progressFromBytes, readCookieConsent, renderShellLink, serializeCookieConsent, signalNavigationStart, sourceUrlIsHttps, suppressNavigationProgress, useEditableSection, useLanguageContext, useMediaQuery2 as useMediaQuery, writeCookieConsent };
|
|
5508
|
+
export { AccountMenu, AppShell, AuditTimeline, AvatarEditor, AvatarEditorDialog, COOKIE_CONSENT_MAX_AGE, COOKIE_CONSENT_NAME, COOKIE_CONSENT_VALUES, COUNTRY_OPTIONS, ConfirmDestructiveDialog, CookieConsentBanner, CostBreakdownCard, CountryPicker, DATA_TABLE_ROW_CLASS, DEFAULT_AUDIT_TIMELINE_LABELS, DEFAULT_COOKIE_CONSENT_BANNER_LABELS, DEFAULT_EDITABLE_SECTION_LABELS, DEFAULT_ENTITY_GRAPH_LABELS, DEFAULT_FILE_DROPZONE_LABELS, DEFAULT_FILE_UPLOAD_LABELS, DEFAULT_FILE_UPLOAD_TRAY_LABELS, DEFAULT_LEGAL_ACCEPT_CHECKBOX_LABELS, DEFAULT_LEGAL_ACCEPT_DIALOG_LABELS, DEFAULT_MATCH_REVIEW_LABELS, DEFAULT_NOTIFICATION_BELL_LABELS, DEFAULT_RISK_BADGE_LABELS, DashboardSkeleton, DataList, DataListItem, DataTable, DataTableSkeleton, DetailPageSkeleton, DimensionBreakdownTable, EditableSection, Empty2 as Empty, EmptyContent2 as EmptyContent, EmptyDescription2 as EmptyDescription, EmptyHeader2 as EmptyHeader, EmptyMedia2 as EmptyMedia, EmptyState, EmptyTitle2 as EmptyTitle, EntityGraph, ErrorState, Field, FieldMessage, FileDropzone, FileUploadMenu, FileUploadTray, FormCardSkeleton, LanguageContext, LanguageSwitcher, LegalAcceptCheckbox, LegalAcceptDialog, LegalMarkdown, ListSkeleton, LoadingState, MatchReview, MetricChartCard, MetricEmptyState, MetricSkeleton, NavTabs, NavigationProgress, NotificationBell, PageContainer, PageTitle, PageTitleSkeleton, PaginatedCombobox, RiskBadge, RouteLoading, SafeImage, SparklineStat, StatHighlightCard, THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY, TIME_RANGE_OPTIONS, TableSkeleton, ThemeSwitcher, TimeRangePicker, avatarFallbackStyle, cn, cookieConsentAllowsReplay, cookieDomainFromHostname, countryLabel, countryPickerItems, createMultipartUploadController, defaultLanguages, fileMatchesAccept, filterCountries, formatCountryOptionLabel, getAvatarColors, getInitials, isCookieConsentValue, isEmbeddedWindow, isKnownCountryCode, matchClaimIsUnverified, parseCookieConsent, partRanges, progressFromBytes, readCookieConsent, renderShellLink, serializeCookieConsent, signalNavigationStart, sourceUrlIsHttps, suppressNavigationProgress, useEditableSection, useLanguageContext, useMediaQuery2 as useMediaQuery, writeCookieConsent };
|
|
5309
5509
|
//# sourceMappingURL=index.js.map
|
|
5310
5510
|
//# sourceMappingURL=index.js.map
|