-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Adds TextInput as a new web component #27348
Adds TextInput as a new web component #27348
Conversation
…erbrady/fluentui-fork into web-components-v3
📊 Bundle size report🤖 This report was generated against 94f4ec8598a9e34e3ab799f4f5899d5b8dddb645 |
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 94f4ec8598a9e34e3ab799f4f5899d5b8dddb645 (build) |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e01a615:
|
…christopherbrady/fluentui-fork into user/brianbrady/text-input
|
||
export const Required = renderComponent(html<TextInputStoryArgs>` | ||
<fluent-text-input required> | ||
<span slot="end">${Person20Regular}${Person20Regular}</span> |
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.
Any reason for having two icons here?
</div> | ||
`); | ||
|
||
export const Inline = renderComponent(html<TextInputStoryArgs>` |
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.
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.
Looks like it just needed to be wrapped in a element. Working now :)
outline: 'outline', | ||
underline: 'underline', | ||
filledLighter: 'filled-lighter', | ||
filledLighterShadow: 'filled-lighter--shadow', |
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.
filled-darker-shadow
and filled-lighter-shadow
are deprecated in FUIR9 and not mentioned in the FUIWC3 component spec. I think we should remove them.
<span slot="end">${Person20Regular}</span> | ||
<fluent-label>Inline Input</fluent-label> | ||
</fluent-text-input> | ||
<p |
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.
Have you considered using <fluent-text>
in the example?
packages/web-components/package.json
Outdated
@@ -116,6 +116,10 @@ | |||
"types": "./dist/esm/tab-panel/define.d.ts", | |||
"default": "./dist/esm/tab-panel/define.js" | |||
}, | |||
"./text-input": { |
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.
nit: This should alphabetically go after text
change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json
Outdated
Show resolved
Hide resolved
packages/web-components/src/index.ts
Outdated
@@ -21,6 +21,7 @@ export * from './switch/index.js'; | |||
export * from './tabs/index.js'; | |||
export * from './tab/index.js'; | |||
export * from './tab-panel/index.js'; | |||
export * from './text-input/index.js'; |
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.
bellow text
* HTML Attribute: control-size | ||
*/ | ||
@attr({ attribute: 'control-size' }) | ||
public controlSize: TextInputControlSize = TextInputControlSize.medium; |
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 think the agreement is not to assign default value to the attributes unless completely necessary to reduce DOM size. Styles should be authored to honor the default values without explicitly setting them in javascript.
…ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
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.
lgtm
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * text input init * adds text input options * styles text input * updates text input styles * adds input size attribute and styles * updates text input storybook * text input: adds properties to class * text-input: re-exports TextFieldType as TextInputType * text input: fixes export names * text input: updates underline styles * text-input: exports text-input from package.json * removes dead code * text-input: removes default attr values * text-input: updates icon sizes * text-input: updates block vs inline implimentation * text-input: updates docs * text-input: adds styling support for icons and text passed through start/end slots * text-input: updates border styles * input: updates storybook content * updates README * text-input: adds filled non shadow variants * text-input: modifies storybook examples * text-input: removes dead import * addresses PR feedback * text input: updates styles * text input: yarn change * text input: updates README and styles * text input: shorthands css property * textinput: fixes ts errors * textinput: updates attribute name * textinput: uses fluent-label in stories * textinput: updates control size type name * textinput: updates storybook * textinput: updates type * textinput: updates story styles * Update change/@fluentui-web-components-ec003fd2-a453-4e83-b620-9ec9f3ddffa0.json Co-authored-by: Miroslav Stastny <mistastn@microsoft.com> * text-input: addresses feedback * text-input: alphabetize exports, removes setting default attr value --------- Co-authored-by: Miroslav Stastny <mistastn@microsoft.com>
TextInput
Design Spec
Link to Text Input Design Spec in Figma
Engineering Spec
Fluent WC3 Text Input extends from the FAST Text Field and is intended to be as close to the Fluent UI React 9 Input implementation as possible. However, due to the nature of web components there will not be 100% parity between the two.
Class:
TextInput
Component Name
<fluent-text-input>
Variables
TextInputSize
{ small: "small", medium: "medium", large: "large" }
TextInputAppearance
{ outline: "outline", underline: "underline", filledLighter: "filled-lighter", filledDarker: "filled-darker" }
TextInputType
{ email: "email", password: "password", tel: "tel", text: "text", url: "url" }
Fields
appearance
TextInputAppearance
outline
autofocus
boolean
false
disabled
boolean
false
list
string
datalist
to an element byid
maxlength
number
minlength
number
name
string
pattern
string
placeholder
string
readonly
boolean
false
required
boolean
false
size
InputSize
medium
spellcheck
boolean
false
type
TextInputType
TextInputType.text
current-value
current-value
RFCMethods
select
validate
Events
change
Attributes
appearance
autofocus
list
maxlength
minlength
pattern
placeholder
readonly
size
spellcheck
type
Slots
start
end
Additional Styling Variations
For performance considerations, we have avoided the addition of explicit attributes for appearance variations that modify only one CSS property. Instead, opting to provide guidance for users to apply their own CSS to achieve these appearance variations.
Block v.s Inline
The Fluent UI
TextInput
component offers two appearance variations for the display property - block (default) and inline. To achieve the inline variation, users should apply their own custom CSS.Accessibility
W3C Text Input Spec
WAI-ARIA Roles, States, and Properties
This component supports ARIA attributes that inherit from the ARIA Global States and Properties.
Preparation
Fluent Web Component v3 v.s Fluent React 9
Component and Slot Mapping
<Input>
<fluent-text-input>
contentBefore
start
contentAfter
end