fis-component 0.1.34 → 0.1.36
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/cjs/index.js +97 -55
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Provider/ConfigContext.d.ts +15 -0
- package/dist/cjs/types/src/components/Provider/index.d.ts +3 -0
- package/dist/cjs/types/src/components/Select/Select.stories.d.ts +57 -6
- package/dist/cjs/types/src/components/Select/styles.d.ts +1 -0
- package/dist/cjs/types/src/components/Select/types.d.ts +9 -0
- package/dist/cjs/types/src/index.d.ts +2 -0
- package/dist/esm/index.js +96 -56
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Provider/ConfigContext.d.ts +15 -0
- package/dist/esm/types/src/components/Provider/index.d.ts +3 -0
- package/dist/esm/types/src/components/Select/Select.stories.d.ts +57 -6
- package/dist/esm/types/src/components/Select/styles.d.ts +1 -0
- package/dist/esm/types/src/components/Select/types.d.ts +9 -0
- package/dist/esm/types/src/index.d.ts +2 -0
- package/dist/index.d.ts +28 -2
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** Giá trị mặc định cho từng component, mỗi dự án tự cấu hình */
|
|
3
|
+
export interface FISComponentConfig {
|
|
4
|
+
select?: {
|
|
5
|
+
/** Mặc định allowClear cho FISSelect (prop truyền trực tiếp sẽ ưu tiên hơn) */
|
|
6
|
+
allowClear?: boolean;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface FISConfigProviderProps {
|
|
10
|
+
config?: FISComponentConfig;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** Có thể lồng nhau, config bên trong ghi đè config bên ngoài theo từng component */
|
|
14
|
+
export declare const FISConfigProvider: React.FC<FISConfigProviderProps>;
|
|
15
|
+
export declare const useFISConfig: () => FISComponentConfig;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DefaultTheme } from "styled-components";
|
|
3
|
+
import { FISComponentConfig } from "./ConfigContext";
|
|
3
4
|
export interface ThemeProviderProps {
|
|
4
5
|
theme?: DefaultTheme;
|
|
6
|
+
/** Cấu hình mặc định cho component theo từng dự án */
|
|
7
|
+
config?: FISComponentConfig;
|
|
5
8
|
children: React.ReactNode;
|
|
6
9
|
}
|
|
7
10
|
declare const FISThemeProvider: React.FC<ThemeProviderProps>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { SelectOption, SelectProps } from "./types";
|
|
2
|
-
type
|
|
3
|
-
type
|
|
4
|
-
type
|
|
1
|
+
import { FISSelectRef, SelectOption, SelectProps } from "./types";
|
|
2
|
+
type StoryArgs<P> = P extends unknown ? Omit<P, "renderOption" | "displayValue"> : never;
|
|
3
|
+
type SingleSelectStoryProps = StoryArgs<SelectProps<string>>;
|
|
4
|
+
type MultiSelectStoryProps = StoryArgs<SelectProps<string>>;
|
|
5
|
+
type NumberSelectStoryProps = StoryArgs<SelectProps<number>>;
|
|
5
6
|
declare const meta: {
|
|
6
7
|
title: string;
|
|
7
|
-
component: import("react").ForwardRefExoticComponent<SelectProps<string | number> & import("react").RefAttributes<
|
|
8
|
+
component: import("react").ForwardRefExoticComponent<SelectProps<string | number> & import("react").RefAttributes<FISSelectRef>>;
|
|
8
9
|
tags: string[];
|
|
9
10
|
parameters: {
|
|
10
11
|
controls: {
|
|
@@ -33,6 +34,10 @@ declare const meta: {
|
|
|
33
34
|
iconLabel: {
|
|
34
35
|
control: "select";
|
|
35
36
|
options: string[];
|
|
37
|
+
mapping: {
|
|
38
|
+
none: undefined;
|
|
39
|
+
info: import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
};
|
|
36
41
|
};
|
|
37
42
|
required: {
|
|
38
43
|
control: "boolean";
|
|
@@ -57,14 +62,50 @@ declare const meta: {
|
|
|
57
62
|
control: "text";
|
|
58
63
|
};
|
|
59
64
|
multiDisplayText: {
|
|
60
|
-
control:
|
|
65
|
+
control: false;
|
|
61
66
|
};
|
|
62
67
|
removeSelectedText: {
|
|
63
68
|
control: "text";
|
|
64
69
|
};
|
|
70
|
+
selectedGroupLabel: {
|
|
71
|
+
control: "text";
|
|
72
|
+
};
|
|
65
73
|
maxHeight: {
|
|
66
74
|
control: "number";
|
|
67
75
|
};
|
|
76
|
+
portal: {
|
|
77
|
+
control: "boolean";
|
|
78
|
+
};
|
|
79
|
+
hideChip: {
|
|
80
|
+
control: "boolean";
|
|
81
|
+
};
|
|
82
|
+
showSearch: {
|
|
83
|
+
control: "boolean";
|
|
84
|
+
};
|
|
85
|
+
searchDebounce: {
|
|
86
|
+
control: "number";
|
|
87
|
+
};
|
|
88
|
+
noData: {
|
|
89
|
+
control: "boolean";
|
|
90
|
+
};
|
|
91
|
+
noResult: {
|
|
92
|
+
control: "boolean";
|
|
93
|
+
};
|
|
94
|
+
noDataText: {
|
|
95
|
+
control: "text";
|
|
96
|
+
};
|
|
97
|
+
noResultText: {
|
|
98
|
+
control: "text";
|
|
99
|
+
};
|
|
100
|
+
virtualized: {
|
|
101
|
+
control: "boolean";
|
|
102
|
+
};
|
|
103
|
+
virtualItemHeight: {
|
|
104
|
+
control: "number";
|
|
105
|
+
};
|
|
106
|
+
onOpen: {
|
|
107
|
+
action: string;
|
|
108
|
+
};
|
|
68
109
|
};
|
|
69
110
|
args: {
|
|
70
111
|
options: SelectOption<string>[];
|
|
@@ -95,3 +136,13 @@ export declare const SimpleTooltip: import("@storybook/core/csf").AnnotatedStory
|
|
|
95
136
|
export declare const CustomTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
96
137
|
export declare const SecondaryTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
97
138
|
export declare const MultiSelectWithTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, MultiSelectStoryProps>;
|
|
139
|
+
export declare const Positive: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
140
|
+
export declare const MultiSelectCustomText: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, MultiSelectStoryProps>;
|
|
141
|
+
export declare const CustomRender: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
142
|
+
export declare const EmptyStates: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
143
|
+
export declare const SearchControl: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
144
|
+
export declare const Virtualized: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
145
|
+
export declare const LoadMore: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
146
|
+
export declare const NoPortal: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
147
|
+
export declare const WithRef: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
148
|
+
export declare const AllowClear: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
@@ -4,3 +4,4 @@ export declare const DivInputWrapperSC: import("styled-components/dist/types").I
|
|
|
4
4
|
}>> & string;
|
|
5
5
|
export declare const DivDropdownMenuSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
6
|
export declare const SelectedTagsWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const SpanClearIconSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
@@ -29,10 +29,19 @@ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omi
|
|
|
29
29
|
tooltipTitle?: TooltipTitleCustom | React.ReactNode;
|
|
30
30
|
/** Tooltip variant color */
|
|
31
31
|
tooltipVariant?: "primary" | "secondary";
|
|
32
|
+
/**
|
|
33
|
+
* Hiện icon xoá khi hover (giống antd).
|
|
34
|
+
* Không truyền thì lấy theo config.select.allowClear của FISThemeProvider.
|
|
35
|
+
* Xoá: single gọi onChange(undefined), multi gọi onChange([]).
|
|
36
|
+
*/
|
|
37
|
+
allowClear?: boolean;
|
|
38
|
+
/** Callback khi bấm icon xoá (chỉ dùng với allowClear) */
|
|
39
|
+
onClear?: () => void;
|
|
32
40
|
};
|
|
33
41
|
export type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
|
|
34
42
|
multi?: false;
|
|
35
43
|
value: T;
|
|
44
|
+
/** Với allowClear, value nhận được có thể là undefined khi bấm xoá */
|
|
36
45
|
onChange: (value: T) => void;
|
|
37
46
|
displayValue?: (item: SelectOptionItem<T>) => string;
|
|
38
47
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as FISThemeProvider } from "./components/Provider";
|
|
2
|
+
export { FISConfigProvider, useFISConfig, } from "./components/Provider/ConfigContext";
|
|
3
|
+
export type { FISComponentConfig, FISConfigProviderProps, } from "./components/Provider/ConfigContext";
|
|
2
4
|
export type { ThemeType } from "./styles/design-system";
|
|
3
5
|
export { default as FISButton } from "./components/Button";
|
|
4
6
|
export { default as FISLinkButton } from "./components/LinkButton";
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,25 @@ import * as antd_es_date_picker_generatePicker from 'antd/es/date-picker/generat
|
|
|
15
15
|
import * as rc_picker from 'rc-picker';
|
|
16
16
|
import * as antd_es_notification_interface from 'antd/es/notification/interface';
|
|
17
17
|
|
|
18
|
+
/** Giá trị mặc định cho từng component, mỗi dự án tự cấu hình */
|
|
19
|
+
interface FISComponentConfig {
|
|
20
|
+
select?: {
|
|
21
|
+
/** Mặc định allowClear cho FISSelect (prop truyền trực tiếp sẽ ưu tiên hơn) */
|
|
22
|
+
allowClear?: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface FISConfigProviderProps {
|
|
26
|
+
config?: FISComponentConfig;
|
|
27
|
+
children: React__default.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/** Có thể lồng nhau, config bên trong ghi đè config bên ngoài theo từng component */
|
|
30
|
+
declare const FISConfigProvider: React__default.FC<FISConfigProviderProps>;
|
|
31
|
+
declare const useFISConfig: () => FISComponentConfig;
|
|
32
|
+
|
|
18
33
|
interface ThemeProviderProps {
|
|
19
34
|
theme?: DefaultTheme;
|
|
35
|
+
/** Cấu hình mặc định cho component theo từng dự án */
|
|
36
|
+
config?: FISComponentConfig;
|
|
20
37
|
children: React__default.ReactNode;
|
|
21
38
|
}
|
|
22
39
|
declare const FISThemeProvider: React__default.FC<ThemeProviderProps>;
|
|
@@ -4543,10 +4560,19 @@ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omi
|
|
|
4543
4560
|
tooltipTitle?: TooltipTitleCustom | React.ReactNode;
|
|
4544
4561
|
/** Tooltip variant color */
|
|
4545
4562
|
tooltipVariant?: "primary" | "secondary";
|
|
4563
|
+
/**
|
|
4564
|
+
* Hiện icon xoá khi hover (giống antd).
|
|
4565
|
+
* Không truyền thì lấy theo config.select.allowClear của FISThemeProvider.
|
|
4566
|
+
* Xoá: single gọi onChange(undefined), multi gọi onChange([]).
|
|
4567
|
+
*/
|
|
4568
|
+
allowClear?: boolean;
|
|
4569
|
+
/** Callback khi bấm icon xoá (chỉ dùng với allowClear) */
|
|
4570
|
+
onClear?: () => void;
|
|
4546
4571
|
};
|
|
4547
4572
|
type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
|
|
4548
4573
|
multi?: false;
|
|
4549
4574
|
value: T;
|
|
4575
|
+
/** Với allowClear, value nhận được có thể là undefined khi bấm xoá */
|
|
4550
4576
|
onChange: (value: T) => void;
|
|
4551
4577
|
displayValue?: (item: SelectOptionItem<T>) => string;
|
|
4552
4578
|
};
|
|
@@ -4746,5 +4772,5 @@ type FISTextComponent = {
|
|
|
4746
4772
|
};
|
|
4747
4773
|
declare const FISText: FISTextComponent;
|
|
4748
4774
|
|
|
4749
|
-
export { FISAlertBanner, FISApiSelect, FISAvatar, FISBadge, FISBreadcrumb, FISButton, FISButtonGroup, FISCheckbox, FISCheckboxGroup, FISChipButton, FISCollapse, FISCombobox, FISDateRange, FISDivider, FISIconButton, FISInputArea, FISInputDate, FISInputField, FISInputLabel, FISInputStepper, FISInputText, FISInputTime, FISLinkButton, FISMenuItem, FISMenuSection, FISMenuSelect, FISMenuSelectDropdown, FISPagination, FISProgressCircular, FISProgressLinear, FISRadio, RadioGroup as FISRadioGroup, FISSegmented, FISSelect, FISSelectItem, FISSorter, FISSplitButton, FISSwitch, FISTab, FISTable, FISTableCell, FISTableHeaderCell, FISText, FISThemeProvider, FISToast, FISTooltip, SegmentedPanelItem, TabPanelItem, useNotification, useToast };
|
|
4750
|
-
export type { ApiSelectProps, ApiSelectRef, FISMenuData, FISMenuSelectDropdownProps, PaginationProps as FISPaginationProps, TableProps as FISTableProps, FISTableRef, FetchAll, FetchAllParams, FetchPage, FetchPageParams, FetchPageResult, ThemeType$2 as ThemeType };
|
|
4775
|
+
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, RadioGroup as FISRadioGroup, FISSegmented, FISSelect, FISSelectItem, FISSorter, FISSplitButton, FISSwitch, FISTab, FISTable, FISTableCell, FISTableHeaderCell, FISText, FISThemeProvider, FISToast, FISTooltip, SegmentedPanelItem, TabPanelItem, useFISConfig, useNotification, useToast };
|
|
4776
|
+
export type { ApiSelectProps, ApiSelectRef, FISComponentConfig, FISConfigProviderProps, FISMenuData, FISMenuSelectDropdownProps, PaginationProps as FISPaginationProps, TableProps as FISTableProps, FISTableRef, FetchAll, FetchAllParams, FetchPage, FetchPageParams, FetchPageResult, ThemeType$2 as ThemeType };
|