Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ship Overlay v2 #3456

Merged
merged 46 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c00c3ca
feat(overlay): ship Overlay API v2
Westbrook Jul 17, 2023
aca9e45
feat(dialog): leverage Overlay v2
Westbrook Jul 17, 2023
26485da
feat(tooltip): leverage Overlay v2
Westbrook Jul 17, 2023
e8eed79
docs: leverage Overlay v2
Westbrook Jul 17, 2023
7ea6977
feat(menu): prepare for Overlay v2 and less connnected/disconnected r…
Westbrook Jul 17, 2023
0ee5c35
feat(popover): leverage Overlay v2
Westbrook Jul 17, 2023
afd8a89
feat(picker,action-group,split-button): leverage Overlay v2
Westbrook Jul 17, 2023
c31aeb3
test: leverage for test coverage
Westbrook Jul 17, 2023
9bf372a
chore: adopt changes from #3181
Westbrook Jul 19, 2023
1d72b8d
chore: code review updates
Westbrook Jul 19, 2023
b502559
chore: code review updates 2
Westbrook Jul 26, 2023
cf3265f
refactor: invert extension order of the Overlay class
Westbrook Jul 28, 2023
1351a7a
refactor: update "Enter" key support and focus throwing
Westbrook Jul 28, 2023
56912d2
fix: allow non-selection carying Picker derivatives to report value
Westbrook Jul 28, 2023
9606067
refactor: ongoing clean up
Westbrook Jul 30, 2023
7910a51
refactor: reduce duplicate code
Westbrook Jul 31, 2023
d1d6517
chore: code review
Westbrook Aug 2, 2023
d8f33a5
test: coverage
Westbrook Aug 2, 2023
3b833b8
chore: floating-ui versions
Westbrook Aug 4, 2023
94fb398
fix: address margin effected positioning
Westbrook Aug 5, 2023
3681f2b
refactor: maintain auto close approach from previous flaoting-ui vers…
Westbrook Aug 7, 2023
6c2a4a3
test: coverage
Westbrook Aug 7, 2023
1424f4e
refactor: tooltip association workflow
Westbrook Aug 8, 2023
0950910
fix: handle longpress and over filter overlays
Westbrook Aug 9, 2023
1fa0105
test: coverage
Westbrook Aug 9, 2023
a25514a
test: more coverage
Westbrook Aug 9, 2023
77cf0ec
fix: ensure submenus stay open when root it clicked again
Westbrook Aug 10, 2023
966e9e4
refactor: submenu open workflow
Westbrook Aug 10, 2023
40fa67f
docs: clarify uncovered API surface and API types/descriptions
Westbrook Aug 14, 2023
4700ecf
chore: complete rebase
Westbrook Aug 14, 2023
65d1863
refactor: address code review comments
Westbrook Aug 15, 2023
9401ef2
refactor: cyclical placement and sizing management
Westbrook Aug 15, 2023
c300fb5
perf: open/close timing update
Westbrook Aug 16, 2023
9f53c01
perf: make lots of things lazy
Westbrook Aug 16, 2023
e707af2
chore: message the merge
Westbrook Aug 16, 2023
70dd1ab
test: correct tooltip benchmark
Westbrook Aug 17, 2023
cb4f9a4
perf: make submenus lazy
Westbrook Aug 17, 2023
4e845db
test: clean up timing
Westbrook Aug 17, 2023
cb81777
refactor: review VRT results
Westbrook Aug 17, 2023
96ab72f
perf: make submenus lazier
Westbrook Aug 17, 2023
be97af3
chore: code review changes
Westbrook Aug 18, 2023
91172f6
chore: final code review changes?
Westbrook Aug 18, 2023
7df240c
chore: clean up
Westbrook Aug 18, 2023
f064251
chore: extra protection for various states
Westbrook Aug 18, 2023
b6bc830
docs: update final dates and versions
Westbrook Aug 18, 2023
fc87ce2
ci: update golden images cache
Westbrook Aug 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ executors:
parameters:
current_golden_images_hash:
type: string
default: 68bb9c038f91e9577b14802dcf923cd1dace34e7
default: bd0e3b059017f75117482c310263df3a3ae5404c
wireit_cache_name:
type: string
default: wireit
Expand Down
2 changes: 1 addition & 1 deletion cem-react-wrapper.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
plugins: [
defineElementPlugin(),
reactWrapperPlugin({
exclude: ['StoryDecorator'],
exclude: ['StoryDecorator', 'TooltipOpenable'],
outDir: '../../react',
prettierConfig: yaml.load(
readFileSync(resolve('../../.prettierrc.yaml'))
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"docs:review": "alex packages/**/*.md",
"docs:start": "yarn workspace documentation serve --watch",
"find": "test -f custom-elements.json",
"gen-react-wrapper": "rm -fr react && lerna exec --ignore \"{@spectrum-web-components/{base,bundle,custom-vars-viewer,modal,iconset,shared,opacity-checkerboard,styles,reactive-controllers},@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- cem analyze --config ../../cem-react-wrapper.config.js && node ./scripts/generate-icon-react-wrapper.js",
"gen-react-wrapper": "rm -fr react && lerna exec --ignore \"{@spectrum-web-components/{base,bundle,custom-vars-viewer,modal,iconset,shared,opacity-checkerboard,styles,reactive-controllers,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- cem analyze --config ../../cem-react-wrapper.config.js && node ./scripts/generate-icon-react-wrapper.js",
"get-ready": "yarn build:clear-cache && yarn build",
"icons": "wireit",
"icons:ui": "wireit",
Expand All @@ -55,7 +55,7 @@
"prepare": "husky install",
"prestorybook": "wireit",
"prestorybook:build": "cem analyze --outdir .storybook/",
"pretest:bench": "test -f test/benchmark/cli.js ||:",
"pretest:bench": "yarn build:tests && test -f test/benchmark/cli.js ||:",
"pretest:visual": "yarn build && yarn build",
"process-icons": "wireit",
"process-spectrum": "wireit",
Expand All @@ -68,19 +68,20 @@
"storybook:quick": "run-p build:watch storybook:run",
"storybook:run": "web-dev-server --config wds-storybook.config.js",
"test": "yarn test:focus unit",
"test:bench": "node test/benchmark/cli.js",
"test:bench": "yarn build:tests && node test/benchmark/cli.js",
"test:changed": "node ./tasks/test-changes.js",
"test:ci": "yarn test:start",
"test:create": "wireit",
"test:errors": "yarn test | grep -A 32 ❌",
"test:focus": "yarn build && yarn test:ci --coverage --group",
"test:focus": "yarn build && yarn test:ci --group",
"test:start": "web-test-runner",
"test:visual": "yarn test:visual:ci",
"test:visual:ci": "yarn test:start --group",
"test:visual:clean": "yarn test:visual:clean:baseline && yarn test:visual:clean:current",
"test:visual:clean:baseline": "rimraf test/visual/screenshots-baseline",
"test:visual:clean:current": "rimraf test/visual/screenshots-current",
"test:watch": "yarn test:watch:focus unit",
"test:watch:flags:focus": "yarn build && run-p build:watch \"test:start --watch --group {1} --config web-test-runner.config.ci-chromium-flags.js\" --",
"test:watch:focus": "yarn build && run-p build:watch \"test:start --watch --group {1}\" --",
"update:spectrum-css": "node ./scripts/update-spectrum-css.js --latest || yarn update:spectrum-css:cleanup",
"update:spectrum-css:cleanup": "yarn lint:packagejson && yarn --ignore-scripts && yarn process-spectrum",
Expand Down Expand Up @@ -152,7 +153,7 @@
"gh-pages": "^4.0.0",
"glob": "^10.3.0",
"gunzip-maybe": "^1.4.2",
"husky": "^8.0.1",
"husky": "^8.0.3",
"latest-version": "^7.0.0",
"lerna": "^6.0.1",
"lightningcss": "^1.19.0",
Expand Down
36 changes: 29 additions & 7 deletions packages/action-button/src/ActionButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class ActionButton extends SizedMixin(ButtonBase, {
constructor() {
super();
this.addEventListener('click', this.onClick);
this.addEventListener('pointerdown', this.onPointerdown);
}

private onClick = (): void => {
Expand All @@ -134,10 +133,13 @@ export class ActionButton extends SizedMixin(ButtonBase, {
}
};

private onPointerdown(event: PointerEvent): void {
private handlePointerdownHoldAffordance(event: PointerEvent): void {
if (event.button !== 0) return;
this.addEventListener('pointerup', this.onPointerup);
this.addEventListener('pointercancel', this.onPointerup);
this.addEventListener('pointerup', this.handlePointerupHoldAffordance);
this.addEventListener(
'pointercancel',
this.handlePointerupHoldAffordance
);
LONGPRESS_TIMEOUT = setTimeout(() => {
this.dispatchEvent(
new CustomEvent<LongpressEvent>('longpress', {
Expand All @@ -151,10 +153,16 @@ export class ActionButton extends SizedMixin(ButtonBase, {
}, LONGPRESS_DURATION);
}

private onPointerup(): void {
private handlePointerupHoldAffordance(): void {
clearTimeout(LONGPRESS_TIMEOUT);
this.removeEventListener('pointerup', this.onPointerup);
this.removeEventListener('pointercancel', this.onPointerup);
this.removeEventListener(
'pointerup',
this.handlePointerupHoldAffordance
);
this.removeEventListener(
'pointercancel',
this.handlePointerupHoldAffordance
);
}

/**
Expand Down Expand Up @@ -258,6 +266,20 @@ export class ActionButton extends SizedMixin(ButtonBase, {
);
}
}
if (changes.has('holdAffordance')) {
if (this.holdAffordance) {
this.addEventListener(
'pointerdown',
this.handlePointerdownHoldAffordance
);
} else {
this.removeEventListener(
'pointerdown',
this.handlePointerdownHoldAffordance
);
this.handlePointerupHoldAffordance();
}
}
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/action-group/src/ActionGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
target.tabIndex = 0;
target.setAttribute('aria-checked', 'true');
this.setSelected([target.value], true);
target.focus();
break;
}
case 'multiple': {
Expand Down
2 changes: 2 additions & 0 deletions packages/action-group/test/action-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ describe('ActionGroup', () => {
expect(el.selected.length).to.equal(1);
expect(el.selected[0]).to.equal('Second');

thirdElement.focus();
thirdElement.click();

await elementUpdated(el);
Expand Down Expand Up @@ -1204,6 +1205,7 @@ describe('ActionGroup', () => {
await elementUpdated(el);
expect(el.selected.length).to.equal(0);

thirdElement.focus();
thirdElement.click();

await elementUpdated(el);
Expand Down
10 changes: 7 additions & 3 deletions packages/action-menu/src/ActionMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ export class ActionMenu extends ObserveSlotText(PickerBase, 'label') {
id="button"
class="button"
size=${this.size}
@blur=${this.onButtonBlur}
@click=${this.onButtonClick}
@focus=${this.onButtonFocus}
@blur=${this.handleButtonBlur}
@click=${this.handleButtonClick}
@keydown=${{
handleEvent: this.handleEnterKeydown,
capture: true,
}}
?disabled=${this.disabled}
>
${this.buttonContent}
</sp-action-button>
${this.renderMenu}
`;
}

Expand Down
5 changes: 4 additions & 1 deletion packages/action-menu/src/action-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ governing permissions and limitations under the License.
min-width: 0;
}

:host > sp-menu {
display: none;
}

::slotted([slot='icon']) {
flex-shrink: 0;
}
Expand All @@ -33,7 +37,6 @@ governing permissions and limitations under the License.
#popover {
width: auto;
max-width: none;
display: none;
}

:host([dir='ltr']) ::slotted([slot='icon']),
Expand Down
8 changes: 7 additions & 1 deletion packages/action-menu/stories/action-menu.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ governing permissions and limitations under the License.
*/
import { html, TemplateResult } from '@spectrum-web-components/base';

import '@spectrum-web-components/action-menu/sp-action-menu.js';
import '@spectrum-web-components/menu/sp-menu.js';
import '@spectrum-web-components/menu/sp-menu-item.js';
import '@spectrum-web-components/menu/sp-menu-group.js';
import '@spectrum-web-components/menu/sp-menu-divider.js';
import '@spectrum-web-components/tooltip/sp-tooltip.js';
import { ActionMenuMarkup } from './';

import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
Expand Down Expand Up @@ -233,7 +235,11 @@ export const controlled = (): TemplateResult => {
</sp-menu-item>
<sp-menu-item>
Show
<sp-menu slot="submenu">
<sp-menu
slot="submenu"
selects="multiple"
@change=${(event: Event) => event.preventDefault()}
>
<sp-menu-item
value="grid"
?selected=${state.grid}
Expand Down
Loading