@ews-admin/global-design-system 1.1.14 → 1.1.15
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/components/Logo/Logo.d.ts +3 -27
- package/dist/components/Logo/Logo.d.ts.map +1 -1
- package/dist/components/Logo/Logo.types.d.ts +41 -0
- package/dist/components/Logo/Logo.types.d.ts.map +1 -0
- package/dist/components/Logo/index.d.ts +1 -1
- package/dist/components/Logo/index.d.ts.map +1 -1
- package/dist/components/Logo/logoAssets.d.ts +1 -0
- package/dist/components/Logo/logoAssets.d.ts.map +1 -0
- package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts +1 -1
- package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +3 -3
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/hooks/useSelectField.d.ts +4 -4
- package/dist/hooks/useSelectField.d.ts.map +1 -1
- package/dist/icons/Icon.d.ts +1 -1
- package/dist/icons/Icon.d.ts.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.d.ts +30 -14
- package/dist/index.esm.css +2 -2
- package/dist/index.esm.js +55 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +54 -20
- package/dist/index.js.map +1 -1
- package/dist/styles/theme-variables.css +62 -0
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Logo/Logo.tsx +65 -45
- package/src/components/Logo/Logo.types.ts +42 -0
- package/src/components/Logo/index.ts +1 -1
- package/src/components/SearchAutocomplete/SearchAutocomplete.tsx +1 -1
- package/src/components/Select/Select.tsx +21 -8
- package/src/hooks/useSelectField.ts +7 -2
- package/src/icons/Icon.tsx +1 -1
- package/src/styles/index.css +0 -32
- package/src/utils/index.ts +5 -3
- package/tailwind.preset.js +23 -23
package/dist/index.js
CHANGED
|
@@ -75,13 +75,15 @@ const formatNumeric = (value) => {
|
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* Utility function to validate phone numbers
|
|
78
|
-
* Validates phone numbers with 1-
|
|
78
|
+
* Validates phone numbers with 1-17 digits, optionally starting with + symbol
|
|
79
79
|
* @param value - Phone number string to validate
|
|
80
80
|
* @returns Boolean indicating if the phone number is valid
|
|
81
81
|
*/
|
|
82
82
|
function isValidPhoneNumber(value) {
|
|
83
83
|
const trimmedValue = value.trim();
|
|
84
|
-
|
|
84
|
+
// Allow + at the beginning, followed by 1-17 digits
|
|
85
|
+
// Or just 1-17 digits without +
|
|
86
|
+
const phoneRegex = /^(\+\d{1,17}|\d{1,17})$/;
|
|
85
87
|
return phoneRegex.test(trimmedValue);
|
|
86
88
|
}
|
|
87
89
|
|
|
@@ -517,7 +519,7 @@ const Select = React.forwardRef(({ options = [], value, onChange, placeholder =
|
|
|
517
519
|
? options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
|
|
518
520
|
: options;
|
|
519
521
|
// Calculate dropdown position based on available space
|
|
520
|
-
const calculateDropdownPosition = () => {
|
|
522
|
+
const calculateDropdownPosition = React.useCallback(() => {
|
|
521
523
|
if (!containerRef.current)
|
|
522
524
|
return;
|
|
523
525
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
@@ -548,7 +550,7 @@ const Select = React.forwardRef(({ options = [], value, onChange, placeholder =
|
|
|
548
550
|
else {
|
|
549
551
|
setDropdownPosition("bottom");
|
|
550
552
|
}
|
|
551
|
-
};
|
|
553
|
+
}, [filteredOptions.length, searchable, maxHeight]);
|
|
552
554
|
// Alternative calculation using actual dropdown element when available
|
|
553
555
|
const calculateDropdownPositionWithElement = () => {
|
|
554
556
|
if (!containerRef.current || !dropdownRef.current)
|
|
@@ -598,7 +600,13 @@ const Select = React.forwardRef(({ options = [], value, onChange, placeholder =
|
|
|
598
600
|
calculateDropdownPositionWithElement();
|
|
599
601
|
});
|
|
600
602
|
}
|
|
601
|
-
}, [
|
|
603
|
+
}, [
|
|
604
|
+
isOpen,
|
|
605
|
+
filteredOptions.length,
|
|
606
|
+
searchable,
|
|
607
|
+
maxHeight,
|
|
608
|
+
calculateDropdownPosition,
|
|
609
|
+
]);
|
|
602
610
|
// Recalculate position on window resize
|
|
603
611
|
React.useEffect(() => {
|
|
604
612
|
const handleResize = () => {
|
|
@@ -612,7 +620,7 @@ const Select = React.forwardRef(({ options = [], value, onChange, placeholder =
|
|
|
612
620
|
window.removeEventListener("resize", handleResize);
|
|
613
621
|
window.removeEventListener("scroll", handleResize);
|
|
614
622
|
};
|
|
615
|
-
}, [isOpen]);
|
|
623
|
+
}, [isOpen, calculateDropdownPosition]);
|
|
616
624
|
// Handle keyboard navigation
|
|
617
625
|
const handleKeyDown = (event) => {
|
|
618
626
|
if (disabled)
|
|
@@ -1721,7 +1729,7 @@ const DropdownMultiSelect = ({ options, name, control, placeholder = "Select opt
|
|
|
1721
1729
|
}), error && jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ews-error", children: error })] }));
|
|
1722
1730
|
};
|
|
1723
1731
|
|
|
1724
|
-
const Logo = ({ size = "md", showTagline: _showTagline = true, iconOnly = false, variant = "normal", className, onClick, }) => {
|
|
1732
|
+
const Logo = ({ size = "md", showTagline: _showTagline = true, iconOnly = false, variant = "normal", className, onClick, customSrc, alt = "MEDECINE 360 Logo", clickable = false, }) => {
|
|
1725
1733
|
const sizes = {
|
|
1726
1734
|
sm: "h-8",
|
|
1727
1735
|
md: "h-12",
|
|
@@ -1734,21 +1742,47 @@ const Logo = ({ size = "md", showTagline: _showTagline = true, iconOnly = false,
|
|
|
1734
1742
|
lg: "h-12 w-12",
|
|
1735
1743
|
xl: "h-16 w-16",
|
|
1736
1744
|
};
|
|
1737
|
-
// Get the appropriate logo image based on variant
|
|
1738
|
-
// For iconOnly, always use favicon.ico
|
|
1739
|
-
const logoSrc =
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1745
|
+
// Get the appropriate logo image based on variant or custom source
|
|
1746
|
+
// For iconOnly, always use favicon.ico unless customSrc is provided
|
|
1747
|
+
const logoSrc = customSrc ||
|
|
1748
|
+
(iconOnly
|
|
1749
|
+
? "/favicon.ico"
|
|
1750
|
+
: variant === "white"
|
|
1751
|
+
? "/image/logoWhite.png"
|
|
1752
|
+
: variant === "fullWhite"
|
|
1753
|
+
? "/image/logoFullWhite.png"
|
|
1754
|
+
: variant === "favicon"
|
|
1755
|
+
? "/favicon.ico"
|
|
1756
|
+
: "/image/logo.png");
|
|
1757
|
+
const isClickable = clickable || !!onClick;
|
|
1748
1758
|
if (iconOnly) {
|
|
1749
|
-
return (jsxRuntime.jsx("div", { className: cn("flex items-center justify-center", iconSizes[size], className), onClick: onClick, role:
|
|
1759
|
+
return (jsxRuntime.jsx("div", { className: cn("flex items-center justify-center", iconSizes[size], isClickable && "cursor-pointer", className), onClick: onClick, role: isClickable ? "button" : undefined, tabIndex: isClickable ? 0 : undefined, onKeyDown: isClickable
|
|
1760
|
+
? (e) => {
|
|
1761
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1762
|
+
e.preventDefault();
|
|
1763
|
+
onClick?.();
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
: undefined, children: jsxRuntime.jsx("img", { src: logoSrc, alt: alt, className: "object-contain w-full h-full", onError: (e) => {
|
|
1767
|
+
// Fallback to favicon if image fails to load
|
|
1768
|
+
if (logoSrc !== "/favicon.ico") {
|
|
1769
|
+
e.target.src = "/favicon.ico";
|
|
1770
|
+
}
|
|
1771
|
+
} }) }));
|
|
1750
1772
|
}
|
|
1751
|
-
return (jsxRuntime.jsx("div", { className: cn("flex items-center", sizes[size], className), onClick: onClick, role:
|
|
1773
|
+
return (jsxRuntime.jsx("div", { className: cn("flex items-center", sizes[size], isClickable && "cursor-pointer", className), onClick: onClick, role: isClickable ? "button" : undefined, tabIndex: isClickable ? 0 : undefined, onKeyDown: isClickable
|
|
1774
|
+
? (e) => {
|
|
1775
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1776
|
+
e.preventDefault();
|
|
1777
|
+
onClick?.();
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
: undefined, children: jsxRuntime.jsx("img", { src: logoSrc, alt: alt, className: "object-contain w-auto h-full", onError: (e) => {
|
|
1781
|
+
// Fallback to favicon if image fails to load
|
|
1782
|
+
if (logoSrc !== "/favicon.ico") {
|
|
1783
|
+
e.target.src = "/favicon.ico";
|
|
1784
|
+
}
|
|
1785
|
+
} }) }));
|
|
1752
1786
|
};
|
|
1753
1787
|
|
|
1754
1788
|
const PROMED_THEME = {
|