graphen 1.10.20 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphen",
3
- "version": "1.10.20",
3
+ "version": "2.0.0",
4
4
  "description": "Graphen is a small library, that keeps reusable blocks of UI and helps making application design consistent across multiple projects.",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ type Props = {
5
+ className?: string;
6
+ type?: "default" | "info" | "success" | "danger";
7
+ children?: React.ReactNode;
8
+ showPulse?: boolean;
9
+ };
10
+
11
+ function Badge({
12
+ className = "",
13
+ type = "default",
14
+ children = null,
15
+ showPulse = false,
16
+ }: Props) {
17
+ const classes = classNames("gc-badge", className, {
18
+ [`gc-badge--${type}`]: type !== "default",
19
+ });
20
+
21
+ return (
22
+ <span className={classes}>
23
+ {showPulse && <span className="gc-badge__pulse" aria-hidden="true" />}
24
+ {children}
25
+ </span>
26
+ );
27
+ }
28
+
29
+ export default Badge;
@@ -0,0 +1,38 @@
1
+ .gc-badge {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 6px;
5
+ height: 22px;
6
+ padding: 0 8px;
7
+ background: $gb-color-component;
8
+ border: 1px solid $gb-color-component-dark;
9
+ border-radius: 999px;
10
+ color: $gb-color-text;
11
+ font-family: $gb-font-mono;
12
+ font-size: 11px;
13
+
14
+ &__pulse {
15
+ width: 6px;
16
+ height: 6px;
17
+ background: currentcolor;
18
+ border-radius: 50%;
19
+ }
20
+
21
+ &--success {
22
+ background: rgba($gb-color-success, 0.1);
23
+ border-color: rgba($gb-color-success, 0.3);
24
+ color: $gb-color-success;
25
+ }
26
+
27
+ &--danger {
28
+ background: rgba($gb-color-danger, 0.1);
29
+ border-color: rgba($gb-color-danger, 0.3);
30
+ color: $gb-color-danger;
31
+ }
32
+
33
+ &--info {
34
+ background: rgba($gb-color-info, 0.1);
35
+ border-color: rgba($gb-color-info, 0.3);
36
+ color: $gb-color-info;
37
+ }
38
+ }
@@ -8,9 +8,13 @@
8
8
  margin: 0;
9
9
  min-height: 100vh;
10
10
  font-family: $gb-font;
11
- font-weight: 100;
12
- font-size: $font-size-very-large;
11
+ font-weight: 400;
12
+ font-size: 15px;
13
+ line-height: 1.55;
13
14
  color: $gb-color-text;
15
+ background: $color-white;
16
+ font-feature-settings: 'ss01', 'cv11';
17
+ -webkit-font-smoothing: antialiased;
14
18
 
15
19
  a {
16
20
  cursor: pointer;
@@ -1,75 +1,110 @@
1
1
  .gc-btn {
2
- @include cx-btn--size(34px);
3
-
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ gap: 8px;
4
6
  box-sizing: border-box;
5
- display: inline-block;
6
- font-weight: normal;
7
- text-align: center;
8
- touch-action: manipulation;
9
- cursor: pointer;
7
+ height: 36px;
8
+ padding: 0 14px;
9
+ background: $gb-color-component;
10
10
  border: 1px solid transparent;
11
- white-space: nowrap;
12
11
  border-radius: $radius-medium;
12
+ color: $gb-color-text;
13
+ font-family: $gb-font;
14
+ font-size: 13.5px;
15
+ font-weight: 500;
16
+ text-align: center;
17
+ text-decoration: none;
18
+ white-space: nowrap;
19
+ cursor: pointer;
13
20
  user-select: none;
14
21
  vertical-align: middle;
22
+ touch-action: manipulation;
23
+ transition: background-color 0.12s, border-color 0.12s, color 0.12s, transform 0.04s;
24
+
25
+ &:hover {
26
+ background: $gb-color-component-dark;
27
+ }
28
+
29
+ &:active {
30
+ transform: translateY(1px);
31
+ }
15
32
 
16
33
  &--medium {
17
- @include cx-btn--size(34px);
34
+ height: 36px;
18
35
  }
19
36
 
20
37
  &--small {
21
- @include cx-btn--size(20px);
38
+ height: 28px;
39
+ padding: 0 10px;
40
+ font-size: 12.5px;
41
+ border-radius: $radius-small;
42
+ }
43
+
44
+ &--large {
45
+ height: 44px;
46
+ padding: 0 18px;
47
+ font-size: 14.5px;
48
+ border-radius: 7px;
22
49
  }
23
50
 
24
51
  &--full {
52
+ display: flex;
25
53
  width: 100%;
26
- display: block;
27
54
  }
28
55
 
29
56
  &--primary {
30
- background-color: $gb-color-primary;
57
+ background: $gb-color-primary;
31
58
  color: $color-white;
32
59
 
33
60
  &:hover {
34
- background-color: darken($gb-color-primary, 10%);
61
+ background: darken($gb-color-primary, 10%);
35
62
  }
36
63
  }
37
64
 
65
+ &--outline,
38
66
  &--secondary {
39
67
  background: $color-white;
40
- color: $gb-color-primary;
41
- border-width: 1px;
42
- border-style: solid;
43
- border-color: $gb-color-primary;
68
+ border-color: $gb-color-component-dark;
69
+ color: $gb-color-text;
44
70
 
45
71
  &:hover {
46
- border-color: darken($gb-color-primary, 10%);
47
- color: darken($gb-color-primary, 10%);
72
+ background: $gb-color-component;
73
+ border-color: $gb-color-text;
48
74
  }
49
75
  }
50
76
 
77
+ &--ghost,
51
78
  &--tertiary {
52
- background: $color-white;
53
- color: $gb-color-primary;
54
- border: none;
79
+ background: transparent;
80
+ color: $gb-color-text;
81
+
82
+ &:hover {
83
+ background: $gb-color-component;
84
+ }
85
+ }
86
+
87
+ &--success {
88
+ background: $gb-color-success;
89
+ color: $color-white;
55
90
 
56
91
  &:hover {
57
- color: darken($gb-color-primary, 10%);
92
+ background: darken($gb-color-success, 10%);
58
93
  }
59
94
  }
60
95
 
61
96
  &--danger {
62
- background-color: $gb-color-danger;
97
+ background: $gb-color-danger;
63
98
  color: $color-white;
64
99
 
65
100
  &:hover {
66
- background-color: darken($gb-color-danger, 10%);
101
+ background: darken($gb-color-danger, 10%);
67
102
  }
68
103
  }
69
104
 
70
- &--disabled {
71
- background-color: $gb-color-component;
72
- color: $gb-color-disabled;
105
+ &--disabled,
106
+ &[disabled] {
107
+ opacity: 0.45;
73
108
  cursor: not-allowed;
74
109
  pointer-events: none;
75
110
  }
@@ -1,16 +1,15 @@
1
1
  .gc-card {
2
- border-width: 1px;
3
- border-style: solid;
4
- border-radius: $radius-medium;
5
- padding: $spacing-large;
2
+ background: $color-white;
3
+ border: 1px solid $gb-color-component-dark;
4
+ border-radius: $radius-large;
5
+ padding: 18px;
6
+ box-shadow: 0 1px 0 rgba(20, 20, 28, 0.04), 0 1px 2px rgba(20, 20, 28, 0.04);
6
7
 
7
8
  &--default {
8
9
  background-color: $gb-color-component-light;
9
- border-color: $gb-color-component-dark;
10
10
  }
11
11
 
12
12
  &--gradient {
13
13
  background: linear-gradient(#f5f5f5, #fff 10%);
14
- border-color: $gb-color-component-dark;
15
14
  }
16
15
  }
@@ -1,22 +1,26 @@
1
1
  describe("dropdown menu", () => {
2
2
  it("should open dropdown and pick a value", () => {
3
- cy.visit("localhost:3000");
3
+ cy.visit("http://localhost:3000");
4
+
5
+ cy.get("#dropdown").scrollIntoView();
6
+
4
7
  cy.get("[data-cy=dropdown-button]")
5
8
  .first()
9
+ .should("contain", "Red")
6
10
  .click()
7
11
  .get("[data-cy=dropdown-item]")
8
- .contains("Red")
12
+ .contains("Blue")
9
13
  .click()
10
14
  .get("[data-cy=dropdown-button]")
11
- .should("contain", "Red");
15
+ .should("contain", "Blue");
12
16
 
13
17
  cy.get("[data-cy=dropdown-button]")
14
18
  .first()
15
19
  .click()
16
20
  .get("[data-cy=dropdown-item]")
17
- .contains("Blue")
21
+ .contains("Red")
18
22
  .click()
19
23
  .get("[data-cy=dropdown-button]")
20
- .should("contain", "Blue");
24
+ .should("contain", "Red");
21
25
  });
22
26
  });
@@ -9,33 +9,60 @@
9
9
 
10
10
  &__label {
11
11
  display: block;
12
- color: $color-boulder;
13
- font-size: $font-size-very-large;
14
- font-weight: bold;
15
- padding-left: $spacing-small;
16
- margin-bottom: $spacing-small;
12
+ margin-bottom: 6px;
13
+ padding-left: 2px;
14
+ color: $gb-color-text;
15
+ font-size: 13px;
16
+ font-weight: 500;
17
17
  }
18
18
 
19
19
  &__field {
20
20
  box-sizing: border-box;
21
21
  display: block;
22
- border-radius: $radius-medium;
23
22
  width: 100%;
24
- padding: 0 $spacing-medium;
25
- font-size: $font-size-very-large;
26
- line-height: 34px;
23
+ height: 36px;
24
+ padding: 0 12px;
25
+ background: $color-white;
27
26
  border: 1px solid $gb-color-component-dark;
27
+ border-radius: $radius-medium;
28
+ color: $gb-color-text;
29
+ font-family: $gb-font;
30
+ font-size: 13.5px;
31
+ outline: none;
32
+ transition: border-color 0.12s, box-shadow 0.12s;
33
+
34
+ &::placeholder {
35
+ color: $color-boulder;
36
+ }
37
+
38
+ &:focus {
39
+ border-color: $gb-color-primary;
40
+ box-shadow: 0 0 0 3px rgba($gb-color-primary, 0.18);
41
+ }
28
42
 
29
43
  &--success {
30
44
  border-color: $gb-color-success;
45
+
46
+ &:focus {
47
+ box-shadow: 0 0 0 3px rgba($gb-color-success, 0.18);
48
+ }
31
49
  }
32
50
 
33
51
  &--danger {
34
52
  border-color: $gb-color-danger;
53
+
54
+ &:focus {
55
+ box-shadow: 0 0 0 3px rgba($gb-color-danger, 0.18);
56
+ }
35
57
  }
36
58
 
37
59
  &:disabled {
38
60
  border: 0;
61
+ opacity: 0.6;
39
62
  }
40
63
  }
64
+
65
+ &--full &__field {
66
+ max-width: 100%;
67
+ }
41
68
  }
@@ -1,20 +1,23 @@
1
1
  .gc-link {
2
2
  cursor: pointer;
3
3
  text-decoration: none;
4
+ transition: color 0.12s, border-color 0.12s;
4
5
 
5
6
  &--primary {
6
7
  color: $gb-color-link;
8
+ border-bottom: 1px solid rgba($gb-color-link, 0.3);
7
9
 
8
10
  &:hover {
9
- color: lighten($gb-color-link, 20%);
11
+ border-bottom-color: $gb-color-link;
10
12
  }
11
13
  }
12
14
 
13
15
  &--default {
14
16
  color: $gb-color-text;
17
+ border-bottom: 1px solid rgba($gb-color-text, 0.25);
15
18
 
16
19
  &:hover {
17
- color: lighten($gb-color-text, 20%);
20
+ border-bottom-color: $gb-color-text;
18
21
  }
19
22
  }
20
23
  }
@@ -12,7 +12,8 @@ function Logo({ className = "", onClick = () => {} }: Props) {
12
12
  /* eslint-disable jsx-a11y/no-static-element-interactions */
13
13
  return (
14
14
  <span onClick={onClick} className={logoClasses}>
15
- CODA_
15
+ CODA
16
+ <span className="gc-logo__cursor" aria-hidden="true" />
16
17
  </span>
17
18
  );
18
19
  /* eslint-enable jsx-a11y/no-static-element-interactions */
@@ -1,5 +1,27 @@
1
1
  .gc-logo {
2
- font-family: 'Inder Regular', sans-serif;
3
- font-size: 24px;
2
+ display: inline-flex;
3
+ align-items: baseline;
4
+ font-family: $gb-font-mono;
5
+ font-size: 22px;
6
+ font-weight: 500;
7
+ letter-spacing: 0.04em;
4
8
  color: $gb-color-logo;
9
+
10
+ &__cursor {
11
+ display: inline-block;
12
+ width: 0.5em;
13
+ height: 1em;
14
+ margin-left: 4px;
15
+ background: $gb-color-primary;
16
+ transform: translateY(2px);
17
+ animation: gc-logo-blink 1.1s steps(1) infinite;
18
+ }
19
+ }
20
+
21
+ @keyframes gc-logo-blink {
22
+ 50% { opacity: 0; }
23
+ }
24
+
25
+ @media (prefers-reduced-motion: reduce) {
26
+ .gc-logo__cursor { animation: none; }
5
27
  }
@@ -0,0 +1,40 @@
1
+ .gc-section-header {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 12px;
5
+ padding: 14px 18px;
6
+ background: $gb-color-component;
7
+ border: 1px solid $gb-color-component-dark;
8
+ border-radius: $radius-large;
9
+
10
+ &__icon {
11
+ display: grid;
12
+ place-items: center;
13
+ width: 32px;
14
+ height: 32px;
15
+ background: rgba($gb-color-primary, 0.14);
16
+ border-radius: 8px;
17
+ color: $gb-color-primary;
18
+ }
19
+
20
+ &__title {
21
+ font-size: 15px;
22
+ font-weight: 500;
23
+ }
24
+
25
+ &__sub {
26
+ margin-left: auto;
27
+ font-size: 13px;
28
+ color: $color-boulder;
29
+ }
30
+
31
+ &--success &__icon {
32
+ background: rgba($gb-color-success, 0.14);
33
+ color: $gb-color-success;
34
+ }
35
+
36
+ &--danger &__icon {
37
+ background: rgba($gb-color-danger, 0.14);
38
+ color: $gb-color-danger;
39
+ }
40
+ }
@@ -1,5 +1,6 @@
1
1
  .gc-separator {
2
- border-top: 1px solid $gb-color-component-dark;
3
- margin-bottom: $spacing-medium;
4
- margin-top: $spacing-medium;
2
+ height: 1px;
3
+ margin: 8px 0;
4
+ border: 0;
5
+ background: $gb-color-component-dark;
5
6
  }