@tecsinapse/cortex-react 2.1.0-beta.6 → 2.1.0-beta.7

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.
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Flags = require('country-flag-icons/react/3x2');
5
+
6
+ function _interopNamespaceDefault(e) {
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var Flags__namespace = /*#__PURE__*/_interopNamespaceDefault(Flags);
24
+
25
+ const FlagIcon = ({
26
+ countryCode,
27
+ className = "w-[25px]",
28
+ title
29
+ }) => {
30
+ if (!countryCode) return null;
31
+ const upperCode = countryCode.toUpperCase();
32
+ const FlagComponent = Flags__namespace[upperCode];
33
+ if (!FlagComponent) {
34
+ return null;
35
+ }
36
+ return /* @__PURE__ */ jsxRuntime.jsx(
37
+ FlagComponent,
38
+ {
39
+ className,
40
+ title: title || upperCode,
41
+ "aria-label": `Flag of ${upperCode}`
42
+ }
43
+ );
44
+ };
45
+
46
+ exports.FlagIcon = FlagIcon;
@@ -10,14 +10,14 @@ const PhoneInputOption = ({
10
10
  return /* @__PURE__ */ jsxRuntime.jsxs(
11
11
  "button",
12
12
  {
13
- className: "flex w-full h-[2rem] items-center justify-between p-centi cursor-pointer hover:bg-gray-100 bg-inherit",
13
+ className: "flex w-full h-[2rem] items-center justify-between p-centi cursor-pointer hover:bg-secondary-xlight bg-inherit",
14
14
  onClick: () => {
15
15
  handleSelectCountry(country);
16
16
  },
17
17
  disabled: disableClick,
18
18
  children: [
19
19
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: country?.name }),
20
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-gray-400 text-sm", children: [
20
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-secondary-light text-sm", children: [
21
21
  "+",
22
22
  country?.dialCode
23
23
  ] })
@@ -64,6 +64,7 @@ require('react-icons/fa6');
64
64
  require('react-dom');
65
65
  require('react-icons/io5');
66
66
  var reactInternationalPhone = require('react-international-phone');
67
+ require('country-flag-icons/react/3x2');
67
68
 
68
69
  const countries = reactInternationalPhone.defaultCountries.map((c) => {
69
70
  return reactInternationalPhone.parseCountry(c);
@@ -10,9 +10,8 @@ const PhoneInputPopover = ({ children }) => {
10
10
  return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
11
11
  index.Popover.Content,
12
12
  {
13
- className: "bg-white shadow-md rounded-md overflow-hidden h-full max-h-[30vh] outline-none",
13
+ className: "bg-white shadow-md rounded-md overflow-hidden h-full max-h-[30vh] outline-none z-9999",
14
14
  style: {
15
- zIndex: 9999,
16
15
  width: triggerWidth ? `${triggerWidth}px` : "auto"
17
16
  },
18
17
  children
@@ -64,6 +64,7 @@ require('react-dom');
64
64
  require('./Options.js');
65
65
  var context = require('./context.js');
66
66
  require('react-international-phone');
67
+ var FlagIcon = require('./FlagIcon.js');
67
68
 
68
69
  const PhoneInputTrigger = ({
69
70
  disabled = false,
@@ -100,13 +101,7 @@ const PhoneInputTrigger = ({
100
101
  className: "flex items-center gap-1 cursor-pointer w-full",
101
102
  onClick: () => setIsOpen?.(true),
102
103
  children: [
103
- country ? /* @__PURE__ */ jsxRuntime.jsx(
104
- "img",
105
- {
106
- src: `https://purecatamphetamine.github.io/country-flag-icons/3x2/${country?.iso2.toUpperCase()}.svg`,
107
- className: "w-[25px]"
108
- }
109
- ) : null,
104
+ country ? /* @__PURE__ */ jsxRuntime.jsx(FlagIcon.FlagIcon, { countryCode: country.iso2, className: "w-[25px]" }) : null,
110
105
  /* @__PURE__ */ jsxRuntime.jsx(io5.IoChevronDown, { className: "h-full text-md" })
111
106
  ]
112
107
  }
@@ -70,6 +70,7 @@ require('../components/PhoneInput/Options.js');
70
70
  require('../components/PhoneInput/context.js');
71
71
  require('react-international-phone');
72
72
  require('react-icons/io5');
73
+ require('country-flag-icons/react/3x2');
73
74
 
74
75
  const ManagerContext = React.createContext(null);
75
76
  const ManagerProvider = ({ children }) => {
@@ -0,0 +1,25 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import * as Flags from 'country-flag-icons/react/3x2';
3
+
4
+ const FlagIcon = ({
5
+ countryCode,
6
+ className = "w-[25px]",
7
+ title
8
+ }) => {
9
+ if (!countryCode) return null;
10
+ const upperCode = countryCode.toUpperCase();
11
+ const FlagComponent = Flags[upperCode];
12
+ if (!FlagComponent) {
13
+ return null;
14
+ }
15
+ return /* @__PURE__ */ jsx(
16
+ FlagComponent,
17
+ {
18
+ className,
19
+ title: title || upperCode,
20
+ "aria-label": `Flag of ${upperCode}`
21
+ }
22
+ );
23
+ };
24
+
25
+ export { FlagIcon };
@@ -8,14 +8,14 @@ const PhoneInputOption = ({
8
8
  return /* @__PURE__ */ jsxs(
9
9
  "button",
10
10
  {
11
- className: "flex w-full h-[2rem] items-center justify-between p-centi cursor-pointer hover:bg-gray-100 bg-inherit",
11
+ className: "flex w-full h-[2rem] items-center justify-between p-centi cursor-pointer hover:bg-secondary-xlight bg-inherit",
12
12
  onClick: () => {
13
13
  handleSelectCountry(country);
14
14
  },
15
15
  disabled: disableClick,
16
16
  children: [
17
17
  /* @__PURE__ */ jsx("span", { children: country?.name }),
18
- /* @__PURE__ */ jsxs("span", { className: "text-gray-400 text-sm", children: [
18
+ /* @__PURE__ */ jsxs("span", { className: "text-secondary-light text-sm", children: [
19
19
  "+",
20
20
  country?.dialCode
21
21
  ] })
@@ -62,6 +62,7 @@ import 'react-icons/fa6';
62
62
  import 'react-dom';
63
63
  import 'react-icons/io5';
64
64
  import { defaultCountries, parseCountry } from 'react-international-phone';
65
+ import 'country-flag-icons/react/3x2';
65
66
 
66
67
  const countries = defaultCountries.map((c) => {
67
68
  return parseCountry(c);
@@ -8,9 +8,8 @@ const PhoneInputPopover = ({ children }) => {
8
8
  return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
9
9
  Popover.Content,
10
10
  {
11
- className: "bg-white shadow-md rounded-md overflow-hidden h-full max-h-[30vh] outline-none",
11
+ className: "bg-white shadow-md rounded-md overflow-hidden h-full max-h-[30vh] outline-none z-9999",
12
12
  style: {
13
- zIndex: 9999,
14
13
  width: triggerWidth ? `${triggerWidth}px` : "auto"
15
14
  },
16
15
  children
@@ -62,6 +62,7 @@ import 'react-dom';
62
62
  import './Options.js';
63
63
  import { usePhoneContext } from './context.js';
64
64
  import 'react-international-phone';
65
+ import { FlagIcon } from './FlagIcon.js';
65
66
 
66
67
  const PhoneInputTrigger = ({
67
68
  disabled = false,
@@ -98,13 +99,7 @@ const PhoneInputTrigger = ({
98
99
  className: "flex items-center gap-1 cursor-pointer w-full",
99
100
  onClick: () => setIsOpen?.(true),
100
101
  children: [
101
- country ? /* @__PURE__ */ jsx(
102
- "img",
103
- {
104
- src: `https://purecatamphetamine.github.io/country-flag-icons/3x2/${country?.iso2.toUpperCase()}.svg`,
105
- className: "w-[25px]"
106
- }
107
- ) : null,
102
+ country ? /* @__PURE__ */ jsx(FlagIcon, { countryCode: country.iso2, className: "w-[25px]" }) : null,
108
103
  /* @__PURE__ */ jsx(IoChevronDown, { className: "h-full text-md" })
109
104
  ]
110
105
  }
@@ -68,6 +68,7 @@ import '../components/PhoneInput/Options.js';
68
68
  import '../components/PhoneInput/context.js';
69
69
  import 'react-international-phone';
70
70
  import 'react-icons/io5';
71
+ import 'country-flag-icons/react/3x2';
71
72
 
72
73
  const ManagerContext = createContext(null);
73
74
  const ManagerProvider = ({ children }) => {
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface FlagIconProps {
3
+ countryCode: string;
4
+ className?: string;
5
+ title?: string;
6
+ }
7
+ export declare const FlagIcon: React.FC<FlagIconProps>;
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "2.1.0-beta.6",
3
+ "version": "2.1.0-beta.7",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -20,8 +20,9 @@
20
20
  "dependencies": {
21
21
  "@floating-ui/react": "^0.26.18",
22
22
  "@internationalized/date": "3.7.0",
23
- "@tecsinapse/cortex-core": "2.0.0",
23
+ "@tecsinapse/cortex-core": "2.0.1",
24
24
  "clsx": "2.1.1",
25
+ "country-flag-icons": "^1.6.4",
25
26
  "currency.js": "2.0.4",
26
27
  "embla-carousel-autoplay": "^8.0.0",
27
28
  "embla-carousel-react": "^8.6.0",
@@ -49,5 +50,5 @@
49
50
  "react-icons": ">=5.2.0",
50
51
  "tailwindcss": "^4.1.16"
51
52
  },
52
- "gitHead": "ed355af197814bf13f477826cc4deff86c0ea5d5"
53
- }
53
+ "gitHead": "ba46003a38a57a0de7b0afd9bcdb438fc639a98e"
54
+ }