@televet/kibble-ui 1.17.12 → 1.17.13

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
@@ -620,6 +620,40 @@ var NotificationCounter = function (_a) {
620
620
  return (React__default["default"].createElement(react.Flex, __assign({}, rest, { alignItems: "center", border: theme.borders['1px'], borderColor: theme.colors.white, borderRadius: theme.radii.full, fontSize: notificationCounterFontSizes[size], fontWeight: theme.fontWeights.semibold, height: notificationCounterSizes[size], justifyContent: "center", width: notificationCounterSizes[size] }, notificationVariantStyles[variant]), _showCount && counterContent));
621
621
  };
622
622
 
623
+ exports.AlertVariant = void 0;
624
+ (function (AlertVariant) {
625
+ AlertVariant["Error"] = "error";
626
+ AlertVariant["Warning"] = "warning";
627
+ AlertVariant["Success"] = "success";
628
+ AlertVariant["Info"] = "info";
629
+ })(exports.AlertVariant || (exports.AlertVariant = {}));
630
+ exports.AlertStatusIcon = void 0;
631
+ (function (AlertStatusIcon) {
632
+ AlertStatusIcon["error"] = "warningSign";
633
+ AlertStatusIcon["warning"] = "warningSign";
634
+ AlertStatusIcon["success"] = "checkmark";
635
+ AlertStatusIcon["info"] = "infoCircleOutlined";
636
+ })(exports.AlertStatusIcon || (exports.AlertStatusIcon = {}));
637
+
638
+ var LightStatusVariantMap = {
639
+ info: 'info',
640
+ success: 'success',
641
+ warning: 'warning',
642
+ error: 'error',
643
+ };
644
+ var DarkStatusVariantMap = {
645
+ info: 'infoDark',
646
+ success: 'successDark',
647
+ warning: 'warningDark',
648
+ error: 'errorDark',
649
+ };
650
+ var AlertIconColorMap = {
651
+ info: 'active',
652
+ success: 'success',
653
+ error: 'error',
654
+ warning: 'warning',
655
+ };
656
+
623
657
  var IconSizeMap$1 = {
624
658
  xs: 14,
625
659
  sm: 16,
@@ -3447,21 +3481,6 @@ var Logo = function (_a) {
3447
3481
  };
3448
3482
  Logo.displayName = 'Logo';
3449
3483
 
3450
- exports.AlertVariant = void 0;
3451
- (function (AlertVariant) {
3452
- AlertVariant["Error"] = "error";
3453
- AlertVariant["Warning"] = "warning";
3454
- AlertVariant["Success"] = "success";
3455
- AlertVariant["Info"] = "info";
3456
- })(exports.AlertVariant || (exports.AlertVariant = {}));
3457
- exports.AlertStatusIcon = void 0;
3458
- (function (AlertStatusIcon) {
3459
- AlertStatusIcon["error"] = "warningSign";
3460
- AlertStatusIcon["warning"] = "warningSign";
3461
- AlertStatusIcon["success"] = "checkmark";
3462
- AlertStatusIcon["info"] = "infoCircleOutlined";
3463
- })(exports.AlertStatusIcon || (exports.AlertStatusIcon = {}));
3464
-
3465
3484
  var Button = React.forwardRef(function (props, ref) {
3466
3485
  var _a = useTheme(), components = _a.components, fontWeights = _a.fontWeights, radii = _a.radii;
3467
3486
  var _b = components.Button[props.variant || 'primary'], variant = _b.variant, light = _b.light, dark = _b.dark;
@@ -3718,6 +3737,121 @@ var ButtonSizeConfig = {
3718
3737
  },
3719
3738
  };
3720
3739
 
3740
+ var AlertButton = function (buttonProps) {
3741
+ buttonProps.buttonText; var buttonPosition = buttonProps.buttonPosition, hasDescription = buttonProps.hasDescription, rest = __rest(buttonProps, ["buttonText", "buttonPosition", "hasDescription"]);
3742
+ return (React__default["default"].createElement(react.Box, { className: "Alert__Button", pt: buttonPosition === 'bottomLeft' && !hasDescription ? 1 : 0, pb: buttonPosition === 'bottomLeft' ? 0.5 : 0 },
3743
+ React__default["default"].createElement(Button, __assign({ size: "xs", variant: "secondary" }, rest), buttonProps.buttonText)));
3744
+ };
3745
+
3746
+ var AlertCloseButton = function (props) {
3747
+ var onClose = props.onClose;
3748
+ return (React__default["default"].createElement(react.Box, { className: "Alert__CloseButton" },
3749
+ React__default["default"].createElement(Button, { variant: "ghostNeutral", iconName: "close", size: "xs", onClick: onClose })));
3750
+ };
3751
+
3752
+ var Heading = function (_a) {
3753
+ 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"]);
3754
+ var _e = useTheme(), components = _e.components, colors = _e.colors;
3755
+ var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
3756
+ var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
3757
+ var sizes = components.Heading.variants[variant].sizes;
3758
+ var sizeProps = !sizes ? undefined : sizes[size];
3759
+ return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
3760
+ };
3761
+
3762
+ var HeadingConfig = {
3763
+ variants: {
3764
+ large: {
3765
+ sizes: {
3766
+ xs: {
3767
+ fontSize: '14px',
3768
+ lineHeight: '120%',
3769
+ fontWeight: fontWeights.semibold,
3770
+ },
3771
+ sm: {
3772
+ fontSize: '16px',
3773
+ lineHeight: '120%',
3774
+ fontWeight: fontWeights.semibold,
3775
+ },
3776
+ md: {
3777
+ fontSize: '20px',
3778
+ lineHeight: '120%',
3779
+ fontWeight: fontWeights.semibold,
3780
+ },
3781
+ lg: {
3782
+ fontSize: '30px',
3783
+ lineHeight: '133%',
3784
+ fontWeight: fontWeights.semibold,
3785
+ },
3786
+ xl: {
3787
+ fontSize: '36px',
3788
+ lineHeight: '133%',
3789
+ fontWeight: fontWeights.semibold,
3790
+ },
3791
+ '2xl': {
3792
+ fontSize: '48px',
3793
+ lineHeight: '120%',
3794
+ fontWeight: fontWeights.semibold,
3795
+ },
3796
+ '3xl': {
3797
+ fontSize: '60px',
3798
+ lineHeight: '100%',
3799
+ fontWeight: fontWeights.semibold,
3800
+ },
3801
+ '4xl': {
3802
+ fontSize: '72px',
3803
+ lineHeight: '100%',
3804
+ fontWeight: fontWeights.semibold,
3805
+ },
3806
+ },
3807
+ },
3808
+ small: {
3809
+ sizes: {
3810
+ xs: {
3811
+ fontSize: '14px',
3812
+ lineHeight: '120%',
3813
+ fontWeight: fontWeights.semibold,
3814
+ },
3815
+ sm: {
3816
+ fontSize: '16px',
3817
+ lineHeight: '120%',
3818
+ fontWeight: fontWeights.semibold,
3819
+ },
3820
+ md: {
3821
+ fontSize: '20px',
3822
+ lineHeight: '120%',
3823
+ fontWeight: fontWeights.semibold,
3824
+ },
3825
+ lg: {
3826
+ fontSize: '24px',
3827
+ lineHeight: '133%',
3828
+ fontWeight: fontWeights.semibold,
3829
+ },
3830
+ xl: {
3831
+ fontSize: '30px',
3832
+ lineHeight: '133%',
3833
+ fontWeight: fontWeights.semibold,
3834
+ },
3835
+ '2xl': {
3836
+ fontSize: '36px',
3837
+ lineHeight: '120%',
3838
+ fontWeight: fontWeights.semibold,
3839
+ },
3840
+ '3xl': {
3841
+ fontSize: '48px',
3842
+ lineHeight: '100%',
3843
+ fontWeight: fontWeights.semibold,
3844
+ },
3845
+ '4xl': {
3846
+ fontSize: '60px',
3847
+ lineHeight: '100%',
3848
+ fontWeight: fontWeights.semibold,
3849
+ },
3850
+ },
3851
+ },
3852
+ },
3853
+ };
3854
+
3721
3855
  var DrawerConfig = {
3722
3856
  variants: {
3723
3857
  alwaysOpen: {
@@ -4197,109 +4331,6 @@ var RatingDot = function (_a) {
4197
4331
  } }, 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))));
4198
4332
  };
4199
4333
 
4200
- var Heading = function (_a) {
4201
- 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"]);
4202
- var _e = useTheme(), components = _e.components, colors = _e.colors;
4203
- var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
4204
- var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
4205
- var sizes = components.Heading.variants[variant].sizes;
4206
- var sizeProps = !sizes ? undefined : sizes[size];
4207
- return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
4208
- };
4209
-
4210
- var HeadingConfig = {
4211
- variants: {
4212
- large: {
4213
- sizes: {
4214
- xs: {
4215
- fontSize: '14px',
4216
- lineHeight: '120%',
4217
- fontWeight: fontWeights.semibold,
4218
- },
4219
- sm: {
4220
- fontSize: '16px',
4221
- lineHeight: '120%',
4222
- fontWeight: fontWeights.semibold,
4223
- },
4224
- md: {
4225
- fontSize: '20px',
4226
- lineHeight: '120%',
4227
- fontWeight: fontWeights.semibold,
4228
- },
4229
- lg: {
4230
- fontSize: '30px',
4231
- lineHeight: '133%',
4232
- fontWeight: fontWeights.semibold,
4233
- },
4234
- xl: {
4235
- fontSize: '36px',
4236
- lineHeight: '133%',
4237
- fontWeight: fontWeights.semibold,
4238
- },
4239
- '2xl': {
4240
- fontSize: '48px',
4241
- lineHeight: '120%',
4242
- fontWeight: fontWeights.semibold,
4243
- },
4244
- '3xl': {
4245
- fontSize: '60px',
4246
- lineHeight: '100%',
4247
- fontWeight: fontWeights.semibold,
4248
- },
4249
- '4xl': {
4250
- fontSize: '72px',
4251
- lineHeight: '100%',
4252
- fontWeight: fontWeights.semibold,
4253
- },
4254
- },
4255
- },
4256
- small: {
4257
- sizes: {
4258
- xs: {
4259
- fontSize: '14px',
4260
- lineHeight: '120%',
4261
- fontWeight: fontWeights.semibold,
4262
- },
4263
- sm: {
4264
- fontSize: '16px',
4265
- lineHeight: '120%',
4266
- fontWeight: fontWeights.semibold,
4267
- },
4268
- md: {
4269
- fontSize: '20px',
4270
- lineHeight: '120%',
4271
- fontWeight: fontWeights.semibold,
4272
- },
4273
- lg: {
4274
- fontSize: '24px',
4275
- lineHeight: '133%',
4276
- fontWeight: fontWeights.semibold,
4277
- },
4278
- xl: {
4279
- fontSize: '30px',
4280
- lineHeight: '133%',
4281
- fontWeight: fontWeights.semibold,
4282
- },
4283
- '2xl': {
4284
- fontSize: '36px',
4285
- lineHeight: '120%',
4286
- fontWeight: fontWeights.semibold,
4287
- },
4288
- '3xl': {
4289
- fontSize: '48px',
4290
- lineHeight: '100%',
4291
- fontWeight: fontWeights.semibold,
4292
- },
4293
- '4xl': {
4294
- fontSize: '60px',
4295
- lineHeight: '100%',
4296
- fontWeight: fontWeights.semibold,
4297
- },
4298
- },
4299
- },
4300
- },
4301
- };
4302
-
4303
4334
  var RatingDots = function (_a) {
4304
4335
  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;
4305
4336
  var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
@@ -15270,43 +15301,64 @@ var TextConfig = {
15270
15301
  },
15271
15302
  };
15272
15303
 
15273
- var LightStatusVariantMap = {
15274
- info: 'info',
15275
- success: 'success',
15276
- warning: 'warning',
15277
- error: 'error',
15278
- };
15279
- var DarkStatusVariantMap = {
15280
- info: 'infoDark',
15281
- success: 'successDark',
15282
- warning: 'warningDark',
15283
- error: 'errorDark',
15284
- };
15285
- var AlertIconColorMap = {
15286
- info: 'active',
15287
- success: 'success',
15288
- error: 'error',
15289
- warning: 'warning',
15304
+ var AlertTitle = function (props) {
15305
+ var title = props.title, titleProps = props.titleProps;
15306
+ return (React__default["default"].createElement(Heading, __assign({ className: "Alert__Title", flexGrow: 1, lineHeight: 6, size: "sm" }, titleProps), title));
15307
+ };
15308
+
15309
+ var AlertIcon = function (props) {
15310
+ var iconProps = props.iconProps, status = props.status;
15311
+ var iconColor = react.useColorModeValue(AlertIconColorMap[status], 'currentColor');
15312
+ return (React__default["default"].createElement(react.Box, { className: "Alert__Icon", maxH: "24px" },
15313
+ React__default["default"].createElement(Icon, __assign({ color: iconColor, size: "lg" }, iconProps, { name: (iconProps === null || iconProps === void 0 ? void 0 : iconProps.name) || exports.AlertStatusIcon[status] }))));
15314
+ };
15315
+
15316
+ var AlertDescription = function (props) {
15317
+ var description = props.description, descriptionProps = props.descriptionProps;
15318
+ return (React__default["default"].createElement(Text, __assign({ className: "Alert__Description", as: "p", size: "md" }, descriptionProps), description));
15319
+ };
15320
+
15321
+ var AlertBody = function (props) {
15322
+ var children = props.children, hideIcon = props.hideIcon, hideCloseButton = props.hideCloseButton;
15323
+ return (React__default["default"].createElement(react.VStack, { className: "Alert__Body", justify: "flex-start", align: "flex-start", w: "100%", pl: !hideIcon ? '34px' : '', pr: !hideCloseButton ? '34px' : '' }, children));
15324
+ };
15325
+
15326
+ var AlertHeader = function (props) {
15327
+ var children = props.children;
15328
+ return (React__default["default"].createElement(react.HStack, { className: "Alert__Header", w: "100%", align: "flex-start", justify: "flex-start" }, children));
15290
15329
  };
15291
15330
 
15292
15331
  var Alert = function (_a) {
15293
- var children = _a.children, _b = _a.status, status = _b === void 0 ? exports.AlertVariant.Success : _b, _c = _a.showIcon, showIcon = _c === void 0 ? true : _c, iconProps = _a.iconProps, _d = _a.showButton, showButton = _d === void 0 ? false : _d, buttonProps = _a.buttonProps, buttonTitle = _a.buttonTitle, alertTitle = _a.alertTitle, titleProps = _a.titleProps, description = _a.description, descriptionProps = _a.descriptionProps, _e = _a.showCloseButton, showCloseButton = _e === void 0 ? true : _e, onClose = _a.onClose, rest = __rest(_a, ["children", "status", "showIcon", "iconProps", "showButton", "buttonProps", "buttonTitle", "alertTitle", "titleProps", "description", "descriptionProps", "showCloseButton", "onClose"]);
15332
+ var buttonProps = _a.buttonProps, children = _a.children, description = _a.description, descriptionProps = _a.descriptionProps, iconProps = _a.iconProps, onClose = _a.onClose, _b = _a.hideCloseButton, hideCloseButton = _b === void 0 ? false : _b, _c = _a.hideIcon, hideIcon = _c === void 0 ? false : _c, _d = _a.status, status = _d === void 0 ? exports.AlertVariant.Success : _d, title = _a.title, titleProps = _a.titleProps, rest = __rest(_a, ["buttonProps", "children", "description", "descriptionProps", "iconProps", "onClose", "hideCloseButton", "hideIcon", "status", "title", "titleProps"]);
15294
15333
  var alertVariant = react.useColorModeValue(LightStatusVariantMap[status], DarkStatusVariantMap[status]);
15295
- var iconColor = react.useColorModeValue(AlertIconColorMap[status], 'currentColor');
15296
- return (React__default["default"].createElement(react.Alert, __assign({ justifyContent: "space-between", overflow: "visible", variant: alertVariant, pl: 3, pr: showCloseButton ? 2 : 3, pb: description || children ? 3 : 2 }, rest),
15297
- React__default["default"].createElement(react.Flex, { w: "100%" },
15298
- showIcon && (React__default["default"].createElement(react.Box, { mr: 2 },
15299
- React__default["default"].createElement(Icon, __assign({ color: iconColor, size: "lg", name: (iconProps === null || iconProps === void 0 ? void 0 : iconProps.name) || exports.AlertStatusIcon[status] }, iconProps)))),
15300
- React__default["default"].createElement(react.Flex, { flexGrow: 1 },
15301
- React__default["default"].createElement(react.Flex, { alignItems: "flex-start", flexDirection: description ? 'column' : 'row', flexWrap: "wrap", w: "100%", justify: "space-between", align: "center" },
15302
- alertTitle && (React__default["default"].createElement(react.Box, { pt: 0.5, pr: 1, flexGrow: 1 },
15303
- React__default["default"].createElement(Heading, __assign({ size: "sm", colorToken: "default" }, titleProps), alertTitle))),
15304
- description && (React__default["default"].createElement(react.Box, { flexGrow: 1, pb: 2 },
15305
- React__default["default"].createElement(Text, __assign({ as: "p", size: "md" }, descriptionProps), description))),
15306
- children,
15307
- showButton && (React__default["default"].createElement(Button, __assign({ size: "xs", variant: "secondary" }, buttonProps), buttonTitle)))),
15308
- showCloseButton && (React__default["default"].createElement(react.Box, { ml: 2 },
15309
- React__default["default"].createElement(Button, { variant: "ghostNeutral", iconName: "close", size: "xs", onClick: onClose }))))));
15334
+ if (buttonProps && !buttonProps.buttonPosition) {
15335
+ buttonProps.buttonPosition = 'topRight';
15336
+ }
15337
+ var AlertWithTitle = function () {
15338
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
15339
+ React__default["default"].createElement(AlertHeader, null,
15340
+ !hideIcon && React__default["default"].createElement(AlertIcon, { status: status, iconProps: iconProps }),
15341
+ React__default["default"].createElement(AlertTitle, { title: title, titleProps: titleProps }),
15342
+ (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonPosition) === 'topRight' && (React__default["default"].createElement(AlertButton, __assign({}, buttonProps, { hasDescription: Boolean(description) }))),
15343
+ !hideCloseButton && React__default["default"].createElement(AlertCloseButton, { onClose: onClose })),
15344
+ React__default["default"].createElement(AlertBody, { hideIcon: hideIcon, hideCloseButton: hideCloseButton },
15345
+ description && React__default["default"].createElement(AlertDescription, { description: description, descriptionProps: descriptionProps }),
15346
+ children,
15347
+ (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonPosition) === 'bottomLeft' && (React__default["default"].createElement(AlertButton, __assign({}, buttonProps, { hasDescription: Boolean(description) }))))));
15348
+ };
15349
+ var AlertWithoutTitle = function () {
15350
+ return (React__default["default"].createElement(react.VStack, { w: "100%", align: "flex-start", justify: "flex-start" },
15351
+ React__default["default"].createElement(AlertHeader, null,
15352
+ !hideIcon && React__default["default"].createElement(AlertIcon, { status: status, iconProps: iconProps }),
15353
+ React__default["default"].createElement(react.Box, { flexGrow: 1 },
15354
+ description && React__default["default"].createElement(AlertDescription, { description: description, descriptionProps: descriptionProps }),
15355
+ children),
15356
+ (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonPosition) === 'topRight' && (React__default["default"].createElement(AlertButton, __assign({}, buttonProps, { hasDescription: Boolean(description) }))),
15357
+ !hideCloseButton && React__default["default"].createElement(AlertCloseButton, { onClose: onClose })),
15358
+ (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonPosition) === 'bottomLeft' && (React__default["default"].createElement(AlertBody, { hideIcon: hideIcon, hideCloseButton: hideCloseButton },
15359
+ React__default["default"].createElement(AlertButton, __assign({}, buttonProps, { hasDescription: Boolean(description) }))))));
15360
+ };
15361
+ return (React__default["default"].createElement(react.Alert, __assign({ flexDirection: "column", align: "flex-start", justify: "flex-start", variant: alertVariant, px: 3, py: 2 }, rest), title ? React__default["default"].createElement(AlertWithTitle, null) : React__default["default"].createElement(AlertWithoutTitle, null)));
15310
15362
  };
15311
15363
 
15312
15364
  var AlertConfig = {
@@ -21737,16 +21789,14 @@ function getToastPlacement(position, dir) {
21737
21789
  }
21738
21790
 
21739
21791
  var Toast = function (props) {
21740
- var _a = props.status, status = _a === void 0 ? 'info' : _a, id = props.id, title = props.title, isClosable = props.isClosable, onClose = props.onClose, description = props.description, buttonTitle = props.buttonTitle, onButtonClick = props.onButtonClick, _b = props.hideIcon, hideIcon = _b === void 0 ? false : _b;
21741
- var buttonProps = { onClick: onButtonClick };
21792
+ props.position; props.duration; var id = props.id; props.onCloseComplete; props.containerStyle; var rest = __rest(props, ["position", "duration", "id", "onCloseComplete", "containerStyle"]);
21742
21793
  return (React__namespace.createElement(react.DarkMode, null,
21743
- React__namespace.createElement(Alert, { id: id, alertTitle: title, buttonTitle: buttonTitle, description: description, showIcon: !hideIcon, status: status, showCloseButton: isClosable, onClose: onClose, variant: DarkStatusVariantMap[status], showButton: !!onButtonClick && !!buttonTitle, buttonProps: buttonProps })));
21794
+ React__namespace.createElement(Alert, __assign({ id: id }, rest))));
21744
21795
  };
21745
21796
  var defaults = {
21746
21797
  title: '',
21747
21798
  duration: 5000,
21748
21799
  position: 'top',
21749
- isClosable: true,
21750
21800
  };
21751
21801
  var defaultStandaloneParam = {
21752
21802
  theme: theme$1,