barbican-reset 1.5.8 → 1.5.9

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.
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <div :class="styleContainer" :data-test="testData">
3
- <div :class="styleWrap">
4
- <span :class="styleSpan">
5
- <div :class="$style.title" v-if="title.length > 0 && !toggle">{{ title }}</div>
2
+ <div :class="[`br-alert`,{ center }]" :data-test="`alert-${this.getStatus}`">
3
+ <div :class="[`wrap`, getStatus,{ inline },{ toggle }]">
4
+ <span :class="{ flex }">
5
+ <div class="title" v-if="title.length > 0 && !toggle">{{ title }}</div>
6
6
  <slot />
7
7
  </span>
8
- <b-button v-if="toggle" variant="invisible" :class="styleButton" @click="$emit('close')">
9
- <close-icon />
8
+ <b-button v-if="toggle" variant="invisible" :class="[`exit`, getStatus]" @click="$emit('close')">
9
+ <close-icon :status="getStatus" />
10
10
  </b-button>
11
11
  </div>
12
12
  </div>
@@ -21,6 +21,13 @@ export default {
21
21
  BButton,
22
22
  CloseIcon,
23
23
  },
24
+ computed: {
25
+ getStatus() {
26
+ if (this.error) { return "error"; }
27
+ if (this.success) { return "success"; }
28
+ return "neutral";
29
+ }
30
+ },
24
31
  props: {
25
32
  inline: {
26
33
  type: Boolean,
@@ -42,10 +49,6 @@ export default {
42
49
  type: Boolean,
43
50
  default: false,
44
51
  },
45
- margin: {
46
- type: String,
47
- default: null
48
- },
49
52
  title: {
50
53
  type: String,
51
54
  default: ''
@@ -54,202 +57,8 @@ export default {
54
57
  type: Boolean,
55
58
  default: false,
56
59
  }
57
- },
58
- computed: {
59
- testData() {
60
- if (this.error) {
61
- return 'alert-error';
62
- } else if (this.success) {
63
- return 'alert-success';
64
- } return 'alert-neutral';
65
- },
66
- styleContainer() {
67
- let style = this.$style;
68
- let output = [style.container];
69
- if (this.center) { output.push(style.center); }
70
- if (this.margin) {
71
- switch (this.margin) {
72
- case 'lg': output.push(style.margin_lg); break;
73
- case 'md': output.push(style.margin_md); break;
74
- default: output.push(style.margin_sm); break;
75
- }
76
- }
77
- return output;
78
- },
79
- styleWrap() {
80
- let style = this.$style;
81
- let output = [style.wrap];
82
- if (this.error) { output.push(style.error, 'error'); }
83
- if (this.success) { output.push(style.success, 'success'); }
84
- if (this.inline) { output.push(style.inline); }
85
- if (this.toggle) { output.push(style.toggle); }
86
- return output;
87
- },
88
- styleSpan() {
89
- let style = this.$style;
90
- let output = [];
91
- if (this.flex) { output.push(style.flex); }
92
- return output;
93
- },
94
- styleButton() {
95
- let style = this.$style;
96
- let output = [style.button];
97
- if (this.error) { output.push(style.error); }
98
- else if (this.success) { output.push(style.success); }
99
- else { output.push(style.neutral); }
100
- return output;
101
- }
102
60
  }
103
61
  };
104
- </script>
105
-
106
- <style lang="scss" module>
107
-
108
- $neutral-colors: $c-status-neutral, $c-status-neutral-fade;
109
- $success-colors: $c-status-success, $c-status-success-fade;
110
- $error-colors: $c-status-error, $c-status-error-fade;
111
-
112
- @mixin icon($color, $fade) {
113
- [data-fill] { fill: $fade; }
114
- [data-outline],
115
- [data-cross] { fill: $color; }
116
-
117
- @include focus {
118
- [data-fill] { fill: $color; }
119
- [data-cross] { fill: $fade; }
120
- }
121
- }
122
-
123
- .container {
124
- @include media-breakpoint-down(xs) {
125
- font-size: $font-size-sm;
126
- }
127
-
128
- &.margin_sm {
129
- margin-bottom: 1rem;
130
- }
131
-
132
- &.margin_md {
133
- margin-bottom: 1.25rem;
134
-
135
- @include media-breakpoint-up(md) {
136
- margin-bottom: 2rem;
137
- }
138
- }
139
-
140
- &.center {
141
- text-align: center;
142
-
143
- .wrap {
144
- justify-content: center;
145
- }
146
- }
147
- }
148
-
149
- .wrap {
150
- background-color: $c-status-neutral-fade;
151
- border-color: $c-status-neutral-light;
152
- border-radius: $border-radius;
153
- border-width: $border-width;
154
- color: $c-status-neutral;
155
- border-style: solid;
156
- padding: $space;
157
-
158
- &.inline {
159
- @include inline-block;
160
- }
161
-
162
- &.toggle {
163
- justify-content: space-between;
164
- align-items: center;
165
- display: flex;
166
- gap: $space;
167
-
168
- &.inline {
169
- display: inline-flex;
170
- }
171
- }
172
-
173
- a {
174
- @include focus {
175
- @include single-box($c-status-neutral);
176
- background-color: $c-status-neutral;
177
- color: $c-status-neutral-fade;
178
- }
179
- }
180
-
181
- p {
182
- margin-bottom: 0;
183
-
184
- + p {
185
- margin-top: 1rem;
186
- }
187
- }
188
-
189
- &.error {
190
- background-color: $c-status-error-fade;
191
- border-color: $c-status-error-light;
192
- color: $c-status-error;
193
- }
194
-
195
- &.success {
196
- background-color: $c-status-success-fade;
197
- border-color: $c-status-success-light;
198
- color: $c-status-success;
199
- }
200
- }
201
62
 
202
- .title {
203
- margin-bottom: 0.25rem;
204
- font-weight: 700;
205
- }
206
-
207
- .flex {
208
- justify-content: space-between;
209
- display: flex;
210
- }
211
-
212
- .button.neutral {
213
- @include icon($neutral-colors...);
214
- }
215
-
216
- .button.success {
217
- @include icon($success-colors...);
218
- }
219
-
220
- .button.error {
221
- @include icon($error-colors...);
222
- }
223
-
224
- </style>
225
-
226
- <style lang="scss" scoped>
227
-
228
- @mixin status_focus(
229
- $color: $c-status-neutral,
230
- $fade: $c-status-neutral-fade) {
231
-
232
- @include focus {
233
- @include single-box($color);
234
- background-color: $color;
235
- color: $fade;
236
- }
237
- }
238
-
239
- .btn.btn-link, a {
240
- @include status_focus;
241
- }
242
-
243
- .error {
244
- .btn.btn-link, a {
245
- @include status_focus($c-status-error, $c-status-error-fade);
246
- }
247
- }
248
-
249
- .success {
250
- .btn.btn-link, a {
251
- @include status_focus($c-status-success, $c-status-success-fade);
252
- }
253
- }
63
+ </script>
254
64
 
255
- </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <svg width="28" viewBox="0 0 20 20">
3
- <path data-fill fill="#fefbfa" d="M10,0C4.5,0,0,4.5,0,10s4.5,10,10,10s10-4.5,10-10S15.5,0,10,0z" />
4
- <path data-outline fill="#353535" d="M10,0C4.5,0,0,4.5,0,10s4.5,10,10,10s10-4.5,10-10S15.5,0,10,0z M10,18c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8 S14.4,18,10,18z" />
5
- <path data-cross fill="#353535" d="M12.6,6L10,8.6L7.4,6L6,7.4L8.6,10L6,12.6L7.4,14l2.6-2.6l2.6,2.6l1.4-1.4L11.4,10L14,7.4L12.6,6z" />
3
+ <path class="tint" fill="#fefbfa" d="M10,0C4.5,0,0,4.5,0,10s4.5,10,10,10s10-4.5,10-10S15.5,0,10,0z" />
4
+ <path class="cross" fill="#353535" d="M10,0C4.5,0,0,4.5,0,10s4.5,10,10,10s10-4.5,10-10S15.5,0,10,0z M10,18c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8 S14.4,18,10,18z" />
5
+ <path class="cross" fill="#353535" d="M12.6,6L10,8.6L7.4,6L6,7.4L8.6,10L6,12.6L7.4,14l2.6-2.6l2.6,2.6l1.4-1.4L11.4,10L14,7.4L12.6,6z" />
6
6
  </svg>
7
7
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barbican-reset",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "A collection of useful scss imports and js scripts, that provide consistent styling and functionality across barbican projects.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,140 @@
1
+
2
+ $neutral_wrap: $c-status-neutral, $c-status-neutral-fade, $c-status-neutral-light;
3
+ $success_wrap: $c-status-success, $c-status-success-fade, $c-status-success-light;
4
+ $error_wrap: $c-status-error, $c-status-error-fade, $c-status-error-light;
5
+
6
+ $neutral_focus: $c-status-neutral, $c-status-neutral-fade;
7
+ $success_focus: $c-status-success, $c-status-success-fade;
8
+ $error_focus: $c-status-error, $c-status-error-fade;
9
+
10
+ @mixin status_focus($main, $fade) {
11
+ @include focus {
12
+ @include single-box($main);
13
+ background-color: $main;
14
+ color: $fade;
15
+ }
16
+ }
17
+
18
+ @mixin exit($main, $fade) {
19
+ path.cross {
20
+ fill: $main;
21
+ }
22
+ path.tint {
23
+ fill: $fade;
24
+ }
25
+
26
+ @include focus {
27
+ outline-color: $main;
28
+
29
+ path.cross {
30
+ fill: $fade;
31
+ }
32
+ path.tint {
33
+ fill: $main;
34
+ }
35
+ }
36
+ }
37
+
38
+ @mixin wrap($main, $fade, $light) {
39
+ background-color: $fade;
40
+ border-color: $light;
41
+ color: $main;
42
+ }
43
+
44
+ .br-alert {
45
+ @include media-breakpoint-down(xs) {
46
+ font-size: $font-size-sm;
47
+ }
48
+
49
+ &.center {
50
+ text-align: center;
51
+
52
+ .wrap {
53
+ justify-content: center;
54
+ }
55
+ }
56
+
57
+ .wrap {
58
+ @include wrap($neutral_wrap...);
59
+ border-radius: $border-radius;
60
+ border-width: $border-width;
61
+ border-style: solid;
62
+ padding: $space;
63
+
64
+ .btn.btn-link, a {
65
+ @include status_focus($neutral_focus...);
66
+ }
67
+
68
+ &.error {
69
+ @include wrap($error_wrap...);
70
+
71
+ .btn.btn-link, a {
72
+ @include status_focus($error_focus...);
73
+ }
74
+ }
75
+
76
+ &.success {
77
+ @include wrap($success_wrap...);
78
+
79
+ .btn.btn-link, a {
80
+ @include status_focus($success_focus...);
81
+ }
82
+ }
83
+
84
+ &.inline {
85
+ @include inline-block;
86
+ }
87
+
88
+ &.toggle {
89
+ justify-content: space-between;
90
+ align-items: center;
91
+ display: flex;
92
+ gap: $space;
93
+
94
+ &.inline {
95
+ display: inline-flex;
96
+ }
97
+ }
98
+
99
+ p {
100
+ margin-bottom: 0;
101
+
102
+ + p {
103
+ margin-top: 1rem;
104
+ }
105
+ }
106
+ }
107
+
108
+ .title {
109
+ margin-bottom: 0.25rem;
110
+ font-weight: 700;
111
+ }
112
+
113
+ .flex {
114
+ justify-content: space-between;
115
+ display: flex;
116
+ }
117
+
118
+ .btn.exit {
119
+ border-radius: 50%;
120
+ border: none;
121
+ padding: 0;
122
+
123
+ @include focus {
124
+ outline: 0.1875rem solid;
125
+ box-shadow: none;
126
+ }
127
+
128
+ &.error {
129
+ @include exit($error_focus...);
130
+ }
131
+
132
+ &.success {
133
+ @include exit($success_focus...);
134
+ }
135
+
136
+ &.neutral {
137
+ @include exit($neutral_focus...);
138
+ }
139
+ }
140
+ }
package/scss/index.scss CHANGED
@@ -14,6 +14,7 @@
14
14
  @import "close-icon";
15
15
  @import "table/index";
16
16
  @import "promo";
17
+ @import "alert";
17
18
 
18
19
  // bootstrap component styles
19
20
  @import "btn";