-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(input): add legacy and modern template rendering #26193
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
621dc13
feat(input): add new js and css props
liamdebeasi d24428c
chore(): copy updates
liamdebeasi 0402ae8
test(input): move old tests to legacy directory
liamdebeasi 7643d2d
feat(input): add legacy vs modern template rendering
liamdebeasi 259a3a2
refactor(form): add form controller
liamdebeasi a989e94
chore(): update comments
liamdebeasi 2a80a5f
chore(): update tests
liamdebeasi 08ea3a0
chore(): add moved screenshots
liamdebeasi bd80054
chore(): add moved screenshots
liamdebeasi 19f4994
chore(): fix test file
liamdebeasi d02c144
chore(): prettier
liamdebeasi 8d7f0c4
feat(input): add missing fixed label
liamdebeasi fff8ed1
Merge remote-tracking branch 'origin/FW-2591' into 2591-props
liamdebeasi 563f177
Update core/src/components/input/input.tsx
liamdebeasi e1696af
chore(): run build
liamdebeasi a17a9ae
Merge remote-tracking branch 'origin/2591-props' into 2591-template
liamdebeasi f556aee
chore(input): remove justify property
liamdebeasi 6b8131a
Update core/src/components/input/input.tsx
liamdebeasi e0b5cd6
feat(input): add missing fill property
liamdebeasi 5a0f812
refactor(): explicitly add element type
liamdebeasi 4272366
chore(): fix el type
liamdebeasi 6d09ad6
Merge remote-tracking branch 'origin/2591-props' into 2591-template
liamdebeasi 127d791
Merge remote-tracking branch 'origin/FW-2591' into 2591-template
liamdebeasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" dir="ltr"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>Input - Basic</title> | ||
| <meta | ||
| name="viewport" | ||
| content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" | ||
| /> | ||
| <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" /> | ||
| <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> | ||
| <script src="../../../../../scripts/testing/scripts.js"></script> | ||
| <script nomodule src="../../../../../dist/ionic/ionic.js"></script> | ||
| <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Input - Basic</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content id="content"> | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-input placeholder="Placeholder"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item lines="full" id="fullItem"> | ||
| <ion-input id="fullInput" placeholder="Full"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item lines="inset" id="insetItem"> | ||
| <ion-input id="insetInput" placeholder="Inset"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item lines="none" id="noneItem"> | ||
| <ion-input id="noneInput" placeholder="None"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Default Label</ion-label> | ||
| <ion-input value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Clear Input</ion-label> | ||
| <ion-input | ||
| clear-input | ||
| value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges" | ||
| ></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item color="dark"> | ||
| <ion-label position="floating">Floating</ion-label> | ||
| <ion-input checked></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label position="fixed">Type #</ion-label> | ||
| <ion-input type="number" value="333"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label position="stacked">Password</ion-label> | ||
| <ion-input type="password"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label position="stacked">Placeholder</ion-label> | ||
| <ion-input placeholder="Enter Something"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Disabled</ion-label> | ||
| <ion-input id="dynamicDisabled" value="Disabled" disabled></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Readonly</ion-label> | ||
| <ion-input id="dynamicReadonly" value="Readonly" readonly></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Slot</ion-label> | ||
| <ion-input slot="start" value="Start"></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Toggle</ion-label> | ||
| <ion-toggle checked slot="end"></ion-toggle> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label position="fixed">Type #</ion-label> | ||
| <div type="number" value="333" class="input input-md hydrated"> | ||
| <!----> | ||
| <input | ||
| aria-disabled="false" | ||
| autocapitalize="none" | ||
| autocomplete="off" | ||
| autocorrect="off" | ||
| autofocus="false" | ||
| class="native-input native-input-md" | ||
| spellcheck="false" | ||
| type="number" | ||
| /> | ||
| <button type="button" class="input-clear-icon" hidden=""></button> | ||
| </div> | ||
| </ion-item> | ||
| </ion-list> | ||
|
|
||
| <div class="ion-text-center"> | ||
| <ion-button onclick="toggleBoolean('dynamicDisabled', 'disabled')"> Toggle Disabled </ion-button> | ||
|
|
||
| <ion-button color="secondary" onclick="toggleBoolean('dynamicReadonly', 'readonly')"> | ||
| Toggle Readonly | ||
| </ion-button> | ||
| </div> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Clear Input</ion-label> | ||
| <ion-input | ||
| clear-input | ||
| value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges" | ||
| ></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-label>Clear On Edit</ion-label> | ||
| <ion-input | ||
| clear-on-edit | ||
| value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges" | ||
| ></ion-input> | ||
| </ion-item> | ||
|
|
||
| <ion-item style="max-width: 250px"> | ||
| <ion-input value="Narrow input"></ion-input> | ||
| <ion-label class="ion-text-right">Left</ion-label> | ||
| </ion-item> | ||
|
|
||
| <ion-item style="max-width: 250px"> | ||
| <ion-label>Right</ion-label> | ||
| <ion-input class="ion-text-right" value="Narrow input"></ion-input> | ||
| </ion-item> | ||
| </ion-content> | ||
|
|
||
| <script> | ||
| document.querySelector('ion-input').addEventListener('ionBlur', (ev) => { | ||
| console.log(ev); | ||
| }); | ||
|
|
||
| function toggleBoolean(id, prop) { | ||
| var el = document.getElementById(id); | ||
|
|
||
| var isTrue = el[prop] ? false : true; | ||
| el[prop] = isTrue; | ||
| console.log('in toggleBoolean, setting', prop, 'to', isTrue); | ||
| } | ||
| </script> | ||
| </ion-app> | ||
| </body> | ||
| </html> |
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * Creates a controller that tracks whether a form control is using the legacy or modern syntax. This should be removed when the legacy form control syntax is removed. | ||
| * | ||
| * @internal | ||
| * @prop el: The Ionic form component to reference | ||
| */ | ||
| export const createLegacyFormController = (el: HTMLIonInputElement): LegacyFormController => { | ||
| const controlEl: HTMLIonInputElement = el; | ||
| let legacyControl = true; | ||
|
|
||
| /** | ||
| * Detect if developers are using the legacy form control syntax | ||
| * so a deprecation warning is logged. This warning can be disabled | ||
| * by either using the new `label` property or setting `aria-label` | ||
| * on the control. | ||
| */ | ||
| const hasLabelProp = controlEl.label !== undefined; | ||
| const hasAriaLabelAttribute = controlEl.hasAttribute('aria-label'); | ||
|
|
||
| legacyControl = !hasLabelProp && !hasAriaLabelAttribute; | ||
|
|
||
| const hasLegacyControl = () => { | ||
| return legacyControl; | ||
| }; | ||
|
|
||
| return { hasLegacyControl }; | ||
| }; | ||
|
|
||
| export type LegacyFormController = { | ||
| hasLegacyControl: () => boolean; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './form-controller'; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.