@overmap-ai/blocks 1.0.40-improvements.2 → 1.0.40-phone-input.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/PhoneNumberInput/CountrySelect.d.ts +11 -0
- package/dist/PhoneNumberInput/FlagComponent.d.ts +2 -0
- package/dist/PhoneNumberInput/InputComponent.d.ts +5 -0
- package/dist/PhoneNumberInput/PhoneNumberInput.d.ts +6 -0
- package/dist/PhoneNumberInput/context.d.ts +4 -0
- package/dist/PhoneNumberInput/index.d.ts +2 -0
- package/dist/PhoneNumberInput/typings.d.ts +9 -0
- package/dist/blocks.js +93 -0
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +92 -2
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +2 -1
package/dist/blocks.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@radix-ui/react-alert-dialog"), require("react/jsx-runtime"), require("class-variance-authority"), require("react"), require("@radix-ui/react-avatar"), require("@radix-ui/react-checkbox"), require("react-responsive"), require("cmdk"), require("@radix-ui/react-dialog"), require("react-day-picker"), require("lucide-react/dynamic"), require("@radix-ui/react-hover-card"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-slot"), require("@floating-ui/react"), require("@radix-ui/react-separator"), require("@radix-ui/react-one-time-password-field"), require("react-error-boundary"), require("@radix-ui/react-popover"), require("@radix-ui/react-progress"), require("@radix-ui/react-radio-group"), require("@radix-ui/react-toggle-group"), require("@radix-ui/react-tabs"), require("@radix-ui/react-slider"), require("@radix-ui/react-switch"), require("@radix-ui/react-toast"), require("@radix-ui/react-toggle"), require("@radix-ui/react-tooltip")) : typeof define === "function" && define.amd ? define(["exports", "@radix-ui/react-alert-dialog", "react/jsx-runtime", "class-variance-authority", "react", "@radix-ui/react-avatar", "@radix-ui/react-checkbox", "react-responsive", "cmdk", "@radix-ui/react-dialog", "react-day-picker", "lucide-react/dynamic", "@radix-ui/react-hover-card", "react-transition-group", "react-dom", "@radix-ui/react-slot", "@floating-ui/react", "@radix-ui/react-separator", "@radix-ui/react-one-time-password-field", "react-error-boundary", "@radix-ui/react-popover", "@radix-ui/react-progress", "@radix-ui/react-radio-group", "@radix-ui/react-toggle-group", "@radix-ui/react-tabs", "@radix-ui/react-slider", "@radix-ui/react-switch", "@radix-ui/react-toast", "@radix-ui/react-toggle", "@radix-ui/react-tooltip"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.blocks = {}, global.RadixAlertDialog, global.jsxRuntime, global.classVarianceAuthority, global.react, global.RadixAvatar, global.RadixCheckbox, global.reactResponsive, global.cmdk, global.RadixDialog, global.reactDayPicker, global.dynamic, global.RadixHoverCard, global.reactTransitionGroup, global.ReactDOM, global.reactSlot, global.react$1, global.RadixSeparator, global.RadixOneTimePasswordField, global.reactErrorBoundary, global.RadixPopover, global.RadixProgress, global.RadixRadioGroup, global.RadixToggleGroup, global.RadixTabs, global.RadixSlider, global.RadixSwitch, global.RadixToast, global.Toggle, global.RadixTooltip));
|
|
3
|
-
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority, react, RadixAvatar, RadixCheckbox, reactResponsive, cmdk, RadixDialog, reactDayPicker, dynamic, RadixHoverCard, reactTransitionGroup, ReactDOM, reactSlot, react$1, RadixSeparator, RadixOneTimePasswordField, reactErrorBoundary, RadixPopover, RadixProgress, RadixRadioGroup, RadixToggleGroup, RadixTabs, RadixSlider, RadixSwitch, RadixToast, Toggle, RadixTooltip) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@radix-ui/react-alert-dialog"), require("react/jsx-runtime"), require("class-variance-authority"), require("react"), require("@radix-ui/react-avatar"), require("@radix-ui/react-checkbox"), require("react-responsive"), require("cmdk"), require("@radix-ui/react-dialog"), require("react-day-picker"), require("lucide-react/dynamic"), require("@radix-ui/react-hover-card"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-slot"), require("@floating-ui/react"), require("@radix-ui/react-separator"), require("@radix-ui/react-one-time-password-field"), require("react-error-boundary"), require("react-phone-number-input"), require("lucide-react"), require("react-phone-number-input/min"), require("@radix-ui/react-popover"), require("@radix-ui/react-progress"), require("@radix-ui/react-radio-group"), require("@radix-ui/react-toggle-group"), require("@radix-ui/react-tabs"), require("@radix-ui/react-slider"), require("@radix-ui/react-switch"), require("@radix-ui/react-toast"), require("@radix-ui/react-toggle"), require("@radix-ui/react-tooltip")) : typeof define === "function" && define.amd ? define(["exports", "@radix-ui/react-alert-dialog", "react/jsx-runtime", "class-variance-authority", "react", "@radix-ui/react-avatar", "@radix-ui/react-checkbox", "react-responsive", "cmdk", "@radix-ui/react-dialog", "react-day-picker", "lucide-react/dynamic", "@radix-ui/react-hover-card", "react-transition-group", "react-dom", "@radix-ui/react-slot", "@floating-ui/react", "@radix-ui/react-separator", "@radix-ui/react-one-time-password-field", "react-error-boundary", "react-phone-number-input", "lucide-react", "react-phone-number-input/min", "@radix-ui/react-popover", "@radix-ui/react-progress", "@radix-ui/react-radio-group", "@radix-ui/react-toggle-group", "@radix-ui/react-tabs", "@radix-ui/react-slider", "@radix-ui/react-switch", "@radix-ui/react-toast", "@radix-ui/react-toggle", "@radix-ui/react-tooltip"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.blocks = {}, global.RadixAlertDialog, global.jsxRuntime, global.classVarianceAuthority, global.react, global.RadixAvatar, global.RadixCheckbox, global.reactResponsive, global.cmdk, global.RadixDialog, global.reactDayPicker, global.dynamic, global.RadixHoverCard, global.reactTransitionGroup, global.ReactDOM, global.reactSlot, global.react$1, global.RadixSeparator, global.RadixOneTimePasswordField, global.reactErrorBoundary, global.PhoneInput, global.lucideReact, global.min, global.RadixPopover, global.RadixProgress, global.RadixRadioGroup, global.RadixToggleGroup, global.RadixTabs, global.RadixSlider, global.RadixSwitch, global.RadixToast, global.Toggle, global.RadixTooltip));
|
|
3
|
+
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority, react, RadixAvatar, RadixCheckbox, reactResponsive, cmdk, RadixDialog, reactDayPicker, dynamic, RadixHoverCard, reactTransitionGroup, ReactDOM, reactSlot, react$1, RadixSeparator, RadixOneTimePasswordField, reactErrorBoundary, PhoneInput, lucideReact, min, RadixPopover, RadixProgress, RadixRadioGroup, RadixToggleGroup, RadixTabs, RadixSlider, RadixSwitch, RadixToast, Toggle, RadixTooltip) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -4385,6 +4385,95 @@
|
|
|
4385
4385
|
);
|
|
4386
4386
|
});
|
|
4387
4387
|
OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
|
|
4388
|
+
const PhoneNumberInputContext = react.createContext({});
|
|
4389
|
+
const FlagComponent = react.memo((props) => {
|
|
4390
|
+
const { country } = props;
|
|
4391
|
+
return country ? country : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PhoneIcon, { size: 16 });
|
|
4392
|
+
});
|
|
4393
|
+
FlagComponent.displayName = "FlagComponent";
|
|
4394
|
+
const CountrySelect = react.memo((props) => {
|
|
4395
|
+
const { disabled, value, onChange, options } = props;
|
|
4396
|
+
const { radius, size, variant, accentColor } = react.use(PhoneNumberInputContext);
|
|
4397
|
+
const handleSelect = react.useCallback(
|
|
4398
|
+
(e) => {
|
|
4399
|
+
onChange(e.target.value);
|
|
4400
|
+
},
|
|
4401
|
+
[onChange]
|
|
4402
|
+
);
|
|
4403
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4404
|
+
Button,
|
|
4405
|
+
{
|
|
4406
|
+
className: "relative",
|
|
4407
|
+
accentColor,
|
|
4408
|
+
radius,
|
|
4409
|
+
size,
|
|
4410
|
+
variant,
|
|
4411
|
+
disabled,
|
|
4412
|
+
children: [
|
|
4413
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
|
|
4414
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { size: 16, "aria-hidden": "true" }),
|
|
4415
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4416
|
+
"select",
|
|
4417
|
+
{
|
|
4418
|
+
disabled,
|
|
4419
|
+
value,
|
|
4420
|
+
onChange: handleSelect,
|
|
4421
|
+
className: "absolute inset-0 text-sm opacity-0",
|
|
4422
|
+
"aria-label": "Select country",
|
|
4423
|
+
children: [
|
|
4424
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select a country" }, "default"),
|
|
4425
|
+
options.filter((x) => x.value).map((option, i) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: option.value, children: [
|
|
4426
|
+
option.label,
|
|
4427
|
+
" ",
|
|
4428
|
+
option.value && `+${min.getCountryCallingCode(option.value)}`
|
|
4429
|
+
] }, option.value ?? `empty-${i}`))
|
|
4430
|
+
]
|
|
4431
|
+
}
|
|
4432
|
+
)
|
|
4433
|
+
]
|
|
4434
|
+
}
|
|
4435
|
+
);
|
|
4436
|
+
});
|
|
4437
|
+
CountrySelect.displayName = "CountrySelect";
|
|
4438
|
+
const InputComponent = react.memo((props) => {
|
|
4439
|
+
const { accentColor, radius, size, variant } = react.use(PhoneNumberInputContext);
|
|
4440
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Input.Root, { variant, size, radius, accentColor, children: /* @__PURE__ */ jsxRuntime.jsx(Input.Field, { ...props }) });
|
|
4441
|
+
});
|
|
4442
|
+
InputComponent.displayName = "InputComponent";
|
|
4443
|
+
const PhoneNumberInput = react.memo((props) => {
|
|
4444
|
+
const providerContext = useProvider();
|
|
4445
|
+
const {
|
|
4446
|
+
ref,
|
|
4447
|
+
className,
|
|
4448
|
+
size = "md",
|
|
4449
|
+
variant = "outline",
|
|
4450
|
+
radius = providerContext.radius,
|
|
4451
|
+
accentColor = providerContext.accentColor,
|
|
4452
|
+
...rest
|
|
4453
|
+
} = props;
|
|
4454
|
+
const contextValue = react.useMemo(
|
|
4455
|
+
() => ({
|
|
4456
|
+
size,
|
|
4457
|
+
variant,
|
|
4458
|
+
radius,
|
|
4459
|
+
accentColor
|
|
4460
|
+
}),
|
|
4461
|
+
[accentColor, radius, size, variant]
|
|
4462
|
+
);
|
|
4463
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PhoneNumberInputContext, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4464
|
+
PhoneInput,
|
|
4465
|
+
{
|
|
4466
|
+
ref,
|
|
4467
|
+
className: classVarianceAuthority.cx(className, "flex gap-1"),
|
|
4468
|
+
flagComponent: FlagComponent,
|
|
4469
|
+
countrySelectComponent: CountrySelect,
|
|
4470
|
+
inputComponent: InputComponent,
|
|
4471
|
+
"data-accent-color": accentColor,
|
|
4472
|
+
...rest
|
|
4473
|
+
}
|
|
4474
|
+
) });
|
|
4475
|
+
});
|
|
4476
|
+
PhoneNumberInput.displayName = "PhoneNumberInput";
|
|
4388
4477
|
const PopoverArrow = react.memo((props) => {
|
|
4389
4478
|
const { ref, children, className, ...rest } = props;
|
|
4390
4479
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
@@ -6647,6 +6736,7 @@
|
|
|
6647
6736
|
exports2.OverlayTitle = OverlayTitle;
|
|
6648
6737
|
exports2.OverlayTrigger = OverlayTrigger;
|
|
6649
6738
|
exports2.OvermapErrorBoundary = OvermapErrorBoundary;
|
|
6739
|
+
exports2.PhoneNumberInput = PhoneNumberInput;
|
|
6650
6740
|
exports2.Popover = Popover;
|
|
6651
6741
|
exports2.PopoverArrow = PopoverArrow;
|
|
6652
6742
|
exports2.PopoverContent = PopoverContent;
|