@dialpad/dialtone 8.13.6 → 8.14.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/README.md CHANGED
@@ -2,19 +2,38 @@
2
2
 
3
3
  This is the home for Dialtone, Dialpad's design system. It includes the resources needed to create consistent, predictable interfaces that conform to Dialpad’s design principles, language, styles, and best practices.
4
4
 
5
- ## Install Dialtone via NPM
6
-
7
- To add Dialtone into your project, you can install it via NPM:
5
+ ## Install Dialtone
8
6
 
7
+ ### Install it via NPM:
9
8
  ```
10
9
  npm install @dialpad/dialtone
11
10
  ```
12
11
 
13
- Once installed, add the following line in your CSS/LESS file:
12
+ ### Import dialtone:
13
+ - CSS/LESS:
14
+ ```less
15
+ @import "node_modules/@dialpad/dialtone/lib/dist/css/dialtone.min.css";
16
+ ```
17
+ - Javascript:
18
+ ```js
19
+ import '@dialpad/dialtone/lib/dist/css/dialtone.min.css';
14
20
  ```
15
- @import "node_modules/@dialpad/dialtone/lib/dist/css/dialtone.css";
21
+
22
+ ### Add dialtone's theme class to the `<body>`
23
+
24
+ - Light mode
25
+ ```html
26
+ <body class="dialtone-theme-light">...</body>
16
27
  ```
17
28
 
29
+ - Dark mode
30
+ ```html
31
+ <body class="dialtone-theme-dark">...</body>
32
+ ```
33
+
34
+ This will define the Dialtone CSS variables for your desired theme.
35
+ It is required to do this for Dialtone to function.
36
+
18
37
  ## Building Dialtone locally
19
38
 
20
39
  To build Dialtone locally, visit our [installation instructions](https://dialpad.design/guides/getting-started/#build-dialtone-locally).
@@ -13,11 +13,7 @@
13
13
  .d-banner {
14
14
  // Component CSS Vars
15
15
  // ------------------------------------------------------------------------
16
- --banner-color-background: var(--dt-color-surface-secondary);
17
- --banner-color-text: var(--dt-color-foreground-primary);
18
- --notice-color-icon: var(--toast-color-text);
19
16
  --banner-color-border: var(--dt-color-border-subtle);
20
- --banner-font-size: var(--dt-font-size-200);
21
17
  --banner-line-height: var(--dt-font-line-height-200);
22
18
  --banner-dialog-padding-y: var(--dt-space-400);
23
19
  --banner-dialog-padding-x: var(--dt-space-500);
@@ -27,22 +23,15 @@
27
23
  right: 0;
28
24
  left: 0;
29
25
  z-index: var(--zi-navigation-fixed);
30
- display: flex;
31
- box-sizing: border-box;
32
- width: 100%;
26
+ max-width: 100%;
33
27
  min-height: var(--dt-size-650); // 48
34
- color: var(--banner-color-text);
35
- font-size: var(--banner-font-size);
28
+ padding: 0;
36
29
  line-height: var(--banner-line-height);
37
- background-color: var(--banner-color-background);
38
30
  border-bottom: 1px solid var(--banner-color-border);
39
31
  border-radius: 0;
40
32
  box-shadow: none;
41
33
 
42
- // If you want to hide and reveal the banner
43
34
  &[aria-hidden='true'] {
44
- --topbar-height: var(--dt-size-650);
45
-
46
35
  visibility: hidden;
47
36
  opacity: 0;
48
37
  }
@@ -52,17 +41,12 @@
52
41
  opacity: 1;
53
42
  }
54
43
 
55
- // If you want to put the banner above the topbar
56
- &.d-banner--pinned {
44
+ &--pinned {
57
45
  z-index: calc(~'var(--zi-navigation-fixed) + 1');
58
46
  transform: translate3d(0, 0, 0);
59
47
  }
60
48
  }
61
49
 
62
- .d-banner--transform {
63
- transform: translate3d(0, var(--topbar-height), 0);
64
- }
65
-
66
50
  // ============================================================================
67
51
  // $ CONTENT CONTAINER
68
52
  // ----------------------------------------------------------------------------
@@ -89,52 +73,5 @@
89
73
  // $$ DEFAULT IMPORTANT
90
74
  // ----------------------------------------------------------------------------
91
75
  .d-banner.d-banner--important {
92
- --banner-color-background: var(--dt-color-surface-strong);
93
- --banner-color-text: var(--dt-color-foreground-primary-inverted);
94
- --notice-color-icon: var(--dt-color-foreground-primary-inverted);
95
76
  --banner-color-border: transparent;
96
77
  }
97
-
98
- // $$ ERROR
99
- // ----------------------------------------------------------------------------
100
- .d-banner--error {
101
- --banner-color-background: var(--dt-color-surface-critical);
102
-
103
- &.d-banner--important {
104
- --banner-color-background: var(--dt-color-surface-critical-strong);
105
- --banner-color-text: var(--dt-color-foreground-primary-inverted);
106
- }
107
- }
108
-
109
- // $$ INFO
110
- // ----------------------------------------------------------------------------
111
- .d-banner--info {
112
- --banner-color-background: var(--dt-color-surface-info);
113
-
114
- &.d-banner--important {
115
- --banner-color-background: var(--dt-color-surface-info-strong);
116
- --banner-color-text: var(--dt-color-foreground-primary-inverted);
117
- }
118
- }
119
-
120
- // $$ SUCCESS
121
- // ----------------------------------------------------------------------------
122
- .d-banner--success {
123
- --banner-color-background: var(--dt-color-surface-success);
124
-
125
- &.d-banner--important {
126
- --banner-color-background: var(--dt-color-surface-success-strong);
127
- --banner-color-text: var(--dt-color-foreground-primary-inverted);
128
- }
129
- }
130
-
131
- // $$ WARNING
132
- // ----------------------------------------------------------------------------
133
- .d-banner--warning {
134
- --banner-color-background: var(--dt-color-surface-warning);
135
-
136
- &.d-banner--important {
137
- --banner-color-background: var(--dt-color-gold-200);
138
- --banner-color-text: var(--dt-color-foreground-primary);
139
- }
140
- }
@@ -136,7 +136,7 @@
136
136
  top: 0;
137
137
  width: 100%;
138
138
  padding-top: var(--dt-space-525);
139
- background: var(--dt-color-surface-secondary);
139
+ background: var(--dt-color-surface-primary);
140
140
  }
141
141
 
142
142
  &__list {
@@ -10,7 +10,9 @@
10
10
  // $ BASE WRAPPER
11
11
  // ----------------------------------------------------------------------------
12
12
 
13
- .d-notice {
13
+ .d-notice,
14
+ .d-banner,
15
+ .d-toast {
14
16
  // Component CSS Vars
15
17
  // ------------------------------------------------------------------------
16
18
  --notice-color-background: var(--dt-color-surface-secondary);
@@ -37,12 +39,6 @@
37
39
  background-color: var(--notice-color-background);
38
40
  border-radius: var(--notice-border-radius);
39
41
  box-shadow: var(--notice-box-shadow);
40
-
41
- .d-toast & {
42
- max-width: var(--dt-size-975);
43
- box-shadow: var(--dt-shadow-small);
44
- pointer-events: all;
45
- }
46
42
  }
47
43
 
48
44
  // ============================================================================
@@ -64,6 +60,10 @@
64
60
  flex: 0 auto;
65
61
  gap: var(--dt-space-400);
66
62
  align-items: center;
63
+
64
+ button {
65
+ color: var(--notice-color-text);
66
+ }
67
67
  }
68
68
 
69
69
  // $$ ICON
@@ -98,11 +98,13 @@
98
98
  // ============================================================================
99
99
  // $$ DEFAULT IMPORTANT
100
100
  // ----------------------------------------------------------------------------
101
- .d-notice.d-notice--important {
101
+ .d-notice.d-notice--important,
102
+ .d-banner.d-banner--important,
103
+ .d-toast.d-toast--important {
102
104
  --notice-color-background: var(--dt-color-surface-strong);
103
105
  --notice-color-text: var(--dt-color-foreground-primary-inverted);
106
+ --notice-color-icon: var(--notice-color-text);
104
107
  --notice-color-shadow: transparent;
105
- --notice-color-icon: var(--dt-color-foreground-primary-inverted);
106
108
  }
107
109
 
108
110
  // $$ ERROR
@@ -117,7 +119,6 @@
117
119
  &.d-banner--important,
118
120
  &.d-toast--important {
119
121
  --notice-color-background: var(--dt-color-surface-critical-strong);
120
- --notice-color-text: var(--dt-color-foreground-primary-inverted);
121
122
  }
122
123
  }
123
124
 
@@ -164,8 +165,7 @@
164
165
  &.d-notice--important,
165
166
  &.d-banner--important,
166
167
  &.d-toast--important {
167
- --notice-color-background: var(--dt-color-gold-200);
168
- --notice-color-text: var(--dt-color-foreground-primary);
169
- --notice-color-icon: var(--notice-color-text);
168
+ --notice-color-background: var(--dt-color-surface-warning-strong);
169
+ --notice-color-text: var(--dt-color-neutral-black);
170
170
  }
171
171
  }
@@ -53,6 +53,12 @@
53
53
  // Use shared style properties of d-input (<input>, <textarea>)
54
54
  .d-input();
55
55
 
56
+ // select options can be styled on windows
57
+ & option {
58
+ color: var(--dt-color-foreground-secondary);
59
+ background-color: var(--dt-color-surface-secondary);
60
+ }
61
+
56
62
  // -- FOCUS STATE
57
63
  &:focus {
58
64
  --input-color-background: var(--dt-inputs-color-background-focus);
@@ -25,28 +25,15 @@
25
25
  .d-toast {
26
26
  // Component CSS Vars
27
27
  // ------------------------------------------------------------------------
28
- --toast-color-background: var(--dt-color-surface-secondary);
29
- --toast-color-text: var(--dt-color-foreground-primary);
30
- --notice-color-icon: var(--toast-color-text);
31
- --toast-color-shadow: hsla(var(--dt-color-black-900-hsl) ~' / ' 15%);
32
- --toast-padding: var(--dt-space-500);
33
- --toast-border-radius: var(--dt-size-400);
28
+ --toast-color-shadow: hsla(var(--dt-color-black-900-hsl) / 0.15);
34
29
  --toast-box-shadow: 0 0 0 var(--dt-size-100) var(--toast-color-shadow) inset, var(--dt-shadow-medium);
35
- --toast-font-size: var(--dt-font-size-200);
36
- --toast-line-height: var(--dt-font-line-height-300);
37
30
 
38
31
  z-index: var(--zi-notification);
39
- box-sizing: border-box;
40
- width: 100%;
41
- max-width: var(--dt-size-1020); // 628
42
- padding: var(--toast-padding);
43
- color: var(--toast-color-text);
44
- font-size: var(--toast-font-size);
45
- line-height: var(--toast-line-height);
32
+ display: block;
33
+ max-width: var(--dt-size-975);
46
34
  word-break: normal;
47
- background-color: var(--toast-color-background);
48
- border-radius: var(--toast-border-radius);
49
35
  box-shadow: var(--toast-box-shadow);
36
+ pointer-events: all;
50
37
 
51
38
  // If there's a link in a toast, break the url so it wraps
52
39
  > a {
@@ -73,70 +60,11 @@
73
60
  display: flex;
74
61
  align-items: center;
75
62
 
76
- .d-notice__content {
77
- margin-right: var(--dt-space-500); // 16
78
- }
79
-
80
63
  .d-notice__actions {
81
64
  margin-left: var(--dt-space-600); // 32
82
65
  }
83
66
  }
84
67
 
85
- // ============================================================================
86
- // $ STYLES
87
- // ============================================================================
88
- // $$ DEFAULT IMPORTANT
89
- // ----------------------------------------------------------------------------
90
- .d-toast.d-toast--important {
91
- --toast-color-background: var(--dt-color-surface-strong);
92
- --toast-color-text: var(--dt-color-foreground-primary-inverted);
93
- --notice-color-icon: var(--toast-color-text);
94
- }
95
-
96
- // $$ ERROR
97
- // ----------------------------------------------------------------------------
98
- .d-toast--error {
99
- --toast-color-background: var(--dt-color-surface-critical);
100
-
101
- &.d-toast--important {
102
- --toast-color-background: var(--dt-color-red-400);
103
- --toast-color-text: var(--dt-color-foreground-primary-inverted);
104
- }
105
- }
106
-
107
- // $$ INFO
108
- // ----------------------------------------------------------------------------
109
- .d-toast--info {
110
- --toast-color-background: var(--dt-color-surface-info);
111
-
112
- &.d-toast--important {
113
- --toast-color-background: var(--dt-color-surface-info-strong);
114
- --toast-color-text: var(--dt-color-foreground-primary-inverted);
115
- }
116
- }
117
-
118
- // $$ SUCCESS
119
- // ----------------------------------------------------------------------------
120
- .d-toast--success {
121
- --toast-color-background: var(--dt-color-surface-success);
122
-
123
- &.d-toast--important {
124
- --toast-color-background: var(--dt-color-surface-success-strong);
125
- --toast-color-text: var(--dt-color-foreground-primary-inverted);
126
- }
127
- }
128
-
129
- // $$ WARNING
130
- // ----------------------------------------------------------------------------
131
- .d-toast--warning {
132
- --toast-color-background: var(--dt-color-surface-warning);
133
-
134
- &.d-toast--important {
135
- --toast-color-background: var(--dt-color-surface-warning-strong);
136
- --toast-color-text: var(--dt-color-foreground-primary);
137
- }
138
- }
139
-
140
68
  // ============================================================================
141
69
  // $ UC Toast Shims
142
70
  // ============================================================================
@@ -13,7 +13,6 @@
13
13
  // -- COMPONENTS
14
14
  @import 'components/avatar';
15
15
  @import 'components/badge';
16
- @import 'components/banner';
17
16
  @import 'components/breadcrumbs';
18
17
  @import 'components/button';
19
18
  @import 'components/card';
@@ -25,8 +24,9 @@
25
24
  @import 'components/link';
26
25
  @import 'components/list-group'; // Dialtone 5 shim
27
26
  @import 'components/modal';
28
- @import 'components/toast'; // Needs to come before Notice styles
29
27
  @import 'components/notice';
28
+ @import 'components/toast';
29
+ @import 'components/banner';
30
30
  @import 'components/popover';
31
31
  @import 'components/radio-checkbox';
32
32
  @import 'components/selects';