@televet/kibble-ui 5.1.1 → 5.3.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/AGENTS.md +4 -1
- package/dist/chunks/alert.component-1-RhljlT.js +2 -0
- package/dist/chunks/alert.component-1-RhljlT.js.map +1 -0
- package/dist/chunks/alert.component-ByJCotaH.js +149 -0
- package/dist/chunks/alert.component-ByJCotaH.js.map +1 -0
- package/dist/chunks/card.component-DegvL21w.js +57 -0
- package/dist/chunks/card.component-DegvL21w.js.map +1 -0
- package/dist/chunks/card.component-Z7HRGxC4.js +2 -0
- package/dist/chunks/card.component-Z7HRGxC4.js.map +1 -0
- package/dist/chunks/{conversationCard.component-sKlfIP1V.js → conversationCard.component-CjeOO2L3.js} +3 -3
- package/dist/chunks/{conversationCard.component-sKlfIP1V.js.map → conversationCard.component-CjeOO2L3.js.map} +1 -1
- package/dist/chunks/{conversationCard.component-CXEHIrKJ.js → conversationCard.component-ESYyuGvU.js} +2 -2
- package/dist/chunks/{conversationCard.component-CXEHIrKJ.js.map → conversationCard.component-ESYyuGvU.js.map} +1 -1
- package/dist/chunks/{maintenanceBanner.types-CfHYj6Nu.js → maintenanceBanner.types-CPr8G6Hj.js} +2 -2
- package/dist/chunks/{maintenanceBanner.types-CfHYj6Nu.js.map → maintenanceBanner.types-CPr8G6Hj.js.map} +1 -1
- package/dist/chunks/{maintenanceBanner.types-Bey20P0-.js → maintenanceBanner.types-bwnay-jL.js} +2 -2
- package/dist/chunks/{maintenanceBanner.types-Bey20P0-.js.map → maintenanceBanner.types-bwnay-jL.js.map} +1 -1
- package/dist/chunks/{notificationCounter.component-BUxWlpKh.js → notificationCounter.component-Cmpqouio.js} +2 -2
- package/dist/chunks/notificationCounter.component-Cmpqouio.js.map +1 -0
- package/dist/chunks/{notificationCounter.component-DikPb9gS.js → notificationCounter.component-kKVMY1AR.js} +9 -7
- package/dist/chunks/notificationCounter.component-kKVMY1AR.js.map +1 -0
- package/dist/chunks/{tab.types-CxSmEPw0.js → tab.types-C3Si454B.js} +2 -2
- package/dist/chunks/{tab.types-CxSmEPw0.js.map → tab.types-C3Si454B.js.map} +1 -1
- package/dist/chunks/{tab.types-C33sw4x5.js → tab.types-CBEczQus.js} +2 -2
- package/dist/chunks/{tab.types-C33sw4x5.js.map → tab.types-CBEczQus.js.map} +1 -1
- package/dist/chunks/{theme.provider-D_0Xfv0Z.js → theme.provider-CO6PM6Lp.js} +54 -14
- package/dist/chunks/{theme.provider-D_0Xfv0Z.js.map → theme.provider-CO6PM6Lp.js.map} +1 -1
- package/dist/chunks/{theme.provider-BX40Kz1f.js → theme.provider-CnANijP7.js} +388 -348
- package/dist/chunks/{theme.provider-BX40Kz1f.js.map → theme.provider-CnANijP7.js.map} +1 -1
- package/dist/cjs/components/Alert/index.cjs +1 -1
- package/dist/cjs/components/Card/index.cjs +1 -1
- package/dist/cjs/components/ConversationCard/index.cjs +1 -1
- package/dist/cjs/components/MaintenanceBanner/index.cjs +1 -1
- package/dist/cjs/components/NotificationCounter/index.cjs +1 -1
- package/dist/cjs/components/Tabs/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/theme/index.cjs +1 -1
- package/dist/cjs/theme/tokens/typography/index.cjs +1 -1
- package/dist/cjs/theme/tokens/typography/index.cjs.map +1 -1
- package/dist/components.json +11 -3
- package/dist/esm/components/Alert/index.js +1 -1
- package/dist/esm/components/Card/index.js +1 -1
- package/dist/esm/components/ConversationCard/index.js +1 -1
- package/dist/esm/components/MaintenanceBanner/index.js +1 -1
- package/dist/esm/components/NotificationCounter/index.js +1 -1
- package/dist/esm/components/Tabs/index.js +1 -1
- package/dist/esm/components/index.js +6 -6
- package/dist/esm/index.js +7 -7
- package/dist/esm/theme/index.js +1 -1
- package/dist/esm/theme/tokens/typography/index.js +6 -6
- package/dist/esm/theme/tokens/typography/index.js.map +1 -1
- package/dist/types/components/Card/card.component.d.ts +6 -10
- package/package.json +1 -1
- package/dist/chunks/alert.component-B0gDwaKQ.js +0 -2
- package/dist/chunks/alert.component-B0gDwaKQ.js.map +0 -1
- package/dist/chunks/alert.component-DjFZO6Ks.js +0 -141
- package/dist/chunks/alert.component-DjFZO6Ks.js.map +0 -1
- package/dist/chunks/card.component-B1AznjWF.js +0 -55
- package/dist/chunks/card.component-B1AznjWF.js.map +0 -1
- package/dist/chunks/card.component-BmBiYbMV.js +0 -2
- package/dist/chunks/card.component-BmBiYbMV.js.map +0 -1
- package/dist/chunks/notificationCounter.component-BUxWlpKh.js.map +0 -1
- package/dist/chunks/notificationCounter.component-DikPb9gS.js.map +0 -1
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import y, { forwardRef as C, Fragment as N } from "react";
|
|
3
|
-
import { W as w } from "./heading.component-D8oRhIr6.js";
|
|
4
|
-
import { I as S } from "./icon.component-PV_nHBId.js";
|
|
5
|
-
import { W } from "./text.component-DbJw4Y9-.js";
|
|
6
|
-
import { B as j } from "./button.component-BO6oee_V.js";
|
|
7
|
-
import { F as A } from "./flex-CX-8gE9T.js";
|
|
8
|
-
import { StatusIconMap as k, StatusTypographyMap as B } from "../esm/shared/records/index.js";
|
|
9
|
-
import { c as I } from "./provider-ClCAdPxy.js";
|
|
10
|
-
import { c as z } from "./create-slot-recipe-context-D_FXDJGp.js";
|
|
11
|
-
import { c as $ } from "./factory-BQshv7_b.js";
|
|
12
|
-
import { I as u, W as g, C as F } from "./icons-CEVtpQAi.js";
|
|
13
|
-
const [M, D] = I({
|
|
14
|
-
name: "AlertStatusContext",
|
|
15
|
-
hookName: "useAlertStatusContext",
|
|
16
|
-
providerName: "<Alert />"
|
|
17
|
-
}), {
|
|
18
|
-
withProvider: E,
|
|
19
|
-
withContext: p,
|
|
20
|
-
useStyles: b
|
|
21
|
-
} = z({ key: "alert" }), H = E(
|
|
22
|
-
"div",
|
|
23
|
-
"root",
|
|
24
|
-
{
|
|
25
|
-
forwardAsChild: !0,
|
|
26
|
-
wrapElement(t, s) {
|
|
27
|
-
return (
|
|
28
|
-
// @ts-ignore fix later
|
|
29
|
-
/* @__PURE__ */ e.jsx(M, { value: { status: s.status || "info" }, children: t })
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
), T = p(
|
|
34
|
-
"div",
|
|
35
|
-
"title"
|
|
36
|
-
), q = p("div", "description"), G = p(
|
|
37
|
-
"div",
|
|
38
|
-
"content"
|
|
39
|
-
), J = {
|
|
40
|
-
info: u,
|
|
41
|
-
warning: g,
|
|
42
|
-
success: F,
|
|
43
|
-
error: g,
|
|
44
|
-
neutral: u
|
|
45
|
-
}, K = C(
|
|
46
|
-
function(s, c) {
|
|
47
|
-
const r = D(), a = b(), l = typeof r.status == "string" ? J[r.status] : N, { children: m = /* @__PURE__ */ e.jsx(l, {}), ...i } = s;
|
|
48
|
-
return /* @__PURE__ */ e.jsx($.span, { ref: c, ...i, css: [a.indicator, s.css], children: m });
|
|
49
|
-
}
|
|
50
|
-
), f = ({
|
|
51
|
-
buttonPosition: t = "topRight",
|
|
52
|
-
buttonText: s,
|
|
53
|
-
status: c,
|
|
54
|
-
["data-testid"]: r = "kibble-alert-button",
|
|
55
|
-
...a
|
|
56
|
-
}) => /* @__PURE__ */ e.jsx(
|
|
57
|
-
A,
|
|
58
|
-
{
|
|
59
|
-
className: "Alert__Button",
|
|
60
|
-
"data-testid": r,
|
|
61
|
-
...t !== "topRight" && { pt: 2, pb: 1 },
|
|
62
|
-
...t === "bottomRight" && { justifyContent: "flex-end" },
|
|
63
|
-
children: /* @__PURE__ */ e.jsx(j, { size: "xs", variant: c === "default" ? "primary" : "secondary", w: "max-content", ...a, children: s })
|
|
64
|
-
}
|
|
65
|
-
), it = ({
|
|
66
|
-
buttonProps: t,
|
|
67
|
-
description: s,
|
|
68
|
-
descriptionProps: c,
|
|
69
|
-
hideCloseButton: r = !1,
|
|
70
|
-
hideIcon: a = !1,
|
|
71
|
-
iconProps: l,
|
|
72
|
-
onClose: m,
|
|
73
|
-
onContrast: i = !1,
|
|
74
|
-
status: n = "success",
|
|
75
|
-
title: d,
|
|
76
|
-
titleProps: v,
|
|
77
|
-
closeButtonIcon: R = "close",
|
|
78
|
-
["data-testid"]: o = "kibble-alert",
|
|
79
|
-
..._
|
|
80
|
-
}) => {
|
|
81
|
-
t && !t.buttonPosition && (t.buttonPosition = "topRight");
|
|
82
|
-
const x = t && t.buttonPosition === "topRight", h = x ? A : y.Fragment;
|
|
83
|
-
return /* @__PURE__ */ e.jsxs(
|
|
84
|
-
H,
|
|
85
|
-
{
|
|
86
|
-
className: "Alert",
|
|
87
|
-
"data-testid": o,
|
|
88
|
-
..._,
|
|
89
|
-
variant: n,
|
|
90
|
-
hideIcon: a,
|
|
91
|
-
onContrast: i,
|
|
92
|
-
children: [
|
|
93
|
-
!a && /* @__PURE__ */ e.jsx(K, { className: "Alert__Icon", "data-testid": `${o}-icon`, children: /* @__PURE__ */ e.jsx(
|
|
94
|
-
S,
|
|
95
|
-
{
|
|
96
|
-
variant: i ? "onContrast" : B[n],
|
|
97
|
-
name: l?.name || k[n],
|
|
98
|
-
size: "lg",
|
|
99
|
-
...l
|
|
100
|
-
}
|
|
101
|
-
) }),
|
|
102
|
-
/* @__PURE__ */ e.jsxs(G, { className: "Alert__Content", "data-testid": `${o}-content`, children: [
|
|
103
|
-
d && /* @__PURE__ */ e.jsxs(
|
|
104
|
-
h,
|
|
105
|
-
{
|
|
106
|
-
...x && {
|
|
107
|
-
justifyContent: "space-between",
|
|
108
|
-
gap: 2
|
|
109
|
-
},
|
|
110
|
-
children: [
|
|
111
|
-
/* @__PURE__ */ e.jsx(T, { className: "Alert__Title", "data-testid": `${o}-title`, children: /* @__PURE__ */ e.jsx(w, { size: "sm", variant: i ? "onContrast" : "default", ...v, children: d }) }),
|
|
112
|
-
t && t.buttonPosition === "topRight" && /* @__PURE__ */ e.jsx(f, { status: n, onContrast: i, ...t })
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
s && /* @__PURE__ */ e.jsxs(h, { ...x && { justifyContent: "space-between" }, children: [
|
|
117
|
-
/* @__PURE__ */ e.jsx(q, { className: "Alert__Description", "data-testid": `${o}-description`, children: typeof s == "string" ? /* @__PURE__ */ e.jsx(W, { size: "md", variant: i ? "onContrast" : "default", ...c, children: s }) : s }),
|
|
118
|
-
t && t.buttonPosition === "topRight" && !d && /* @__PURE__ */ e.jsx(f, { status: n, onContrast: i, ...t })
|
|
119
|
-
] }),
|
|
120
|
-
t && t?.buttonPosition !== "topRight" && /* @__PURE__ */ e.jsx(f, { status: n, onContrast: i, ...t })
|
|
121
|
-
] }),
|
|
122
|
-
!r && /* @__PURE__ */ e.jsx(
|
|
123
|
-
j,
|
|
124
|
-
{
|
|
125
|
-
className: "Alert__CloseTrigger",
|
|
126
|
-
"data-testid": `${o}-close-trigger`,
|
|
127
|
-
iconName: R,
|
|
128
|
-
size: "xs",
|
|
129
|
-
variant: "ghostNeutral",
|
|
130
|
-
onContrast: i,
|
|
131
|
-
onClick: m
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
export {
|
|
139
|
-
it as A
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=alert.component-DjFZO6Ks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alert.component-DjFZO6Ks.js","sources":["../../node_modules/@chakra-ui/react/dist/esm/components/alert/alert.js","../../src/components/Alert/components/AlertButton/alertButton.component.tsx","../../src/components/Alert/alert.component.tsx"],"sourcesContent":["\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef, Fragment } from 'react';\nimport { createContext } from '../../create-context.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { InfoIcon, WarningIcon, CheckCircleIcon } from '../icons.js';\n\nconst [AlertStatusProvider, useAlertStatusContext] = createContext({\n name: \"AlertStatusContext\",\n hookName: \"useAlertStatusContext\",\n providerName: \"<Alert />\"\n});\nconst {\n withProvider,\n withContext,\n useStyles: useAlertStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"alert\" });\nconst AlertRoot = withProvider(\n \"div\",\n \"root\",\n {\n forwardAsChild: true,\n wrapElement(element, props) {\n return (\n // @ts-ignore fix later\n /* @__PURE__ */ jsx(AlertStatusProvider, { value: { status: props.status || \"info\" }, children: element })\n );\n }\n }\n);\nconst AlertPropsProvider = PropsProvider;\nconst AlertTitle = withContext(\n \"div\",\n \"title\"\n);\nconst AlertDescription = withContext(\"div\", \"description\");\nconst AlertContent = withContext(\n \"div\",\n \"content\"\n);\nconst iconMap = {\n info: InfoIcon,\n warning: WarningIcon,\n success: CheckCircleIcon,\n error: WarningIcon,\n neutral: InfoIcon\n};\nconst AlertIndicator = forwardRef(\n function AlertIndicator2(props, ref) {\n const api = useAlertStatusContext();\n const styles = useAlertStyles();\n const Icon = typeof api.status === \"string\" ? iconMap[api.status] : Fragment;\n const { children = /* @__PURE__ */ jsx(Icon, {}), ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, ...rest, css: [styles.indicator, props.css], children });\n }\n);\n\nexport { AlertContent, AlertDescription, AlertIndicator, AlertPropsProvider, AlertRoot, AlertStatusProvider, AlertTitle, useAlertStatusContext, useAlertStyles };\n","import React from 'react';\nimport { AlertButtonPosition } from 'components/Alert/alert.types';\nimport { Button, ButtonProps } from 'components/Button/button.component';\nimport { Status } from 'shared/types/status';\nimport { Flex } from '@chakra-ui/react/flex';\n\nexport interface AlertButtonProps extends Omit<ButtonProps, 'children'> {\n /** Position of the button.\n * @default topRight\n */\n buttonPosition?: AlertButtonPosition;\n /** Text to display in the button. */\n buttonText: string;\n /** Data test id for the button.\n * @default kibble-alert-button\n */\n 'data-testid'?: string;\n}\n\ninterface InternalAlertButtonProps extends AlertButtonProps {\n /** Status of the alert.\n * @internal\n */\n status: Status;\n}\n\nexport const AlertButton = ({\n buttonPosition = 'topRight',\n buttonText,\n status,\n ['data-testid']: dataTestId = 'kibble-alert-button',\n ...rest\n}: InternalAlertButtonProps): React.JSX.Element => {\n return (\n <Flex\n className=\"Alert__Button\"\n data-testid={dataTestId}\n {...(buttonPosition !== 'topRight' && { pt: 2, pb: 1 })}\n {...(buttonPosition === 'bottomRight' && { justifyContent: 'flex-end' })}\n >\n <Button size=\"xs\" variant={status === 'default' ? 'primary' : 'secondary'} w=\"max-content\" {...rest}>\n {buttonText}\n </Button>\n </Flex>\n );\n};\n","import React from 'react';\nimport { Alert as CAlert } from '@chakra-ui/react/alert';\nimport { Heading, HeadingProps } from 'components/Heading/heading.component';\nimport { Icon, IconProps } from 'components/Icon/icon.component';\nimport { Text, TextProps } from 'components/Text/text.component';\nimport { Status } from 'shared/types/status';\nimport { Button } from 'components/Button/button.component';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { AlertButton, AlertButtonProps } from './components/AlertButton/alertButton.component';\nimport { StatusIconMap, StatusTypographyMap } from 'shared/records/status';\nimport { IconName } from 'components/Icon/icon.types';\n\nexport interface AlertProps extends Omit<CAlert.RootProps, 'title' | 'status' | 'children' | 'variant' | 'size'> {\n /** Props to customize the alert button. */\n buttonProps?: AlertButtonProps;\n /** The body of the alert */\n description?: React.ReactNode;\n /** Props to customize the description when passed as a string. */\n descriptionProps?: TextProps;\n /**\n * If true, the close button will not be displayed.\n * @default false\n */\n hideCloseButton?: boolean;\n /**\n * If true, the icon will not be displayed.\n * @default false\n */\n hideIcon?: boolean;\n /** Props to customize the icon. */\n iconProps?: IconProps;\n /** Callback function to be called when the close button is clicked. */\n onClose?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * If true, the alert will use a contrasting variant according to the selected status.\n * @default false\n */\n onContrast?: boolean;\n /**\n * The status of the alert. Determines the color of the alert.\n * @default success\n */\n status?: Status;\n /** The title of the alert. */\n title?: React.ReactNode;\n /** Props to customize the title when passed as a string. */\n titleProps?: HeadingProps;\n /** The name of the icon to be used as the close button. */\n closeButtonIcon?: IconName;\n /** Data test id for the alert.\n * @default kibble-alert\n */\n 'data-testid'?: string;\n}\n\nexport const Alert = ({\n buttonProps,\n description,\n descriptionProps,\n hideCloseButton = false,\n hideIcon = false,\n iconProps,\n onClose,\n onContrast = false,\n status = 'success',\n title,\n titleProps,\n closeButtonIcon = 'close',\n ['data-testid']: dataTestId = 'kibble-alert',\n ...rest\n}: AlertProps): React.JSX.Element => {\n if (buttonProps && !buttonProps.buttonPosition) {\n buttonProps.buttonPosition = 'topRight';\n }\n const isTopRightButton = buttonProps && buttonProps.buttonPosition === 'topRight';\n const WithButtonWrapper = isTopRightButton ? Flex : React.Fragment;\n\n return (\n <CAlert.Root\n className=\"Alert\"\n data-testid={dataTestId}\n {...rest}\n variant={status}\n hideIcon={hideIcon}\n onContrast={onContrast}\n >\n {!hideIcon && (\n <CAlert.Indicator className=\"Alert__Icon\" data-testid={`${dataTestId}-icon`}>\n <Icon\n variant={onContrast ? 'onContrast' : StatusTypographyMap[status]}\n name={iconProps?.name || StatusIconMap[status]}\n size=\"lg\"\n {...iconProps}\n />\n </CAlert.Indicator>\n )}\n <CAlert.Content className=\"Alert__Content\" data-testid={`${dataTestId}-content`}>\n {title && (\n <WithButtonWrapper\n {...(isTopRightButton && {\n justifyContent: 'space-between',\n gap: 2,\n })}\n >\n <CAlert.Title className=\"Alert__Title\" data-testid={`${dataTestId}-title`}>\n <Heading size=\"sm\" variant={onContrast ? 'onContrast' : 'default'} {...titleProps}>\n {title}\n </Heading>\n </CAlert.Title>\n {buttonProps && buttonProps.buttonPosition === 'topRight' && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </WithButtonWrapper>\n )}\n {description && (\n <WithButtonWrapper {...(isTopRightButton && { justifyContent: 'space-between' })}>\n <CAlert.Description className=\"Alert__Description\" data-testid={`${dataTestId}-description`}>\n {typeof description === 'string' ? (\n <Text size=\"md\" variant={onContrast ? 'onContrast' : 'default'} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </CAlert.Description>\n {buttonProps && buttonProps.buttonPosition === 'topRight' && !title && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </WithButtonWrapper>\n )}\n {buttonProps && buttonProps?.buttonPosition !== 'topRight' && (\n <AlertButton status={status} onContrast={onContrast} {...buttonProps} />\n )}\n </CAlert.Content>\n {!hideCloseButton && (\n <Button\n className=\"Alert__CloseTrigger\"\n data-testid={`${dataTestId}-close-trigger`}\n iconName={closeButtonIcon}\n size=\"xs\"\n variant=\"ghostNeutral\"\n onContrast={onContrast}\n onClick={onClose}\n />\n )}\n </CAlert.Root>\n );\n};\n"],"names":["AlertStatusProvider","useAlertStatusContext","createContext","withProvider","withContext","useAlertStyles","createSlotRecipeContext","AlertRoot","element","props","jsx","AlertTitle","AlertDescription","AlertContent","iconMap","InfoIcon","WarningIcon","CheckCircleIcon","AlertIndicator","forwardRef","ref","api","styles","Icon","Fragment","children","rest","chakra","AlertButton","buttonPosition","buttonText","status","dataTestId","Flex","Button","Alert","buttonProps","description","descriptionProps","hideCloseButton","hideIcon","iconProps","onClose","onContrast","title","titleProps","closeButtonIcon","isTopRightButton","WithButtonWrapper","React","jsxs","CAlert.Root","CAlert.Indicator","StatusTypographyMap","StatusIconMap","CAlert.Content","CAlert.Title","Heading","CAlert.Description","Text"],"mappings":";;;;;;;;;;;;AASA,MAAM,CAACA,GAAqBC,CAAqB,IAAIC,EAAc;AAAA,EACjE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GACK;AAAA,EACJ,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAWC;AAEb,IAAIC,EAAwB,EAAE,KAAK,QAAO,CAAE,GACtCC,IAAYJ;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,IACE,gBAAg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,QAAA;AAAA,MACX;AAAA,IAAA;AAAA,EAEJ;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { j as l } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import { B as m } from "./index-9BerxEcw.js";
|
|
3
|
-
const x = {
|
|
4
|
-
lg: 7,
|
|
5
|
-
md: 5,
|
|
6
|
-
sm: 3,
|
|
7
|
-
xs: 2
|
|
8
|
-
}, g = ({
|
|
9
|
-
active: a = !1,
|
|
10
|
-
fullWidth: e = !0,
|
|
11
|
-
interactive: o = !1,
|
|
12
|
-
invalid: d = !1,
|
|
13
|
-
onClick: s,
|
|
14
|
-
onContrast: r = !1,
|
|
15
|
-
size: t = "md",
|
|
16
|
-
children: b,
|
|
17
|
-
["data-testid"]: i = "kibble-card",
|
|
18
|
-
...n
|
|
19
|
-
}) => /* @__PURE__ */ l.jsx(
|
|
20
|
-
m,
|
|
21
|
-
{
|
|
22
|
-
className: "Card",
|
|
23
|
-
"data-testid": i,
|
|
24
|
-
bg: r ? "background.contrast" : "background",
|
|
25
|
-
p: x[t],
|
|
26
|
-
border: "1px",
|
|
27
|
-
borderColor: r ? "border.contrast" : "border",
|
|
28
|
-
borderRadius: "lg",
|
|
29
|
-
...d && { "aria-invalid": !0 },
|
|
30
|
-
...o && {
|
|
31
|
-
borderColor: {
|
|
32
|
-
base: `${a ? "transparent" : r ? "border.contrast" : "border"}`,
|
|
33
|
-
_invalid: `${r ? "border.danger.contrast" : "border.danger"}`
|
|
34
|
-
},
|
|
35
|
-
boxShadow: {
|
|
36
|
-
base: `${a ? r ? "active.contrast" : "active" : "none"}`,
|
|
37
|
-
...!a && {
|
|
38
|
-
_hover: r ? "hover.contrast" : "hover"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
cursor: "pointer",
|
|
42
|
-
transition: ".1s all ease-in-out"
|
|
43
|
-
},
|
|
44
|
-
...e ? { w: "100%" } : { maxW: "max-content" },
|
|
45
|
-
onClick: (c) => {
|
|
46
|
-
s?.(c);
|
|
47
|
-
},
|
|
48
|
-
...n,
|
|
49
|
-
children: b
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
export {
|
|
53
|
-
g as C
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=card.component-B1AznjWF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.component-B1AznjWF.js","sources":["../../src/components/Card/card.records.ts","../../src/components/Card/card.component.tsx"],"sourcesContent":["import { CardSize } from './card.types';\n\nexport const CardPaddingMap: Record<CardSize, number> = {\n lg: 7,\n md: 5,\n sm: 3,\n xs: 2,\n};\n","import React from 'react';\nimport { Box, BoxProps } from '@chakra-ui/react/box';\nimport { CardSize } from './card.types';\nimport { CardPaddingMap } from './card.records';\n\nexport interface BaseCardProps {\n /**\n * If `false`, the max width will be set to `max-content` and will not take up the full width of the parent.\n * @default true\n */\n fullWidth?: boolean;\n /**\n * If `true`, the card will use a contrasting variant.\n * @default false\n */\n onContrast?: boolean;\n /**\n * Size of the card. This mostly determines the amount of padding around the inside edge of the card.\n * @default md\n */\n size?: CardSize;\n /** Data test id for the card.\n * @default kibble-card\n */\n 'data-testid'?: string;\n}\n\nexport interface DefaultCardProps extends BaseCardProps {\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, a blue 2px box shadow will be present around the card.\n * @default false\n */\n active?: never;\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, the card will be styled with a red border.\n * @default false\n */\n invalid?: never;\n /**\n * If `true`, the card will have hover and active states, and will use the pointer cursor. If setting this value you can also pass the `active` prop to triggr the cards active state.\n * @default false\n */\n interactive?: false;\n}\n\nexport interface InteractiveCardProps extends BaseCardProps {\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, a blue 2px box shadow will be present around the card.\n * @default false\n */\n active?: boolean;\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, the card will be styled with a red border.\n * @default false\n */\n invalid?: boolean;\n /**\n * If `true`, the card will have hover and active states, and will use the pointer cursor. If setting this value you can also pass the `active` prop to triggr the cards active state.\n * @default false\n */\n interactive?: true;\n}\n\nexport type KCardProps = InteractiveCardProps | DefaultCardProps;\n\nexport type CardProps = KCardProps & BoxProps;\n\nexport const Card = ({\n active = false,\n fullWidth = true,\n interactive = false,\n invalid = false,\n onClick,\n onContrast = false,\n size = 'md',\n children,\n ['data-testid']: dataTestId = 'kibble-card',\n ...rest\n}: CardProps): React.JSX.Element => {\n return (\n <Box\n className=\"Card\"\n data-testid={dataTestId}\n bg={onContrast ? 'background.contrast' : 'background'}\n p={CardPaddingMap[size]}\n border=\"1px\"\n borderColor={onContrast ? 'border.contrast' : 'border'}\n borderRadius=\"lg\"\n {...(invalid && { 'aria-invalid': true })}\n {...(interactive && {\n borderColor: {\n base: `${active ? 'transparent' : onContrast ? 'border.contrast' : 'border'}`,\n _invalid: `${onContrast ? 'border.danger.contrast' : 'border.danger'}`,\n },\n boxShadow: {\n base: `${active ? (onContrast ? 'active.contrast' : 'active') : 'none'}`,\n ...(!active && {\n _hover: onContrast ? 'hover.contrast' : 'hover',\n }),\n },\n cursor: 'pointer',\n transition: '.1s all ease-in-out',\n })}\n {...(!fullWidth ? { maxW: 'max-content' } : { w: '100%' })}\n onClick={(e) => {\n onClick?.(e);\n }}\n {...rest}\n >\n {children}\n </Box>\n );\n};\n"],"names":["CardPaddingMap","Card","active","fullWidth","interactive","invalid","onClick","onContrast","size","children","dataTestId","rest","jsx","Box","e"],"mappings":";;AAEO,MAAMA,IAA2C;AAAA,EACtD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GC4DaC,IAAO,CAAC;AAAA,EACnB,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,aAAAC,IAAc;AAAA,EACd,SAAAC,IAAU;AAAA,EACV,SAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,CAAC,gBAAgBC,IAAa;AAAA,EAC9B,GAAGC;AACL,MAEIC,gBAAAA,EAAA;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,eAAaH;AAAA,IACb,IAAIH,IAAa,wBAAwB;AAAA,IACzC,GAAGP,EAAeQ,CAAI;AAAA,IACtB,QAAO;AAAA,IACP,aAAaD,IAAa,oBAAoB;AAAA,IAC9C,cAAa;AAAA,IACZ,GAAIF,KAAW,EAAE,gBAAgB,GAAK;AAAA,IACtC,GAAID,KAAe;AAAA,MAClB,aAAa;AAAA,QACX,MAAM,GAAGF,IAAS,gBAAgBK,IAAa,oBAAoB,QAAQ;AAAA,QAC3E,UAAU,GAAGA,IAAa,2BAA2B,eAAe;AAAA,MACtE;AAAA,MACA,WAAW;AAAA,QACT,MAAM,GAAGL,IAAUK,IAAa,oBAAoB,WAAY,MAAM;AAAA,QACtE,GAAI,CAACL,KAAU;AAAA,UACb,QAAQK,IAAa,mBAAmB;AAAA,QAAA;AAAA,MAE5C;AAAA,MACA,QAAQ;AAAA,MACR,YAAY;AAAA,IACd;AAAA,IACC,GAAKJ,IAAsC,EAAE,GAAG,OAAO,IAAtC,EAAE,MAAM,cAAc;AAAA,IACxC,SAAS,CAACW,MAAM;AACd,MAAAR,IAAUQ,CAAC;AAAA,IACb;AAAA,IACC,GAAGH;AAAA,IAEH,UAAAF;AAAA,EAAA;AACH;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("./jsx-runtime-BjDatQAs.js"),u=require("./index-BQRnVsAg.js"),x={lg:7,md:5,sm:3,xs:2},g=({active:e=!1,fullWidth:a=!0,interactive:d=!1,invalid:o=!1,onClick:s,onContrast:r=!1,size:t="md",children:n,["data-testid"]:i="kibble-card",...b})=>l.jsxRuntimeExports.jsx(u.Box,{className:"Card","data-testid":i,bg:r?"background.contrast":"background",p:x[t],border:"1px",borderColor:r?"border.contrast":"border",borderRadius:"lg",...o&&{"aria-invalid":!0},...d&&{borderColor:{base:`${e?"transparent":r?"border.contrast":"border"}`,_invalid:`${r?"border.danger.contrast":"border.danger"}`},boxShadow:{base:`${e?r?"active.contrast":"active":"none"}`,...!e&&{_hover:r?"hover.contrast":"hover"}},cursor:"pointer",transition:".1s all ease-in-out"},...a?{w:"100%"}:{maxW:"max-content"},onClick:c=>{s?.(c)},...b,children:n});exports.Card=g;
|
|
2
|
-
//# sourceMappingURL=card.component-BmBiYbMV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.component-BmBiYbMV.js","sources":["../../src/components/Card/card.records.ts","../../src/components/Card/card.component.tsx"],"sourcesContent":["import { CardSize } from './card.types';\n\nexport const CardPaddingMap: Record<CardSize, number> = {\n lg: 7,\n md: 5,\n sm: 3,\n xs: 2,\n};\n","import React from 'react';\nimport { Box, BoxProps } from '@chakra-ui/react/box';\nimport { CardSize } from './card.types';\nimport { CardPaddingMap } from './card.records';\n\nexport interface BaseCardProps {\n /**\n * If `false`, the max width will be set to `max-content` and will not take up the full width of the parent.\n * @default true\n */\n fullWidth?: boolean;\n /**\n * If `true`, the card will use a contrasting variant.\n * @default false\n */\n onContrast?: boolean;\n /**\n * Size of the card. This mostly determines the amount of padding around the inside edge of the card.\n * @default md\n */\n size?: CardSize;\n /** Data test id for the card.\n * @default kibble-card\n */\n 'data-testid'?: string;\n}\n\nexport interface DefaultCardProps extends BaseCardProps {\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, a blue 2px box shadow will be present around the card.\n * @default false\n */\n active?: never;\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, the card will be styled with a red border.\n * @default false\n */\n invalid?: never;\n /**\n * If `true`, the card will have hover and active states, and will use the pointer cursor. If setting this value you can also pass the `active` prop to triggr the cards active state.\n * @default false\n */\n interactive?: false;\n}\n\nexport interface InteractiveCardProps extends BaseCardProps {\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, a blue 2px box shadow will be present around the card.\n * @default false\n */\n active?: boolean;\n /**\n * *Only applicable when the `interactive` prop is `true`. If `true`, the card will be styled with a red border.\n * @default false\n */\n invalid?: boolean;\n /**\n * If `true`, the card will have hover and active states, and will use the pointer cursor. If setting this value you can also pass the `active` prop to triggr the cards active state.\n * @default false\n */\n interactive?: true;\n}\n\nexport type KCardProps = InteractiveCardProps | DefaultCardProps;\n\nexport type CardProps = KCardProps & BoxProps;\n\nexport const Card = ({\n active = false,\n fullWidth = true,\n interactive = false,\n invalid = false,\n onClick,\n onContrast = false,\n size = 'md',\n children,\n ['data-testid']: dataTestId = 'kibble-card',\n ...rest\n}: CardProps): React.JSX.Element => {\n return (\n <Box\n className=\"Card\"\n data-testid={dataTestId}\n bg={onContrast ? 'background.contrast' : 'background'}\n p={CardPaddingMap[size]}\n border=\"1px\"\n borderColor={onContrast ? 'border.contrast' : 'border'}\n borderRadius=\"lg\"\n {...(invalid && { 'aria-invalid': true })}\n {...(interactive && {\n borderColor: {\n base: `${active ? 'transparent' : onContrast ? 'border.contrast' : 'border'}`,\n _invalid: `${onContrast ? 'border.danger.contrast' : 'border.danger'}`,\n },\n boxShadow: {\n base: `${active ? (onContrast ? 'active.contrast' : 'active') : 'none'}`,\n ...(!active && {\n _hover: onContrast ? 'hover.contrast' : 'hover',\n }),\n },\n cursor: 'pointer',\n transition: '.1s all ease-in-out',\n })}\n {...(!fullWidth ? { maxW: 'max-content' } : { w: '100%' })}\n onClick={(e) => {\n onClick?.(e);\n }}\n {...rest}\n >\n {children}\n </Box>\n );\n};\n"],"names":["CardPaddingMap","Card","active","fullWidth","interactive","invalid","onClick","onContrast","size","children","dataTestId","rest","jsx","Box","e"],"mappings":"2FAEaA,EAA2C,CACtD,GAAI,EACJ,GAAI,EACJ,GAAI,EACJ,GAAI,CACN,EC4DaC,EAAO,CAAC,CACnB,OAAAC,EAAS,GACT,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,QAAAC,EAAU,GACV,QAAAC,EACA,WAAAC,EAAa,GACb,KAAAC,EAAO,KACP,SAAAC,EACA,CAAC,eAAgBC,EAAa,cAC9B,GAAGC,CACL,IAEIC,EAAA,kBAAA,IAACC,EAAA,IAAA,CACC,UAAU,OACV,cAAaH,EACb,GAAIH,EAAa,sBAAwB,aACzC,EAAGP,EAAeQ,CAAI,EACtB,OAAO,MACP,YAAaD,EAAa,kBAAoB,SAC9C,aAAa,KACZ,GAAIF,GAAW,CAAE,eAAgB,EAAK,EACtC,GAAID,GAAe,CAClB,YAAa,CACX,KAAM,GAAGF,EAAS,cAAgBK,EAAa,kBAAoB,QAAQ,GAC3E,SAAU,GAAGA,EAAa,yBAA2B,eAAe,EACtE,EACA,UAAW,CACT,KAAM,GAAGL,EAAUK,EAAa,kBAAoB,SAAY,MAAM,GACtE,GAAI,CAACL,GAAU,CACb,OAAQK,EAAa,iBAAmB,OAAA,CAE5C,EACA,OAAQ,UACR,WAAY,qBACd,EACC,GAAKJ,EAAsC,CAAE,EAAG,MAAO,EAAtC,CAAE,KAAM,aAAc,EACxC,QAAUW,GAAM,CACdR,IAAUQ,CAAC,CACb,EACC,GAAGH,EAEH,SAAAF,CAAA,CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notificationCounter.component-BUxWlpKh.js","sources":["../../src/components/NotificationCounter/notificationCounter.recipe.ts","../../src/components/NotificationCounter/notificationCounter.records.ts","../../src/components/NotificationCounter/notificationCounter.component.tsx"],"sourcesContent":["import { defineSlotRecipe, SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { NotificationCounterSize, NotificationCounterVariant } from './notificationCounter.types';\n\nconst notificationCounterSlots = ['root', 'maxElement'] as const;\ntype NotificationCounterSlot = (typeof notificationCounterSlots)[number];\n\nconst notificationCounterVariantStyles: Record<\n NotificationCounterVariant,\n Record<NotificationCounterSlot, SystemStyleObject>\n> = {\n blue: {\n root: {\n bgColor: 'background.accent',\n color: 'text.contrast',\n },\n maxElement: {\n bgColor: 'text.contrast',\n },\n },\n green: {\n root: {\n bgColor: 'background.success.contrast',\n color: 'text.contrast',\n },\n maxElement: {\n bgColor: 'text.contrast',\n },\n },\n neutral: {\n root: {\n bgColor: 'background.subtle.less',\n color: 'text',\n },\n maxElement: {\n bgColor: 'text',\n },\n },\n red: {\n root: {\n bgColor: 'background.danger.contrast',\n color: 'text.contrast',\n },\n maxElement: {\n bgColor: 'text.contrast',\n },\n },\n};\n\nconst notificationCounterSizeStyles: Record<\n NotificationCounterSize,\n Record<NotificationCounterSlot, SystemStyleObject>\n> = {\n xs: {\n root: {\n fontSize: '8px',\n height: 3,\n width: 3,\n },\n maxElement: {\n height: '1px',\n width: '1px',\n },\n },\n sm: {\n root: { fontSize: '10px', height: 4, width: 4 },\n maxElement: {\n height: '2px',\n width: '2px',\n },\n },\n md: {\n root: {\n fontSize: 'xs',\n height: 5,\n width: 5,\n },\n maxElement: {\n height: '3px',\n width: '3px',\n },\n },\n lg: {\n root: {\n fontSize: 'sm',\n height: 6,\n width: 6,\n },\n maxElement: {\n height: 1,\n width: 1,\n },\n },\n};\n\nexport const notificationCounterRecipe = defineSlotRecipe({\n slots: notificationCounterSlots,\n base: {\n root: {\n alignItems: 'center',\n border: '1px',\n borderColor: 'background',\n borderRadius: 'full',\n fontWeight: 'semibold',\n justifyContent: 'center',\n },\n maxElement: {\n borderRadius: 'full',\n },\n },\n variants: {\n size: notificationCounterSizeStyles,\n variant: notificationCounterVariantStyles,\n },\n defaultVariants: {\n size: 'md',\n variant: 'red',\n },\n});\n","import { SpinnerSize } from 'components/Spinner/spinner.types';\nimport { NotificationCounterSize, NotificationCounterVariant } from './notificationCounter.types';\nimport { TypographyVariant } from 'shared/types';\n\nexport const MAX_COUNT = 99;\n\nexport const notificationCounterSpinnerSize: Record<NotificationCounterSize, SpinnerSize | null> = {\n xs: null, // The xs size doesn't show a spinner\n sm: 'xs',\n md: 'xs',\n lg: 'sm',\n};\n\nexport const spinnerVariantToNotificationCounterVariant: Record<NotificationCounterVariant, TypographyVariant> = {\n red: 'dangerOnContrast',\n blue: 'interactiveOnContrast',\n green: 'brandOnContrast',\n neutral: 'subtleOnContrast',\n};\n","import React, { useMemo } from 'react';\nimport { Flex, FlexProps } from '@chakra-ui/react/flex';\nimport { NotificationCounterSize, NotificationCounterVariant } from './notificationCounter.types';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { notificationCounterRecipe } from './notificationCounter.recipe';\nimport {\n MAX_COUNT,\n notificationCounterSpinnerSize,\n spinnerVariantToNotificationCounterVariant,\n} from './notificationCounter.records';\nimport { Spinner } from 'components/Spinner/spinner.component';\nimport { Box } from '@chakra-ui/react/box';\n\nexport interface NotificationCounterProps extends FlexProps {\n /** Value of the notification counter. If count is greater than 99, the count will be hidden and a special indicator will take its place. */\n count?: number;\n /** If true, the notification counter will show a spinner.\n * @default false\n */\n loading?: boolean;\n /** Whether or not to show the counter label. If the size is xs, by default the count label won't be shown.\n * @default true\n */\n showCount?: boolean;\n /** Size of the notification counter\n * @default md\n */\n size?: NotificationCounterSize;\n /** Color variant for the notification counter\n * @default red\n */\n variant?: NotificationCounterVariant;\n /** Data test id for the notification counter.\n * @default kibble-notification-counter\n */\n 'data-testid'?: string;\n}\n\nexport const NotificationCounter = ({\n count,\n loading = false,\n showCount = true,\n size = 'md',\n variant = 'red',\n ['data-testid']: dataTestId = 'kibble-notification-counter',\n ...rest\n}: NotificationCounterProps): React.JSX.Element => {\n const recipe = useSlotRecipe({ recipe: notificationCounterRecipe });\n const styles = recipe({ size, variant });\n const shouldShowCount = size !== 'xs' && showCount;\n\n const counterContent = useMemo(() => {\n const _spinnerSize = notificationCounterSpinnerSize[size];\n const _spinnerVariant = spinnerVariantToNotificationCounterVariant[variant];\n\n if (loading && !!_spinnerSize) return <Spinner variant={_spinnerVariant} size={_spinnerSize} />;\n\n if (count == null) return null; // Handle undefined or null count\n\n if (count > MAX_COUNT) return <Box css={styles.maxElement} />;\n\n return count;\n }, [size, variant, loading, count, styles.maxElement]);\n\n return (\n <Flex className=\"NotificationCounter\" data-testid={dataTestId} css={styles.root} {...rest}>\n {shouldShowCount && counterContent}\n </Flex>\n );\n};\n"],"names":["notificationCounterSlots","notificationCounterVariantStyles","notificationCounterSizeStyles","notificationCounterRecipe","defineSlotRecipe","MAX_COUNT","notificationCounterSpinnerSize","spinnerVariantToNotificationCounterVariant","NotificationCounter","count","loading","showCount","size","variant","dataTestId","rest","styles","useSlotRecipe","shouldShowCount","counterContent","useMemo","_spinnerSize","_spinnerVariant","Spinner","Box","jsx","Flex"],"mappings":"mRAGMA,EAA2B,CAAC,OAAQ,YAAY,EAGhDC,EAGF,CACF,KAAM,CACJ,KAAM,CACJ,QAAS,oBACT,MAAO,eACT,EACA,WAAY,CACV,QAAS,eAAA,CAEb,EACA,MAAO,CACL,KAAM,CACJ,QAAS,8BACT,MAAO,eACT,EACA,WAAY,CACV,QAAS,eAAA,CAEb,EACA,QAAS,CACP,KAAM,CACJ,QAAS,yBACT,MAAO,MACT,EACA,WAAY,CACV,QAAS,MAAA,CAEb,EACA,IAAK,CACH,KAAM,CACJ,QAAS,6BACT,MAAO,eACT,EACA,WAAY,CACV,QAAS,eAAA,CACX,CAEJ,EAEMC,EAGF,CACF,GAAI,CACF,KAAM,CACJ,SAAU,MACV,OAAQ,EACR,MAAO,CACT,EACA,WAAY,CACV,OAAQ,MACR,MAAO,KAAA,CAEX,EACA,GAAI,CACF,KAAM,CAAE,SAAU,OAAQ,OAAQ,EAAG,MAAO,CAAE,EAC9C,WAAY,CACV,OAAQ,MACR,MAAO,KAAA,CAEX,EACA,GAAI,CACF,KAAM,CACJ,SAAU,KACV,OAAQ,EACR,MAAO,CACT,EACA,WAAY,CACV,OAAQ,MACR,MAAO,KAAA,CAEX,EACA,GAAI,CACF,KAAM,CACJ,SAAU,KACV,OAAQ,EACR,MAAO,CACT,EACA,WAAY,CACV,OAAQ,EACR,MAAO,CAAA,CACT,CAEJ,EAEaC,EAA4BC,EAAAA,iBAAiB,CACxD,MAAOJ,EACP,KAAM,CACJ,KAAM,CACJ,WAAY,SACZ,OAAQ,MACR,YAAa,aACb,aAAc,OACd,WAAY,WACZ,eAAgB,QAClB,EACA,WAAY,CACV,aAAc,MAAA,CAElB,EACA,SAAU,CACR,KAAME,EACN,QAASD,CACX,EACA,gBAAiB,CACf,KAAM,KACN,QAAS,KAAA,CAEb,CAAC,ECjHYI,EAAY,GAEZC,EAAsF,CACjG,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EAAoG,CAC/G,IAAK,mBACL,KAAM,wBACN,MAAO,kBACP,QAAS,kBACX,ECoBaC,EAAsB,CAAC,CAClC,MAAAC,EACA,QAAAC,EAAU,GACV,UAAAC,EAAY,GACZ,KAAAC,EAAO,KACP,QAAAC,EAAU,MACV,CAAC,eAAgBC,EAAa,8BAC9B,GAAGC,CACL,IAAmD,CAEjD,MAAMC,EADSC,EAAA,cAAc,CAAE,OAAQd,EAA2B,EAC5C,CAAE,KAAAS,EAAM,QAAAC,EAAS,EACjCK,EAAkBN,IAAS,MAAQD,EAEnCQ,EAAiBC,EAAAA,QAAQ,IAAM,CAC7B,MAAAC,EAAef,EAA+BM,CAAI,EAClDU,EAAkBf,EAA2CM,CAAO,EAEtE,OAAAH,GAAaW,0BAAsBE,UAAQ,CAAA,QAASD,EAAiB,KAAMD,CAAc,CAAA,EAEzFZ,GAAS,KAAa,KAEtBA,EAAQJ,0BAAmBmB,EAAI,IAAA,CAAA,IAAKR,EAAO,WAAY,EAEpDP,CAAA,EACN,CAACG,EAAMC,EAASH,EAASD,EAAOO,EAAO,UAAU,CAAC,EAErD,OACGS,EAAAA,kBAAAA,IAAAC,EAAAA,KAAA,CAAK,UAAU,sBAAsB,cAAaZ,EAAY,IAAKE,EAAO,KAAO,GAAGD,EAClF,SAAAG,GAAmBC,EACtB,CAEJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notificationCounter.component-DikPb9gS.js","sources":["../../src/components/NotificationCounter/notificationCounter.recipe.ts","../../src/components/NotificationCounter/notificationCounter.records.ts","../../src/components/NotificationCounter/notificationCounter.component.tsx"],"sourcesContent":["import { defineSlotRecipe, SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { NotificationCounterSize, NotificationCounterVariant } from './notificationCounter.types';\n\nconst notificationCounterSlots = ['root', 'maxElement'] as const;\ntype NotificationCounterSlot = (typeof notificationCounterSlots)[number];\n\nconst notificationCounterVariantStyles: Record<\n NotificationCounterVariant,\n Record<NotificationCounterSlot, SystemStyleObject>\n> = {\n blue: {\n root: {\n bgColor: 'background.accent',\n color: 'text.contrast',\n },\n maxElement: {\n bgColor: 'text.contrast',\n },\n },\n green: {\n root: {\n bgColor: 'background.success.contrast',\n color: 'text.contrast',\n },\n maxElement: {\n bgColor: 'text.contrast',\n },\n },\n neutral: {\n root: {\n bgColor: 'background.subtle.less',\n color: 'text',\n },\n maxElement: {\n bgColor: 'text',\n },\n },\n red: {\n root: {\n bgColor: 'background.danger.contrast',\n color: 'text.contrast',\n },\n maxElement: {\n bgColor: 'text.contrast',\n },\n },\n};\n\nconst notificationCounterSizeStyles: Record<\n NotificationCounterSize,\n Record<NotificationCounterSlot, SystemStyleObject>\n> = {\n xs: {\n root: {\n fontSize: '8px',\n height: 3,\n width: 3,\n },\n maxElement: {\n height: '1px',\n width: '1px',\n },\n },\n sm: {\n root: { fontSize: '10px', height: 4, width: 4 },\n maxElement: {\n height: '2px',\n width: '2px',\n },\n },\n md: {\n root: {\n fontSize: 'xs',\n height: 5,\n width: 5,\n },\n maxElement: {\n height: '3px',\n width: '3px',\n },\n },\n lg: {\n root: {\n fontSize: 'sm',\n height: 6,\n width: 6,\n },\n maxElement: {\n height: 1,\n width: 1,\n },\n },\n};\n\nexport const notificationCounterRecipe = defineSlotRecipe({\n slots: notificationCounterSlots,\n base: {\n root: {\n alignItems: 'center',\n border: '1px',\n borderColor: 'background',\n borderRadius: 'full',\n fontWeight: 'semibold',\n justifyContent: 'center',\n },\n maxElement: {\n borderRadius: 'full',\n },\n },\n variants: {\n size: notificationCounterSizeStyles,\n variant: notificationCounterVariantStyles,\n },\n defaultVariants: {\n size: 'md',\n variant: 'red',\n },\n});\n","import { SpinnerSize } from 'components/Spinner/spinner.types';\nimport { NotificationCounterSize, NotificationCounterVariant } from './notificationCounter.types';\nimport { TypographyVariant } from 'shared/types';\n\nexport const MAX_COUNT = 99;\n\nexport const notificationCounterSpinnerSize: Record<NotificationCounterSize, SpinnerSize | null> = {\n xs: null, // The xs size doesn't show a spinner\n sm: 'xs',\n md: 'xs',\n lg: 'sm',\n};\n\nexport const spinnerVariantToNotificationCounterVariant: Record<NotificationCounterVariant, TypographyVariant> = {\n red: 'dangerOnContrast',\n blue: 'interactiveOnContrast',\n green: 'brandOnContrast',\n neutral: 'subtleOnContrast',\n};\n","import React, { useMemo } from 'react';\nimport { Flex, FlexProps } from '@chakra-ui/react/flex';\nimport { NotificationCounterSize, NotificationCounterVariant } from './notificationCounter.types';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { notificationCounterRecipe } from './notificationCounter.recipe';\nimport {\n MAX_COUNT,\n notificationCounterSpinnerSize,\n spinnerVariantToNotificationCounterVariant,\n} from './notificationCounter.records';\nimport { Spinner } from 'components/Spinner/spinner.component';\nimport { Box } from '@chakra-ui/react/box';\n\nexport interface NotificationCounterProps extends FlexProps {\n /** Value of the notification counter. If count is greater than 99, the count will be hidden and a special indicator will take its place. */\n count?: number;\n /** If true, the notification counter will show a spinner.\n * @default false\n */\n loading?: boolean;\n /** Whether or not to show the counter label. If the size is xs, by default the count label won't be shown.\n * @default true\n */\n showCount?: boolean;\n /** Size of the notification counter\n * @default md\n */\n size?: NotificationCounterSize;\n /** Color variant for the notification counter\n * @default red\n */\n variant?: NotificationCounterVariant;\n /** Data test id for the notification counter.\n * @default kibble-notification-counter\n */\n 'data-testid'?: string;\n}\n\nexport const NotificationCounter = ({\n count,\n loading = false,\n showCount = true,\n size = 'md',\n variant = 'red',\n ['data-testid']: dataTestId = 'kibble-notification-counter',\n ...rest\n}: NotificationCounterProps): React.JSX.Element => {\n const recipe = useSlotRecipe({ recipe: notificationCounterRecipe });\n const styles = recipe({ size, variant });\n const shouldShowCount = size !== 'xs' && showCount;\n\n const counterContent = useMemo(() => {\n const _spinnerSize = notificationCounterSpinnerSize[size];\n const _spinnerVariant = spinnerVariantToNotificationCounterVariant[variant];\n\n if (loading && !!_spinnerSize) return <Spinner variant={_spinnerVariant} size={_spinnerSize} />;\n\n if (count == null) return null; // Handle undefined or null count\n\n if (count > MAX_COUNT) return <Box css={styles.maxElement} />;\n\n return count;\n }, [size, variant, loading, count, styles.maxElement]);\n\n return (\n <Flex className=\"NotificationCounter\" data-testid={dataTestId} css={styles.root} {...rest}>\n {shouldShowCount && counterContent}\n </Flex>\n );\n};\n"],"names":["notificationCounterSlots","notificationCounterVariantStyles","notificationCounterSizeStyles","notificationCounterRecipe","defineSlotRecipe","MAX_COUNT","notificationCounterSpinnerSize","spinnerVariantToNotificationCounterVariant","NotificationCounter","count","loading","showCount","size","variant","dataTestId","rest","styles","useSlotRecipe","shouldShowCount","counterContent","useMemo","_spinnerSize","_spinnerVariant","Spinner","Box","jsx","Flex"],"mappings":";;;;;;;AAGA,MAAMA,IAA2B,CAAC,QAAQ,YAAY,GAGhDC,IAGF;AAAA,EACF,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,IAAA;AAAA,EAEb;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,IAAA;AAAA,EAEb;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,IAAA;AAAA,EAEb;AAAA,EAC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