@stackoverflow/stacks 1.7.1 → 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/README.md +1 -1
- 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 +1351 -1171
- 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/base/fieldset.less +5 -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} +7 -6
- 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/components/checkbox_radio/checkbox_radio.less +158 -0
- package/lib/components/description/description.less +9 -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/components/input_textarea/input_textarea.less +166 -0
- package/lib/{css/components/labels.less → components/label/label.less} +4 -4
- package/lib/{css/components → components/link}/link.less +9 -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 → components/post-summary}/post-summary.less +6 -2
- package/lib/components/select/select.less +148 -0
- 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/{css/components/tags.less → components/tag/tag.less} +3 -3
- 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/{css/components/toggle-switches.less → components/toggle-switch/toggle-switch.less} +8 -0
- package/lib/{ts/controllers/s-uploader.ts → components/uploader/uploader.ts} +1 -1
- package/lib/controllers.ts +33 -0
- package/lib/{css/exports → exports}/mixins.less +73 -11
- package/lib/{ts/index.ts → index.ts} +1 -1
- package/lib/input-utils.less +44 -0
- 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 +26 -25
- package/dist/controllers/index.d.ts +0 -9
- package/lib/css/components/inputs.less +0 -666
- package/lib/css/stacks-static.less +0 -97
- package/lib/test/s-avatar.test.ts +0 -74
- package/lib/test/s-banner.visual.test.ts +0 -61
- package/lib/test/s-button.visual.test.ts +0 -12
- 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/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/code-blocks.less → components/code-block/code-block.less} +0 -0
- /package/lib/{css/components/empty-states.less → components/empty-state/empty-state.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/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/spinner}/spinner.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/stacks.less → stacks.less} +0 -0
- /package/lib/{ts/stacks.ts → stacks.ts} +0 -0
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
margin-bottom @ex-transition-duration cubic-bezier(0, 0, 0, 1),
|
|
18
18
|
transform @ex-transition-duration cubic-bezier(1, 0, 1, 1),
|
|
19
19
|
opacity @ex-transition-duration cubic-bezier(1, 0, 1, 1);
|
|
20
|
+
--_ex-content-v: unset;
|
|
20
21
|
|
|
21
22
|
&:not(.is-expanded) {
|
|
22
23
|
--_ex-after-h: 0;
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
max-height 0s @ex-transition-duration,
|
|
33
34
|
transform @ex-transition-duration cubic-bezier(0, 1, 1, 1),
|
|
34
35
|
opacity @ex-transition-duration cubic-bezier(0, 1, 1, 1);
|
|
36
|
+
--_ex-content-v: hidden;
|
|
35
37
|
|
|
36
38
|
& .s-expandable--content {
|
|
37
39
|
@supports ((-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)) or (clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%))) {
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
opacity: var(--_ex-content-o);
|
|
63
65
|
-webkit-transform: var(--_ex-content-transform);
|
|
64
66
|
transform: var(--_ex-content-transform);
|
|
67
|
+
visibility: var(--_ex-content-v);
|
|
65
68
|
|
|
66
69
|
-ms-flex-preferred-size: 100%;
|
|
67
70
|
flex-basis: 100%;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
|
+
import { screen } from "@testing-library/dom";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import "../../index";
|
|
5
|
+
|
|
6
|
+
const user = userEvent.setup();
|
|
7
|
+
|
|
8
|
+
describe("expandable-control", () => {
|
|
9
|
+
it("should focus on expandable content only when expanded", async () => {
|
|
10
|
+
const trigger = await fixture(html`
|
|
11
|
+
<button
|
|
12
|
+
data-controller="s-expandable-control"
|
|
13
|
+
aria-expanded="false"
|
|
14
|
+
aria-controls="expandable-example"
|
|
15
|
+
>
|
|
16
|
+
expandable trigger
|
|
17
|
+
</button>
|
|
18
|
+
<div class="s-expandable" id="expandable-example">
|
|
19
|
+
<div class="s-expandable--content">
|
|
20
|
+
<button>inside expandable</button>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
`);
|
|
24
|
+
|
|
25
|
+
// expandable is not expanded
|
|
26
|
+
let expandableTrigger = screen.getByRole("button", {
|
|
27
|
+
name: "expandable trigger",
|
|
28
|
+
expanded: false,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
32
|
+
expect(
|
|
33
|
+
screen.queryByRole("button", {
|
|
34
|
+
name: "inside expandable",
|
|
35
|
+
})
|
|
36
|
+
).to.be.null;
|
|
37
|
+
|
|
38
|
+
await userEvent.click(expandableTrigger);
|
|
39
|
+
|
|
40
|
+
// expandable is now expanded
|
|
41
|
+
expandableTrigger = screen.getByRole("button", {
|
|
42
|
+
name: "expandable trigger",
|
|
43
|
+
expanded: true,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
47
|
+
expect(
|
|
48
|
+
screen.getByRole("button", {
|
|
49
|
+
name: "inside expandable",
|
|
50
|
+
})
|
|
51
|
+
).to.be.visible;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.s-input-fill {
|
|
2
|
+
--_if-bc: var(--bc-darker);
|
|
3
|
+
--_if-bg: var(--black-050);
|
|
4
|
+
--_if-blw: 0;
|
|
5
|
+
--_if-blr: 0;
|
|
6
|
+
--_if-brr: 0;
|
|
7
|
+
--_if-brw: 0;
|
|
8
|
+
|
|
9
|
+
&&__clear {
|
|
10
|
+
--_if-bc: transparent;
|
|
11
|
+
--_if-bg: transparent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.order-first {
|
|
15
|
+
--_if-blw: var(--su-static1);
|
|
16
|
+
--_if-blr: var(--br-sm);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.order-last {
|
|
20
|
+
--_if-brw: var(--su-static1);
|
|
21
|
+
--_if-brr: var(--br-sm);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
background-color: var(--_if-bg);
|
|
25
|
+
border: var(--su-static1) solid var(--_if-bc);
|
|
26
|
+
border-left-width: var(--_if-blw);
|
|
27
|
+
border-right-width: var(--_if-brw);
|
|
28
|
+
border-radius: var(--_if-blr) var(--_if-brr) var(--_if-brr) var(--_if-blr);
|
|
29
|
+
|
|
30
|
+
color: var(--fc-medium);
|
|
31
|
+
font-family: inherit;
|
|
32
|
+
line-height: var(--lh-sm);
|
|
33
|
+
padding: 0.6em 0.7em;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.s-input-icon {
|
|
2
|
+
--_ii-fc: unset;
|
|
3
|
+
--_ii-r: 0.7em;
|
|
4
|
+
|
|
5
|
+
// MODIFIERS
|
|
6
|
+
.has-error & {
|
|
7
|
+
--_ii-fc: var(--red-400);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.has-success & {
|
|
11
|
+
--_ii-fc: var(--green-400);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.has-warning & {
|
|
15
|
+
--_ii-fc: var(--yellow-600);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.is-disabled & {
|
|
19
|
+
--_ii-fc: var(--black-400);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.is-readonly & {
|
|
23
|
+
--_ii-fc: var(--black-200);
|
|
24
|
+
|
|
25
|
+
.highcontrast-mode({
|
|
26
|
+
--_ii-fc: var(--fc-light);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&&__creditcard,
|
|
31
|
+
&&__search {
|
|
32
|
+
--_ii-r: auto;
|
|
33
|
+
|
|
34
|
+
color: var(--black-400);
|
|
35
|
+
left: 0.7em;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
color: var(--_ii-fc);
|
|
39
|
+
right: var(--_ii-r);
|
|
40
|
+
|
|
41
|
+
margin-top: -9px; // Half the icon's height at 18px for centering;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 50%;
|
|
45
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
.s-input,
|
|
2
|
+
.s-textarea {
|
|
3
|
+
--_in-bc: var(--bc-darker);
|
|
4
|
+
--_in-bc-focus: var(--theme-secondary-300);
|
|
5
|
+
--_in-bg: var(--white);
|
|
6
|
+
--_in-br: var(--br-sm);
|
|
7
|
+
--_in-bs-focus: 0 0 0 var(--su-static4) var(--focus-ring);
|
|
8
|
+
--_in-c: unset;
|
|
9
|
+
--_in-fc: var(--fc-dark);
|
|
10
|
+
--_in-fc-focus: var(--black);
|
|
11
|
+
--_in-fs: var(--fs-body1);
|
|
12
|
+
--_in-o: unset;
|
|
13
|
+
--_in-px: 0.7em;
|
|
14
|
+
--_in-py: 0.6em;
|
|
15
|
+
--_in-placeholder-fc: var(--black-200);
|
|
16
|
+
|
|
17
|
+
// CONTEXTUAL STYLES
|
|
18
|
+
@supports (-webkit-overflow-scrolling: touch) {
|
|
19
|
+
--_in-fs: var(--su-static16); // 16px — Increase font size for mobile safari. This keeps our inputs from zooming the page while focused.
|
|
20
|
+
--_in-px: 0.55em;
|
|
21
|
+
--_in-py: 0.36em;
|
|
22
|
+
|
|
23
|
+
&::-webkit-input-placeholder {
|
|
24
|
+
line-height: normal !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.highcontrast-mode({
|
|
29
|
+
--_in-bc: var(--black);
|
|
30
|
+
--_in-placeholder-fc: var(--black-400);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// MODIFIERS
|
|
34
|
+
fieldset[disabled] &,
|
|
35
|
+
&[disabled],
|
|
36
|
+
&[readonly],
|
|
37
|
+
.is-readonly & {
|
|
38
|
+
--_in-c: not-allowed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fieldset[disabled] &,
|
|
42
|
+
&[disabled] {
|
|
43
|
+
--_in-o: var(--_o-disabled-static);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[readonly],
|
|
47
|
+
.is-readonly & {
|
|
48
|
+
.highcontrast-mode({
|
|
49
|
+
--_in-fc: var(--fc-light);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
--_in-bg: var(--black-050);
|
|
53
|
+
--_in-bc: var(--bc-light);
|
|
54
|
+
--_in-fc: var(--black-200);
|
|
55
|
+
--_in-fc-focus: var(--_in-fc);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.validation-states(
|
|
59
|
+
in,
|
|
60
|
+
{ .highcontrast-mode({ --_in-bc: var(--red-400); }); },
|
|
61
|
+
{ .highcontrast-mode({ --_in-bc: var(--green-400); }); },
|
|
62
|
+
{ .highcontrast-mode({ --_in-bc: var(--yellow-600); }); }
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// Sizes
|
|
66
|
+
&&__sm {
|
|
67
|
+
.size-styles(sm; in; @styles: fs);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&&__md {
|
|
71
|
+
@supports (-webkit-overflow-scrolling: touch) {
|
|
72
|
+
--_in-fs: 17px;
|
|
73
|
+
--_in-py: 0.4em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.size-styles(md; in; @styles: br, fs);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&&__lg {
|
|
80
|
+
.size-styles(lg; in; @styles: br, fs);
|
|
81
|
+
--_in-px: 0.6em;
|
|
82
|
+
--_in-py: 0.45em;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&&__xl {
|
|
86
|
+
.size-styles(xl; in; @styles: br, fs);
|
|
87
|
+
--_in-px: 0.5em;
|
|
88
|
+
--_in-py: 0.4em;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// CHILD ELEMENTS
|
|
92
|
+
.webkit-autofill();
|
|
93
|
+
|
|
94
|
+
&::placeholder,
|
|
95
|
+
&::-webkit-input-placeholder {
|
|
96
|
+
color: var(--_in-placeholder-fc);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&::placeholder {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&&__creditcard,
|
|
104
|
+
&&__search {
|
|
105
|
+
--_in-pl: var(--su-static32);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// INTERACTION
|
|
109
|
+
&:focus{
|
|
110
|
+
border-color: var(--_in-bc-focus);
|
|
111
|
+
box-shadow: var(--_in-bs-focus);
|
|
112
|
+
color: var(--_in-fc-focus);
|
|
113
|
+
outline: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@scrollbar-styles();
|
|
117
|
+
background-color: var(--_in-bg);
|
|
118
|
+
border: var(--su-static1) solid var(--_in-bc);
|
|
119
|
+
border-radius: var(--_in-br);
|
|
120
|
+
color: var(--_in-fc);
|
|
121
|
+
cursor: var(--_in-c);
|
|
122
|
+
font-size: var(--_in-fs);
|
|
123
|
+
opacity: var(--_in-o);
|
|
124
|
+
padding: var(--_in-py) var(--_in-px) var(--_in-py) var(--_in-pl, var(--_in-px));
|
|
125
|
+
|
|
126
|
+
-webkit-appearance: none; // Removes shadows we don't want in mobile Safari
|
|
127
|
+
font-family: inherit;
|
|
128
|
+
margin: 0; // A guard against Core's default margins
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.s-input {
|
|
133
|
+
.input-states({
|
|
134
|
+
padding-right: var(--su32);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
&:focus-within {
|
|
138
|
+
.highcontrast-mode({
|
|
139
|
+
--_in-bc-focus: var(--black);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
border-color: var(--_in-bc-focus);
|
|
143
|
+
box-shadow: var(--_in-bs-focus);
|
|
144
|
+
color: var(--_in-fc-focus);
|
|
145
|
+
outline: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&&__md {
|
|
149
|
+
--_in-py: 0.5em;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.s-textarea {
|
|
154
|
+
.input-states({
|
|
155
|
+
padding-right: var(--su48);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
&&__md {
|
|
159
|
+
--_in-py: 0.72em;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
~ .s-input-icon {
|
|
163
|
+
right: 1.5em;
|
|
164
|
+
top: 1.5em;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
// MODIFIERS
|
|
24
24
|
// Sizes
|
|
25
25
|
&&__sm {
|
|
26
|
-
|
|
26
|
+
.size-styles(sm; la; @styles: fs);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&&__md {
|
|
30
|
-
|
|
30
|
+
.size-styles(md; la; @styles: fs);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&&__lg {
|
|
34
|
-
|
|
34
|
+
.size-styles(lg; la; @styles: fs);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&&__xl {
|
|
38
|
-
|
|
38
|
+
.size-styles(xl; la; @styles: fs);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// CHILD ELEMENTS
|
|
@@ -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);
|
|
@@ -83,6 +83,13 @@ a,
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// MODIFIERS
|
|
87
|
+
fieldset[disabled] & {
|
|
88
|
+
box-shadow: none !important;
|
|
89
|
+
opacity: var(--_o-disabled-static);
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
86
93
|
// INTERACTION
|
|
87
94
|
&:active,
|
|
88
95
|
&:hover {
|
|
@@ -98,7 +105,7 @@ a,
|
|
|
98
105
|
.s-link {
|
|
99
106
|
button& {
|
|
100
107
|
&:focus {
|
|
101
|
-
outline:
|
|
108
|
+
outline: revert;
|
|
102
109
|
}
|
|
103
110
|
|
|
104
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;">
|
|
@@ -206,8 +206,12 @@
|
|
|
206
206
|
margin: 0 !important;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
&,
|
|
210
|
+
&.s-btn { // To override .s-btn class attributes
|
|
211
|
+
padding: var(--su8);
|
|
212
|
+
position: absolute;
|
|
213
|
+
}
|
|
214
|
+
|
|
211
215
|
right: var(--su8);
|
|
212
216
|
top: var(--su8);
|
|
213
217
|
}
|