@televet/kibble-ui 1.14.2-beta.2v2u763.2 → 1.14.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.
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TagProps as ChakraTagProps } from '@chakra-ui/react';
|
|
3
3
|
import { TagSize } from './tag.types';
|
|
4
|
-
import { FontWeight } from 'theme/tokens';
|
|
5
4
|
export interface TagProps extends ChakraTagProps {
|
|
6
5
|
leftElement?: JSX.Element;
|
|
7
6
|
rightElement?: JSX.Element;
|
|
8
7
|
label: string;
|
|
9
8
|
showCloseButton?: boolean;
|
|
10
9
|
size?: TagSize;
|
|
11
|
-
fontWeight?: FontWeight;
|
|
12
10
|
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
13
11
|
}
|
|
14
|
-
export declare const Tag: ({ leftElement, rightElement, label, showCloseButton,
|
|
12
|
+
export declare const Tag: ({ leftElement, rightElement, label, showCloseButton, onClose, size, ...rest }: TagProps) => JSX.Element;
|
package/build/index.js
CHANGED
|
@@ -105,11 +105,11 @@ var paddingRightBySize = {
|
|
|
105
105
|
lg: 1,
|
|
106
106
|
};
|
|
107
107
|
var Tag = function (_a) {
|
|
108
|
-
var leftElement = _a.leftElement, rightElement = _a.rightElement, label = _a.label, _b = _a.showCloseButton, showCloseButton = _b === void 0 ? false : _b,
|
|
108
|
+
var leftElement = _a.leftElement, rightElement = _a.rightElement, label = _a.label, _b = _a.showCloseButton, showCloseButton = _b === void 0 ? false : _b, onClose = _a.onClose, _c = _a.size, size = _c === void 0 ? 'md' : _c, rest = __rest(_a, ["leftElement", "rightElement", "label", "showCloseButton", "onClose", "size"]);
|
|
109
109
|
var labelStyle = __assign(__assign({}, (!!leftElement && { ml: 1 })), (!!rightElement && { mr: 1 }));
|
|
110
110
|
return (React__default["default"].createElement(react.Tag, __assign({}, rest, { size: size }, (showCloseButton && { pr: paddingRightBySize[size] })),
|
|
111
111
|
leftElement,
|
|
112
|
-
React__default["default"].createElement(react.TagLabel, __assign({}, labelStyle
|
|
112
|
+
React__default["default"].createElement(react.TagLabel, __assign({}, labelStyle), label),
|
|
113
113
|
rightElement,
|
|
114
114
|
showCloseButton && !!onClose && React__default["default"].createElement(react.TagCloseButton, { onClick: onClose })));
|
|
115
115
|
};
|
|
@@ -508,6 +508,9 @@ var TagConfig = {
|
|
|
508
508
|
container: {
|
|
509
509
|
borderRadius: radii.md,
|
|
510
510
|
},
|
|
511
|
+
label: {
|
|
512
|
+
fontWeight: fontWeights.semibold,
|
|
513
|
+
},
|
|
511
514
|
closeButton: {
|
|
512
515
|
height: '20px',
|
|
513
516
|
marginInline: 0,
|
|
@@ -3784,18 +3787,150 @@ function withFormControl(Component) {
|
|
|
3784
3787
|
return WithFormControl;
|
|
3785
3788
|
}
|
|
3786
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
|
+
|
|
3787
3915
|
var Checkbox = function (_a) {
|
|
3788
3916
|
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
|
+
};
|
|
3789
3922
|
var margins = { m: m, mb: mb, mt: mt, mr: mr, ml: ml };
|
|
3790
|
-
return (React__default["default"].createElement(react.
|
|
3791
|
-
React__default["default"].createElement(react.Checkbox, __assign({}, rest, { size: size, variant: variant, m: 0
|
|
3923
|
+
return (React__default["default"].createElement(react.FormLabel, __assign({ display: "flex", alignItems: "center", cursor: "pointer" }, margins),
|
|
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)));
|
|
3792
3927
|
};
|
|
3793
3928
|
|
|
3794
3929
|
var CheckboxGroup = function (_a) {
|
|
3795
3930
|
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"]);
|
|
3796
3931
|
rest.isFieldInline; var domProps = __rest(rest, ["isFieldInline"]);
|
|
3797
3932
|
return (React__default["default"].createElement(react.CheckboxGroup, __assign({}, domProps),
|
|
3798
|
-
React__default["default"].createElement(react.Stack, { direction: direction, spacing: spacing,
|
|
3933
|
+
React__default["default"].createElement(react.Stack, { direction: direction, spacing: spacing, display: "inline-flex" }, checkboxes.map(function (checkbox, index) { return (React__default["default"].createElement(Checkbox, __assign({ key: index }, checkbox, { size: size, variant: variant || checkbox.variant }))); }))));
|
|
3799
3934
|
};
|
|
3800
3935
|
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
3801
3936
|
var WrappedCheckboxGroup = withFormControl(CheckboxGroup);
|
|
@@ -3839,16 +3974,6 @@ var RoundCheckedStyle = {
|
|
|
3839
3974
|
},
|
|
3840
3975
|
};
|
|
3841
3976
|
var CheckboxConfig = {
|
|
3842
|
-
baseStyle: {
|
|
3843
|
-
control: {
|
|
3844
|
-
_focus: {
|
|
3845
|
-
boxShadow: 'none',
|
|
3846
|
-
},
|
|
3847
|
-
},
|
|
3848
|
-
label: {
|
|
3849
|
-
marginInlineStart: 0,
|
|
3850
|
-
},
|
|
3851
|
-
},
|
|
3852
3977
|
sizes: {
|
|
3853
3978
|
sm: {
|
|
3854
3979
|
control: {
|
|
@@ -3857,8 +3982,6 @@ var CheckboxConfig = {
|
|
|
3857
3982
|
},
|
|
3858
3983
|
label: {
|
|
3859
3984
|
fontSize: fontSizes.sm,
|
|
3860
|
-
ml: 2,
|
|
3861
|
-
mt: -1,
|
|
3862
3985
|
},
|
|
3863
3986
|
},
|
|
3864
3987
|
md: {
|
|
@@ -3868,8 +3991,6 @@ var CheckboxConfig = {
|
|
|
3868
3991
|
},
|
|
3869
3992
|
label: {
|
|
3870
3993
|
fontSize: fontSizes.md,
|
|
3871
|
-
ml: 2,
|
|
3872
|
-
mt: -1,
|
|
3873
3994
|
},
|
|
3874
3995
|
},
|
|
3875
3996
|
lg: {
|
|
@@ -3879,8 +4000,6 @@ var CheckboxConfig = {
|
|
|
3879
4000
|
},
|
|
3880
4001
|
label: {
|
|
3881
4002
|
fontSize: fontSizes.lg,
|
|
3882
|
-
ml: 3,
|
|
3883
|
-
mt: '-3px',
|
|
3884
4003
|
},
|
|
3885
4004
|
},
|
|
3886
4005
|
},
|
|
@@ -4144,131 +4263,6 @@ var RatingDot = function (_a) {
|
|
|
4144
4263
|
} }, 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))));
|
|
4145
4264
|
};
|
|
4146
4265
|
|
|
4147
|
-
var Heading = function (_a) {
|
|
4148
|
-
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"]);
|
|
4149
|
-
var _e = useTheme(), components = _e.components, colors = _e.colors;
|
|
4150
|
-
var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
|
|
4151
|
-
var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
|
|
4152
|
-
var sizes = components.Heading.variants[variant].sizes;
|
|
4153
|
-
var sizeProps = !sizes ? undefined : sizes[size];
|
|
4154
|
-
return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
|
|
4155
|
-
};
|
|
4156
|
-
|
|
4157
|
-
var HeadingConfig = {
|
|
4158
|
-
variants: {
|
|
4159
|
-
large: {
|
|
4160
|
-
sizes: {
|
|
4161
|
-
xs: {
|
|
4162
|
-
fontSize: '14px',
|
|
4163
|
-
lineHeight: '120%',
|
|
4164
|
-
fontWeight: fontWeights.semibold,
|
|
4165
|
-
},
|
|
4166
|
-
sm: {
|
|
4167
|
-
fontSize: '16px',
|
|
4168
|
-
lineHeight: '120%',
|
|
4169
|
-
fontWeight: fontWeights.semibold,
|
|
4170
|
-
},
|
|
4171
|
-
md: {
|
|
4172
|
-
fontSize: '20px',
|
|
4173
|
-
lineHeight: '120%',
|
|
4174
|
-
fontWeight: fontWeights.semibold,
|
|
4175
|
-
},
|
|
4176
|
-
lg: {
|
|
4177
|
-
fontSize: '30px',
|
|
4178
|
-
lineHeight: '133%',
|
|
4179
|
-
fontWeight: fontWeights.semibold,
|
|
4180
|
-
},
|
|
4181
|
-
xl: {
|
|
4182
|
-
fontSize: '36px',
|
|
4183
|
-
lineHeight: '133%',
|
|
4184
|
-
fontWeight: fontWeights.semibold,
|
|
4185
|
-
},
|
|
4186
|
-
'2xl': {
|
|
4187
|
-
fontSize: '48px',
|
|
4188
|
-
lineHeight: '120%',
|
|
4189
|
-
fontWeight: fontWeights.semibold,
|
|
4190
|
-
},
|
|
4191
|
-
'3xl': {
|
|
4192
|
-
fontSize: '60px',
|
|
4193
|
-
lineHeight: '100%',
|
|
4194
|
-
fontWeight: fontWeights.semibold,
|
|
4195
|
-
},
|
|
4196
|
-
'4xl': {
|
|
4197
|
-
fontSize: '72px',
|
|
4198
|
-
lineHeight: '100%',
|
|
4199
|
-
fontWeight: fontWeights.semibold,
|
|
4200
|
-
},
|
|
4201
|
-
},
|
|
4202
|
-
},
|
|
4203
|
-
small: {
|
|
4204
|
-
sizes: {
|
|
4205
|
-
xs: {
|
|
4206
|
-
fontSize: '14px',
|
|
4207
|
-
lineHeight: '120%',
|
|
4208
|
-
fontWeight: fontWeights.semibold,
|
|
4209
|
-
},
|
|
4210
|
-
sm: {
|
|
4211
|
-
fontSize: '16px',
|
|
4212
|
-
lineHeight: '120%',
|
|
4213
|
-
fontWeight: fontWeights.semibold,
|
|
4214
|
-
},
|
|
4215
|
-
md: {
|
|
4216
|
-
fontSize: '20px',
|
|
4217
|
-
lineHeight: '120%',
|
|
4218
|
-
fontWeight: fontWeights.semibold,
|
|
4219
|
-
},
|
|
4220
|
-
lg: {
|
|
4221
|
-
fontSize: '24px',
|
|
4222
|
-
lineHeight: '133%',
|
|
4223
|
-
fontWeight: fontWeights.semibold,
|
|
4224
|
-
},
|
|
4225
|
-
xl: {
|
|
4226
|
-
fontSize: '30px',
|
|
4227
|
-
lineHeight: '133%',
|
|
4228
|
-
fontWeight: fontWeights.semibold,
|
|
4229
|
-
},
|
|
4230
|
-
'2xl': {
|
|
4231
|
-
fontSize: '36px',
|
|
4232
|
-
lineHeight: '120%',
|
|
4233
|
-
fontWeight: fontWeights.semibold,
|
|
4234
|
-
},
|
|
4235
|
-
'3xl': {
|
|
4236
|
-
fontSize: '48px',
|
|
4237
|
-
lineHeight: '100%',
|
|
4238
|
-
fontWeight: fontWeights.semibold,
|
|
4239
|
-
},
|
|
4240
|
-
'4xl': {
|
|
4241
|
-
fontSize: '60px',
|
|
4242
|
-
lineHeight: '100%',
|
|
4243
|
-
fontWeight: fontWeights.semibold,
|
|
4244
|
-
},
|
|
4245
|
-
},
|
|
4246
|
-
},
|
|
4247
|
-
},
|
|
4248
|
-
};
|
|
4249
|
-
|
|
4250
|
-
var TruncatedText = function (_a) {
|
|
4251
|
-
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"]);
|
|
4252
|
-
var _c = __read(React.useState(false), 2), isTextOverFlowing = _c[0], setIsTextOverFlowing = _c[1];
|
|
4253
|
-
var containerRef = React.useRef(null);
|
|
4254
|
-
var onCheckTextOverFlowing = React.useCallback(function (containerRefValue) {
|
|
4255
|
-
var _a, _b;
|
|
4256
|
-
if (containerRefValue && containerRefValue.current) {
|
|
4257
|
-
var textScrollHeight = ((_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].scrollHeight) || 0;
|
|
4258
|
-
var containerOffsetHeight = ((_b = containerRefValue.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
|
|
4259
|
-
return textScrollHeight > containerOffsetHeight;
|
|
4260
|
-
}
|
|
4261
|
-
return false;
|
|
4262
|
-
}, []);
|
|
4263
|
-
React.useEffect(function () {
|
|
4264
|
-
var checkValue = onCheckTextOverFlowing(containerRef);
|
|
4265
|
-
setIsTextOverFlowing(checkValue);
|
|
4266
|
-
}, [containerRef, onCheckTextOverFlowing]);
|
|
4267
|
-
return (React__default["default"].createElement(react.Box, { ref: containerRef, className: "TruncatedText__Wrapper" },
|
|
4268
|
-
React__default["default"].createElement(Tooltip, { className: "TruncatedText__Tooltip", label: textContent || '', isDisabled: !isTextOverFlowing, placement: placement, titleCaseLabel: titleCaseTooltipLabel },
|
|
4269
|
-
React__default["default"].createElement(react.Text, __assign({ className: "TruncatedText__TextContent", noOfLines: noOfLines, as: "p" }, rest), textContent))));
|
|
4270
|
-
};
|
|
4271
|
-
|
|
4272
4266
|
var RatingDots = function (_a) {
|
|
4273
4267
|
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;
|
|
4274
4268
|
var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
@@ -4618,24 +4612,20 @@ var Select = function (_a) {
|
|
|
4618
4612
|
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"]);
|
|
4619
4613
|
var colors = useTheme().colors;
|
|
4620
4614
|
var selectRef = React.useRef(null);
|
|
4621
|
-
var
|
|
4615
|
+
var _c = __read(React.useState({
|
|
4622
4616
|
label: placeholder,
|
|
4623
4617
|
value: '',
|
|
4624
4618
|
leftElement: null,
|
|
4625
4619
|
isPlaceholder: true,
|
|
4626
|
-
})
|
|
4627
|
-
var _c = __read(React.useState(palceholderValue), 2), selectedOption = _c[0], setSelectedOption = _c[1];
|
|
4620
|
+
}), 2), selectedOption = _c[0], setSelectedOption = _c[1];
|
|
4628
4621
|
React.useEffect(function () {
|
|
4629
4622
|
if (value) {
|
|
4630
4623
|
var defaultValue = options.find(function (option) { return option.value === value; });
|
|
4631
4624
|
if (defaultValue) {
|
|
4632
4625
|
setSelectedOption(defaultValue);
|
|
4633
4626
|
}
|
|
4634
|
-
else {
|
|
4635
|
-
setSelectedOption(palceholderValue);
|
|
4636
|
-
}
|
|
4637
4627
|
}
|
|
4638
|
-
}, [value, options
|
|
4628
|
+
}, [value, options]);
|
|
4639
4629
|
var selectWidth = React.useMemo(function () {
|
|
4640
4630
|
var _a;
|
|
4641
4631
|
if (!selectRef.current) {
|