Skip to content

Commit e48da75

Browse files
authored
fix(ui5-input): enhance storybook samples (#7532)
1 parent 1206df2 commit e48da75

File tree

2 files changed

+16
-43
lines changed

2 files changed

+16
-43
lines changed

packages/main/src/Input.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,6 @@ class Input extends UI5Element implements SuggestionComponent, IFormElement {
336336

337337
/**
338338
* Defines the HTML type of the component.
339-
* Available options are: <code>Text</code>, <code>Email</code>,
340-
* <code>Number</code>, <code>Password</code>, <code>Tel</code>, and <code>URL</code>.
341339
* <br><br>
342340
* <b>Notes:</b>
343341
* <ul>
@@ -384,15 +382,6 @@ class Input extends UI5Element implements SuggestionComponent, IFormElement {
384382

385383
/**
386384
* Defines the value state of the component.
387-
* <br><br>
388-
* Available options are:
389-
* <ul>
390-
* <li><code>None</code></li>
391-
* <li><code>Error</code></li>
392-
* <li><code>Warning</code></li>
393-
* <li><code>Success</code></li>
394-
* <li><code>Information</code></li>
395-
* </ul>
396385
*
397386
* @type {sap.ui.webc.base.types.ValueState}
398387
* @name sap.ui.webc.main.Input.prototype.valueState

packages/playground/_stories/main/Input/Input.stories.ts

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,13 @@ const Template: UI5StoryArgs<Input, StoryArgsSlots> = (args) => html`
5555
</ui5-input>`;
5656

5757

58-
export const BasicInput = Template.bind({});
59-
BasicInput.args = {
60-
showClearIcon: true,
58+
export const Basic = Template.bind({});
59+
Basic.args = {
6160
value: "Input"
6261
};
6362

64-
export const InputSuggestions = Template.bind({});
65-
InputSuggestions.decorators = [
63+
export const WithSuggestions = Template.bind({});
64+
WithSuggestions.decorators = [
6665
(story) => {
6766
return html`
6867
${story()}
@@ -75,7 +74,7 @@ InputSuggestions.decorators = [
7574
"Austria", "Australia", "Bulgaria", "Canada", "Columbia", "Croatia", "Denmark",
7675
"England", "Finland", "France", "Germany", "Hungary", "Ireland", "Italy", "Kuwait",
7776
"Luxembourg", "Mexico", "Morocco", "Norway", "Paraguay", "Philippines", "Portugal",
78-
"Spain", "Sweden", "Sri Lanka", "Senegal", "United Kingdom", "USA" ];
77+
"Spain", "Sweden", "Sri Lanka", "Senegal", "Thailand", "The United Kingdom of Great Britain and Northern Ireland", "USA" ];
7978
8079
if (value) {
8180
suggestionItems = ui5_database_entries.filter((item) => {
@@ -87,26 +86,21 @@ InputSuggestions.decorators = [
8786
});
8887
suggestionItems.forEach((item) => {
8988
const li = document.createElement("ui5-suggestion-item");
90-
li.icon = "world";
91-
li.additionalText = "explore";
92-
li.additionalTextState = "Success";
93-
li.description = "travel the world";
9489
li.text = item;
9590
input${index}.appendChild(li);
9691
});
9792
});
9893
</script>`;
9994
}
10095
]
101-
InputSuggestions.args = {
96+
WithSuggestions.args = {
10297
placeholder: "Start typing country name",
10398
showSuggestions: true,
10499
showClearIcon: true
105100
};
106-
InputSuggestions.storyName = "Input With Suggestions (note: the usage depends on the framework you are using)";
107101

108-
export const InputSuggestionsValueStateMessage = Template.bind({});
109-
InputSuggestionsValueStateMessage.args = {
102+
export const WithValueStateMessage = Template.bind({});
103+
WithValueStateMessage.args = {
110104
default: `
111105
<ui5-li>Cozy</ui5-li>
112106
<ui5-li>Compact</ui5-li>
@@ -116,39 +110,31 @@ InputSuggestionsValueStateMessage.args = {
116110
valueState: ValueState.Error,
117111
valueStateMessage: '<div slot="valueStateMessage">This is an error message. Extra long text used as an error message.</div>'
118112
};
119-
InputSuggestionsValueStateMessage.storyName = "Input with Suggestions and Value State Message";
120113

121-
export const InputLabel = Template.bind({});
122-
InputLabel.decorators = [
114+
export const WithLabel = Template.bind({});
115+
WithLabel.decorators = [
123116
(story) => {
124117
return html`
125118
<ui5-label class="samples-big-margin-right" for="input-${index + 1}" required="" show-colon="">Secret Code</ui5-label>
126119
${story()}
127120
`;
128121
}
129122
]
130-
InputLabel.args = {
123+
WithLabel.args = {
131124
type: InputType.Password,
132-
valueState: ValueState.Error,
133125
placeholder: "Enter your Secret Code",
134126
required: true
135127
};
136-
InputLabel.storyName = "Input with Label";
137128

138-
export const InputWithVHD: StoryFn = () => html`
129+
export const WithValueHelpDialog: StoryFn = () => html`
139130
<ui5-input id="valueHelpInput" placeholder="Enter product" show-suggestions="">
140131
<ui5-icon id="valueHelpIcon" slot="icon" name="value-help"></ui5-icon>
141132
</ui5-input>
142133
<ui5-dialog id="dialog" accessible-name="Products Value Help">
143134
<div slot="header" id="dialogHeader" style="width: 100%; padding: 0 1rem 0.5rem 1rem;">
144-
<div id="titleBar" style="
145-
display: flex;
146-
justify-content: space-between;
147-
align-items: center;">
135+
<div id="titleBar" style="display: flex; justify-content: space-between; align-items: center;">
148136
<h2 id="headerTitle" style="
149-
margin-top: 1em !important;
150-
font-size: 1rem;
151-
font-weight: 500;">
137+
margin-top: 1em !important; font-size: 1rem; font-weight: 500;">
152138
Products
153139
</h2>
154140
<ui5-button design="Transparent" id="clearButton">Clear</ui5-button>
@@ -253,14 +239,12 @@ export const InputWithVHD: StoryFn = () => html`
253239
itemsList${index}.addEventListener("item-click", handleItemClick);
254240
</script>
255241
`;
256-
InputWithVHD.parameters = {
242+
WithValueHelpDialog.parameters = {
257243
docs: {
258244
story: {
259245
// Opt-out of inline rendering
260246
inline: false,
261247
iframeHeight: "500px",
262248
},
263249
}
264-
};
265-
266-
InputWithVHD.storyName = "Input With Value Help Dialog";
250+
};

0 commit comments

Comments
 (0)