Skip to content

Commit

Permalink
fix(button): add partially disabled support to button variants (#2139)
Browse files Browse the repository at this point in the history
  • Loading branch information
saiponnada committed Mar 19, 2024
1 parent 6fac247 commit c1f16c2
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-ears-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/ebayui-core": minor
---

fix(button): add partially disabled support to button variants
10 changes: 5 additions & 5 deletions src/components/ebay-button/button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default {
},
type: { category: "Options" },
},
"partially-disabled": {
partiallyDisabled: {
description:
"programmatically disabled, but remains keyboard focusable",
table: {
Expand All @@ -127,7 +127,7 @@ export default {
category: "Toggles",
},
},
"fixed-height": {
fixedHeight: {
description: "fixes the height based on `size`",
table: {
defaultValue: {
Expand All @@ -138,7 +138,7 @@ export default {
},
truncate: {
description:
"used in conjunction with `fixed-height`; truncates text to single line with ellipsis when text overflows",
"used in conjunction with `fixedHeight`; truncates text to single line with ellipsis when text overflows",
table: {
defaultValue: {
summary: "false",
Expand Down Expand Up @@ -207,9 +207,9 @@ Standard.args = {
size: null,
disabled: false,
priority: null,
"partially-disabled": false,
partiallyDisabled: false,
transparent: false,
"fixed-height": false,
fixedHeight: false,
truncate: false,
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/ebay-button/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export interface ButtonInput extends Omit<Marko.Input<"button">, `on${string}`>
fluid?: boolean;
borderless?: boolean;
disabled?: boolean;
"partially-disabled"?: boolean;
partiallyDisabled?: boolean;
transparent?: boolean;
"fixed-height"?: boolean;
fixedHeight?: boolean;
truncate?: boolean;
split?: string;
"a11y-text"?: AttrString;
Expand Down
3 changes: 2 additions & 1 deletion src/components/ebay-icon-button/component-browser.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { AttrString } from "marko/tags-html";
import * as eventUtils from "../../common/event-utils";
import type { WithNormalizedProps } from "../../global";
import type { Input as ButtonInput } from "../ebay-button/index.marko";

interface IconButtonInput extends Omit<Marko.Input<"button">, `on${string}`> {
"badge-number"?: number | string;
href?: string;
transparent?: boolean;
size?: "small" | "large";
"partially-disabled"?: boolean;
partiallyDisabled?: ButtonInput["partiallyDisabled"];
"badge-aria-label"?: AttrString;
"on-click"?: (event: { originalEvent: MouseEvent }) => void;
"on-escape"?: (event: { originalEvent: KeyboardEvent }) => void;
Expand Down
1 change: 1 addition & 0 deletions src/components/ebay-menu-button/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface MenuButtonInput
"prefix-id"?: string;
variant?: "overflow" | "form" | "button" | "icon";
borderless?: boolean;
partiallyDisabled?: EbayButtonInput["partiallyDisabled"];
priority?: "primary" | "secondary" | "tertiary" | "delete" | "none";
size?: EbayButtonInput["size"];
transparent?: boolean;
Expand Down
2 changes: 2 additions & 0 deletions src/components/ebay-menu-button/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $ const {
fixWidth,
borderless,
size,
partiallyDisabled,
priority: inputPriority,
disabled,
variant: inputVariant,
Expand Down Expand Up @@ -78,6 +79,7 @@ $ {
aria-labelledby=(labelId && `${prefixId} ${labelId}`)
split=(isButtonVariant ? split : undefined)
disabled=disabled
partiallyDisabled=partiallyDisabled
on-escape("handleButtonEscape")
key="button">
<if(isOverflowVariant)>
Expand Down
1 change: 1 addition & 0 deletions src/components/ebay-menu-button/marko-tag.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@fix-width": "boolean",
"@borderless": "boolean",
"@size": "string",
"@partially-disabled": "boolean",
"@priority": "string",
"@prefix-id": "string",
"@prefix-label": "string",
Expand Down
10 changes: 10 additions & 0 deletions src/components/ebay-menu-button/menu-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ export default {
description:
'Will collapse whole menu when an item is selected in menu. Typically used in `type="radio"`',
},
partiallyDisabled: {
description:
"programmatically disabled, but remains keyboard focusable",
control: { type: "boolean" },
table: {
defaultValue: {
summary: "false",
},
},
},
prefixId: {
control: { type: "text" },
description:
Expand Down
1 change: 1 addition & 0 deletions src/components/ebay-split-button/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface SplitButtonInput extends Omit<MenuButtonInput, `on${string}`> {
size?: ButtonInput["size"];
disabled?: ButtonInput["disabled"];
priority?: ButtonInput["priority"];
partiallyDisabled?: ButtonInput["partiallyDisabled"];
"body-state"?: ButtonInput["bodyState"];
href?: ButtonInput["href"];
"a11y-button-loading-text"?: ButtonInput["a11yText"];
Expand Down
3 changes: 3 additions & 0 deletions src/components/ebay-split-button/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $ const {
bodyState,
disabled,
href,
partiallyDisabled,
priority,
renderBody,
size,
Expand All @@ -27,6 +28,7 @@ $ const {
bodyState=bodyState
href=href
a11yText=a11yButtonLoadingText
partiallyDisabled=partiallyDisabled
>
<span.btn__cell><span.btn__text><${renderBody}/></span></span>
</ebay-button>
Expand All @@ -43,6 +45,7 @@ $ const {
transparent=transparent
reverse
variant='button'
partiallyDisabled=partiallyDisabled
...menuButtonInput
/>
</span>
2 changes: 1 addition & 1 deletion src/components/ebay-split-button/split-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
},
},
},
"partially-disabled": {
partiallyDisabled: {
description:
"programmatically disabled, but remains keyboard focusable",
control: { type: "boolean" },
Expand Down

0 comments on commit c1f16c2

Please sign in to comment.