@beweco/aurora-ui 0.1.5 → 0.1.6

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.js CHANGED
@@ -4,6 +4,7 @@ var react = require('@heroui/react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var react$1 = require('@iconify/react');
7
+ var reactDom = require('react-dom');
7
8
  var useTheme = require('@heroui/use-theme');
8
9
 
9
10
  /******************************************************************************
@@ -465,42 +466,50 @@ var defaultTranslations$2 = {
465
466
  expandListAriaLabel: "Desplegar lista de países",
466
467
  noCountriesFound: "No se encontraron países",
467
468
  };
469
+
468
470
  var Phone = function (_a) {
469
- var label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.errorText, errorText = _d === void 0 ? "" : _d, _e = _a.value, value = _e === void 0 ? "" : _e, onChange = _a.onChange, onBlur = _a.onBlur, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.name, name = _g === void 0 ? "phone" : _g, _h = _a.translations, translations = _h === void 0 ? {} : _h;
470
- var _j = React.useState(false), isDropdownOpen = _j[0], setIsDropdownOpen = _j[1];
471
- var _k = React.useState(uniqueCountries[0]), selectedCountry = _k[0], setSelectedCountry = _k[1];
472
- var _l = React.useState(""), inputValue = _l[0], setInputValue = _l[1];
471
+ var id = _a.id, label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.errorText, errorText = _d === void 0 ? "" : _d, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.name, name = _f === void 0 ? "phone" : _f, _g = _a.translations, translations = _g === void 0 ? {} : _g;
472
+ var _h = React.useState(false), isDropdownOpen = _h[0], setIsDropdownOpen = _h[1];
473
+ var _j = React.useState(uniqueCountries[0]), selectedCountry = _j[0], setSelectedCountry = _j[1];
474
+ var _k = React.useState(""), inputValue = _k[0], setInputValue = _k[1];
473
475
  var dropdownRef = React.useRef(null);
476
+ var portalDropdownRef = React.useRef(null);
477
+ var _l = React.useState({}), dropdownPosition = _l[0], setDropdownPosition = _l[1];
474
478
  var _m = React.useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
475
- // Combinar traducciones por defecto con las proporcionadas
476
479
  var t = __assign(__assign({}, defaultTranslations$2), translations);
477
- // Usar la etiqueta de las traducciones si no se proporciona label explícitamente
478
480
  var finalLabel = label || t.label;
479
- // Sincroniza valor externo
480
481
  React.useEffect(function () {
481
482
  if (value) {
482
- // Si value incluye el código, lo separamos
483
- var found = uniqueCountries.find(function (c) { return value.startsWith(c.code); });
483
+ var found = uniqueCountries.find(function (c) { return c.code === value.countryCode; });
484
484
  if (found) {
485
485
  setSelectedCountry(found);
486
- setInputValue(value.replace(found.code, "").trim());
487
- }
488
- else {
489
- setInputValue(value);
490
486
  }
487
+ setInputValue(value.phoneNumber);
491
488
  }
492
489
  }, [value]);
493
- // Open dropdown: reset filteredCountries
494
490
  React.useEffect(function () {
495
491
  if (isDropdownOpen) {
496
492
  setFilteredCountries(uniqueCountries);
497
493
  }
498
494
  }, [isDropdownOpen]);
499
- // Cierra dropdown al hacer click fuera
495
+ React.useLayoutEffect(function () {
496
+ if (isDropdownOpen && dropdownRef.current) {
497
+ var rect = dropdownRef.current.getBoundingClientRect();
498
+ setDropdownPosition({
499
+ position: "absolute",
500
+ top: "".concat(rect.bottom + window.scrollY + 4, "px"),
501
+ left: "".concat(rect.left + window.scrollX, "px"),
502
+ width: "15rem",
503
+ zIndex: 50,
504
+ });
505
+ }
506
+ }, [isDropdownOpen]);
500
507
  React.useEffect(function () {
501
508
  var handleClickOutside = function (event) {
502
509
  if (dropdownRef.current &&
503
- !dropdownRef.current.contains(event.target)) {
510
+ !dropdownRef.current.contains(event.target) &&
511
+ portalDropdownRef.current &&
512
+ !portalDropdownRef.current.contains(event.target)) {
504
513
  setIsDropdownOpen(false);
505
514
  }
506
515
  };
@@ -515,31 +524,27 @@ var Phone = function (_a) {
515
524
  setSelectedCountry(country);
516
525
  setIsDropdownOpen(false);
517
526
  if (onChange) {
518
- onChange(country.code + inputValue);
527
+ onChange({ countryCode: country.code, phoneNumber: inputValue });
519
528
  }
520
529
  };
521
530
  var handleInputChange = function (e) {
522
- // Solo números
523
531
  var val = e.target.value.replace(/\D/g, "");
524
532
  setInputValue(val);
525
533
  if (onChange) {
526
- onChange(selectedCountry.code + val);
534
+ onChange({ countryCode: selectedCountry.code, phoneNumber: val });
527
535
  }
528
536
  };
529
- return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 w-full relative", children: [finalLabel && (jsxRuntime.jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-tiny text-default-600 mb-1", children: [finalLabel, " ", required && jsxRuntime.jsx("span", { className: "text-pink-600", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex items-center w-full min-h-[56px] bg-white dark:bg-gray-900 transition-colors shadow-sm border border-[#E4E4E7] dark:border-gray-700 rounded-2xl focus-within:border-blue-500 dark:focus-within:border-blue-400 ".concat(error
530
- ? "border-pink-500 dark:border-pink-600"
531
- : "border-[#E4E4E7] dark:border-gray-700").concat(disabled ? " bg-gray-100 dark:bg-gray-800 opacity-60" : ""), children: [jsxRuntime.jsxs("div", { className: "relative ml-2", ref: dropdownRef, children: [jsxRuntime.jsxs("button", { type: "button",
532
- ///bg-gray-100
533
- className: "flex items-center gap-1 px-4 h-10 rounded-xl dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none transition-colors", onClick: function () { return setIsDropdownOpen(function (v) { return !v; }); }, disabled: disabled, tabIndex: 0, "aria-label": t.selectCountryAriaLabel, children: [jsxRuntime.jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsxRuntime.jsx("span", { className: "text-xs text-gray-700 dark:text-gray-200", children: selectedCountry.code }), jsxRuntime.jsxs("svg", { className: "w-4 h-4 text-gray-400 dark:text-gray-300 ml-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": t.expandListAriaLabel, children: [jsxRuntime.jsx("title", { children: t.expandListAriaLabel }), jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }), isDropdownOpen && (jsxRuntime.jsxs("div", { className: "absolute z-30 mt-2 w-60 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg", children: [jsxRuntime.jsx("div", { className: "p-2", children: jsxRuntime.jsx("input", { type: "text", className: "w-full px-3 py-2 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 rounded-lg focus:outline-none focus:border-blue-500 dark:focus:border-blue-400", placeholder: t.searchPlaceholder, onChange: function (e) {
534
- var searchTerm = e.target.value.toLowerCase();
535
- var filtered = uniqueCountries.filter(function (country) {
536
- return country.name.toLowerCase().includes(searchTerm) ||
537
- country.code.toLowerCase().includes(searchTerm);
538
- });
539
- setFilteredCountries(filtered);
540
- } }) }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxRuntime.jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 ".concat(country.code === selectedCountry.code
541
- ? "bg-blue-50 dark:bg-blue-900"
542
- : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsxRuntime.jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsxRuntime.jsx("span", { className: "flex-1 text-left dark:text-gray-100", children: country.name }), jsxRuntime.jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: country.code })] }, country.code)); })) : (jsxRuntime.jsx("div", { className: "px-4 py-2 text-sm text-gray-500 dark:text-gray-400", children: t.noCountriesFound })) })] }))] }), jsxRuntime.jsx(react.Input, { type: "tel", className: "flex-1 border-none bg-transparent text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 h-10 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsxRuntime.jsx("span", { className: "text-xs text-pink-600 dark:text-pink-400 mt-1", children: errorText }))] }));
537
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 w-full relative", id: id, children: [finalLabel && (jsxRuntime.jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-tiny text-default-500 mb-1", children: [finalLabel, " ", required && jsxRuntime.jsx("span", { className: "text-danger-500", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex items-center w-full min-h-[56px] transition-colors shadow-sm border-medium border-default-200 rounded-xl focus-within:border-primary-500 dark:focus-within:border-primary-500 ".concat(error ? "border-danger-500 " : "border-default-200").concat(disabled ? "opacity-60" : ""), children: [jsxRuntime.jsx("div", { className: "relative ml-2", ref: dropdownRef, children: jsxRuntime.jsxs("button", { type: "button", className: "flex items-center gap-1 px-4 h-10 rounded-xl bg-default-100 focus:outline-none transition-colors", onClick: function () { return setIsDropdownOpen(function (v) { return !v; }); }, disabled: disabled, tabIndex: 0, "aria-label": t.selectCountryAriaLabel, children: [jsxRuntime.jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: selectedCountry.code }), jsxRuntime.jsxs("svg", { className: "w-4 h-4 text-default-500 ml-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": t.expandListAriaLabel, children: [jsxRuntime.jsx("title", { children: t.expandListAriaLabel }), jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }) }), jsxRuntime.jsx(react.Input, { type: "tel", className: "flex-1 border-none bg-transparent text-default-500 placeholder-default-500 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsxRuntime.jsx("span", { className: "text-xs text-danger-500 mt-1", children: errorText })), isDropdownOpen &&
538
+ reactDom.createPortal(jsxRuntime.jsxs("div", { ref: portalDropdownRef, style: dropdownPosition, className: "bg-content1 border border-default-200 rounded-lg shadow-lg z-50", children: [jsxRuntime.jsx("div", { className: "p-2", children: jsxRuntime.jsx("input", { type: "text", className: "w-full px-3 py-2 text-sm bg-default-100 border-medium border-default-200 text-default-500 rounded-lg focus:outline-none focus:border-primary-500", placeholder: t.searchPlaceholder, onChange: function (e) {
539
+ var searchTerm = e.target.value.toLowerCase();
540
+ var filtered = uniqueCountries.filter(function (country) {
541
+ return country.name.toLowerCase().includes(searchTerm) ||
542
+ country.code.toLowerCase().includes(searchTerm);
543
+ });
544
+ setFilteredCountries(filtered);
545
+ } }) }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxRuntime.jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-default-200 ".concat(country.code === selectedCountry.code
546
+ ? "bg-primary-50"
547
+ : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsxRuntime.jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsxRuntime.jsx("span", { className: "flex-1 text-left text-default-500", children: country.name }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: country.code })] }, country.code)); })) : (jsxRuntime.jsx("div", { className: "px-4 py-2 text-sm text-default-500", children: t.noCountriesFound })) })] }), document.body)] }));
543
548
  };
544
549
 
545
550
  /**
@@ -895,7 +900,9 @@ var ThemePicker = function (_a) {
895
900
  previewContent: (jsxRuntime.jsxs("div", { className: "rounded-lg border border-[#3F3F46] p-3 mt-4 flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-1/2 bg-[#3F3F46] rounded mb-2" }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-[#3F3F46]" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/4 rounded bg-[#3F3F46]" })] })] }), jsxRuntime.jsx("div", { className: "h-8 w-2/3 bg-[#27272A] rounded-lg mt-2" })] })),
896
901
  },
897
902
  ];
898
- return (jsxRuntime.jsx(react.RadioGroup, { value: value, onChange: function (e) { return onChange(e.target.value); }, className: "flex gap-6 w-full ".concat(className || ""), style: { gap: 16 }, children: themes.map(function (theme) { return (jsxRuntime.jsxs("div", { className: "relative rounded-[14px] ".concat(theme.cardClass, " p-6 w-1/2 min-h-[180px] transition-all duration-200 flex flex-col justify-start"), children: [jsxRuntime.jsx("div", { className: "absolute top-6 right-6", children: jsxRuntime.jsx(react.Radio, { "aria-label": theme.label, color: theme.radioColor, size: "sm", value: theme.key }) }), jsxRuntime.jsx("span", { className: theme.labelClass, children: theme.label }), theme.previewContent] }, theme.key)); }) }));
903
+ return (jsxRuntime.jsx(react.RadioGroup, { value: value, onChange: function (e) { return onChange(e.target.value); }, className: "flex justify-center ".concat(className || ""), orientation: "horizontal", classNames: {
904
+ wrapper: "gap-3",
905
+ }, children: themes.map(function (theme) { return (jsxRuntime.jsxs("div", { className: "relative rounded-2xl ".concat(theme.cardClass, " p-4 flex-1 transition-all duration-200 flex flex-col justify-start"), children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntime.jsx("span", { className: theme.labelClass, children: theme.label }), jsxRuntime.jsx(react.Radio, { "aria-label": theme.label, color: theme.radioColor, size: "sm", value: theme.key })] }), theme.previewContent] }, theme.key)); }) }));
899
906
  };
900
907
 
901
908
  var ConfigMenu = function (_a) {
package/dist/index.esm.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { Autocomplete, Button as Button$1, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, Input as Input$1, RadioGroup, Radio, cn, ListboxItem, Popover, PopoverTrigger, Tooltip, PopoverContent, Listbox, Accordion, AccordionItem, ListboxSection, Spacer, Avatar, Card as Card$1, CardBody, CardFooter, Select as Select$1, Switch as Switch$1, TimeInput as TimeInput$1, Chip, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, Textarea as Textarea$1, Dropdown, DropdownTrigger, DropdownMenu, DropdownSection, DropdownItem, Alert, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader as ModalHeader$1, ModalBody as ModalBody$1, Slider, ModalFooter as ModalFooter$1, Pagination as Pagination$1 } from '@heroui/react';
2
2
  export * from '@heroui/react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import React, { useId, useState, useCallback, createElement, useRef, useEffect, createContext, useContext, useMemo } from 'react';
4
+ import React, { useId, useState, useCallback, createElement, useRef, useEffect, useLayoutEffect, createContext, useContext, useMemo } from 'react';
5
5
  import { Icon } from '@iconify/react';
6
+ import { createPortal } from 'react-dom';
6
7
  import { useTheme } from '@heroui/use-theme';
7
8
 
8
9
  /******************************************************************************
@@ -464,42 +465,50 @@ var defaultTranslations$2 = {
464
465
  expandListAriaLabel: "Desplegar lista de países",
465
466
  noCountriesFound: "No se encontraron países",
466
467
  };
468
+
467
469
  var Phone = function (_a) {
468
- var label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.errorText, errorText = _d === void 0 ? "" : _d, _e = _a.value, value = _e === void 0 ? "" : _e, onChange = _a.onChange, onBlur = _a.onBlur, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.name, name = _g === void 0 ? "phone" : _g, _h = _a.translations, translations = _h === void 0 ? {} : _h;
469
- var _j = useState(false), isDropdownOpen = _j[0], setIsDropdownOpen = _j[1];
470
- var _k = useState(uniqueCountries[0]), selectedCountry = _k[0], setSelectedCountry = _k[1];
471
- var _l = useState(""), inputValue = _l[0], setInputValue = _l[1];
470
+ var id = _a.id, label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.errorText, errorText = _d === void 0 ? "" : _d, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.name, name = _f === void 0 ? "phone" : _f, _g = _a.translations, translations = _g === void 0 ? {} : _g;
471
+ var _h = useState(false), isDropdownOpen = _h[0], setIsDropdownOpen = _h[1];
472
+ var _j = useState(uniqueCountries[0]), selectedCountry = _j[0], setSelectedCountry = _j[1];
473
+ var _k = useState(""), inputValue = _k[0], setInputValue = _k[1];
472
474
  var dropdownRef = useRef(null);
475
+ var portalDropdownRef = useRef(null);
476
+ var _l = useState({}), dropdownPosition = _l[0], setDropdownPosition = _l[1];
473
477
  var _m = useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
474
- // Combinar traducciones por defecto con las proporcionadas
475
478
  var t = __assign(__assign({}, defaultTranslations$2), translations);
476
- // Usar la etiqueta de las traducciones si no se proporciona label explícitamente
477
479
  var finalLabel = label || t.label;
478
- // Sincroniza valor externo
479
480
  useEffect(function () {
480
481
  if (value) {
481
- // Si value incluye el código, lo separamos
482
- var found = uniqueCountries.find(function (c) { return value.startsWith(c.code); });
482
+ var found = uniqueCountries.find(function (c) { return c.code === value.countryCode; });
483
483
  if (found) {
484
484
  setSelectedCountry(found);
485
- setInputValue(value.replace(found.code, "").trim());
486
- }
487
- else {
488
- setInputValue(value);
489
485
  }
486
+ setInputValue(value.phoneNumber);
490
487
  }
491
488
  }, [value]);
492
- // Open dropdown: reset filteredCountries
493
489
  useEffect(function () {
494
490
  if (isDropdownOpen) {
495
491
  setFilteredCountries(uniqueCountries);
496
492
  }
497
493
  }, [isDropdownOpen]);
498
- // Cierra dropdown al hacer click fuera
494
+ useLayoutEffect(function () {
495
+ if (isDropdownOpen && dropdownRef.current) {
496
+ var rect = dropdownRef.current.getBoundingClientRect();
497
+ setDropdownPosition({
498
+ position: "absolute",
499
+ top: "".concat(rect.bottom + window.scrollY + 4, "px"),
500
+ left: "".concat(rect.left + window.scrollX, "px"),
501
+ width: "15rem",
502
+ zIndex: 50,
503
+ });
504
+ }
505
+ }, [isDropdownOpen]);
499
506
  useEffect(function () {
500
507
  var handleClickOutside = function (event) {
501
508
  if (dropdownRef.current &&
502
- !dropdownRef.current.contains(event.target)) {
509
+ !dropdownRef.current.contains(event.target) &&
510
+ portalDropdownRef.current &&
511
+ !portalDropdownRef.current.contains(event.target)) {
503
512
  setIsDropdownOpen(false);
504
513
  }
505
514
  };
@@ -514,31 +523,27 @@ var Phone = function (_a) {
514
523
  setSelectedCountry(country);
515
524
  setIsDropdownOpen(false);
516
525
  if (onChange) {
517
- onChange(country.code + inputValue);
526
+ onChange({ countryCode: country.code, phoneNumber: inputValue });
518
527
  }
519
528
  };
520
529
  var handleInputChange = function (e) {
521
- // Solo números
522
530
  var val = e.target.value.replace(/\D/g, "");
523
531
  setInputValue(val);
524
532
  if (onChange) {
525
- onChange(selectedCountry.code + val);
533
+ onChange({ countryCode: selectedCountry.code, phoneNumber: val });
526
534
  }
527
535
  };
528
- return (jsxs("div", { className: "flex flex-col gap-1 w-full relative", children: [finalLabel && (jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-tiny text-default-600 mb-1", children: [finalLabel, " ", required && jsx("span", { className: "text-pink-600", children: "*" })] })), jsxs("div", { className: "flex items-center w-full min-h-[56px] bg-white dark:bg-gray-900 transition-colors shadow-sm border border-[#E4E4E7] dark:border-gray-700 rounded-2xl focus-within:border-blue-500 dark:focus-within:border-blue-400 ".concat(error
529
- ? "border-pink-500 dark:border-pink-600"
530
- : "border-[#E4E4E7] dark:border-gray-700").concat(disabled ? " bg-gray-100 dark:bg-gray-800 opacity-60" : ""), children: [jsxs("div", { className: "relative ml-2", ref: dropdownRef, children: [jsxs("button", { type: "button",
531
- ///bg-gray-100
532
- className: "flex items-center gap-1 px-4 h-10 rounded-xl dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none transition-colors", onClick: function () { return setIsDropdownOpen(function (v) { return !v; }); }, disabled: disabled, tabIndex: 0, "aria-label": t.selectCountryAriaLabel, children: [jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsx("span", { className: "text-xs text-gray-700 dark:text-gray-200", children: selectedCountry.code }), jsxs("svg", { className: "w-4 h-4 text-gray-400 dark:text-gray-300 ml-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": t.expandListAriaLabel, children: [jsx("title", { children: t.expandListAriaLabel }), jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }), isDropdownOpen && (jsxs("div", { className: "absolute z-30 mt-2 w-60 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg", children: [jsx("div", { className: "p-2", children: jsx("input", { type: "text", className: "w-full px-3 py-2 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 rounded-lg focus:outline-none focus:border-blue-500 dark:focus:border-blue-400", placeholder: t.searchPlaceholder, onChange: function (e) {
533
- var searchTerm = e.target.value.toLowerCase();
534
- var filtered = uniqueCountries.filter(function (country) {
535
- return country.name.toLowerCase().includes(searchTerm) ||
536
- country.code.toLowerCase().includes(searchTerm);
537
- });
538
- setFilteredCountries(filtered);
539
- } }) }), jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 ".concat(country.code === selectedCountry.code
540
- ? "bg-blue-50 dark:bg-blue-900"
541
- : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsx("span", { className: "flex-1 text-left dark:text-gray-100", children: country.name }), jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: country.code })] }, country.code)); })) : (jsx("div", { className: "px-4 py-2 text-sm text-gray-500 dark:text-gray-400", children: t.noCountriesFound })) })] }))] }), jsx(Input$1, { type: "tel", className: "flex-1 border-none bg-transparent text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 h-10 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsx("span", { className: "text-xs text-pink-600 dark:text-pink-400 mt-1", children: errorText }))] }));
536
+ return (jsxs("div", { className: "flex flex-col gap-1 w-full relative", id: id, children: [finalLabel && (jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-tiny text-default-500 mb-1", children: [finalLabel, " ", required && jsx("span", { className: "text-danger-500", children: "*" })] })), jsxs("div", { className: "flex items-center w-full min-h-[56px] transition-colors shadow-sm border-medium border-default-200 rounded-xl focus-within:border-primary-500 dark:focus-within:border-primary-500 ".concat(error ? "border-danger-500 " : "border-default-200").concat(disabled ? "opacity-60" : ""), children: [jsx("div", { className: "relative ml-2", ref: dropdownRef, children: jsxs("button", { type: "button", className: "flex items-center gap-1 px-4 h-10 rounded-xl bg-default-100 focus:outline-none transition-colors", onClick: function () { return setIsDropdownOpen(function (v) { return !v; }); }, disabled: disabled, tabIndex: 0, "aria-label": t.selectCountryAriaLabel, children: [jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsx("span", { className: "text-xs text-default-500", children: selectedCountry.code }), jsxs("svg", { className: "w-4 h-4 text-default-500 ml-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": t.expandListAriaLabel, children: [jsx("title", { children: t.expandListAriaLabel }), jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }) }), jsx(Input$1, { type: "tel", className: "flex-1 border-none bg-transparent text-default-500 placeholder-default-500 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsx("span", { className: "text-xs text-danger-500 mt-1", children: errorText })), isDropdownOpen &&
537
+ createPortal(jsxs("div", { ref: portalDropdownRef, style: dropdownPosition, className: "bg-content1 border border-default-200 rounded-lg shadow-lg z-50", children: [jsx("div", { className: "p-2", children: jsx("input", { type: "text", className: "w-full px-3 py-2 text-sm bg-default-100 border-medium border-default-200 text-default-500 rounded-lg focus:outline-none focus:border-primary-500", placeholder: t.searchPlaceholder, onChange: function (e) {
538
+ var searchTerm = e.target.value.toLowerCase();
539
+ var filtered = uniqueCountries.filter(function (country) {
540
+ return country.name.toLowerCase().includes(searchTerm) ||
541
+ country.code.toLowerCase().includes(searchTerm);
542
+ });
543
+ setFilteredCountries(filtered);
544
+ } }) }), jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-default-200 ".concat(country.code === selectedCountry.code
545
+ ? "bg-primary-50"
546
+ : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsx("span", { className: "flex-1 text-left text-default-500", children: country.name }), jsx("span", { className: "text-xs text-default-500", children: country.code })] }, country.code)); })) : (jsx("div", { className: "px-4 py-2 text-sm text-default-500", children: t.noCountriesFound })) })] }), document.body)] }));
542
547
  };
543
548
 
544
549
  /**
@@ -894,7 +899,9 @@ var ThemePicker = function (_a) {
894
899
  previewContent: (jsxs("div", { className: "rounded-lg border border-[#3F3F46] p-3 mt-4 flex flex-col gap-2", children: [jsx("div", { className: "h-3 w-1/2 bg-[#3F3F46] rounded mb-2" }), jsxs("div", { className: "flex flex-col gap-1", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsx("div", { className: "h-3 w-1/3 rounded bg-[#3F3F46]" })] }), jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsx("div", { className: "h-3 w-1/4 rounded bg-[#3F3F46]" })] })] }), jsx("div", { className: "h-8 w-2/3 bg-[#27272A] rounded-lg mt-2" })] })),
895
900
  },
896
901
  ];
897
- return (jsx(RadioGroup, { value: value, onChange: function (e) { return onChange(e.target.value); }, className: "flex gap-6 w-full ".concat(className || ""), style: { gap: 16 }, children: themes.map(function (theme) { return (jsxs("div", { className: "relative rounded-[14px] ".concat(theme.cardClass, " p-6 w-1/2 min-h-[180px] transition-all duration-200 flex flex-col justify-start"), children: [jsx("div", { className: "absolute top-6 right-6", children: jsx(Radio, { "aria-label": theme.label, color: theme.radioColor, size: "sm", value: theme.key }) }), jsx("span", { className: theme.labelClass, children: theme.label }), theme.previewContent] }, theme.key)); }) }));
902
+ return (jsx(RadioGroup, { value: value, onChange: function (e) { return onChange(e.target.value); }, className: "flex justify-center ".concat(className || ""), orientation: "horizontal", classNames: {
903
+ wrapper: "gap-3",
904
+ }, children: themes.map(function (theme) { return (jsxs("div", { className: "relative rounded-2xl ".concat(theme.cardClass, " p-4 flex-1 transition-all duration-200 flex flex-col justify-start"), children: [jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsx("span", { className: theme.labelClass, children: theme.label }), jsx(Radio, { "aria-label": theme.label, color: theme.radioColor, size: "sm", value: theme.key })] }), theme.previewContent] }, theme.key)); }) }));
898
905
  };
899
906
 
900
907
  var ConfigMenu = function (_a) {
@@ -1,5 +1,4 @@
1
1
  import type React from "react";
2
2
  import type { DateRangePickerProps } from "./DateRangePicker.types";
3
- import "./DateRangePicker.scss";
4
3
  export declare const DateRangePicker: React.FC<DateRangePickerProps>;
5
4
  //# sourceMappingURL=DateRangePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/daterangepicker/DateRangePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,wBAAwB,CAAC;AAEhC,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsB1D,CAAC"}
1
+ {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/daterangepicker/DateRangePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsB1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAyDxE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwM3C,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkN3C,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -6,13 +6,24 @@ export interface PhoneTranslations {
6
6
  expandListAriaLabel?: string;
7
7
  noCountriesFound?: string;
8
8
  }
9
+ export interface Country {
10
+ code: string;
11
+ name: string;
12
+ flag: string;
13
+ }
14
+ export interface PhoneValue {
15
+ countryCode?: string;
16
+ phoneNumber: string;
17
+ country?: string;
18
+ }
9
19
  export interface PhoneInputProps {
20
+ id?: string;
10
21
  label?: string;
11
22
  required?: boolean;
12
23
  error?: boolean;
13
24
  errorText?: string;
14
- value?: string;
15
- onChange?: (value: string) => void;
25
+ value?: PhoneValue;
26
+ onChange?: (value: PhoneValue) => void;
16
27
  onBlur?: () => void;
17
28
  disabled?: boolean;
18
29
  name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Phone.types.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,iBAAiB,CAAC;CACjC"}
1
+ {"version":3,"file":"Phone.types.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,iBAAiB,CAAC;CACjC"}
@@ -0,0 +1,13 @@
1
+ import type { PhoneTranslations } from "./Phone.types";
2
+ export declare const countries: {
3
+ code: string;
4
+ name: string;
5
+ flag: string;
6
+ }[];
7
+ export declare const uniqueCountries: {
8
+ code: string;
9
+ name: string;
10
+ flag: string;
11
+ }[];
12
+ export declare const defaultTranslations: Required<PhoneTranslations>;
13
+ //# sourceMappingURL=phone.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone.constants.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/phone.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,SAAS;;;;GAsCrB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;GAE3B,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,CAO3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/theme-picker/ThemePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEX,gBAAgB,EAEhB,MAAM,qBAAqB,CAAC;AAQ7B;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwFlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/theme-picker/ThemePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEX,gBAAgB,EAEhB,MAAM,qBAAqB,CAAC;AAQ7B;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2FlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beweco/aurora-ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Bewe Aurora UI Component Library",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",