kiban-design-system 1.0.284-alpha.0 → 1.0.287-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/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
- alerts = alerts.filter(alertElement => alertElement.duration > 0);
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.id ? () => deleteAlert(alertItem.id) : undefined,
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))
@@ -6897,6 +6910,12 @@ const useShowAlert = () => {
6897
6910
  } = useContext(AlertContext);
6898
6911
  return addAlert;
6899
6912
  };
6913
+ const useDeleteAlert = () => {
6914
+ const {
6915
+ deleteAlert
6916
+ } = useContext(AlertContext);
6917
+ return deleteAlert;
6918
+ };
6900
6919
 
6901
6920
  const MAIN_CLASS$q = "column";
6902
6921
  /** Grid.Item is used for set size of element in the Grid
@@ -18281,11 +18300,11 @@ const Item$2 = ({
18281
18300
  const isCollapsed = isCollapsedProp !== undefined ? isCollapsedProp : collapsed;
18282
18301
  const AnchorComponent = !isExternal ? anchorComponent || "a" : "a";
18283
18302
  const isActive = useMemo(() => {
18284
- if (location && url) {
18303
+ if (location?.pathname && url) {
18285
18304
  return isExact ? location.pathname === url : location.pathname.includes(url);
18286
18305
  }
18287
18306
  return isActiveProp;
18288
- }, [location, isExact, isActiveProp, url]);
18307
+ }, [location?.pathname, isExact, isActiveProp, url]);
18289
18308
  useEffect(() => {
18290
18309
  if (isActive && subNavigationItems) {
18291
18310
  setCurrentTierItems?.(subNavigationItems || [], {
@@ -41323,5 +41342,5 @@ const Link = ({
41323
41342
  });
41324
41343
  };
41325
41344
 
41326
- export { ActionList, Alert, AlertProvider, AlphaAttributeInput, AlphaBadge, AlphaButton, AlphaChip, AlphaFilterControl, AlphaGraphicCard, AlphaIcon, AlphaInlineError, AlphaInputDate, InputTag$1 as AlphaInputTag, AlphaInputText, AlphaLabel, AlphaLabelledField, AlphaMultiSelectionPicker, AlphaSegmentedControl, AlphaSideMenu, AlphaSpinner, AlphaStepper, AlphaTag, AlphaTile, AlphaTooltip, Totalizer as AlphaTotalizer, AlphaZipCodeInput, AnnotatedSection, Avatar, Badge, Banner, Button, CalendarPicker, Card, Checkbox, ChoiceList, Collapsible, Connector, Container, Cover, DataTable, DatePicker, DeletableSection, Divider, DynamicForm, EmptyState, ErrorIcon, FileDownloader, Filedrop, FilterControl, Filters, Footer, Form$1 as Form, FormField, FormLayout, Frame, Grid, GridItem, Header$1 as Header, Icon, IconButton, IndexList, InlineEdit, InputPhoneNumber, InputTag, InputText, Item$2 as Item, JsonViewer, Label, Link, ListInfo, Loader, Logo, Media, Modal, ModalHeader, Nip, OptionList, Page, PageActions, Pagination, Pane, Panel, PanelFooter, PanelHeader, PendingIcon, Popover$1 as Popover, Progress, RadioButton, Section$1 as Section, SectionForm, Select, SideMenu, SkeletonInput, SkeletonMedia, SkeletonTabs, SkeletonText, SkeletonTitle, SortableList, Spinner, Stack, StepDefault, SuccessIcon, Table, Tabs, Tag, ThemeProvider, ThreadItem, Thumbnail, Tier, Tile, TimeSelector, Title, Toggle, Tooltip, WarningIcon, capitalize, cssClassName, formatDate, formatFileSize, isComponentTypeOf, isValidIcon, themeClassConverter, useShowAlert, useTheme };
41345
+ export { ActionList, Alert, AlertProvider, AlphaAttributeInput, AlphaBadge, AlphaButton, AlphaChip, AlphaFilterControl, AlphaGraphicCard, AlphaIcon, AlphaInlineError, AlphaInputDate, InputTag$1 as AlphaInputTag, AlphaInputText, AlphaLabel, AlphaLabelledField, AlphaMultiSelectionPicker, AlphaSegmentedControl, AlphaSideMenu, AlphaSpinner, AlphaStepper, AlphaTag, AlphaTile, AlphaTooltip, Totalizer as AlphaTotalizer, AlphaZipCodeInput, AnnotatedSection, Avatar, Badge, Banner, Button, CalendarPicker, Card, Checkbox, ChoiceList, Collapsible, Connector, Container, Cover, DataTable, DatePicker, DeletableSection, Divider, DynamicForm, EmptyState, ErrorIcon, FileDownloader, Filedrop, FilterControl, Filters, Footer, Form$1 as Form, FormField, FormLayout, Frame, Grid, GridItem, Header$1 as Header, Icon, IconButton, IndexList, InlineEdit, InputPhoneNumber, InputTag, InputText, Item$2 as Item, JsonViewer, Label, Link, ListInfo, Loader, Logo, Media, Modal, ModalHeader, Nip, OptionList, Page, PageActions, Pagination, Pane, Panel, PanelFooter, PanelHeader, PendingIcon, Popover$1 as Popover, Progress, RadioButton, Section$1 as Section, SectionForm, Select, SideMenu, SkeletonInput, SkeletonMedia, SkeletonTabs, SkeletonText, SkeletonTitle, SortableList, Spinner, Stack, StepDefault, SuccessIcon, Table, Tabs, Tag, ThemeProvider, ThreadItem, Thumbnail, Tier, Tile, TimeSelector, Title, Toggle, Tooltip, WarningIcon, capitalize, cssClassName, formatDate, formatFileSize, isComponentTypeOf, isValidIcon, themeClassConverter, useDeleteAlert, useShowAlert, useTheme };
41327
41346
  //# sourceMappingURL=index.esm.js.map