@algenium/blocks 1.15.0 → 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 +165 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +165 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/dist/index.cjs
CHANGED
|
@@ -19,6 +19,8 @@ var dateFns = require('date-fns');
|
|
|
19
19
|
var reactDayPicker = require('react-day-picker');
|
|
20
20
|
var cmdk = require('cmdk');
|
|
21
21
|
var valid = require('card-validator');
|
|
22
|
+
var RPNInput = require('react-phone-number-input');
|
|
23
|
+
var flags = require('react-phone-number-input/flags');
|
|
22
24
|
|
|
23
25
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
26
|
|
|
@@ -49,6 +51,8 @@ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitiv
|
|
|
49
51
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
50
52
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
51
53
|
var valid__default = /*#__PURE__*/_interopDefault(valid);
|
|
54
|
+
var RPNInput__namespace = /*#__PURE__*/_interopNamespace(RPNInput);
|
|
55
|
+
var flags__default = /*#__PURE__*/_interopDefault(flags);
|
|
52
56
|
|
|
53
57
|
var CalendarContext = React7.createContext(null);
|
|
54
58
|
function useCalendarContext() {
|
|
@@ -10289,6 +10293,166 @@ function USAddressInput({
|
|
|
10289
10293
|
] })
|
|
10290
10294
|
] });
|
|
10291
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
|
+
};
|
|
10292
10456
|
|
|
10293
10457
|
// src/data/mexicoStates.ts
|
|
10294
10458
|
var MEXICO_STATES = [
|
|
@@ -10547,6 +10711,7 @@ exports.MiniCalendar = MiniCalendar;
|
|
|
10547
10711
|
exports.NotificationsContext = NotificationsContext;
|
|
10548
10712
|
exports.NotificationsWidget = NotificationsWidget;
|
|
10549
10713
|
exports.OrgSwitcher = OrgSwitcher;
|
|
10714
|
+
exports.PhoneInput = PhoneInput;
|
|
10550
10715
|
exports.Popover = Popover;
|
|
10551
10716
|
exports.PopoverAnchor = PopoverAnchor;
|
|
10552
10717
|
exports.PopoverContent = PopoverContent;
|