fis-component 0.2.0 → 0.2.2
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 +12 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Provider/ConfigContext.d.ts +13 -2
- package/dist/cjs/types/src/components/Select/Select.stories.d.ts +1 -0
- package/dist/cjs/types/src/components/Select/types.d.ts +18 -6
- package/dist/esm/index.js +12 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Provider/ConfigContext.d.ts +13 -2
- package/dist/esm/types/src/components/Select/Select.stories.d.ts +1 -0
- package/dist/esm/types/src/components/Select/types.d.ts +18 -6
- package/dist/index.d.ts +31 -8
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -51,10 +51,13 @@ const INHERITS = {
|
|
|
51
51
|
ApiSelect: ["Select"],
|
|
52
52
|
};
|
|
53
53
|
const getDefaults = (config, name) => {
|
|
54
|
-
const legacy =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const legacy = {};
|
|
55
|
+
if (name === "Select" || name === "ApiSelect") {
|
|
56
|
+
if (config.select?.allowClear !== undefined)
|
|
57
|
+
legacy.allowClear = config.select.allowClear;
|
|
58
|
+
if (config.select?.clearValue !== undefined)
|
|
59
|
+
legacy.clearValue = config.select.clearValue;
|
|
60
|
+
}
|
|
58
61
|
const names = [...(INHERITS[name] ?? []), name];
|
|
59
62
|
return names.reduce((acc, n) => ({ ...acc, ...config.components?.[n] }), legacy);
|
|
60
63
|
};
|
|
@@ -5566,7 +5569,7 @@ const DivWrapperSC$5 = styled.div `
|
|
|
5566
5569
|
`;
|
|
5567
5570
|
|
|
5568
5571
|
const FISInputStepper$1 = React.forwardRef((props, ref) => {
|
|
5569
|
-
const { min, max, step = 1, defaultValue, sizeInput = "md", StartIcon, EndIcon, negative, positive, message, iconLabel, textLabel = "", onClickIconLabel, disabled, readOnly, onChange, ...rest } = props;
|
|
5572
|
+
const { min, max, step = 1, defaultValue, sizeInput = "md", StartIcon, EndIcon, negative, positive, message, iconLabel, textLabel = "", onClickIconLabel, disabled, readOnly, onChange, className, ...rest } = props;
|
|
5570
5573
|
const [count, setCount] = React.useState(defaultValue !== undefined ? defaultValue : undefined);
|
|
5571
5574
|
const handleIncrement = () => {
|
|
5572
5575
|
setCount((prev) => {
|
|
@@ -5597,7 +5600,7 @@ const FISInputStepper$1 = React.forwardRef((props, ref) => {
|
|
|
5597
5600
|
"input-text-lg": sizeInput === "lg",
|
|
5598
5601
|
}), children: [jsxRuntime.jsx(FISIconButton$1, { icon: StartIcon ? StartIcon : jsxRuntime.jsx(DecreIcon, {}), size: sizeInput === "lg" ? "md" : "sm", variant: "tertiary-invisible", onClick: handleDecrement, disabled: min !== undefined && count !== undefined && count <= min, className: classNames("decrement", {
|
|
5599
5602
|
"disabled-button": disabled || readOnly,
|
|
5600
|
-
}) }), jsxRuntime.jsx(InputSC$1, { ...rest, ref: ref, disabled: disabled, readOnly: readOnly, type: "number", value: count !== undefined ? count : "", className: classNames({
|
|
5603
|
+
}) }), jsxRuntime.jsx(InputSC$1, { ...rest, ref: ref, disabled: disabled, readOnly: readOnly, type: "number", value: count !== undefined ? count : "", className: classNames(className, {
|
|
5601
5604
|
negative: negative,
|
|
5602
5605
|
"input-text-lg": sizeInput === "lg",
|
|
5603
5606
|
}), onChange: handleChange }), jsxRuntime.jsx(FISIconButton$1, { icon: EndIcon ? EndIcon : jsxRuntime.jsx(IncreIcon, {}), size: sizeInput === "lg" ? "md" : "sm", variant: "tertiary-invisible", onClick: handleIncrement, disabled: max !== undefined && count !== undefined && count >= max, className: classNames("increment", {
|
|
@@ -75599,7 +75602,7 @@ function isMenuSize(value) {
|
|
|
75599
75602
|
|
|
75600
75603
|
const FISSelect$1 = React.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,
|
|
75601
75604
|
// Default theo dự án được gộp ở withFISDefaults (src/index.ts)
|
|
75602
|
-
allowClear = false, onClear, ...restProps }, ref) => {
|
|
75605
|
+
allowClear = false, clearValue, onClear, ...restProps }, ref) => {
|
|
75603
75606
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
75604
75607
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
75605
75608
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
@@ -75703,11 +75706,11 @@ allowClear = false, onClear, ...restProps }, ref) => {
|
|
|
75703
75706
|
onChange([]);
|
|
75704
75707
|
}
|
|
75705
75708
|
else {
|
|
75706
|
-
onChange(
|
|
75709
|
+
onChange(clearValue);
|
|
75707
75710
|
}
|
|
75708
75711
|
setCachedSelectedItem(null);
|
|
75709
75712
|
onClear?.();
|
|
75710
|
-
}, [multi, onChange, onClear]);
|
|
75713
|
+
}, [multi, onChange, onClear, clearValue]);
|
|
75711
75714
|
const handleOptionRemove = React.useCallback((option) => {
|
|
75712
75715
|
if (multi && Array.isArray(value)) {
|
|
75713
75716
|
const newValues = value.filter((v) => v !== option.value);
|