@snack-uikit/alert 0.8.7 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +18 -18
- package/dist/components/Alert/Alert.d.ts +9 -7
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/Alert/styles.module.css +6 -102
- package/dist/components/AlertTop/AlertTop.d.ts +7 -12
- package/dist/components/AlertTop/AlertTop.js +3 -3
- package/dist/components/AlertTop/styles.module.css +0 -114
- package/dist/helperComponents/AlertButton.d.ts +19 -0
- package/dist/helperComponents/AlertButton.js +5 -0
- package/dist/helperComponents/index.d.ts +0 -1
- package/dist/helperComponents/index.js +0 -1
- package/dist/helperComponents/styles.module.css +138 -0
- package/package.json +2 -2
- package/src/components/Alert/Alert.tsx +24 -22
- package/src/components/Alert/styles.module.scss +7 -48
- package/src/components/AlertTop/AlertTop.tsx +16 -34
- package/src/components/AlertTop/styles.module.scss +14 -68
- package/src/helperComponents/AlertButton.tsx +45 -0
- package/src/helperComponents/index.ts +0 -1
- package/src/helperComponents/styles.module.scss +110 -0
- package/dist/helperComponents/AlertButton/AlertButton.d.ts +0 -9
- package/dist/helperComponents/AlertButton/AlertButton.js +0 -6
- package/dist/helperComponents/AlertButton/index.d.ts +0 -1
- package/dist/helperComponents/AlertButton/index.js +0 -1
- package/dist/helperComponents/AlertButton/styles.module.css +0 -75
- package/dist/helperComponents/AlertTopButton/AlertTopButton.d.ts +0 -9
- package/dist/helperComponents/AlertTopButton/AlertTopButton.js +0 -6
- package/dist/helperComponents/AlertTopButton/index.d.ts +0 -1
- package/dist/helperComponents/AlertTopButton/index.js +0 -1
- package/dist/helperComponents/AlertTopButton/styles.module.css +0 -55
- package/src/helperComponents/AlertButton/AlertButton.tsx +0 -26
- package/src/helperComponents/AlertButton/index.ts +0 -1
- package/src/helperComponents/AlertButton/styles.module.scss +0 -49
- package/src/helperComponents/AlertTopButton/AlertTopButton.tsx +0 -25
- package/src/helperComponents/AlertTopButton/index.ts +0 -1
- package/src/helperComponents/AlertTopButton/styles.module.scss +0 -54
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { APPEARANCE_TO_COLOR_MAP_INVERT } from '../../components/AlertTop/constants';
|
|
3
|
-
import styles from './styles.module.css';
|
|
4
|
-
export function AlertTopButton({ appearance, buttonText, buttonIcon, buttonOnClick }) {
|
|
5
|
-
return (_jsxs("button", { onClick: buttonOnClick, className: styles.alertTopButton, "data-color": APPEARANCE_TO_COLOR_MAP_INVERT[appearance], children: [_jsx("span", { children: buttonText }), buttonIcon] }));
|
|
6
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AlertTopButton';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AlertTopButton';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
.alertTopButton{
|
|
2
|
-
height:var(--size-alert-top-button, 32px);
|
|
3
|
-
gap:var(--space-alert-top-button-gap, 4px);
|
|
4
|
-
border-radius:var(--radius-alert-top-button, 12px);
|
|
5
|
-
padding-left:var(--space-alert-top-button-horizontal-padding, 12px);
|
|
6
|
-
padding-right:var(--space-alert-top-button-horizontal-padding, 12px);
|
|
7
|
-
font-family:var(--sans-label-l-font-family, SB Sans Interface);
|
|
8
|
-
font-weight:var(--sans-label-l-font-weight, Semibold);
|
|
9
|
-
line-height:var(--sans-label-l-line-height, 20px);
|
|
10
|
-
font-size:var(--sans-label-l-font-size, 14px);
|
|
11
|
-
letter-spacing:var(--sans-label-l-letter-spacing, -0.1px);
|
|
12
|
-
paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
|
|
13
|
-
cursor:pointer;
|
|
14
|
-
display:flex;
|
|
15
|
-
align-items:center;
|
|
16
|
-
box-sizing:border-box;
|
|
17
|
-
margin:0;
|
|
18
|
-
margin-left:auto;
|
|
19
|
-
white-space:nowrap;
|
|
20
|
-
background:var(--sys-opacity-enabled, rgba(255, 255, 255, 0.1607843137));
|
|
21
|
-
border:0;
|
|
22
|
-
}
|
|
23
|
-
.alertTopButton svg{
|
|
24
|
-
width:var(--size-icon-container-s, 24px) !important;
|
|
25
|
-
height:var(--size-icon-container-s, 24px) !important;
|
|
26
|
-
}
|
|
27
|
-
.alertTopButton:hover{
|
|
28
|
-
opacity:unset;
|
|
29
|
-
background-color:var(--sys-opacity-hovered, rgba(255, 255, 255, 0.2392156863));
|
|
30
|
-
}
|
|
31
|
-
.alertTopButton:focus-visible{
|
|
32
|
-
outline-width:var(--border-state-focus-s-border-width, 2px);
|
|
33
|
-
outline-style:var(--border-state-focus-s-border-style, solid);
|
|
34
|
-
outline-color:var(--border-state-focus-s-border-color, );
|
|
35
|
-
background-color:var(--sys-opacity-hovered, rgba(255, 255, 255, 0.2392156863));
|
|
36
|
-
outline-color:var(--sys-available-on-complementary, #ffffff);
|
|
37
|
-
}
|
|
38
|
-
.alertTopButton:active{
|
|
39
|
-
background-color:var(--sys-opacity-activated, rgba(255, 255, 255, 0.3215686275));
|
|
40
|
-
}
|
|
41
|
-
.alertTopButton[data-color=invert-neutral]{
|
|
42
|
-
color:var(--sys-invert-neutral-text-main, #e8eaf1);
|
|
43
|
-
}
|
|
44
|
-
.alertTopButton[data-color=primary]{
|
|
45
|
-
color:var(--sys-primary-on-accent, #fdfbff);
|
|
46
|
-
}
|
|
47
|
-
.alertTopButton[data-color=red]{
|
|
48
|
-
color:var(--sys-red-on-accent, #fffbf9);
|
|
49
|
-
}
|
|
50
|
-
.alertTopButton[data-color=yellow]{
|
|
51
|
-
color:var(--sys-yellow-on-accent, #5e3d06);
|
|
52
|
-
}
|
|
53
|
-
.alertTopButton[data-color=green]{
|
|
54
|
-
color:var(--sys-green-on-accent, #fcfefa);
|
|
55
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { APPEARANCE_TO_COLOR_MAP } from '../../constants';
|
|
4
|
-
import { Appearance } from '../../types';
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
|
|
7
|
-
export type AlertButtonProps = {
|
|
8
|
-
appearance: Appearance;
|
|
9
|
-
label: string;
|
|
10
|
-
icon?: ReactElement;
|
|
11
|
-
onClick(e: MouseEvent<HTMLButtonElement>): void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function AlertButton({ appearance, label, icon, onClick }: AlertButtonProps) {
|
|
15
|
-
return (
|
|
16
|
-
<button
|
|
17
|
-
onClick={onClick}
|
|
18
|
-
className={styles.alertButton}
|
|
19
|
-
data-color={APPEARANCE_TO_COLOR_MAP[appearance]}
|
|
20
|
-
data-test-id='alert__action-button'
|
|
21
|
-
>
|
|
22
|
-
<span>{label}</span>
|
|
23
|
-
{icon}
|
|
24
|
-
</button>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AlertButton';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-alert';
|
|
2
|
-
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';
|
|
3
|
-
|
|
4
|
-
$colors: 'neutral', 'primary', 'red', 'yellow', 'green';
|
|
5
|
-
|
|
6
|
-
.alertButton {
|
|
7
|
-
@include composite-var($alert-button-button-action);
|
|
8
|
-
@include composite-var($sans-label-l);
|
|
9
|
-
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
margin: 0;
|
|
17
|
-
|
|
18
|
-
white-space: nowrap;
|
|
19
|
-
|
|
20
|
-
background: none;
|
|
21
|
-
border: 0;
|
|
22
|
-
|
|
23
|
-
svg {
|
|
24
|
-
width: $icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
25
|
-
height: $icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&:focus-visible {
|
|
29
|
-
@include outline-var($container-focused-s);
|
|
30
|
-
|
|
31
|
-
outline-color: $sys-available-complementary;
|
|
32
|
-
outline-offset: $spacing-state-focus-offset;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@each $color in $colors {
|
|
36
|
-
&[data-color='#{$color}'] {
|
|
37
|
-
color: simple-var($theme-variables, 'sys', $color, 'text-support');
|
|
38
|
-
|
|
39
|
-
&:hover,
|
|
40
|
-
&:focus-visible {
|
|
41
|
-
color: simple-var($theme-variables, 'sys', $color, 'text-light');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:active {
|
|
45
|
-
color: simple-var($theme-variables, 'sys', $color, 'text-main');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { APPEARANCE_TO_COLOR_MAP_INVERT } from '../../components/AlertTop/constants';
|
|
4
|
-
import { Appearance } from '../../types';
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
|
|
7
|
-
export type AlertTopButtonProps = {
|
|
8
|
-
appearance: Appearance;
|
|
9
|
-
buttonText: string;
|
|
10
|
-
buttonIcon?: ReactElement;
|
|
11
|
-
buttonOnClick?: () => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function AlertTopButton({ appearance, buttonText, buttonIcon, buttonOnClick }: AlertTopButtonProps) {
|
|
15
|
-
return (
|
|
16
|
-
<button
|
|
17
|
-
onClick={buttonOnClick}
|
|
18
|
-
className={styles.alertTopButton}
|
|
19
|
-
data-color={APPEARANCE_TO_COLOR_MAP_INVERT[appearance]}
|
|
20
|
-
>
|
|
21
|
-
<span>{buttonText}</span>
|
|
22
|
-
{buttonIcon}
|
|
23
|
-
</button>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AlertTopButton';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-alert-alertTop';
|
|
2
|
-
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';
|
|
3
|
-
|
|
4
|
-
$colors: 'invert-neutral', 'primary', 'red', 'yellow', 'green';
|
|
5
|
-
|
|
6
|
-
.alertTopButton {
|
|
7
|
-
@include composite-var($alert-top-button-button-action);
|
|
8
|
-
@include composite-var($sans-label-l);
|
|
9
|
-
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
margin: 0;
|
|
17
|
-
margin-left: auto;
|
|
18
|
-
|
|
19
|
-
white-space: nowrap;
|
|
20
|
-
|
|
21
|
-
background: $sys-opacity-enabled;
|
|
22
|
-
border: 0;
|
|
23
|
-
|
|
24
|
-
svg {
|
|
25
|
-
width: $icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
26
|
-
height: $icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
opacity: unset;
|
|
31
|
-
background-color: $sys-opacity-hovered;
|
|
32
|
-
}
|
|
33
|
-
&:focus-visible {
|
|
34
|
-
@include outline-var($container-focused-s);
|
|
35
|
-
|
|
36
|
-
background-color: $sys-opacity-hovered;
|
|
37
|
-
outline-color: $sys-available-on-complementary;
|
|
38
|
-
}
|
|
39
|
-
&:active {
|
|
40
|
-
background-color: $sys-opacity-activated;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@each $color in $colors {
|
|
44
|
-
&[data-color='#{$color}'] {
|
|
45
|
-
@if $color == 'invert-neutral' {
|
|
46
|
-
color: simple-var($theme-variables, 'sys', $color, 'text-main');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@else {
|
|
50
|
-
color: simple-var($theme-variables, 'sys', $color, 'on-accent');
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|