diff --git a/core/package.json b/core/package.json index dbf9710e51..4a630c0e71 100644 --- a/core/package.json +++ b/core/package.json @@ -65,6 +65,7 @@ "build.vendor": "rollup --config ./scripts/swiper.rollup.config.js", "build.css": "npm run css.sass && npm run css.minify", "build.debug": "npm run clean && stencil build --debug", + "build.docs": "stencil build --docs", "build.docs.json": "stencil build --docs-json dist/docs.json", "clean": "node scripts/clean.js", "cdnloader": "node scripts/copy-cdn-loader.js", diff --git a/core/src/components/action-sheet/readme.md b/core/src/components/action-sheet/readme.md index 446f280aa6..b12332e9e2 100644 --- a/core/src/components/action-sheet/readme.md +++ b/core/src/components/action-sheet/readme.md @@ -45,7 +45,7 @@ export class ActionSheetExample { } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'caret-forward-circle', handler: () => { console.log('Play clicked'); } @@ -94,7 +94,7 @@ async function presentActionSheet() { } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'caret-forward-circle', handler: () => { console.log('Play clicked'); } @@ -121,9 +121,9 @@ async function presentActionSheet() { ### React ```typescript -import React, { useState } from 'react' +import React, { useState } from 'react'; import { IonActionSheet, IonContent, IonButton } from '@ionic/react'; -import { trash, share, playCircleOutline, heart, close } from 'ionicons/icons'; +import { trash, share, caretForwardCircle, heart, close } from 'ionicons/icons'; export const ActionSheetExample: React.FC = () => { @@ -150,7 +150,7 @@ export const ActionSheetExample: React.FC = () => { } }, { text: 'Play (open modal)', - icon: playCircleOutline, + icon: caretForwardCircle, handler: () => { console.log('Play clicked'); } @@ -179,6 +179,69 @@ export const ActionSheetExample: React.FC = () => { ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +import { actionSheetController } from '@ionic/core'; + +@Component({ + tag: 'action-sheet-example', + styleUrl: 'action-sheet-example.css' +}) +export class ActionSheetExample { + async presentActionSheet() { + const actionSheet = await actionSheetController.create({ + header: 'Albums', + buttons: [{ + text: 'Delete', + role: 'destructive', + icon: 'trash', + handler: () => { + console.log('Delete clicked'); + } + }, { + text: 'Share', + icon: 'share', + handler: () => { + console.log('Share clicked'); + } + }, { + text: 'Play (open modal)', + icon: 'caret-forward-circle', + handler: () => { + console.log('Play clicked'); + } + }, { + text: 'Favorite', + icon: 'heart', + handler: () => { + console.log('Favorite clicked'); + } + }, { + text: 'Cancel', + icon: 'close', + role: 'cancel', + handler: () => { + console.log('Cancel clicked'); + } + }] + }); + await actionSheet.present(); + } + + render() { + return [ + + this.presentActionSheet()}>Present Action Sheet + + ]; + } +} +``` + + ### Vue ```html @@ -213,7 +276,7 @@ export default { }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'caret-forward-circle', handler: () => { console.log('Play clicked') }, diff --git a/core/src/components/action-sheet/usage/angular.md b/core/src/components/action-sheet/usage/angular.md index 8b4bebada8..926e54fa15 100644 --- a/core/src/components/action-sheet/usage/angular.md +++ b/core/src/components/action-sheet/usage/angular.md @@ -29,7 +29,7 @@ export class ActionSheetExample { } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'caret-forward-circle', handler: () => { console.log('Play clicked'); } diff --git a/core/src/components/action-sheet/usage/javascript.md b/core/src/components/action-sheet/usage/javascript.md index 75770b7a41..6db3aaf3f3 100644 --- a/core/src/components/action-sheet/usage/javascript.md +++ b/core/src/components/action-sheet/usage/javascript.md @@ -19,7 +19,7 @@ async function presentActionSheet() { } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'caret-forward-circle', handler: () => { console.log('Play clicked'); } diff --git a/core/src/components/action-sheet/usage/react.md b/core/src/components/action-sheet/usage/react.md index 37424541a0..4f8323e149 100644 --- a/core/src/components/action-sheet/usage/react.md +++ b/core/src/components/action-sheet/usage/react.md @@ -1,7 +1,7 @@ ```typescript -import React, { useState } from 'react' +import React, { useState } from 'react'; import { IonActionSheet, IonContent, IonButton } from '@ionic/react'; -import { trash, share, playCircleOutline, heart, close } from 'ionicons/icons'; +import { trash, share, caretForwardCircle, heart, close } from 'ionicons/icons'; export const ActionSheetExample: React.FC = () => { @@ -28,7 +28,7 @@ export const ActionSheetExample: React.FC = () => { } }, { text: 'Play (open modal)', - icon: playCircleOutline, + icon: caretForwardCircle, handler: () => { console.log('Play clicked'); } diff --git a/core/src/components/action-sheet/usage/stencil.md b/core/src/components/action-sheet/usage/stencil.md new file mode 100644 index 0000000000..e71cd10886 --- /dev/null +++ b/core/src/components/action-sheet/usage/stencil.md @@ -0,0 +1,59 @@ +```tsx +import { Component, h } from '@stencil/core'; + +import { actionSheetController } from '@ionic/core'; + +@Component({ + tag: 'action-sheet-example', + styleUrl: 'action-sheet-example.css' +}) +export class ActionSheetExample { + async presentActionSheet() { + const actionSheet = await actionSheetController.create({ + header: 'Albums', + buttons: [{ + text: 'Delete', + role: 'destructive', + icon: 'trash', + handler: () => { + console.log('Delete clicked'); + } + }, { + text: 'Share', + icon: 'share', + handler: () => { + console.log('Share clicked'); + } + }, { + text: 'Play (open modal)', + icon: 'caret-forward-circle', + handler: () => { + console.log('Play clicked'); + } + }, { + text: 'Favorite', + icon: 'heart', + handler: () => { + console.log('Favorite clicked'); + } + }, { + text: 'Cancel', + icon: 'close', + role: 'cancel', + handler: () => { + console.log('Cancel clicked'); + } + }] + }); + await actionSheet.present(); + } + + render() { + return [ + + this.presentActionSheet()}>Present Action Sheet + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/action-sheet/usage/vue.md b/core/src/components/action-sheet/usage/vue.md index b7adb2f09b..af30358dcd 100644 --- a/core/src/components/action-sheet/usage/vue.md +++ b/core/src/components/action-sheet/usage/vue.md @@ -30,7 +30,7 @@ export default { }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'caret-forward-circle', handler: () => { console.log('Play clicked') }, diff --git a/core/src/components/alert/readme.md b/core/src/components/alert/readme.md index b86b6fe5ab..317cd55520 100644 --- a/core/src/components/alert/readme.md +++ b/core/src/components/alert/readme.md @@ -779,6 +779,282 @@ export default AlertExample; ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +import { alertController } from '@ionic/core'; + +@Component({ + tag: 'alert-example', + styleUrl: 'alert-example.css' +}) +export class AlertExample { + async presentAlert() { + const alert = await alertController.create({ + header: 'Alert', + subHeader: 'Subtitle', + message: 'This is an alert message.', + buttons: ['OK'] + }); + + await alert.present(); + } + + async presentAlertMultipleButtons() { + const alert = await alertController.create({ + header: 'Alert', + subHeader: 'Subtitle', + message: 'This is an alert message.', + buttons: ['Cancel', 'Open Modal', 'Delete'] + }); + + await alert.present(); + } + + async presentAlertConfirm() { + const alert = await alertController.create({ + header: 'Confirm!', + message: 'Message text!!!', + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: (blah) => { + console.log('Confirm Cancel: blah'); + } + }, { + text: 'Okay', + handler: () => { + console.log('Confirm Okay'); + } + } + ] + }); + + await alert.present(); + } + + async presentAlertPrompt() { + const alert = await alertController.create({ + header: 'Prompt!', + inputs: [ + { + name: 'name1', + type: 'text', + placeholder: 'Placeholder 1' + }, + { + name: 'name2', + type: 'text', + id: 'name2-id', + value: 'hello', + placeholder: 'Placeholder 2' + }, + // multiline input. + { + name: 'paragraph', + id: 'paragraph', + type: 'textarea', + placeholder: 'Placeholder 3' + }, + { + name: 'name3', + value: 'http://ionicframework.com', + type: 'url', + placeholder: 'Favorite site ever' + }, + // input date with min & max + { + name: 'name4', + type: 'date', + min: '2017-03-01', + max: '2018-01-12' + }, + // input date without min nor max + { + name: 'name5', + type: 'date' + }, + { + name: 'name6', + type: 'number', + min: -5, + max: 10 + }, + { + name: 'name7', + type: 'number' + } + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ] + }); + + await alert.present(); + } + + async presentAlertRadio() { + const alert = await alertController.create({ + header: 'Radio', + inputs: [ + { + name: 'radio1', + type: 'radio', + label: 'Radio 1', + value: 'value1', + checked: true + }, + { + name: 'radio2', + type: 'radio', + label: 'Radio 2', + value: 'value2' + }, + { + name: 'radio3', + type: 'radio', + label: 'Radio 3', + value: 'value3' + }, + { + name: 'radio4', + type: 'radio', + label: 'Radio 4', + value: 'value4' + }, + { + name: 'radio5', + type: 'radio', + label: 'Radio 5', + value: 'value5' + }, + { + name: 'radio6', + type: 'radio', + label: 'Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 ', + value: 'value6' + } + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ] + }); + + await alert.present(); + } + + async presentAlertCheckbox() { + const alert = await alertController.create({ + header: 'Checkbox', + inputs: [ + { + name: 'checkbox1', + type: 'checkbox', + label: 'Checkbox 1', + value: 'value1', + checked: true + }, + + { + name: 'checkbox2', + type: 'checkbox', + label: 'Checkbox 2', + value: 'value2' + }, + + { + name: 'checkbox3', + type: 'checkbox', + label: 'Checkbox 3', + value: 'value3' + }, + + { + name: 'checkbox4', + type: 'checkbox', + label: 'Checkbox 4', + value: 'value4' + }, + + { + name: 'checkbox5', + type: 'checkbox', + label: 'Checkbox 5', + value: 'value5' + }, + + { + name: 'checkbox6', + type: 'checkbox', + label: 'Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6', + value: 'value6' + } + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ] + }); + + await alert.present(); + } + + + render() { + return [ + + this.presentAlert()}>Present Alert + this.presentAlertMultipleButtons()}>Present Alert: Multiple Buttons + this.presentAlertConfirm()}>Present Alert: Confirm + this.presentAlertPrompt()}>Present Alert: Prompt + this.presentAlertRadio()}>Present Alert: Radio + this.presentAlertCheckbox()}>Present Alert: Checkbox + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/alert/usage/stencil.md b/core/src/components/alert/usage/stencil.md new file mode 100644 index 0000000000..371411496c --- /dev/null +++ b/core/src/components/alert/usage/stencil.md @@ -0,0 +1,272 @@ +```tsx +import { Component, h } from '@stencil/core'; + +import { alertController } from '@ionic/core'; + +@Component({ + tag: 'alert-example', + styleUrl: 'alert-example.css' +}) +export class AlertExample { + async presentAlert() { + const alert = await alertController.create({ + header: 'Alert', + subHeader: 'Subtitle', + message: 'This is an alert message.', + buttons: ['OK'] + }); + + await alert.present(); + } + + async presentAlertMultipleButtons() { + const alert = await alertController.create({ + header: 'Alert', + subHeader: 'Subtitle', + message: 'This is an alert message.', + buttons: ['Cancel', 'Open Modal', 'Delete'] + }); + + await alert.present(); + } + + async presentAlertConfirm() { + const alert = await alertController.create({ + header: 'Confirm!', + message: 'Message text!!!', + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: (blah) => { + console.log('Confirm Cancel: blah'); + } + }, { + text: 'Okay', + handler: () => { + console.log('Confirm Okay'); + } + } + ] + }); + + await alert.present(); + } + + async presentAlertPrompt() { + const alert = await alertController.create({ + header: 'Prompt!', + inputs: [ + { + name: 'name1', + type: 'text', + placeholder: 'Placeholder 1' + }, + { + name: 'name2', + type: 'text', + id: 'name2-id', + value: 'hello', + placeholder: 'Placeholder 2' + }, + // multiline input. + { + name: 'paragraph', + id: 'paragraph', + type: 'textarea', + placeholder: 'Placeholder 3' + }, + { + name: 'name3', + value: 'http://ionicframework.com', + type: 'url', + placeholder: 'Favorite site ever' + }, + // input date with min & max + { + name: 'name4', + type: 'date', + min: '2017-03-01', + max: '2018-01-12' + }, + // input date without min nor max + { + name: 'name5', + type: 'date' + }, + { + name: 'name6', + type: 'number', + min: -5, + max: 10 + }, + { + name: 'name7', + type: 'number' + } + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ] + }); + + await alert.present(); + } + + async presentAlertRadio() { + const alert = await alertController.create({ + header: 'Radio', + inputs: [ + { + name: 'radio1', + type: 'radio', + label: 'Radio 1', + value: 'value1', + checked: true + }, + { + name: 'radio2', + type: 'radio', + label: 'Radio 2', + value: 'value2' + }, + { + name: 'radio3', + type: 'radio', + label: 'Radio 3', + value: 'value3' + }, + { + name: 'radio4', + type: 'radio', + label: 'Radio 4', + value: 'value4' + }, + { + name: 'radio5', + type: 'radio', + label: 'Radio 5', + value: 'value5' + }, + { + name: 'radio6', + type: 'radio', + label: 'Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 Radio 6 ', + value: 'value6' + } + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ] + }); + + await alert.present(); + } + + async presentAlertCheckbox() { + const alert = await alertController.create({ + header: 'Checkbox', + inputs: [ + { + name: 'checkbox1', + type: 'checkbox', + label: 'Checkbox 1', + value: 'value1', + checked: true + }, + + { + name: 'checkbox2', + type: 'checkbox', + label: 'Checkbox 2', + value: 'value2' + }, + + { + name: 'checkbox3', + type: 'checkbox', + label: 'Checkbox 3', + value: 'value3' + }, + + { + name: 'checkbox4', + type: 'checkbox', + label: 'Checkbox 4', + value: 'value4' + }, + + { + name: 'checkbox5', + type: 'checkbox', + label: 'Checkbox 5', + value: 'value5' + }, + + { + name: 'checkbox6', + type: 'checkbox', + label: 'Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6 Checkbox 6', + value: 'value6' + } + ], + buttons: [ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ] + }); + + await alert.present(); + } + + + render() { + return [ + + this.presentAlert()}>Present Alert + this.presentAlertMultipleButtons()}>Present Alert: Multiple Buttons + this.presentAlertConfirm()}>Present Alert: Confirm + this.presentAlertPrompt()}>Present Alert: Prompt + this.presentAlertRadio()}>Present Alert: Radio + this.presentAlertCheckbox()}>Present Alert: Checkbox + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/avatar/readme.md b/core/src/components/avatar/readme.md index 151dbdc301..67403f0f96 100644 --- a/core/src/components/avatar/readme.md +++ b/core/src/components/avatar/readme.md @@ -36,7 +36,7 @@ Avatars can be used by themselves or inside of any element. If placed inside of ### React ```tsx -import React from 'react' +import React from 'react'; import { IonAvatar, IonChip, IonItem, IonLabel, IonContent } from '@ionic/react'; export const AvatarExample: React.FC = () => ( @@ -63,6 +63,41 @@ export const AvatarExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'avatar-example', + styleUrl: 'avatar-example.css' +}) +export class AvatarExample { + render() { + return [ + + + , + + + + + + Chip Avatar + , + + + + + + Item Avatar + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/avatar/usage/react.md b/core/src/components/avatar/usage/react.md index de4ee1d1ea..db76f35b99 100644 --- a/core/src/components/avatar/usage/react.md +++ b/core/src/components/avatar/usage/react.md @@ -1,5 +1,5 @@ ```tsx -import React from 'react' +import React from 'react'; import { IonAvatar, IonChip, IonItem, IonLabel, IonContent } from '@ionic/react'; export const AvatarExample: React.FC = () => ( diff --git a/core/src/components/avatar/usage/stencil.md b/core/src/components/avatar/usage/stencil.md new file mode 100644 index 0000000000..137e6c00db --- /dev/null +++ b/core/src/components/avatar/usage/stencil.md @@ -0,0 +1,31 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'avatar-example', + styleUrl: 'avatar-example.css' +}) +export class AvatarExample { + render() { + return [ + + + , + + + + + + Chip Avatar + , + + + + + + Item Avatar + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/back-button/readme.md b/core/src/components/back-button/readme.md index 5395f63507..173c554321 100644 --- a/core/src/components/back-button/readme.md +++ b/core/src/components/back-button/readme.md @@ -173,6 +173,75 @@ export const BackButtonExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'back-button-example', + styleUrl: 'back-button-example.css' +}) +export class BackButtonExample { + render() { + const buttonText = "Custom"; + const buttonIcon = "add"; + + return [ + // Default back button + + + + + + + , + + // Back button with a default href + + + + + + + , + + // Back button with custom text and icon + + + + + + + + , + + // Back button with no text and custom icon + + + + + + + , + + // Danger back button next to a menu button + + + + + + + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/back-button/usage/stencil.md b/core/src/components/back-button/usage/stencil.md new file mode 100644 index 0000000000..7948c2d7b5 --- /dev/null +++ b/core/src/components/back-button/usage/stencil.md @@ -0,0 +1,65 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'back-button-example', + styleUrl: 'back-button-example.css' +}) +export class BackButtonExample { + render() { + const buttonText = "Custom"; + const buttonIcon = "add"; + + return [ + // Default back button + + + + + + + , + + // Back button with a default href + + + + + + + , + + // Back button with custom text and icon + + + + + + + + , + + // Back button with no text and custom icon + + + + + + + , + + // Danger back button next to a menu button + + + + + + + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/backdrop/readme.md b/core/src/components/backdrop/readme.md index 8c671e13ff..148119157e 100644 --- a/core/src/components/backdrop/readme.md +++ b/core/src/components/backdrop/readme.md @@ -40,7 +40,7 @@ import { Component } from '@angular/core'; styleUrls: ['./backdrop-example.css'], }) export class BackdropExample { - backdropDismiss = false; + enableBackdropDismiss = false; showBackdrop = false; shouldPropagate = false; } @@ -100,6 +100,46 @@ export const BackdropExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'backdrop-example', + styleUrl: 'backdrop-example.css' +}) +export class BackdropExample { + render() { + const enableBackdropDismiss = false; + const showBackdrop = false; + const shouldPropagate = false; + + return [ + // Default backdrop + , + + // Backdrop that is not tappable + , + + // Backdrop that is not visible + , + + // Backdrop with propagation + , + + // Backdrop that sets dynamic properties + + + ]; + } +} +``` + + ### Vue ```html @@ -129,7 +169,7 @@ export const BackdropExample: React.FC = () => ( @Component() export default class Example extends Vue { - backdropDismiss = false; + enableBackdropDismiss = false; showBackdrop = false; shouldPropagate = false; } diff --git a/core/src/components/backdrop/usage/angular.md b/core/src/components/backdrop/usage/angular.md index b2e9a35825..8e454fe310 100644 --- a/core/src/components/backdrop/usage/angular.md +++ b/core/src/components/backdrop/usage/angular.md @@ -28,7 +28,7 @@ import { Component } from '@angular/core'; styleUrls: ['./backdrop-example.css'], }) export class BackdropExample { - backdropDismiss = false; + enableBackdropDismiss = false; showBackdrop = false; shouldPropagate = false; } diff --git a/core/src/components/backdrop/usage/stencil.md b/core/src/components/backdrop/usage/stencil.md new file mode 100644 index 0000000000..4c74219cbd --- /dev/null +++ b/core/src/components/backdrop/usage/stencil.md @@ -0,0 +1,36 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'backdrop-example', + styleUrl: 'backdrop-example.css' +}) +export class BackdropExample { + render() { + const enableBackdropDismiss = false; + const showBackdrop = false; + const shouldPropagate = false; + + return [ + // Default backdrop + , + + // Backdrop that is not tappable + , + + // Backdrop that is not visible + , + + // Backdrop with propagation + , + + // Backdrop that sets dynamic properties + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/backdrop/usage/vue.md b/core/src/components/backdrop/usage/vue.md index c912d31816..6c2488525f 100644 --- a/core/src/components/backdrop/usage/vue.md +++ b/core/src/components/backdrop/usage/vue.md @@ -25,7 +25,7 @@ @Component() export default class Example extends Vue { - backdropDismiss = false; + enableBackdropDismiss = false; showBackdrop = false; shouldPropagate = false; } diff --git a/core/src/components/badge/readme.md b/core/src/components/badge/readme.md index 3b96582196..e237412343 100644 --- a/core/src/components/badge/readme.md +++ b/core/src/components/badge/readme.md @@ -67,6 +67,44 @@ export const BadgeExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'badge-example', + styleUrl: 'badge-example.css' +}) +export class BadgeExample { + render() { + return [ + // Default + 99, + + // Colors + 11, + 22, + 33, + 44, + 55, + 66, + 77, + 88, + 99, + + // Item with badge on left and right + + 11 + My Item + 22 + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/badge/usage/stencil.md b/core/src/components/badge/usage/stencil.md new file mode 100644 index 0000000000..862456d3b4 --- /dev/null +++ b/core/src/components/badge/usage/stencil.md @@ -0,0 +1,34 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'badge-example', + styleUrl: 'badge-example.css' +}) +export class BadgeExample { + render() { + return [ + // Default + 99, + + // Colors + 11, + 22, + 33, + 44, + 55, + 66, + 77, + 88, + 99, + + // Item with badge on left and right + + 11 + My Item + 22 + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/button/readme.md b/core/src/components/button/readme.md index 246b7bbacb..b8fd10007c 100644 --- a/core/src/components/button/readme.md +++ b/core/src/components/button/readme.md @@ -155,6 +155,72 @@ export const ButtonExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'button-example', + styleUrl: 'button-example.css' +}) +export class ButtonExample { + render() { + return [ + // Default + Default, + + // Anchor + Anchor, + + // Colors + Primary, + Secondary, + Tertiary, + Success, + Warning, + Danger, + Light, + Medium, + Dark, + + // Expand + Full Button, + Block Button, + + // Round + Round Button, + + // Fill + Outline + Full, + Outline + Block, + Outline + Round, + + // Icons + + + Left Icon + , + + + Right Icon + + , + + + + , + + // Sizes + Large, + Default, + Small + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/button/usage/stencil.md b/core/src/components/button/usage/stencil.md new file mode 100644 index 0000000000..82ced76b17 --- /dev/null +++ b/core/src/components/button/usage/stencil.md @@ -0,0 +1,62 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'button-example', + styleUrl: 'button-example.css' +}) +export class ButtonExample { + render() { + return [ + // Default + Default, + + // Anchor + Anchor, + + // Colors + Primary, + Secondary, + Tertiary, + Success, + Warning, + Danger, + Light, + Medium, + Dark, + + // Expand + Full Button, + Block Button, + + // Round + Round Button, + + // Fill + Outline + Full, + Outline + Block, + Outline + Round, + + // Icons + + + Left Icon + , + + + Right Icon + + , + + + + , + + // Sizes + Large, + Default, + Small + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/buttons/readme.md b/core/src/components/buttons/readme.md index fb186fbae7..61151e9d2f 100644 --- a/core/src/components/buttons/readme.md +++ b/core/src/components/buttons/readme.md @@ -125,16 +125,8 @@ The `` element can be positioned inside of the toolbar using a name ```tsx import React from 'react'; -import { - IonButtons, - IonToolbar, - IonBackButton, - IonTitle, - IonButton, - IonIcon, - IonMenuButton, - IonContent -} from '@ionic/react'; +import { IonButtons, IonToolbar, IonBackButton, IonTitle, IonButton, IonIcon, IonMenuButton, IonContent } from '@ionic/react'; +import { personCircle, search, star, ellipsisHorizontal, ellipsisVertical } from 'ionicons/icons'; export const ButtonsExample: React.FC = () => ( @@ -148,16 +140,16 @@ export const ButtonsExample: React.FC = () => ( - + - + Default Buttons - + @@ -165,7 +157,7 @@ export const ButtonsExample: React.FC = () => ( {}}> - + Right side menu toggle @@ -177,7 +169,7 @@ export const ButtonsExample: React.FC = () => ( - + Collapsible Buttons @@ -187,6 +179,73 @@ export const ButtonsExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'buttons-example', + styleUrl: 'buttons-example.css' +}) +export class ButtonsExample { + + clickedStar() { + console.log("Clicked star button"); + } + + render() { + return [ + + + + + Back Button + , + + + + + + + + + + + Default Buttons + + + + + + , + + + + this.clickedStar()}> + + + + Right side menu toggle + + + + , + + + + + + + + Collapsible Buttons + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/buttons/usage/react.md b/core/src/components/buttons/usage/react.md index dbb51964ce..12e2c1b416 100644 --- a/core/src/components/buttons/usage/react.md +++ b/core/src/components/buttons/usage/react.md @@ -1,15 +1,7 @@ ```tsx import React from 'react'; -import { - IonButtons, - IonToolbar, - IonBackButton, - IonTitle, - IonButton, - IonIcon, - IonMenuButton, - IonContent -} from '@ionic/react'; +import { IonButtons, IonToolbar, IonBackButton, IonTitle, IonButton, IonIcon, IonMenuButton, IonContent } from '@ionic/react'; +import { personCircle, search, star, ellipsisHorizontal, ellipsisVertical } from 'ionicons/icons'; export const ButtonsExample: React.FC = () => ( @@ -23,16 +15,16 @@ export const ButtonsExample: React.FC = () => ( - + - + Default Buttons - + @@ -40,7 +32,7 @@ export const ButtonsExample: React.FC = () => ( {}}> - + Right side menu toggle @@ -52,7 +44,7 @@ export const ButtonsExample: React.FC = () => ( - + Collapsible Buttons diff --git a/core/src/components/buttons/usage/stencil.md b/core/src/components/buttons/usage/stencil.md new file mode 100644 index 0000000000..e684b0c7c7 --- /dev/null +++ b/core/src/components/buttons/usage/stencil.md @@ -0,0 +1,63 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'buttons-example', + styleUrl: 'buttons-example.css' +}) +export class ButtonsExample { + + clickedStar() { + console.log("Clicked star button"); + } + + render() { + return [ + + + + + Back Button + , + + + + + + + + + + + Default Buttons + + + + + + , + + + + this.clickedStar()}> + + + + Right side menu toggle + + + + , + + + + + + + + Collapsible Buttons + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/card/readme.md b/core/src/components/card/readme.md index 8714f05ab0..66ef391017 100644 --- a/core/src/components/card/readme.md +++ b/core/src/components/card/readme.md @@ -133,6 +133,70 @@ export const CardExamples: React.FC = () => { ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'card-example', + styleUrl: 'card-example.css' +}) +export class CardExample { + render() { + return [ + + + Card Subtitle + Card Title + + + + Keep close to Nature's heart... and break clear away, once in awhile, + and climb a mountain or spend a week in the woods. Wash your spirit clean. + + , + + + + + ion-item in a card, icon left, button right + View + + + + This is content, without any paragraph or header tags, + within an ion-card-content element. + + , + + + + + Card Link Item 1 activated + + + + + Card Link Item 2 + + + + + Card Button Item 1 activated + + + + + Card Button Item 2 + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/card/usage/stencil.md b/core/src/components/card/usage/stencil.md new file mode 100644 index 0000000000..bb2b44e398 --- /dev/null +++ b/core/src/components/card/usage/stencil.md @@ -0,0 +1,60 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'card-example', + styleUrl: 'card-example.css' +}) +export class CardExample { + render() { + return [ + + + Card Subtitle + Card Title + + + + Keep close to Nature's heart... and break clear away, once in awhile, + and climb a mountain or spend a week in the woods. Wash your spirit clean. + + , + + + + + ion-item in a card, icon left, button right + View + + + + This is content, without any paragraph or header tags, + within an ion-card-content element. + + , + + + + + Card Link Item 1 activated + + + + + Card Link Item 2 + + + + + Card Button Item 1 activated + + + + + Card Button Item 2 + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/checkbox/readme.md b/core/src/components/checkbox/readme.md index 5e71d0324b..0f77bde855 100644 --- a/core/src/components/checkbox/readme.md +++ b/core/src/components/checkbox/readme.md @@ -153,6 +153,55 @@ export const CheckboxExamples: React.FC = () => { ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'checkbox-example', + styleUrl: 'checkbox-example.css' +}) +export class CheckboxExample { + private form = [ + { val: 'Pepperoni', isChecked: true }, + { val: 'Sausage', isChecked: false }, + { val: 'Mushroom', isChecked: false } + ]; + + render() { + return [ + // Default Checkbox + , + + // Disabled Checkbox + , + + // Checked Checkbox + , + + // Checkbox Colors + , + , + , + , + , + + // Checkboxes in a List + + {this.form.map(entry => + + {entry.val} + + + )} + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/checkbox/usage/stencil.md b/core/src/components/checkbox/usage/stencil.md new file mode 100644 index 0000000000..42599e313a --- /dev/null +++ b/core/src/components/checkbox/usage/stencil.md @@ -0,0 +1,45 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'checkbox-example', + styleUrl: 'checkbox-example.css' +}) +export class CheckboxExample { + private form = [ + { val: 'Pepperoni', isChecked: true }, + { val: 'Sausage', isChecked: false }, + { val: 'Mushroom', isChecked: false } + ]; + + render() { + return [ + // Default Checkbox + , + + // Disabled Checkbox + , + + // Checked Checkbox + , + + // Checkbox Colors + , + , + , + , + , + + // Checkboxes in a List + + {this.form.map(entry => + + {entry.val} + + + )} + + ]; + } +} +``` diff --git a/core/src/components/chip/readme.md b/core/src/components/chip/readme.md index 3414b275d2..dad437e1d1 100644 --- a/core/src/components/chip/readme.md +++ b/core/src/components/chip/readme.md @@ -117,6 +117,64 @@ export const ChipExamples: React.FC = () => { ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'chip-example', + styleUrl: 'chip-example.css' +}) +export class ChipExample { + render() { + return [ + + Default + , + + + Secondary Label + , + + + Secondary w/ Dark label + , + + + + Default + , + + + + Default + , + + + Button Chip + + , + + + + Icon Chip + + , + + + + + + Avatar Chip + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/chip/usage/stencil.md b/core/src/components/chip/usage/stencil.md new file mode 100644 index 0000000000..79e9156813 --- /dev/null +++ b/core/src/components/chip/usage/stencil.md @@ -0,0 +1,54 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'chip-example', + styleUrl: 'chip-example.css' +}) +export class ChipExample { + render() { + return [ + + Default + , + + + Secondary Label + , + + + Secondary w/ Dark label + , + + + + Default + , + + + + Default + , + + + Button Chip + + , + + + + Icon Chip + + , + + + + + + Avatar Chip + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/content/readme.md b/core/src/components/content/readme.md index 9e92f58efc..9b61d91cba 100644 --- a/core/src/components/content/readme.md +++ b/core/src/components/content/readme.md @@ -77,6 +77,47 @@ const ContentExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'content-example', + styleUrl: 'content-example.css' +}) +export class ContentExample { + logScrollStart() { + console.log('Scroll start'); + } + + logScrolling(ev) { + console.log('Scrolling', ev); + } + + logScrollEnd() { + console.log('Scroll end'); + } + + render() { + return [ + this.logScrollStart()} + onIonScroll={(ev) => this.logScrolling(ev)} + onIonScrollEnd={() => this.logScrollEnd()}> +

Main Content

+ +
+

Fixed Content

+
+
+ ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/content/usage/stencil.md b/core/src/components/content/usage/stencil.md new file mode 100644 index 0000000000..e39a358cbb --- /dev/null +++ b/core/src/components/content/usage/stencil.md @@ -0,0 +1,37 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'content-example', + styleUrl: 'content-example.css' +}) +export class ContentExample { + logScrollStart() { + console.log('Scroll start'); + } + + logScrolling(ev) { + console.log('Scrolling', ev); + } + + logScrollEnd() { + console.log('Scroll end'); + } + + render() { + return [ + this.logScrollStart()} + onIonScroll={(ev) => this.logScrolling(ev)} + onIonScrollEnd={() => this.logScrollEnd()}> +

Main Content

+ +
+

Fixed Content

+
+
+ ]; + } +} +``` diff --git a/core/src/components/datetime/readme.md b/core/src/components/datetime/readme.md index 22a047dfb7..262d205829 100644 --- a/core/src/components/datetime/readme.md +++ b/core/src/components/datetime/readme.md @@ -555,6 +555,116 @@ export const DateTimeExamples: React.FC = () => { ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'datetime-example', + styleUrl: 'datetime-example.css' +}) +export class DatetimeExample { + private customYearValues = [2020, 2016, 2008, 2004, 2000, 1996]; + private customDayShortNames = ['s\u00f8n', 'man', 'tir', 'ons', 'tor', 'fre', 'l\u00f8r']; + private customPickerOptions = { + buttons: [{ + text: 'Save', + handler: () => console.log('Clicked Save!') + }, { + text: 'Log', + handler: () => { + console.log('Clicked Log. Do not Dismiss.'); + return false; + } + }] + } + + render() { + return [ + + MMMM + + , + + + MM DD YY + + , + + + Disabled + + , + + + YYYY + + , + + + MMMM YY + + , + + + MM/DD/YYYY + + , + + + MM/DD/YYYY + + , + + + DDD. MMM DD, YY (custom locale) + + , + + + D MMM YYYY H:mm + + , + + + DDDD MMM D, YYYY + + , + + + HH:mm + + , + + + h:mm a + + , + + + hh:mm A (15 min steps) + + , + + + Leap years, summer months + + , + + + Specific days/months/years + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/datetime/usage/stencil.md b/core/src/components/datetime/usage/stencil.md new file mode 100644 index 0000000000..4be0359da5 --- /dev/null +++ b/core/src/components/datetime/usage/stencil.md @@ -0,0 +1,106 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'datetime-example', + styleUrl: 'datetime-example.css' +}) +export class DatetimeExample { + private customYearValues = [2020, 2016, 2008, 2004, 2000, 1996]; + private customDayShortNames = ['s\u00f8n', 'man', 'tir', 'ons', 'tor', 'fre', 'l\u00f8r']; + private customPickerOptions = { + buttons: [{ + text: 'Save', + handler: () => console.log('Clicked Save!') + }, { + text: 'Log', + handler: () => { + console.log('Clicked Log. Do not Dismiss.'); + return false; + } + }] + } + + render() { + return [ + + MMMM + + , + + + MM DD YY + + , + + + Disabled + + , + + + YYYY + + , + + + MMMM YY + + , + + + MM/DD/YYYY + + , + + + MM/DD/YYYY + + , + + + DDD. MMM DD, YY (custom locale) + + , + + + D MMM YYYY H:mm + + , + + + DDDD MMM D, YYYY + + , + + + HH:mm + + , + + + h:mm a + + , + + + hh:mm A (15 min steps) + + , + + + Leap years, summer months + + , + + + Specific days/months/years + + + ]; + } +} +``` diff --git a/core/src/components/fab-button/readme.md b/core/src/components/fab-button/readme.md index 2d2e5acc7d..efd025fee3 100644 --- a/core/src/components/fab-button/readme.md +++ b/core/src/components/fab-button/readme.md @@ -15,7 +15,7 @@ If the FAB button is not wrapped with ``, it will scroll with the conte - + Button @@ -45,7 +45,7 @@ import { IonContent, IonFab, IonFabButton } from '@ionic/react'; export const FabButtonExample: React.FC = () => ( {/*-- Fixed Floating Action Button that does not scroll with the content --*/} - + Button @@ -66,6 +66,45 @@ export const FabButtonExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'fab-button-example', + styleUrl: 'fab-button-example.css' +}) +export class FabButtonExample { + render() { + return [ + + + {/* Fixed Floating Action Button that does not scroll with the content */} + + Button + + + {/* Default Floating Action Button that scrolls with the content */} + Default + + {/* Mini */} + Mini + + {/* Colors */} + Primary + Secondary + Danger + Light + Dark + + + ]; + } +} +``` + + ### Vue ```html @@ -73,7 +112,7 @@ export const FabButtonExample: React.FC = () => ( - + Button diff --git a/core/src/components/fab-button/usage/angular.md b/core/src/components/fab-button/usage/angular.md index bf6ccba454..03573bf6d4 100644 --- a/core/src/components/fab-button/usage/angular.md +++ b/core/src/components/fab-button/usage/angular.md @@ -2,7 +2,7 @@ - + Button diff --git a/core/src/components/fab-button/usage/javascript.md b/core/src/components/fab-button/usage/javascript.md index bf6ccba454..03573bf6d4 100644 --- a/core/src/components/fab-button/usage/javascript.md +++ b/core/src/components/fab-button/usage/javascript.md @@ -2,7 +2,7 @@ - + Button diff --git a/core/src/components/fab-button/usage/react.md b/core/src/components/fab-button/usage/react.md index fade567fca..fdd7f459b3 100644 --- a/core/src/components/fab-button/usage/react.md +++ b/core/src/components/fab-button/usage/react.md @@ -5,7 +5,7 @@ import { IonContent, IonFab, IonFabButton } from '@ionic/react'; export const FabButtonExample: React.FC = () => ( {/*-- Fixed Floating Action Button that does not scroll with the content --*/} - + Button diff --git a/core/src/components/fab-button/usage/stencil.md b/core/src/components/fab-button/usage/stencil.md new file mode 100644 index 0000000000..7318ed37f5 --- /dev/null +++ b/core/src/components/fab-button/usage/stencil.md @@ -0,0 +1,35 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'fab-button-example', + styleUrl: 'fab-button-example.css' +}) +export class FabButtonExample { + render() { + return [ + + + {/* Fixed Floating Action Button that does not scroll with the content */} + + Button + + + {/* Default Floating Action Button that scrolls with the content */} + Default + + {/* Mini */} + Mini + + {/* Colors */} + Primary + Secondary + Danger + Light + Dark + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/fab-button/usage/vue.md b/core/src/components/fab-button/usage/vue.md index 92d1614eb0..6e1c520151 100644 --- a/core/src/components/fab-button/usage/vue.md +++ b/core/src/components/fab-button/usage/vue.md @@ -3,7 +3,7 @@ - + Button diff --git a/core/src/components/fab-list/readme.md b/core/src/components/fab-list/readme.md index c3d58e3fed..3a7693b713 100644 --- a/core/src/components/fab-list/readme.md +++ b/core/src/components/fab-list/readme.md @@ -10,19 +10,55 @@ The `ion-fab-list` element is a container for multiple fab buttons. This collect ### Angular / javascript ```html - + Share - - Facebook - Twitter - Youtube + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Vimeo + + + + + + + + + - ``` @@ -32,29 +68,57 @@ The `ion-fab-list` element is a container for multiple fab buttons. This collect ```tsx import React from 'react'; import { IonFab, IonFabButton, IonFabList, IonContent, IonIcon } from '@ionic/react'; +import { logoFacebook, logoTwitter, logoYoutube, logoPwa, logoNpm, logoIonic, logoGithub, logoJavascript, logoAngular, logoVimeo, logoChrome, logoReact } from 'ionicons/icons'; export const FabListExample: React.FC = () => ( - - - - - + + Share - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + @@ -64,6 +128,74 @@ export const FabListExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'fab-list-example', + styleUrl: 'fab-list-example.css' +}) +export class FabListExample { + render() { + return [ + + Share + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/fab-list/usage/angular.md b/core/src/components/fab-list/usage/angular.md index feb7aafeac..e100f3c873 100644 --- a/core/src/components/fab-list/usage/angular.md +++ b/core/src/components/fab-list/usage/angular.md @@ -1,16 +1,52 @@ ```html - + Share - - Facebook - Twitter - Youtube + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Vimeo + + + + + + + + + - ``` diff --git a/core/src/components/fab-list/usage/javascript.md b/core/src/components/fab-list/usage/javascript.md index feb7aafeac..e100f3c873 100644 --- a/core/src/components/fab-list/usage/javascript.md +++ b/core/src/components/fab-list/usage/javascript.md @@ -1,16 +1,52 @@ ```html - + Share - - Facebook - Twitter - Youtube + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Vimeo + + + + + + + + + - ``` diff --git a/core/src/components/fab-list/usage/react.md b/core/src/components/fab-list/usage/react.md index 7ad2c94e67..89ac3668b1 100644 --- a/core/src/components/fab-list/usage/react.md +++ b/core/src/components/fab-list/usage/react.md @@ -1,29 +1,57 @@ ```tsx import React from 'react'; import { IonFab, IonFabButton, IonFabList, IonContent, IonIcon } from '@ionic/react'; +import { logoFacebook, logoTwitter, logoYoutube, logoPwa, logoNpm, logoIonic, logoGithub, logoJavascript, logoAngular, logoVimeo, logoChrome, logoReact } from 'ionicons/icons'; export const FabListExample: React.FC = () => ( - - - - - + + Share - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + diff --git a/core/src/components/fab-list/usage/stencil.md b/core/src/components/fab-list/usage/stencil.md new file mode 100644 index 0000000000..1c066f5cad --- /dev/null +++ b/core/src/components/fab-list/usage/stencil.md @@ -0,0 +1,64 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'fab-list-example', + styleUrl: 'fab-list-example.css' +}) +export class FabListExample { + render() { + return [ + + Share + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/fab/readme.md b/core/src/components/fab/readme.md index 9472ff5506..047ab1a818 100644 --- a/core/src/components/fab/readme.md +++ b/core/src/components/fab/readme.md @@ -10,6 +10,12 @@ Fabs are container elements that contain one or more fab buttons. They should be ### Angular / javascript ```html + + + Header + + + @@ -89,6 +95,12 @@ Fabs are container elements that contain one or more fab buttons. They should be + + + + Footer + + ``` @@ -96,7 +108,7 @@ Fabs are container elements that contain one or more fab buttons. They should be ```tsx import React from 'react'; -import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonFab, IonFabButton, IonIcon, IonFabList } from '@ionic/react'; +import { IonContent, IonHeader, IonFooter, IonPage, IonTitle, IonToolbar, IonFab, IonFabButton, IonIcon, IonFabList } from '@ionic/react'; import { add, settings, share, person, arrowForwardCircle, arrowBackCircle, arrowUpCircle, logoVimeo, logoFacebook, logoInstagram, logoTwitter } from 'ionicons/icons'; export const FabExamples: React.FC = () => { @@ -104,7 +116,7 @@ export const FabExamples: React.FC = () => { - FabExamples + Header @@ -186,16 +198,138 @@ export const FabExamples: React.FC = () => { + + + Footer + + ); }; ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'fab-example', + styleUrl: 'fab-example.css' +}) +export class FabExample { + render() { + return [ + + + Header + + , + + + {/* fab placed to the top end */} + + + + + + + {/* fab placed to the bottom end */} + + + + + + + {/* fab placed to the top start */} + + + + + + + {/* fab placed to the bottom start */} + + + + + + + {/* fab placed to the (vertical) center and start */} + + + + + + + {/* fab placed to the (vertical) center and end */} + + + + + + + {/* fab placed to the top and end and on the top edge of the content overlapping header */} + + + + + + + {/* fab placed to the bottom and start and on the bottom edge of content overlapping footer with a list to the right */} + + + + + + + + + + {/* fab placed in the center of the content with a list on each side */} + + + + + + + + + + + + + + + + + + , + + + + + Footer + + + + ]; + } +} +``` + + ### Vue ```html ``` diff --git a/core/src/components/fab/usage/angular.md b/core/src/components/fab/usage/angular.md index 3f13c497c7..c52d793b6e 100644 --- a/core/src/components/fab/usage/angular.md +++ b/core/src/components/fab/usage/angular.md @@ -1,4 +1,10 @@ ```html + + + Header + + + @@ -78,4 +84,10 @@ + + + + Footer + + ``` diff --git a/core/src/components/fab/usage/javascript.md b/core/src/components/fab/usage/javascript.md index 3f13c497c7..c52d793b6e 100644 --- a/core/src/components/fab/usage/javascript.md +++ b/core/src/components/fab/usage/javascript.md @@ -1,4 +1,10 @@ ```html + + + Header + + + @@ -78,4 +84,10 @@ + + + + Footer + + ``` diff --git a/core/src/components/fab/usage/react.md b/core/src/components/fab/usage/react.md index 8a1ae65db0..5209f4ca09 100644 --- a/core/src/components/fab/usage/react.md +++ b/core/src/components/fab/usage/react.md @@ -1,6 +1,6 @@ ```tsx import React from 'react'; -import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonFab, IonFabButton, IonIcon, IonFabList } from '@ionic/react'; +import { IonContent, IonHeader, IonFooter, IonPage, IonTitle, IonToolbar, IonFab, IonFabButton, IonIcon, IonFabList } from '@ionic/react'; import { add, settings, share, person, arrowForwardCircle, arrowBackCircle, arrowUpCircle, logoVimeo, logoFacebook, logoInstagram, logoTwitter } from 'ionicons/icons'; export const FabExamples: React.FC = () => { @@ -8,7 +8,7 @@ export const FabExamples: React.FC = () => { - FabExamples + Header @@ -90,6 +90,11 @@ export const FabExamples: React.FC = () => { + + + Footer + + ); }; diff --git a/core/src/components/fab/usage/stencil.md b/core/src/components/fab/usage/stencil.md new file mode 100644 index 0000000000..234e8af287 --- /dev/null +++ b/core/src/components/fab/usage/stencil.md @@ -0,0 +1,107 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'fab-example', + styleUrl: 'fab-example.css' +}) +export class FabExample { + render() { + return [ + + + Header + + , + + + {/* fab placed to the top end */} + + + + + + + {/* fab placed to the bottom end */} + + + + + + + {/* fab placed to the top start */} + + + + + + + {/* fab placed to the bottom start */} + + + + + + + {/* fab placed to the (vertical) center and start */} + + + + + + + {/* fab placed to the (vertical) center and end */} + + + + + + + {/* fab placed to the top and end and on the top edge of the content overlapping header */} + + + + + + + {/* fab placed to the bottom and start and on the bottom edge of content overlapping footer with a list to the right */} + + + + + + + + + + {/* fab placed in the center of the content with a list on each side */} + + + + + + + + + + + + + + + + + + , + + + + + Footer + + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/fab/usage/vue.md b/core/src/components/fab/usage/vue.md index c7f57e6d33..dba0f9af7e 100644 --- a/core/src/components/fab/usage/vue.md +++ b/core/src/components/fab/usage/vue.md @@ -1,5 +1,11 @@ ```html ``` diff --git a/core/src/components/footer/readme.md b/core/src/components/footer/readme.md index 2782250f7d..c87a16f280 100644 --- a/core/src/components/footer/readme.md +++ b/core/src/components/footer/readme.md @@ -55,6 +55,38 @@ export const FooterExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'footer-example', + styleUrl: 'footer-example.css' +}) +export class FooterExample { + render() { + return [ + , + + // Footer without a border + + + Footer - No Border + + , + + + + Footer + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/footer/usage/stencil.md b/core/src/components/footer/usage/stencil.md new file mode 100644 index 0000000000..84ef348a27 --- /dev/null +++ b/core/src/components/footer/usage/stencil.md @@ -0,0 +1,28 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'footer-example', + styleUrl: 'footer-example.css' +}) +export class FooterExample { + render() { + return [ + , + + // Footer without a border + + + Footer - No Border + + , + + + + Footer + + + ]; + } +} +``` diff --git a/core/src/components/grid/readme.md b/core/src/components/grid/readme.md index 7809da7f6c..1c7f87924c 100644 --- a/core/src/components/grid/readme.md +++ b/core/src/components/grid/readme.md @@ -337,6 +337,201 @@ export const GridExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'grid-example', + styleUrl: 'grid-example.css' +}) +export class GridExample { + render() { + return [ + + + + ion-col + + + ion-col + + + ion-col + + + ion-col + + + + + + ion-col [size="6"] + + + ion-col + + + ion-col + + + + + + ion-col [size="3"] + + + ion-col + + + ion-col [size="3"] + + + + + + ion-col [size="3"] + + + ion-col [size="3"] [offset="3"] + + + + + + ion-col + + + ion-col +
# +
+ + ion-col +
# +
# +
+ + ion-col +
# +
# +
# +
+
+ + + + ion-col [start] + + + ion-col [center] + + + ion-col [end] + + + ion-col +
# +
# +
+
+ + + + [start] ion-col + + + [start] ion-col + + + [start] ion-col [end] + + + ion-col +
# +
# +
+
+ + + + [center] ion-col + + + [center] ion-col + + + [center] ion-col + + + ion-col +
# +
# +
+
+ + + + [end] ion-col + + + [end] ion-col [start] + + + [end] ion-col + + + ion-col +
# +
# +
+
+ + + + ion-col [size="12"] [sizeSm] + + + ion-col [size="12"] [sizeSm] + + + ion-col [size="12"] [sizeSm] + + + ion-col [size="12"] [sizeSm] + + + + + + ion-col [size="12"] [sizeMd] + + + ion-col [size="12"] [sizeMd] + + + ion-col [size="12"] [sizeMd] + + + ion-col [size="12"] [sizeMd] + + + + + + ion-col [size="6"] [sizeLg] [offset="3"] + + + ion-col [size="3"] [sizeLg] + + +
+ ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/grid/usage/stencil.md b/core/src/components/grid/usage/stencil.md new file mode 100644 index 0000000000..8b71ef5316 --- /dev/null +++ b/core/src/components/grid/usage/stencil.md @@ -0,0 +1,191 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'grid-example', + styleUrl: 'grid-example.css' +}) +export class GridExample { + render() { + return [ + + + + ion-col + + + ion-col + + + ion-col + + + ion-col + + + + + + ion-col [size="6"] + + + ion-col + + + ion-col + + + + + + ion-col [size="3"] + + + ion-col + + + ion-col [size="3"] + + + + + + ion-col [size="3"] + + + ion-col [size="3"] [offset="3"] + + + + + + ion-col + + + ion-col +
# +
+ + ion-col +
# +
# +
+ + ion-col +
# +
# +
# +
+
+ + + + ion-col [start] + + + ion-col [center] + + + ion-col [end] + + + ion-col +
# +
# +
+
+ + + + [start] ion-col + + + [start] ion-col + + + [start] ion-col [end] + + + ion-col +
# +
# +
+
+ + + + [center] ion-col + + + [center] ion-col + + + [center] ion-col + + + ion-col +
# +
# +
+
+ + + + [end] ion-col + + + [end] ion-col [start] + + + [end] ion-col + + + ion-col +
# +
# +
+
+ + + + ion-col [size="12"] [sizeSm] + + + ion-col [size="12"] [sizeSm] + + + ion-col [size="12"] [sizeSm] + + + ion-col [size="12"] [sizeSm] + + + + + + ion-col [size="12"] [sizeMd] + + + ion-col [size="12"] [sizeMd] + + + ion-col [size="12"] [sizeMd] + + + ion-col [size="12"] [sizeMd] + + + + + + ion-col [size="6"] [sizeLg] [offset="3"] + + + ion-col [size="3"] [sizeLg] + + +
+ ]; + } +} +``` diff --git a/core/src/components/header/readme.md b/core/src/components/header/readme.md index 716687853f..ef87fbc0a7 100644 --- a/core/src/components/header/readme.md +++ b/core/src/components/header/readme.md @@ -83,6 +83,51 @@ export const HeaderExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'header-example', + styleUrl: 'header-example.css' +}) +export class HeaderExample { + render() { + return [ + + + + + + My Navigation Bar + + + + Subheader + + , + + // Header without a border + + + Header - No Border + + , + + + + + My Navigation Bar + + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/header/usage/stencil.md b/core/src/components/header/usage/stencil.md new file mode 100644 index 0000000000..8abf3618b2 --- /dev/null +++ b/core/src/components/header/usage/stencil.md @@ -0,0 +1,41 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'header-example', + styleUrl: 'header-example.css' +}) +export class HeaderExample { + render() { + return [ + + + + + + My Navigation Bar + + + + Subheader + + , + + // Header without a border + + + Header - No Border + + , + + + + + My Navigation Bar + + + + ]; + } +} +``` diff --git a/core/src/components/icon/usage/stencil.md b/core/src/components/icon/usage/stencil.md new file mode 100644 index 0000000000..9022f3132c --- /dev/null +++ b/core/src/components/icon/usage/stencil.md @@ -0,0 +1,26 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'icon-example', + styleUrl: 'icon-example.css' +}) +export class IconExample { + render() { + return [ + // uses "star" icon for both modes + , + + // explicitly set the icon for each mode + , + + // use a custom svg icon + , + + // set the icon size + , + + ]; + } +} +``` diff --git a/core/src/components/img/readme.md b/core/src/components/img/readme.md index 362d07a65f..26be240884 100644 --- a/core/src/components/img/readme.md +++ b/core/src/components/img/readme.md @@ -51,6 +51,45 @@ export const ImgExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'img-example', + styleUrl: 'img-example.css' +}) +export class ImgExample { + private items = [{ + 'text': 'Item 1', + 'src': '/path/to/external/file.png' + }, { + 'text': 'Item 2', + 'src': '/path/to/external/file.png' + }, { + 'text': 'Item 3', + 'src': '/path/to/external/file.png' + }]; + + render() { + return [ + + {this.items.map(item => + + + + + {item.text} + + )} + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/img/usage/stencil.md b/core/src/components/img/usage/stencil.md new file mode 100644 index 0000000000..2f14878da5 --- /dev/null +++ b/core/src/components/img/usage/stencil.md @@ -0,0 +1,35 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'img-example', + styleUrl: 'img-example.css' +}) +export class ImgExample { + private items = [{ + 'text': 'Item 1', + 'src': '/path/to/external/file.png' + }, { + 'text': 'Item 2', + 'src': '/path/to/external/file.png' + }, { + 'text': 'Item 3', + 'src': '/path/to/external/file.png' + }]; + + render() { + return [ + + {this.items.map(item => + + + + + {item.text} + + )} + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/infinite-scroll-content/readme.md b/core/src/components/infinite-scroll-content/readme.md index 96dcbf08a0..ddef2f08bb 100644 --- a/core/src/components/infinite-scroll-content/readme.md +++ b/core/src/components/infinite-scroll-content/readme.md @@ -39,6 +39,32 @@ The `ion-infinite-scroll-content` component is not supported in React. ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'infinite-scroll-content-example', + styleUrl: 'infinite-scroll-content-example.css' +}) +export class InfiniteScrollContentExample { + render() { + return [ + + + + + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/infinite-scroll-content/usage/stencil.md b/core/src/components/infinite-scroll-content/usage/stencil.md new file mode 100644 index 0000000000..9eeae1fb85 --- /dev/null +++ b/core/src/components/infinite-scroll-content/usage/stencil.md @@ -0,0 +1,22 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'infinite-scroll-content-example', + styleUrl: 'infinite-scroll-content-example.css' +}) +export class InfiniteScrollContentExample { + render() { + return [ + + + + + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/infinite-scroll/readme.md b/core/src/components/infinite-scroll/readme.md index b51e71aae3..69f21c9a63 100644 --- a/core/src/components/infinite-scroll/readme.md +++ b/core/src/components/infinite-scroll/readme.md @@ -115,6 +115,88 @@ function toggleInfiniteScroll() { ``` +### Stencil + +```tsx +import { Component, State, h } from '@stencil/core'; + +@Component({ + tag: 'infinite-scroll-example', + styleUrl: 'infinite-scroll-example.css' +}) +export class InfiniteScrollExample { + private infiniteScroll: HTMLIonInfiniteScrollElement; + + @State() data = []; + + componentWillLoad() { + this.pushData(); + } + + pushData() { + const max = this.data.length + 20; + const min = max - 20; + + for (var i = min; i < max; i++) { + this.data.push('Item ' + i); + } + + // Stencil does not re-render when pushing to an array + // so create a new copy of the array + // https://stenciljs.com/docs/reactive-data#handling-arrays-and-objects + this.data = [ + ...this.data + ]; + } + + loadData(ev) { + setTimeout(() => { + this.pushData(); + console.log('Loaded data'); + ev.target.complete(); + + // App logic to determine if all data is loaded + // and disable the infinite scroll + if (this.data.length == 1000) { + ev.target.disabled = true; + } + }, 500); + } + + toggleInfiniteScroll() { + this.infiniteScroll.disabled = !this.infiniteScroll.disabled; + } + + render() { + return [ + + this.toggleInfiniteScroll()} expand="block"> + Toggle Infinite Scroll + + + + {this.data.map(item => + + {item} + + )} + + + this.infiniteScroll = el} + onIonInfinite={(ev) => this.loadData(ev)}> + + + + + ]; + } +} +``` + + ## Properties diff --git a/core/src/components/infinite-scroll/usage/stencil.md b/core/src/components/infinite-scroll/usage/stencil.md new file mode 100644 index 0000000000..fdf570da48 --- /dev/null +++ b/core/src/components/infinite-scroll/usage/stencil.md @@ -0,0 +1,78 @@ +```tsx +import { Component, State, h } from '@stencil/core'; + +@Component({ + tag: 'infinite-scroll-example', + styleUrl: 'infinite-scroll-example.css' +}) +export class InfiniteScrollExample { + private infiniteScroll: HTMLIonInfiniteScrollElement; + + @State() data = []; + + componentWillLoad() { + this.pushData(); + } + + pushData() { + const max = this.data.length + 20; + const min = max - 20; + + for (var i = min; i < max; i++) { + this.data.push('Item ' + i); + } + + // Stencil does not re-render when pushing to an array + // so create a new copy of the array + // https://stenciljs.com/docs/reactive-data#handling-arrays-and-objects + this.data = [ + ...this.data + ]; + } + + loadData(ev) { + setTimeout(() => { + this.pushData(); + console.log('Loaded data'); + ev.target.complete(); + + // App logic to determine if all data is loaded + // and disable the infinite scroll + if (this.data.length == 1000) { + ev.target.disabled = true; + } + }, 500); + } + + toggleInfiniteScroll() { + this.infiniteScroll.disabled = !this.infiniteScroll.disabled; + } + + render() { + return [ + + this.toggleInfiniteScroll()} expand="block"> + Toggle Infinite Scroll + + + + {this.data.map(item => + + {item} + + )} + + + this.infiniteScroll = el} + onIonInfinite={(ev) => this.loadData(ev)}> + + + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/input/readme.md b/core/src/components/input/readme.md index 25c62404da..abbada54db 100644 --- a/core/src/components/input/readme.md +++ b/core/src/components/input/readme.md @@ -178,6 +178,65 @@ export const InputExamples: React.FC = () => { ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'input-example', + styleUrl: 'input-example.css' +}) +export class InputExample { + render() { + return [ + // Default Input + , + + // Input with value + , + + // Input with placeholder + , + + // Input with clear button when there is a value + , + + // Number type input + , + + // Disabled input + , + + // Readonly input + , + + // Inputs with labels + + Default Label + + , + + + Floating Label + + , + + + Fixed Label + + , + + + Stacked Label + + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/input/usage/stencil.md b/core/src/components/input/usage/stencil.md new file mode 100644 index 0000000000..78982fb9ce --- /dev/null +++ b/core/src/components/input/usage/stencil.md @@ -0,0 +1,55 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'input-example', + styleUrl: 'input-example.css' +}) +export class InputExample { + render() { + return [ + // Default Input + , + + // Input with value + , + + // Input with placeholder + , + + // Input with clear button when there is a value + , + + // Number type input + , + + // Disabled input + , + + // Readonly input + , + + // Inputs with labels + + Default Label + + , + + + Floating Label + + , + + + Fixed Label + + , + + + Stacked Label + + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/item-divider/readme.md b/core/src/components/item-divider/readme.md index 19462cfe88..1ec6eab96b 100644 --- a/core/src/components/item-divider/readme.md +++ b/core/src/components/item-divider/readme.md @@ -102,6 +102,62 @@ export const ItemDividerExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-divider-example', + styleUrl: 'item-divider-example.css' +}) +export class ItemDividerExample { + render() { + return [ + + + Basic Item Divider + + , + + + + Secondary Item Divider + + , + + // Item Dividers in a List + + + + Section A + + + + A1 + A2 + A3 + A4 + A5 + + + + Section B + + + + B1 + B2 + B3 + B4 + B5 + + ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/item-divider/usage/stencil.md b/core/src/components/item-divider/usage/stencil.md new file mode 100644 index 0000000000..16b26cf6d2 --- /dev/null +++ b/core/src/components/item-divider/usage/stencil.md @@ -0,0 +1,52 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-divider-example', + styleUrl: 'item-divider-example.css' +}) +export class ItemDividerExample { + render() { + return [ + + + Basic Item Divider + + , + + + + Secondary Item Divider + + , + + // Item Dividers in a List + + + + Section A + + + + A1 + A2 + A3 + A4 + A5 + + + + Section B + + + + B1 + B2 + B3 + B4 + B5 + + ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/item-group/readme.md b/core/src/components/item-group/readme.md index 3a8afbf48d..d3c27f2e64 100644 --- a/core/src/components/item-group/readme.md +++ b/core/src/components/item-group/readme.md @@ -234,6 +234,125 @@ export default Example; ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-group-example', + styleUrl: 'item-group-example.css' +}) +export class ItemGroupExample { + render() { + return [ + + + A + + + + Angola + + + Argentina + + + Armenia + + + + + + B + + + + Bangladesh + + + Belarus + + + Belgium + + + + + // They can also be used to group sliding items + + + + Fruits + + + + + + +

Grapes

+
+
+ + + Favorite + + +
+ + + + +

Apples

+
+
+ + + Favorite + + +
+
+ + + + + Vegetables + + + + + + +

Carrots

+
+
+ + + Favorite + + +
+ + + + +

Celery

+
+
+ + + Favorite + + +
+
+ ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/item-group/usage/stencil.md b/core/src/components/item-group/usage/stencil.md new file mode 100644 index 0000000000..e4cc2e435d --- /dev/null +++ b/core/src/components/item-group/usage/stencil.md @@ -0,0 +1,115 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-group-example', + styleUrl: 'item-group-example.css' +}) +export class ItemGroupExample { + render() { + return [ + + + A + + + + Angola + + + Argentina + + + Armenia + + + + + + B + + + + Bangladesh + + + Belarus + + + Belgium + + + + + // They can also be used to group sliding items + + + + Fruits + + + + + + +

Grapes

+
+
+ + + Favorite + + +
+ + + + +

Apples

+
+
+ + + Favorite + + +
+
+ + + + + Vegetables + + + + + + +

Carrots

+
+
+ + + Favorite + + +
+ + + + +

Celery

+
+
+ + + Favorite + + +
+
+ ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/item-sliding/readme.md b/core/src/components/item-sliding/readme.md index 974a655658..4110b00bfa 100644 --- a/core/src/components/item-sliding/readme.md +++ b/core/src/components/item-sliding/readme.md @@ -331,6 +331,8 @@ Options can be expanded to take up the full width of the item if you swipe past import React from 'react'; import { IonList, IonItemSliding, IonItem, IonLabel, IonItemOptions, IonItemOption, IonIcon, IonNote } from '@ionic/react'; +import { heart, trash, star, archive, ellipsisHorizontal, ellipsisVertical } from 'ionicons/icons'; + export const ItemSlidingExample: React.FC = () => ( {/* Sliding item with text options on both sides */} @@ -383,16 +385,16 @@ export const ItemSlidingExample: React.FC = () => ( - + - + - + @@ -406,11 +408,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -425,11 +427,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -444,11 +446,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -463,11 +465,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -477,6 +479,177 @@ export const ItemSlidingExample: React.FC = () => ( ``` +### Stencil + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-sliding-example', + styleUrl: 'item-sliding-example.css' +}) +export class ItemSlidingExample { + favorite(ev: any) { + console.log('Favorite clicked', ev); + } + + share(ev: any) { + console.log('Favorite clicked', ev); + } + + unread(ev: any) { + console.log('Favorite clicked', ev); + } + + render() { + return [ + + {/* Sliding item with text options on both sides */} + + + this.favorite(ev)}>Favorite + this.share(ev)}>Share + + + + Item Options + + + + this.unread(ev)}>Unread + + + + {/* Sliding item with expandable options on both sides */} + + + + Delete + + + + + Expandable Options + + + + + Archive + + + + + {/* Multi-line sliding item with icon options on both sides */} + + + +

HubStruck Notifications

+

A new message in your network

+

Oceanic Next has joined your network

+
+ + 10:45 AM + +
+ + + + + + + + + + + + + + + +
+ + {/* Sliding item with icon start options on end side */} + + + + Sliding Item, Icons Start + + + + + + More + + + + Archive + + + + + {/* Sliding item with icon end options on end side */} + + + + Sliding Item, Icons End + + + + + + More + + + + Archive + + + + + {/* Sliding item with icon top options on end side */} + + + + Sliding Item, Icons Top + + + + + + More + + + + Archive + + + + + {/* Sliding item with icon bottom options on end side */} + + + + Sliding Item, Icons Bottom + + + + + + More + + + + Archive + + + +
+ ]; + } +} +``` + + ### Vue ```html diff --git a/core/src/components/item-sliding/usage/react.md b/core/src/components/item-sliding/usage/react.md index 08ceb726d0..d9fe0f0311 100644 --- a/core/src/components/item-sliding/usage/react.md +++ b/core/src/components/item-sliding/usage/react.md @@ -2,6 +2,8 @@ import React from 'react'; import { IonList, IonItemSliding, IonItem, IonLabel, IonItemOptions, IonItemOption, IonIcon, IonNote } from '@ionic/react'; +import { heart, trash, star, archive, ellipsisHorizontal, ellipsisVertical } from 'ionicons/icons'; + export const ItemSlidingExample: React.FC = () => ( {/* Sliding item with text options on both sides */} @@ -54,16 +56,16 @@ export const ItemSlidingExample: React.FC = () => ( - + - + - + @@ -77,11 +79,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -96,11 +98,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -115,11 +117,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive @@ -134,11 +136,11 @@ export const ItemSlidingExample: React.FC = () => ( - + More - + Archive diff --git a/core/src/components/item-sliding/usage/stencil.md b/core/src/components/item-sliding/usage/stencil.md new file mode 100644 index 0000000000..e697083933 --- /dev/null +++ b/core/src/components/item-sliding/usage/stencil.md @@ -0,0 +1,167 @@ +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-sliding-example', + styleUrl: 'item-sliding-example.css' +}) +export class ItemSlidingExample { + favorite(ev: any) { + console.log('Favorite clicked', ev); + } + + share(ev: any) { + console.log('Favorite clicked', ev); + } + + unread(ev: any) { + console.log('Favorite clicked', ev); + } + + render() { + return [ + + {/* Sliding item with text options on both sides */} + + + this.favorite(ev)}>Favorite + this.share(ev)}>Share + + + + Item Options + + + + this.unread(ev)}>Unread + + + + {/* Sliding item with expandable options on both sides */} + + + + Delete + + + + + Expandable Options + + + + + Archive + + + + + {/* Multi-line sliding item with icon options on both sides */} + + + +

HubStruck Notifications

+

A new message in your network

+

Oceanic Next has joined your network

+
+ + 10:45 AM + +
+ + + + + + + + + + + + + + + +
+ + {/* Sliding item with icon start options on end side */} + + + + Sliding Item, Icons Start + + + + + + More + + + + Archive + + + + + {/* Sliding item with icon end options on end side */} + + + + Sliding Item, Icons End + + + + + + More + + + + Archive + + + + + {/* Sliding item with icon top options on end side */} + + + + Sliding Item, Icons Top + + + + + + More + + + + Archive + + + + + {/* Sliding item with icon bottom options on end side */} + + + + Sliding Item, Icons Bottom + + + + + + More + + + + Archive + + + +
+ ]; + } +} +``` \ No newline at end of file diff --git a/core/src/components/item/readme.md b/core/src/components/item/readme.md index 89c99eb32a..3f8e436d5e 100644 --- a/core/src/components/item/readme.md +++ b/core/src/components/item/readme.md @@ -61,8 +61,6 @@ The highlight color changes based on the item state, but all of the states use I ### Angular -Basic Usage - ```html @@ -92,7 +90,7 @@ Basic Usage ``` -Detail Arrows +### Detail Arrows ```html @@ -114,7 +112,7 @@ Detail Arrows ``` -List Items +### List Items ```html @@ -158,7 +156,7 @@ List Items ``` -Item Lines +### Item Lines ```html @@ -215,7 +213,7 @@ Item Lines ``` -Media Items +### Media Items ```html @@ -259,7 +257,7 @@ Media Items ``` -Buttons in Items +### Buttons in Items ```html @@ -295,7 +293,7 @@ Buttons in Items ``` -Icons in Items +### Icons in Items ```html @@ -335,7 +333,7 @@ Icons in Items ``` -Item Inputs +### Item Inputs ```html @@ -385,8 +383,6 @@ Item Inputs ### Javascript -Basic Usage - ```html @@ -416,7 +412,7 @@ Basic Usage ``` -Detail Arrows +### Detail Arrows ```html @@ -438,7 +434,7 @@ Detail Arrows ``` -List Items +### List Items ```html @@ -482,7 +478,7 @@ List Items ``` -Item Lines +### Item Lines ```html @@ -539,7 +535,7 @@ Item Lines ``` -Media Items +### Media Items ```html @@ -583,7 +579,7 @@ Media Items ``` -Buttons in Items +### Buttons in Items ```html @@ -619,7 +615,7 @@ Buttons in Items ``` -Icons in Items +### Icons in Items ```html @@ -659,7 +655,7 @@ Icons in Items ``` -Item Inputs +### Item Inputs ```html @@ -727,68 +723,66 @@ export const ItemExamples: React.FC = () => { Item - + {/*-- Item as a Button --*/} { }}> Button Item - + {/*-- Item as an Anchor --*/} Anchor Item - + Secondary Color Item - + {/*-- Detail Arrows --*/} - Standard Item with Detail Arrow - + { }} detail> Button Item with Detail Arrow - + Anchor Item with no Detail Arrow - + - Item - + No Lines Item - + Multiline text that should wrap when it is too long to fit on one line in the item. - + @@ -806,12 +800,10 @@ export const ItemExamples: React.FC = () => { Item with Full Lines - + - - {/*-- Item Inset Lines --*/} Item Lines Inset @@ -864,21 +856,19 @@ export const ItemExamples: React.FC = () => {
- - { }}> Avatar Start, Button Item - + Thumbnail End, Anchor Item - + @@ -906,30 +896,27 @@ export const ItemExamples: React.FC = () => { - - Buttons in Items - - - + {/*-- Buttons in Items --*/} + Start - + Button Start/End End - + Start Icon - > + > Buttons with Icons End Icon - + @@ -942,25 +929,24 @@ export const ItemExamples: React.FC = () => { - Icon End - + Large Icon End - + Small Icon End - + @@ -968,13 +954,13 @@ export const ItemExamples: React.FC = () => { Icon Start - + Two Icons End - + @@ -1022,15 +1008,441 @@ export const ItemExamples: React.FC = () => {
- + ); }; ``` -### Vue +### Stencil -Basic Usage +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + buttonClick() { + console.log('Clicked button'); + } + + render() { + return [ + // Default Item + + + Item + + , + + // Item as a Button + this.buttonClick()}> + + Button Item + + , + + // Item as an Anchor + + + Anchor Item + + , + + + + Secondary Color Item + + + ]; + } +} +``` + +### Detail Arrows + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + buttonClick() { + console.log('Clicked button'); + } + + render() { + return [ + + + Standard Item with Detail Arrow + + , + + this.buttonClick()} detail> + + Button Item with Detail Arrow + + , + + + + Anchor Item with no Detail Arrow + + + ]; + } +} +``` + +### List Items + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + render() { + return [ + + + + Item + + , + + + + No Lines Item + + , + + + + Multiline text that should wrap when it is too long + to fit on one line in the item. + + , + + + + +

H3 Primary Title

+
+

Paragraph line 1

+ +

Paragraph line 2 secondary

+
+
+
, + + + + Item with Full Lines + + +
+ ]; + } +} +``` + +### Item Lines + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + render() { + return [ + // Item Inset Lines + + Item Lines Inset + , + + // Item Full Lines + + Item Lines Full + , + + // Item None Lines + + Item Lines None + , + + // List Full Lines + + + Full Lines Item 1 + + + + Full Lines Item 2 + + , + + // List Inset Lines + + + Inset Lines Item 1 + + + + Inset Lines Item 2 + + , + + // List No Lines + + + No lines Item 1 + + + + No lines Item 2 + + + + No lines Item 3 + + + ]; + } +} +``` + +### Media Items + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + testClick() { + console.log('Test click'); + } + + render() { + return [ + this.testClick()}> + + + + + Avatar Start, Button Item + + , + + + + Thumbnail End, Anchor Item + + + + + , + + + + + + +

H2 Title Text

+

Button on right

+
+ View +
, + + this.testClick()}> + + + + +

H3 Title Text

+

Icon on right

+
+ +
+ ]; + } +} +``` + +### Buttons in Items + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + render() { + return [ + + + Start + + Button Start/End + + End + + , + + + + Start Icon + + + Buttons with Icons + + + End Icon + + , + + + + + + Icon only Buttons + + + + + ]; + } +} +``` + +### Icons in Items + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + render() { + return [ + + + Icon End + + + , + + + + Large Icon End + + + , + + + + Small Icon End + + + , + + + + + Icon Start + + , + + + + Two Icons End + + + + + ]; + } +} +``` + +### Item Inputs + +```tsx +import { Component, h } from '@stencil/core'; + +@Component({ + tag: 'item-example', + styleUrl: 'item-example.css' +}) +export class ItemExample { + render() { + return [ + + Datetime + + , + + + Select + + No Game Console + NES + Nintendo64 + PlayStation + Sega Genesis + Sega Saturn + SNES + + , + + + Toggle + + , + + + Floating Input + + , + + + Input (placeholder) + + , + + + Checkbox + + , + + + Range + + + ]; + } +} +``` + + +### Vue ```html ``` -Detail Arrows +### Detail Arrows ```html ``` -List Items +### List Items ```html ``` -Item Lines +### Item Lines ```html