Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
ryotaro612 committed Feb 23, 2025
1 parent 5baad95 commit 8a219fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/text-field/label/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from "./styles.css?inline";
export class SpTextFieldLabel extends HTMLElement {
static styles = makeStyleSheet(styles);

static observedAttributes = ["for", "text"];
static observedAttributes = ["htmlFor", "text"];

get htmlFor(): string {
return this.#for;
Expand Down Expand Up @@ -57,7 +57,7 @@ export class SpTextFieldLabel extends HTMLElement {
}

attributeChangedCallback(name: string, _: string, newValue: string | null) {
if (name === "for") {
if (name === "htmlFor") {
this.htmlFor = newValue ? newValue : "";
} else if (name === "text") {
this.textContent = newValue;
Expand Down
6 changes: 4 additions & 2 deletions stories/text-field/x-large.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const meta: Meta<SpTextFieldXLarge> = {
component: "sp-text-field-x-large",
args: {
label: "ラベル",
error: "エラーテキストが入ります。",
error: "",
placeholder: "プレースホルダー",
disabled: false,
name: "surname",
Expand All @@ -19,11 +19,13 @@ const meta: Meta<SpTextFieldXLarge> = {
export default meta;

export const Default: StoryObj<SpTextFieldXLarge> = {
render: ({ label, error, placeholder, disabled }) => {
render: ({ label, error, placeholder, disabled, name, value }) => {
return html`<sp-text-field-x-large
placeholder=${placeholder}
label=${label}
?disabled=${disabled}
name=${name}
value=${value}
error=${error}
>
</sp-text-field-x-large>`;
Expand Down

0 comments on commit 8a219fc

Please sign in to comment.