@snack-uikit/alert 0.5.20-preview-85c5f47b.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 +369 -0
- package/LICENSE +201 -0
- package/README.md +79 -0
- package/dist/components/Alert/Alert.d.ts +27 -0
- package/dist/components/Alert/Alert.js +28 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Alert/styles.module.css +187 -0
- package/dist/components/AlertTop/AlertTop.d.ts +34 -0
- package/dist/components/AlertTop/AlertTop.js +30 -0
- package/dist/components/AlertTop/constants.d.ts +14 -0
- package/dist/components/AlertTop/constants.js +16 -0
- package/dist/components/AlertTop/index.d.ts +1 -0
- package/dist/components/AlertTop/index.js +1 -0
- package/dist/components/AlertTop/styles.module.css +237 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/constants.d.ts +15 -0
- package/dist/constants.js +16 -0
- package/dist/helperComponents/AlertTopButton/AlertTopButton.d.ts +9 -0
- package/dist/helperComponents/AlertTopButton/AlertTopButton.js +6 -0
- package/dist/helperComponents/AlertTopButton/index.d.ts +1 -0
- package/dist/helperComponents/AlertTopButton/index.js +1 -0
- package/dist/helperComponents/AlertTopButton/styles.module.css +58 -0
- package/dist/helperComponents/index.d.ts +1 -0
- package/dist/helperComponents/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +17 -0
- package/package.json +42 -0
- package/src/components/Alert/Alert.tsx +92 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Alert/styles.module.scss +106 -0
- package/src/components/AlertTop/AlertTop.tsx +134 -0
- package/src/components/AlertTop/constants.ts +17 -0
- package/src/components/AlertTop/index.ts +1 -0
- package/src/components/AlertTop/styles.module.scss +157 -0
- package/src/components/index.ts +2 -0
- package/src/constants.ts +17 -0
- package/src/helperComponents/AlertTopButton/AlertTopButton.tsx +25 -0
- package/src/helperComponents/AlertTopButton/index.ts +1 -0
- package/src/helperComponents/AlertTopButton/styles.module.scss +57 -0
- package/src/helperComponents/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/utils.tsx +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AlertTopButton';
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
opacity: $opacity-a080;
|
|
22
|
+
background: none;
|
|
23
|
+
border: 0;
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
width: $icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
27
|
+
height: $icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
opacity: unset;
|
|
32
|
+
background-color: $sys-opacity-hovered;
|
|
33
|
+
}
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
@include outline-var($container-focused-s);
|
|
36
|
+
|
|
37
|
+
opacity: unset;
|
|
38
|
+
background-color: $sys-opacity-hovered;
|
|
39
|
+
outline-color: $sys-available-on-complementary;
|
|
40
|
+
}
|
|
41
|
+
&:active {
|
|
42
|
+
opacity: $opacity-a080;
|
|
43
|
+
background-color: $sys-opacity-activated;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@each $color in $colors {
|
|
47
|
+
&[data-color='#{$color}'] {
|
|
48
|
+
@if $color == 'invert-neutral' {
|
|
49
|
+
color: simple-var($theme-variables, 'sys', $color, 'text-main');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@else {
|
|
53
|
+
color: simple-var($theme-variables, 'sys', $color, 'on-accent');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AlertTopButton';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/src/utils.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AlarmFilledSVG, CheckFilledSVG, CrossFilledSVG, InfoFilledSVG } from '@snack-uikit/icons';
|
|
2
|
+
|
|
3
|
+
import { Appearance } from './constants';
|
|
4
|
+
|
|
5
|
+
export function getIcon(appearance: Appearance) {
|
|
6
|
+
switch (appearance) {
|
|
7
|
+
case Appearance.Success:
|
|
8
|
+
return <CheckFilledSVG />;
|
|
9
|
+
case Appearance.Error:
|
|
10
|
+
return <CrossFilledSVG />;
|
|
11
|
+
case Appearance.Warning:
|
|
12
|
+
return <AlarmFilledSVG />;
|
|
13
|
+
case Appearance.Primary:
|
|
14
|
+
case Appearance.Neutral:
|
|
15
|
+
default:
|
|
16
|
+
return <InfoFilledSVG />;
|
|
17
|
+
}
|
|
18
|
+
}
|