fis-component 0.2.4 → 0.2.6

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.
@@ -21,6 +21,7 @@ declare const meta: {
21
21
  actionLabel?: string | undefined;
22
22
  closable?: boolean | undefined;
23
23
  onClickAction?: (() => void) | undefined;
24
+ onClose?: (() => void) | undefined;
24
25
  }>) => import("react/jsx-runtime").JSX.Element)[];
25
26
  argTypes: {
26
27
  theme: {
@@ -144,3 +145,13 @@ export declare const NoIcon: import("@storybook/core/csf").AnnotatedStoryFn<impo
144
145
  export declare const NoCloseButton: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").ToastProps>;
145
146
  export declare const NoAction: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").ToastProps>;
146
147
  export declare const BottomAction: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").ToastProps>;
148
+ export declare const QueueBehavior: {
149
+ (): import("react/jsx-runtime").JSX.Element;
150
+ parameters: {
151
+ docs: {
152
+ description: {
153
+ story: string;
154
+ };
155
+ };
156
+ };
157
+ };
@@ -1,8 +1,21 @@
1
1
  import React from "react";
2
2
  import { ToastProps, ToastPositionType } from ".";
3
- interface ToastOptions extends ToastProps {
3
+ export interface ToastOptions extends ToastProps {
4
+ /**
5
+ * Thời gian hiển thị (ms). Trống hoặc 0 → 3000.
6
+ * Giá trị không hữu hạn (Infinity) → không tự tắt, chỉ mất khi bấm ✕ hoặc bị thay.
7
+ * Giá trị lớn hơn 2147483647 được kẹp về 2147483647.
8
+ */
4
9
  duration?: number;
10
+ /** Vị trí hiển thị. Mặc định "top-right". */
5
11
  position?: ToastPositionType;
12
+ /**
13
+ * Danh tính của toast. Toast mới cùng `key` sẽ thay toast cũ.
14
+ * Không truyền thì hai toast coi là trùng khi cùng `title` và `theme`.
15
+ */
16
+ key?: string;
17
+ /** Gọi khi người dùng bấm ✕, trước khi toast bị gỡ. */
18
+ onClose?: () => void;
6
19
  }
7
20
  export interface ToastContextType {
8
21
  showToast: (options: ToastOptions) => void;
@@ -11,4 +24,3 @@ export declare const ToastContext: React.Context<ToastContextType | undefined>;
11
24
  export declare const ToastProvider: React.FC<{
12
25
  children: React.ReactNode;
13
26
  }>;
14
- export {};
@@ -15,6 +15,12 @@ export type ToastProps = {
15
15
  actionLabel?: string;
16
16
  closable?: boolean;
17
17
  onClickAction?: () => void;
18
+ /**
19
+ * Gọi khi bấm nút đóng (✕). Khi có prop này, toast không tự ẩn mà để
20
+ * component cha quyết định (ví dụ ToastProvider gỡ toast khỏi danh sách).
21
+ * Không truyền thì toast tự ẩn tại chỗ như trước.
22
+ */
23
+ onClose?: () => void;
18
24
  };
19
25
  declare const FISToast: React.FC<ToastProps>;
20
26
  export default FISToast;
@@ -52,6 +52,8 @@ export type { FISTableRef, TableProps as FISTableProps, } from "./components/Tab
52
52
  export type { ApiSelectProps, ApiSelectRef, FetchAll, FetchPage, FetchPageParams, FetchPageResult, FetchAllParams, } from "./components/ApiSelect/types";
53
53
  export { default as useNotification } from "./components/Notification/useNotification";
54
54
  export { default as useToast } from "./components/Toast/useToast";
55
+ export type { ToastOptions, ToastContextType, } from "./components/Toast/ToastContext";
56
+ export type { ToastProps, ToastPositionType } from "./components/Toast";
55
57
  export type { PaginationProps as FISPaginationProps } from "./components/Pagination";
56
58
  export declare const FISButton: typeof RawButton;
57
59
  export declare const FISLinkButton: typeof RawLinkButton;
package/dist/index.d.ts CHANGED
@@ -4221,6 +4221,12 @@ type ToastProps = {
4221
4221
  actionLabel?: string;
4222
4222
  closable?: boolean;
4223
4223
  onClickAction?: () => void;
4224
+ /**
4225
+ * Gọi khi bấm nút đóng (✕). Khi có prop này, toast không tự ẩn mà để
4226
+ * component cha quyết định (ví dụ ToastProvider gỡ toast khỏi danh sách).
4227
+ * Không truyền thì toast tự ẩn tại chỗ như trước.
4228
+ */
4229
+ onClose?: () => void;
4224
4230
  };
4225
4231
  declare const FISToast$1: React__default.FC<ToastProps>;
4226
4232
 
@@ -4892,8 +4898,21 @@ declare const useNotification: () => {
4892
4898
  };
4893
4899
 
4894
4900
  interface ToastOptions extends ToastProps {
4901
+ /**
4902
+ * Thời gian hiển thị (ms). Trống hoặc 0 → 3000.
4903
+ * Giá trị không hữu hạn (Infinity) → không tự tắt, chỉ mất khi bấm ✕ hoặc bị thay.
4904
+ * Giá trị lớn hơn 2147483647 được kẹp về 2147483647.
4905
+ */
4895
4906
  duration?: number;
4907
+ /** Vị trí hiển thị. Mặc định "top-right". */
4896
4908
  position?: ToastPositionType;
4909
+ /**
4910
+ * Danh tính của toast. Toast mới cùng `key` sẽ thay toast cũ.
4911
+ * Không truyền thì hai toast coi là trùng khi cùng `title` và `theme`.
4912
+ */
4913
+ key?: string;
4914
+ /** Gọi khi người dùng bấm ✕, trước khi toast bị gỡ. */
4915
+ onClose?: () => void;
4897
4916
  }
4898
4917
  interface ToastContextType {
4899
4918
  showToast: (options: ToastOptions) => void;
@@ -4952,4 +4971,4 @@ declare const FISPagination: typeof FISPagination$1;
4952
4971
  declare const FISText: typeof FISText$1;
4953
4972
 
4954
4973
  export { FISAlertBanner, FISApiSelect, FISAvatar, FISBadge, FISBreadcrumb, FISButton, FISButtonGroup, FISCheckbox, FISCheckboxGroup, FISChipButton, FISCollapse, FISCombobox, FISConfigProvider, FISDateRange, FISDivider, FISIconButton, FISInputArea, FISInputDate, FISInputField, FISInputLabel, FISInputStepper, FISInputText, FISInputTime, FISLinkButton, FISMenuItem, FISMenuSection, FISMenuSelect, FISMenuSelectDropdown, FISPagination, FISProgressCircular, FISProgressLinear, FISRadio, FISRadioGroup, FISSegmented, FISSelect, FISSelectItem, FISSorter, FISSplitButton, FISSwitch, FISTab, FISTable, FISTableCell, FISTableHeaderCell, FISText, FISThemeProvider, FISToast, FISTooltip, SegmentedPanelItem, TabPanelItem, useFISComponentDefaults, useFISConfig, useNotification, useToast, withFISDefaults };
4955
- export type { ApiSelectProps, ApiSelectRef, FISComponentConfig, FISComponentDefaults, FISComponentName, FISConfigProviderProps, FISDefaultProps, FISMenuData, FISMenuSelectDropdownProps, FISNonConfigurableProp, PaginationProps as FISPaginationProps, TableProps as FISTableProps, FISTableRef, FetchAll, FetchAllParams, FetchPage, FetchPageParams, FetchPageResult, ThemeType$2 as ThemeType };
4974
+ export type { ApiSelectProps, ApiSelectRef, FISComponentConfig, FISComponentDefaults, FISComponentName, FISConfigProviderProps, FISDefaultProps, FISMenuData, FISMenuSelectDropdownProps, FISNonConfigurableProp, PaginationProps as FISPaginationProps, TableProps as FISTableProps, FISTableRef, FetchAll, FetchAllParams, FetchPage, FetchPageParams, FetchPageResult, ThemeType$2 as ThemeType, ToastContextType, ToastOptions, ToastPositionType, ToastProps };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "homepage": "https://vietdiemtran.github.io/fis-component/",
3
3
  "name": "fis-component",
4
- "version": "0.2.4",
4
+ "version": "0.2.6",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",