kiban-design-system 1.0.284-alpha.0 → 1.0.286-alpha.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/components/AlertProvider/AlertProvider.d.ts +4 -3
- package/dist/components/AlertProvider/AlertProvider.props.d.ts +9 -4
- package/dist/components/AlertProvider/context/AlertContext.d.ts +1 -1
- package/dist/index.cjs.js +23 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6811,7 +6811,8 @@ const Logo = ({
|
|
|
6811
6811
|
|
|
6812
6812
|
const AlertContext = /*#__PURE__*/createContext({
|
|
6813
6813
|
addAlert: () => null,
|
|
6814
|
-
limit: 0
|
|
6814
|
+
limit: 0,
|
|
6815
|
+
deleteAlert: () => {}
|
|
6815
6816
|
});
|
|
6816
6817
|
|
|
6817
6818
|
const AlertProvider = ({
|
|
@@ -6837,9 +6838,15 @@ const AlertProvider = ({
|
|
|
6837
6838
|
const countDownAlerts = () => {
|
|
6838
6839
|
let alerts = alertList.map(alertElem => ({
|
|
6839
6840
|
...alertElem,
|
|
6840
|
-
duration: alertElem.duration - 1000
|
|
6841
|
+
duration: alertElem.duration === "infinite" ? "infinite" : alertElem.duration - 1000
|
|
6841
6842
|
}));
|
|
6842
|
-
|
|
6843
|
+
// Trigger on dismiss event when an alert is dismissed
|
|
6844
|
+
alerts.forEach(alertElement => {
|
|
6845
|
+
if (alertElement.duration === 0) {
|
|
6846
|
+
alertElement.onDismiss?.(alertElement.id);
|
|
6847
|
+
}
|
|
6848
|
+
});
|
|
6849
|
+
alerts = alerts.filter(alertElement => alertElement.duration === "infinite" || typeof alertElement.duration === "number" && alertElement.duration > 0);
|
|
6843
6850
|
setAlertList(alerts);
|
|
6844
6851
|
};
|
|
6845
6852
|
useEffect(() => {
|
|
@@ -6856,7 +6863,9 @@ const AlertProvider = ({
|
|
|
6856
6863
|
icon,
|
|
6857
6864
|
appearance,
|
|
6858
6865
|
content,
|
|
6859
|
-
duration
|
|
6866
|
+
duration,
|
|
6867
|
+
onDismiss,
|
|
6868
|
+
dismissible = false
|
|
6860
6869
|
}) => {
|
|
6861
6870
|
const id = Math.floor(Math.random() * 100 + 1);
|
|
6862
6871
|
const alertAddProps = {
|
|
@@ -6864,9 +6873,12 @@ const AlertProvider = ({
|
|
|
6864
6873
|
appearance,
|
|
6865
6874
|
content,
|
|
6866
6875
|
duration,
|
|
6867
|
-
id
|
|
6876
|
+
id,
|
|
6877
|
+
onDismiss,
|
|
6878
|
+
dismissible
|
|
6868
6879
|
};
|
|
6869
6880
|
setNewAlert(alertAddProps);
|
|
6881
|
+
return id;
|
|
6870
6882
|
};
|
|
6871
6883
|
const deleteAlert = index => {
|
|
6872
6884
|
if (index !== undefined) {
|
|
@@ -6876,15 +6888,16 @@ const AlertProvider = ({
|
|
|
6876
6888
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(AlertContext.Provider, {
|
|
6877
6889
|
value: {
|
|
6878
6890
|
addAlert,
|
|
6879
|
-
limit
|
|
6891
|
+
limit,
|
|
6892
|
+
deleteAlert
|
|
6880
6893
|
},
|
|
6881
6894
|
children: [children, portalTarget && alertList.length > 0 && /*#__PURE__*/createPortal(/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
6882
6895
|
className: "AlertProvider",
|
|
6883
6896
|
children: alertList.map(alertItem => /*#__PURE__*/jsxRuntimeExports.jsx(Alert, {
|
|
6884
6897
|
icon: alertItem.icon,
|
|
6885
6898
|
appearance: alertItem.appearance,
|
|
6886
|
-
duration: alertItem.duration,
|
|
6887
|
-
onDismiss: alertItem.
|
|
6899
|
+
duration: alertItem.duration === "infinite" ? undefined : alertItem.duration,
|
|
6900
|
+
onDismiss: alertItem.dismissible ? () => deleteAlert(alertItem.id) : undefined,
|
|
6888
6901
|
content: alertItem.content,
|
|
6889
6902
|
id: alertItem.id
|
|
6890
6903
|
}, alertItem.id))
|
|
@@ -18281,11 +18294,11 @@ const Item$2 = ({
|
|
|
18281
18294
|
const isCollapsed = isCollapsedProp !== undefined ? isCollapsedProp : collapsed;
|
|
18282
18295
|
const AnchorComponent = !isExternal ? anchorComponent || "a" : "a";
|
|
18283
18296
|
const isActive = useMemo(() => {
|
|
18284
|
-
if (location && url) {
|
|
18297
|
+
if (location?.pathname && url) {
|
|
18285
18298
|
return isExact ? location.pathname === url : location.pathname.includes(url);
|
|
18286
18299
|
}
|
|
18287
18300
|
return isActiveProp;
|
|
18288
|
-
}, [location, isExact, isActiveProp, url]);
|
|
18301
|
+
}, [location?.pathname, isExact, isActiveProp, url]);
|
|
18289
18302
|
useEffect(() => {
|
|
18290
18303
|
if (isActive && subNavigationItems) {
|
|
18291
18304
|
setCurrentTierItems?.(subNavigationItems || [], {
|