Skip to content

Commit

Permalink
fix(segmented-button): move types and validSizes to marko file (#2100)
Browse files Browse the repository at this point in the history
* fix(segmented-button): move types and validSizes to marko file

* chore: add changeset
  • Loading branch information
LuLaValva committed Feb 15, 2024
1 parent e836526 commit 277f12b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-mugs-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/ebayui-core": patch
---

fix segmented-buttons-import error
29 changes: 5 additions & 24 deletions src/components/ebay-segmented-buttons/component.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
import type { WithNormalizedProps } from "../../global";

export const validSizes = ["large"] as const;

export interface SegmentedButtonsEvent {
originalEvent: PointerEvent;
index: number;
value?: string;
}

export interface SegmentedButton
extends Omit<Marko.Input<"button">, `on${string}`> {
selected?: boolean;
icon?: Marko.Renderable;
}

interface SegmentedButtonsInput
extends Omit<Marko.Input<"div">, `on${string}`> {
buttons?: Marko.RepeatableAttrTag<SegmentedButton>;
size?: (typeof validSizes)[number];
"on-change"?: (event: SegmentedButtonsEvent) => void;
}

export interface Input extends WithNormalizedProps<SegmentedButtonsInput> {}
import type {
Input,
SegmentedButton,
SegmentedButtonsEvent,
} from "./index.marko";

interface State {
selectedIndex: number;
Expand Down
22 changes: 21 additions & 1 deletion src/components/ebay-segmented-buttons/index.marko
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
import { processHtmlAttributes } from "../../common/html-attributes";
import type { WithNormalizedProps } from "../../global";

import { validSizes } from "./component";
static const validSizes = ["large"] as const;

export interface SegmentedButtonsEvent {
originalEvent: PointerEvent;
index: number;
value?: string;
}

export interface SegmentedButton extends Omit<Marko.Input<"button">, `on${string}`> {
selected?: boolean;
icon?: Marko.Renderable;
}

static interface SegmentedButtonsInput extends Omit<Marko.Input<"div">, `on${string}`> {
buttons?: Marko.RepeatableAttrTag<SegmentedButton>;
size?: (typeof validSizes)[number];
"on-change"?: (event: SegmentedButtonsEvent) => void;
}

export interface Input extends WithNormalizedProps<SegmentedButtonsInput> {}

$ let {
size: inputSize,
Expand Down

0 comments on commit 277f12b

Please sign in to comment.