-
Notifications
You must be signed in to change notification settings - Fork 250
chore(close-button): add structure for s2 migration #6355
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
Open
TarunAdobe
wants to merge
14
commits into
main
Choose a base branch
from
ttomar/migrate-close-button
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3d7da5d
chore(close-button): add structure for s2 migration
TarunAdobe b896859
chore(close-button): add Cross400 and Cross500 icons for l and xl sizes
TarunAdobe 300b3f9
docs(close-button): mark Phase 2 setup complete after scaffold
TarunAdobe 91eaa63
fix(close-button): give scaffold CSS dimensions so a11y tests see a v…
TarunAdobe b7d4ec2
fix(close-button): inherit SizedMixin size reflection from ButtonBase
TarunAdobe c87e8c6
fix(close-button): omit pending from close-button public surface
TarunAdobe ccbaa38
fix(close-button): hide inherited pending API via CEM plugin and docs…
TarunAdobe 9d9444a
refactor(close-button): drop variant alias from 2nd-gen public API
TarunAdobe bdae2fd
style(close-button): fix Prettier formatting in CloseButton.ts
TarunAdobe e55d7d9
refactor(button): split SharedButtonBase and PendingMixin for close-b…
TarunAdobe adf9921
fix(button): restore instanceof SharedButtonBase via single concrete …
TarunAdobe 1d04fe4
refactor(button): consolidate ButtonBase and add PendingController
TarunAdobe 2981c31
fix(button): preserve disabled click suppression after PendingControl…
TarunAdobe 2558819
fix(button): use stable arrow for handleClick event handler
TarunAdobe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
2nd-gen/packages/core/components/close-button/CloseButton.base.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /** | ||
| * Copyright 2026 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| import { property } from 'lit/decorators.js'; | ||
|
|
||
| import { ButtonBase } from '@spectrum-web-components/core/components/button'; | ||
|
|
||
| import { | ||
| CLOSE_BUTTON_VALID_SIZES, | ||
| type CloseButtonSize, | ||
| type CloseButtonStaticColor, | ||
| } from './CloseButton.types.js'; | ||
|
|
||
| /** | ||
| * Abstract base for dismiss close-button semantics shared by rendering layers. | ||
| * Extends {@link ButtonBase} with close-button sizing and static-color API. | ||
| * | ||
| * @slot - Accessible text label rendered visually hidden next to the cross icon. | ||
| * | ||
| * @attribute {CloseButtonSize} size - Visual size of the close button. | ||
| * @attribute {'white' | 'black'} static-color - Static color treatment for display over colored or image backgrounds. | ||
| * @attribute {boolean} disabled - Whether the button is disabled. | ||
| */ | ||
| export abstract class CloseButtonBase extends ButtonBase { | ||
| /** @internal */ | ||
| static override readonly VALID_SIZES: readonly CloseButtonSize[] = | ||
| CLOSE_BUTTON_VALID_SIZES; | ||
|
|
||
| /** | ||
| * Static color treatment for display over colored or image backgrounds. | ||
| */ | ||
| @property({ type: String, reflect: true, attribute: 'static-color' }) | ||
| public staticColor?: CloseButtonStaticColor; | ||
|
|
||
| /** | ||
| * Close buttons always render a cross icon; treat as icon-present for | ||
| * shared {@link ButtonBase} accessibility checks. | ||
| * | ||
| * @internal | ||
| */ | ||
| protected override get hasIcon(): boolean { | ||
| return true; | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
2nd-gen/packages/core/components/close-button/CloseButton.types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /** | ||
| * Copyright 2026 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| import type { ElementSize } from '@spectrum-web-components/core/mixins/index.js'; | ||
|
|
||
| // ────────────────── | ||
| // SHARED | ||
| // ────────────────── | ||
|
|
||
| export const CLOSE_BUTTON_VALID_SIZES = [ | ||
| 's', | ||
| 'm', | ||
| 'l', | ||
| 'xl', | ||
| ] as const satisfies readonly ElementSize[]; | ||
|
|
||
| export const CLOSE_BUTTON_STATIC_COLORS = ['white', 'black'] as const; | ||
|
|
||
| // ────────────────── | ||
| // TYPES | ||
| // ────────────────── | ||
|
|
||
| export type CloseButtonSize = (typeof CLOSE_BUTTON_VALID_SIZES)[number]; | ||
| export type CloseButtonStaticColor = | ||
| (typeof CLOSE_BUTTON_STATIC_COLORS)[number]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Copyright 2026 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
| export * from './CloseButton.base.js'; | ||
| export * from './CloseButton.types.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
2nd-gen/packages/core/controllers/pending-controller/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /** | ||
| * Copyright 2026 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| export { | ||
| PendingController, | ||
| type PendingHost, | ||
| } from './src/pending-controller.js'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to advocate that button base be the shared button base. the pending mixin should be applied at the swc button level. if theres disagreement then i will request that shared button base (i would want to discuss the naming of this as well) should be treated like every other base class and have its own directory for discoverability. or we need to discuss architecture of these kinds of components and how we organize them, i can see this coming up with cards too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the concepts of base classes is that they store core functionality. i would almost argue that we dont need a core base class per component. i would use one button base for all buttons and then in SWC add the differing functionality that makes them unique components. i thought that was the pattern we were aiming for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our discussion yesterday I have removed the mixin, created a controller and removed the sharedButtonbase.
So buttonbase is the base that other buttons can use.
One thing though right now that is still there is a closebuttonbase which extends the button base and overrides close button specific size and color properties. Let me know if this is okay or do we want to not hav ea close button base at all.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caseyisonit @TarunAdobe I like this pattern except for the fact that it has scalability issue. In future if 3+ more components uses
PendingControlleryou will have 3-4 hosts each copy pasting the same property block. In that case you need to revisit this and extract aPendingButtonBaseclass or a helper. For now this is fine.