@televet/kibble-ui 1.14.1 → 1.14.2-beta.2v2u763.1
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/build/index.js +153 -140
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1605,7 +1605,7 @@ var toTitleCase = function (s) {
|
|
|
1605
1605
|
};
|
|
1606
1606
|
|
|
1607
1607
|
var Button = React.forwardRef(function (props, ref) {
|
|
1608
|
-
var _a = useTheme(), components = _a.components, fontWeights = _a.fontWeights;
|
|
1608
|
+
var _a = useTheme(), components = _a.components, fontWeights = _a.fontWeights, radii = _a.radii;
|
|
1609
1609
|
var _b = components.Button[props.variant || 'primary'], variant = _b.variant, light = _b.light, dark = _b.dark;
|
|
1610
1610
|
var modeColor = props.darkMode ? dark : light;
|
|
1611
1611
|
var bg = react.useColorModeValue(modeColor.default, dark.default);
|
|
@@ -1631,7 +1631,7 @@ var Button = React.forwardRef(function (props, ref) {
|
|
|
1631
1631
|
domProps[position] = ButtonIcon;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
|
-
return (React__default["default"].createElement(react.Button, __assign({ fontWeight: fontWeights.semibold, ref: ref, _hover: hoverClass, _active: activeClass, iconSpacing: domProps.size === 'sm' || domProps.size === 'xs' ? '4px' : '8px' }, domProps), domProps.children));
|
|
1634
|
+
return (React__default["default"].createElement(react.Button, __assign({ fontWeight: fontWeights.semibold, ref: ref, _hover: hoverClass, _active: activeClass, iconSpacing: domProps.size === 'sm' || domProps.size === 'xs' ? '4px' : '8px', borderRadius: radii.base }, domProps), domProps.children));
|
|
1635
1635
|
});
|
|
1636
1636
|
Button.displayName = 'Button';
|
|
1637
1637
|
|
|
@@ -3787,150 +3787,18 @@ function withFormControl(Component) {
|
|
|
3787
3787
|
return WithFormControl;
|
|
3788
3788
|
}
|
|
3789
3789
|
|
|
3790
|
-
var Heading = function (_a) {
|
|
3791
|
-
var children = _a.children, _b = _a.size, size = _b === void 0 ? 'lg' : _b, color = _a.color, _c = _a.colorToken, colorToken = _c === void 0 ? 'headline' : _c, _d = _a.darkMode, darkMode = _d === void 0 ? false : _d, rest = __rest(_a, ["children", "size", "color", "colorToken", "darkMode"]);
|
|
3792
|
-
var _e = useTheme(), components = _e.components, colors = _e.colors;
|
|
3793
|
-
var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
|
|
3794
|
-
var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
|
|
3795
|
-
var sizes = components.Heading.variants[variant].sizes;
|
|
3796
|
-
var sizeProps = !sizes ? undefined : sizes[size];
|
|
3797
|
-
return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
|
|
3798
|
-
};
|
|
3799
|
-
|
|
3800
|
-
var HeadingConfig = {
|
|
3801
|
-
variants: {
|
|
3802
|
-
large: {
|
|
3803
|
-
sizes: {
|
|
3804
|
-
xs: {
|
|
3805
|
-
fontSize: '14px',
|
|
3806
|
-
lineHeight: '120%',
|
|
3807
|
-
fontWeight: fontWeights.semibold,
|
|
3808
|
-
},
|
|
3809
|
-
sm: {
|
|
3810
|
-
fontSize: '16px',
|
|
3811
|
-
lineHeight: '120%',
|
|
3812
|
-
fontWeight: fontWeights.semibold,
|
|
3813
|
-
},
|
|
3814
|
-
md: {
|
|
3815
|
-
fontSize: '20px',
|
|
3816
|
-
lineHeight: '120%',
|
|
3817
|
-
fontWeight: fontWeights.semibold,
|
|
3818
|
-
},
|
|
3819
|
-
lg: {
|
|
3820
|
-
fontSize: '30px',
|
|
3821
|
-
lineHeight: '133%',
|
|
3822
|
-
fontWeight: fontWeights.semibold,
|
|
3823
|
-
},
|
|
3824
|
-
xl: {
|
|
3825
|
-
fontSize: '36px',
|
|
3826
|
-
lineHeight: '133%',
|
|
3827
|
-
fontWeight: fontWeights.semibold,
|
|
3828
|
-
},
|
|
3829
|
-
'2xl': {
|
|
3830
|
-
fontSize: '48px',
|
|
3831
|
-
lineHeight: '120%',
|
|
3832
|
-
fontWeight: fontWeights.semibold,
|
|
3833
|
-
},
|
|
3834
|
-
'3xl': {
|
|
3835
|
-
fontSize: '60px',
|
|
3836
|
-
lineHeight: '100%',
|
|
3837
|
-
fontWeight: fontWeights.semibold,
|
|
3838
|
-
},
|
|
3839
|
-
'4xl': {
|
|
3840
|
-
fontSize: '72px',
|
|
3841
|
-
lineHeight: '100%',
|
|
3842
|
-
fontWeight: fontWeights.semibold,
|
|
3843
|
-
},
|
|
3844
|
-
},
|
|
3845
|
-
},
|
|
3846
|
-
small: {
|
|
3847
|
-
sizes: {
|
|
3848
|
-
xs: {
|
|
3849
|
-
fontSize: '14px',
|
|
3850
|
-
lineHeight: '120%',
|
|
3851
|
-
fontWeight: fontWeights.semibold,
|
|
3852
|
-
},
|
|
3853
|
-
sm: {
|
|
3854
|
-
fontSize: '16px',
|
|
3855
|
-
lineHeight: '120%',
|
|
3856
|
-
fontWeight: fontWeights.semibold,
|
|
3857
|
-
},
|
|
3858
|
-
md: {
|
|
3859
|
-
fontSize: '20px',
|
|
3860
|
-
lineHeight: '120%',
|
|
3861
|
-
fontWeight: fontWeights.semibold,
|
|
3862
|
-
},
|
|
3863
|
-
lg: {
|
|
3864
|
-
fontSize: '24px',
|
|
3865
|
-
lineHeight: '133%',
|
|
3866
|
-
fontWeight: fontWeights.semibold,
|
|
3867
|
-
},
|
|
3868
|
-
xl: {
|
|
3869
|
-
fontSize: '30px',
|
|
3870
|
-
lineHeight: '133%',
|
|
3871
|
-
fontWeight: fontWeights.semibold,
|
|
3872
|
-
},
|
|
3873
|
-
'2xl': {
|
|
3874
|
-
fontSize: '36px',
|
|
3875
|
-
lineHeight: '120%',
|
|
3876
|
-
fontWeight: fontWeights.semibold,
|
|
3877
|
-
},
|
|
3878
|
-
'3xl': {
|
|
3879
|
-
fontSize: '48px',
|
|
3880
|
-
lineHeight: '100%',
|
|
3881
|
-
fontWeight: fontWeights.semibold,
|
|
3882
|
-
},
|
|
3883
|
-
'4xl': {
|
|
3884
|
-
fontSize: '60px',
|
|
3885
|
-
lineHeight: '100%',
|
|
3886
|
-
fontWeight: fontWeights.semibold,
|
|
3887
|
-
},
|
|
3888
|
-
},
|
|
3889
|
-
},
|
|
3890
|
-
},
|
|
3891
|
-
};
|
|
3892
|
-
|
|
3893
|
-
var TruncatedText = function (_a) {
|
|
3894
|
-
var _b = _a.noOfLines, noOfLines = _b === void 0 ? 1 : _b, textContent = _a.textContent, placement = _a.placement, titleCaseTooltipLabel = _a.titleCaseTooltipLabel, rest = __rest(_a, ["noOfLines", "textContent", "placement", "titleCaseTooltipLabel"]);
|
|
3895
|
-
var _c = __read(React.useState(false), 2), isTextOverFlowing = _c[0], setIsTextOverFlowing = _c[1];
|
|
3896
|
-
var containerRef = React.useRef(null);
|
|
3897
|
-
var onCheckTextOverFlowing = React.useCallback(function (containerRefValue) {
|
|
3898
|
-
var _a, _b;
|
|
3899
|
-
if (containerRefValue && containerRefValue.current) {
|
|
3900
|
-
var textScrollHeight = ((_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].scrollHeight) || 0;
|
|
3901
|
-
var containerOffsetHeight = ((_b = containerRefValue.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
|
|
3902
|
-
return textScrollHeight > containerOffsetHeight;
|
|
3903
|
-
}
|
|
3904
|
-
return false;
|
|
3905
|
-
}, []);
|
|
3906
|
-
React.useEffect(function () {
|
|
3907
|
-
var checkValue = onCheckTextOverFlowing(containerRef);
|
|
3908
|
-
setIsTextOverFlowing(checkValue);
|
|
3909
|
-
}, [containerRef, onCheckTextOverFlowing]);
|
|
3910
|
-
return (React__default["default"].createElement(react.Box, { ref: containerRef, className: "TruncatedText__Wrapper" },
|
|
3911
|
-
React__default["default"].createElement(Tooltip, { className: "TruncatedText__Tooltip", label: textContent || '', isDisabled: !isTextOverFlowing, placement: placement, titleCaseLabel: titleCaseTooltipLabel },
|
|
3912
|
-
React__default["default"].createElement(react.Text, __assign({ className: "TruncatedText__TextContent", noOfLines: noOfLines, as: "p" }, rest), textContent))));
|
|
3913
|
-
};
|
|
3914
|
-
|
|
3915
3790
|
var Checkbox = function (_a) {
|
|
3916
3791
|
var children = _a.children, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.variant, variant = _c === void 0 ? 'square' : _c, _d = _a.m, m = _d === void 0 ? 0 : _d, mb = _a.mb, mt = _a.mt, mr = _a.mr, ml = _a.ml, rest = __rest(_a, ["children", "size", "variant", "m", "mb", "mt", "mr", "ml"]);
|
|
3917
|
-
var Spacing = {
|
|
3918
|
-
sm: 2,
|
|
3919
|
-
md: 2,
|
|
3920
|
-
lg: 3,
|
|
3921
|
-
};
|
|
3922
3792
|
var margins = { m: m, mb: mb, mt: mt, mr: mr, ml: ml };
|
|
3923
|
-
return (React__default["default"].createElement(react.
|
|
3924
|
-
React__default["default"].createElement(react.Checkbox, __assign({}, rest, { size: size, variant: variant, m: 0 }))
|
|
3925
|
-
typeof children === 'string' && (React__default["default"].createElement(Text, { size: size, ml: Spacing[size], as: "span" }, children)),
|
|
3926
|
-
children && typeof children !== 'string' && React__default["default"].createElement(react.Box, { ml: Spacing[size] }, children)));
|
|
3793
|
+
return (React__default["default"].createElement(react.Box, __assign({}, margins),
|
|
3794
|
+
React__default["default"].createElement(react.Checkbox, __assign({}, rest, { size: size, variant: variant, m: 0, alignItems: "flex-start" }), children)));
|
|
3927
3795
|
};
|
|
3928
3796
|
|
|
3929
3797
|
var CheckboxGroup = function (_a) {
|
|
3930
3798
|
var checkboxes = _a.checkboxes, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.direction, direction = _c === void 0 ? 'row' : _c, spacing = _a.spacing, variant = _a.variant, rest = __rest(_a, ["checkboxes", "size", "direction", "spacing", "variant"]);
|
|
3931
3799
|
rest.isFieldInline; var domProps = __rest(rest, ["isFieldInline"]);
|
|
3932
3800
|
return (React__default["default"].createElement(react.CheckboxGroup, __assign({}, domProps),
|
|
3933
|
-
React__default["default"].createElement(react.Stack, { direction: direction, spacing: spacing,
|
|
3801
|
+
React__default["default"].createElement(react.Stack, { direction: direction, spacing: spacing, width: "fit-content" }, checkboxes.map(function (checkbox, index) { return (React__default["default"].createElement(Checkbox, __assign({ key: index }, checkbox, { size: size, variant: variant || checkbox.variant }))); }))));
|
|
3934
3802
|
};
|
|
3935
3803
|
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
3936
3804
|
var WrappedCheckboxGroup = withFormControl(CheckboxGroup);
|
|
@@ -3974,6 +3842,16 @@ var RoundCheckedStyle = {
|
|
|
3974
3842
|
},
|
|
3975
3843
|
};
|
|
3976
3844
|
var CheckboxConfig = {
|
|
3845
|
+
baseStyle: {
|
|
3846
|
+
control: {
|
|
3847
|
+
_focus: {
|
|
3848
|
+
boxShadow: 'none',
|
|
3849
|
+
},
|
|
3850
|
+
},
|
|
3851
|
+
label: {
|
|
3852
|
+
marginInlineStart: 0,
|
|
3853
|
+
},
|
|
3854
|
+
},
|
|
3977
3855
|
sizes: {
|
|
3978
3856
|
sm: {
|
|
3979
3857
|
control: {
|
|
@@ -3982,6 +3860,8 @@ var CheckboxConfig = {
|
|
|
3982
3860
|
},
|
|
3983
3861
|
label: {
|
|
3984
3862
|
fontSize: fontSizes.sm,
|
|
3863
|
+
ml: 2,
|
|
3864
|
+
mt: -1,
|
|
3985
3865
|
},
|
|
3986
3866
|
},
|
|
3987
3867
|
md: {
|
|
@@ -3991,6 +3871,8 @@ var CheckboxConfig = {
|
|
|
3991
3871
|
},
|
|
3992
3872
|
label: {
|
|
3993
3873
|
fontSize: fontSizes.md,
|
|
3874
|
+
ml: 2,
|
|
3875
|
+
mt: -1,
|
|
3994
3876
|
},
|
|
3995
3877
|
},
|
|
3996
3878
|
lg: {
|
|
@@ -4000,6 +3882,8 @@ var CheckboxConfig = {
|
|
|
4000
3882
|
},
|
|
4001
3883
|
label: {
|
|
4002
3884
|
fontSize: fontSizes.lg,
|
|
3885
|
+
ml: 3,
|
|
3886
|
+
mt: '-3px',
|
|
4003
3887
|
},
|
|
4004
3888
|
},
|
|
4005
3889
|
},
|
|
@@ -4263,6 +4147,131 @@ var RatingDot = function (_a) {
|
|
|
4263
4147
|
} }, number))) : (React__default["default"].createElement(react.Flex, { as: "div", bgColor: colors.background.brand, h: "40px", w: "40px", borderRadius: "20px", border: "2px solid ".concat(colors.background.brand), color: colors.text.dark.default, mr: 1, mb: 1, justifyContent: "center", alignItems: "center", fontSize: "lg", cursor: "default" }, number))));
|
|
4264
4148
|
};
|
|
4265
4149
|
|
|
4150
|
+
var Heading = function (_a) {
|
|
4151
|
+
var children = _a.children, _b = _a.size, size = _b === void 0 ? 'lg' : _b, color = _a.color, _c = _a.colorToken, colorToken = _c === void 0 ? 'headline' : _c, _d = _a.darkMode, darkMode = _d === void 0 ? false : _d, rest = __rest(_a, ["children", "size", "color", "colorToken", "darkMode"]);
|
|
4152
|
+
var _e = useTheme(), components = _e.components, colors = _e.colors;
|
|
4153
|
+
var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
|
|
4154
|
+
var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
|
|
4155
|
+
var sizes = components.Heading.variants[variant].sizes;
|
|
4156
|
+
var sizeProps = !sizes ? undefined : sizes[size];
|
|
4157
|
+
return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
|
|
4158
|
+
};
|
|
4159
|
+
|
|
4160
|
+
var HeadingConfig = {
|
|
4161
|
+
variants: {
|
|
4162
|
+
large: {
|
|
4163
|
+
sizes: {
|
|
4164
|
+
xs: {
|
|
4165
|
+
fontSize: '14px',
|
|
4166
|
+
lineHeight: '120%',
|
|
4167
|
+
fontWeight: fontWeights.semibold,
|
|
4168
|
+
},
|
|
4169
|
+
sm: {
|
|
4170
|
+
fontSize: '16px',
|
|
4171
|
+
lineHeight: '120%',
|
|
4172
|
+
fontWeight: fontWeights.semibold,
|
|
4173
|
+
},
|
|
4174
|
+
md: {
|
|
4175
|
+
fontSize: '20px',
|
|
4176
|
+
lineHeight: '120%',
|
|
4177
|
+
fontWeight: fontWeights.semibold,
|
|
4178
|
+
},
|
|
4179
|
+
lg: {
|
|
4180
|
+
fontSize: '30px',
|
|
4181
|
+
lineHeight: '133%',
|
|
4182
|
+
fontWeight: fontWeights.semibold,
|
|
4183
|
+
},
|
|
4184
|
+
xl: {
|
|
4185
|
+
fontSize: '36px',
|
|
4186
|
+
lineHeight: '133%',
|
|
4187
|
+
fontWeight: fontWeights.semibold,
|
|
4188
|
+
},
|
|
4189
|
+
'2xl': {
|
|
4190
|
+
fontSize: '48px',
|
|
4191
|
+
lineHeight: '120%',
|
|
4192
|
+
fontWeight: fontWeights.semibold,
|
|
4193
|
+
},
|
|
4194
|
+
'3xl': {
|
|
4195
|
+
fontSize: '60px',
|
|
4196
|
+
lineHeight: '100%',
|
|
4197
|
+
fontWeight: fontWeights.semibold,
|
|
4198
|
+
},
|
|
4199
|
+
'4xl': {
|
|
4200
|
+
fontSize: '72px',
|
|
4201
|
+
lineHeight: '100%',
|
|
4202
|
+
fontWeight: fontWeights.semibold,
|
|
4203
|
+
},
|
|
4204
|
+
},
|
|
4205
|
+
},
|
|
4206
|
+
small: {
|
|
4207
|
+
sizes: {
|
|
4208
|
+
xs: {
|
|
4209
|
+
fontSize: '14px',
|
|
4210
|
+
lineHeight: '120%',
|
|
4211
|
+
fontWeight: fontWeights.semibold,
|
|
4212
|
+
},
|
|
4213
|
+
sm: {
|
|
4214
|
+
fontSize: '16px',
|
|
4215
|
+
lineHeight: '120%',
|
|
4216
|
+
fontWeight: fontWeights.semibold,
|
|
4217
|
+
},
|
|
4218
|
+
md: {
|
|
4219
|
+
fontSize: '20px',
|
|
4220
|
+
lineHeight: '120%',
|
|
4221
|
+
fontWeight: fontWeights.semibold,
|
|
4222
|
+
},
|
|
4223
|
+
lg: {
|
|
4224
|
+
fontSize: '24px',
|
|
4225
|
+
lineHeight: '133%',
|
|
4226
|
+
fontWeight: fontWeights.semibold,
|
|
4227
|
+
},
|
|
4228
|
+
xl: {
|
|
4229
|
+
fontSize: '30px',
|
|
4230
|
+
lineHeight: '133%',
|
|
4231
|
+
fontWeight: fontWeights.semibold,
|
|
4232
|
+
},
|
|
4233
|
+
'2xl': {
|
|
4234
|
+
fontSize: '36px',
|
|
4235
|
+
lineHeight: '120%',
|
|
4236
|
+
fontWeight: fontWeights.semibold,
|
|
4237
|
+
},
|
|
4238
|
+
'3xl': {
|
|
4239
|
+
fontSize: '48px',
|
|
4240
|
+
lineHeight: '100%',
|
|
4241
|
+
fontWeight: fontWeights.semibold,
|
|
4242
|
+
},
|
|
4243
|
+
'4xl': {
|
|
4244
|
+
fontSize: '60px',
|
|
4245
|
+
lineHeight: '100%',
|
|
4246
|
+
fontWeight: fontWeights.semibold,
|
|
4247
|
+
},
|
|
4248
|
+
},
|
|
4249
|
+
},
|
|
4250
|
+
},
|
|
4251
|
+
};
|
|
4252
|
+
|
|
4253
|
+
var TruncatedText = function (_a) {
|
|
4254
|
+
var _b = _a.noOfLines, noOfLines = _b === void 0 ? 1 : _b, textContent = _a.textContent, placement = _a.placement, titleCaseTooltipLabel = _a.titleCaseTooltipLabel, rest = __rest(_a, ["noOfLines", "textContent", "placement", "titleCaseTooltipLabel"]);
|
|
4255
|
+
var _c = __read(React.useState(false), 2), isTextOverFlowing = _c[0], setIsTextOverFlowing = _c[1];
|
|
4256
|
+
var containerRef = React.useRef(null);
|
|
4257
|
+
var onCheckTextOverFlowing = React.useCallback(function (containerRefValue) {
|
|
4258
|
+
var _a, _b;
|
|
4259
|
+
if (containerRefValue && containerRefValue.current) {
|
|
4260
|
+
var textScrollHeight = ((_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].scrollHeight) || 0;
|
|
4261
|
+
var containerOffsetHeight = ((_b = containerRefValue.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
|
|
4262
|
+
return textScrollHeight > containerOffsetHeight;
|
|
4263
|
+
}
|
|
4264
|
+
return false;
|
|
4265
|
+
}, []);
|
|
4266
|
+
React.useEffect(function () {
|
|
4267
|
+
var checkValue = onCheckTextOverFlowing(containerRef);
|
|
4268
|
+
setIsTextOverFlowing(checkValue);
|
|
4269
|
+
}, [containerRef, onCheckTextOverFlowing]);
|
|
4270
|
+
return (React__default["default"].createElement(react.Box, { ref: containerRef, className: "TruncatedText__Wrapper" },
|
|
4271
|
+
React__default["default"].createElement(Tooltip, { className: "TruncatedText__Tooltip", label: textContent || '', isDisabled: !isTextOverFlowing, placement: placement, titleCaseLabel: titleCaseTooltipLabel },
|
|
4272
|
+
React__default["default"].createElement(react.Text, __assign({ className: "TruncatedText__TextContent", noOfLines: noOfLines, as: "p" }, rest), textContent))));
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4266
4275
|
var RatingDots = function (_a) {
|
|
4267
4276
|
var minValue = _a.minValue, maxValue = _a.maxValue, minLabel = _a.minLabel, maxLabel = _a.maxLabel, centeredLabel = _a.centeredLabel, isDisabled = _a.isDisabled, isInteractive = _a.isInteractive, onClick = _a.onClick, selected = _a.selected;
|
|
4268
4277
|
var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
@@ -4612,20 +4621,24 @@ var Select = function (_a) {
|
|
|
4612
4621
|
var options = _a.options; _a.isFieldInline; var useBrowserDefaultMenu = _a.useBrowserDefaultMenu, placeholder = _a.placeholder, listProps = _a.listProps, value = _a.value, _b = _a.shouldTruncateText, shouldTruncateText = _b === void 0 ? true : _b, size = _a.size, onChange = _a.onChange, domProps = __rest(_a, ["options", "isFieldInline", "useBrowserDefaultMenu", "placeholder", "listProps", "value", "shouldTruncateText", "size", "onChange"]);
|
|
4613
4622
|
var colors = useTheme().colors;
|
|
4614
4623
|
var selectRef = React.useRef(null);
|
|
4615
|
-
var
|
|
4624
|
+
var palceholderValue = React.useMemo(function () { return ({
|
|
4616
4625
|
label: placeholder,
|
|
4617
4626
|
value: '',
|
|
4618
4627
|
leftElement: null,
|
|
4619
4628
|
isPlaceholder: true,
|
|
4620
|
-
})
|
|
4629
|
+
}); }, [placeholder]);
|
|
4630
|
+
var _c = __read(React.useState(palceholderValue), 2), selectedOption = _c[0], setSelectedOption = _c[1];
|
|
4621
4631
|
React.useEffect(function () {
|
|
4622
4632
|
if (value) {
|
|
4623
4633
|
var defaultValue = options.find(function (option) { return option.value === value; });
|
|
4624
4634
|
if (defaultValue) {
|
|
4625
4635
|
setSelectedOption(defaultValue);
|
|
4626
4636
|
}
|
|
4637
|
+
else {
|
|
4638
|
+
setSelectedOption(palceholderValue);
|
|
4639
|
+
}
|
|
4627
4640
|
}
|
|
4628
|
-
}, [value, options]);
|
|
4641
|
+
}, [value, options, palceholderValue]);
|
|
4629
4642
|
var selectWidth = React.useMemo(function () {
|
|
4630
4643
|
var _a;
|
|
4631
4644
|
if (!selectRef.current) {
|