@algenium/blocks 1.14.1 → 1.16.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/dist/index.cjs +516 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -1
- package/dist/index.d.ts +140 -1
- package/dist/index.js +504 -5
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,10 @@ var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
|
17
17
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
18
18
|
var dateFns = require('date-fns');
|
|
19
19
|
var reactDayPicker = require('react-day-picker');
|
|
20
|
+
var cmdk = require('cmdk');
|
|
20
21
|
var valid = require('card-validator');
|
|
22
|
+
var RPNInput = require('react-phone-number-input');
|
|
23
|
+
var flags = require('react-phone-number-input/flags');
|
|
21
24
|
|
|
22
25
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
26
|
|
|
@@ -48,6 +51,8 @@ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitiv
|
|
|
48
51
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
49
52
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
50
53
|
var valid__default = /*#__PURE__*/_interopDefault(valid);
|
|
54
|
+
var RPNInput__namespace = /*#__PURE__*/_interopNamespace(RPNInput);
|
|
55
|
+
var flags__default = /*#__PURE__*/_interopDefault(flags);
|
|
51
56
|
|
|
52
57
|
var CalendarContext = React7.createContext(null);
|
|
53
58
|
function useCalendarContext() {
|
|
@@ -3902,7 +3907,7 @@ function LanguageSwitcher({
|
|
|
3902
3907
|
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
3903
3908
|
const sizes = sizeClasses2[size];
|
|
3904
3909
|
const shapeClass = shapeClasses2[shape];
|
|
3905
|
-
const
|
|
3910
|
+
const defaultLabels6 = {
|
|
3906
3911
|
language: labels.language ?? "Language"
|
|
3907
3912
|
};
|
|
3908
3913
|
if (variant === "mini") {
|
|
@@ -3912,7 +3917,7 @@ function LanguageSwitcher({
|
|
|
3912
3917
|
{
|
|
3913
3918
|
variant: "ghost",
|
|
3914
3919
|
size: "icon",
|
|
3915
|
-
"aria-label":
|
|
3920
|
+
"aria-label": defaultLabels6.language,
|
|
3916
3921
|
className: cn(sizes.buttonMini, shapeClass, className),
|
|
3917
3922
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Languages, { className: sizes.iconMini })
|
|
3918
3923
|
}
|
|
@@ -9192,6 +9197,342 @@ function useDebouncedValueStrict(value, delayMs) {
|
|
|
9192
9197
|
}, [value, delayMs]);
|
|
9193
9198
|
return debounced;
|
|
9194
9199
|
}
|
|
9200
|
+
function Command({
|
|
9201
|
+
className,
|
|
9202
|
+
...props
|
|
9203
|
+
}) {
|
|
9204
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9205
|
+
cmdk.Command,
|
|
9206
|
+
{
|
|
9207
|
+
"data-slot": "command",
|
|
9208
|
+
className: cn(
|
|
9209
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
9210
|
+
className
|
|
9211
|
+
),
|
|
9212
|
+
...props
|
|
9213
|
+
}
|
|
9214
|
+
);
|
|
9215
|
+
}
|
|
9216
|
+
function CommandDialog({
|
|
9217
|
+
title = "Command Palette",
|
|
9218
|
+
description = "Search for a command to run...",
|
|
9219
|
+
children,
|
|
9220
|
+
className,
|
|
9221
|
+
showCloseButton = true,
|
|
9222
|
+
commandProps,
|
|
9223
|
+
...props
|
|
9224
|
+
}) {
|
|
9225
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { ...props, children: [
|
|
9226
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "sr-only", children: [
|
|
9227
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
|
|
9228
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: description })
|
|
9229
|
+
] }),
|
|
9230
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9231
|
+
DialogContent,
|
|
9232
|
+
{
|
|
9233
|
+
className: cn("overflow-hidden p-0", className),
|
|
9234
|
+
showCloseButton,
|
|
9235
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9236
|
+
Command,
|
|
9237
|
+
{
|
|
9238
|
+
className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
|
|
9239
|
+
...commandProps,
|
|
9240
|
+
children
|
|
9241
|
+
}
|
|
9242
|
+
)
|
|
9243
|
+
}
|
|
9244
|
+
)
|
|
9245
|
+
] });
|
|
9246
|
+
}
|
|
9247
|
+
function CommandInput({
|
|
9248
|
+
className,
|
|
9249
|
+
...props
|
|
9250
|
+
}) {
|
|
9251
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9252
|
+
"div",
|
|
9253
|
+
{
|
|
9254
|
+
"data-slot": "command-input-wrapper",
|
|
9255
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
9256
|
+
children: [
|
|
9257
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
9258
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9259
|
+
cmdk.Command.Input,
|
|
9260
|
+
{
|
|
9261
|
+
"data-slot": "command-input",
|
|
9262
|
+
className: cn(
|
|
9263
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
9264
|
+
className
|
|
9265
|
+
),
|
|
9266
|
+
...props
|
|
9267
|
+
}
|
|
9268
|
+
)
|
|
9269
|
+
]
|
|
9270
|
+
}
|
|
9271
|
+
);
|
|
9272
|
+
}
|
|
9273
|
+
function CommandList({
|
|
9274
|
+
className,
|
|
9275
|
+
...props
|
|
9276
|
+
}) {
|
|
9277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9278
|
+
cmdk.Command.List,
|
|
9279
|
+
{
|
|
9280
|
+
"data-slot": "command-list",
|
|
9281
|
+
className: cn(
|
|
9282
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
9283
|
+
className
|
|
9284
|
+
),
|
|
9285
|
+
...props
|
|
9286
|
+
}
|
|
9287
|
+
);
|
|
9288
|
+
}
|
|
9289
|
+
function CommandEmpty({
|
|
9290
|
+
...props
|
|
9291
|
+
}) {
|
|
9292
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9293
|
+
cmdk.Command.Empty,
|
|
9294
|
+
{
|
|
9295
|
+
"data-slot": "command-empty",
|
|
9296
|
+
className: "py-6 text-center text-sm",
|
|
9297
|
+
...props
|
|
9298
|
+
}
|
|
9299
|
+
);
|
|
9300
|
+
}
|
|
9301
|
+
function CommandGroup({
|
|
9302
|
+
className,
|
|
9303
|
+
...props
|
|
9304
|
+
}) {
|
|
9305
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9306
|
+
cmdk.Command.Group,
|
|
9307
|
+
{
|
|
9308
|
+
"data-slot": "command-group",
|
|
9309
|
+
className: cn(
|
|
9310
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
9311
|
+
className
|
|
9312
|
+
),
|
|
9313
|
+
...props
|
|
9314
|
+
}
|
|
9315
|
+
);
|
|
9316
|
+
}
|
|
9317
|
+
function CommandSeparator({
|
|
9318
|
+
className,
|
|
9319
|
+
...props
|
|
9320
|
+
}) {
|
|
9321
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9322
|
+
cmdk.Command.Separator,
|
|
9323
|
+
{
|
|
9324
|
+
"data-slot": "command-separator",
|
|
9325
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
9326
|
+
...props
|
|
9327
|
+
}
|
|
9328
|
+
);
|
|
9329
|
+
}
|
|
9330
|
+
function CommandItem({
|
|
9331
|
+
className,
|
|
9332
|
+
...props
|
|
9333
|
+
}) {
|
|
9334
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9335
|
+
cmdk.Command.Item,
|
|
9336
|
+
{
|
|
9337
|
+
"data-slot": "command-item",
|
|
9338
|
+
className: cn(
|
|
9339
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
9340
|
+
className
|
|
9341
|
+
),
|
|
9342
|
+
...props
|
|
9343
|
+
}
|
|
9344
|
+
);
|
|
9345
|
+
}
|
|
9346
|
+
function CommandShortcut({
|
|
9347
|
+
className,
|
|
9348
|
+
...props
|
|
9349
|
+
}) {
|
|
9350
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9351
|
+
"span",
|
|
9352
|
+
{
|
|
9353
|
+
"data-slot": "command-shortcut",
|
|
9354
|
+
className: cn(
|
|
9355
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
9356
|
+
className
|
|
9357
|
+
),
|
|
9358
|
+
...props
|
|
9359
|
+
}
|
|
9360
|
+
);
|
|
9361
|
+
}
|
|
9362
|
+
|
|
9363
|
+
// src/components/search/fuzzy.ts
|
|
9364
|
+
function normalize(value) {
|
|
9365
|
+
return value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
9366
|
+
}
|
|
9367
|
+
function fuzzyMatch(query, target) {
|
|
9368
|
+
const q = normalize(query.trim());
|
|
9369
|
+
if (!q) return true;
|
|
9370
|
+
const t = normalize(target);
|
|
9371
|
+
if (t.includes(q)) return true;
|
|
9372
|
+
let qi = 0;
|
|
9373
|
+
for (let ti = 0; ti < t.length && qi < q.length; ti++) {
|
|
9374
|
+
if (t[ti] === q[qi]) qi++;
|
|
9375
|
+
}
|
|
9376
|
+
return qi === q.length;
|
|
9377
|
+
}
|
|
9378
|
+
var defaultLabels5 = {
|
|
9379
|
+
placeholder: "Buscar en toda la plataforma\u2026",
|
|
9380
|
+
dialogTitle: "Buscar",
|
|
9381
|
+
dialogDescription: "Busca funcionalidades, eventos, documentos y m\xE1s",
|
|
9382
|
+
loading: "Buscando\u2026",
|
|
9383
|
+
empty: "No se encontraron resultados",
|
|
9384
|
+
error: "No se pudo completar la b\xFAsqueda",
|
|
9385
|
+
featuresGroup: "Funcionalidades",
|
|
9386
|
+
defaultResultsGroup: "Resultados"
|
|
9387
|
+
};
|
|
9388
|
+
function groupHitsByType(hits) {
|
|
9389
|
+
const order = [];
|
|
9390
|
+
const byType = /* @__PURE__ */ new Map();
|
|
9391
|
+
for (const hit of hits) {
|
|
9392
|
+
if (!byType.has(hit.type)) {
|
|
9393
|
+
byType.set(hit.type, []);
|
|
9394
|
+
order.push(hit.type);
|
|
9395
|
+
}
|
|
9396
|
+
byType.get(hit.type)?.push(hit);
|
|
9397
|
+
}
|
|
9398
|
+
return order.map((type) => [type, byType.get(type) ?? []]);
|
|
9399
|
+
}
|
|
9400
|
+
function SearchCommand({
|
|
9401
|
+
open,
|
|
9402
|
+
onOpenChange,
|
|
9403
|
+
fetchResults,
|
|
9404
|
+
onSelect,
|
|
9405
|
+
features = [],
|
|
9406
|
+
typeLabels,
|
|
9407
|
+
labels: userLabels,
|
|
9408
|
+
minQueryLength = 2,
|
|
9409
|
+
debounceMs = 200,
|
|
9410
|
+
className
|
|
9411
|
+
}) {
|
|
9412
|
+
const labels = { ...defaultLabels5, ...userLabels };
|
|
9413
|
+
const [query, setQuery] = React7.useState("");
|
|
9414
|
+
const [hits, setHits] = React7.useState([]);
|
|
9415
|
+
const [isLoading, setIsLoading] = React7.useState(false);
|
|
9416
|
+
const [hasError, setHasError] = React7.useState(false);
|
|
9417
|
+
const debouncedQuery = useDebouncedValue(query, debounceMs);
|
|
9418
|
+
const requestIdRef = React7.useRef(0);
|
|
9419
|
+
React7.useEffect(() => {
|
|
9420
|
+
if (!open) {
|
|
9421
|
+
setQuery("");
|
|
9422
|
+
setHits([]);
|
|
9423
|
+
setHasError(false);
|
|
9424
|
+
}
|
|
9425
|
+
}, [open]);
|
|
9426
|
+
React7.useEffect(() => {
|
|
9427
|
+
const trimmed = debouncedQuery.trim();
|
|
9428
|
+
if (trimmed.length < minQueryLength) {
|
|
9429
|
+
setHits([]);
|
|
9430
|
+
setHasError(false);
|
|
9431
|
+
setIsLoading(false);
|
|
9432
|
+
return;
|
|
9433
|
+
}
|
|
9434
|
+
const requestId = ++requestIdRef.current;
|
|
9435
|
+
setIsLoading(true);
|
|
9436
|
+
setHasError(false);
|
|
9437
|
+
fetchResults(trimmed).then((result) => {
|
|
9438
|
+
if (requestIdRef.current !== requestId) return;
|
|
9439
|
+
setHits(result);
|
|
9440
|
+
}).catch(() => {
|
|
9441
|
+
if (requestIdRef.current !== requestId) return;
|
|
9442
|
+
setHits([]);
|
|
9443
|
+
setHasError(true);
|
|
9444
|
+
}).finally(() => {
|
|
9445
|
+
if (requestIdRef.current !== requestId) return;
|
|
9446
|
+
setIsLoading(false);
|
|
9447
|
+
});
|
|
9448
|
+
}, [debouncedQuery, minQueryLength, fetchResults]);
|
|
9449
|
+
const filteredFeatures = React7.useMemo(() => {
|
|
9450
|
+
if (!query.trim()) return features;
|
|
9451
|
+
return features.filter(
|
|
9452
|
+
(feature) => fuzzyMatch(query, feature.label) || feature.keywords?.some((keyword) => fuzzyMatch(query, keyword))
|
|
9453
|
+
);
|
|
9454
|
+
}, [features, query]);
|
|
9455
|
+
const groupedHits = React7.useMemo(() => groupHitsByType(hits), [hits]);
|
|
9456
|
+
function handleSelect(selection) {
|
|
9457
|
+
onSelect(selection);
|
|
9458
|
+
onOpenChange(false);
|
|
9459
|
+
}
|
|
9460
|
+
const hasAnyResults = filteredFeatures.length > 0 || hits.length > 0;
|
|
9461
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9462
|
+
CommandDialog,
|
|
9463
|
+
{
|
|
9464
|
+
open,
|
|
9465
|
+
onOpenChange,
|
|
9466
|
+
title: labels.dialogTitle,
|
|
9467
|
+
description: labels.dialogDescription,
|
|
9468
|
+
className,
|
|
9469
|
+
commandProps: { shouldFilter: false },
|
|
9470
|
+
children: [
|
|
9471
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9472
|
+
CommandInput,
|
|
9473
|
+
{
|
|
9474
|
+
placeholder: labels.placeholder,
|
|
9475
|
+
value: query,
|
|
9476
|
+
onValueChange: setQuery
|
|
9477
|
+
}
|
|
9478
|
+
),
|
|
9479
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
|
|
9480
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: labels.loading }) : null,
|
|
9481
|
+
hasError && !isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-6 text-center text-sm text-destructive", children: labels.error }) : null,
|
|
9482
|
+
!isLoading && !hasError && !hasAnyResults ? /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: labels.empty }) : null,
|
|
9483
|
+
filteredFeatures.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { heading: labels.featuresGroup, children: filteredFeatures.map((feature) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9484
|
+
CommandItem,
|
|
9485
|
+
{
|
|
9486
|
+
value: feature.id,
|
|
9487
|
+
onSelect: () => handleSelect({ kind: "feature", feature }),
|
|
9488
|
+
children: [
|
|
9489
|
+
feature.icon,
|
|
9490
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: feature.label })
|
|
9491
|
+
]
|
|
9492
|
+
},
|
|
9493
|
+
feature.id
|
|
9494
|
+
)) }) : null,
|
|
9495
|
+
!isLoading && groupedHits.map(([type, typeHits]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9496
|
+
CommandGroup,
|
|
9497
|
+
{
|
|
9498
|
+
heading: typeLabels?.[type] ?? labels.defaultResultsGroup,
|
|
9499
|
+
children: typeHits.map((hit) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9500
|
+
CommandItem,
|
|
9501
|
+
{
|
|
9502
|
+
value: hit.id,
|
|
9503
|
+
onSelect: () => handleSelect({ kind: "hit", hit }),
|
|
9504
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
9505
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: hit.title }),
|
|
9506
|
+
hit.snippet ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: hit.snippet }) : null
|
|
9507
|
+
] })
|
|
9508
|
+
},
|
|
9509
|
+
hit.id
|
|
9510
|
+
))
|
|
9511
|
+
},
|
|
9512
|
+
type
|
|
9513
|
+
))
|
|
9514
|
+
] })
|
|
9515
|
+
]
|
|
9516
|
+
}
|
|
9517
|
+
);
|
|
9518
|
+
}
|
|
9519
|
+
function useSearchHotkey(options = {}) {
|
|
9520
|
+
const { defaultOpen = false, disabled = false } = options;
|
|
9521
|
+
const [open, setOpen] = React7.useState(defaultOpen);
|
|
9522
|
+
const toggle = React7.useCallback(() => setOpen((prev) => !prev), []);
|
|
9523
|
+
React7.useEffect(() => {
|
|
9524
|
+
if (disabled) return;
|
|
9525
|
+
function handleKeyDown(event) {
|
|
9526
|
+
if (event.key.toLowerCase() !== "k") return;
|
|
9527
|
+
if (!event.metaKey && !event.ctrlKey) return;
|
|
9528
|
+
event.preventDefault();
|
|
9529
|
+
setOpen((prev) => !prev);
|
|
9530
|
+
}
|
|
9531
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
9532
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
9533
|
+
}, [disabled]);
|
|
9534
|
+
return { open, setOpen, toggle };
|
|
9535
|
+
}
|
|
9195
9536
|
function onlyDigits(s, max) {
|
|
9196
9537
|
return s.replace(/\D/g, "").slice(0, max);
|
|
9197
9538
|
}
|
|
@@ -9952,6 +10293,166 @@ function USAddressInput({
|
|
|
9952
10293
|
] })
|
|
9953
10294
|
] });
|
|
9954
10295
|
}
|
|
10296
|
+
function Input({ className, type, ...props }) {
|
|
10297
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10298
|
+
"input",
|
|
10299
|
+
{
|
|
10300
|
+
type,
|
|
10301
|
+
"data-slot": "input",
|
|
10302
|
+
className: cn(
|
|
10303
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
10304
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
10305
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
10306
|
+
className
|
|
10307
|
+
),
|
|
10308
|
+
...props
|
|
10309
|
+
}
|
|
10310
|
+
);
|
|
10311
|
+
}
|
|
10312
|
+
var PhoneInput = React7__namespace.forwardRef(
|
|
10313
|
+
({ className, onChange, value, defaultCountry = "MX", ...props }, ref) => {
|
|
10314
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10315
|
+
RPNInput__namespace.default,
|
|
10316
|
+
{
|
|
10317
|
+
ref,
|
|
10318
|
+
className: cn("flex", className),
|
|
10319
|
+
flagComponent: FlagComponent,
|
|
10320
|
+
countrySelectComponent: CountrySelect,
|
|
10321
|
+
inputComponent: InputComponent,
|
|
10322
|
+
smartCaret: false,
|
|
10323
|
+
defaultCountry,
|
|
10324
|
+
value: value || void 0,
|
|
10325
|
+
onChange: (nextValue) => onChange?.(nextValue || ""),
|
|
10326
|
+
...props
|
|
10327
|
+
}
|
|
10328
|
+
);
|
|
10329
|
+
}
|
|
10330
|
+
);
|
|
10331
|
+
PhoneInput.displayName = "PhoneInput";
|
|
10332
|
+
var InputComponent = React7__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10333
|
+
Input,
|
|
10334
|
+
{
|
|
10335
|
+
className: cn("rounded-e-lg rounded-s-none", className),
|
|
10336
|
+
...props,
|
|
10337
|
+
ref
|
|
10338
|
+
}
|
|
10339
|
+
));
|
|
10340
|
+
InputComponent.displayName = "InputComponent";
|
|
10341
|
+
var CountrySelect = ({
|
|
10342
|
+
disabled,
|
|
10343
|
+
value: selectedCountry,
|
|
10344
|
+
options: countryList,
|
|
10345
|
+
onChange
|
|
10346
|
+
}) => {
|
|
10347
|
+
const scrollAreaRef = React7__namespace.useRef(null);
|
|
10348
|
+
const [searchValue, setSearchValue] = React7__namespace.useState("");
|
|
10349
|
+
const [isOpen, setIsOpen] = React7__namespace.useState(false);
|
|
10350
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10351
|
+
Popover,
|
|
10352
|
+
{
|
|
10353
|
+
open: isOpen,
|
|
10354
|
+
modal: true,
|
|
10355
|
+
onOpenChange: (open) => {
|
|
10356
|
+
setIsOpen(open);
|
|
10357
|
+
if (open) setSearchValue("");
|
|
10358
|
+
},
|
|
10359
|
+
children: [
|
|
10360
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10361
|
+
Button,
|
|
10362
|
+
{
|
|
10363
|
+
type: "button",
|
|
10364
|
+
variant: "outline",
|
|
10365
|
+
className: "flex gap-1 rounded-e-none rounded-s-lg border-r-0 px-3 focus:z-10",
|
|
10366
|
+
disabled,
|
|
10367
|
+
children: [
|
|
10368
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10369
|
+
FlagComponent,
|
|
10370
|
+
{
|
|
10371
|
+
country: selectedCountry,
|
|
10372
|
+
countryName: selectedCountry
|
|
10373
|
+
}
|
|
10374
|
+
),
|
|
10375
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10376
|
+
lucideReact.ChevronsUpDown,
|
|
10377
|
+
{
|
|
10378
|
+
className: cn(
|
|
10379
|
+
"-mr-2 size-4 opacity-50",
|
|
10380
|
+
disabled ? "hidden" : "opacity-100"
|
|
10381
|
+
)
|
|
10382
|
+
}
|
|
10383
|
+
)
|
|
10384
|
+
]
|
|
10385
|
+
}
|
|
10386
|
+
) }),
|
|
10387
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[300px] p-0", children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { children: [
|
|
10388
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10389
|
+
CommandInput,
|
|
10390
|
+
{
|
|
10391
|
+
value: searchValue,
|
|
10392
|
+
onValueChange: (value) => {
|
|
10393
|
+
setSearchValue(value);
|
|
10394
|
+
setTimeout(() => {
|
|
10395
|
+
if (scrollAreaRef.current) {
|
|
10396
|
+
const viewportElement = scrollAreaRef.current.querySelector(
|
|
10397
|
+
"[data-radix-scroll-area-viewport]"
|
|
10398
|
+
);
|
|
10399
|
+
if (viewportElement) {
|
|
10400
|
+
viewportElement.scrollTop = 0;
|
|
10401
|
+
}
|
|
10402
|
+
}
|
|
10403
|
+
}, 0);
|
|
10404
|
+
},
|
|
10405
|
+
placeholder: "Search country..."
|
|
10406
|
+
}
|
|
10407
|
+
),
|
|
10408
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandList, { children: /* @__PURE__ */ jsxRuntime.jsxs(ScrollArea, { ref: scrollAreaRef, className: "h-72", children: [
|
|
10409
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No country found." }),
|
|
10410
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: countryList.map(
|
|
10411
|
+
({ value, label }) => value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10412
|
+
CountrySelectOption,
|
|
10413
|
+
{
|
|
10414
|
+
country: value,
|
|
10415
|
+
countryName: label,
|
|
10416
|
+
selectedCountry,
|
|
10417
|
+
onChange,
|
|
10418
|
+
onSelectComplete: () => setIsOpen(false)
|
|
10419
|
+
},
|
|
10420
|
+
value
|
|
10421
|
+
) : null
|
|
10422
|
+
) })
|
|
10423
|
+
] }) })
|
|
10424
|
+
] }) })
|
|
10425
|
+
]
|
|
10426
|
+
}
|
|
10427
|
+
);
|
|
10428
|
+
};
|
|
10429
|
+
var CountrySelectOption = ({
|
|
10430
|
+
country,
|
|
10431
|
+
countryName,
|
|
10432
|
+
selectedCountry,
|
|
10433
|
+
onChange,
|
|
10434
|
+
onSelectComplete
|
|
10435
|
+
}) => {
|
|
10436
|
+
const handleSelect = () => {
|
|
10437
|
+
onChange(country);
|
|
10438
|
+
onSelectComplete();
|
|
10439
|
+
};
|
|
10440
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(CommandItem, { className: "gap-2", onSelect: handleSelect, children: [
|
|
10441
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlagComponent, { country, countryName }),
|
|
10442
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-sm", children: countryName }),
|
|
10443
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-foreground/50", children: `+${RPNInput__namespace.getCountryCallingCode(country)}` }),
|
|
10444
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10445
|
+
lucideReact.CheckIcon,
|
|
10446
|
+
{
|
|
10447
|
+
className: `ml-auto size-4 ${country === selectedCountry ? "opacity-100" : "opacity-0"}`
|
|
10448
|
+
}
|
|
10449
|
+
)
|
|
10450
|
+
] });
|
|
10451
|
+
};
|
|
10452
|
+
var FlagComponent = ({ country, countryName }) => {
|
|
10453
|
+
const Flag2 = flags__default.default[country];
|
|
10454
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-6 overflow-hidden rounded-sm bg-foreground/20 [&_svg:not([class*='size-'])]:size-full", children: Flag2 && /* @__PURE__ */ jsxRuntime.jsx(Flag2, { title: countryName }) });
|
|
10455
|
+
};
|
|
9955
10456
|
|
|
9956
10457
|
// src/data/mexicoStates.ts
|
|
9957
10458
|
var MEXICO_STATES = [
|
|
@@ -10145,6 +10646,15 @@ exports.ChatRoomView = ChatRoomView;
|
|
|
10145
10646
|
exports.ChatSidebar = ChatSidebar;
|
|
10146
10647
|
exports.ChatSidebarContext = ChatSidebarContext;
|
|
10147
10648
|
exports.ChatSidebarProvider = ChatSidebarProvider;
|
|
10649
|
+
exports.Command = Command;
|
|
10650
|
+
exports.CommandDialog = CommandDialog;
|
|
10651
|
+
exports.CommandEmpty = CommandEmpty;
|
|
10652
|
+
exports.CommandGroup = CommandGroup;
|
|
10653
|
+
exports.CommandInput = CommandInput;
|
|
10654
|
+
exports.CommandItem = CommandItem;
|
|
10655
|
+
exports.CommandList = CommandList;
|
|
10656
|
+
exports.CommandSeparator = CommandSeparator;
|
|
10657
|
+
exports.CommandShortcut = CommandShortcut;
|
|
10148
10658
|
exports.Dialog = Dialog;
|
|
10149
10659
|
exports.DialogClose = DialogClose;
|
|
10150
10660
|
exports.DialogContent = DialogContent;
|
|
@@ -10201,12 +10711,14 @@ exports.MiniCalendar = MiniCalendar;
|
|
|
10201
10711
|
exports.NotificationsContext = NotificationsContext;
|
|
10202
10712
|
exports.NotificationsWidget = NotificationsWidget;
|
|
10203
10713
|
exports.OrgSwitcher = OrgSwitcher;
|
|
10714
|
+
exports.PhoneInput = PhoneInput;
|
|
10204
10715
|
exports.Popover = Popover;
|
|
10205
10716
|
exports.PopoverAnchor = PopoverAnchor;
|
|
10206
10717
|
exports.PopoverContent = PopoverContent;
|
|
10207
10718
|
exports.PopoverTrigger = PopoverTrigger;
|
|
10208
10719
|
exports.ScrollArea = ScrollArea;
|
|
10209
10720
|
exports.ScrollBar = ScrollBar;
|
|
10721
|
+
exports.SearchCommand = SearchCommand;
|
|
10210
10722
|
exports.Slider = Slider;
|
|
10211
10723
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
10212
10724
|
exports.Toggle = Toggle;
|
|
@@ -10224,6 +10736,7 @@ exports.createLiveHlsConfig = createLiveHlsConfig;
|
|
|
10224
10736
|
exports.createVodHlsConfig = createVodHlsConfig;
|
|
10225
10737
|
exports.defaultLanguages = defaultLanguages;
|
|
10226
10738
|
exports.describePlaybackError = describePlaybackError;
|
|
10739
|
+
exports.fuzzyMatch = fuzzyMatch;
|
|
10227
10740
|
exports.getEnvironmentDotClass = getEnvironmentDotClass;
|
|
10228
10741
|
exports.getEnvironmentLabel = getEnvironmentLabel;
|
|
10229
10742
|
exports.isBlocksDataEnvironment = isBlocksDataEnvironment;
|
|
@@ -10240,5 +10753,6 @@ exports.useHlsPlayback = useHlsPlayback;
|
|
|
10240
10753
|
exports.useLanguageContext = useLanguageContext;
|
|
10241
10754
|
exports.useNotificationsContext = useNotificationsContext;
|
|
10242
10755
|
exports.usePlaybackStats = usePlaybackStats;
|
|
10756
|
+
exports.useSearchHotkey = useSearchHotkey;
|
|
10243
10757
|
//# sourceMappingURL=index.cjs.map
|
|
10244
10758
|
//# sourceMappingURL=index.cjs.map
|