tfy-web-components 0.0.17 → 0.0.19

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.
Files changed (69) hide show
  1. package/README.md +19 -0
  2. package/dist/Accordion.d.ts +58 -0
  3. package/dist/Badge.d.ts +46 -0
  4. package/dist/Button.d.ts +4 -2
  5. package/dist/CopyField.d.ts +81 -0
  6. package/dist/Dialog.d.ts +18 -0
  7. package/dist/IconProvider.d.ts +4 -2
  8. package/dist/Input.d.ts +27 -0
  9. package/dist/Notification-BT4CZ69U.js +39 -0
  10. package/dist/Notification-BT4CZ69U.js.map +1 -0
  11. package/dist/Notification.d.ts +12 -0
  12. package/dist/Notify.d.ts +4 -0
  13. package/dist/Switch.d.ts +20 -0
  14. package/dist/TabButton.d.ts +20 -0
  15. package/dist/TabPanel.d.ts +14 -0
  16. package/dist/Tooltip.d.ts +9 -5
  17. package/dist/_commonjsHelpers-CcAunmGO.js +34 -0
  18. package/dist/_commonjsHelpers-CcAunmGO.js.map +1 -0
  19. package/dist/components/atoms/Accordion.d.ts +48 -0
  20. package/dist/components/atoms/Accordion.es.js +98 -0
  21. package/dist/components/atoms/Accordion.es.js.map +1 -0
  22. package/dist/components/atoms/Badge.d.ts +35 -0
  23. package/dist/components/atoms/Badge.es.js +50 -0
  24. package/dist/components/atoms/Badge.es.js.map +1 -0
  25. package/dist/components/atoms/Button.d.ts +4 -5
  26. package/dist/components/atoms/Button.es.js +107 -25
  27. package/dist/components/atoms/Button.es.js.map +1 -1
  28. package/dist/components/atoms/IconButton.d.ts +1 -1
  29. package/dist/components/atoms/IconButton.es.js.map +1 -1
  30. package/dist/components/atoms/IconProvider.d.ts +3 -2
  31. package/dist/components/atoms/IconProvider.es.js.map +1 -1
  32. package/dist/components/atoms/Notification.d.ts +9 -0
  33. package/dist/components/atoms/Notification.es.js +6 -0
  34. package/dist/components/atoms/Notification.es.js.map +1 -0
  35. package/dist/components/atoms/Spinner.es.js +1 -1
  36. package/dist/components/atoms/Spinner.es.js.map +1 -1
  37. package/dist/components/atoms/Switch.d.ts +16 -0
  38. package/dist/components/atoms/Switch.es.js +79 -0
  39. package/dist/components/atoms/Switch.es.js.map +1 -0
  40. package/dist/components/atoms/TabButton.d.ts +14 -0
  41. package/dist/components/atoms/TabButton.es.js +34 -0
  42. package/dist/components/atoms/TabButton.es.js.map +1 -0
  43. package/dist/components/atoms/TabPanel.d.ts +10 -0
  44. package/dist/components/atoms/TabPanel.es.js +20 -0
  45. package/dist/components/atoms/TabPanel.es.js.map +1 -0
  46. package/dist/components/atoms/Tooltip.d.ts +8 -5
  47. package/dist/components/atoms/Tooltip.es.js +6 -5
  48. package/dist/components/atoms/Tooltip.es.js.map +1 -1
  49. package/dist/components/molecules/CopyField.d.ts +38 -0
  50. package/dist/components/molecules/CopyField.es.js +74195 -0
  51. package/dist/components/molecules/CopyField.es.js.map +1 -0
  52. package/dist/components/molecules/Dialog.d.ts +14 -0
  53. package/dist/components/molecules/Dialog.es.js +6463 -0
  54. package/dist/components/molecules/Dialog.es.js.map +1 -0
  55. package/dist/components/molecules/Input.d.ts +23 -0
  56. package/dist/components/molecules/Input.es.js +12 -0
  57. package/dist/components/molecules/Input.es.js.map +1 -0
  58. package/dist/components/molecules/Notify.d.ts +1 -0
  59. package/dist/components/molecules/Notify.es.js +1058 -0
  60. package/dist/components/molecules/Notify.es.js.map +1 -0
  61. package/dist/components/theme/index.d.ts +1 -0
  62. package/dist/components/theme/index.es.js +3 -1
  63. package/dist/components/theme/index.es.js.map +1 -1
  64. package/dist/components/theme/utils.es.js +9 -175
  65. package/dist/components/theme/utils.es.js.map +1 -1
  66. package/dist/isTypedArray-CoDTnA8U.js +185 -0
  67. package/dist/isTypedArray-CoDTnA8U.js.map +1 -0
  68. package/dist/style.css +1 -0
  69. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.es.js","sources":["../../../src/components/atoms/Accordion.tsx"],"sourcesContent":["import React from 'react'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport MuiAccordion, { AccordionProps } from '@mui/material/Accordion'\nimport MuiAccordionDetails from '@mui/material/AccordionDetails'\nimport MuiAccordionSummary, { AccordionSummaryProps as MuiAccordionSummaryProps } from '@mui/material/AccordionSummary'\nimport { styled } from '@mui/material/styles'\n\nimport { colors } from '@/components/theme/theme'\n\nimport classNames from '@/utils/classNames'\n\nexport const Accordion = styled((props: AccordionProps & { background?: string; borderColor?: string }) => {\n const { background, borderColor, ...restProps } = props\n return <MuiAccordion disableGutters elevation={0} square {...restProps} />\n})(({ background, borderColor }) => ({\n border: `0.0625rem solid ${borderColor ?? colors.gray[250]}`,\n borderRadius: '0.5rem',\n backgroundColor: background ?? colors.gray[250],\n marginBottom: '0.75rem',\n '&:before': {\n display: 'none',\n },\n}))\n\nexport interface AccordionSummaryProps extends MuiAccordionSummaryProps {\n hideIcon?: boolean\n chevronDown?: boolean\n rightIcon?: boolean\n iconClasses?: string\n}\n\nexport const AccordionSummary = styled((props: AccordionSummaryProps) => {\n const { hideIcon, chevronDown, rightIcon, iconClasses, ...restProps } = props\n return (\n <MuiAccordionSummary\n expandIcon={\n hideIcon ? (\n <></>\n ) : (\n <FontAwesomeIcon\n icon={chevronDown ? 'chevron-down' : 'chevron-right'}\n className={classNames('text-xs text-gray-400', iconClasses)}\n />\n )\n }\n {...restProps}\n />\n )\n})(({ theme, chevronDown, rightIcon }) => ({\n flexDirection: rightIcon ? 'row' : 'row-reverse',\n '& .MuiAccordionSummary-expandIconWrapper.Mui-expanded': {\n transform: chevronDown ? 'rotate(-180deg)' : 'rotate(90deg)',\n },\n '& .MuiAccordionSummary-content': {\n marginLeft: theme.spacing(1),\n },\n}))\n\nexport const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({\n padding: `0 ${theme.spacing(2)}`,\n}))\n\nexport default function CustomizedAccordions({\n children,\n btn,\n id,\n discription,\n sx,\n tools,\n}: {\n children: React.ReactNode | JSX.Element | string\n btn: React.ReactNode | JSX.Element | string\n id: string\n discription?: string\n sx?: object\n tools?: React.ReactNode | JSX.Element | string\n}) {\n const [expanded, setExpanded] = React.useState<boolean>(false)\n const [showTools, setShowTools] = React.useState<boolean>(false)\n\n const handleChange = () => {\n if (!expanded && tools) {\n setShowTools(true)\n }\n setExpanded(!expanded)\n }\n\n return (\n <Accordion\n expanded={expanded}\n onChange={handleChange}\n sx={sx}\n TransitionProps={\n tools\n ? {\n onExited: (node: HTMLElement) => {\n if (tools) {\n setShowTools(false)\n }\n },\n }\n : undefined\n }\n >\n <AccordionSummary aria-controls=\"panel\" id={id}>\n <div className=\"w-full\">\n <div className=\"flex w-full\">\n <div className=\"font-base text-gray-1000 font-medium ml-1\">{btn}</div>\n <div className=\"flex items-center w-full px-3 pr-4\">\n <div className=\"w-full border-y border-gray-200\"></div>\n </div>\n {showTools && tools}\n </div>\n {discription && <div className=\"font-sans text-gray-600 text-xs font-medium ml-1.5\">{discription}</div>}\n </div>\n </AccordionSummary>\n <AccordionDetails>{children}</AccordionDetails>\n </Accordion>\n )\n}\n"],"names":["React"],"mappings":";;;;;;;;;AAWO,MAAM,YAAY,OAAO,CAAC,UAA0E;AACzG,QAAM,EAAE,YAAY,aAAa,GAAG,cAAc;AAClD,SAAO,oBAAC,gBAAa,gBAAc,MAAC,WAAW,GAAG,QAAM,MAAE,GAAG,UAAA,CAAW;AAC1E,CAAC,EAAE,CAAC,EAAE,YAAY,mBAAmB;AAAA,EACnC,QAAQ,mBAAmB,eAAe,OAAO,KAAK,GAAG,CAAC;AAAA,EAC1D,cAAc;AAAA,EACd,iBAAiB,cAAc,OAAO,KAAK,GAAG;AAAA,EAC9C,cAAc;AAAA,EACd,YAAY;AAAA,IACV,SAAS;AAAA,EAAA;AAEb,EAAE;AASK,MAAM,mBAAmB,OAAO,CAAC,UAAiC;AACvE,QAAM,EAAE,UAAU,aAAa,WAAW,aAAa,GAAG,cAAc;AACxE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC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AI,WAAU,eACb,UAAA;AAAA,YAAA,oBAAC,OAAA,EAAI,WAAU,6CAA6C,UAAA,KAAI;AAAA,YAChE,oBAAC,SAAI,WAAU,sCACb,8BAAC,OAAA,EAAI,WAAU,mCAAkC,EAAA,CACnD;AAAA,YACC,aAAa;AAAA,UAAA,GAChB;AAAA,UACC,eAAe,oBAAC,OAAA,EAAI,WAAU,sDAAsD,UAAA,YAAA,CAAY;AAAA,QAAA,EAAA,CACnG,EAAA,CACF;AAAA,QACA,oBAAC,oBAAkB,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGlC;"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { type IconProp } from './IconProvider';
3
+ type BadgeType = 'default' | 'warning' | 'waiting' | 'primary' | 'danger' | 'success' | 'gray' | 'light-gray' | 'white' | 'none';
4
+ interface IconRequired {
5
+ icon: IconProp;
6
+ rightIcon?: IconProp;
7
+ text?: React.ReactNode | JSX.Element | string;
8
+ }
9
+ interface RightIconRequired {
10
+ icon?: IconProp;
11
+ rightIcon: IconProp;
12
+ text?: React.ReactNode | JSX.Element | string;
13
+ }
14
+ interface TextRequired {
15
+ icon?: IconProp;
16
+ rightIcon?: IconProp;
17
+ text: React.ReactNode | JSX.Element | string;
18
+ }
19
+ type AtleastOne = IconRequired | RightIconRequired | TextRequired;
20
+ export type BadgeProps = {
21
+ className?: string;
22
+ iconClasses?: string;
23
+ rightIconClasses?: string;
24
+ textClasses?: string;
25
+ type?: BadgeType;
26
+ iconColor?: string;
27
+ rightIconColor?: string;
28
+ customPadding?: string;
29
+ onClick?: () => void;
30
+ iconSize?: number;
31
+ rightIconSize?: number;
32
+ dataTestPrefix?: string;
33
+ } & React.AllHTMLAttributes<HTMLDivElement> & AtleastOne;
34
+ declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
35
+ export default Badge;
@@ -0,0 +1,50 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React__default from "react";
3
+ import { c as classNames } from "../../classNames-CC5emYUV.js";
4
+ import IconProvider from "./IconProvider.es.js";
5
+ const Badge = React__default.forwardRef((props, ref) => {
6
+ const {
7
+ text,
8
+ icon,
9
+ rightIcon,
10
+ type = "default",
11
+ className: additionalClasses = "",
12
+ iconClasses,
13
+ textClasses,
14
+ customPadding = "py-0.5 px-1",
15
+ iconSize,
16
+ iconColor,
17
+ rightIconClasses,
18
+ rightIconSize,
19
+ rightIconColor,
20
+ dataTestPrefix,
21
+ onClick,
22
+ ...nativeProps
23
+ } = props;
24
+ const classes = classNames("font-sans badge badge-ghost rounded text-xs gap-1 whitespace-nowrap", customPadding, {
25
+ "bg-indigo-100 text-indigo-600 dark:bg-indigo-600/25 dark:text-indigo-300": type === "default",
26
+ "bg-blue-150 text-blue-800 dark:bg-blue-500/25 dark:text-blue-300": type === "primary",
27
+ "bg-rose-100 text-rose-800 dark:bg-rose-500/25 dark:text-rose-300": type === "danger",
28
+ "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/25 dark:text-emerald-300": type === "success",
29
+ "bg-yellow-100 text-yellow-800 dark:bg-yellow-600/25 dark:text-yellow-300": type === "warning",
30
+ "bg-orange-100 text-amber-700 dark:bg-orange-500/25 dark:text-amber-300": type === "waiting",
31
+ "bg-gray-150 text-gray-800 dark:bg-gray-300 dark:text-gray-900": type === "gray",
32
+ "bg-gray-100 text-gray-900 dark:bg-gray-300 dark:text-gray-16": type === "light-gray",
33
+ "bg-white text-gray-600 dark:bg-gray-500/25 dark:text-gray-300": type === "white",
34
+ [additionalClasses]: additionalClasses
35
+ });
36
+ const iconProviderClasses = classNames({
37
+ "text-rose-400": type === "danger",
38
+ "text-emerald-400": type === "success",
39
+ [iconClasses ?? ""]: iconClasses
40
+ });
41
+ return /* @__PURE__ */ jsxs("div", { ...nativeProps, className: classes, onClick, ref, children: [
42
+ icon && /* @__PURE__ */ jsx(IconProvider, { icon, className: iconProviderClasses, color: iconColor, size: iconSize }),
43
+ text && /* @__PURE__ */ jsx("span", { className: textClasses, "data-test": dataTestPrefix && dataTestPrefix + "-text", children: text }),
44
+ rightIcon && /* @__PURE__ */ jsx(IconProvider, { icon: rightIcon, color: rightIconColor, size: rightIconSize, className: rightIconClasses })
45
+ ] });
46
+ });
47
+ export {
48
+ Badge as default
49
+ };
50
+ //# sourceMappingURL=Badge.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.es.js","sources":["../../../src/components/atoms/Badge.tsx"],"sourcesContent":["import React from 'react'\n\nimport classNames from '@/utils/classNames'\n\nimport IconProvider, { type IconProp } from './IconProvider'\n\ntype BadgeType =\n | 'default'\n | 'warning'\n | 'waiting'\n | 'primary'\n | 'danger'\n | 'success'\n | 'gray'\n | 'light-gray'\n | 'white'\n | 'none'\n\ninterface IconRequired {\n icon: IconProp\n rightIcon?: IconProp\n text?: React.ReactNode | JSX.Element | string\n}\n\ninterface RightIconRequired {\n icon?: IconProp\n rightIcon: IconProp\n text?: React.ReactNode | JSX.Element | string\n}\n\ninterface TextRequired {\n icon?: IconProp\n rightIcon?: IconProp\n text: React.ReactNode | JSX.Element | string\n}\n\ntype AtleastOne = IconRequired | RightIconRequired | TextRequired\n\nexport type BadgeProps = {\n className?: string\n iconClasses?: string\n rightIconClasses?: string\n textClasses?: string\n type?: BadgeType\n iconColor?: string\n rightIconColor?: string\n customPadding?: string\n onClick?: () => void\n iconSize?: number\n rightIconSize?: number\n dataTestPrefix?: string\n} & React.AllHTMLAttributes<HTMLDivElement> &\n AtleastOne\n\nconst Badge = React.forwardRef<HTMLDivElement, BadgeProps>((props, ref) => {\n const {\n text,\n icon,\n rightIcon,\n type = 'default',\n className: additionalClasses = '',\n iconClasses,\n textClasses,\n customPadding = 'py-0.5 px-1',\n iconSize,\n iconColor,\n rightIconClasses,\n rightIconSize,\n rightIconColor,\n dataTestPrefix,\n onClick,\n ...nativeProps\n } = props\n const classes = classNames('font-sans badge badge-ghost rounded text-xs gap-1 whitespace-nowrap', customPadding, {\n 'bg-indigo-100 text-indigo-600 dark:bg-indigo-600/25 dark:text-indigo-300': type === 'default',\n 'bg-blue-150 text-blue-800 dark:bg-blue-500/25 dark:text-blue-300': type === 'primary',\n 'bg-rose-100 text-rose-800 dark:bg-rose-500/25 dark:text-rose-300': type === 'danger',\n 'bg-emerald-100 text-emerald-800 dark:bg-emerald-500/25 dark:text-emerald-300': type === 'success',\n 'bg-yellow-100 text-yellow-800 dark:bg-yellow-600/25 dark:text-yellow-300': type === 'warning',\n 'bg-orange-100 text-amber-700 dark:bg-orange-500/25 dark:text-amber-300': type === 'waiting',\n 'bg-gray-150 text-gray-800 dark:bg-gray-300 dark:text-gray-900': type === 'gray',\n 'bg-gray-100 text-gray-900 dark:bg-gray-300 dark:text-gray-16': type === 'light-gray',\n 'bg-white text-gray-600 dark:bg-gray-500/25 dark:text-gray-300': type === 'white',\n [additionalClasses]: additionalClasses,\n })\n const iconProviderClasses = classNames({\n 'text-rose-400': type === 'danger',\n 'text-emerald-400': type === 'success',\n [iconClasses ?? '']: iconClasses,\n })\n\n // TODO: We need to ensure that the consumer is aware that we need to pass at least one of icon, rightIcon and text\n return (\n <div {...nativeProps} className={classes} onClick={onClick} ref={ref}>\n {icon && <IconProvider icon={icon} className={iconProviderClasses} color={iconColor} size={iconSize} />}\n {text && (\n <span className={textClasses} data-test={dataTestPrefix && dataTestPrefix + '-text'}>\n {text}\n </span>\n )}\n {rightIcon && (\n <IconProvider icon={rightIcon} color={rightIconColor} size={rightIconSize} className={rightIconClasses} />\n )}\n </div>\n )\n})\n\nexport default Badge\n"],"names":["React"],"mappings":";;;;AAsDA,MAAM,QAAQA,eAAM,WAAuC,CAAC,OAAO,QAAQ;AACzE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,WAAW,oBAAoB;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,UAAU,WAAW,uEAAuE,eAAe;AAAA,IAC/G,4EAA4E,SAAS;AAAA,IACrF,oEAAoE,SAAS;AAAA,IAC7E,oEAAoE,SAAS;AAAA,IAC7E,gFAAgF,SAAS;AAAA,IACzF,4EAA4E,SAAS;AAAA,IACrF,0EAA0E,SAAS;AAAA,IACnF,iEAAiE,SAAS;AAAA,IAC1E,gEAAgE,SAAS;AAAA,IACzE,iEAAiE,SAAS;AAAA,IAC1E,CAAC,iBAAiB,GAAG;AAAA,EAAA,CACtB;AACD,QAAM,sBAAsB,WAAW;AAAA,IACrC,iBAAiB,SAAS;AAAA,IAC1B,oBAAoB,SAAS;AAAA,IAC7B,CAAC,eAAe,EAAE,GAAG;AAAA,EAAA,CACtB;AAGD,8BACG,OAAA,EAAK,GAAG,aAAa,WAAW,SAAS,SAAkB,KACzD,UAAA;AAAA,IAAA,QAAQ,oBAAC,gBAAa,MAAY,WAAW,qBAAqB,OAAO,WAAW,MAAM,SAAA,CAAU;AAAA,IACpG,4BACE,QAAA,EAAK,WAAW,aAAa,aAAW,kBAAkB,iBAAiB,SACzE,UAAA,KAAA,CACH;AAAA,IAED,aACC,oBAAC,cAAA,EAAa,MAAM,WAAW,OAAO,gBAAgB,MAAM,eAAe,WAAW,iBAAA,CAAkB;AAAA,EAAA,GAE5G;AAEJ,CAAC;"}
@@ -1,9 +1,6 @@
1
- import React, { ReactNode } from 'react';
1
+ import React from 'react';
2
2
  import type { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
3
- import { CustomTooltipProps } from './Tooltip';
4
- type TooltipProps = Partial<Pick<CustomTooltipProps, 'title' | 'placement' | 'size'>> & {
5
- disabledTitle?: ReactNode;
6
- };
3
+ import { TooltipProps } from './Tooltip';
7
4
  export type ButtonSize = 'large' | 'small';
8
5
  export interface ButtonProps {
9
6
  id?: string;
@@ -24,6 +21,8 @@ export interface ButtonProps {
24
21
  removeIconContainer?: boolean;
25
22
  isMenuItem?: boolean;
26
23
  useLightTooltip?: boolean;
24
+ className?: string;
25
+ autoFocus?: boolean;
27
26
  }
28
27
  type ButtonComponent = React.ForwardRefExoticComponent<ButtonProps> & {
29
28
  Ghost: React.ForwardRefExoticComponent<ButtonProps>;
@@ -1,8 +1,76 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import React__default from "react";
3
+ import { o as overArg, i as isPrototype, g as getNative, r as root, b as baseGetTag, t as toSource, M as Map, a as isArrayLike, c as isArray, d as isBuffer, e as isTypedArray, f as isArguments } from "../../isTypedArray-CoDTnA8U.js";
3
4
  import { c as classNames } from "../../classNames-CC5emYUV.js";
4
5
  import IconProvider from "./IconProvider.es.js";
5
6
  import { LightTooltip, DarkTooltip } from "./Tooltip.es.js";
7
+ var nativeKeys = overArg(Object.keys, Object);
8
+ var objectProto$1 = Object.prototype;
9
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
10
+ function baseKeys(object) {
11
+ if (!isPrototype(object)) {
12
+ return nativeKeys(object);
13
+ }
14
+ var result = [];
15
+ for (var key in Object(object)) {
16
+ if (hasOwnProperty$1.call(object, key) && key != "constructor") {
17
+ result.push(key);
18
+ }
19
+ }
20
+ return result;
21
+ }
22
+ var DataView = getNative(root, "DataView");
23
+ var Promise$1 = getNative(root, "Promise");
24
+ var Set = getNative(root, "Set");
25
+ var WeakMap = getNative(root, "WeakMap");
26
+ var mapTag$1 = "[object Map]", objectTag = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
27
+ var dataViewTag = "[object DataView]";
28
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
29
+ var getTag = baseGetTag;
30
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag$1 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set && getTag(new Set()) != setTag$1 || WeakMap && getTag(new WeakMap()) != weakMapTag) {
31
+ getTag = function(value) {
32
+ var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
33
+ if (ctorString) {
34
+ switch (ctorString) {
35
+ case dataViewCtorString:
36
+ return dataViewTag;
37
+ case mapCtorString:
38
+ return mapTag$1;
39
+ case promiseCtorString:
40
+ return promiseTag;
41
+ case setCtorString:
42
+ return setTag$1;
43
+ case weakMapCtorString:
44
+ return weakMapTag;
45
+ }
46
+ }
47
+ return result;
48
+ };
49
+ }
50
+ var mapTag = "[object Map]", setTag = "[object Set]";
51
+ var objectProto = Object.prototype;
52
+ var hasOwnProperty = objectProto.hasOwnProperty;
53
+ function isEmpty(value) {
54
+ if (value == null) {
55
+ return true;
56
+ }
57
+ if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
58
+ return !value.length;
59
+ }
60
+ var tag = getTag(value);
61
+ if (tag == mapTag || tag == setTag) {
62
+ return !value.size;
63
+ }
64
+ if (isPrototype(value)) {
65
+ return !baseKeys(value).length;
66
+ }
67
+ for (var key in value) {
68
+ if (hasOwnProperty.call(value, key)) {
69
+ return false;
70
+ }
71
+ }
72
+ return true;
73
+ }
6
74
  const iconSizeMap = {
7
75
  small: 0.75,
8
76
  large: 0.875
@@ -13,10 +81,11 @@ const getIconContainerSize = (size, isGhostOrTertiary, removeContainer) => {
13
81
  return size === "large" ? `h-3.5 w-3.5 ${baseClasses}` : `h-3 w-3 ${baseClasses}`;
14
82
  }
15
83
  if (size === "large") {
16
- const width = removeContainer ? "w-2.5" : "w-4";
17
- return `h-4 ${width} ${baseClasses}`;
84
+ const width2 = removeContainer ? "w-2.5" : "w-4";
85
+ return `h-4 ${width2} ${baseClasses}`;
18
86
  }
19
- return `h-2.5 w-2.5 ${baseClasses}`;
87
+ const width = removeContainer ? "w-1.5" : "w-2.5";
88
+ return `h-2.5 ${width} ${baseClasses}`;
20
89
  };
21
90
  const Wrapper = ({ condition, tooltipWrapper, children }) => condition ? tooltipWrapper(children) : /* @__PURE__ */ jsx("div", { className: "", children });
22
91
  const ButtonBase = React__default.forwardRef(
@@ -38,26 +107,38 @@ const ButtonBase = React__default.forwardRef(
38
107
  removeIconContainer = false,
39
108
  isMenuItem,
40
109
  id,
41
- useLightTooltip = false
110
+ useLightTooltip = false,
111
+ className = "",
112
+ autoFocus = false
42
113
  }, ref) => {
43
114
  const isDisabled = loading || disabled;
44
- const isIconOnly = text && !!icon;
115
+ const isIconOnly = isEmpty(text) && !isEmpty(icon);
45
116
  const variantClasses = {
46
- primary: classNames("bg-gray-1000 text-white", {
47
- "hover:bg-gray-750": !isDisabled
48
- }),
49
- secondary: classNames("bg-white text-gray-750 border border-gray-250", {
50
- "hover:bg-gray-750 hover:text-white hover:border-gray-750": !isDisabled
51
- }),
52
- ghost: classNames("bg-transparent text-gray-750 border-none shadow-none", {
53
- "hover:bg-gray-150": !isDisabled
117
+ primary: classNames("bg-gray-1000 text-white dark:text-light-white dark:bg-indigo-600", {
118
+ "hover:bg-gray-750 dark:hover:bg-indigo-700 group-hover/targeted-button:bg-gray-750 dark:group-hover/targeted-button:bg-indigo-700": !isDisabled
54
119
  }),
55
- tertiary: classNames("bg-white border text-gray-550 border-gray-250 font-work", {
56
- "hover:border-gray-550": !isDisabled
120
+ secondary: classNames(
121
+ "bg-white dark:bg-gray-300 text-gray-700 dark:text-light-white border border-gray-250 dark:border-gray-350",
122
+ {
123
+ "hover:bg-gray-750 hover:text-white hover:border-gray-750 dark:hover:bg-indigo-600 dark:hover:border-indigo-600 group-hover/targeted-button:bg-gray-750 group-hover/targeted-button:text-white group-hover/targeted-button:border-gray-750 dark:group-hover/targeted-button:bg-indigo-600 dark:group-hover/targeted-button:border-indigo-600": !isDisabled
124
+ }
125
+ ),
126
+ ghost: classNames("bg-transparent text-gray-700 border-none shadow-none", {
127
+ "hover:bg-gray-150 dark:hover:bg-gray-250 group-hover/targeted-button:bg-gray-150 dark:group-hover/targeted-button:bg-gray-250": !isDisabled,
128
+ "dark:hover:bg-gray-350 dark:group-hover/targeted-button:bg-gray-350": !isDisabled && isMenuItem
57
129
  }),
58
- destructive: classNames("bg-white text-rose-500 border border-gray-250", {
59
- "hover:bg-rose-500 hover:text-white hover:border-rose-500": !isDisabled
60
- })
130
+ tertiary: classNames(
131
+ "bg-white border dark:bg-gray-300 text-gray-550 border-gray-250 font-work dark:text-gray-700 dark:border-gray-400",
132
+ {
133
+ "hover:border-gray-550 dark:hover:border-gray-700 group-hover/targeted-button:border-gray-550 dark:group-hover/targeted-button:border-gray-700": !isDisabled
134
+ }
135
+ ),
136
+ destructive: classNames(
137
+ "bg-white text-rose-500 border border-gray-250 dark:bg-rose-600/[.05] dark:border-rose-900",
138
+ {
139
+ "hover:bg-rose-500 hover:text-light-white hover:border-rose-500 dark:hover:bg-rose-500 dark:hover:border-rose-500 group-hover/targeted-button:bg-rose-500 group-hover/targeted-button:text-light-white dark:group-hover/targeted-button:border-rose-500": !isDisabled
140
+ }
141
+ )
61
142
  };
62
143
  const sizeClasses = {
63
144
  large: `h-8 ${isIconOnly ? "px-[0.4375rem]" : "px-2.5"} text-sm`,
@@ -78,11 +159,11 @@ const ButtonBase = React__default.forwardRef(
78
159
  }
79
160
  );
80
161
  const iconClassVariant = {
81
- primary: "text-white",
82
- secondary: isDisabled ? "text-gray-500" : "text-gray-500 group-hover/btn:text-white",
83
- ghost: "text-gray-750",
84
- tertiary: "text-gray-550",
85
- destructive: isDisabled ? "" : "group-hover/btn:text-white"
162
+ primary: "text-white dark:text-light-white",
163
+ secondary: isDisabled ? "text-gray-500" : "text-gray-500 group-hover/btn:text-light-white dark:text-gray-700",
164
+ ghost: "text-gray-700",
165
+ tertiary: "text-gray-550 dark:text-gray-700",
166
+ destructive: isDisabled ? "" : "group-hover/btn:text-white dark:group-hover/btn:text-gray-700"
86
167
  };
87
168
  const iconClass = classNames(iconClassVariant[variant], iconContainer[size], {
88
169
  [`${iconClasses}`]: iconClasses
@@ -93,7 +174,7 @@ const ButtonBase = React__default.forwardRef(
93
174
  title: (tooltipProps == null ? void 0 : tooltipProps.disabledTitle) || (tooltipProps == null ? void 0 : tooltipProps.title),
94
175
  placement: tooltipProps == null ? void 0 : tooltipProps.placement,
95
176
  size: tooltipProps == null ? void 0 : tooltipProps.size,
96
- children
177
+ children: /* @__PURE__ */ jsx("div", { children })
97
178
  }
98
179
  ) : /* @__PURE__ */ jsx(DarkTooltip, { title: tooltipProps == null ? void 0 : tooltipProps.title, placement: tooltipProps == null ? void 0 : tooltipProps.placement, size: tooltipProps == null ? void 0 : tooltipProps.size, children });
99
180
  const iconComp = icon && /* @__PURE__ */ jsx("div", { className: iconClass, children: /* @__PURE__ */ jsx(IconProvider, { icon, size: iconSize || iconSizeMap[size] }) });
@@ -105,10 +186,11 @@ const ButtonBase = React__default.forwardRef(
105
186
  id,
106
187
  type,
107
188
  onClick,
108
- className: classes,
189
+ className: classNames(classes, className),
109
190
  disabled: isDisabled,
110
191
  ref,
111
192
  "data-test": dataTestId,
193
+ autoFocus,
112
194
  children: [
113
195
  !iconToRight && renderedIcon,
114
196
  text,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.es.js","sources":["../../../src/components/atoms/Button.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport type { FontAwesomeIconProps } from '@fortawesome/react-fontawesome'\n\nimport classNames from '@/utils/classNames'\n\nimport IconProvider from './IconProvider'\nimport { CustomTooltipProps, DarkTooltip, LightTooltip } from './Tooltip'\n\ntype TooltipProps = Partial<Pick<CustomTooltipProps, 'title' | 'placement' | 'size'>> & {\n disabledTitle?: ReactNode\n}\nexport type ButtonSize = 'large' | 'small'\n\nexport interface ButtonProps {\n id?: string\n icon?: FontAwesomeIconProps['icon'] | string\n text?: React.ReactNode | JSX.Element | string\n block?: boolean\n disabled?: boolean\n loading?: boolean\n dataTestId?: string\n iconToRight?: boolean\n variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'destructive'\n size?: ButtonSize\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void\n iconClasses?: string\n type?: 'submit' | 'reset' | 'button'\n tooltipProps?: TooltipProps\n iconSize?: number\n removeIconContainer?: boolean\n isMenuItem?: boolean\n useLightTooltip?: boolean\n}\n\nconst iconSizeMap = {\n small: 0.75,\n large: 0.875,\n}\n\ntype ButtonComponent = React.ForwardRefExoticComponent<ButtonProps> & {\n Ghost: React.ForwardRefExoticComponent<ButtonProps>\n Primary: React.ForwardRefExoticComponent<ButtonProps>\n Secondary: React.ForwardRefExoticComponent<ButtonProps>\n Tertiary: React.ForwardRefExoticComponent<ButtonProps>\n Destructive: React.ForwardRefExoticComponent<ButtonProps>\n}\n\ntype WrapperProps = {\n condition: boolean\n tooltipWrapper: (children: ReactElement) => JSX.Element\n children: ReactElement\n}\n\nconst getIconContainerSize = (size: ButtonSize, isGhostOrTertiary: boolean, removeContainer: boolean) => {\n const baseClasses = 'flex items-center justify-center'\n\n if (isGhostOrTertiary) {\n return size === 'large' ? `h-3.5 w-3.5 ${baseClasses}` : `h-3 w-3 ${baseClasses}`\n }\n\n if (size === 'large') {\n const width = removeContainer ? 'w-2.5' : 'w-4'\n return `h-4 ${width} ${baseClasses}`\n }\n\n return `h-2.5 w-2.5 ${baseClasses}`\n}\n\nconst Wrapper: React.FC<WrapperProps> = ({ condition, tooltipWrapper, children }) =>\n condition ? tooltipWrapper(children) : <div className={''}>{children}</div>\n\n// TODO: icon related all configs should be clubbed together.\n// Why is iconClasses needed?\n// That control shouldn't be provided.\nconst ButtonBase = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n text,\n icon,\n block = false,\n disabled = false,\n loading = false,\n dataTestId,\n iconToRight = false,\n variant = 'primary',\n size = 'large',\n onClick,\n iconClasses,\n tooltipProps,\n iconSize,\n type,\n removeIconContainer = false,\n isMenuItem,\n id,\n useLightTooltip = false,\n },\n ref,\n ) => {\n const isDisabled = loading || disabled\n const isIconOnly = text && !!icon\n\n const variantClasses = {\n primary: classNames('bg-gray-1000 text-white', {\n 'hover:bg-gray-750': !isDisabled,\n }),\n secondary: classNames('bg-white text-gray-750 border border-gray-250', {\n 'hover:bg-gray-750 hover:text-white hover:border-gray-750': !isDisabled,\n }),\n ghost: classNames('bg-transparent text-gray-750 border-none shadow-none', {\n 'hover:bg-gray-150': !isDisabled,\n }),\n tertiary: classNames('bg-white border text-gray-550 border-gray-250 font-work', {\n 'hover:border-gray-550': !isDisabled,\n }),\n destructive: classNames('bg-white text-rose-500 border border-gray-250', {\n 'hover:bg-rose-500 hover:text-white hover:border-rose-500': !isDisabled,\n }),\n }\n\n const sizeClasses = {\n large: `h-8 ${isIconOnly ? 'px-[0.4375rem]' : 'px-2.5'} text-sm`,\n small: 'h-6 px-1.5 gap-1 text-xs',\n }\n\n const iconContainer = {\n large: getIconContainerSize('large', ['tertiary', 'ghost'].includes(variant), removeIconContainer),\n small: getIconContainerSize('small', ['tertiary', 'ghost'].includes(variant), removeIconContainer),\n }\n\n const classes = classNames(\n 'group/btn shadow-sm gap-2 font-medium flex relative items-center justify-center outline-none transition-all duration-150 rounded-sm whitespace-nowrap font-lab',\n 'disabled:cursor-not-allowed disabled:opacity-40',\n variantClasses[variant],\n sizeClasses[size],\n {\n 'justify-start w-full': isMenuItem,\n 'w-full': block,\n },\n )\n\n const iconClassVariant = {\n primary: 'text-white',\n secondary: isDisabled ? 'text-gray-500' : 'text-gray-500 group-hover/btn:text-white',\n ghost: 'text-gray-750',\n tertiary: 'text-gray-550',\n destructive: isDisabled ? '' : 'group-hover/btn:text-white',\n }\n\n const iconClass = classNames(iconClassVariant[variant], iconContainer[size], {\n [`${iconClasses}`]: iconClasses,\n })\n\n const tooltipWrapper = (children: ReactElement) =>\n disabled || useLightTooltip ? (\n <LightTooltip\n title={tooltipProps?.disabledTitle || tooltipProps?.title}\n placement={tooltipProps?.placement}\n size={tooltipProps?.size}\n >\n {children}\n </LightTooltip>\n ) : (\n <DarkTooltip title={tooltipProps?.title} placement={tooltipProps?.placement} size={tooltipProps?.size}>\n {children}\n </DarkTooltip>\n )\n\n const iconComp = icon && (\n <div className={iconClass}>\n <IconProvider icon={icon} size={iconSize || iconSizeMap[size]} />\n </div>\n )\n\n const spinnerComp = (\n <div className={iconClass}>\n <IconProvider icon=\"fa-spinner\" className=\"fa-spin\" size={iconSizeMap[size]} />\n </div>\n )\n\n const renderedIcon = loading ? spinnerComp : iconComp\n\n return (\n <Wrapper condition={!!tooltipProps?.title || !!tooltipProps?.disabledTitle} tooltipWrapper={tooltipWrapper}>\n <button\n id={id}\n type={type}\n onClick={onClick}\n className={classes}\n disabled={isDisabled}\n ref={ref}\n data-test={dataTestId}\n >\n {!iconToRight && renderedIcon}\n {text}\n {iconToRight && renderedIcon}\n </button>\n </Wrapper>\n )\n },\n)\n\nconst GhostButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"ghost\" />\n))\n\nconst PrimaryButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"primary\" />\n))\n\nconst SecondaryButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"secondary\" />\n))\n\nconst TertiaryButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"tertiary\" />\n))\n\nconst DestructiveButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"destructive\" />\n))\n\nconst Button = ButtonBase as ButtonComponent\n\nButton.displayName = 'Button'\n\nButton.Ghost = GhostButton\nButton.Primary = PrimaryButton\nButton.Secondary = SecondaryButton\nButton.Tertiary = TertiaryButton\nButton.Destructive = DestructiveButton\n\nexport { Button, DestructiveButton, G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["../../../node_modules/lodash-es/_nativeKeys.js","../../../node_modules/lodash-es/_baseKeys.js","../../../node_modules/lodash-es/_DataView.js","../../../node_modules/lodash-es/_Promise.js","../../../node_modules/lodash-es/_Set.js","../../../node_modules/lodash-es/_WeakMap.js","../../../node_modules/lodash-es/_getTag.js","../../../node_modules/lodash-es/isEmpty.js","../../../src/components/atoms/Button.tsx"],"sourcesContent":["import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n","import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n","import baseKeys from './_baseKeys.js';\nimport getTag from './_getTag.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isArrayLike from './isArrayLike.js';\nimport isBuffer from './isBuffer.js';\nimport isPrototype from './_isPrototype.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\nfunction isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nexport default isEmpty;\n","import React, { ReactElement } from 'react'\nimport _isEmpty from 'lodash-es/isEmpty'\nimport type { FontAwesomeIconProps } from '@fortawesome/react-fontawesome'\n\nimport classNames from '@/utils/classNames'\n\nimport IconProvider from './IconProvider'\nimport { DarkTooltip, LightTooltip, TooltipProps } from './Tooltip'\n\nexport type ButtonSize = 'large' | 'small'\n\nexport interface ButtonProps {\n id?: string\n icon?: FontAwesomeIconProps['icon'] | string\n text?: React.ReactNode | JSX.Element | string\n block?: boolean\n disabled?: boolean\n loading?: boolean\n dataTestId?: string\n iconToRight?: boolean\n variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'destructive'\n size?: ButtonSize\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void\n iconClasses?: string\n type?: 'submit' | 'reset' | 'button'\n tooltipProps?: TooltipProps\n iconSize?: number\n removeIconContainer?: boolean\n isMenuItem?: boolean\n useLightTooltip?: boolean\n className?: string\n autoFocus?: boolean\n}\n\nconst iconSizeMap = {\n small: 0.75,\n large: 0.875,\n}\n\ntype ButtonComponent = React.ForwardRefExoticComponent<ButtonProps> & {\n Ghost: React.ForwardRefExoticComponent<ButtonProps>\n Primary: React.ForwardRefExoticComponent<ButtonProps>\n Secondary: React.ForwardRefExoticComponent<ButtonProps>\n Tertiary: React.ForwardRefExoticComponent<ButtonProps>\n Destructive: React.ForwardRefExoticComponent<ButtonProps>\n}\n\ntype WrapperProps = {\n condition: boolean\n tooltipWrapper: (children: ReactElement) => JSX.Element\n children: ReactElement\n}\n\nconst getIconContainerSize = (size: ButtonSize, isGhostOrTertiary: boolean, removeContainer: boolean) => {\n const baseClasses = 'flex items-center justify-center'\n\n if (isGhostOrTertiary) {\n return size === 'large' ? `h-3.5 w-3.5 ${baseClasses}` : `h-3 w-3 ${baseClasses}`\n }\n\n if (size === 'large') {\n const width = removeContainer ? 'w-2.5' : 'w-4'\n return `h-4 ${width} ${baseClasses}`\n }\n const width = removeContainer ? 'w-1.5' : 'w-2.5'\n return `h-2.5 ${width} ${baseClasses}`\n}\n\nconst Wrapper: React.FC<WrapperProps> = ({ condition, tooltipWrapper, children }) =>\n condition ? tooltipWrapper(children) : <div className={''}>{children}</div>\n\n// TODO: icon related all configs should be clubbed together.\n// Why is iconClasses needed?\n// That control shouldn't be provided.\nconst ButtonBase = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n text,\n icon,\n block = false,\n disabled = false,\n loading = false,\n dataTestId,\n iconToRight = false,\n variant = 'primary',\n size = 'large',\n onClick,\n iconClasses,\n tooltipProps,\n iconSize,\n type,\n removeIconContainer = false,\n isMenuItem,\n id,\n useLightTooltip = false,\n className = '',\n autoFocus = false,\n },\n ref,\n ) => {\n const isDisabled = loading || disabled\n const isIconOnly = _isEmpty(text) && !_isEmpty(icon)\n\n const variantClasses = {\n primary: classNames('bg-gray-1000 text-white dark:text-light-white dark:bg-indigo-600', {\n 'hover:bg-gray-750 dark:hover:bg-indigo-700 group-hover/targeted-button:bg-gray-750 dark:group-hover/targeted-button:bg-indigo-700':\n !isDisabled,\n }),\n secondary: classNames(\n 'bg-white dark:bg-gray-300 text-gray-700 dark:text-light-white border border-gray-250 dark:border-gray-350',\n {\n 'hover:bg-gray-750 hover:text-white hover:border-gray-750 dark:hover:bg-indigo-600 dark:hover:border-indigo-600 group-hover/targeted-button:bg-gray-750 group-hover/targeted-button:text-white group-hover/targeted-button:border-gray-750 dark:group-hover/targeted-button:bg-indigo-600 dark:group-hover/targeted-button:border-indigo-600':\n !isDisabled,\n },\n ),\n ghost: classNames('bg-transparent text-gray-700 border-none shadow-none', {\n 'hover:bg-gray-150 dark:hover:bg-gray-250 group-hover/targeted-button:bg-gray-150 dark:group-hover/targeted-button:bg-gray-250':\n !isDisabled,\n 'dark:hover:bg-gray-350 dark:group-hover/targeted-button:bg-gray-350': !isDisabled && isMenuItem,\n }),\n tertiary: classNames(\n 'bg-white border dark:bg-gray-300 text-gray-550 border-gray-250 font-work dark:text-gray-700 dark:border-gray-400',\n {\n 'hover:border-gray-550 dark:hover:border-gray-700 group-hover/targeted-button:border-gray-550 dark:group-hover/targeted-button:border-gray-700':\n !isDisabled,\n },\n ),\n destructive: classNames(\n 'bg-white text-rose-500 border border-gray-250 dark:bg-rose-600/[.05] dark:border-rose-900',\n {\n 'hover:bg-rose-500 hover:text-light-white hover:border-rose-500 dark:hover:bg-rose-500 dark:hover:border-rose-500 group-hover/targeted-button:bg-rose-500 group-hover/targeted-button:text-light-white dark:group-hover/targeted-button:border-rose-500':\n !isDisabled,\n },\n ),\n }\n const sizeClasses = {\n large: `h-8 ${isIconOnly ? 'px-[0.4375rem]' : 'px-2.5'} text-sm`,\n small: 'h-6 px-1.5 gap-1 text-xs',\n }\n\n const iconContainer = {\n large: getIconContainerSize('large', ['tertiary', 'ghost'].includes(variant), removeIconContainer),\n small: getIconContainerSize('small', ['tertiary', 'ghost'].includes(variant), removeIconContainer),\n }\n\n const classes = classNames(\n 'group/btn shadow-sm gap-2 font-medium flex relative items-center justify-center outline-none transition-all duration-150 rounded-sm whitespace-nowrap font-lab',\n 'disabled:cursor-not-allowed disabled:opacity-40',\n variantClasses[variant],\n sizeClasses[size],\n {\n 'justify-start w-full': isMenuItem,\n 'w-full': block,\n },\n )\n\n const iconClassVariant = {\n primary: 'text-white dark:text-light-white',\n secondary: isDisabled ? 'text-gray-500' : 'text-gray-500 group-hover/btn:text-light-white dark:text-gray-700',\n ghost: 'text-gray-700',\n tertiary: 'text-gray-550 dark:text-gray-700',\n destructive: isDisabled ? '' : 'group-hover/btn:text-white dark:group-hover/btn:text-gray-700',\n }\n\n const iconClass = classNames(iconClassVariant[variant], iconContainer[size], {\n [`${iconClasses}`]: iconClasses,\n })\n\n const tooltipWrapper = (children: ReactElement) =>\n disabled || useLightTooltip ? (\n <LightTooltip\n title={tooltipProps?.disabledTitle || tooltipProps?.title}\n placement={tooltipProps?.placement}\n size={tooltipProps?.size}\n >\n <div>{children}</div>\n </LightTooltip>\n ) : (\n <DarkTooltip title={tooltipProps?.title} placement={tooltipProps?.placement} size={tooltipProps?.size}>\n {children}\n </DarkTooltip>\n )\n\n const iconComp = icon && (\n <div className={iconClass}>\n <IconProvider icon={icon} size={iconSize || iconSizeMap[size]} />\n </div>\n )\n\n const spinnerComp = (\n <div className={iconClass}>\n <IconProvider icon=\"fa-spinner\" className=\"fa-spin\" size={iconSizeMap[size]} />\n </div>\n )\n\n const renderedIcon = loading ? spinnerComp : iconComp\n\n return (\n <Wrapper condition={!!tooltipProps?.title || !!tooltipProps?.disabledTitle} tooltipWrapper={tooltipWrapper}>\n <button\n id={id}\n type={type}\n onClick={onClick}\n className={classNames(classes, className)}\n disabled={isDisabled}\n ref={ref}\n data-test={dataTestId}\n autoFocus={autoFocus}\n >\n {!iconToRight && renderedIcon}\n {text}\n {iconToRight && renderedIcon}\n </button>\n </Wrapper>\n )\n },\n)\n\nconst GhostButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"ghost\" />\n))\n\nconst PrimaryButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"primary\" />\n))\n\nconst SecondaryButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"secondary\" />\n))\n\nconst TertiaryButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"tertiary\" />\n))\n\nconst DestructiveButton = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => (\n <ButtonBase {...props} ref={ref} variant=\"destructive\" />\n))\n\nconst Button = ButtonBase as ButtonComponent\n\nButton.displayName = 'Button'\n\nButton.Ghost = GhostButton\nButton.Primary = PrimaryButton\nButton.Secondary = SecondaryButton\nButton.Tertiary = TertiaryButton\nButton.Destructive = DestructiveButton\n\nexport { Button, DestructiveButton, GhostButton, PrimaryButton, SecondaryButton, TertiaryButton }\nexport default Button\n"],"names":["objectProto","hasOwnProperty","Promise","mapTag","setTag","width","React","_isEmpty"],"mappings":";;;;;;AAGA,IAAI,aAAa,QAAQ,OAAO,MAAM,MAAM;ACC5C,IAAIA,gBAAc,OAAO;AAGzB,IAAIC,mBAAiBD,cAAY;AASjC,SAAS,SAAS,QAAQ;AACxB,MAAI,CAAC,YAAY,MAAM,GAAG;AACxB,WAAO,WAAW,MAAM;AAAA,EAC1B;AACA,MAAI,SAAS,CAAA;AACb,WAAS,OAAO,OAAO,MAAM,GAAG;AAC9B,QAAIC,iBAAe,KAAK,QAAQ,GAAG,KAAK,OAAO,eAAe;AAC5D,aAAO,KAAK,GAAG;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;ACvBA,IAAI,WAAW,UAAU,MAAM,UAAU;ACAzC,IAAIC,YA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AAU,SAAQ,WAAU,CACpD;AAED,MAAM,kBAAkBA,eAAM,WAA2C,CAAC,OAAO,QAC/E,oBAAC,YAAA,EAAY,GAAG,OAAO,KAAU,SAAQ,aAAY,CACtD;AAED,MAAM,iBAAiBA,eAAM,WAA2C,CAAC,OAAO,QAC9E,oBAAC,YAAA,EAAY,GAAG,OAAO,KAAU,SAAQ,YAAW,CACrD;AAED,MAAM,oBAAoBA,eAAM,WAA2C,CAAC,OAAO,QACjF,oBAAC,YAAA,EAAY,GAAG,OAAO,KAAU,SAAQ,eAAc,CACxD;AAED,MAAM,SAAS;AAEf,OAAO,cAAc;AAErB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,cAAc;","x_google_ignoreList":[0,1,2,3,4,5,6,7]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
2
+ import { type IconProp } from '@fortawesome/fontawesome-svg-core';
3
3
  interface IconButtonProps {
4
4
  icon: string | IconProp;
5
5
  onClick?: (e: React.MouseEvent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.es.js","sources":["../../../src/components/atoms/IconButton.tsx"],"sourcesContent":["import React from 'react'\nimport { IconProp } from '@fortawesome/fontawesome-svg-core'\n\nimport classNames from '@/utils/classNames'\n\nimport IconProvider from './IconProvider'\nimport { DarkTooltip } from './Tooltip'\n\ninterface IconButtonProps {\n icon: string | IconProp\n onClick?: (e: React.MouseEvent) => void\n iconSize?: number\n disabled?: boolean\n tooltip?: string\n}\n\nconst IconButton: React.FC<IconButtonProps> = ({ icon, iconSize, onClick, disabled, tooltip }) => {\n const classes = classNames('text-gray-450 hover:text-gray-750 cursor-pointer w-3', {\n 'text-gray-450 hover:text-gray-450 pointer-event-none opacity-40': disabled,\n })\n\n return (\n <DarkTooltip title={tooltip}>\n <span className=\"leading-none\">\n <IconProvider icon={icon} size={iconSize} onClick={onClick} className={classes} />\n </span>\n </DarkTooltip>\n )\n}\n\nexport default IconButton\n"],"names":[],"mappings":";;;;AAgBA,MAAM,aAAwC,CAAC,EAAE,MAAM,UAAU,SAAS,UAAU,cAAc;AAChG,QAAM,UAAU,WAAW,wDAAwD;AAAA,IACjF,mEAAmE;AAAA,EAAA,CACpE;AAED,6BACG,aAAA,EAAY,OAAO,SAClB,UAAA,oBAAC,UAAK,WAAU,gBACd,UAAA,oBAAC,cAAA,EAAa,MAAY,MAAM,UAAU,SAAkB,WAAW,QAAA,CAAS,GAClF,GACF;AAEJ;"}
1
+ {"version":3,"file":"IconButton.es.js","sources":["../../../src/components/atoms/IconButton.tsx"],"sourcesContent":["import React from 'react'\nimport { type IconProp } from '@fortawesome/fontawesome-svg-core'\n\nimport classNames from '@/utils/classNames'\n\nimport IconProvider from './IconProvider'\nimport { DarkTooltip } from './Tooltip'\n\ninterface IconButtonProps {\n icon: string | IconProp\n onClick?: (e: React.MouseEvent) => void\n iconSize?: number\n disabled?: boolean\n tooltip?: string\n}\n\nconst IconButton: React.FC<IconButtonProps> = ({ icon, iconSize, onClick, disabled, tooltip }) => {\n const classes = classNames('text-gray-450 hover:text-gray-750 cursor-pointer w-3', {\n 'text-gray-450 hover:text-gray-450 pointer-event-none opacity-40': disabled,\n })\n\n return (\n <DarkTooltip title={tooltip}>\n <span className=\"leading-none\">\n <IconProvider icon={icon} size={iconSize} onClick={onClick} className={classes} />\n </span>\n </DarkTooltip>\n )\n}\n\nexport default IconButton\n"],"names":[],"mappings":";;;;AAgBA,MAAM,aAAwC,CAAC,EAAE,MAAM,UAAU,SAAS,UAAU,cAAc;AAChG,QAAM,UAAU,WAAW,wDAAwD;AAAA,IACjF,mEAAmE;AAAA,EAAA,CACpE;AAED,6BACG,aAAA,EAAY,OAAO,SAClB,UAAA,oBAAC,UAAK,WAAU,gBACd,UAAA,oBAAC,cAAA,EAAa,MAAY,MAAM,UAAU,SAAkB,WAAW,QAAA,CAAS,GAClF,GACF;AAEJ;"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
2
+ import { IconProp as FontAwesomeIconProp } from '@fortawesome/fontawesome-svg-core';
3
3
  import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
4
4
  type ImgIconMap = {
5
5
  [key: string]: string;
@@ -10,8 +10,9 @@ type CustomIconMap = {
10
10
  [key: string]: React.LazyExoticComponent<CustomIcon> | CustomIcon;
11
11
  };
12
12
  export declare const registerIcons: (iconMap: CustomIconMap) => void;
13
+ export type IconProp = string | FontAwesomeIconProp;
13
14
  interface IconProps {
14
- icon: string | IconProp;
15
+ icon: IconProp;
15
16
  color?: string;
16
17
  className?: string;
17
18
  onClick?: (e: React.MouseEvent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"IconProvider.es.js","sources":["../../../src/components/atoms/IconProvider.tsx"],"sourcesContent":["import React, { ForwardedRef, forwardRef, Suspense } from 'react'\nimport { IconProp } from '@fortawesome/fontawesome-svg-core'\nimport { FontAwesomeIcon, FontAwesomeIconProps } from '@fortawesome/react-fontawesome'\n\nimport classNames from '@/utils/classNames'\n\nimport useTheme from '../theme/useTheme'\n\ntype ImgIconMap = { [key: string]: string }\nconst IMG_ICONS_MAP: ImgIconMap = {}\nexport const registerImgIcons = (iconMap: ImgIconMap) => {\n Object.assign(IMG_ICONS_MAP, iconMap)\n}\n\ntype CustomIcon = React.ComponentType<CustomIconProps>\ntype CustomIconMap = {\n [key: string]: React.LazyExoticComponent<CustomIcon> | CustomIcon\n}\nconst CUSTOM_ICONS_MAP: CustomIconMap = {}\nexport const registerIcons = (iconMap: CustomIconMap) => {\n Object.assign(CUSTOM_ICONS_MAP, iconMap)\n}\n\nconst FA_ICON_ALIAS_MAP: { readonly [key: string]: string } = {\n github: 'fa-brands fa-github',\n gitlab: 'fa-brands fa-gitlab',\n bitbucket: 'fa-brands fa-bitbucket',\n jenkins: 'fa-brands fa-jenkins',\n}\n\ninterface IconProps {\n icon: string | IconProp\n color?: string\n className?: string\n onClick?: (e: React.MouseEvent) => void\n size?: number\n width?: number\n forwardedRef?: React.Ref<HTMLElement>\n nativeProps?: Partial<FontAwesomeIconProps>\n}\n\ntype CustomIconProps = {\n onClick?: (e: React.MouseEvent) => void\n className?: string\n style?: React.CSSProperties\n}\ntype DynamicIconProps = CustomIconProps & {\n name: string\n}\n\nconst DynamicIcon = ({ name, ...props }: DynamicIconProps) => {\n const IconToRender = CUSTOM_ICONS_MAP[name]\n return (\n <Suspense fallback={<span />}>\n <IconToRender {...props} />\n </Suspense>\n )\n}\n\nfunction addDarkSuffix(url: string): string {\n const urlObj = new URL(url)\n const parts = urlObj.pathname.split('/')\n const filename = parts.pop()\n\n if (!filename) {\n return url + '-dark'\n }\n\n const dotIndex = filename.lastIndexOf('.')\n let newFilename: string\n\n if (dotIndex !== -1) {\n newFilename = filename.slice(0, dotIndex) + '-dark' + filename.slice(dotIndex)\n } else {\n newFilename = filename + '-dark'\n }\n\n parts.push(newFilename)\n urlObj.pathname = parts.join('/')\n return urlObj.toString()\n}\n\nconst IconProvider = ({\n icon,\n color,\n size = 0.75,\n width,\n className,\n onClick,\n forwardedRef,\n nativeProps = {},\n}: IconProps) => {\n const { isDark } = useTheme()\n let themeAwareImgIcon: string | null = null\n let fallbackImgIcon: string | null = null\n\n if (typeof icon === 'string' && icon.startsWith('http')) {\n themeAwareImgIcon = isDark ? addDarkSuffix(icon) : icon\n fallbackImgIcon = icon\n } else if (typeof icon === 'string' && IMG_ICONS_MAP[icon as string]) {\n themeAwareImgIcon = isDark\n ? IMG_ICONS_MAP[`${icon}-dark`] ?? IMG_ICONS_MAP[icon as string]\n : IMG_ICONS_MAP[icon as string]\n fallbackImgIcon = IMG_ICONS_MAP[icon as string]\n } else if (Array.isArray(icon) && icon[1] && IMG_ICONS_MAP[icon[1] as string]) {\n themeAwareImgIcon = isDark\n ? IMG_ICONS_MAP[`${icon[1]}-dark`] ?? IMG_ICONS_MAP[icon[1] as string]\n : IMG_ICONS_MAP[icon[1] as string]\n fallbackImgIcon = IMG_ICONS_MAP[icon[1] as string]\n }\n\n const faIcon = FA_ICON_ALIAS_MAP[icon as string] || icon\n\n const iconStyles = width ? { width: `${width}rem`, height: 'auto' } : { height: `${size}rem`, width: 'auto' }\n\n return themeAwareImgIcon ? (\n <img\n ref={forwardedRef as React.ForwardedRef<HTMLImageElement>}\n src={themeAwareImgIcon}\n style={iconStyles}\n className={classNames(className)}\n onClick={onClick}\n onError={(e) => {\n e.currentTarget.src = fallbackImgIcon as string\n }}\n />\n ) : CUSTOM_ICONS_MAP[icon as string] ? (\n <DynamicIcon onClick={onClick} style={{ ...iconStyles, color }} name={String(icon)} className={className} />\n ) : (\n <FontAwesomeIcon\n ref={forwardedRef as ForwardedRef<SVGSVGElement>}\n icon={faIcon as IconProp}\n style={{ color, fontSize: `${width ?? size}rem` }}\n className={classNames('text-xs', className)}\n onClick={onClick}\n {...nativeProps}\n />\n )\n}\n\nexport default React.memo(\n forwardRef<HTMLElement, IconProps>((props, ref) => <IconProvider {...props} forwardedRef={ref} />),\n)\n"],"names":["React"],"mappings":";;;;;AASA,MAAM,gBAA4B,CAAA;AAC3B,MAAM,mBAAmB,CAAC,YAAwB;AACvD,SAAO,OAAO,eAAe,OAAO;AACtC;AAMA,MAAM,mBAAkC,CAAA;AACjC,MAAM,gBAAgB,CAAC,YAA2B;AACvD,SAAO,OAAO,kBAAkB,OAAO;AACzC;AAEA,MAAM,oBAAwD;AAAA,EAC5D,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS;AACX;AAsBA,MAAM,cAAc,CAAC,EAAE,MAAM,GAAG,YAA8B;AAC5D,QAAM,eAAe,iBAAiB,IAAI;AAC1C,SACE,oBAAC,UAAA,EAAS,UAAU,oBAAC,QAAA,CAAA,CAAK,GACxB,UAAA,oBAAC,cAAA,EAAc,GAAG,MAAA,CAAO,EAAA,CAC3B;AAEJ;AAEA,SAAS,cAAc,KAAqB;AAC1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AEpD,QAAM,aAAa,QAAQ,EAAE,OAAO,GAAG,KAAK,OAAO,QAAQ,OAAA,IAAW,EAAE,QAAQ,GAAG,IAAI,OAAO,OAAO,OAAA;AAErG,SAAO,oBACL;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,WAAW,WAAW,SAAS;AAAA,MAC/B;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,cAAc,MAAM;AAAA,MACxB;AAAA,IAAA;AAAA,EAAA,IAEA,iBAAiB,IAAc,IACjC,oBAAC,aAAA,EAAY,SAAkB,OAAO,EAAE,GAAG,YAAY,SAAS,MAAM,OAAO,IAAI,GAAG,WAAsB,IAE1G;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,UAAU,GAAG,SAAS,IAAI,MAAA;AAAA,MAC1C,WAAW,WAAW,WAAW,SAAS;AAAA,MAC1C;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,MAAA,iBAAeA,eAAM;AAAA,EACnB,WAAmC,CAAC,OAAO,QAAQ,oBAAC,gBAAc,GAAG,OAAO,cAAc,KAAK,CAAE;AACnG;"}
1
+ {"version":3,"file":"IconProvider.es.js","sources":["../../../src/components/atoms/IconProvider.tsx"],"sourcesContent":["import React, { ForwardedRef, forwardRef, Suspense } from 'react'\nimport { IconProp as FontAwesomeIconProp } from '@fortawesome/fontawesome-svg-core'\nimport { FontAwesomeIcon, FontAwesomeIconProps } from '@fortawesome/react-fontawesome'\n\nimport classNames from '@/utils/classNames'\n\nimport useTheme from '../theme/useTheme'\n\ntype ImgIconMap = { [key: string]: string }\nconst IMG_ICONS_MAP: ImgIconMap = {}\nexport const registerImgIcons = (iconMap: ImgIconMap) => {\n Object.assign(IMG_ICONS_MAP, iconMap)\n}\n\ntype CustomIcon = React.ComponentType<CustomIconProps>\ntype CustomIconMap = {\n [key: string]: React.LazyExoticComponent<CustomIcon> | CustomIcon\n}\nconst CUSTOM_ICONS_MAP: CustomIconMap = {}\nexport const registerIcons = (iconMap: CustomIconMap) => {\n Object.assign(CUSTOM_ICONS_MAP, iconMap)\n}\n\nconst FA_ICON_ALIAS_MAP: { readonly [key: string]: string } = {\n github: 'fa-brands fa-github',\n gitlab: 'fa-brands fa-gitlab',\n bitbucket: 'fa-brands fa-bitbucket',\n jenkins: 'fa-brands fa-jenkins',\n}\n\nexport type IconProp = string | FontAwesomeIconProp\n\ninterface IconProps {\n icon: IconProp\n color?: string\n className?: string\n onClick?: (e: React.MouseEvent) => void\n size?: number\n width?: number\n forwardedRef?: React.Ref<HTMLElement>\n nativeProps?: Partial<FontAwesomeIconProps>\n}\n\ntype CustomIconProps = {\n onClick?: (e: React.MouseEvent) => void\n className?: string\n style?: React.CSSProperties\n}\ntype DynamicIconProps = CustomIconProps & {\n name: string\n}\n\nconst DynamicIcon = ({ name, ...props }: DynamicIconProps) => {\n const IconToRender = CUSTOM_ICONS_MAP[name]\n return (\n <Suspense fallback={<span />}>\n <IconToRender {...props} />\n </Suspense>\n )\n}\n\nfunction addDarkSuffix(url: string): string {\n const urlObj = new URL(url)\n const parts = urlObj.pathname.split('/')\n const filename = parts.pop()\n\n if (!filename) {\n return url + '-dark'\n }\n\n const dotIndex = filename.lastIndexOf('.')\n let newFilename: string\n\n if (dotIndex !== -1) {\n newFilename = filename.slice(0, dotIndex) + '-dark' + filename.slice(dotIndex)\n } else {\n newFilename = filename + '-dark'\n }\n\n parts.push(newFilename)\n urlObj.pathname = parts.join('/')\n return urlObj.toString()\n}\n\nconst IconProvider = ({\n icon,\n color,\n size = 0.75,\n width,\n className,\n onClick,\n forwardedRef,\n nativeProps = {},\n}: IconProps) => {\n const { isDark } = useTheme()\n let themeAwareImgIcon: string | null = null\n let fallbackImgIcon: string | null = null\n\n if (typeof icon === 'string' && icon.startsWith('http')) {\n themeAwareImgIcon = isDark ? addDarkSuffix(icon) : icon\n fallbackImgIcon = icon\n } else if (typeof icon === 'string' && IMG_ICONS_MAP[icon as string]) {\n themeAwareImgIcon = isDark\n ? IMG_ICONS_MAP[`${icon}-dark`] ?? IMG_ICONS_MAP[icon as string]\n : IMG_ICONS_MAP[icon as string]\n fallbackImgIcon = IMG_ICONS_MAP[icon as string]\n } else if (Array.isArray(icon) && icon[1] && IMG_ICONS_MAP[icon[1] as string]) {\n themeAwareImgIcon = isDark\n ? IMG_ICONS_MAP[`${icon[1]}-dark`] ?? IMG_ICONS_MAP[icon[1] as string]\n : IMG_ICONS_MAP[icon[1] as string]\n fallbackImgIcon = IMG_ICONS_MAP[icon[1] as string]\n }\n\n const faIcon = FA_ICON_ALIAS_MAP[icon as string] || icon\n\n const iconStyles = width ? { width: `${width}rem`, height: 'auto' } : { height: `${size}rem`, width: 'auto' }\n\n return themeAwareImgIcon ? (\n <img\n ref={forwardedRef as React.ForwardedRef<HTMLImageElement>}\n src={themeAwareImgIcon}\n style={iconStyles}\n className={classNames(className)}\n onClick={onClick}\n onError={(e) => {\n e.currentTarget.src = fallbackImgIcon as string\n }}\n />\n ) : CUSTOM_ICONS_MAP[icon as string] ? (\n <DynamicIcon onClick={onClick} style={{ ...iconStyles, color }} name={String(icon)} className={className} />\n ) : (\n <FontAwesomeIcon\n ref={forwardedRef as ForwardedRef<SVGSVGElement>}\n icon={faIcon as FontAwesomeIconProp}\n style={{ color, fontSize: `${width ?? size}rem` }}\n className={classNames('text-xs', className)}\n onClick={onClick}\n {...nativeProps}\n />\n )\n}\n\nexport default React.memo(\n forwardRef<HTMLElement, IconProps>((props, ref) => <IconProvider {...props} forwardedRef={ref} />),\n)\n"],"names":["React"],"mappings":";;;;;AASA,MAAM,gBAA4B,CAAA;AAC3B,MAAM,mBAAmB,CAAC,YAAwB;AACvD,SAAO,OAAO,eAAe,OAAO;AACtC;AAMA,MAAM,mBAAkC,CAAA;AACjC,MAAM,gBAAgB,CAAC,YAA2B;AACvD,SAAO,OAAO,k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
5
+ icon?: React.ReactNode | JSX.Element | string;
6
+ dataTestPrefix?: string;
7
+ };
8
+ export declare const Toast: React.FC<ToastProps>;
9
+ export {};
@@ -0,0 +1,6 @@
1
+ import "react/jsx-runtime";
2
+ import { T } from "../../Notification-BT4CZ69U.js";
3
+ export {
4
+ T as Toast
5
+ };
6
+ //# sourceMappingURL=Notification.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notification.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -4,7 +4,7 @@ const Spinner = ({ className, small, big, medium, center, type = "normal" }) =>
4
4
  const isDefault = () => type === "normal";
5
5
  const classes = classNames({
6
6
  "animate-spin ease-linear rounded-full overflow-hidden": true,
7
- "border-gray-200 btop": isDefault(),
7
+ "border-gray-200 border-t-indigo-600": isDefault(),
8
8
  "border-4 border-t-4 h-8 w-8": isDefault() && !small && !medium && !big,
9
9
  "h-4 w-4": small,
10
10
  "border-2 border-t-2": isDefault() && small,
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.es.js","sources":["../../../src/components/atoms/Spinner.tsx"],"sourcesContent":["import React from 'react'\n\nimport classNames from '@/utils/classNames'\n\nexport interface SpinnerProps {\n className?: string\n small?: boolean\n big?: boolean\n medium?: boolean\n center?: boolean\n type?: 'normal'\n}\nconst Spinner: React.FC<SpinnerProps> = ({ className, small, big, medium, center, type = 'normal' }) => {\n const isDefault = () => type === 'normal'\n\n const classes = classNames({\n 'animate-spin ease-linear rounded-full overflow-hidden': true,\n 'border-gray-200 btop': isDefault(),\n 'border-4 border-t-4 h-8 w-8': isDefault() && !small && !medium && !big,\n 'h-4 w-4': small,\n 'border-2 border-t-2': isDefault() && small,\n 'h-12 w-12': medium,\n 'border-4 border-t-4': isDefault() && medium,\n 'h-20 w-20': big,\n 'border-8 border-t-8 ': isDefault() && big,\n 'm-auto': center,\n [`${className}`]: className,\n })\n\n switch (type) {\n default:\n return (\n <div className={classes} role=\"status\">\n <span className=\"invisible\">Loading...</span>\n </div>\n )\n }\n}\n\nexport default Spinner\n"],"names":[],"mappings":";;AAYA,MAAM,UAAkC,CAAC,EAAE,WAAW,OAAO,KAAK,QAAQ,QAAQ,OAAO,eAAe;AACtG,QAAM,YAAY,MAAM,SAAS;AAEjC,QAAM,UAAU,WAAW;AAAA,IACzB,yDAAyD;AAAA,IACzD,wBAAwB,UAAA;AAAA,IACxB,+BAA+B,UAAA,KAAe,CAAC,SAAS,CAAC,UAAU,CAAC;AAAA,IACpE,WAAW;AAAA,IACX,uBAAuB,eAAe;AAAA,IACtC,aAAa;AAAA,IACb,uBAAuB,eAAe;AAAA,IACtC,aAAa;AAAA,IACb,wBAAwB,eAAe;AAAA,IACvC,UAAU;AAAA,IACV,CAAC,GAAG,SAAS,EAAE,GAAG;AAAA,EAAA,CACnB;AAED,UAAQ,MAAA;AAAA,IACN;AACE,aACE,oBAAC,OAAA,EAAI,WAAW,SAAS,MAAK,UAC5B,UAAA,oBAAC,QAAA,EAAK,WAAU,aAAY,UAAA,aAAA,CAAU,GACxC;AAAA,EAAA;AAGR;"}
1
+ {"version":3,"file":"Spinner.es.js","sources":["../../../src/components/atoms/Spinner.tsx"],"sourcesContent":["import React from 'react'\n\nimport classNames from '@/utils/classNames'\n\nexport interface SpinnerProps {\n className?: string\n small?: boolean\n big?: boolean\n medium?: boolean\n center?: boolean\n type?: 'normal'\n}\nconst Spinner: React.FC<SpinnerProps> = ({ className, small, big, medium, center, type = 'normal' }) => {\n const isDefault = () => type === 'normal'\n\n const classes = classNames({\n 'animate-spin ease-linear rounded-full overflow-hidden': true,\n 'border-gray-200 border-t-indigo-600': isDefault(),\n 'border-4 border-t-4 h-8 w-8': isDefault() && !small && !medium && !big,\n 'h-4 w-4': small,\n 'border-2 border-t-2': isDefault() && small,\n 'h-12 w-12': medium,\n 'border-4 border-t-4': isDefault() && medium,\n 'h-20 w-20': big,\n 'border-8 border-t-8 ': isDefault() && big,\n 'm-auto': center,\n [`${className}`]: className,\n })\n\n switch (type) {\n default:\n return (\n <div className={classes} role=\"status\">\n <span className=\"invisible\">Loading...</span>\n </div>\n )\n }\n}\n\nexport default Spinner\n"],"names":[],"mappings":";;AAYA,MAAM,UAAkC,CAAC,EAAE,WAAW,OAAO,KAAK,QAAQ,QAAQ,OAAO,eAAe;AACtG,QAAM,YAAY,MAAM,SAAS;AAEjC,QAAM,UAAU,WAAW;AAAA,IACzB,yDAAyD;AAAA,IACzD,uCAAuC,UAAA;AAAA,IACvC,+BAA+B,UAAA,KAAe,CAAC,SAAS,CAAC,UAAU,CAAC;AAAA,IACpE,WAAW;AAAA,IACX,uBAAuB,eAAe;AAAA,IACtC,aAAa;AAAA,IACb,uBAAuB,eAAe;AAAA,IACtC,aAAa;AAAA,IACb,wBAAwB,eAAe;AAAA,IACvC,UAAU;AAAA,IACV,CAAC,GAAG,SAAS,EAAE,GAAG;AAAA,EAAA,CACnB;AAED,UAAQ,MAAA;AAAA,IACN;AACE,aACE,oBAAC,OAAA,EAAI,WAAW,SAAS,MAAK,UAC5B,UAAA,oBAAC,QAAA,EAAK,WAAU,aAAY,UAAA,aAAA,CAAU,GACxC;AAAA,EAAA;AAGR;"}
@@ -0,0 +1,16 @@
1
+ import { Theme } from '@mui/material';
2
+ import { MUIStyledCommonProps } from '@mui/system';
3
+ import { SwitchProps } from '@mui/material/Switch';
4
+ import { StyledComponent } from '@emotion/styled';
5
+ /// <reference types="react" />
6
+ interface InputHTMLAttributesExtended extends React.InputHTMLAttributes<HTMLInputElement> {
7
+ 'data-test'?: string;
8
+ }
9
+ export interface StyledSwitchProps {
10
+ inputProps?: InputHTMLAttributesExtended;
11
+ widthMultiple?: number;
12
+ heightMultiple?: number;
13
+ thumbWidthMultiple?: number;
14
+ }
15
+ declare const Switch: StyledComponent<SwitchProps & MUIStyledCommonProps<Theme> & StyledSwitchProps, {}, {}>;
16
+ export default Switch;
@@ -0,0 +1,79 @@
1
+ import styled from "@mui/material/styles/styled";
2
+ import NativeSwitch from "@mui/material/Switch";
3
+ import { colors } from "../theme/theme.es.js";
4
+ import { useTheme } from "../theme/useTheme.es.js";
5
+ import { useContext, createContext } from "react";
6
+ const getRootFontSize = () => {
7
+ const width = window.innerWidth;
8
+ switch (true) {
9
+ case width >= 3840:
10
+ return 32;
11
+ case width >= 2880:
12
+ return 24;
13
+ case width >= 2400:
14
+ return 20;
15
+ default:
16
+ return 16;
17
+ }
18
+ };
19
+ const RootFontSizeContext = createContext({
20
+ rootFontSize: getRootFontSize()
21
+ });
22
+ const useRootFontSize = () => useContext(RootFontSizeContext);
23
+ const getDimensions = (widthMultiple, heightMultiple, thumbWidthMultiple, rootFontSize) => {
24
+ const WIDTH = widthMultiple * rootFontSize;
25
+ const HEIGHT = heightMultiple * rootFontSize;
26
+ const THUMB_WIDTH = thumbWidthMultiple * rootFontSize;
27
+ return { WIDTH, HEIGHT, THUMB_WIDTH };
28
+ };
29
+ const Switch = styled(NativeSwitch, {
30
+ shouldForwardProp: (prop) => !["widthMultiple", "heightMultiple", "thumbWidthMultiple"].includes(prop)
31
+ })(({ theme, widthMultiple = 2, heightMultiple = 1, thumbWidthMultiple = 0.9375 }) => {
32
+ const { isDark } = useTheme();
33
+ const { rootFontSize } = useRootFontSize();
34
+ const { WIDTH, HEIGHT, THUMB_WIDTH } = getDimensions(widthMultiple, heightMultiple, thumbWidthMultiple, rootFontSize);
35
+ return {
36
+ width: WIDTH,
37
+ height: HEIGHT,
38
+ padding: 0,
39
+ display: "flex",
40
+ "&:active": {
41
+ "& .MuiSwitch-thumb": {
42
+ width: THUMB_WIDTH
43
+ },
44
+ "& .MuiSwitch-switchBase.Mui-checked": {
45
+ transform: "translateX(1rem)"
46
+ }
47
+ },
48
+ "& .MuiSwitch-switchBase": {
49
+ padding: 2,
50
+ "&.Mui-checked": {
51
+ transform: `translateX(${WIDTH - THUMB_WIDTH - 1}px)`,
52
+ color: "#fff",
53
+ "& + .MuiSwitch-track": {
54
+ opacity: 1,
55
+ background: isDark ? colors.indigo[500] : "radial-gradient(84.37% 84.37% at 50% 100%, #2900CE 0%, #5429FF 100%), linear-gradient(0deg, #5501E1 40.19%, #2F5FFF 111.1%)"
56
+ }
57
+ }
58
+ },
59
+ "& .MuiSwitch-thumb": {
60
+ boxShadow: "0 0.125rem 0.25rem 0 rgb(0 35 11 / 20%)",
61
+ width: "0.75rem",
62
+ height: "0.75rem",
63
+ borderRadius: "0.375rem",
64
+ transition: theme.transitions.create(["width"], {
65
+ duration: 200
66
+ })
67
+ },
68
+ "& .MuiSwitch-track": {
69
+ borderRadius: "0.5rem",
70
+ opacity: 1,
71
+ backgroundColor: isDark ? colors.gray[500] : colors.gray[200],
72
+ boxSizing: "border-box"
73
+ }
74
+ };
75
+ });
76
+ export {
77
+ Switch as default
78
+ };
79
+ //# sourceMappingURL=Switch.es.js.map