fis-component 0.1.35 → 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 +86 -42
- 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 +1 -0
- 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 +85 -43
- 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 +1 -0
- 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>;
|
|
@@ -145,3 +145,4 @@ export declare const Virtualized: import("@storybook/core/csf").AnnotatedStoryFn
|
|
|
145
145
|
export declare const LoadMore: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
146
146
|
export declare const NoPortal: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
|
|
147
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/esm/index.js
CHANGED
|
@@ -9275,14 +9275,14 @@ const defaultGetPrefixCls = (suffixCls, customizePrefixCls) => {
|
|
|
9275
9275
|
return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls;
|
|
9276
9276
|
};
|
|
9277
9277
|
// zombieJ: 🚨 Do not pass `defaultRenderEmpty` here since it will cause circular dependency.
|
|
9278
|
-
const ConfigContext = /*#__PURE__*/React.createContext({
|
|
9278
|
+
const ConfigContext$1 = /*#__PURE__*/React.createContext({
|
|
9279
9279
|
// We provide a default function for Context without provider
|
|
9280
9280
|
getPrefixCls: defaultGetPrefixCls,
|
|
9281
9281
|
iconPrefixCls: defaultIconPrefixCls
|
|
9282
9282
|
});
|
|
9283
9283
|
const {
|
|
9284
9284
|
Consumer: ConfigConsumer
|
|
9285
|
-
} = ConfigContext;
|
|
9285
|
+
} = ConfigContext$1;
|
|
9286
9286
|
const EMPTY_OBJECT = {};
|
|
9287
9287
|
/**
|
|
9288
9288
|
* Get ConfigProvider configured component props.
|
|
@@ -9293,7 +9293,7 @@ const EMPTY_OBJECT = {};
|
|
|
9293
9293
|
* which will waste both compare calculation & memory.
|
|
9294
9294
|
*/
|
|
9295
9295
|
function useComponentConfig(propName) {
|
|
9296
|
-
const context = React.useContext(ConfigContext);
|
|
9296
|
+
const context = React.useContext(ConfigContext$1);
|
|
9297
9297
|
const {
|
|
9298
9298
|
getPrefixCls,
|
|
9299
9299
|
direction,
|
|
@@ -10647,7 +10647,7 @@ const {
|
|
|
10647
10647
|
const {
|
|
10648
10648
|
getPrefixCls,
|
|
10649
10649
|
iconPrefixCls
|
|
10650
|
-
} = useContext$1(ConfigContext);
|
|
10650
|
+
} = useContext$1(ConfigContext$1);
|
|
10651
10651
|
const rootPrefixCls = getPrefixCls();
|
|
10652
10652
|
return {
|
|
10653
10653
|
rootPrefixCls,
|
|
@@ -10667,7 +10667,7 @@ const {
|
|
|
10667
10667
|
useCSP: () => {
|
|
10668
10668
|
const {
|
|
10669
10669
|
csp
|
|
10670
|
-
} = useContext$1(ConfigContext);
|
|
10670
|
+
} = useContext$1(ConfigContext$1);
|
|
10671
10671
|
return csp !== null && csp !== void 0 ? csp : {};
|
|
10672
10672
|
},
|
|
10673
10673
|
getResetStyles: (token, config) => {
|
|
@@ -12008,19 +12008,19 @@ const ProviderChildren = props => {
|
|
|
12008
12008
|
disabled: componentDisabled
|
|
12009
12009
|
}, childNode);
|
|
12010
12010
|
}
|
|
12011
|
-
return /*#__PURE__*/React.createElement(ConfigContext.Provider, {
|
|
12011
|
+
return /*#__PURE__*/React.createElement(ConfigContext$1.Provider, {
|
|
12012
12012
|
value: memoedConfig
|
|
12013
12013
|
}, childNode);
|
|
12014
12014
|
};
|
|
12015
12015
|
const ConfigProvider = props => {
|
|
12016
|
-
const context = React.useContext(ConfigContext);
|
|
12016
|
+
const context = React.useContext(ConfigContext$1);
|
|
12017
12017
|
const antLocale = React.useContext(LocaleContext);
|
|
12018
12018
|
return /*#__PURE__*/React.createElement(ProviderChildren, Object.assign({
|
|
12019
12019
|
parentContext: context,
|
|
12020
12020
|
legacyLocale: antLocale
|
|
12021
12021
|
}, props));
|
|
12022
12022
|
};
|
|
12023
|
-
ConfigProvider.ConfigContext = ConfigContext;
|
|
12023
|
+
ConfigProvider.ConfigContext = ConfigContext$1;
|
|
12024
12024
|
ConfigProvider.SizeContext = SizeContext;
|
|
12025
12025
|
ConfigProvider.config = setGlobalConfig;
|
|
12026
12026
|
ConfigProvider.useConfig = useConfig;
|
|
@@ -14137,7 +14137,7 @@ const showWaveEffect = (target, info) => {
|
|
|
14137
14137
|
const useWave = (nodeRef, className, component) => {
|
|
14138
14138
|
const {
|
|
14139
14139
|
wave
|
|
14140
|
-
} = React.useContext(ConfigContext);
|
|
14140
|
+
} = React.useContext(ConfigContext$1);
|
|
14141
14141
|
const [, token, hashId] = useToken();
|
|
14142
14142
|
const showWave = useEvent(event => {
|
|
14143
14143
|
const node = nodeRef.current;
|
|
@@ -14176,7 +14176,7 @@ const Wave = props => {
|
|
|
14176
14176
|
} = props;
|
|
14177
14177
|
const {
|
|
14178
14178
|
getPrefixCls
|
|
14179
|
-
} = useContext$1(ConfigContext);
|
|
14179
|
+
} = useContext$1(ConfigContext$1);
|
|
14180
14180
|
const containerRef = useRef(null);
|
|
14181
14181
|
// ============================== Style ===============================
|
|
14182
14182
|
const prefixCls = getPrefixCls('wave');
|
|
@@ -14316,7 +14316,7 @@ const Compact$1 = props => {
|
|
|
14316
14316
|
const {
|
|
14317
14317
|
getPrefixCls,
|
|
14318
14318
|
direction: directionConfig
|
|
14319
|
-
} = React.useContext(ConfigContext);
|
|
14319
|
+
} = React.useContext(ConfigContext$1);
|
|
14320
14320
|
const {
|
|
14321
14321
|
size,
|
|
14322
14322
|
direction,
|
|
@@ -14369,7 +14369,7 @@ const ButtonGroup = props => {
|
|
|
14369
14369
|
const {
|
|
14370
14370
|
getPrefixCls,
|
|
14371
14371
|
direction
|
|
14372
|
-
} = React.useContext(ConfigContext);
|
|
14372
|
+
} = React.useContext(ConfigContext$1);
|
|
14373
14373
|
const {
|
|
14374
14374
|
prefixCls: customizePrefixCls,
|
|
14375
14375
|
size,
|
|
@@ -15681,7 +15681,7 @@ const CollapsePanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
15681
15681
|
}
|
|
15682
15682
|
const {
|
|
15683
15683
|
getPrefixCls
|
|
15684
|
-
} = React.useContext(ConfigContext);
|
|
15684
|
+
} = React.useContext(ConfigContext$1);
|
|
15685
15685
|
const {
|
|
15686
15686
|
prefixCls: customizePrefixCls,
|
|
15687
15687
|
className,
|
|
@@ -17365,7 +17365,7 @@ const InternalCompoundedButton = /*#__PURE__*/React__default.forwardRef((props,
|
|
|
17365
17365
|
const mergedType = type || 'default';
|
|
17366
17366
|
const {
|
|
17367
17367
|
button
|
|
17368
|
-
} = React__default.useContext(ConfigContext);
|
|
17368
|
+
} = React__default.useContext(ConfigContext$1);
|
|
17369
17369
|
const shape = customizeShape || (button === null || button === void 0 ? void 0 : button.shape) || 'default';
|
|
17370
17370
|
const [mergedColor, mergedVariant] = useMemo$1(() => {
|
|
17371
17371
|
// >>>>> Local
|
|
@@ -22164,7 +22164,7 @@ const PurePanel$5 = props => {
|
|
|
22164
22164
|
restProps = __rest$n(props, ["prefixCls", "className", "icon", "type", "message", "description", "btn", "actions", "closable", "closeIcon", "className"]);
|
|
22165
22165
|
const {
|
|
22166
22166
|
getPrefixCls
|
|
22167
|
-
} = React.useContext(ConfigContext);
|
|
22167
|
+
} = React.useContext(ConfigContext$1);
|
|
22168
22168
|
const mergedActions = actions !== null && actions !== void 0 ? actions : btn;
|
|
22169
22169
|
if (process.env.NODE_ENV !== 'production') {
|
|
22170
22170
|
const warning = devUseWarning('Notification');
|
|
@@ -22314,7 +22314,7 @@ const Holder = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
22314
22314
|
getPopupContainer,
|
|
22315
22315
|
notification,
|
|
22316
22316
|
direction
|
|
22317
|
-
} = useContext$1(ConfigContext);
|
|
22317
|
+
} = useContext$1(ConfigContext$1);
|
|
22318
22318
|
const [, token] = useToken();
|
|
22319
22319
|
const prefixCls = staticPrefixCls || getPrefixCls('notification');
|
|
22320
22320
|
// =============================== Style ===============================
|
|
@@ -22471,7 +22471,7 @@ const genPurePanel = (Component, alignPropName, postProps, defaultPrefixCls, get
|
|
|
22471
22471
|
});
|
|
22472
22472
|
const {
|
|
22473
22473
|
getPrefixCls
|
|
22474
|
-
} = React.useContext(ConfigContext);
|
|
22474
|
+
} = React.useContext(ConfigContext$1);
|
|
22475
22475
|
const prefixCls = getPrefixCls(defaultPrefixCls || 'select', customizePrefixCls);
|
|
22476
22476
|
React.useEffect(() => {
|
|
22477
22477
|
// We do not care about ssr
|
|
@@ -29197,7 +29197,7 @@ const DefaultRenderEmpty = props => {
|
|
|
29197
29197
|
} = props;
|
|
29198
29198
|
const {
|
|
29199
29199
|
getPrefixCls
|
|
29200
|
-
} = useContext$1(ConfigContext);
|
|
29200
|
+
} = useContext$1(ConfigContext$1);
|
|
29201
29201
|
const prefix = getPrefixCls('empty');
|
|
29202
29202
|
switch (componentName) {
|
|
29203
29203
|
case 'Table':
|
|
@@ -29236,7 +29236,7 @@ const useVariant = (component, variant, legacyBordered) => {
|
|
|
29236
29236
|
const {
|
|
29237
29237
|
variant: configVariant,
|
|
29238
29238
|
[component]: componentConfig
|
|
29239
|
-
} = React.useContext(ConfigContext);
|
|
29239
|
+
} = React.useContext(ConfigContext$1);
|
|
29240
29240
|
const ctxVariant = React.useContext(VariantContext);
|
|
29241
29241
|
const configComponentVariant = componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.variant;
|
|
29242
29242
|
let mergedVariant;
|
|
@@ -30597,7 +30597,7 @@ const InternalSelect = (props, ref) => {
|
|
|
30597
30597
|
virtual,
|
|
30598
30598
|
popupMatchSelectWidth: contextPopupMatchSelectWidth,
|
|
30599
30599
|
popupOverflow
|
|
30600
|
-
} = React.useContext(ConfigContext);
|
|
30600
|
+
} = React.useContext(ConfigContext$1);
|
|
30601
30601
|
const {
|
|
30602
30602
|
showSearch,
|
|
30603
30603
|
style: contextStyle,
|
|
@@ -31664,7 +31664,7 @@ const PurePanel$3 = props => {
|
|
|
31664
31664
|
} = props;
|
|
31665
31665
|
const {
|
|
31666
31666
|
getPrefixCls
|
|
31667
|
-
} = React.useContext(ConfigContext);
|
|
31667
|
+
} = React.useContext(ConfigContext$1);
|
|
31668
31668
|
const prefixCls = getPrefixCls('tooltip', customizePrefixCls);
|
|
31669
31669
|
const [wrapCSSVar, hashId, cssVarCls] = useStyle$d(prefixCls);
|
|
31670
31670
|
// Color
|
|
@@ -34376,7 +34376,7 @@ const Sider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
34376
34376
|
const {
|
|
34377
34377
|
getPrefixCls,
|
|
34378
34378
|
direction
|
|
34379
|
-
} = useContext$1(ConfigContext);
|
|
34379
|
+
} = useContext$1(ConfigContext$1);
|
|
34380
34380
|
const prefixCls = getPrefixCls('layout-sider', customizePrefixCls);
|
|
34381
34381
|
const [wrapCSSVar, hashId, cssVarCls] = useStyle$c(prefixCls);
|
|
34382
34382
|
// ========================= Responsive =========================
|
|
@@ -34504,7 +34504,7 @@ const MenuDivider = props => {
|
|
|
34504
34504
|
restProps = __rest$h(props, ["prefixCls", "className", "dashed"]);
|
|
34505
34505
|
const {
|
|
34506
34506
|
getPrefixCls
|
|
34507
|
-
} = React.useContext(ConfigContext);
|
|
34507
|
+
} = React.useContext(ConfigContext$1);
|
|
34508
34508
|
const prefixCls = getPrefixCls('menu', customizePrefixCls);
|
|
34509
34509
|
const classString = classNames({
|
|
34510
34510
|
[`${prefixCls}-item-divider-dashed`]: !!dashed
|
|
@@ -35705,7 +35705,7 @@ const InternalMenu = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
35705
35705
|
getPopupContainer,
|
|
35706
35706
|
direction,
|
|
35707
35707
|
menu
|
|
35708
|
-
} = React.useContext(ConfigContext);
|
|
35708
|
+
} = React.useContext(ConfigContext$1);
|
|
35709
35709
|
const rootPrefixCls = getPrefixCls();
|
|
35710
35710
|
const {
|
|
35711
35711
|
prefixCls: customizePrefixCls,
|
|
@@ -36184,7 +36184,7 @@ const Dropdown$1 = props => {
|
|
|
36184
36184
|
getPrefixCls,
|
|
36185
36185
|
direction,
|
|
36186
36186
|
dropdown
|
|
36187
|
-
} = React.useContext(ConfigContext);
|
|
36187
|
+
} = React.useContext(ConfigContext$1);
|
|
36188
36188
|
const mergedPopupRender = popupRender || dropdownRender;
|
|
36189
36189
|
// Warning for deprecated usage
|
|
36190
36190
|
const warning = devUseWarning('Dropdown');
|
|
@@ -43266,7 +43266,7 @@ const InternalRadio = (props, ref) => {
|
|
|
43266
43266
|
getPrefixCls,
|
|
43267
43267
|
direction,
|
|
43268
43268
|
radio
|
|
43269
|
-
} = React.useContext(ConfigContext);
|
|
43269
|
+
} = React.useContext(ConfigContext$1);
|
|
43270
43270
|
const innerRef = React.useRef(null);
|
|
43271
43271
|
const mergedRef = composeRef(ref, innerRef);
|
|
43272
43272
|
const {
|
|
@@ -43369,7 +43369,7 @@ const RadioGroup$1 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
43369
43369
|
const {
|
|
43370
43370
|
getPrefixCls,
|
|
43371
43371
|
direction
|
|
43372
|
-
} = React.useContext(ConfigContext);
|
|
43372
|
+
} = React.useContext(ConfigContext$1);
|
|
43373
43373
|
const {
|
|
43374
43374
|
name: formItemName
|
|
43375
43375
|
} = React.useContext(FormItemInputContext);
|
|
@@ -43486,7 +43486,7 @@ var __rest$d = undefined && undefined.__rest || function (s, e) {
|
|
|
43486
43486
|
const RadioButton = (props, ref) => {
|
|
43487
43487
|
const {
|
|
43488
43488
|
getPrefixCls
|
|
43489
|
-
} = React.useContext(ConfigContext);
|
|
43489
|
+
} = React.useContext(ConfigContext$1);
|
|
43490
43490
|
const {
|
|
43491
43491
|
prefixCls: customizePrefixCls
|
|
43492
43492
|
} = props,
|
|
@@ -46696,7 +46696,7 @@ const InternalCheckbox = (props, ref) => {
|
|
|
46696
46696
|
getPrefixCls,
|
|
46697
46697
|
direction,
|
|
46698
46698
|
checkbox
|
|
46699
|
-
} = React.useContext(ConfigContext);
|
|
46699
|
+
} = React.useContext(ConfigContext$1);
|
|
46700
46700
|
const checkboxGroup = React.useContext(GroupContext);
|
|
46701
46701
|
const {
|
|
46702
46702
|
isFormItemInput
|
|
@@ -46808,7 +46808,7 @@ const CheckboxGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
46808
46808
|
const {
|
|
46809
46809
|
getPrefixCls,
|
|
46810
46810
|
direction
|
|
46811
|
-
} = React.useContext(ConfigContext);
|
|
46811
|
+
} = React.useContext(ConfigContext$1);
|
|
46812
46812
|
const [value, setValue] = React.useState(restProps.value || defaultValue || []);
|
|
46813
46813
|
const [registeredValues, setRegisteredValues] = React.useState([]);
|
|
46814
46814
|
React.useEffect(() => {
|
|
@@ -47771,7 +47771,7 @@ const generateRangePicker = generateConfig => {
|
|
|
47771
47771
|
direction,
|
|
47772
47772
|
getPopupContainer,
|
|
47773
47773
|
rangePicker
|
|
47774
|
-
} = useContext$1(ConfigContext);
|
|
47774
|
+
} = useContext$1(ConfigContext$1);
|
|
47775
47775
|
const prefixCls = getPrefixCls('picker', customizePrefixCls);
|
|
47776
47776
|
const {
|
|
47777
47777
|
compactSize,
|
|
@@ -47924,7 +47924,7 @@ const generatePicker$1 = generateConfig => {
|
|
|
47924
47924
|
getPopupContainer,
|
|
47925
47925
|
// Consume different styles according to different names
|
|
47926
47926
|
[consumerName]: consumerStyle
|
|
47927
|
-
} = useContext$1(ConfigContext);
|
|
47927
|
+
} = useContext$1(ConfigContext$1);
|
|
47928
47928
|
const prefixCls = getPrefixCls('picker', customizePrefixCls);
|
|
47929
47929
|
const {
|
|
47930
47930
|
compactSize,
|
|
@@ -48187,7 +48187,7 @@ const SpaceAddon = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
48187
48187
|
const {
|
|
48188
48188
|
getPrefixCls,
|
|
48189
48189
|
direction: directionConfig
|
|
48190
|
-
} = React__default.useContext(ConfigContext);
|
|
48190
|
+
} = React__default.useContext(ConfigContext$1);
|
|
48191
48191
|
const prefixCls = getPrefixCls('space-addon', customizePrefixCls);
|
|
48192
48192
|
const [wrapCSSVar, hashId, cssVarCls] = useStyle$5(prefixCls);
|
|
48193
48193
|
const {
|
|
@@ -48421,7 +48421,7 @@ const DropdownButton = props => {
|
|
|
48421
48421
|
getPopupContainer: getContextPopupContainer,
|
|
48422
48422
|
getPrefixCls,
|
|
48423
48423
|
direction
|
|
48424
|
-
} = React.useContext(ConfigContext);
|
|
48424
|
+
} = React.useContext(ConfigContext$1);
|
|
48425
48425
|
const {
|
|
48426
48426
|
prefixCls: customizePrefixCls,
|
|
48427
48427
|
type = 'default',
|
|
@@ -50531,7 +50531,7 @@ const GlobalHolder = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
50531
50531
|
} = props;
|
|
50532
50532
|
const {
|
|
50533
50533
|
getPrefixCls
|
|
50534
|
-
} = useContext$1(ConfigContext);
|
|
50534
|
+
} = useContext$1(ConfigContext$1);
|
|
50535
50535
|
const prefixCls = defaultGlobalConfig.prefixCls || getPrefixCls('notification');
|
|
50536
50536
|
const appConfig = useContext$1(AppConfigContext);
|
|
50537
50537
|
const [api, holder] = useInternalNotification(Object.assign(Object.assign(Object.assign({}, notificationConfig), {
|
|
@@ -57611,7 +57611,7 @@ const Tree$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
57611
57611
|
direction,
|
|
57612
57612
|
virtual,
|
|
57613
57613
|
tree
|
|
57614
|
-
} = React__default.useContext(ConfigContext);
|
|
57614
|
+
} = React__default.useContext(ConfigContext$1);
|
|
57615
57615
|
const {
|
|
57616
57616
|
prefixCls: customizePrefixCls,
|
|
57617
57617
|
className,
|
|
@@ -57902,7 +57902,7 @@ const DirectoryTree = (_a, ref) => {
|
|
|
57902
57902
|
const {
|
|
57903
57903
|
getPrefixCls,
|
|
57904
57904
|
direction
|
|
57905
|
-
} = React.useContext(ConfigContext);
|
|
57905
|
+
} = React.useContext(ConfigContext$1);
|
|
57906
57906
|
const {
|
|
57907
57907
|
prefixCls: customizePrefixCls,
|
|
57908
57908
|
className,
|
|
@@ -58246,7 +58246,7 @@ const FilterDropdown = props => {
|
|
|
58246
58246
|
const {
|
|
58247
58247
|
direction,
|
|
58248
58248
|
renderEmpty
|
|
58249
|
-
} = React.useContext(ConfigContext);
|
|
58249
|
+
} = React.useContext(ConfigContext$1);
|
|
58250
58250
|
if (typeof column.filterDropdown === 'function') {
|
|
58251
58251
|
dropdownContent = column.filterDropdown({
|
|
58252
58252
|
prefixCls: `${dropdownPrefixCls}-custom`,
|
|
@@ -60569,7 +60569,7 @@ const InternalTable$1 = (props, ref) => {
|
|
|
60569
60569
|
renderEmpty,
|
|
60570
60570
|
getPrefixCls,
|
|
60571
60571
|
getPopupContainer: getContextPopupContainer
|
|
60572
|
-
} = React.useContext(ConfigContext);
|
|
60572
|
+
} = React.useContext(ConfigContext$1);
|
|
60573
60573
|
const mergedSize = useSize(customizeSize);
|
|
60574
60574
|
const tableLocale = Object.assign(Object.assign({}, contextLocale.Table), locale);
|
|
60575
60575
|
const rawData = dataSource || EMPTY_LIST;
|
|
@@ -63657,7 +63657,20 @@ const ToastProvider = ({ children, }) => {
|
|
|
63657
63657
|
return (jsxs(ToastContext.Provider, { value: { showToast }, children: [children, toasts.length > 0 && (jsx(ToastWrapper, { "$position": toasts[0].position || "top-right", children: toasts.map((toast, index) => (jsx(FISToast, { ...toast }, index))) }))] }));
|
|
63658
63658
|
};
|
|
63659
63659
|
|
|
63660
|
-
const
|
|
63660
|
+
const ConfigContext = createContext$1({});
|
|
63661
|
+
/** Có thể lồng nhau, config bên trong ghi đè config bên ngoài theo từng component */
|
|
63662
|
+
const FISConfigProvider = ({ config, children, }) => {
|
|
63663
|
+
const parent = useContext$1(ConfigContext);
|
|
63664
|
+
const value = useMemo$1(() => ({
|
|
63665
|
+
...parent,
|
|
63666
|
+
...config,
|
|
63667
|
+
select: { ...parent.select, ...config?.select },
|
|
63668
|
+
}), [parent, config]);
|
|
63669
|
+
return (jsx(ConfigContext.Provider, { value: value, children: children }));
|
|
63670
|
+
};
|
|
63671
|
+
const useFISConfig = () => useContext$1(ConfigContext);
|
|
63672
|
+
|
|
63673
|
+
const FISThemeProvider = ({ theme: theme$1 = theme, config, children, }) => (jsxs(ThemeProvider, { theme: theme$1, children: [jsx(GlobalStyle, { theme: theme$1 }), jsx(FISConfigProvider, { config: config, children: jsx(NotificationProvider, { children: jsx(ToastProvider, { children: children }) }) })] }));
|
|
63661
63674
|
|
|
63662
63675
|
const DivSwitchLabelContainerSC = styled.div `
|
|
63663
63676
|
display: flex;
|
|
@@ -75727,13 +75740,25 @@ const SelectedTagsWrapper = styled.div `
|
|
|
75727
75740
|
${getTheme("com/combo-box/selected-data/horizontal-gap")}
|
|
75728
75741
|
);
|
|
75729
75742
|
`;
|
|
75743
|
+
const SpanClearIconSC = styled.span `
|
|
75744
|
+
display: flex;
|
|
75745
|
+
align-items: center;
|
|
75746
|
+
justify-content: center;
|
|
75747
|
+
width: 100%;
|
|
75748
|
+
height: 100%;
|
|
75749
|
+
cursor: pointer;
|
|
75750
|
+
pointer-events: auto;
|
|
75751
|
+
`;
|
|
75730
75752
|
|
|
75731
75753
|
function isMenuSize(value) {
|
|
75732
75754
|
return value === "sm" || value === "md";
|
|
75733
75755
|
}
|
|
75734
75756
|
|
|
75735
|
-
const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal = true, maxHeight, onPopupScroll, onOpen, hideChip, tooltipTitle, tooltipVariant = "primary", noData, noResult, noDataText, noResultText, footer, searchDebounce, showSearch, onSearchInput, virtualized, virtualItemHeight, removeSelectedText, selectedGroupLabel, ...restProps }, ref) => {
|
|
75757
|
+
const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal = true, maxHeight, onPopupScroll, onOpen, hideChip, tooltipTitle, tooltipVariant = "primary", noData, noResult, noDataText, noResultText, footer, searchDebounce, showSearch, onSearchInput, virtualized, virtualItemHeight, removeSelectedText, selectedGroupLabel, allowClear: allowClearProp, onClear, ...restProps }, ref) => {
|
|
75758
|
+
const config = useFISConfig();
|
|
75759
|
+
const allowClear = allowClearProp ?? config.select?.allowClear ?? false;
|
|
75736
75760
|
const [isOpen, setIsOpen] = useState(false);
|
|
75761
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
75737
75762
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
75738
75763
|
const [popperElement, setPopperElement] = useState(null);
|
|
75739
75764
|
const [cachedSelectedItem, setCachedSelectedItem] = useState(null);
|
|
@@ -75823,6 +75848,23 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
75823
75848
|
onOpen?.();
|
|
75824
75849
|
}
|
|
75825
75850
|
}, [disabled, onOpen]);
|
|
75851
|
+
const hasSelectedValue = multi
|
|
75852
|
+
? Array.isArray(value) && value.length > 0
|
|
75853
|
+
: value !== undefined && value !== null && value !== "";
|
|
75854
|
+
const showClearIcon = allowClear && !disabled && hasSelectedValue && isHovered;
|
|
75855
|
+
const handleClear = useCallback((event) => {
|
|
75856
|
+
// Không để click lan lên wrapper làm mở dropdown
|
|
75857
|
+
event.stopPropagation();
|
|
75858
|
+
setIsOpen(false);
|
|
75859
|
+
if (multi) {
|
|
75860
|
+
onChange([]);
|
|
75861
|
+
}
|
|
75862
|
+
else {
|
|
75863
|
+
onChange(undefined);
|
|
75864
|
+
}
|
|
75865
|
+
setCachedSelectedItem(null);
|
|
75866
|
+
onClear?.();
|
|
75867
|
+
}, [multi, onChange, onClear]);
|
|
75826
75868
|
const handleOptionRemove = useCallback((option) => {
|
|
75827
75869
|
if (multi && Array.isArray(value)) {
|
|
75828
75870
|
const newValues = value.filter((v) => v !== option.value);
|
|
@@ -75944,7 +75986,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
75944
75986
|
}
|
|
75945
75987
|
}, [isOpen, multi]);
|
|
75946
75988
|
const renderSelectInput = () => {
|
|
75947
|
-
const selectInput = (jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, "$hasValue": !!value && !disabled, children: jsx(FISSelectItem, { ...restProps, onBlur: handleBlur, ref: inputRef, size: size, placeholder: placeholder, iconSuffix: isOpen ? jsx(ArrowUpIcon, {}) : jsx(ArrowDownIcon, {}), value: computedDisplayValue, onChange: () => undefined, disabled: disabled, activeDropdown: isOpen, negative: negative }) }));
|
|
75989
|
+
const selectInput = (jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "$hasValue": !!value && !disabled, children: jsx(FISSelectItem, { ...restProps, onBlur: handleBlur, ref: inputRef, size: size, placeholder: placeholder, iconSuffix: showClearIcon ? (jsx(SpanClearIconSC, { role: "button", "aria-label": "Xo\u00E1", onMouseDown: (e) => e.preventDefault(), onClick: handleClear, children: jsx(CloseIcon, {}) })) : isOpen ? (jsx(ArrowUpIcon, {})) : (jsx(ArrowDownIcon, {})), value: computedDisplayValue, onChange: () => undefined, disabled: disabled, activeDropdown: isOpen, negative: negative }) }));
|
|
75948
75990
|
if (tooltipTitle) {
|
|
75949
75991
|
return (jsx(FISTooltip, { title: tooltipTitle, variant: tooltipVariant, smartPlacement: true, children: selectInput }));
|
|
75950
75992
|
}
|
|
@@ -76644,5 +76686,5 @@ const TextSC = styled.p `
|
|
|
76644
76686
|
const FISText = forwardRef(({ tag, as, variant, children, color, ...rest }, ref) => (jsx(TextSC, { as: as ?? tag, "$variant": variant, "$color": color ? getTheme(color) : "", ref: ref, ...rest, children: children })));
|
|
76645
76687
|
FISText.displayName = "FISText";
|
|
76646
76688
|
|
|
76647
|
-
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 };
|
|
76689
|
+
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 };
|
|
76648
76690
|
//# sourceMappingURL=index.js.map
|