@optigrit/optigrit-ui 0.0.14 → 0.0.16
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/index.js +28 -22
- package/index.css +1 -1
- package/package.json +1 -1
- package/tailwind.preset.js +14 -12
package/dist/components/index.js
CHANGED
|
@@ -1599,6 +1599,30 @@ var icons = {
|
|
|
1599
1599
|
warning: /* @__PURE__ */ jsx37(WarningIcon, {}),
|
|
1600
1600
|
info: /* @__PURE__ */ jsx37(InfoIcon, {})
|
|
1601
1601
|
};
|
|
1602
|
+
var textStyles = {
|
|
1603
|
+
success: "text-success-800",
|
|
1604
|
+
error: "text-error-800",
|
|
1605
|
+
warning: "text-warning-800",
|
|
1606
|
+
info: "text-info-800"
|
|
1607
|
+
};
|
|
1608
|
+
var alertStyles = {
|
|
1609
|
+
success: "bg-success-50 border-success-200 text-success-800",
|
|
1610
|
+
error: "bg-error-50 border-error-200 text-error-800",
|
|
1611
|
+
warning: "bg-warning-50 border-warning-200 text-warning-800",
|
|
1612
|
+
info: "bg-info-50 border-info-200 text-info-800"
|
|
1613
|
+
};
|
|
1614
|
+
var iconStyles = {
|
|
1615
|
+
success: "text-success-600",
|
|
1616
|
+
error: "text-error-600",
|
|
1617
|
+
warning: "text-warning-600",
|
|
1618
|
+
info: "text-info-600"
|
|
1619
|
+
};
|
|
1620
|
+
var progressColors = {
|
|
1621
|
+
success: "bg-success-900",
|
|
1622
|
+
error: "bg-error-900",
|
|
1623
|
+
warning: "bg-warning-900",
|
|
1624
|
+
info: "bg-info-900"
|
|
1625
|
+
};
|
|
1602
1626
|
function AlertComponent({ open, title, type, options, onClose }) {
|
|
1603
1627
|
if (typeof window === "undefined") return null;
|
|
1604
1628
|
const [progress, setProgress] = useState7(100);
|
|
@@ -1661,24 +1685,6 @@ function AlertComponent({ open, title, type, options, onClose }) {
|
|
|
1661
1685
|
if (!options?.duration || remainingRef.current <= 0) return;
|
|
1662
1686
|
startProgressAnimation(remainingRef.current);
|
|
1663
1687
|
}, [options?.duration, startProgressAnimation]);
|
|
1664
|
-
const alertStyles = {
|
|
1665
|
-
success: "bg-green-50 border-green-200 text-green-800 dark:bg-green-950 dark:border-green-800 dark:text-green-300",
|
|
1666
|
-
error: "bg-red-50 border-red-200 text-red-800 dark:bg-red-950 dark:border-red-800 dark:text-red-300",
|
|
1667
|
-
warning: "bg-yellow-50 border-yellow-200 text-yellow-800 dark:bg-yellow-950 dark:border-yellow-800 dark:text-yellow-300",
|
|
1668
|
-
info: "bg-blue-50 border-blue-200 text-blue-800 dark:bg-blue-950 dark:border-blue-800 dark:text-blue-300"
|
|
1669
|
-
};
|
|
1670
|
-
const iconStyles = {
|
|
1671
|
-
success: "text-green-600 dark:text-green-400",
|
|
1672
|
-
error: "text-red-600 dark:text-red-400",
|
|
1673
|
-
warning: "text-yellow-600 dark:text-yellow-400",
|
|
1674
|
-
info: "text-blue-600 dark:text-blue-400"
|
|
1675
|
-
};
|
|
1676
|
-
const progressColors = {
|
|
1677
|
-
success: "bg-green-500",
|
|
1678
|
-
error: "bg-red-500",
|
|
1679
|
-
warning: "bg-yellow-500",
|
|
1680
|
-
info: "bg-blue-500"
|
|
1681
|
-
};
|
|
1682
1688
|
return /* @__PURE__ */ jsx37(
|
|
1683
1689
|
ShowWithAnimation,
|
|
1684
1690
|
{
|
|
@@ -1710,12 +1716,12 @@ function AlertComponent({ open, title, type, options, onClose }) {
|
|
|
1710
1716
|
children: [
|
|
1711
1717
|
/* @__PURE__ */ jsxs18("div", { className: cn("flex gap-3 items-center px-4 pt-4", options?.content ? "pb-2" : "pb-4"), children: [
|
|
1712
1718
|
/* @__PURE__ */ jsx37("div", { className: cn("flex-shrink-0", iconStyles[type]), children: icons[type] }),
|
|
1713
|
-
/* @__PURE__ */ jsx37("h3", { className: "flex-1 text-sm font-semibold", children: title }),
|
|
1719
|
+
/* @__PURE__ */ jsx37("h3", { className: cn("flex-1 text-sm font-semibold", textStyles[type]), children: title }),
|
|
1714
1720
|
/* @__PURE__ */ jsx37(
|
|
1715
1721
|
"button",
|
|
1716
1722
|
{
|
|
1717
1723
|
onClick: onClose,
|
|
1718
|
-
className: "flex-shrink-0 opacity-50 hover:opacity-100 transition-opacity rounded-md",
|
|
1724
|
+
className: cn("flex-shrink-0 opacity-50 hover:opacity-100 transition-opacity rounded-md", textStyles[type]),
|
|
1719
1725
|
"aria-label": "Close Alert",
|
|
1720
1726
|
children: /* @__PURE__ */ jsx37(CloseIcon, {})
|
|
1721
1727
|
}
|
|
@@ -1726,7 +1732,7 @@ function AlertComponent({ open, title, type, options, onClose }) {
|
|
|
1726
1732
|
"button",
|
|
1727
1733
|
{
|
|
1728
1734
|
onClick: () => setShowContent(!showContent),
|
|
1729
|
-
className: "text-xs font-medium underline opacity-80 hover:opacity-100 transition-opacity flex items-center gap-1",
|
|
1735
|
+
className: cn("text-xs font-medium underline opacity-80 hover:opacity-100 transition-opacity flex items-center gap-1", textStyles[type]),
|
|
1730
1736
|
children: [
|
|
1731
1737
|
showContent ? "Less Info" : "More Info",
|
|
1732
1738
|
/* @__PURE__ */ jsx37(ChevronDownIcon, { className: cn("w-3 h-3 transition-transform duration-200", showContent ? "rotate-180" : "rotate-0") })
|
|
@@ -1736,7 +1742,7 @@ function AlertComponent({ open, title, type, options, onClose }) {
|
|
|
1736
1742
|
/* @__PURE__ */ jsx37("div", { className: cn(
|
|
1737
1743
|
"grid transition-all duration-300 ease-in-out",
|
|
1738
1744
|
showContent ? "grid-rows-[1fr] opacity-100 mt-2" : "grid-rows-[0fr] opacity-0 mt-0"
|
|
1739
|
-
), children: /* @__PURE__ */ jsx37("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx37("div", { className: "text-sm opacity-90 leading-relaxed pb-1", children: options.content }) }) })
|
|
1745
|
+
), children: /* @__PURE__ */ jsx37("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx37("div", { className: cn("text-sm opacity-90 leading-relaxed pb-1", textStyles[type]), children: options.content }) }) })
|
|
1740
1746
|
] }),
|
|
1741
1747
|
options?.duration && /* @__PURE__ */ jsx37("div", { className: "w-full h-1 bg-black/5 dark:bg-white/5 absolute bottom-0 left-0", children: /* @__PURE__ */ jsx37(
|
|
1742
1748
|
"div",
|
package/index.css
CHANGED
package/package.json
CHANGED
package/tailwind.preset.js
CHANGED
|
@@ -28,24 +28,26 @@ export default {
|
|
|
28
28
|
|
|
29
29
|
function generateShades(color) {
|
|
30
30
|
const shades = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
50: '',
|
|
32
|
+
DEFAULT: '',
|
|
33
|
+
100: '',
|
|
34
|
+
200: '',
|
|
35
|
+
300: '',
|
|
36
|
+
400: '',
|
|
37
|
+
500: '',
|
|
38
|
+
600: '',
|
|
39
|
+
700: '',
|
|
40
|
+
800: '',
|
|
41
|
+
900: '',
|
|
42
|
+
950: ''
|
|
41
43
|
};
|
|
42
44
|
|
|
43
|
-
for(let shadeKey in shades) {
|
|
45
|
+
for (let shadeKey in shades) {
|
|
44
46
|
const ratio = shadeKey === 'DEFAULT' ? 100 : parseInt(shadeKey) / 10;
|
|
45
47
|
shades[shadeKey] = `
|
|
46
48
|
rgb(
|
|
47
49
|
from color-mix(
|
|
48
|
-
in srgb, ${color} ${ratio}%, var(--bg, white) ${100 - ratio}%
|
|
50
|
+
in srgb, ${color} ${ratio}%, var(--bg-secondary, white) ${100 - ratio}%
|
|
49
51
|
) r g b / <alpha-value>
|
|
50
52
|
)
|
|
51
53
|
`;
|