tfy-web-components 0.0.1
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/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/..d.ts +31 -0
- package/dist/Button.d.ts +62 -0
- package/dist/CustomDrawer.d.ts +30 -0
- package/dist/IconButton.d.ts +15 -0
- package/dist/IconProvider.d.ts +39 -0
- package/dist/Spinner.d.ts +15 -0
- package/dist/Tooltip.d.ts +28 -0
- package/dist/classNames-f3c6f58e.js +9 -0
- package/dist/classNames-f3c6f58e.js.map +1 -0
- package/dist/components/atoms/Button.d.ts +42 -0
- package/dist/components/atoms/Button.es.js +147 -0
- package/dist/components/atoms/Button.es.js.map +1 -0
- package/dist/components/atoms/IconButton.d.ts +11 -0
- package/dist/components/atoms/IconButton.es.js +20 -0
- package/dist/components/atoms/IconButton.es.js.map +1 -0
- package/dist/components/atoms/IconProvider.d.ts +29 -0
- package/dist/components/atoms/IconProvider.es.js +67 -0
- package/dist/components/atoms/IconProvider.es.js.map +1 -0
- package/dist/components/atoms/Spinner.d.ts +11 -0
- package/dist/components/atoms/Spinner.es.js +28 -0
- package/dist/components/atoms/Spinner.es.js.map +1 -0
- package/dist/components/atoms/Tooltip.d.ts +21 -0
- package/dist/components/atoms/Tooltip.es.js +118 -0
- package/dist/components/atoms/Tooltip.es.js.map +1 -0
- package/dist/components/molecules/CustomDrawer.d.ts +24 -0
- package/dist/components/molecules/CustomDrawer.es.js +114 -0
- package/dist/components/molecules/CustomDrawer.es.js.map +1 -0
- package/dist/index.es.js +13 -0
- package/dist/index.es.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [Truefoundry]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# TrueFoundry Web Components
|
|
2
|
+
|
|
3
|
+
## Structure/Elements
|
|
4
|
+
|
|
5
|
+
- ⚛️ [React 18](https://reactjs.org/)
|
|
6
|
+
- 📚 [Storybook 8](https://storybook.js.org/) - Components preview
|
|
7
|
+
- 🖌️ [Tailwind CSS 3](https://tailwindcss.com/)
|
|
8
|
+
- ⏩ [Vite](https://vitejs.dev/) - Run and build the project blazingly fast!
|
|
9
|
+
- ⚡ [Vitest](https://vitest.dev/) - Components Unit Testing
|
|
10
|
+
- 📐 [ESLint](https://eslint.org/) & [Prettier](https://prettier.io/) - Formatting and Linting
|
|
11
|
+
- 🌟 [Typescript](https://www.typescriptlang.org/)
|
|
12
|
+
- 🐶 [Husky](https://typicode.github.io/husky) & [Lint Staged](https://www.npmjs.com/package/lint-staged) - Pre-commit Hooks
|
|
13
|
+
|
|
14
|
+
## Main Scripts
|
|
15
|
+
|
|
16
|
+
Always prepending yarn:
|
|
17
|
+
|
|
18
|
+
- `dev`: Bootstrap the Storybook preview with Hot Reload.
|
|
19
|
+
- `build`: Builds the static storybook project.
|
|
20
|
+
- `build:lib`: Builds the component library into the **dist** folder.
|
|
21
|
+
- `lint:fix`: Applies linting based on the rules defined in **.eslintrc.js**.
|
|
22
|
+
- `format:prettier`: Formats files using the prettier rules defined in **.prettierrc**.
|
|
23
|
+
- `test`: Runs testing using watch mode.
|
|
24
|
+
- `test:cov`: Runs testing displaying a coverage report.
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
[MIT](LICENSE)
|
package/dist/..d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { default as React_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const CustomDrawer: React_2.FC<DrawerProps>;
|
|
4
|
+
|
|
5
|
+
declare interface DrawerProps {
|
|
6
|
+
children: React_2.ReactNode | JSX.Element | string;
|
|
7
|
+
anchor?: 'right' | 'left' | 'top' | 'bottom' | undefined;
|
|
8
|
+
open: boolean;
|
|
9
|
+
inner?: boolean;
|
|
10
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
11
|
+
width?: string;
|
|
12
|
+
bodyClassName?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
overflowY?: boolean;
|
|
15
|
+
confirmOnClose?: boolean;
|
|
16
|
+
confirmOnCloseMessage?: string;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare const Spinner: React_2.FC<SpinnerProps>;
|
|
21
|
+
|
|
22
|
+
declare interface SpinnerProps {
|
|
23
|
+
className?: string;
|
|
24
|
+
small?: boolean;
|
|
25
|
+
big?: boolean;
|
|
26
|
+
medium?: boolean;
|
|
27
|
+
center?: boolean;
|
|
28
|
+
type?: 'normal';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { }
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
2
|
+
import { default as React_2 } from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { TooltipProps as TooltipProps_2 } from '@mui/material/Tooltip';
|
|
5
|
+
|
|
6
|
+
declare const Button: ButtonComponent;
|
|
7
|
+
export { Button }
|
|
8
|
+
export default Button;
|
|
9
|
+
|
|
10
|
+
declare type ButtonComponent = React_2.ForwardRefExoticComponent<ButtonProps> & {
|
|
11
|
+
Ghost: React_2.ForwardRefExoticComponent<ButtonProps>;
|
|
12
|
+
Primary: React_2.ForwardRefExoticComponent<ButtonProps>;
|
|
13
|
+
Secondary: React_2.ForwardRefExoticComponent<ButtonProps>;
|
|
14
|
+
Tertiary: React_2.ForwardRefExoticComponent<ButtonProps>;
|
|
15
|
+
Destructive: React_2.ForwardRefExoticComponent<ButtonProps>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export declare interface ButtonProps {
|
|
19
|
+
id?: string;
|
|
20
|
+
icon?: FontAwesomeIconProps['icon'] | string;
|
|
21
|
+
text?: React_2.ReactNode | JSX.Element | string;
|
|
22
|
+
block?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
dataTestId?: string;
|
|
26
|
+
iconToRight?: boolean;
|
|
27
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'destructive';
|
|
28
|
+
size?: ButtonSize;
|
|
29
|
+
onClick?: (e: React_2.MouseEvent<HTMLButtonElement>) => void;
|
|
30
|
+
iconClasses?: string;
|
|
31
|
+
type?: 'submit' | 'reset' | 'button';
|
|
32
|
+
tooltipProps?: TooltipProps;
|
|
33
|
+
iconSize?: number;
|
|
34
|
+
removeIconContainer?: boolean;
|
|
35
|
+
isMenuItem?: boolean;
|
|
36
|
+
useLightTooltip?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare type ButtonSize = 'large' | 'small';
|
|
40
|
+
|
|
41
|
+
declare type CustomTooltipProps = TooltipProps_2 & {
|
|
42
|
+
size?: Sizes;
|
|
43
|
+
border?: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export declare const DestructiveButton: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
47
|
+
|
|
48
|
+
export declare const GhostButton: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
49
|
+
|
|
50
|
+
export declare const PrimaryButton: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
51
|
+
|
|
52
|
+
export declare const SecondaryButton: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
53
|
+
|
|
54
|
+
declare type Sizes = 'large' | 'variable' | 'medium' | 'fit';
|
|
55
|
+
|
|
56
|
+
export declare const TertiaryButton: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
57
|
+
|
|
58
|
+
declare type TooltipProps = Partial<Pick<CustomTooltipProps, 'title' | 'placement' | 'size'>> & {
|
|
59
|
+
disabledTitle?: ReactNode;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as React_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
declare type ContextType = {
|
|
4
|
+
isPreventEscape?: boolean;
|
|
5
|
+
confirmOnClose?: boolean;
|
|
6
|
+
onEscape?: () => void;
|
|
7
|
+
updateDrawerContext?: (_?: ContextType, clearState?: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
declare const CustomDrawer: React_2.FC<DrawerProps>;
|
|
11
|
+
export default CustomDrawer;
|
|
12
|
+
|
|
13
|
+
export declare const CustomDrawerContext: React_2.Context<ContextType>;
|
|
14
|
+
|
|
15
|
+
declare interface DrawerProps {
|
|
16
|
+
children: React_2.ReactNode | JSX.Element | string;
|
|
17
|
+
anchor?: 'right' | 'left' | 'top' | 'bottom' | undefined;
|
|
18
|
+
open: boolean;
|
|
19
|
+
inner?: boolean;
|
|
20
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
21
|
+
width?: string;
|
|
22
|
+
bodyClassName?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
overflowY?: boolean;
|
|
25
|
+
confirmOnClose?: boolean;
|
|
26
|
+
confirmOnCloseMessage?: string;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { default as React_2 } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const IconButton: React_2.FC<IconButtonProps>;
|
|
5
|
+
export default IconButton;
|
|
6
|
+
|
|
7
|
+
declare interface IconButtonProps {
|
|
8
|
+
icon: string | IconProp;
|
|
9
|
+
onClick?: (e: React_2.MouseEvent) => void;
|
|
10
|
+
iconSize?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
2
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
import { default as React_2 } from 'react';
|
|
4
|
+
|
|
5
|
+
declare type CustomIcon = React_2.ComponentType<CustomIconProps>;
|
|
6
|
+
|
|
7
|
+
declare type CustomIconMap = {
|
|
8
|
+
[key: string]: React_2.LazyExoticComponent<CustomIcon> | CustomIcon;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare type CustomIconProps = {
|
|
12
|
+
onClick?: (e: React_2.MouseEvent) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React_2.CSSProperties;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare const _default: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<IconProps & React_2.RefAttributes<HTMLElement>>>;
|
|
18
|
+
export default _default;
|
|
19
|
+
|
|
20
|
+
declare interface IconProps {
|
|
21
|
+
icon: string | IconProp;
|
|
22
|
+
color?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
onClick?: (e: React_2.MouseEvent) => void;
|
|
25
|
+
size?: number;
|
|
26
|
+
width?: number;
|
|
27
|
+
forwardedRef?: React_2.Ref<HTMLElement>;
|
|
28
|
+
nativeProps?: Partial<FontAwesomeIconProps>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare type ImgIconMap = {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export declare const registerIcons: (iconMap: CustomIconMap) => void;
|
|
36
|
+
|
|
37
|
+
export declare const registerImgIcons: (iconMap: ImgIconMap) => void;
|
|
38
|
+
|
|
39
|
+
export { }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const Spinner: React_2.FC<SpinnerProps>;
|
|
4
|
+
export default Spinner;
|
|
5
|
+
|
|
6
|
+
export declare interface SpinnerProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
small?: boolean;
|
|
9
|
+
big?: boolean;
|
|
10
|
+
medium?: boolean;
|
|
11
|
+
center?: boolean;
|
|
12
|
+
type?: 'normal';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MUIStyledCommonProps } from '@mui/system';
|
|
2
|
+
import * as React_2 from 'react';
|
|
3
|
+
import { Theme } from '@mui/material';
|
|
4
|
+
import { TooltipProps } from '@mui/material/Tooltip';
|
|
5
|
+
|
|
6
|
+
export declare type CustomTooltipProps = TooltipProps & {
|
|
7
|
+
size?: Sizes;
|
|
8
|
+
border?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export declare const DarkTooltip: React_2.NamedExoticComponent<TooltipProps & {
|
|
12
|
+
size?: Sizes | undefined;
|
|
13
|
+
border?: boolean | undefined;
|
|
14
|
+
} & MUIStyledCommonProps<Theme>>;
|
|
15
|
+
|
|
16
|
+
export declare const LightTooltip: React_2.NamedExoticComponent<TooltipProps & {
|
|
17
|
+
size?: Sizes | undefined;
|
|
18
|
+
border?: boolean | undefined;
|
|
19
|
+
} & MUIStyledCommonProps<Theme>>;
|
|
20
|
+
|
|
21
|
+
export declare type Sizes = 'large' | 'variable' | 'medium' | 'fit';
|
|
22
|
+
|
|
23
|
+
export declare const UnstyledTooltip: React_2.NamedExoticComponent<TooltipProps & {
|
|
24
|
+
size?: Sizes | undefined;
|
|
25
|
+
border?: boolean | undefined;
|
|
26
|
+
} & MUIStyledCommonProps<Theme>>;
|
|
27
|
+
|
|
28
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classNames-f3c6f58e.js","sources":["../src/utils/classNames.ts"],"sourcesContent":["import cn, { Argument } from 'classnames'\nimport { twMerge } from 'tailwind-merge'\n\nexport default function classNames(...args: Argument[]) {\n return twMerge(cn(args))\n}\n"],"names":[],"mappings":";;AAGA,SAAwB,cAAc,MAAkB;AAC/C,SAAA,QAAQ,GAAG,IAAI,CAAC;AACzB;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
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
|
+
};
|
|
7
|
+
export type ButtonSize = 'large' | 'small';
|
|
8
|
+
export interface ButtonProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
icon?: FontAwesomeIconProps['icon'] | string;
|
|
11
|
+
text?: React.ReactNode | JSX.Element | string;
|
|
12
|
+
block?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
dataTestId?: string;
|
|
16
|
+
iconToRight?: boolean;
|
|
17
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'destructive';
|
|
18
|
+
size?: ButtonSize;
|
|
19
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
|
+
iconClasses?: string;
|
|
21
|
+
type?: 'submit' | 'reset' | 'button';
|
|
22
|
+
tooltipProps?: TooltipProps;
|
|
23
|
+
iconSize?: number;
|
|
24
|
+
removeIconContainer?: boolean;
|
|
25
|
+
isMenuItem?: boolean;
|
|
26
|
+
useLightTooltip?: boolean;
|
|
27
|
+
}
|
|
28
|
+
type ButtonComponent = React.ForwardRefExoticComponent<ButtonProps> & {
|
|
29
|
+
Ghost: React.ForwardRefExoticComponent<ButtonProps>;
|
|
30
|
+
Primary: React.ForwardRefExoticComponent<ButtonProps>;
|
|
31
|
+
Secondary: React.ForwardRefExoticComponent<ButtonProps>;
|
|
32
|
+
Tertiary: React.ForwardRefExoticComponent<ButtonProps>;
|
|
33
|
+
Destructive: React.ForwardRefExoticComponent<ButtonProps>;
|
|
34
|
+
};
|
|
35
|
+
declare const GhostButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
36
|
+
declare const PrimaryButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
37
|
+
declare const SecondaryButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
declare const TertiaryButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
39
|
+
declare const DestructiveButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
declare const Button: ButtonComponent;
|
|
41
|
+
export { Button, DestructiveButton, GhostButton, PrimaryButton, SecondaryButton, TertiaryButton };
|
|
42
|
+
export default Button;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import { c as classNames } from "../../classNames-f3c6f58e.js";
|
|
4
|
+
import IconProvider from "./IconProvider.es.js";
|
|
5
|
+
import { LightTooltip, DarkTooltip } from "./Tooltip.es.js";
|
|
6
|
+
import "classnames";
|
|
7
|
+
import "tailwind-merge";
|
|
8
|
+
import "@fortawesome/react-fontawesome";
|
|
9
|
+
import "@mui/material/styles/styled";
|
|
10
|
+
import "@mui/material/Tooltip";
|
|
11
|
+
const iconSizeMap = {
|
|
12
|
+
small: 0.75,
|
|
13
|
+
large: 0.875
|
|
14
|
+
};
|
|
15
|
+
const getIconContainerSize = (size, isGhostOrTertiary, removeContainer) => {
|
|
16
|
+
const baseClasses = "flex items-center justify-center";
|
|
17
|
+
if (isGhostOrTertiary) {
|
|
18
|
+
return size === "large" ? `h-3.5 w-3.5 ${baseClasses}` : `h-3 w-3 ${baseClasses}`;
|
|
19
|
+
}
|
|
20
|
+
if (size === "large") {
|
|
21
|
+
const width = removeContainer ? "w-2.5" : "w-4";
|
|
22
|
+
return `h-4 ${width} ${baseClasses}`;
|
|
23
|
+
}
|
|
24
|
+
return `h-2.5 w-2.5 ${baseClasses}`;
|
|
25
|
+
};
|
|
26
|
+
const Wrapper = ({ condition, tooltipWrapper, children }) => condition ? tooltipWrapper(children) : /* @__PURE__ */ jsx("div", { className: "", children });
|
|
27
|
+
const ButtonBase = React__default.forwardRef(
|
|
28
|
+
({
|
|
29
|
+
text,
|
|
30
|
+
icon,
|
|
31
|
+
block = false,
|
|
32
|
+
disabled = false,
|
|
33
|
+
loading = false,
|
|
34
|
+
dataTestId,
|
|
35
|
+
iconToRight = false,
|
|
36
|
+
variant = "primary",
|
|
37
|
+
size = "large",
|
|
38
|
+
onClick,
|
|
39
|
+
iconClasses,
|
|
40
|
+
tooltipProps,
|
|
41
|
+
iconSize,
|
|
42
|
+
type,
|
|
43
|
+
removeIconContainer = false,
|
|
44
|
+
isMenuItem,
|
|
45
|
+
id,
|
|
46
|
+
useLightTooltip = false
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const isDisabled = loading || disabled;
|
|
49
|
+
const isIconOnly = text && !!icon;
|
|
50
|
+
const variantClasses = {
|
|
51
|
+
primary: classNames("bg-gray-1000 text-white", {
|
|
52
|
+
"hover:bg-gray-750": !isDisabled
|
|
53
|
+
}),
|
|
54
|
+
secondary: classNames("bg-white text-gray-750 border border-gray-250", {
|
|
55
|
+
"hover:bg-gray-750 hover:text-white hover:border-gray-750": !isDisabled
|
|
56
|
+
}),
|
|
57
|
+
ghost: classNames("bg-transparent text-gray-750 border-none shadow-none", {
|
|
58
|
+
"hover:bg-gray-150": !isDisabled
|
|
59
|
+
}),
|
|
60
|
+
tertiary: classNames("bg-white border text-gray-550 border-gray-250 font-work", {
|
|
61
|
+
"hover:border-gray-550": !isDisabled
|
|
62
|
+
}),
|
|
63
|
+
destructive: classNames("bg-white text-rose-500 border border-gray-250", {
|
|
64
|
+
"hover:bg-rose-500 hover:text-white hover:border-rose-500": !isDisabled
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
const sizeClasses = {
|
|
68
|
+
large: `h-8 ${isIconOnly ? "px-[0.4375rem]" : "px-2.5"} text-sm`,
|
|
69
|
+
small: "h-6 px-1.5 gap-1 text-xs"
|
|
70
|
+
};
|
|
71
|
+
const iconContainer = {
|
|
72
|
+
large: getIconContainerSize("large", ["tertiary", "ghost"].includes(variant), removeIconContainer),
|
|
73
|
+
small: getIconContainerSize("small", ["tertiary", "ghost"].includes(variant), removeIconContainer)
|
|
74
|
+
};
|
|
75
|
+
const classes = classNames(
|
|
76
|
+
"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",
|
|
77
|
+
"disabled:cursor-not-allowed disabled:opacity-40",
|
|
78
|
+
variantClasses[variant],
|
|
79
|
+
sizeClasses[size],
|
|
80
|
+
{
|
|
81
|
+
"justify-start w-full": isMenuItem,
|
|
82
|
+
"w-full": block
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const iconClassVariant = {
|
|
86
|
+
primary: "text-white",
|
|
87
|
+
secondary: isDisabled ? "text-gray-500" : "text-gray-500 group-hover/btn:text-white",
|
|
88
|
+
ghost: "text-gray-750",
|
|
89
|
+
tertiary: "text-gray-550",
|
|
90
|
+
destructive: isDisabled ? "" : "group-hover/btn:text-white"
|
|
91
|
+
};
|
|
92
|
+
const iconClass = classNames(iconClassVariant[variant], iconContainer[size], {
|
|
93
|
+
[`${iconClasses}`]: iconClasses
|
|
94
|
+
});
|
|
95
|
+
const tooltipWrapper = (children) => disabled || useLightTooltip ? /* @__PURE__ */ jsx(
|
|
96
|
+
LightTooltip,
|
|
97
|
+
{
|
|
98
|
+
title: (tooltipProps == null ? void 0 : tooltipProps.disabledTitle) || (tooltipProps == null ? void 0 : tooltipProps.title),
|
|
99
|
+
placement: tooltipProps == null ? void 0 : tooltipProps.placement,
|
|
100
|
+
size: tooltipProps == null ? void 0 : tooltipProps.size,
|
|
101
|
+
children
|
|
102
|
+
}
|
|
103
|
+
) : /* @__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 });
|
|
104
|
+
const iconComp = icon && /* @__PURE__ */ jsx("div", { className: iconClass, children: /* @__PURE__ */ jsx(IconProvider, { icon, size: iconSize || iconSizeMap[size] }) });
|
|
105
|
+
const spinnerComp = /* @__PURE__ */ jsx("div", { className: iconClass, children: /* @__PURE__ */ jsx(IconProvider, { icon: "fa-spinner", className: "fa-spin", size: iconSizeMap[size] }) });
|
|
106
|
+
const renderedIcon = loading ? spinnerComp : iconComp;
|
|
107
|
+
return /* @__PURE__ */ jsx(Wrapper, { condition: !!(tooltipProps == null ? void 0 : tooltipProps.title) || !!(tooltipProps == null ? void 0 : tooltipProps.disabledTitle), tooltipWrapper, children: /* @__PURE__ */ jsxs(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
id,
|
|
111
|
+
type,
|
|
112
|
+
onClick,
|
|
113
|
+
className: classes,
|
|
114
|
+
disabled: isDisabled,
|
|
115
|
+
ref,
|
|
116
|
+
"data-test": dataTestId,
|
|
117
|
+
children: [
|
|
118
|
+
!iconToRight && renderedIcon,
|
|
119
|
+
text,
|
|
120
|
+
iconToRight && renderedIcon
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
) });
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
const GhostButton = React__default.forwardRef((props, ref) => /* @__PURE__ */ jsx(ButtonBase, { ...props, ref, variant: "ghost" }));
|
|
127
|
+
const PrimaryButton = React__default.forwardRef((props, ref) => /* @__PURE__ */ jsx(ButtonBase, { ...props, ref, variant: "primary" }));
|
|
128
|
+
const SecondaryButton = React__default.forwardRef((props, ref) => /* @__PURE__ */ jsx(ButtonBase, { ...props, ref, variant: "secondary" }));
|
|
129
|
+
const TertiaryButton = React__default.forwardRef((props, ref) => /* @__PURE__ */ jsx(ButtonBase, { ...props, ref, variant: "tertiary" }));
|
|
130
|
+
const DestructiveButton = React__default.forwardRef((props, ref) => /* @__PURE__ */ jsx(ButtonBase, { ...props, ref, variant: "destructive" }));
|
|
131
|
+
const Button = ButtonBase;
|
|
132
|
+
Button.displayName = "Button";
|
|
133
|
+
Button.Ghost = GhostButton;
|
|
134
|
+
Button.Primary = PrimaryButton;
|
|
135
|
+
Button.Secondary = SecondaryButton;
|
|
136
|
+
Button.Tertiary = TertiaryButton;
|
|
137
|
+
Button.Destructive = DestructiveButton;
|
|
138
|
+
export {
|
|
139
|
+
Button,
|
|
140
|
+
DestructiveButton,
|
|
141
|
+
GhostButton,
|
|
142
|
+
PrimaryButton,
|
|
143
|
+
SecondaryButton,
|
|
144
|
+
TertiaryButton,
|
|
145
|
+
Button as default
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=Button.es.js.map
|
|
@@ -0,0 +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, GhostButton, PrimaryButton, SecondaryButton, TertiaryButton }\nexport default Button\n"],"names":["React"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
interface IconButtonProps {
|
|
4
|
+
icon: string | IconProp;
|
|
5
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
6
|
+
iconSize?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const IconButton: React.FC<IconButtonProps>;
|
|
11
|
+
export default IconButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../classNames-f3c6f58e.js";
|
|
3
|
+
import IconProvider from "./IconProvider.es.js";
|
|
4
|
+
import { DarkTooltip } from "./Tooltip.es.js";
|
|
5
|
+
import "classnames";
|
|
6
|
+
import "tailwind-merge";
|
|
7
|
+
import "react";
|
|
8
|
+
import "@fortawesome/react-fontawesome";
|
|
9
|
+
import "@mui/material/styles/styled";
|
|
10
|
+
import "@mui/material/Tooltip";
|
|
11
|
+
const IconButton = ({ icon, iconSize, onClick, disabled, tooltip }) => {
|
|
12
|
+
const classes = classNames("text-gray-450 hover:text-gray-750 cursor-pointer w-3", {
|
|
13
|
+
"text-gray-450 hover:text-gray-450 pointer-event-none opacity-40": disabled
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsx(DarkTooltip, { title: tooltip, children: /* @__PURE__ */ jsx("span", { className: "leading-none", children: /* @__PURE__ */ jsx(IconProvider, { icon, size: iconSize, onClick, className: classes }) }) });
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
IconButton as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=IconButton.es.js.map
|
|
@@ -0,0 +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":";;;;;;;;;;AAgBM,MAAA,aAAwC,CAAC,EAAE,MAAM,UAAU,SAAS,UAAU,cAAc;AAC1F,QAAA,UAAU,WAAW,wDAAwD;AAAA,IACjF,mEAAmE;AAAA,EAAA,CACpE;AAED,6BACG,aAAY,EAAA,OAAO,SAClB,UAAA,oBAAC,UAAK,WAAU,gBACd,UAAC,oBAAA,cAAA,EAAa,MAAY,MAAM,UAAU,SAAkB,WAAW,QAAA,CAAS,EAClF,CAAA,EACF,CAAA;AAEJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
4
|
+
type ImgIconMap = {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const registerImgIcons: (iconMap: ImgIconMap) => void;
|
|
8
|
+
type CustomIcon = React.ComponentType<CustomIconProps>;
|
|
9
|
+
type CustomIconMap = {
|
|
10
|
+
[key: string]: React.LazyExoticComponent<CustomIcon> | CustomIcon;
|
|
11
|
+
};
|
|
12
|
+
export declare const registerIcons: (iconMap: CustomIconMap) => void;
|
|
13
|
+
interface IconProps {
|
|
14
|
+
icon: string | IconProp;
|
|
15
|
+
color?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
18
|
+
size?: number;
|
|
19
|
+
width?: number;
|
|
20
|
+
forwardedRef?: React.Ref<HTMLElement>;
|
|
21
|
+
nativeProps?: Partial<FontAwesomeIconProps>;
|
|
22
|
+
}
|
|
23
|
+
type CustomIconProps = {
|
|
24
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
};
|
|
28
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLElement>>>;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { forwardRef, Suspense } from "react";
|
|
3
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { c as classNames } from "../../classNames-f3c6f58e.js";
|
|
5
|
+
import "classnames";
|
|
6
|
+
import "tailwind-merge";
|
|
7
|
+
const IMG_ICONS_MAP = {};
|
|
8
|
+
const registerImgIcons = (iconMap) => {
|
|
9
|
+
Object.assign(IMG_ICONS_MAP, iconMap);
|
|
10
|
+
};
|
|
11
|
+
const CUSTOM_ICONS_MAP = {};
|
|
12
|
+
const registerIcons = (iconMap) => {
|
|
13
|
+
Object.assign(CUSTOM_ICONS_MAP, iconMap);
|
|
14
|
+
};
|
|
15
|
+
const FA_ICON_ALIAS_MAP = {
|
|
16
|
+
github: "fa-brands fa-github",
|
|
17
|
+
gitlab: "fa-brands fa-gitlab",
|
|
18
|
+
bitbucket: "fa-brands fa-bitbucket",
|
|
19
|
+
jenkins: "fa-brands fa-jenkins"
|
|
20
|
+
};
|
|
21
|
+
const DynamicIcon = ({ name, ...props }) => {
|
|
22
|
+
const IconToRender = CUSTOM_ICONS_MAP[name];
|
|
23
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("span", {}), children: /* @__PURE__ */ jsx(IconToRender, { ...props }) });
|
|
24
|
+
};
|
|
25
|
+
const IconProvider = ({
|
|
26
|
+
icon,
|
|
27
|
+
color,
|
|
28
|
+
size = 0.75,
|
|
29
|
+
width,
|
|
30
|
+
className,
|
|
31
|
+
onClick,
|
|
32
|
+
forwardedRef,
|
|
33
|
+
nativeProps = {}
|
|
34
|
+
}) => {
|
|
35
|
+
const imgIcon = typeof icon === "string" && icon.startsWith("http") ? icon : IMG_ICONS_MAP[icon];
|
|
36
|
+
const faIcon = FA_ICON_ALIAS_MAP[icon] || icon;
|
|
37
|
+
const iconStyles = width ? { width: `${width}rem`, height: "auto" } : { height: `${size}rem`, width: "auto" };
|
|
38
|
+
return imgIcon ? /* @__PURE__ */ jsx(
|
|
39
|
+
"img",
|
|
40
|
+
{
|
|
41
|
+
ref: forwardedRef,
|
|
42
|
+
src: imgIcon,
|
|
43
|
+
style: iconStyles,
|
|
44
|
+
className: classNames(className),
|
|
45
|
+
onClick
|
|
46
|
+
}
|
|
47
|
+
) : CUSTOM_ICONS_MAP[icon] ? /* @__PURE__ */ jsx(DynamicIcon, { onClick, style: { ...iconStyles, color }, name: String(icon), className }) : /* @__PURE__ */ jsx(
|
|
48
|
+
FontAwesomeIcon,
|
|
49
|
+
{
|
|
50
|
+
ref: forwardedRef,
|
|
51
|
+
icon: faIcon,
|
|
52
|
+
style: { color, fontSize: `${width ?? size}rem` },
|
|
53
|
+
className: classNames("text-xs", className),
|
|
54
|
+
onClick,
|
|
55
|
+
...nativeProps
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
const IconProvider$1 = React__default.memo(
|
|
60
|
+
forwardRef((props, ref) => /* @__PURE__ */ jsx(IconProvider, { ...props, forwardedRef: ref }))
|
|
61
|
+
);
|
|
62
|
+
export {
|
|
63
|
+
IconProvider$1 as default,
|
|
64
|
+
registerIcons,
|
|
65
|
+
registerImgIcons
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=IconProvider.es.js.map
|
|
@@ -0,0 +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\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\nconst IconProvider = ({\n icon,\n color,\n size = 0.75,\n width,\n className,\n onClick,\n forwardedRef,\n nativeProps = {},\n}: IconProps) => {\n const imgIcon = typeof icon === 'string' && icon.startsWith('http') ? icon : IMG_ICONS_MAP[icon as string]\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 imgIcon ? (\n <img\n ref={forwardedRef as React.ForwardedRef<HTMLImageElement>}\n src={imgIcon}\n style={iconStyles}\n className={classNames(className)}\n onClick={onClick}\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":";;;;;;AAOA,MAAM,gBAA4B,CAAA;AACrB,MAAA,mBAAmB,CAAC,YAAwB;AAChD,SAAA,OAAO,eAAe,OAAO;AACtC;AAMA,MAAM,mBAAkC,CAAA;AAC3B,MAAA,gBAAgB,CAAC,YAA2B;AAChD,SAAA,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;AACtD,QAAA,eAAe,iBAAiB,IAAI;AAExC,SAAA,oBAAC,UAAS,EAAA,UAAW,oBAAA,QAAA,CAAK,CAAA,GACxB,UAAC,oBAAA,cAAA,EAAc,GAAG,MAAO,CAAA,EAC3B,CAAA;AAEJ;AAEA,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc,CAAC;AACjB,MAAiB;AACT,QAAA,UAAU,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM,IAAI,OAAO,cAAc,IAAc;AACnG,QAAA,SAAS,kBAAkB,IAAc,KAAK;AAEpD,QAAM,aAAa,QAAQ,EAAE,OAAO,GAAG,KAAK,OAAO,QAAQ,OAAO,IAAI,EAAE,QAAQ,GAAG,IAAI,OAAO,OAAO;AAErG,SAAO,UACL;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,MACP,WAAW,WAAW,SAAS;AAAA,MAC/B;AAAA,IAAA;AAAA,EAAA,IAEA,iBAAiB,IAAc,IAChC,oBAAA,aAAA,EAAY,SAAkB,OAAO,EAAE,GAAG,YAAY,MAAS,GAAA,MAAM,OAAO,IAAI,GAAG,UAAsB,CAAA,IAE1G;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,UAAU,GAAG,SAAS,IAAI,MAAM;AAAA,MAChD,WAAW,WAAW,WAAW,SAAS;AAAA,MAC1C;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,MAAeA,iBAAAA,eAAM;AAAA,EACnB,WAAmC,CAAC,OAAO,QAAQ,oBAAC,gBAAc,GAAG,OAAO,cAAc,IAAA,CAAK,CAAE;AACnG;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../classNames-f3c6f58e.js";
|
|
3
|
+
import "classnames";
|
|
4
|
+
import "tailwind-merge";
|
|
5
|
+
const Spinner = ({ className, small, big, medium, center, type = "normal" }) => {
|
|
6
|
+
const isDefault = () => type === "normal";
|
|
7
|
+
const classes = classNames({
|
|
8
|
+
"animate-spin ease-linear rounded-full overflow-hidden": true,
|
|
9
|
+
"border-gray-200 btop": isDefault(),
|
|
10
|
+
"border-4 border-t-4 h-8 w-8": isDefault() && !small && !medium && !big,
|
|
11
|
+
"h-4 w-4": small,
|
|
12
|
+
"border-2 border-t-2": isDefault() && small,
|
|
13
|
+
"h-12 w-12": medium,
|
|
14
|
+
"border-4 border-t-4": isDefault() && medium,
|
|
15
|
+
"h-20 w-20": big,
|
|
16
|
+
"border-8 border-t-8 ": isDefault() && big,
|
|
17
|
+
"m-auto": center,
|
|
18
|
+
[`${className}`]: className
|
|
19
|
+
});
|
|
20
|
+
switch (type) {
|
|
21
|
+
default:
|
|
22
|
+
return /* @__PURE__ */ jsx("div", { className: classes, role: "status", children: /* @__PURE__ */ jsx("span", { className: "invisible", children: "Loading..." }) });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
Spinner as default
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=Spinner.es.js.map
|
|
@@ -0,0 +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":";;;;AAYM,MAAA,UAAkC,CAAC,EAAE,WAAW,OAAO,KAAK,QAAQ,QAAQ,OAAO,eAAe;AAChG,QAAA,YAAY,MAAM,SAAS;AAEjC,QAAM,UAAU,WAAW;AAAA,IACzB,yDAAyD;AAAA,IACzD,wBAAwB,UAAU;AAAA,IAClC,+BAA+B,UAAU,KAAK,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,MAAM;AAAA,IACZ;AAEI,aAAA,oBAAC,OAAI,EAAA,WAAW,SAAS,MAAK,UAC5B,UAAA,oBAAC,QAAK,EAAA,WAAU,aAAY,UAAA,aAAA,CAAU,EACxC,CAAA;AAAA,EAEN;AACF;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { MUIStyledCommonProps } from '@mui/system';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { TooltipProps } from '@mui/material/Tooltip';
|
|
5
|
+
export type Sizes = 'large' | 'variable' | 'medium' | 'fit';
|
|
6
|
+
export type CustomTooltipProps = TooltipProps & {
|
|
7
|
+
size?: Sizes;
|
|
8
|
+
border?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const LightTooltip: React.NamedExoticComponent<TooltipProps & {
|
|
11
|
+
size?: Sizes | undefined;
|
|
12
|
+
border?: boolean | undefined;
|
|
13
|
+
} & MUIStyledCommonProps<Theme>>;
|
|
14
|
+
export declare const DarkTooltip: React.NamedExoticComponent<TooltipProps & {
|
|
15
|
+
size?: Sizes | undefined;
|
|
16
|
+
border?: boolean | undefined;
|
|
17
|
+
} & MUIStyledCommonProps<Theme>>;
|
|
18
|
+
export declare const UnstyledTooltip: React.NamedExoticComponent<TooltipProps & {
|
|
19
|
+
size?: Sizes | undefined;
|
|
20
|
+
border?: boolean | undefined;
|
|
21
|
+
} & MUIStyledCommonProps<Theme>>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import styled from "@mui/material/styles/styled";
|
|
4
|
+
import Tooltip, { tooltipClasses } from "@mui/material/Tooltip";
|
|
5
|
+
import { c as classNames } from "../../classNames-f3c6f58e.js";
|
|
6
|
+
import "classnames";
|
|
7
|
+
import "tailwind-merge";
|
|
8
|
+
const getSize = (size) => {
|
|
9
|
+
let height = 380;
|
|
10
|
+
let width = 250;
|
|
11
|
+
let font = 12;
|
|
12
|
+
switch (size) {
|
|
13
|
+
case "large":
|
|
14
|
+
width = 420;
|
|
15
|
+
height = 400;
|
|
16
|
+
font = 14;
|
|
17
|
+
break;
|
|
18
|
+
case "medium":
|
|
19
|
+
width = 360;
|
|
20
|
+
height = 300;
|
|
21
|
+
font = 14;
|
|
22
|
+
break;
|
|
23
|
+
case "variable":
|
|
24
|
+
width = "none";
|
|
25
|
+
height = "none";
|
|
26
|
+
case "fit":
|
|
27
|
+
width = "fit-content";
|
|
28
|
+
height = "none";
|
|
29
|
+
}
|
|
30
|
+
return { height, width, font };
|
|
31
|
+
};
|
|
32
|
+
const LightTooltip = React.memo(
|
|
33
|
+
styled(({ className, classes, border, ...props }) => /* @__PURE__ */ jsx(
|
|
34
|
+
Tooltip,
|
|
35
|
+
{
|
|
36
|
+
disableFocusListener: true,
|
|
37
|
+
...props,
|
|
38
|
+
classes: {
|
|
39
|
+
popper: className,
|
|
40
|
+
...classes,
|
|
41
|
+
tooltip: classNames(classes == null ? void 0 : classes.tooltip, "custom-scrollbar")
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
))(({ size, theme, border }) => {
|
|
45
|
+
const { height, width, font } = getSize(size);
|
|
46
|
+
return {
|
|
47
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
|
48
|
+
backgroundColor: "#ffffff",
|
|
49
|
+
color: theme.palette.grey[900],
|
|
50
|
+
fontWeight: 500,
|
|
51
|
+
fontSize: font,
|
|
52
|
+
maxHeight: height,
|
|
53
|
+
minWidth: width,
|
|
54
|
+
width: "auto",
|
|
55
|
+
boxShadow: "0px 2px 6px rgba(0, 52, 102, 0.06), 0px 8px 20px rgba(0, 52, 102, 0.1)",
|
|
56
|
+
borderRadius: "0.375rem",
|
|
57
|
+
overflow: "auto",
|
|
58
|
+
padding: "0.375rem 0.5rem",
|
|
59
|
+
border: border ? "0.0625rem solid #E0ECFD" : "0px solid"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
const DarkTooltip = React.memo(
|
|
65
|
+
styled(({ className, classes, ...props }) => /* @__PURE__ */ jsx(
|
|
66
|
+
Tooltip,
|
|
67
|
+
{
|
|
68
|
+
disableFocusListener: true,
|
|
69
|
+
...props,
|
|
70
|
+
classes: {
|
|
71
|
+
popper: className,
|
|
72
|
+
...classes,
|
|
73
|
+
tooltip: classNames(classes == null ? void 0 : classes.tooltip, "custom-scrollbar")
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
))(({ size, theme }) => {
|
|
77
|
+
const { height, width, font } = getSize(size);
|
|
78
|
+
return {
|
|
79
|
+
[`& .${tooltipClasses.arrow}`]: {
|
|
80
|
+
color: theme.palette.common.black
|
|
81
|
+
},
|
|
82
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
|
83
|
+
backgroundColor: theme.palette.common.black,
|
|
84
|
+
color: theme.palette.grey[200],
|
|
85
|
+
fontWeight: 500,
|
|
86
|
+
fontSize: font,
|
|
87
|
+
width: "auto",
|
|
88
|
+
maxWidth: width,
|
|
89
|
+
maxHeight: height,
|
|
90
|
+
boxShadow: "0px 2px 6px rgba(0, 52, 102, 0.06), 0px 8px 20px rgba(0, 52, 102, 0.1)",
|
|
91
|
+
borderRadius: "0.375rem",
|
|
92
|
+
overflow: "auto",
|
|
93
|
+
padding: "0.375rem 0.5rem"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
const UnstyledTooltip = React.memo(
|
|
99
|
+
styled(({ className, ...props }) => /* @__PURE__ */ jsx(Tooltip, { disableFocusListener: true, ...props, classes: { popper: className, tooltip: "custom-scrollbar" } }))(({ size }) => {
|
|
100
|
+
const { width, height } = getSize(size);
|
|
101
|
+
return {
|
|
102
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
|
103
|
+
backgroundColor: "transparent",
|
|
104
|
+
color: "rgba(0, 0, 0, 0.87)",
|
|
105
|
+
maxWidth: width,
|
|
106
|
+
width: "auto",
|
|
107
|
+
maxHeight: height,
|
|
108
|
+
border: "none"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
|
+
export {
|
|
114
|
+
DarkTooltip,
|
|
115
|
+
LightTooltip,
|
|
116
|
+
UnstyledTooltip
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=Tooltip.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.es.js","sources":["../../../src/components/atoms/Tooltip.tsx"],"sourcesContent":["import * as React from 'react'\nimport styled from '@mui/material/styles/styled'\nimport Tooltip, { tooltipClasses, TooltipProps } from '@mui/material/Tooltip'\n\nimport classNames from '@/utils/classNames'\n\nexport type Sizes = 'large' | 'variable' | 'medium' | 'fit'\n\nexport type CustomTooltipProps = TooltipProps & {\n size?: Sizes\n border?: boolean\n}\n\n// todo: values should rely on root font size\nconst getSize = (size?: Sizes) => {\n let height: string | number = 380\n let width: string | number = 250\n let font = 12\n switch (size) {\n case 'large':\n width = 420\n height = 400\n font = 14\n break\n case 'medium':\n width = 360\n height = 300\n font = 14\n break\n case 'variable':\n width = 'none'\n height = 'none'\n case 'fit':\n width = 'fit-content'\n height = 'none'\n }\n return { height, width, font }\n}\n\nexport const LightTooltip = React.memo(\n styled(({ className, classes, border, ...props }: CustomTooltipProps) => (\n <Tooltip\n disableFocusListener\n {...props}\n classes={{\n popper: className,\n ...classes,\n tooltip: classNames(classes?.tooltip, 'custom-scrollbar'),\n }}\n />\n ))(({ size, theme, border }) => {\n const { height, width, font } = getSize(size)\n return {\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: '#ffffff',\n color: theme.palette.grey[900],\n fontWeight: 500,\n fontSize: font,\n maxHeight: height,\n minWidth: width,\n width: 'auto',\n boxShadow: '0px 2px 6px rgba(0, 52, 102, 0.06), 0px 8px 20px rgba(0, 52, 102, 0.1)',\n borderRadius: '0.375rem',\n overflow: 'auto',\n padding: '0.375rem 0.5rem',\n border: border ? '0.0625rem solid #E0ECFD' : '0px solid',\n },\n }\n }),\n)\n\nexport const DarkTooltip = React.memo(\n styled(({ className, classes, ...props }: CustomTooltipProps) => (\n <Tooltip\n disableFocusListener\n {...props}\n classes={{\n popper: className,\n ...classes,\n tooltip: classNames(classes?.tooltip, 'custom-scrollbar'),\n }}\n />\n ))(({ size, theme }) => {\n const { height, width, font } = getSize(size)\n return {\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.palette.common.black,\n },\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.palette.common.black,\n color: theme.palette.grey[200],\n fontWeight: 500,\n fontSize: font,\n width: 'auto',\n maxWidth: width,\n maxHeight: height,\n boxShadow: '0px 2px 6px rgba(0, 52, 102, 0.06), 0px 8px 20px rgba(0, 52, 102, 0.1)',\n borderRadius: '0.375rem',\n overflow: 'auto',\n padding: '0.375rem 0.5rem',\n },\n }\n }),\n)\n\nexport const UnstyledTooltip = React.memo(\n styled(({ className, ...props }: CustomTooltipProps) => (\n <Tooltip disableFocusListener {...props} classes={{ popper: className, tooltip: 'custom-scrollbar' }} />\n ))(({ size }) => {\n const { width, height } = getSize(size)\n return {\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: 'transparent',\n color: 'rgba(0, 0, 0, 0.87)',\n maxWidth: width,\n width: 'auto',\n maxHeight: height,\n border: 'none',\n },\n }\n }),\n)\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ContextType = {
|
|
3
|
+
isPreventEscape?: boolean;
|
|
4
|
+
confirmOnClose?: boolean;
|
|
5
|
+
onEscape?: () => void;
|
|
6
|
+
updateDrawerContext?: (_?: ContextType, clearState?: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const CustomDrawerContext: React.Context<ContextType>;
|
|
9
|
+
interface DrawerProps {
|
|
10
|
+
children: React.ReactNode | JSX.Element | string;
|
|
11
|
+
anchor?: 'right' | 'left' | 'top' | 'bottom' | undefined;
|
|
12
|
+
open: boolean;
|
|
13
|
+
inner?: boolean;
|
|
14
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
15
|
+
width?: string;
|
|
16
|
+
bodyClassName?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
overflowY?: boolean;
|
|
19
|
+
confirmOnClose?: boolean;
|
|
20
|
+
confirmOnCloseMessage?: string;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
}
|
|
23
|
+
declare const CustomDrawer: React.FC<DrawerProps>;
|
|
24
|
+
export default CustomDrawer;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useState, useRef, useMemo, useEffect } from "react";
|
|
3
|
+
import Drawer from "@mui/material/Drawer";
|
|
4
|
+
import { c as classNames } from "../../classNames-f3c6f58e.js";
|
|
5
|
+
import "classnames";
|
|
6
|
+
import "tailwind-merge";
|
|
7
|
+
const CustomDrawerContext = React__default.createContext({});
|
|
8
|
+
const CustomDrawer = ({
|
|
9
|
+
anchor = "right",
|
|
10
|
+
children,
|
|
11
|
+
open,
|
|
12
|
+
inner,
|
|
13
|
+
size = "medium",
|
|
14
|
+
width,
|
|
15
|
+
bodyClassName,
|
|
16
|
+
className = "",
|
|
17
|
+
overflowY,
|
|
18
|
+
confirmOnClose,
|
|
19
|
+
confirmOnCloseMessage,
|
|
20
|
+
onClose
|
|
21
|
+
}) => {
|
|
22
|
+
const [isCloseConfirmationOpen, setIsCloseConfirmationOpen] = useState(false);
|
|
23
|
+
const [shouldConfirmOnClose, setShouldConfirmOnClose] = useState(confirmOnClose);
|
|
24
|
+
const contextRef = useRef({});
|
|
25
|
+
const contextValue = useMemo(
|
|
26
|
+
() => ({
|
|
27
|
+
updateDrawerContext: (state, clearState) => {
|
|
28
|
+
contextRef.current = clearState ? {} : { ...contextRef.current ?? {}, ...state };
|
|
29
|
+
if ((state == null ? void 0 : state.confirmOnClose) !== shouldConfirmOnClose) {
|
|
30
|
+
setShouldConfirmOnClose(state == null ? void 0 : state.confirmOnClose);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
[shouldConfirmOnClose]
|
|
35
|
+
);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setShouldConfirmOnClose(confirmOnClose);
|
|
38
|
+
if (!open) {
|
|
39
|
+
setIsCloseConfirmationOpen(false);
|
|
40
|
+
}
|
|
41
|
+
}, [confirmOnClose, open]);
|
|
42
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
Drawer,
|
|
45
|
+
{
|
|
46
|
+
anchor,
|
|
47
|
+
open,
|
|
48
|
+
onClose: inner ? shouldConfirmOnClose ? () => setIsCloseConfirmationOpen(true) : onClose : void 0,
|
|
49
|
+
className: classNames("feature-importance custom-drawer", className),
|
|
50
|
+
onKeyDown: (e) => {
|
|
51
|
+
const { isPreventEscape, onEscape } = contextRef.current || {};
|
|
52
|
+
if (e.key === "Escape") {
|
|
53
|
+
if (!isPreventEscape)
|
|
54
|
+
;
|
|
55
|
+
else {
|
|
56
|
+
onEscape == null ? void 0 : onEscape();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
onClick: (e) => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
},
|
|
63
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: classNames(
|
|
67
|
+
"flex-1 bg-gray-50 min-h-[100vh] feature-content",
|
|
68
|
+
width ?? {
|
|
69
|
+
"w-[46vw]": size === "medium" && inner,
|
|
70
|
+
"w-[52vw]": size === "medium" && !inner,
|
|
71
|
+
"w-[30vw]": size === "small" && inner,
|
|
72
|
+
"w-[35vw]": size === "small" && !inner,
|
|
73
|
+
"w-[65vw]": size === "large" && inner,
|
|
74
|
+
"w-[70vw]": size === "large" && !inner,
|
|
75
|
+
"w-[80vw]": size === "xlarge" && inner,
|
|
76
|
+
"w-[85vw]": size === "xlarge" && !inner
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"overflow-y-scroll custom-scrollbar": overflowY
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
children: open && /* @__PURE__ */ jsx("div", { className: classNames("h-full", bodyClassName ?? "my-3 mx-5 mb-1.5"), children: /* @__PURE__ */ jsx(CustomDrawerContext.Provider, { value: contextValue, children }) })
|
|
83
|
+
}
|
|
84
|
+
) })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
shouldConfirmOnClose && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
88
|
+
"following code will be added here ",
|
|
89
|
+
confirmOnCloseMessage && false,
|
|
90
|
+
`
|
|
91
|
+
<Alert
|
|
92
|
+
title="Warning"
|
|
93
|
+
message={
|
|
94
|
+
confirmOnCloseMessage ||
|
|
95
|
+
'Closing this drawer will discard all changes. Are you sure you want to close it?'
|
|
96
|
+
}
|
|
97
|
+
onConfirm={async () => {
|
|
98
|
+
setIsCloseConfirmationOpen(false)
|
|
99
|
+
}}
|
|
100
|
+
onClose={() => setIsCloseConfirmationOpen(false)}
|
|
101
|
+
onCloseAfterConfirm={onClose}
|
|
102
|
+
confirmButtonText="Yes"
|
|
103
|
+
open={isCloseConfirmationOpen}
|
|
104
|
+
/>
|
|
105
|
+
`,
|
|
106
|
+
isCloseConfirmationOpen
|
|
107
|
+
] })
|
|
108
|
+
] });
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
CustomDrawerContext,
|
|
112
|
+
CustomDrawer as default
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=CustomDrawer.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomDrawer.es.js","sources":["../../../src/components/molecules/CustomDrawer.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from 'react'\nimport Drawer from '@mui/material/Drawer'\n\nimport classNames from '@/utils/classNames'\n\ntype ContextType = {\n isPreventEscape?: boolean\n confirmOnClose?: boolean\n onEscape?: () => void\n updateDrawerContext?: (_?: ContextType, clearState?: boolean) => void\n}\n\nexport const CustomDrawerContext = React.createContext<ContextType>({})\n\ninterface DrawerProps {\n children: React.ReactNode | JSX.Element | string\n anchor?: 'right' | 'left' | 'top' | 'bottom' | undefined\n open: boolean\n inner?: boolean\n size?: 'small' | 'medium' | 'large' | 'xlarge'\n width?: string\n bodyClassName?: string\n className?: string\n overflowY?: boolean\n confirmOnClose?: boolean\n confirmOnCloseMessage?: string\n onClose: () => void\n}\n\nconst CustomDrawer: React.FC<DrawerProps> = ({\n anchor = 'right',\n children,\n open,\n inner,\n size = 'medium',\n width,\n bodyClassName,\n className = '',\n overflowY,\n confirmOnClose,\n confirmOnCloseMessage,\n onClose,\n}) => {\n const [isCloseConfirmationOpen, setIsCloseConfirmationOpen] = useState(false)\n const [shouldConfirmOnClose, setShouldConfirmOnClose] = useState(confirmOnClose)\n\n const contextRef = useRef<ContextType>({})\n const contextValue = useMemo<ContextType>(\n () => ({\n updateDrawerContext: (state?: ContextType, clearState?: boolean) => {\n contextRef.current = clearState ? {} : { ...(contextRef.current ?? {}), ...state }\n if (state?.confirmOnClose !== shouldConfirmOnClose) {\n setShouldConfirmOnClose(state?.confirmOnClose)\n }\n },\n }),\n [shouldConfirmOnClose],\n )\n\n useEffect(() => {\n setShouldConfirmOnClose(confirmOnClose)\n if (!open) {\n setIsCloseConfirmationOpen(false)\n }\n }, [confirmOnClose, open])\n\n return (\n <>\n <Drawer\n anchor={anchor}\n open={open}\n onClose={inner ? (shouldConfirmOnClose ? () => setIsCloseConfirmationOpen(true) : onClose) : undefined}\n className={classNames('feature-importance custom-drawer', className)}\n onKeyDown={(e) => {\n const { isPreventEscape, onEscape } = contextRef.current || {}\n if (e.key === 'Escape') {\n if (!isPreventEscape) {\n // TODO: Fix this, do not close drawer when escape is pressed\n // onClose()\n } else {\n onEscape?.()\n }\n }\n }}\n onClick={(e) => {\n e.stopPropagation()\n }}\n >\n <div className=\"flex overflow-hidden\">\n <div\n className={classNames(\n 'flex-1 bg-gray-50 min-h-[100vh] feature-content',\n width ?? {\n 'w-[46vw]': size === 'medium' && inner,\n 'w-[52vw]': size === 'medium' && !inner,\n 'w-[30vw]': size === 'small' && inner,\n 'w-[35vw]': size === 'small' && !inner,\n 'w-[65vw]': size === 'large' && inner,\n 'w-[70vw]': size === 'large' && !inner,\n 'w-[80vw]': size === 'xlarge' && inner,\n 'w-[85vw]': size === 'xlarge' && !inner,\n },\n {\n 'overflow-y-scroll custom-scrollbar': overflowY,\n },\n )}\n >\n {open && (\n <div className={classNames('h-full', bodyClassName ?? 'my-3 mx-5 mb-1.5')}>\n <CustomDrawerContext.Provider value={contextValue}>{children}</CustomDrawerContext.Provider>\n </div>\n )}\n </div>\n </div>\n </Drawer>\n {shouldConfirmOnClose && (\n <>\n following code will be added here {confirmOnCloseMessage && false}\n {`\n <Alert\n title=\"Warning\"\n message={\n confirmOnCloseMessage ||\n 'Closing this drawer will discard all changes. Are you sure you want to close it?'\n }\n onConfirm={async () => {\n setIsCloseConfirmationOpen(false)\n }}\n onClose={() => setIsCloseConfirmationOpen(false)}\n onCloseAfterConfirm={onClose}\n confirmButtonText=\"Yes\"\n open={isCloseConfirmationOpen}\n />\n `}\n {isCloseConfirmationOpen}\n </>\n )}\n </>\n )\n}\n\nexport default CustomDrawer\n"],"names":["React"],"mappings":";;;;;;AAYO,MAAM,sBAAsBA,eAAM,cAA2B,EAAE;AAiBtE,MAAM,eAAsC,CAAC;AAAA,EAC3C,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,yBAAyB,0BAA0B,IAAI,SAAS,KAAK;AAC5E,QAAM,CAAC,sBAAsB,uBAAuB,IAAI,SAAS,cAAc;AAEzE,QAAA,aAAa,OAAoB,CAAA,CAAE;AACzC,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL,qBAAqB,CAAC,OAAqB,eAAyB;AACvD,mBAAA,UAAU,aAAa,KAAK,EAAE,GAAI,WAAW,WAAW,CAAA,GAAK,GAAG;AACvE,aAAA,+BAAO,oBAAmB,sBAAsB;AAClD,kCAAwB,+BAAO,cAAc;AAAA,QAC/C;AAAA,MACF;AAAA,IAAA;AAAA,IAEF,CAAC,oBAAoB;AAAA,EAAA;AAGvB,YAAU,MAAM;AACd,4BAAwB,cAAc;AACtC,QAAI,CAAC,MAAM;AACT,iCAA2B,KAAK;AAAA,IAClC;AAAA,EAAA,GACC,CAAC,gBAAgB,IAAI,CAAC;AAEzB,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,SAAS,QAAS,uBAAuB,MAAM,2BAA2B,IAAI,IAAI,UAAW;AAAA,QAC7F,WAAW,WAAW,oCAAoC,SAAS;AAAA,QACnE,WAAW,CAAC,MAAM;AAChB,gBAAM,EAAE,iBAAiB,SAAA,IAAa,WAAW,WAAW,CAAA;AACxD,cAAA,EAAE,QAAQ,UAAU;AACtB,gBAAI,CAAC;AAAiB;AAAA,iBAGf;AACM;AAAA,YACb;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAAA,QACpB;AAAA,QAEA,UAAA,oBAAC,OAAI,EAAA,WAAU,wBACb,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,SAAS;AAAA,gBACP,YAAY,SAAS,YAAY;AAAA,gBACjC,YAAY,SAAS,YAAY,CAAC;AAAA,gBAClC,YAAY,SAAS,WAAW;AAAA,gBAChC,YAAY,SAAS,WAAW,CAAC;AAAA,gBACjC,YAAY,SAAS,WAAW;AAAA,gBAChC,YAAY,SAAS,WAAW,CAAC;AAAA,gBACjC,YAAY,SAAS,YAAY;AAAA,gBACjC,YAAY,SAAS,YAAY,CAAC;AAAA,cACpC;AAAA,cACA;AAAA,gBACE,sCAAsC;AAAA,cACxC;AAAA,YACF;AAAA,YAEC,kBACE,oBAAA,OAAA,EAAI,WAAW,WAAW,UAAU,iBAAiB,kBAAkB,GACtE,UAAA,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,cAAe,SAAS,CAAA,GAC/D;AAAA,UAAA;AAAA,QAAA,GAGN;AAAA,MAAA;AAAA,IACF;AAAA,IACC,wBACG,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA;AAAA,MACmC,yBAAyB;AAAA,MAC3D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAgBA;AAAA,IAAA,GACH;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as default2 } from "./components/atoms/Spinner.es.js";
|
|
2
|
+
import { default as default3 } from "./components/molecules/CustomDrawer.es.js";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import "./classNames-f3c6f58e.js";
|
|
5
|
+
import "classnames";
|
|
6
|
+
import "tailwind-merge";
|
|
7
|
+
import "react";
|
|
8
|
+
import "@mui/material/Drawer";
|
|
9
|
+
export {
|
|
10
|
+
default3 as CustomDrawer,
|
|
11
|
+
default2 as Spinner
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "tfy-web-components",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "Truefoundry Web Components",
|
|
6
|
+
"author": "Truefoundry",
|
|
7
|
+
"private": false,
|
|
8
|
+
"main": "dist/index.umd.js",
|
|
9
|
+
"module": "dist/index.es.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.es.js",
|
|
15
|
+
"require": "./dist/index.umd.js"
|
|
16
|
+
},
|
|
17
|
+
"./components/atoms/*": {
|
|
18
|
+
"types": "./dist/components/atoms/*.d.ts",
|
|
19
|
+
"import": "./dist/components/atoms/*.es.js"
|
|
20
|
+
},
|
|
21
|
+
"./components/molecules/*": {
|
|
22
|
+
"types": "./dist/components/molecules/*.d.ts",
|
|
23
|
+
"import": "./dist/components/molecules/*.es.js"
|
|
24
|
+
},
|
|
25
|
+
"./dist/style.css": "./dist/style.css"
|
|
26
|
+
},
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
"*": {
|
|
29
|
+
"components/molecules/*": [
|
|
30
|
+
"./dist/components/molecules/*.d.ts"
|
|
31
|
+
],
|
|
32
|
+
"components/atoms/*": [
|
|
33
|
+
"./dist/components/atoms/*.d.ts"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "storybook dev -p 6006",
|
|
39
|
+
"build": "storybook build",
|
|
40
|
+
"build:lib": "tsc && vite build",
|
|
41
|
+
"lint": "eslint --ext .js,.jsx,.ts,.tsx --fix",
|
|
42
|
+
"prettier": "prettier --write \"src/**/*.{ts,tsx,js,mdx}\"",
|
|
43
|
+
"test": "vitest",
|
|
44
|
+
"test:cov": "vitest run --coverage",
|
|
45
|
+
"prepare": "husky install",
|
|
46
|
+
"prepack": "node scripts/prepack.js",
|
|
47
|
+
"postpack": "node scripts/postpack.js"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
51
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
52
|
+
"@mui/material": "^5.5.0",
|
|
53
|
+
"classnames": "^2.5.1",
|
|
54
|
+
"react": "^18.3.1",
|
|
55
|
+
"react-dom": "^18.3.1",
|
|
56
|
+
"tailwind-merge": "^3.0.1",
|
|
57
|
+
"tailwindcss": "3.3.3"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist"
|
|
61
|
+
],
|
|
62
|
+
"lint-staged": {
|
|
63
|
+
"*.{ts,tsx,js,jsx,json,css,md}": [
|
|
64
|
+
"prettier -w"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|