@stackoverflow/stacks 1.8.0 → 1.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/dist/components/activity-indicator/activity-indicator.a11y.test.d.ts +1 -0
- package/dist/components/activity-indicator/activity-indicator.visual.test.d.ts +1 -0
- package/dist/components/avatar/avatar.a11y.test.d.ts +1 -0
- package/dist/components/avatar/avatar.visual.test.d.ts +1 -0
- package/dist/{controllers/s-banner.d.ts → components/banner/banner.d.ts} +1 -1
- package/dist/components/banner/banner.test.d.ts +1 -0
- package/dist/components/banner/banner.visual.test.d.ts +1 -0
- package/dist/components/button/button.a11y.test.d.ts +1 -0
- package/dist/components/button/button.visual.test.d.ts +1 -0
- package/dist/{controllers/s-expandable-control.d.ts → components/expandable/expandable.d.ts} +1 -1
- package/dist/components/expandable/expandable.test.d.ts +1 -0
- package/dist/{controllers/s-modal.d.ts → components/modal/modal.d.ts} +1 -1
- package/dist/{controllers/s-navigation-tablist.d.ts → components/navigation/navigation.d.ts} +1 -1
- package/dist/{controllers/s-popover.d.ts → components/popover/popover.d.ts} +1 -1
- package/dist/{controllers/s-tooltip.d.ts → components/popover/tooltip.d.ts} +1 -1
- package/dist/components/popover/tooltip.test.d.ts +1 -0
- package/dist/components/popover/tooltip.visual.test.d.ts +1 -0
- package/dist/{controllers/s-table.d.ts → components/table/table.d.ts} +1 -1
- package/dist/{controllers/s-toast.d.ts → components/toast/toast.d.ts} +1 -1
- package/dist/components/toast/toast.test.d.ts +1 -0
- package/dist/components/toast/toast.visual.test.d.ts +1 -0
- package/dist/{controllers/s-uploader.d.ts → components/uploader/uploader.d.ts} +1 -1
- package/dist/controllers.d.ts +9 -0
- package/dist/css/stacks.css +2043 -1989
- package/dist/css/stacks.min.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/js/stacks.js +545 -545
- package/dist/js/stacks.min.js +1 -1
- package/dist/test/test-utils.d.ts +136 -0
- package/lib/{css/atomic/borders.less → atomic/border.less} +18 -0
- package/lib/{css/base/icons.less → base/icon.less} +0 -9
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -0
- package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -0
- package/lib/components/avatar/avatar.a11y.test.ts +36 -0
- package/lib/components/avatar/avatar.visual.test.ts +54 -0
- package/lib/components/banner/banner.less +51 -0
- package/lib/{test/s-banner.test.ts → components/banner/banner.test.ts} +7 -3
- package/lib/{ts/controllers/s-banner.ts → components/banner/banner.ts} +1 -1
- package/lib/components/banner/banner.visual.test.ts +36 -0
- package/lib/components/button/button.a11y.test.ts +32 -0
- package/lib/{css/components/buttons.less → components/button/button.less} +3 -2
- package/lib/components/button/button.visual.test.ts +52 -0
- package/lib/{css/components/cards.less → components/card/card.less} +1 -1
- package/lib/components/check-control/check-control.less +17 -0
- package/lib/components/check-group/check-group.less +19 -0
- package/lib/{css/components → components/expandable}/expandable.less +3 -0
- package/lib/components/expandable/expandable.test.ts +53 -0
- package/lib/{ts/controllers/s-expandable-control.ts → components/expandable/expandable.ts} +1 -1
- package/lib/components/input-fill/input-fill.less +35 -0
- package/lib/components/input-icon/input-icon.less +45 -0
- package/lib/components/input-message/input-message.less +48 -0
- package/lib/{css/components/inputs.less → components/input_textarea/input_textarea.less} +0 -131
- package/lib/{css/components → components/link}/link.less +2 -2
- package/lib/{ts/controllers/s-modal.ts → components/modal/modal.ts} +1 -1
- package/lib/{ts/controllers/s-navigation-tablist.ts → components/navigation/navigation.ts} +1 -1
- package/lib/{css/components/notices.less → components/notice/notice.less} +0 -89
- package/lib/{css/components/popovers.less → components/popover/popover.less} +1 -0
- package/lib/{ts/controllers/s-popover.ts → components/popover/popover.ts} +1 -1
- package/lib/{test/s-tooltip.test.ts → components/popover/tooltip.test.ts} +6 -2
- package/lib/{ts/controllers/s-tooltip.ts → components/popover/tooltip.ts} +2 -2
- package/lib/{test/s-tooltip.visual.test.ts → components/popover/tooltip.visual.test.ts} +2 -2
- package/lib/{css/components/sidebar-widgets.less → components/sidebar-widget/sidebar-widget.less} +0 -1
- package/lib/{css/components → components/table}/table.less +0 -5
- package/lib/{ts/controllers/s-table.ts → components/table/table.ts} +1 -1
- package/lib/components/table-container/table-container.less +4 -0
- package/lib/components/toast/toast.less +35 -0
- package/lib/{test/s-toast.test.ts → components/toast/toast.test.ts} +7 -3
- package/lib/{ts/controllers/s-toast.ts → components/toast/toast.ts} +1 -1
- package/lib/components/toast/toast.visual.test.ts +27 -0
- package/lib/{ts/controllers/s-uploader.ts → components/uploader/uploader.ts} +1 -1
- package/lib/controllers.ts +33 -0
- package/lib/{ts/index.ts → index.ts} +1 -1
- package/lib/{css/stacks-dynamic.less → stacks-dynamic.less} +1 -2
- package/lib/stacks-static.less +93 -0
- package/lib/test/test-utils.ts +444 -0
- package/lib/tsconfig.json +1 -1
- package/package.json +17 -17
- package/dist/controllers/index.d.ts +0 -9
- package/lib/css/stacks-static.less +0 -87
- package/lib/test/s-avatar.a11y.test.ts +0 -77
- package/lib/test/s-banner.visual.test.ts +0 -61
- package/lib/test/s-btn.a11y.test.ts +0 -123
- package/lib/test/s-btn.visual.test.ts +0 -16
- package/lib/test/s-toast.visual.test.ts +0 -48
- package/lib/ts/controllers/index.ts +0 -17
- /package/lib/{css/atomic/colors.less → atomic/color.less} +0 -0
- /package/lib/{css/atomic → atomic}/flex.less +0 -0
- /package/lib/{css/atomic → atomic}/gap.less +0 -0
- /package/lib/{css/atomic → atomic}/grid.less +0 -0
- /package/lib/{css/atomic → atomic}/misc.less +0 -0
- /package/lib/{css/atomic → atomic}/spacing.less +0 -0
- /package/lib/{css/atomic → atomic}/typography.less +0 -0
- /package/lib/{css/atomic → atomic}/width-height.less +0 -0
- /package/lib/{css/base → base}/body.less +0 -0
- /package/lib/{css/base → base}/configuration-static.less +0 -0
- /package/lib/{css/base → base}/fieldset.less +0 -0
- /package/lib/{css/base/internals.less → base/internal.less} +0 -0
- /package/lib/{css/base → base}/reset-meyer.less +0 -0
- /package/lib/{css/base → base}/reset-normalize.less +0 -0
- /package/lib/{css/base → base}/reset.less +0 -0
- /package/lib/{css/components → components/activity-indicator}/activity-indicator.less +0 -0
- /package/lib/{css/components/anchors.less → components/anchor/anchor.less} +0 -0
- /package/lib/{css/components/avatars.less → components/avatar/avatar.less} +0 -0
- /package/lib/{css/components → components/award-bling}/award-bling.less +0 -0
- /package/lib/{css/components/badges.less → components/badge/badge.less} +0 -0
- /package/lib/{css/components → components/block-link}/block-link.less +0 -0
- /package/lib/{css/components → components/breadcrumbs}/breadcrumbs.less +0 -0
- /package/lib/{css/components/button-groups.less → components/button-group/button-group.less} +0 -0
- /package/lib/{css/components/checkboxes-radios.less → components/checkbox_radio/checkbox_radio.less} +0 -0
- /package/lib/{css/components/code-blocks.less → components/code-block/code-block.less} +0 -0
- /package/lib/{css/components → components/description}/description.less +0 -0
- /package/lib/{css/components/empty-states.less → components/empty-state/empty-state.less} +0 -0
- /package/lib/{css/components/labels.less → components/label/label.less} +0 -0
- /package/lib/{css/components/link-previews.less → components/link-preview/link-preview.less} +0 -0
- /package/lib/{css/components → components/menu}/menu.less +0 -0
- /package/lib/{css/components/modals.less → components/modal/modal.less} +0 -0
- /package/lib/{css/components → components/navigation}/navigation.less +0 -0
- /package/lib/{css/components/page-titles.less → components/page-title/page-title.less} +0 -0
- /package/lib/{css/components → components/pagination}/pagination.less +0 -0
- /package/lib/{css/components → components/post-summary}/post-summary.less +0 -0
- /package/lib/{css/components/progress-bars.less → components/progress-bar/progress-bar.less} +0 -0
- /package/lib/{css/components → components/prose}/prose.less +0 -0
- /package/lib/{css/components → components/select}/select.less +0 -0
- /package/lib/{css/components → components/spinner}/spinner.less +0 -0
- /package/lib/{css/components/tags.less → components/tag/tag.less} +0 -0
- /package/lib/{css/components/toggle-switches.less → components/toggle-switch/toggle-switch.less} +0 -0
- /package/lib/{css/components → components/topbar}/topbar.less +0 -0
- /package/lib/{css/components → components/uploader}/uploader.less +0 -0
- /package/lib/{css/components/user-cards.less → components/user-card/user-card.less} +0 -0
- /package/lib/{css/exports → exports}/constants-colors.less +0 -0
- /package/lib/{css/exports → exports}/constants-helpers.less +0 -0
- /package/lib/{css/exports → exports}/constants-type.less +0 -0
- /package/lib/{css/exports → exports}/exports.less +0 -0
- /package/lib/{css/exports → exports}/mixins.less +0 -0
- /package/lib/{css/input-utils.less → input-utils.less} +0 -0
- /package/lib/{css/stacks.less → stacks.less} +0 -0
- /package/lib/{ts/stacks.ts → stacks.ts} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.s-input-message {
|
|
2
|
+
--_im-fc: unset;
|
|
3
|
+
--_im-a-fc: unset;
|
|
4
|
+
--_im-a-fc-hover: unset;
|
|
5
|
+
|
|
6
|
+
.input-states({
|
|
7
|
+
a {
|
|
8
|
+
text-decoration: underline;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
fieldset[disabled] & {
|
|
13
|
+
cursor: not-allowed;
|
|
14
|
+
opacity: var(--_o-disabled-static);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// MODIFIERS
|
|
18
|
+
.has-error & {
|
|
19
|
+
--_im-fc: var(--red-500);
|
|
20
|
+
--_im-a-fc: var(--red-800);
|
|
21
|
+
--_im-a-fc-hover: var(--red-900);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.has-success & {
|
|
25
|
+
--_im-fc: var(--green-500);
|
|
26
|
+
--_im-a-fc: var(--green-800);
|
|
27
|
+
--_im-a-fc-hover: var(--green-900);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.has-warning & {
|
|
31
|
+
--_im-fc: var(--yellow-800);
|
|
32
|
+
--_im-a-fc: var(--yellow-900);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// CHILD ELEMENTS
|
|
36
|
+
a {
|
|
37
|
+
&:hover {
|
|
38
|
+
color: var(--_im-a-fc-hover);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
color: var(--_im-a-fc);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
color: var(--_im-fc);
|
|
45
|
+
|
|
46
|
+
font-size: var(--fs-caption);
|
|
47
|
+
padding: var(--su2);
|
|
48
|
+
}
|
|
@@ -164,134 +164,3 @@
|
|
|
164
164
|
top: 1.5em;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
// Other input-related elements
|
|
169
|
-
.s-input-fill {
|
|
170
|
-
--_if-bc: var(--bc-darker);
|
|
171
|
-
--_if-bg: var(--black-050);
|
|
172
|
-
--_if-blw: 0;
|
|
173
|
-
--_if-blr: 0;
|
|
174
|
-
--_if-brr: 0;
|
|
175
|
-
--_if-brw: 0;
|
|
176
|
-
|
|
177
|
-
&&__clear {
|
|
178
|
-
--_if-bc: transparent;
|
|
179
|
-
--_if-bg: transparent;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&.order-first {
|
|
183
|
-
--_if-blw: var(--su-static1);
|
|
184
|
-
--_if-blr: var(--br-sm);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&.order-last {
|
|
188
|
-
--_if-brw: var(--su-static1);
|
|
189
|
-
--_if-brr: var(--br-sm);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
background-color: var(--_if-bg);
|
|
193
|
-
border: var(--su-static1) solid var(--_if-bc);
|
|
194
|
-
border-left-width: var(--_if-blw);
|
|
195
|
-
border-right-width: var(--_if-brw);
|
|
196
|
-
border-radius: var(--_if-blr) var(--_if-brr) var(--_if-brr) var(--_if-blr);
|
|
197
|
-
|
|
198
|
-
color: var(--fc-medium);
|
|
199
|
-
font-family: inherit;
|
|
200
|
-
line-height: var(--lh-sm);
|
|
201
|
-
padding: 0.6em 0.7em;
|
|
202
|
-
white-space: nowrap;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.s-input-icon {
|
|
206
|
-
--_ii-fc: unset;
|
|
207
|
-
--_ii-r: 0.7em;
|
|
208
|
-
|
|
209
|
-
// MODIFIERS
|
|
210
|
-
.has-error & {
|
|
211
|
-
--_ii-fc: var(--red-400);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.has-success & {
|
|
215
|
-
--_ii-fc: var(--green-400);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.has-warning & {
|
|
219
|
-
--_ii-fc: var(--yellow-600);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.is-disabled & {
|
|
223
|
-
--_ii-fc: var(--black-400);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.is-readonly & {
|
|
227
|
-
--_ii-fc: var(--black-200);
|
|
228
|
-
|
|
229
|
-
.highcontrast-mode({
|
|
230
|
-
--_ii-fc: var(--fc-light);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
&&__creditcard,
|
|
235
|
-
&&__search {
|
|
236
|
-
--_ii-r: auto;
|
|
237
|
-
|
|
238
|
-
color: var(--black-400);
|
|
239
|
-
left: 0.7em;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
color: var(--_ii-fc);
|
|
243
|
-
right: var(--_ii-r);
|
|
244
|
-
|
|
245
|
-
margin-top: -9px; // Half the icon's height at 18px for centering;
|
|
246
|
-
pointer-events: none;
|
|
247
|
-
position: absolute;
|
|
248
|
-
top: 50%;
|
|
249
|
-
}
|
|
250
|
-
.s-input-message {
|
|
251
|
-
--_im-fc: unset;
|
|
252
|
-
--_im-a-fc: unset;
|
|
253
|
-
--_im-a-fc-hover: unset;
|
|
254
|
-
|
|
255
|
-
.input-states({
|
|
256
|
-
a {
|
|
257
|
-
text-decoration: underline;
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
fieldset[disabled] & {
|
|
262
|
-
cursor: not-allowed;
|
|
263
|
-
opacity: var(--_o-disabled-static);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// MODIFIERS
|
|
267
|
-
.has-error & {
|
|
268
|
-
--_im-fc: var(--red-500);
|
|
269
|
-
--_im-a-fc: var(--red-800);
|
|
270
|
-
--_im-a-fc-hover: var(--red-900);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.has-success & {
|
|
274
|
-
--_im-fc: var(--green-500);
|
|
275
|
-
--_im-a-fc: var(--green-800);
|
|
276
|
-
--_im-a-fc-hover: var(--green-900);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.has-warning & {
|
|
280
|
-
--_im-fc: var(--yellow-800);
|
|
281
|
-
--_im-a-fc: var(--yellow-900);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// CHILD ELEMENTS
|
|
285
|
-
a {
|
|
286
|
-
&:hover {
|
|
287
|
-
color: var(--_im-a-fc-hover);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
color: var(--_im-a-fc);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
color: var(--_im-fc);
|
|
294
|
-
|
|
295
|
-
font-size: var(--fs-caption);
|
|
296
|
-
padding: var(--su2);
|
|
297
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// TODO we *really* shouldn't be apply styles directly onto `<a>` like this, but
|
|
2
|
-
// it's tech debt that'll take some doing in
|
|
2
|
+
// it's tech debt that'll take some doing in consumer's code to pay down.
|
|
3
3
|
a,
|
|
4
4
|
.s-link {
|
|
5
5
|
--_li-fc: var(--theme-link-color);
|
|
@@ -105,7 +105,7 @@ a,
|
|
|
105
105
|
.s-link {
|
|
106
106
|
button& {
|
|
107
107
|
&:focus {
|
|
108
|
-
outline:
|
|
108
|
+
outline: revert;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
appearance: none;
|
|
@@ -194,51 +194,6 @@
|
|
|
194
194
|
font-size: var(--fs-body1);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
// Banner
|
|
198
|
-
// TODO deprecate .s-banner (by turning it into a modifier on .s-notice)
|
|
199
|
-
// This would reduce the amount of CSS we ship to the client and simplify our codebase
|
|
200
|
-
.s-banner {
|
|
201
|
-
--_no-x-offset: 0; // [1]
|
|
202
|
-
.construct-notice-component(s-banner);
|
|
203
|
-
|
|
204
|
-
&[aria-hidden="true"] { // If you want to hide and reveal the banner
|
|
205
|
-
--_no-x-offset: calc(var(--su48) + var(--su2) * -1); // -50px
|
|
206
|
-
opacity: 0;
|
|
207
|
-
visibility: hidden;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&[aria-hidden="false"] {
|
|
211
|
-
--_no-x-offset: calc(var(--su48) + var(--su1)); // 49px
|
|
212
|
-
opacity: 1;
|
|
213
|
-
visibility: visible;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
&.is-pinned { // If you want to put the banner above the topbar
|
|
217
|
-
z-index: calc(var(--zi-navigation-fixed) + 1);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
&__body-pt {
|
|
221
|
-
padding-top: 93px;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
& &--container { // When we want to keep hero content capped
|
|
225
|
-
margin: 0 auto;
|
|
226
|
-
max-width: calc(var(--s-step) * 10);
|
|
227
|
-
position: relative;
|
|
228
|
-
width: 100%;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
border-width: var(--su-static1) 0;
|
|
232
|
-
inset: 0 0 auto 0;
|
|
233
|
-
padding: var(--su12);
|
|
234
|
-
position: fixed;
|
|
235
|
-
-webkit-transform: translate3d(0, var(--_no-x-offset), 0);
|
|
236
|
-
transform: translate3d(0, var(--_no-x-offset), 0);
|
|
237
|
-
width: 100%;
|
|
238
|
-
z-index: calc(var(--zi-navigation-fixed) - 1); // Tuck below topbar
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Notice
|
|
242
197
|
.s-notice {
|
|
243
198
|
.construct-notice-component(s-notice);
|
|
244
199
|
|
|
@@ -246,47 +201,3 @@
|
|
|
246
201
|
border-width: var(--su-static1);
|
|
247
202
|
padding: var(--su16);
|
|
248
203
|
}
|
|
249
|
-
|
|
250
|
-
// Toast
|
|
251
|
-
.s-toast {
|
|
252
|
-
@media (prefers-reduced-motion) {
|
|
253
|
-
transform: none !important;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
&[aria-hidden="false"] {
|
|
257
|
-
opacity: 1;
|
|
258
|
-
transform: translate3d(0, 0, 0);
|
|
259
|
-
transition: visibility 0s 0s, opacity 100ms var(--te-smooth) 0s, transform 100ms var(--te-smooth) 0s;
|
|
260
|
-
visibility: visible;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.s-notice {
|
|
264
|
-
box-shadow: var(--bs-sm);
|
|
265
|
-
max-width: 44rem;
|
|
266
|
-
padding-bottom: var(--su8);
|
|
267
|
-
padding-top: var(--su8);
|
|
268
|
-
pointer-events: all;
|
|
269
|
-
width: 100%;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
display: flex;
|
|
273
|
-
justify-content: center;
|
|
274
|
-
left: var(--su8);
|
|
275
|
-
opacity: 0;
|
|
276
|
-
pointer-events: none;
|
|
277
|
-
position: fixed;
|
|
278
|
-
right: var(--su8);
|
|
279
|
-
top: var(--su16);
|
|
280
|
-
transform: translate3d(0, -66px, 0);
|
|
281
|
-
transition: transform 100ms var(--te-smooth-slow) 0s, opacity 60ms var(--te-smooth-slow) 0ms, visibility 0s 150ms;
|
|
282
|
-
visibility: hidden;
|
|
283
|
-
z-index: calc(var(--zi-modals) + 1); // Toasts should appear above modals
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// [1] When we use .s-banner, we need to adjust the padding-top on
|
|
287
|
-
// the body tag. This class correctly adjusts the body padding ONLY if
|
|
288
|
-
// the notice is one line. If it wraps to multiple lines, more classes or
|
|
289
|
-
// (ideally) JS will need to be used to determine the notice's height
|
|
290
|
-
// at the time of render. The padding value is determined like so:
|
|
291
|
-
// 50px (top bar) + 44px (notice height) - 1px (bottom border)
|
|
292
|
-
// The borders subtraction are necessary to neatly tuck everything together.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
2
|
import { screen, waitForElementToBeRemoved } from "@testing-library/dom";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import "
|
|
4
|
+
import "../../index";
|
|
5
5
|
|
|
6
6
|
const user = userEvent.setup();
|
|
7
7
|
|
|
8
|
-
describe("
|
|
8
|
+
describe("tooltip", () => {
|
|
9
9
|
it("should make the tooltip element visible on hover (after a delay)", async () => {
|
|
10
10
|
const trigger = await fixture(html`
|
|
11
11
|
<button
|
|
@@ -19,10 +19,12 @@ describe("s-tooltip", () => {
|
|
|
19
19
|
</button>
|
|
20
20
|
`);
|
|
21
21
|
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
22
23
|
expect(screen.queryByRole("tooltip")).to.be.null;
|
|
23
24
|
|
|
24
25
|
await user.hover(trigger);
|
|
25
26
|
const tooltip = await screen.findByRole("tooltip");
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
26
28
|
expect(tooltip).to.be.visible;
|
|
27
29
|
|
|
28
30
|
await user.unhover(trigger);
|
|
@@ -54,9 +56,11 @@ describe("s-tooltip", () => {
|
|
|
54
56
|
|
|
55
57
|
await user.hover(button);
|
|
56
58
|
const tooltip = await screen.findByRole("tooltip");
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
57
60
|
expect(tooltip).to.be.visible;
|
|
58
61
|
|
|
59
62
|
await user.hover(svg);
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
60
64
|
expect(tooltip).to.be.visible;
|
|
61
65
|
});
|
|
62
66
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Stacks from "
|
|
2
|
-
import { BasePopoverController, PopoverController } from "./
|
|
1
|
+
import * as Stacks from "../../stacks";
|
|
2
|
+
import { BasePopoverController, PopoverController } from "./popover";
|
|
3
3
|
|
|
4
4
|
export interface TooltipOptions {
|
|
5
5
|
placement: string;
|
|
@@ -2,11 +2,11 @@ import { html, fixture } from "@open-wc/testing";
|
|
|
2
2
|
import { screen } from "@testing-library/dom";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import { visualDiff } from "@web/test-runner-visual-regression";
|
|
5
|
-
import "
|
|
5
|
+
import "../../index";
|
|
6
6
|
|
|
7
7
|
const user = userEvent.setup();
|
|
8
8
|
|
|
9
|
-
describe("
|
|
9
|
+
describe("tooltip", () => {
|
|
10
10
|
it("should not introduce visual regressions", async () => {
|
|
11
11
|
const wrapper = await fixture(html`
|
|
12
12
|
<div style="height: 100px; width: 160px; display: inline-block;">
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// See also ./lib/components/notice/notice.less
|
|
2
|
+
.s-toast {
|
|
3
|
+
@media (prefers-reduced-motion) {
|
|
4
|
+
transform: none !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&[aria-hidden="false"] {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transform: translate3d(0, 0, 0);
|
|
10
|
+
transition: visibility 0s 0s, opacity 100ms var(--te-smooth) 0s, transform 100ms var(--te-smooth) 0s;
|
|
11
|
+
visibility: visible;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.s-notice {
|
|
15
|
+
box-shadow: var(--bs-sm);
|
|
16
|
+
max-width: 44rem;
|
|
17
|
+
padding-bottom: var(--su8);
|
|
18
|
+
padding-top: var(--su8);
|
|
19
|
+
pointer-events: all;
|
|
20
|
+
width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
left: var(--su8);
|
|
26
|
+
opacity: 0;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
position: fixed;
|
|
29
|
+
right: var(--su8);
|
|
30
|
+
top: var(--su16);
|
|
31
|
+
transform: translate3d(0, -66px, 0);
|
|
32
|
+
transition: transform 100ms var(--te-smooth-slow) 0s, opacity 60ms var(--te-smooth-slow) 0ms, visibility 0s 150ms;
|
|
33
|
+
visibility: hidden;
|
|
34
|
+
z-index: calc(var(--zi-modals) + 1); // Toasts should appear above modals
|
|
35
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
2
|
import { screen } from "@testing-library/dom";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import "
|
|
5
|
-
import { showToast, hideToast } from "
|
|
4
|
+
import "../../index";
|
|
5
|
+
import { showToast, hideToast } from "../../controllers";
|
|
6
6
|
|
|
7
7
|
const user = userEvent.setup();
|
|
8
8
|
|
|
@@ -30,17 +30,19 @@ const testToast = (hidden = true) => html` <button
|
|
|
30
30
|
</aside>
|
|
31
31
|
</div>`;
|
|
32
32
|
|
|
33
|
-
describe("
|
|
33
|
+
describe("toast", () => {
|
|
34
34
|
it("trigger should make toast visible", async () => {
|
|
35
35
|
await fixture(testToast(true));
|
|
36
36
|
|
|
37
37
|
const button = screen.getAllByRole("button")[0]; // Trigger button
|
|
38
38
|
const toast = screen.getByTestId("test-toast");
|
|
39
39
|
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
40
41
|
expect(toast).to.have.attribute("aria-hidden", "true");
|
|
41
42
|
button.addEventListener("click", () => showToast(toast));
|
|
42
43
|
|
|
43
44
|
await user.click(button);
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
44
46
|
expect(toast).to.have.attribute("aria-hidden", "false");
|
|
45
47
|
});
|
|
46
48
|
|
|
@@ -50,10 +52,12 @@ describe("s-toast", () => {
|
|
|
50
52
|
const button = screen.getAllByRole("button")[1]; // Close button
|
|
51
53
|
const toast = screen.getByTestId("test-toast");
|
|
52
54
|
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
53
56
|
expect(toast).to.have.attribute("aria-hidden", "false");
|
|
54
57
|
button.addEventListener("click", () => hideToast(toast));
|
|
55
58
|
|
|
56
59
|
await user.click(button);
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
57
61
|
expect(toast).to.have.attribute("aria-hidden", "true");
|
|
58
62
|
});
|
|
59
63
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import { html } from "@open-wc/testing";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("toast > notice", () => {
|
|
6
|
+
// This is a test of notice component wrapped in a toast component
|
|
7
|
+
runComponentTests({
|
|
8
|
+
type: "visual",
|
|
9
|
+
baseClass: "s-notice", // s-toast is a wrapper around s-notice
|
|
10
|
+
variants: ["info", "success", "warning", "danger"],
|
|
11
|
+
modifiers: {
|
|
12
|
+
primary: ["important"],
|
|
13
|
+
},
|
|
14
|
+
attributes: {
|
|
15
|
+
ariaHidden: "false",
|
|
16
|
+
},
|
|
17
|
+
children: {
|
|
18
|
+
toast: "Test toast",
|
|
19
|
+
},
|
|
20
|
+
tag: "aside",
|
|
21
|
+
template: ({ component, testid }) => html`
|
|
22
|
+
<div data-testid="${testid}" class="s-toast" aria-hidden="false">
|
|
23
|
+
${component}
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// export all controllers *with helpers* so they can be bulk re-exported by the package entry point
|
|
2
|
+
export {
|
|
3
|
+
BannerController,
|
|
4
|
+
hideBanner,
|
|
5
|
+
showBanner,
|
|
6
|
+
} from "./components/banner/banner";
|
|
7
|
+
export { ExpandableController } from "./components/expandable/expandable";
|
|
8
|
+
export {
|
|
9
|
+
ModalController,
|
|
10
|
+
hideModal,
|
|
11
|
+
showModal,
|
|
12
|
+
} from "./components/modal/modal";
|
|
13
|
+
export { TabListController } from "./components/navigation/navigation";
|
|
14
|
+
export {
|
|
15
|
+
attachPopover,
|
|
16
|
+
detachPopover,
|
|
17
|
+
hidePopover,
|
|
18
|
+
BasePopoverController,
|
|
19
|
+
PopoverController,
|
|
20
|
+
showPopover,
|
|
21
|
+
} from "./components/popover/popover";
|
|
22
|
+
export { TableController } from "./components/table/table";
|
|
23
|
+
export {
|
|
24
|
+
ToastController,
|
|
25
|
+
hideToast,
|
|
26
|
+
showToast,
|
|
27
|
+
} from "./components/toast/toast";
|
|
28
|
+
export {
|
|
29
|
+
setTooltipHtml,
|
|
30
|
+
setTooltipText,
|
|
31
|
+
TooltipController,
|
|
32
|
+
} from "./components/popover/tooltip";
|
|
33
|
+
export { UploaderController } from "./components/uploader/uploader";
|
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
// ----------------------------------------------------------------------------
|
|
17
17
|
// -- SET BASIC STYLES FOR BODY
|
|
18
18
|
@import "base/body.less";
|
|
19
|
-
|
|
20
19
|
// -- LESS CONSTANTS AND MIXINS
|
|
21
20
|
@import "exports/exports.less";
|
|
22
21
|
|
|
23
22
|
// -- CONFIG
|
|
24
23
|
@import "base/configuration-static.less";
|
|
25
|
-
@import "base/
|
|
24
|
+
@import "base/internal.less";
|