@cloud-ru/uikit-product-claudia 1.6.2
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/CHANGELOG.md +112 -0
- package/LICENSE +201 -0
- package/README.md +586 -0
- package/package.json +60 -0
- package/src/components/ButtonClaudia/ButtonClaudia.tsx +33 -0
- package/src/components/ButtonClaudia/constants.ts +29 -0
- package/src/components/ButtonClaudia/helperComponents/ButtonPrivate/ButtonPrivate.tsx +99 -0
- package/src/components/ButtonClaudia/helperComponents/ButtonPrivate/constants.ts +13 -0
- package/src/components/ButtonClaudia/helperComponents/ButtonPrivate/index.ts +1 -0
- package/src/components/ButtonClaudia/helperComponents/ButtonPrivate/styles.module.scss +46 -0
- package/src/components/ButtonClaudia/helperComponents/ButtonPrivate/utils.tsx +92 -0
- package/src/components/ButtonClaudia/helperComponents/index.ts +1 -0
- package/src/components/ButtonClaudia/index.ts +1 -0
- package/src/components/ButtonClaudia/styles.module.scss +141 -0
- package/src/components/ButtonClaudia/types.ts +63 -0
- package/src/components/ButtonClaudia/utils.ts +15 -0
- package/src/components/ButtonGiga/ButtonGigaFunction/ButtonGigaFunction.tsx +43 -0
- package/src/components/ButtonGiga/ButtonGigaFunction/index.ts +1 -0
- package/src/components/ButtonGiga/ButtonGigaFunction/styles.module.scss +179 -0
- package/src/components/ButtonGiga/ButtonGigaFunction/types.ts +43 -0
- package/src/components/ButtonGiga/ButtonGigaFunction/utils.ts +16 -0
- package/src/components/ButtonGiga/ButtonGigaMama/ButtonGigaMama.tsx +29 -0
- package/src/components/ButtonGiga/ButtonGigaMama/index.ts +1 -0
- package/src/components/ButtonGiga/ButtonGigaMama/styles.module.scss +180 -0
- package/src/components/ButtonGiga/ButtonGigaMama/utils.ts +15 -0
- package/src/components/ButtonGiga/ButtonGigaOutline/ButtonGigaOutline.tsx +43 -0
- package/src/components/ButtonGiga/ButtonGigaOutline/index.ts +1 -0
- package/src/components/ButtonGiga/ButtonGigaOutline/styles.module.scss +223 -0
- package/src/components/ButtonGiga/ButtonGigaOutline/types.ts +63 -0
- package/src/components/ButtonGiga/ButtonGigaOutline/utils.ts +16 -0
- package/src/components/ButtonGiga/constants.ts +29 -0
- package/src/components/ButtonGiga/helperComponents/ButtonPrivate/ButtonPrivate.tsx +99 -0
- package/src/components/ButtonGiga/helperComponents/ButtonPrivate/constants.ts +15 -0
- package/src/components/ButtonGiga/helperComponents/ButtonPrivate/index.ts +1 -0
- package/src/components/ButtonGiga/helperComponents/ButtonPrivate/styles.module.scss +46 -0
- package/src/components/ButtonGiga/helperComponents/ButtonPrivate/types.ts +63 -0
- package/src/components/ButtonGiga/helperComponents/ButtonPrivate/utils.tsx +92 -0
- package/src/components/ButtonGiga/helperComponents/index.ts +1 -0
- package/src/components/ButtonGiga/index.ts +3 -0
- package/src/components/ButtonGiga/types.ts +43 -0
- package/src/components/ChatStatusAnnouncement/ChatStatusAnnouncement.tsx +109 -0
- package/src/components/ChatStatusAnnouncement/constants.ts +1 -0
- package/src/components/ChatStatusAnnouncement/helperComponents/AlertButton/AlertButton.tsx +24 -0
- package/src/components/ChatStatusAnnouncement/helperComponents/AlertButton/index.ts +1 -0
- package/src/components/ChatStatusAnnouncement/helperComponents/AlertButton/styles.module.scss +27 -0
- package/src/components/ChatStatusAnnouncement/helperComponents/TextContent/TextContent.tsx +18 -0
- package/src/components/ChatStatusAnnouncement/helperComponents/TextContent/index.ts +1 -0
- package/src/components/ChatStatusAnnouncement/index.ts +1 -0
- package/src/components/ChatStatusAnnouncement/styled.module.scss +65 -0
- package/src/components/ChatStatusAnnouncement/types.ts +17 -0
- package/src/components/ChatStatusAnnouncement/utils/index.ts +52 -0
- package/src/components/IconGiga/IconGiga.tsx +64 -0
- package/src/components/IconGiga/constants.ts +23 -0
- package/src/components/IconGiga/index.ts +1 -0
- package/src/components/RecommendPannel/RecommendPanel.tsx +131 -0
- package/src/components/RecommendPannel/helperComponents/Chip/Chip.tsx +47 -0
- package/src/components/RecommendPannel/helperComponents/Chip/index.ts +1 -0
- package/src/components/RecommendPannel/helperComponents/Chip/styles.module.scss +45 -0
- package/src/components/RecommendPannel/helperComponents/ClaudiaChip/ClaudiaChip.tsx +40 -0
- package/src/components/RecommendPannel/helperComponents/ClaudiaChip/index.ts +1 -0
- package/src/components/RecommendPannel/helperComponents/CloseChip/CloseChip.tsx +106 -0
- package/src/components/RecommendPannel/helperComponents/CloseChip/index.ts +1 -0
- package/src/components/RecommendPannel/helperComponents/CloseChip/styles.module.scss +73 -0
- package/src/components/RecommendPannel/helperComponents/DropdownChip/DropdownChip.tsx +112 -0
- package/src/components/RecommendPannel/helperComponents/DropdownChip/index.ts +1 -0
- package/src/components/RecommendPannel/helperComponents/DropdownChip/styles.module.scss +56 -0
- package/src/components/RecommendPannel/hooks/index.ts +15 -0
- package/src/components/RecommendPannel/index.ts +1 -0
- package/src/components/RecommendPannel/styles.module.scss +4 -0
- package/src/components/RecommendPannel/types.ts +21 -0
- package/src/components/RecommendPannel/utils/gitVisibleChipsCount.ts +57 -0
- package/src/components/SshField/SshField.tsx +222 -0
- package/src/components/SshField/components/MobileFieldAi/MobileFieldAi.tsx +71 -0
- package/src/components/SshField/components/MobileFieldAi/index.ts +1 -0
- package/src/components/SshField/components/MobileFieldAi/styles.module.scss +80 -0
- package/src/components/SshField/components/TextArea/TextArea.tsx +113 -0
- package/src/components/SshField/components/TextArea/index.ts +1 -0
- package/src/components/SshField/components/TextArea/styles.module.scss +35 -0
- package/src/components/SshField/helperComponents/DropZoneContent/DropZoneContent.tsx +15 -0
- package/src/components/SshField/helperComponents/DropZoneContent/index.ts +1 -0
- package/src/components/SshField/helperComponents/DropZoneContent/styles.module.scss +17 -0
- package/src/components/SshField/helperComponents/FieldSubmitButton/FieldSubmitButton.tsx +45 -0
- package/src/components/SshField/helperComponents/FieldSubmitButton/index.ts +1 -0
- package/src/components/SshField/helperComponents/TextAreaActionsFooter/TextAreaActionsFooter.tsx +18 -0
- package/src/components/SshField/helperComponents/TextAreaActionsFooter/index.ts +1 -0
- package/src/components/SshField/helperComponents/TextAreaActionsFooter/styles.module.scss +23 -0
- package/src/components/SshField/index.ts +1 -0
- package/src/components/SshField/styles.module.scss +54 -0
- package/src/components/SshField/utils/handleFileError.ts +41 -0
- package/src/components/SshField/utils/isTouchDevice.ts +5 -0
- package/src/components/SshField/utils/readFileContent.ts +23 -0
- package/src/components/SshField/utils/validateSSHKey.ts +84 -0
- package/src/components/index.ts +6 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-giga-id/build/scss/components/styles-tokens-button-buttonFunction' as buttonFunction;
|
|
2
|
+
@use '@sbercloud/figma-tokens-giga-id/build/scss/styles-theme-variables' as stv;
|
|
3
|
+
@use '@sbercloud/figma-tokens-giga-id/build/scss/components/styles-tokens-element';
|
|
4
|
+
|
|
5
|
+
$sizes: 'xs', 's', 'm', 'l';
|
|
6
|
+
$variants: 'label-only', 'icon-only', 'icon-after';
|
|
7
|
+
$appearances: 'primary', 'neutral';
|
|
8
|
+
$typography: (
|
|
9
|
+
'xs': stv.$sans-label-s,
|
|
10
|
+
's': stv.$sans-label-m,
|
|
11
|
+
'm': stv.$sans-label-l,
|
|
12
|
+
'l': stv.$sans-label-l,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
$function-focus-outline-offset: 0;
|
|
16
|
+
$function-filter-brightness-hover: 0.9;
|
|
17
|
+
$function-filter-brightness-active: 0.7;
|
|
18
|
+
|
|
19
|
+
@mixin icon-fill($color) {
|
|
20
|
+
.icon {
|
|
21
|
+
color: $color;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin label-color($color) {
|
|
26
|
+
.label {
|
|
27
|
+
color: $color;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@mixin button-anatomy-styles($button-theme, $sizes, $variants, $typography) {
|
|
32
|
+
@each $size in $sizes {
|
|
33
|
+
&[data-size='#{$size}'] {
|
|
34
|
+
.label {
|
|
35
|
+
@include styles-tokens-element.composite-var($typography, $size);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.icon {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
|
|
43
|
+
width: styles-tokens-element.$icon-s;
|
|
44
|
+
height: styles-tokens-element.$icon-s;
|
|
45
|
+
|
|
46
|
+
svg {
|
|
47
|
+
max-width: styles-tokens-element.$icon-s;
|
|
48
|
+
max-height: styles-tokens-element.$icon-s;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@each $variant in $variants {
|
|
53
|
+
&[data-variant='#{$variant}'] {
|
|
54
|
+
@include styles-tokens-element.composite-var($button-theme, 'container', $size, $variant);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&[data-variant='icon-before'] {
|
|
59
|
+
@include styles-tokens-element.composite-var($button-theme, 'container', $size, 'icon-after');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@mixin loading-label-only($button-theme) {
|
|
66
|
+
&[data-loading][data-variant='label-only'] {
|
|
67
|
+
.icon {
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 50%;
|
|
70
|
+
left: 50%;
|
|
71
|
+
transform: translate(-50%, -50%);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.label {
|
|
75
|
+
@include styles-tokens-element.composite-var($button-theme, 'label', 'load-label-only');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@mixin button-focus-outline {
|
|
81
|
+
&:focus-visible {
|
|
82
|
+
@include styles-tokens-element.outline-var(styles-tokens-element.$container-focused-s);
|
|
83
|
+
|
|
84
|
+
outline-offset: styles-tokens-element.$spacing-state-focus-offset;
|
|
85
|
+
outline-color: stv.$sys-available-complementary;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@mixin giga-function-colors {
|
|
90
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-light'));
|
|
91
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-light'));
|
|
92
|
+
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
border: none;
|
|
95
|
+
|
|
96
|
+
@each $appearance in $appearances {
|
|
97
|
+
&[data-appearance='#{$appearance}'] {
|
|
98
|
+
@if $appearance == 'primary' {
|
|
99
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-default'));
|
|
100
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-default'));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (hover: hover) {
|
|
104
|
+
&:hover {
|
|
105
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-hovered'));
|
|
106
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-hovered'));
|
|
107
|
+
|
|
108
|
+
.icon {
|
|
109
|
+
filter: brightness($function-filter-brightness-hover);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@media (hover: none) or (hover: hover) {
|
|
115
|
+
&:focus-visible {
|
|
116
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-hovered'));
|
|
117
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-hovered'));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:active {
|
|
121
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-pressed'));
|
|
122
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-pressed'));
|
|
123
|
+
|
|
124
|
+
.icon {
|
|
125
|
+
filter: brightness($function-filter-brightness-active);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&[data-loading] {
|
|
130
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-pressed'));
|
|
131
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', $appearance, 'accent-pressed'));
|
|
132
|
+
|
|
133
|
+
.icon {
|
|
134
|
+
filter: brightness($function-filter-brightness-active);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&:disabled,
|
|
139
|
+
&[data-disabled] {
|
|
140
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-disabled'));
|
|
141
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-disabled'));
|
|
142
|
+
|
|
143
|
+
.icon {
|
|
144
|
+
svg path {
|
|
145
|
+
fill: currentColor;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.button.specificityX2 {
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
|
|
157
|
+
@include button-anatomy-styles(buttonFunction.$button-function, $sizes, $variants, $typography);
|
|
158
|
+
@include loading-label-only(buttonFunction.$button-function);
|
|
159
|
+
@include giga-function-colors;
|
|
160
|
+
@include button-focus-outline;
|
|
161
|
+
|
|
162
|
+
&:focus-visible {
|
|
163
|
+
outline-offset: $function-focus-outline-offset;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&[data-size] {
|
|
167
|
+
@each $variant in $variants {
|
|
168
|
+
&[data-variant='#{$variant}'] {
|
|
169
|
+
padding-left: stv.$dimension-0m;
|
|
170
|
+
padding-right: stv.$dimension-0m;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&[data-variant='icon-before'] {
|
|
175
|
+
padding-left: stv.$dimension-0m;
|
|
176
|
+
padding-right: stv.$dimension-0m;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnchorHTMLAttributes,
|
|
3
|
+
ButtonHTMLAttributes,
|
|
4
|
+
FocusEventHandler,
|
|
5
|
+
KeyboardEventHandler,
|
|
6
|
+
MouseEventHandler,
|
|
7
|
+
ReactElement,
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
import { ValueOf } from '@snack-uikit/utils';
|
|
11
|
+
|
|
12
|
+
import { APPEARANCE, ICON_POSITION, SIZE } from '../constants';
|
|
13
|
+
|
|
14
|
+
export type Appearance = ValueOf<typeof APPEARANCE>;
|
|
15
|
+
|
|
16
|
+
export type IconPosition = ValueOf<typeof ICON_POSITION>;
|
|
17
|
+
|
|
18
|
+
export type Size = ValueOf<typeof SIZE>;
|
|
19
|
+
|
|
20
|
+
export type BaseButtonProps = {
|
|
21
|
+
className?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
icon?: ReactElement;
|
|
24
|
+
iconPosition?: IconPosition;
|
|
25
|
+
label?: string;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
28
|
+
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
29
|
+
onFocus?: FocusEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
30
|
+
onBlur?: FocusEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
31
|
+
size?: Size;
|
|
32
|
+
appearance?: Appearance;
|
|
33
|
+
type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
34
|
+
tabIndex?: number;
|
|
35
|
+
fullWidth?: boolean;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type AnchorButtonProps = {
|
|
39
|
+
href?: string;
|
|
40
|
+
target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type CommonButtonProps = AnchorButtonProps & BaseButtonProps;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CommonButtonProps } from './types';
|
|
2
|
+
|
|
3
|
+
export function extractCommonButtonProps({
|
|
4
|
+
disabled,
|
|
5
|
+
href,
|
|
6
|
+
icon,
|
|
7
|
+
iconPosition,
|
|
8
|
+
label,
|
|
9
|
+
loading,
|
|
10
|
+
onClick,
|
|
11
|
+
onFocus,
|
|
12
|
+
onBlur,
|
|
13
|
+
onKeyDown,
|
|
14
|
+
}: CommonButtonProps) {
|
|
15
|
+
return { disabled, href, icon, iconPosition, label, loading, onClick, onKeyDown, onFocus, onBlur };
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
|
|
6
|
+
import { HTML_TYPE, TARGET } from '../constants';
|
|
7
|
+
import { ButtonPrivate } from '../helperComponents';
|
|
8
|
+
import { CommonButtonProps } from '../helperComponents/ButtonPrivate/types';
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
import { extractCommonButtonProps } from './utils';
|
|
11
|
+
|
|
12
|
+
export type ButtonGigaMamaProps = WithSupportProps<Omit<CommonButtonProps, 'appearance' | 'size' | 'iconPosition'>>;
|
|
13
|
+
|
|
14
|
+
export const ButtonGigaMama = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonGigaMamaProps>(
|
|
15
|
+
({ className, target = TARGET.Blank, type = HTML_TYPE.Button, tabIndex, fullWidth = false, ...rest }, ref) => (
|
|
16
|
+
<ButtonPrivate
|
|
17
|
+
{...extractSupportProps(rest)}
|
|
18
|
+
{...extractCommonButtonProps({ ...rest })}
|
|
19
|
+
className={cn(styles.button, styles.specificity, className)}
|
|
20
|
+
iconClassName={styles.icon}
|
|
21
|
+
labelClassName={styles.label}
|
|
22
|
+
fullWidth={fullWidth}
|
|
23
|
+
target={target}
|
|
24
|
+
type={type}
|
|
25
|
+
tabIndex={tabIndex}
|
|
26
|
+
ref={ref}
|
|
27
|
+
/>
|
|
28
|
+
),
|
|
29
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonGigaMama';
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/* stylelint-disable color-no-hex */
|
|
2
|
+
// TODO: refactor styles to use tokens
|
|
3
|
+
@use '@sbercloud/figma-tokens-giga-id/build/scss/styles-theme-variables' as stv;
|
|
4
|
+
@use '@sbercloud/figma-tokens-giga-id/build/scss/components/styles-tokens-element';
|
|
5
|
+
|
|
6
|
+
$mama-gap: 4px;
|
|
7
|
+
$mama-width: 304px;
|
|
8
|
+
$mama-max-height: 72px;
|
|
9
|
+
$mama-padding: 24px 0px;
|
|
10
|
+
$mama-border-radius: 12px;
|
|
11
|
+
$mama-icon-height: 24px;
|
|
12
|
+
$mama-before-padding: 1px;
|
|
13
|
+
|
|
14
|
+
$mama-gradient-color-start: #7cb5f2;
|
|
15
|
+
$mama-gradient-color-middle: #5fd7c2;
|
|
16
|
+
$mama-gradient-color-end: #26d07c;
|
|
17
|
+
$mama-gradient: radial-gradient(
|
|
18
|
+
92.53% 92.53% at 65.87% 21.69%,
|
|
19
|
+
$mama-gradient-color-start 15%,
|
|
20
|
+
$mama-gradient-color-middle 45%,
|
|
21
|
+
$mama-gradient-color-end 65%
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
$mama-box-shadow-hover: 0px 0px 1px 0px #00000026 inset;
|
|
25
|
+
$mama-box-shadow-active: 0px 0px 1px 0px #0000004d inset;
|
|
26
|
+
$mama-filter-brightness-hover: 0.9;
|
|
27
|
+
$mama-filter-brightness-active: 0.7;
|
|
28
|
+
|
|
29
|
+
@mixin icon-fill($color) {
|
|
30
|
+
.icon {
|
|
31
|
+
color: $color;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@mixin label-color($color) {
|
|
36
|
+
.label {
|
|
37
|
+
color: $color;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.button.specificity {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
gap: $mama-gap;
|
|
46
|
+
width: $mama-width;
|
|
47
|
+
max-height: $mama-max-height;
|
|
48
|
+
padding: $mama-padding;
|
|
49
|
+
border-radius: $mama-border-radius;
|
|
50
|
+
|
|
51
|
+
background-color: styles-tokens-element.color-on-background-with-opacity(
|
|
52
|
+
transparent,
|
|
53
|
+
stv.$sys-primary-decor-default,
|
|
54
|
+
0.7
|
|
55
|
+
);
|
|
56
|
+
border: none;
|
|
57
|
+
|
|
58
|
+
&[data-full-width] {
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
63
|
+
|
|
64
|
+
.label {
|
|
65
|
+
@include styles-tokens-element.composite-var(stv.$sans-title-m);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.icon {
|
|
69
|
+
color: stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support');
|
|
70
|
+
height: $mama-icon-height;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&::before {
|
|
74
|
+
content: '';
|
|
75
|
+
position: absolute;
|
|
76
|
+
inset: 0;
|
|
77
|
+
padding: $mama-before-padding;
|
|
78
|
+
border-radius: inherit;
|
|
79
|
+
background: $mama-gradient;
|
|
80
|
+
mask:
|
|
81
|
+
linear-gradient(#fff 0 0) content-box,
|
|
82
|
+
linear-gradient(#fff 0 0);
|
|
83
|
+
-webkit-mask-composite: xor;
|
|
84
|
+
mask-composite: exclude;
|
|
85
|
+
pointer-events: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:disabled,
|
|
89
|
+
&[data-disabled] {
|
|
90
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-disabled'));
|
|
91
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-disabled'));
|
|
92
|
+
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
|
|
95
|
+
&::before {
|
|
96
|
+
background: stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-disabled');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.icon {
|
|
100
|
+
svg path {
|
|
101
|
+
fill: stv.simple-var(stv.$theme-variables, 'sys', 'neutral', 'text-disabled');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:hover:not(:disabled):not([data-disabled]) {
|
|
107
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
108
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
109
|
+
|
|
110
|
+
box-shadow: $mama-box-shadow-hover;
|
|
111
|
+
|
|
112
|
+
&::before {
|
|
113
|
+
filter: brightness($mama-filter-brightness-hover);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.icon {
|
|
117
|
+
filter: brightness($mama-filter-brightness-hover);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.label {
|
|
121
|
+
filter: brightness($mama-filter-brightness-hover);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&:active:not(:disabled):not([data-disabled]) {
|
|
126
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
127
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
128
|
+
|
|
129
|
+
box-shadow: $mama-box-shadow-active;
|
|
130
|
+
|
|
131
|
+
&::before {
|
|
132
|
+
filter: brightness($mama-filter-brightness-active);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.label {
|
|
136
|
+
filter: brightness($mama-filter-brightness-active);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.icon {
|
|
140
|
+
filter: brightness($mama-filter-brightness-active);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:focus-visible:not(:disabled):not([data-disabled]) {
|
|
145
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
146
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
147
|
+
|
|
148
|
+
.label {
|
|
149
|
+
filter: brightness($mama-filter-brightness-hover);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.icon {
|
|
153
|
+
filter: brightness($mama-filter-brightness-hover);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@include styles-tokens-element.outline-var(styles-tokens-element.$container-focused-s);
|
|
157
|
+
|
|
158
|
+
outline-offset: styles-tokens-element.$spacing-state-focus-offset;
|
|
159
|
+
outline-color: stv.$sys-available-complementary;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&[data-loading]:not(:disabled):not([data-disabled]) {
|
|
163
|
+
@include label-color(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'text-support'));
|
|
164
|
+
@include icon-fill(stv.simple-var(stv.$theme-variables, 'sys', 'primary', 'accent-pressed'));
|
|
165
|
+
|
|
166
|
+
box-shadow: $mama-box-shadow-active;
|
|
167
|
+
|
|
168
|
+
&::before {
|
|
169
|
+
filter: brightness($mama-filter-brightness-active);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.label {
|
|
173
|
+
filter: brightness($mama-filter-brightness-active);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.icon {
|
|
177
|
+
filter: brightness($mama-filter-brightness-active);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonButtonProps } from '../helperComponents/ButtonPrivate/types';
|
|
2
|
+
|
|
3
|
+
export function extractCommonButtonProps({
|
|
4
|
+
disabled,
|
|
5
|
+
href,
|
|
6
|
+
icon,
|
|
7
|
+
label,
|
|
8
|
+
loading,
|
|
9
|
+
onClick,
|
|
10
|
+
onFocus,
|
|
11
|
+
onBlur,
|
|
12
|
+
onKeyDown,
|
|
13
|
+
}: Omit<CommonButtonProps, 'iconPosition'>) {
|
|
14
|
+
return { disabled, href, icon, label, loading, onClick, onKeyDown, onFocus, onBlur };
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
|
|
6
|
+
import { HTML_TYPE, ICON_POSITION, SIZE, TARGET } from '../constants';
|
|
7
|
+
import { ButtonPrivate } from '../helperComponents';
|
|
8
|
+
import styles from './styles.module.scss';
|
|
9
|
+
import { CommonButtonProps } from './types';
|
|
10
|
+
import { extractCommonButtonProps } from './utils';
|
|
11
|
+
|
|
12
|
+
export type ButtonGigaOutlineProps = WithSupportProps<Omit<CommonButtonProps, 'appearance'>>;
|
|
13
|
+
|
|
14
|
+
export const ButtonGigaOutline = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonGigaOutlineProps>(
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
className,
|
|
18
|
+
size = SIZE.S,
|
|
19
|
+
target = TARGET.Blank,
|
|
20
|
+
type = HTML_TYPE.Button,
|
|
21
|
+
iconPosition = ICON_POSITION.Before,
|
|
22
|
+
tabIndex,
|
|
23
|
+
fullWidth = false,
|
|
24
|
+
...rest
|
|
25
|
+
},
|
|
26
|
+
ref,
|
|
27
|
+
) => (
|
|
28
|
+
<ButtonPrivate
|
|
29
|
+
{...extractSupportProps(rest)}
|
|
30
|
+
{...extractCommonButtonProps({ ...rest, iconPosition })}
|
|
31
|
+
className={cn(styles.button, styles.specificityX2, className)}
|
|
32
|
+
iconClassName={styles.icon}
|
|
33
|
+
labelClassName={styles.label}
|
|
34
|
+
iconPosition={iconPosition}
|
|
35
|
+
size={size}
|
|
36
|
+
fullWidth={fullWidth}
|
|
37
|
+
target={target}
|
|
38
|
+
type={type}
|
|
39
|
+
tabIndex={tabIndex}
|
|
40
|
+
ref={ref}
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonGigaOutline';
|