@televet/kibble-ui 1.14.0-beta.3rxq26f.1 → 1.14.0

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
  },
@@ -4144,131 +4260,6 @@ var RatingDot = function (_a) {
4144
4260
  } }, 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
4261
  };
4146
4262
 
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
4263
  var RatingDots = function (_a) {
4273
4264
  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
4265
  var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];