tfy-web-components 0.0.4 → 0.0.6

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 (115) hide show
  1. package/dist/..d.ts +31 -0
  2. package/dist/Button.d.ts +62 -0
  3. package/dist/CustomDrawer.d.ts +30 -0
  4. package/dist/IconButton.d.ts +15 -0
  5. package/dist/IconProvider.d.ts +39 -0
  6. package/dist/Spinner.d.ts +15 -0
  7. package/dist/Tooltip.d.ts +28 -0
  8. package/dist/animation.d.ts +6 -0
  9. package/dist/backgroundColor.d.ts +5 -0
  10. package/dist/backgroundImage.d.ts +10 -0
  11. package/dist/borderWidth.d.ts +6 -0
  12. package/dist/classNames-f3c6f58e.js +9 -0
  13. package/dist/classNames-f3c6f58e.js.map +1 -0
  14. package/dist/colors.d.ts +191 -0
  15. package/dist/components/atoms/Button.d.ts +42 -0
  16. package/dist/components/atoms/Button.es.js +147 -0
  17. package/dist/components/atoms/Button.es.js.map +1 -0
  18. package/dist/components/atoms/IconButton.d.ts +11 -0
  19. package/dist/components/atoms/IconButton.es.js +20 -0
  20. package/dist/components/atoms/IconButton.es.js.map +1 -0
  21. package/dist/components/atoms/IconProvider.d.ts +29 -0
  22. package/dist/components/atoms/IconProvider.es.js +67 -0
  23. package/dist/components/atoms/IconProvider.es.js.map +1 -0
  24. package/dist/components/atoms/Spinner.d.ts +11 -0
  25. package/dist/components/atoms/Spinner.es.js +28 -0
  26. package/dist/components/atoms/Spinner.es.js.map +1 -0
  27. package/dist/components/atoms/Tooltip.d.ts +21 -0
  28. package/dist/components/atoms/Tooltip.es.js +118 -0
  29. package/dist/components/atoms/Tooltip.es.js.map +1 -0
  30. package/dist/components/molecules/CustomDrawer.d.ts +24 -0
  31. package/dist/components/molecules/CustomDrawer.es.js +114 -0
  32. package/dist/components/molecules/CustomDrawer.es.js.map +1 -0
  33. package/dist/components/theme/animation.d.ts +4 -0
  34. package/dist/components/theme/animation.es.js +8 -0
  35. package/dist/components/theme/animation.es.js.map +1 -0
  36. package/dist/components/theme/backgroundColor.d.ts +3 -0
  37. package/dist/components/theme/backgroundColor.es.js +7 -0
  38. package/dist/components/theme/backgroundColor.es.js.map +1 -0
  39. package/dist/components/theme/backgroundImage.d.ts +8 -0
  40. package/dist/components/theme/backgroundImage.es.js +22 -0
  41. package/dist/components/theme/backgroundImage.es.js.map +1 -0
  42. package/dist/components/theme/borderWidth.d.ts +4 -0
  43. package/dist/components/theme/borderWidth.es.js +8 -0
  44. package/dist/components/theme/borderWidth.es.js.map +1 -0
  45. package/dist/components/theme/colors.d.ts +188 -0
  46. package/dist/components/theme/colors.es.js +194 -0
  47. package/dist/components/theme/colors.es.js.map +1 -0
  48. package/dist/components/theme/cursor.d.ts +3 -0
  49. package/dist/components/theme/cursor.es.js +7 -0
  50. package/dist/components/theme/cursor.es.js.map +1 -0
  51. package/dist/components/theme/dropShadow.d.ts +3 -0
  52. package/dist/components/theme/dropShadow.es.js +7 -0
  53. package/dist/components/theme/dropShadow.es.js.map +1 -0
  54. package/dist/components/theme/flexGrow.d.ts +3 -0
  55. package/dist/components/theme/flexGrow.es.js +7 -0
  56. package/dist/components/theme/flexGrow.es.js.map +1 -0
  57. package/dist/components/theme/fontSize.d.ts +6 -0
  58. package/dist/components/theme/fontSize.es.js +10 -0
  59. package/dist/components/theme/fontSize.es.js.map +1 -0
  60. package/dist/components/theme/height.d.ts +6 -0
  61. package/dist/components/theme/height.es.js +10 -0
  62. package/dist/components/theme/height.es.js.map +1 -0
  63. package/dist/components/theme/index.d.ts +78 -0
  64. package/dist/components/theme/index.es.js +35 -0
  65. package/dist/components/theme/index.es.js.map +1 -0
  66. package/dist/components/theme/keyframes.d.ts +18 -0
  67. package/dist/components/theme/keyframes.es.js +14 -0
  68. package/dist/components/theme/keyframes.es.js.map +1 -0
  69. package/dist/components/theme/lightColorPlugin.js.d.ts +1 -0
  70. package/dist/components/theme/lightColorPlugin.js.es.js +91 -0
  71. package/dist/components/theme/lightColorPlugin.js.es.js.map +1 -0
  72. package/dist/components/theme/maxHeight.d.ts +4 -0
  73. package/dist/components/theme/maxHeight.es.js +8 -0
  74. package/dist/components/theme/maxHeight.es.js.map +1 -0
  75. package/dist/components/theme/screens.d.ts +6 -0
  76. package/dist/components/theme/screens.es.js +10 -0
  77. package/dist/components/theme/screens.es.js.map +1 -0
  78. package/dist/components/theme/tailwindScrollbar.js.d.ts +1 -0
  79. package/dist/components/theme/tailwindScrollbar.js.es.js +81 -0
  80. package/dist/components/theme/tailwindScrollbar.js.es.js.map +1 -0
  81. package/dist/components/theme/theme.d.ts +23 -0
  82. package/dist/components/theme/theme.es.js +128 -0
  83. package/dist/components/theme/theme.es.js.map +1 -0
  84. package/dist/components/theme/transitionProperty.d.ts +4 -0
  85. package/dist/components/theme/transitionProperty.es.js +8 -0
  86. package/dist/components/theme/transitionProperty.es.js.map +1 -0
  87. package/dist/components/theme/useTheme.d.ts +14 -0
  88. package/dist/components/theme/useTheme.es.js +40 -0
  89. package/dist/components/theme/useTheme.es.js.map +1 -0
  90. package/dist/components/theme/utils.d.ts +77 -0
  91. package/dist/components/theme/utils.es.js +762 -0
  92. package/dist/components/theme/utils.es.js.map +1 -0
  93. package/dist/components/theme/zIndex.d.ts +3 -0
  94. package/dist/components/theme/zIndex.es.js +7 -0
  95. package/dist/components/theme/zIndex.es.js.map +1 -0
  96. package/dist/cursor.d.ts +5 -0
  97. package/dist/dropShadow.d.ts +5 -0
  98. package/dist/flexGrow.d.ts +5 -0
  99. package/dist/fontSize.d.ts +8 -0
  100. package/dist/height.d.ts +8 -0
  101. package/dist/index.es.js +13 -0
  102. package/dist/index.es.js.map +1 -0
  103. package/dist/keyframes.d.ts +20 -0
  104. package/dist/lightColorPlugin.js.d.ts +1 -0
  105. package/dist/maxHeight.d.ts +6 -0
  106. package/dist/plugin-06dc459f.js +61 -0
  107. package/dist/plugin-06dc459f.js.map +1 -0
  108. package/dist/screens.d.ts +8 -0
  109. package/dist/tailwindScrollbar.js.d.ts +1 -0
  110. package/dist/theme.d.ts +33 -0
  111. package/dist/transitionProperty.d.ts +6 -0
  112. package/dist/useTheme.d.ts +22 -0
  113. package/dist/utils.d.ts +79 -0
  114. package/dist/zIndex.d.ts +5 -0
  115. package/package.json +1 -1
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 { }
@@ -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,6 @@
1
+ export declare const animation: {
2
+ fadeOut: string;
3
+ fadeIn: string;
4
+ };
5
+
6
+ export { }
@@ -0,0 +1,5 @@
1
+ export declare const backgroundColor: (theme: (path: string) => string | undefined) => {
2
+ app: string | undefined;
3
+ };
4
+
5
+ export { }
@@ -0,0 +1,10 @@
1
+ export declare const backgroundImage: (theme: (path: string) => string | undefined) => {
2
+ 'blue-red-gradient': string;
3
+ 'white-indigo-gradient': string;
4
+ 'chat-template': string;
5
+ 'blue-linear-gradient': string;
6
+ 'new-deployment-gradient': string;
7
+ 'new-deployment-gradient-text': string;
8
+ };
9
+
10
+ export { }
@@ -0,0 +1,6 @@
1
+ export declare const borderWidth: {
2
+ DEFAULT: string;
3
+ 1: string;
4
+ };
5
+
6
+ export { }
@@ -0,0 +1,9 @@
1
+ import cn from "classnames";
2
+ import { twMerge } from "tailwind-merge";
3
+ function classNames(...args) {
4
+ return twMerge(cn(args));
5
+ }
6
+ export {
7
+ classNames as c
8
+ };
9
+ //# sourceMappingURL=classNames-f3c6f58e.js.map
@@ -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,191 @@
1
+ export declare const darkPalette: {
2
+ gray: {
3
+ 16: string;
4
+ 25: string;
5
+ 50: string;
6
+ 75: string;
7
+ 100: string;
8
+ 125: string;
9
+ 150: string;
10
+ 200: string;
11
+ 250: string;
12
+ 275: string;
13
+ 300: string;
14
+ 350: string;
15
+ 375: string;
16
+ 400: string;
17
+ 450: string;
18
+ 500: string;
19
+ 550: string;
20
+ 600: string;
21
+ 650: string;
22
+ 700: string;
23
+ 750: string;
24
+ 800: string;
25
+ 850: string;
26
+ 900: string;
27
+ 950: string;
28
+ 1000: string;
29
+ disabled: string;
30
+ whitesmoke: string;
31
+ };
32
+ indigo: {
33
+ 500: string;
34
+ 525: string;
35
+ 550: string;
36
+ 700: string;
37
+ 725: string;
38
+ 750: string;
39
+ 850: string;
40
+ };
41
+ yellow: {
42
+ '50light': string;
43
+ 100: string;
44
+ '200dark': string;
45
+ 500: string;
46
+ };
47
+ skyblue: string;
48
+ blue: {
49
+ 25: string;
50
+ 45: string;
51
+ primary: string;
52
+ secondary: string;
53
+ 'secondary-light': string;
54
+ purple: string;
55
+ 'purple-2': string;
56
+ 'purple-3': string;
57
+ 100: string;
58
+ 150: string;
59
+ 200: string;
60
+ 350: string;
61
+ 375: string;
62
+ 500: string;
63
+ 550: string;
64
+ '500original': string;
65
+ 600: string;
66
+ 650: string;
67
+ 725: string;
68
+ };
69
+ green: {
70
+ 600: string;
71
+ };
72
+ fuchsia: {
73
+ 100: string;
74
+ 500: string;
75
+ };
76
+ violet: {
77
+ 500: string;
78
+ };
79
+ red: {
80
+ 500: string;
81
+ 650: string;
82
+ 50: string;
83
+ };
84
+ orange: {
85
+ 100: string;
86
+ 650: string;
87
+ };
88
+ amber: {
89
+ 450: string;
90
+ };
91
+ white: string;
92
+ black: string;
93
+ background: string;
94
+ };
95
+
96
+ export declare const lightPalette: {
97
+ gray: {
98
+ 16: string;
99
+ 25: string;
100
+ 50: string;
101
+ 75: string;
102
+ 100: string;
103
+ 125: string;
104
+ 150: string;
105
+ 200: string;
106
+ 250: string;
107
+ 275: string;
108
+ 300: string;
109
+ 350: string;
110
+ 375: string;
111
+ 400: string;
112
+ 450: string;
113
+ 500: string;
114
+ 550: string;
115
+ 600: string;
116
+ 650: string;
117
+ 700: string;
118
+ 750: string;
119
+ 800: string;
120
+ 850: string;
121
+ 900: string;
122
+ 950: string;
123
+ 1000: string;
124
+ disabled: string;
125
+ whitesmoke: string;
126
+ };
127
+ indigo: {
128
+ 500: string;
129
+ 525: string;
130
+ 550: string;
131
+ 700: string;
132
+ 725: string;
133
+ 750: string;
134
+ 850: string;
135
+ };
136
+ yellow: {
137
+ '50light': string;
138
+ 100: string;
139
+ '200dark': string;
140
+ 500: string;
141
+ };
142
+ skyblue: string;
143
+ blue: {
144
+ 25: string;
145
+ 45: string;
146
+ primary: string;
147
+ secondary: string;
148
+ 'secondary-light': string;
149
+ purple: string;
150
+ 'purple-2': string;
151
+ 'purple-3': string;
152
+ 100: string;
153
+ 150: string;
154
+ 200: string;
155
+ 350: string;
156
+ 375: string;
157
+ 500: string;
158
+ 550: string;
159
+ '500original': string;
160
+ 600: string;
161
+ 650: string;
162
+ 725: string;
163
+ };
164
+ green: {
165
+ 600: string;
166
+ };
167
+ fuchsia: {
168
+ 100: string;
169
+ 500: string;
170
+ };
171
+ violet: {
172
+ 500: string;
173
+ };
174
+ red: {
175
+ 500: string;
176
+ 650: string;
177
+ 50: string;
178
+ };
179
+ orange: {
180
+ 100: string;
181
+ 650: string;
182
+ };
183
+ amber: {
184
+ 450: string;
185
+ };
186
+ white: string;
187
+ black: string;
188
+ background: string;
189
+ };
190
+
191
+ export { }
@@ -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