@televet/kibble-ui 1.14.2-beta.2v2u763.1 → 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.
package/build/index.js CHANGED
@@ -3787,18 +3787,150 @@ 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
+
3790
3915
  var Checkbox = function (_a) {
3791
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
+ };
3792
3922
  var margins = { m: m, mb: mb, mt: mt, mr: mr, ml: ml };
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)));
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)));
3795
3927
  };
3796
3928
 
3797
3929
  var CheckboxGroup = function (_a) {
3798
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"]);
3799
3931
  rest.isFieldInline; var domProps = __rest(rest, ["isFieldInline"]);
3800
3932
  return (React__default["default"].createElement(react.CheckboxGroup, __assign({}, domProps),
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 }))); }))));
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 }))); }))));
3802
3934
  };
3803
3935
  CheckboxGroup.displayName = 'CheckboxGroup';
3804
3936
  var WrappedCheckboxGroup = withFormControl(CheckboxGroup);
@@ -3842,16 +3974,6 @@ var RoundCheckedStyle = {
3842
3974
  },
3843
3975
  };
3844
3976
  var CheckboxConfig = {
3845
- baseStyle: {
3846
- control: {
3847
- _focus: {
3848
- boxShadow: 'none',
3849
- },
3850
- },
3851
- label: {
3852
- marginInlineStart: 0,
3853
- },
3854
- },
3855
3977
  sizes: {
3856
3978
  sm: {
3857
3979
  control: {
@@ -3860,8 +3982,6 @@ var CheckboxConfig = {
3860
3982
  },
3861
3983
  label: {
3862
3984
  fontSize: fontSizes.sm,
3863
- ml: 2,
3864
- mt: -1,
3865
3985
  },
3866
3986
  },
3867
3987
  md: {
@@ -3871,8 +3991,6 @@ var CheckboxConfig = {
3871
3991
  },
3872
3992
  label: {
3873
3993
  fontSize: fontSizes.md,
3874
- ml: 2,
3875
- mt: -1,
3876
3994
  },
3877
3995
  },
3878
3996
  lg: {
@@ -3882,8 +4000,6 @@ var CheckboxConfig = {
3882
4000
  },
3883
4001
  label: {
3884
4002
  fontSize: fontSizes.lg,
3885
- ml: 3,
3886
- mt: '-3px',
3887
4003
  },
3888
4004
  },
3889
4005
  },
@@ -4147,131 +4263,6 @@ var RatingDot = function (_a) {
4147
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))));
4148
4264
  };
4149
4265
 
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
-
4275
4266
  var RatingDots = function (_a) {
4276
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;
4277
4268
  var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
@@ -4621,24 +4612,20 @@ var Select = function (_a) {
4621
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"]);
4622
4613
  var colors = useTheme().colors;
4623
4614
  var selectRef = React.useRef(null);
4624
- var palceholderValue = React.useMemo(function () { return ({
4615
+ var _c = __read(React.useState({
4625
4616
  label: placeholder,
4626
4617
  value: '',
4627
4618
  leftElement: null,
4628
4619
  isPlaceholder: true,
4629
- }); }, [placeholder]);
4630
- var _c = __read(React.useState(palceholderValue), 2), selectedOption = _c[0], setSelectedOption = _c[1];
4620
+ }), 2), selectedOption = _c[0], setSelectedOption = _c[1];
4631
4621
  React.useEffect(function () {
4632
4622
  if (value) {
4633
4623
  var defaultValue = options.find(function (option) { return option.value === value; });
4634
4624
  if (defaultValue) {
4635
4625
  setSelectedOption(defaultValue);
4636
4626
  }
4637
- else {
4638
- setSelectedOption(palceholderValue);
4639
- }
4640
4627
  }
4641
- }, [value, options, palceholderValue]);
4628
+ }, [value, options]);
4642
4629
  var selectWidth = React.useMemo(function () {
4643
4630
  var _a;
4644
4631
  if (!selectRef.current) {