diff --git a/components/textfield/stories/template.js b/components/textfield/stories/template.js index 9a7f064cd3..72ba6d0d82 100644 --- a/components/textfield/stories/template.js +++ b/components/textfield/stories/template.js @@ -120,15 +120,13 @@ export const Template = ({ style=${styleMap(customStyles)} @click=${onclick} @focusin=${function() { - updateArgs({ + updateArgs?.({ isFocused: true, - isKeyboardFocused: true }); }} @focusout=${function() { - updateArgs({ + updateArgs?.({ isFocused: false, - isKeyboardFocused: false }); }} id=${ifDefined(id)} @@ -231,7 +229,7 @@ export const TextFieldOptions = (args, context) => Container({ "gap": "8px", }, heading: "Default", - content: Template({...args, context}) + content: Template(args, context) })} ${Container({ withBorder: false, @@ -275,3 +273,29 @@ export const TextFieldOptions = (args, context) => Container({ })} ` }); + +export const KeyboardFocusTemplate = (args, context) => Container({ + direction: "column", + withBorder: false, + wrapperStyles: { + rowGap: "12px", + }, + content: html` + ${Container({ + withBorder: false, + containerStyles: { + "gap": "8px", + }, + heading: "Default", + content: Template({...args, isKeyboardFocused: true}, context) + })} + ${Container({ + withBorder: false, + containerStyles: { + "gap": "8px", + }, + heading: "Quiet", + content: Template({...args, isKeyboardFocused: true, isQuiet: true}, context) + })} + ` +}); diff --git a/components/textfield/stories/textarea.stories.js b/components/textfield/stories/textarea.stories.js index f91dc576ee..a7571aa3d1 100644 --- a/components/textfield/stories/textarea.stories.js +++ b/components/textfield/stories/textarea.stories.js @@ -2,14 +2,13 @@ import { Sizes } from "@spectrum-css/preview/decorators"; import { disableDefaultModes } from "@spectrum-css/preview/modes"; import metadata from "../metadata/metadata.json"; import packageJson from "../package.json"; -import { HelpTextOptionsTextArea, Template, TextAreaOptions } from "./textarea.template.js"; +import { HelpTextOptionsTextArea, KeyboardFocusTemplate, Template, TextAreaOptions } from "./textarea.template.js"; import { TextAreaGroup } from "./textarea.test.js"; import { default as Textfield } from "./textfield.stories.js"; /** * A text area is multi-line text field using the `