Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0aac276af | ||
|
|
6d6fd4af1b | ||
|
|
7cfee535ac | ||
|
|
167e311474 | ||
|
|
7eae6ec591 | ||
|
|
8f6f9be500 | ||
|
|
e5ffb6f04b | ||
|
|
6c500fd6b2 | ||
|
|
730105964a | ||
|
|
6e477b743e |
@@ -30,6 +30,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
|
||||
- [Progress bar](#version-8x-progress-bar)
|
||||
- [Radio](#version-8x-radio)
|
||||
- [Range](#version-8x-range)
|
||||
- [Searchbar](#version-8x-searchbar)
|
||||
- [Select](#version-8x-select)
|
||||
- [Textarea](#version-8x-textarea)
|
||||
- [Toggle](#version-8x-toggle)
|
||||
@@ -264,6 +265,10 @@ For more information on styling toast buttons, refer to the [Toast Theming docum
|
||||
|
||||
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-range` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy range syntax, refer to the [Range documentation](https://ionicframework.com/docs/api/range#migrating-from-legacy-range-syntax).
|
||||
|
||||
<h4 id="version-8x-searchbar">Searchbar</h4>
|
||||
|
||||
- The `autocapitalize` property now defaults to `'off'`.
|
||||
|
||||
<h4 id="version-8x-select">Select</h4>
|
||||
|
||||
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-select` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy select syntax, refer to the [Select documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax).
|
||||
|
||||
17
core/api.txt
@@ -265,7 +265,6 @@ ion-button,css-prop,--padding-start
|
||||
ion-button,css-prop,--padding-top
|
||||
ion-button,css-prop,--ripple-color
|
||||
ion-button,css-prop,--transition
|
||||
ion-button,part,focus-ring
|
||||
ion-button,part,native
|
||||
|
||||
ion-buttons,scoped
|
||||
@@ -322,6 +321,9 @@ ion-checkbox,prop,justify,"end" | "space-between" | "start",'space-between',fals
|
||||
ion-checkbox,prop,labelPlacement,"end" | "fixed" | "stacked" | "start",'start',false,false
|
||||
ion-checkbox,prop,mode,"ios" | "md",undefined,false,false
|
||||
ion-checkbox,prop,name,string,this.inputId,false,false
|
||||
ion-checkbox,prop,required,boolean,false,false,false
|
||||
ion-checkbox,prop,shape,"rectangular" | "soft" | undefined,'soft',false,true
|
||||
ion-checkbox,prop,size,"default" | "small" | undefined,'default',false,true
|
||||
ion-checkbox,prop,theme,"ios" | "md" | "ionic",undefined,false,false
|
||||
ion-checkbox,prop,value,any,'on',false,false
|
||||
ion-checkbox,event,ionBlur,void,true
|
||||
@@ -339,6 +341,7 @@ ion-checkbox,css-prop,--checkmark-width
|
||||
ion-checkbox,css-prop,--size
|
||||
ion-checkbox,css-prop,--transition
|
||||
ion-checkbox,part,container
|
||||
ion-checkbox,part,focus-ring
|
||||
ion-checkbox,part,label
|
||||
ion-checkbox,part,mark
|
||||
|
||||
@@ -604,7 +607,7 @@ ion-input,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secon
|
||||
ion-input,prop,counter,boolean,false,false,false
|
||||
ion-input,prop,counterFormatter,((inputLength: number, maxLength: number) => string) | undefined,undefined,false,false
|
||||
ion-input,prop,debounce,number | undefined,undefined,false,false
|
||||
ion-input,prop,disabled,boolean,false,false,false
|
||||
ion-input,prop,disabled,boolean,false,false,true
|
||||
ion-input,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false
|
||||
ion-input,prop,errorText,string | undefined,undefined,false,false
|
||||
ion-input,prop,fill,"outline" | "solid" | undefined,undefined,false,false
|
||||
@@ -621,7 +624,7 @@ ion-input,prop,multiple,boolean | undefined,undefined,false,false
|
||||
ion-input,prop,name,string,this.inputId,false,false
|
||||
ion-input,prop,pattern,string | undefined,undefined,false,false
|
||||
ion-input,prop,placeholder,string | undefined,undefined,false,false
|
||||
ion-input,prop,readonly,boolean,false,false,false
|
||||
ion-input,prop,readonly,boolean,false,false,true
|
||||
ion-input,prop,required,boolean,false,false,false
|
||||
ion-input,prop,shape,"round" | undefined,undefined,false,false
|
||||
ion-input,prop,spellcheck,boolean,false,false,false
|
||||
@@ -654,6 +657,12 @@ ion-input,css-prop,--placeholder-font-style
|
||||
ion-input,css-prop,--placeholder-font-weight
|
||||
ion-input,css-prop,--placeholder-opacity
|
||||
|
||||
ion-input-password-toggle,shadow
|
||||
ion-input-password-toggle,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined,undefined,false,true
|
||||
ion-input-password-toggle,prop,hideIcon,string | undefined,undefined,false,false
|
||||
ion-input-password-toggle,prop,mode,"ios" | "md",undefined,false,false
|
||||
ion-input-password-toggle,prop,showIcon,string | undefined,undefined,false,false
|
||||
|
||||
ion-item,shadow
|
||||
ion-item,prop,button,boolean,false,false,false
|
||||
ion-item,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined,undefined,false,true
|
||||
@@ -1266,7 +1275,7 @@ ion-row,prop,theme,"ios" | "md" | "ionic",undefined,false,false
|
||||
|
||||
ion-searchbar,scoped
|
||||
ion-searchbar,prop,animated,boolean,false,false,false
|
||||
ion-searchbar,prop,autocapitalize,string,undefined,true,false
|
||||
ion-searchbar,prop,autocapitalize,string,'off',false,false
|
||||
ion-searchbar,prop,autocomplete,"name" | "email" | "tel" | "url" | "on" | "off" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo",'off',false,false
|
||||
ion-searchbar,prop,autocorrect,"off" | "on",'off',false,false
|
||||
ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', arrowBackSharp) as string,false,false
|
||||
|
||||
51
core/package-lock.json
generated
@@ -43,7 +43,7 @@
|
||||
"jest-cli": "^29.7.0",
|
||||
"prettier": "^2.6.1",
|
||||
"rollup": "^2.26.4",
|
||||
"sass": "^1.72.0",
|
||||
"sass": "^1.33.0",
|
||||
"serve": "^14.0.1",
|
||||
"stylelint": "^13.13.1",
|
||||
"stylelint-order": "^4.1.0"
|
||||
@@ -5149,12 +5149,6 @@
|
||||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/immutable": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz",
|
||||
"integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
|
||||
@@ -8610,20 +8604,18 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.72.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.72.0.tgz",
|
||||
"integrity": "sha512-Gpczt3WA56Ly0Mn8Sl21Vj94s1axi9hDIzDFn9Ph9x3C3p4nNyvsqJoQyVXKou6cBlfFWEgRW4rT8Tb4i3XnVA==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.33.0.tgz",
|
||||
"integrity": "sha512-9v0MUXnSi62FtfjqcwZ+b8B9FIxdwFEb3FPUkjEPXWd0b5KcnPGSp2XF9WrzcH1ZxedfgJVTdA3A1j4eEj53xg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
"immutable": "^4.0.0",
|
||||
"source-map-js": ">=0.6.2 <2.0.0"
|
||||
"chokidar": ">=3.0.0 <4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"sass": "sass.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/semver": {
|
||||
@@ -8796,15 +8788,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
|
||||
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.13",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz",
|
||||
@@ -13716,12 +13699,6 @@
|
||||
"integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"immutable": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz",
|
||||
"integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==",
|
||||
"dev": true
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
|
||||
@@ -16209,14 +16186,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.72.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.72.0.tgz",
|
||||
"integrity": "sha512-Gpczt3WA56Ly0Mn8Sl21Vj94s1axi9hDIzDFn9Ph9x3C3p4nNyvsqJoQyVXKou6cBlfFWEgRW4rT8Tb4i3XnVA==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.33.0.tgz",
|
||||
"integrity": "sha512-9v0MUXnSi62FtfjqcwZ+b8B9FIxdwFEb3FPUkjEPXWd0b5KcnPGSp2XF9WrzcH1ZxedfgJVTdA3A1j4eEj53xg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
"immutable": "^4.0.0",
|
||||
"source-map-js": ">=0.6.2 <2.0.0"
|
||||
"chokidar": ">=3.0.0 <4.0.0"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
@@ -16353,12 +16328,6 @@
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map-js": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
|
||||
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.13",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz",
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
"jest-cli": "^29.7.0",
|
||||
"prettier": "^2.6.1",
|
||||
"rollup": "^2.26.4",
|
||||
"sass": "^1.72.0",
|
||||
"sass": "^1.33.0",
|
||||
"serve": "^14.0.1",
|
||||
"stylelint": "^13.13.1",
|
||||
"stylelint-order": "^4.1.0"
|
||||
|
||||
73
core/src/components.d.ts
vendored
@@ -724,6 +724,18 @@ export namespace Components {
|
||||
* The name of the control, which is submitted with the form data.
|
||||
*/
|
||||
"name": string;
|
||||
/**
|
||||
* If `true`, the checkbox will be presented with an error style when it is unchecked.
|
||||
*/
|
||||
"required": boolean;
|
||||
/**
|
||||
* Set to `"soft"` for a checkbox with more rounded corners.
|
||||
*/
|
||||
"shape"?: 'soft' | 'rectangular';
|
||||
/**
|
||||
* Set to `"small"` for a checkbox with less height and padding or to `"default"` for a checkbox with the default height and padding.
|
||||
*/
|
||||
"size"?: 'small' | 'default';
|
||||
/**
|
||||
* The theme determines the visual appearance of the component.
|
||||
*/
|
||||
@@ -1471,6 +1483,25 @@ export namespace Components {
|
||||
*/
|
||||
"value"?: string | number | null;
|
||||
}
|
||||
interface IonInputPasswordToggle {
|
||||
/**
|
||||
* The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics).
|
||||
*/
|
||||
"color"?: Color;
|
||||
/**
|
||||
* The icon that can be used to represent hiding a password. If not set, the "eyeOff" Ionicon will be used.
|
||||
*/
|
||||
"hideIcon"?: string;
|
||||
/**
|
||||
* The mode determines which platform styles to use.
|
||||
*/
|
||||
"mode"?: "ios" | "md";
|
||||
/**
|
||||
* The icon that can be used to represent showing a password. If not set, the "eye" Ionicon will be used.
|
||||
*/
|
||||
"showIcon"?: string;
|
||||
"type": TextFieldTypes;
|
||||
}
|
||||
interface IonItem {
|
||||
/**
|
||||
* If `true`, a button tag will be rendered and the item will be tappable.
|
||||
@@ -4323,6 +4354,12 @@ declare global {
|
||||
prototype: HTMLIonInputElement;
|
||||
new (): HTMLIonInputElement;
|
||||
};
|
||||
interface HTMLIonInputPasswordToggleElement extends Components.IonInputPasswordToggle, HTMLStencilElement {
|
||||
}
|
||||
var HTMLIonInputPasswordToggleElement: {
|
||||
prototype: HTMLIonInputPasswordToggleElement;
|
||||
new (): HTMLIonInputPasswordToggleElement;
|
||||
};
|
||||
interface HTMLIonItemElement extends Components.IonItem, HTMLStencilElement {
|
||||
}
|
||||
var HTMLIonItemElement: {
|
||||
@@ -5147,6 +5184,7 @@ declare global {
|
||||
"ion-infinite-scroll": HTMLIonInfiniteScrollElement;
|
||||
"ion-infinite-scroll-content": HTMLIonInfiniteScrollContentElement;
|
||||
"ion-input": HTMLIonInputElement;
|
||||
"ion-input-password-toggle": HTMLIonInputPasswordToggleElement;
|
||||
"ion-item": HTMLIonItemElement;
|
||||
"ion-item-divider": HTMLIonItemDividerElement;
|
||||
"ion-item-group": HTMLIonItemGroupElement;
|
||||
@@ -5926,6 +5964,18 @@ declare namespace LocalJSX {
|
||||
* Emitted when the checkbox has focus.
|
||||
*/
|
||||
"onIonFocus"?: (event: IonCheckboxCustomEvent<void>) => void;
|
||||
/**
|
||||
* If `true`, the checkbox will be presented with an error style when it is unchecked.
|
||||
*/
|
||||
"required"?: boolean;
|
||||
/**
|
||||
* Set to `"soft"` for a checkbox with more rounded corners.
|
||||
*/
|
||||
"shape"?: 'soft' | 'rectangular';
|
||||
/**
|
||||
* Set to `"small"` for a checkbox with less height and padding or to `"default"` for a checkbox with the default height and padding.
|
||||
*/
|
||||
"size"?: 'small' | 'default';
|
||||
/**
|
||||
* The theme determines the visual appearance of the component.
|
||||
*/
|
||||
@@ -6689,6 +6739,25 @@ declare namespace LocalJSX {
|
||||
*/
|
||||
"value"?: string | number | null;
|
||||
}
|
||||
interface IonInputPasswordToggle {
|
||||
/**
|
||||
* The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics).
|
||||
*/
|
||||
"color"?: Color;
|
||||
/**
|
||||
* The icon that can be used to represent hiding a password. If not set, the "eyeOff" Ionicon will be used.
|
||||
*/
|
||||
"hideIcon"?: string;
|
||||
/**
|
||||
* The mode determines which platform styles to use.
|
||||
*/
|
||||
"mode"?: "ios" | "md";
|
||||
/**
|
||||
* The icon that can be used to represent showing a password. If not set, the "eye" Ionicon will be used.
|
||||
*/
|
||||
"showIcon"?: string;
|
||||
"type"?: TextFieldTypes;
|
||||
}
|
||||
interface IonItem {
|
||||
/**
|
||||
* If `true`, a button tag will be rendered and the item will be tappable.
|
||||
@@ -8121,7 +8190,7 @@ declare namespace LocalJSX {
|
||||
/**
|
||||
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
|
||||
*/
|
||||
"autocapitalize": string;
|
||||
"autocapitalize"?: string;
|
||||
/**
|
||||
* Set the input's autocomplete property.
|
||||
*/
|
||||
@@ -9064,6 +9133,7 @@ declare namespace LocalJSX {
|
||||
"ion-infinite-scroll": IonInfiniteScroll;
|
||||
"ion-infinite-scroll-content": IonInfiniteScrollContent;
|
||||
"ion-input": IonInput;
|
||||
"ion-input-password-toggle": IonInputPasswordToggle;
|
||||
"ion-item": IonItem;
|
||||
"ion-item-divider": IonItemDivider;
|
||||
"ion-item-group": IonItemGroup;
|
||||
@@ -9162,6 +9232,7 @@ declare module "@stencil/core" {
|
||||
"ion-infinite-scroll": LocalJSX.IonInfiniteScroll & JSXBase.HTMLAttributes<HTMLIonInfiniteScrollElement>;
|
||||
"ion-infinite-scroll-content": LocalJSX.IonInfiniteScrollContent & JSXBase.HTMLAttributes<HTMLIonInfiniteScrollContentElement>;
|
||||
"ion-input": LocalJSX.IonInput & JSXBase.HTMLAttributes<HTMLIonInputElement>;
|
||||
"ion-input-password-toggle": LocalJSX.IonInputPasswordToggle & JSXBase.HTMLAttributes<HTMLIonInputPasswordToggleElement>;
|
||||
"ion-item": LocalJSX.IonItem & JSXBase.HTMLAttributes<HTMLIonItemElement>;
|
||||
"ion-item-divider": LocalJSX.IonItemDivider & JSXBase.HTMLAttributes<HTMLIonItemDividerElement>;
|
||||
"ion-item-group": LocalJSX.IonItemGroup & JSXBase.HTMLAttributes<HTMLIonItemGroupElement>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "../accordion/accordion.vars";
|
||||
|
||||
// Accordion Group
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Accordion
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Accordion
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Action Sheet
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Action Sheet
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Action Sheet
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@use "sass:math";
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
@import "../item/item.ios.vars";
|
||||
|
||||
// iOS Alert
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "../item/item.md.vars";
|
||||
|
||||
// Material Design Alert
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Alert
|
||||
// --------------------------------------------------
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
|
||||
// iOS Avatar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
|
||||
// Material Design Avatar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
|
||||
// Avatar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Back Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Back Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Back Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Badge
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Badge
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Badge
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Breadcrumb
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Breadcrumb
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Breadcrumb
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Breadcrumbs
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -156,26 +156,9 @@
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
// Only show the focus ring when the button is focused
|
||||
:host(.ion-focused) {
|
||||
--overflow: visible;
|
||||
|
||||
.button-native::after {
|
||||
@include border-radius(inherit);
|
||||
}
|
||||
}
|
||||
|
||||
.button-focus-ring {
|
||||
@include position(-4px, -4px, -4px, -4px);
|
||||
@include border-radius(inherit);
|
||||
|
||||
position: absolute;
|
||||
|
||||
transition: border-color 0.3s;
|
||||
|
||||
border: var(--focus-ring-width) solid var(--focus-ring-color);
|
||||
|
||||
content: "";
|
||||
box-sizing: border-box;
|
||||
:host(.ion-focused) .button-native {
|
||||
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
// Fill Solid Button
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// Ionic Button
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -20,7 +20,6 @@ import type { RouterDirection } from '../router/utils/interface';
|
||||
* @slot end - Content is placed to the right of the button text in LTR, and to the left in RTL.
|
||||
*
|
||||
* @part native - The native HTML button or anchor element that wraps all child elements.
|
||||
* @part focus-ring - The visual indicator that appears as an outline around the button when focused. Only available for the Ionic theme.
|
||||
*/
|
||||
@Component({
|
||||
tag: 'ion-button',
|
||||
@@ -418,7 +417,6 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
|
||||
<slot name="end"></slot>
|
||||
</span>
|
||||
{theme === 'md' && <ion-ripple-effect type={this.rippleType}></ion-ripple-effect>}
|
||||
{theme === 'ionic' && <div part="focus-ring" class="button-focus-ring"></div>}
|
||||
</TagType>
|
||||
</Host>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Button
|
||||
// --------------------------------------------------
|
||||
|
||||
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
@import "../toolbar/toolbar.ios.vars";
|
||||
|
||||
// iOS Buttons
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "../toolbar/toolbar.md.vars";
|
||||
|
||||
// Material Design Buttons
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
:host {
|
||||
display: flex;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Card Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Card Content
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Card Content
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Card Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Card Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Card Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Card Subtitle
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Card Subtitle
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Card Subtitle
|
||||
// --------------------------------------------------
|
||||
@@ -16,4 +16,4 @@
|
||||
|
||||
:host(.ion-color) {
|
||||
color: current-color(base);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Card Title
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Card Title
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
|
||||
// Card Title
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Card
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Card
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Card
|
||||
// --------------------------------------------------
|
||||
|
||||
165
core/src/components/checkbox/checkbox.ionic.scss
Normal file
@@ -0,0 +1,165 @@
|
||||
@import "./checkbox";
|
||||
@import "./checkbox.ionic.vars";
|
||||
|
||||
// ionic Checkbox
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
// Border
|
||||
--border-radius: calc(var(--size) * .125);
|
||||
--border-width: #{$checkbox-ionic-icon-border-width};
|
||||
--border-style: #{$checkbox-ionic-icon-border-style};
|
||||
--border-color: #{$checkbox-ionic-icon-border-color-off};
|
||||
--checkmark-width: 3;
|
||||
--padding-top: #{$checkbox-ionic-padding-top};
|
||||
--padding-bottom: #{$checkbox-ionic-padding-bottom};
|
||||
|
||||
// Background
|
||||
--checkbox-background: #{$checkbox-ionic-icon-background-color-off};
|
||||
|
||||
// Transition
|
||||
--transition: #{background $checkbox-ionic-transition-duration $checkbox-ionic-transition-easing};
|
||||
|
||||
// Size
|
||||
--size: #{$checkbox-ionic-icon-size};
|
||||
// add to existing selector
|
||||
|
||||
// margin is required to make room for outline on focus, otherwise the outline may get cut off
|
||||
@include margin($checkbox-ionic-outline-width);
|
||||
@include padding(--padding-top, null, --padding-bottom, null);
|
||||
|
||||
// Target area
|
||||
&::after {
|
||||
@include position(50%, 0, null, 0);
|
||||
|
||||
position: absolute;
|
||||
|
||||
height: 100%;
|
||||
min-height: 48px;
|
||||
|
||||
transform: translateY(-50%);
|
||||
|
||||
content: "";
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.native-wrapper{
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Sizes
|
||||
// --------------------------------------------------
|
||||
:host(.checkbox-small) {
|
||||
--padding-top: #{$checkbox-ionic-small-padding-top};
|
||||
--padding-bottom: #{$checkbox-ionic-small-padding-bottom};
|
||||
|
||||
// Size
|
||||
--size: #{$checkbox-ionic-small-icon-size};
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Shapes
|
||||
// --------------------------------------------------
|
||||
:host(.checkbox-rectangular) {
|
||||
--border-radius: #{$checkbox-ionic-rectangular-border};
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Disabled
|
||||
// --------------------------------------------------
|
||||
// disabled, indeterminate checkbox
|
||||
:host(.checkbox-disabled.checkbox-indeterminate) .checkbox-icon {
|
||||
border-width: 0;
|
||||
|
||||
background-color: #74aafc;
|
||||
}
|
||||
|
||||
// disabled, unchecked checkbox
|
||||
:host(.checkbox-disabled) .checkbox-icon {
|
||||
border-color: #c9c9c9;
|
||||
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
// disabled, checked checkbox
|
||||
:host(.checkbox-disabled.checkbox-checked) .checkbox-icon {
|
||||
border-width: 0;
|
||||
|
||||
background-color: #A8C8F8;
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Required State
|
||||
// --------------------------------------------------
|
||||
// Unhecked checkbox with `required` property set to true
|
||||
:host(.checkbox-required:not(.checkbox-checked):not(.checkbox-indeterminate)) {
|
||||
.checkbox-icon {
|
||||
border-color: #f72c2c;
|
||||
}
|
||||
}
|
||||
|
||||
// Focused: Unchecked checkbox with `required` property set to true
|
||||
:host(.ion-focusable.checkbox-required:not(.checkbox-checked):not(.checkbox-indeterminate)) .checkbox-icon {
|
||||
outline-color: #ffafaf;
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Focus Ring
|
||||
// --------------------------------------------------
|
||||
:host(.ion-focused:not(.checkbox-disabled)) .focus-ring {
|
||||
@include position(-4px, -4px, -4px, -4px);
|
||||
position: absolute;
|
||||
|
||||
width: calc(100% + 8px);
|
||||
height: calc(100% + 8px);
|
||||
|
||||
transition: border-color 0.3s;
|
||||
|
||||
border: 2px solid $checkbox-ionic-focus-ring-color;
|
||||
|
||||
@include border-radius(var(--border-radius));
|
||||
|
||||
content: "";
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
// Required state
|
||||
:host(.ion-focused.checkbox-required) .focus-ring {
|
||||
border-color:$checkbox-ionic-focus-required-ring-color;
|
||||
}
|
||||
|
||||
// Checkbox: Hover
|
||||
// --------------------------------------------------------
|
||||
@media (any-hover: hover) {
|
||||
:host(:hover) .checkbox-icon {
|
||||
background-color: #ececec; // mix of 'white', '#121212', 0.08, 'rgb'
|
||||
}
|
||||
|
||||
:host(:hover.checkbox-checked) .checkbox-icon,
|
||||
:host(:hover.checkbox-indeterminate) .checkbox-icon {
|
||||
background-color: #1061da; // mix of '#1068eb', '#121212', 0.08, 'rgb'
|
||||
}
|
||||
|
||||
// unchecked checkbox with `required` property set to true
|
||||
:host(:hover.checkbox-required:not(.checkbox-checked):not(.checkbox-indeterminate)) {
|
||||
.checkbox-icon {
|
||||
border-color: #ee2b2b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checkbox: Active
|
||||
// --------------------------------------------------------
|
||||
:host(.ion-activated) .checkbox-icon {
|
||||
background-color: #e3e3e3; // mix of 'white', '#121212', 0.12, 'rgb'
|
||||
}
|
||||
|
||||
:host(.ion-activated.checkbox-checked) .checkbox-icon,
|
||||
:host(.ion-activated.checkbox-indeterminate) .checkbox-icon {
|
||||
background-color: #105ed1; // mix of '#1068eb', '#121212', 0.12, 'rgb'
|
||||
}
|
||||
|
||||
:host(.checkbox-label-placement-start) {
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
}
|
||||
63
core/src/components/checkbox/checkbox.ionic.vars.scss
Normal file
@@ -0,0 +1,63 @@
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "../item/item.md.vars";
|
||||
|
||||
// ionic Checkbox
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Background color of the checkbox icon when off
|
||||
$checkbox-ionic-icon-background-color-off: $item-md-background !default;
|
||||
|
||||
/// @prop - Size of the checkbox icon
|
||||
/// The icon size does not use dynamic font
|
||||
/// because it does not scale in native.
|
||||
$checkbox-ionic-icon-size: 24px !default;
|
||||
|
||||
/// @prop - Icon size of the checkbox for the small size
|
||||
$checkbox-ionic-small-icon-size: 16px !default;
|
||||
|
||||
/// @prop - Border width of the checkbox icon
|
||||
$checkbox-ionic-icon-border-width: 1px !default;
|
||||
|
||||
/// @prop - Border style of the checkbox icon
|
||||
$checkbox-ionic-icon-border-style: solid !default;
|
||||
|
||||
/// @prop - Border color of the checkbox icon when off
|
||||
$checkbox-ionic-icon-border-color-off: #9a9a9a !default;
|
||||
|
||||
/// @prop - Outline width of the checkbox
|
||||
$checkbox-ionic-outline-width: 2px !default;
|
||||
|
||||
/// @prop - Padding top of the checkbox for the default size
|
||||
$checkbox-ionic-padding-top: 12px !default;
|
||||
|
||||
/// @prop - Padding bottom of the button for the default size
|
||||
$checkbox-ionic-padding-bottom: 12px !default;
|
||||
|
||||
/// @prop - Padding top of the checkbox for the small size
|
||||
$checkbox-ionic-small-padding-top: 16px !default;
|
||||
|
||||
/// @prop - Padding bottom of the button for the small size
|
||||
$checkbox-ionic-small-padding-bottom: 16px !default;
|
||||
|
||||
/// @prop - Focus color of the checkbox
|
||||
$checkbox-ionic-focus-ring-color: #9ec4fd !default;
|
||||
|
||||
/// @prop - Focus color of the required checkbox
|
||||
$checkbox-ionic-focus-required-ring-color: #FFAFAF !default;
|
||||
|
||||
/// @prop - Transition duration of the checkbox
|
||||
$checkbox-ionic-transition-duration: 180ms !default;
|
||||
|
||||
/// @prop - Transition easing of the checkbox
|
||||
$checkbox-ionic-transition-easing: cubic-bezier(.4, 0, .2, 1) !default;
|
||||
|
||||
|
||||
// Checkbox Shapes
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
/* Rectangular */
|
||||
/// @prop - Rectangular border radius of the checkbox
|
||||
$checkbox-ionic-rectangular-border: 0 !default;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@use "sass:math";
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
@import "../item/item.ios.vars";
|
||||
|
||||
// iOS Checkbox
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "../item/item.md.vars";
|
||||
|
||||
// Material Design Checkbox
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "./checkbox.vars.scss";
|
||||
|
||||
// Checkbox
|
||||
|
||||
@@ -18,13 +18,14 @@ import type { CheckboxChangeEventDetail } from './checkbox-interface';
|
||||
* @part container - The container for the checkbox mark.
|
||||
* @part label - The label text describing the checkbox.
|
||||
* @part mark - The checkmark used to indicate the checked state.
|
||||
* @part focus-ring - The visual indicator that appears as an outline around the checkbox when focused. Only available for the Ionic theme.
|
||||
*/
|
||||
@Component({
|
||||
tag: 'ion-checkbox',
|
||||
styleUrls: {
|
||||
ios: 'checkbox.ios.scss',
|
||||
md: 'checkbox.md.scss',
|
||||
ionic: 'checkbox.md.scss',
|
||||
ionic: 'checkbox.ionic.scss',
|
||||
},
|
||||
shadow: true,
|
||||
})
|
||||
@@ -98,6 +99,22 @@ export class Checkbox implements ComponentInterface {
|
||||
*/
|
||||
@Prop() alignment: 'start' | 'center' = 'center';
|
||||
|
||||
/**
|
||||
* If `true`, the checkbox will be presented with an error style when it is unchecked.
|
||||
*/
|
||||
@Prop() required = false;
|
||||
|
||||
/**
|
||||
* Set to `"soft"` for a checkbox with more rounded corners.
|
||||
*/
|
||||
@Prop() shape?: 'soft' | 'rectangular' = 'soft';
|
||||
|
||||
/**
|
||||
* Set to `"small"` for a checkbox with less height and padding or to `"default"`
|
||||
* for a checkbox with the default height and padding.
|
||||
*/
|
||||
@Prop() size?: 'small' | 'default' = 'default';
|
||||
|
||||
/**
|
||||
* Emitted when the checked property has changed
|
||||
* as a result of a user action such as a click.
|
||||
@@ -181,6 +198,9 @@ export class Checkbox implements ComponentInterface {
|
||||
name,
|
||||
value,
|
||||
alignment,
|
||||
required,
|
||||
size,
|
||||
shape,
|
||||
} = this;
|
||||
const theme = getIonTheme(this);
|
||||
|
||||
@@ -201,6 +221,9 @@ export class Checkbox implements ComponentInterface {
|
||||
[`checkbox-justify-${justify}`]: true,
|
||||
[`checkbox-alignment-${alignment}`]: true,
|
||||
[`checkbox-label-placement-${labelPlacement}`]: true,
|
||||
'checkbox-required': required,
|
||||
[`checkbox-${size}`]: true,
|
||||
[`checkbox-${shape}`]: true,
|
||||
})}
|
||||
onClick={this.onClick}
|
||||
>
|
||||
@@ -233,6 +256,7 @@ export class Checkbox implements ComponentInterface {
|
||||
<svg class="checkbox-icon" viewBox="0 0 24 24" part="container">
|
||||
{path}
|
||||
</svg>
|
||||
{theme === 'ionic' && <div part="focus-ring" class="focus-ring"></div>}
|
||||
</div>
|
||||
</label>
|
||||
</Host>
|
||||
@@ -252,6 +276,12 @@ export class Checkbox implements ComponentInterface {
|
||||
) : (
|
||||
<path d="M1.73,12.91 8.1,19.28 22.79,4.59" part="mark" />
|
||||
);
|
||||
} else if (theme === 'ionic') {
|
||||
path = indeterminate ? (
|
||||
<path d="M6.5 12H17.5" stroke-linecap="round" part="mark" />
|
||||
) : (
|
||||
<path d="M6 12.5L10 16.5L18.5 8" stroke-linecap="round" stroke-linejoin="round" part="mark" />
|
||||
);
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import type { E2EPage } from '@utils/test/playwright';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
class CheckboxFixture {
|
||||
readonly page: E2EPage;
|
||||
readonly screenshotFn?: (file: string) => string;
|
||||
|
||||
constructor(page: E2EPage, screenshot?: (file: string) => string) {
|
||||
this.page = page;
|
||||
this.screenshotFn = screenshot;
|
||||
}
|
||||
|
||||
async checkScreenshot(modifier: string) {
|
||||
const { screenshotFn } = this;
|
||||
|
||||
if (!screenshotFn) {
|
||||
throw new Error(
|
||||
'A screenshot function is required to take a screenshot. Pass one in when creating CheckboxFixture.'
|
||||
);
|
||||
}
|
||||
|
||||
const wrapper = this.page.locator('#screenshot-wrapper');
|
||||
|
||||
await expect(wrapper).toHaveScreenshot(screenshotFn(`${modifier}-checkbox`));
|
||||
}
|
||||
}
|
||||
|
||||
configs({ themes: ['ionic'], modes: ['md'] }).forEach(({ config, screenshot, title }) => {
|
||||
test.describe(title('checkbox: theme ionic'), () => {
|
||||
let checkboxFixture!: CheckboxFixture;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(`/src/components/checkbox/test/theme-ionic`, config);
|
||||
await page.setIonViewport();
|
||||
checkboxFixture = new CheckboxFixture(page, screenshot);
|
||||
});
|
||||
|
||||
test('default', async () => {
|
||||
await checkboxFixture.checkScreenshot(`default`);
|
||||
});
|
||||
});
|
||||
});
|
||||
419
core/src/components/checkbox/test/theme-ionic/index.html
Normal file
@@ -0,0 +1,419 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr" theme="ionic">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Checkbox - 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>
|
||||
<style>
|
||||
ion-checkbox.checkbox-part::part(mark) {
|
||||
transform: scale(0.5);
|
||||
transform-origin: center;
|
||||
}
|
||||
ion-col {
|
||||
border: 1px solid cadetblue;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<ion-app>
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>Checkbox - Basic</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content class="ion-padding">
|
||||
<div id="checkboxes">
|
||||
<ion-title>Label Placement Default</ion-title>
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Unchecked</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" class="ion-margin-start">Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox shape="rectangular" class="ion-margin-start">Rectangular</ion-checkbox></ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox size="small" shape="rectangular" class="ion-margin-start"> Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox class="ion-focused ion-margin-start">Focused</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" class="ion-focused ion-margin-start">Focused</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox shape="rectangular" class="ion-focused ion-margin-start">Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox size="small" shape="rectangular" class="ion-focused ion-margin-start">
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Checked</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox checked>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" checked>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox shape="rectangular" checked>Rectangular</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" shape="rectangular" checked>Rectangular</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox class="ion-focused" checked>Focused</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" class="ion-focused" checked>Focused</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox shape="rectangular" class="ion-focused" checked>Rect Focus</ion-checkbox></ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox size="small" shape="rectangular" class="ion-focused" checked>Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Disabled</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox disabled>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" disabled>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox shape="rectangular" disabled>Rectangular</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" shape="rectangular" disabled>Rectangular</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox class="ion-focused" disabled>Focused</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" class="ion-focused" disabled>Focused</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox shape="rectangular" class="ion-focused" disabled>Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox size="small" shape="rectangular" class="ion-focused" disabled>Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Required</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox required>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" required>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox shape="rectangular" required>Rectangular</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" shape="rectangular" required>Rectangular</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox class="ion-focused" required>Focused</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" class="ion-focused" required>Small Focused</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox shape="rectangular" class="ion-focused" required>Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox size="small" shape="rectangular" class="ion-focused" required>Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Indeterminate</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox indeterminate>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" indeterminate>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox shape="rectangular" indeterminate>Rectangular</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" shape="rectangular" indeterminate>Rectangular</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox class="ion-focused" indeterminate>Focused</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox size="small" class="ion-focused" indeterminate>Focused</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox shape="rectangular" class="ion-focused" indeterminate>Rect Focus</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox size="small" shape="rectangular" class="ion-focused" indeterminate>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</div>
|
||||
|
||||
<div id="checkboxes2">
|
||||
<ion-title>Label Placement End</ion-title>
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Unchecked</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end">Default</ion-checkbox></ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" class="ion-margin-start">Default</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" class="ion-margin-start">
|
||||
Rectangular
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" class="ion-margin-start">
|
||||
Rectangular
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" class="ion-focused ion-margin-start">Focused</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" class="ion-focused ion-margin-start">
|
||||
Focused
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" class="ion-focused ion-margin-start">
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox
|
||||
label-placement="end"
|
||||
size="small"
|
||||
shape="rectangular"
|
||||
class="ion-focused ion-margin-start"
|
||||
>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Checked</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" checked>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox label-placement="end" size="small" checked>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" checked>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" checked>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" class="ion-focused" checked>Focused</ion-checkbox></ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" class="ion-focused" checked>Focused</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" class="ion-focused" checked>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" class="ion-focused" checked>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Disabled</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" disabled>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox label-placement="end" size="small" disabled>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" disabled>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" disabled>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" class="ion-focused" disabled>Focused</ion-checkbox></ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" class="ion-focused" disabled>Focused</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" class="ion-focused" disabled>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" class="ion-focused" disabled>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Required</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" required>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox label-placement="end" size="small" required>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" required>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" required>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" class="ion-focused" required>Focused</ion-checkbox></ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" class="ion-focused" required>
|
||||
Small Focused
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" class="ion-focused" required>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" class="ion-focused" required>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center"><ion-title>Indeterminate</ion-title></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="ion-text-center">Default</ion-col>
|
||||
<ion-col class="ion-text-center">Small</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col><ion-checkbox label-placement="end" indeterminate>Default</ion-checkbox></ion-col>
|
||||
<ion-col><ion-checkbox label-placement="end" size="small" indeterminate>Default</ion-checkbox></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" indeterminate>Rectangular</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" indeterminate>
|
||||
Rectangular
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" class="ion-focused" indeterminate>Focused</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" class="ion-focused" indeterminate>
|
||||
Focused
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" shape="rectangular" class="ion-focused" indeterminate>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-checkbox label-placement="end" size="small" shape="rectangular" class="ion-focused" indeterminate>
|
||||
Rect Focus
|
||||
</ion-checkbox>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "./chip.vars";
|
||||
|
||||
:host {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "../grid/grid.mixins";
|
||||
|
||||
// Grid Column
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Content
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Datetime Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import "./datetime.scss";
|
||||
@import "./datetime.ios.vars.scss";
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
:host {
|
||||
--background: #{ion-color(light, base)};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import "./datetime.scss";
|
||||
@import "./datetime.md.vars.scss";
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
:host {
|
||||
--background: var(--ion-color-step-100, var(--ion-background-color-step-100, #ffffff));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Datetime
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS FAB Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design FAB Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Floating Action Buttons
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "../fab-button/fab-button.vars";
|
||||
|
||||
// Floating Action Button List
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "../fab-button/fab-button.vars";
|
||||
|
||||
// Floating Action Button Container
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Footer
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Footer
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Footer
|
||||
// --------------------------------------------------
|
||||
@@ -16,4 +16,4 @@ ion-footer {
|
||||
|
||||
ion-footer.footer-toolbar-padding ion-toolbar:last-of-type {
|
||||
padding-bottom: var(--ion-safe-area-bottom, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/mixins";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "../../themes/ionic.mixins";
|
||||
|
||||
// Responsive Mixins
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "./grid.mixins";
|
||||
|
||||
// Grid
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Header
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.ios";
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// Material Design Infinite Scroll
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals.md";
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Infinite Scroll
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "../../themes/globals";
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Infinite Scroll
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
import type { ComponentInterface } from '@stencil/core';
|
||||
import { Component, Element, Host, Prop, h, Watch } from '@stencil/core';
|
||||
import { printIonWarning } from '@utils/logging';
|
||||
import { createColorClasses } from '@utils/theme';
|
||||
import { eyeOff, eye } from 'ionicons/icons';
|
||||
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import type { Color, TextFieldTypes } from '../../interface';
|
||||
|
||||
/**
|
||||
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
||||
*/
|
||||
@Component({
|
||||
tag: 'ion-input-password-toggle',
|
||||
/**
|
||||
* Empty CSS files are required in order for the mode to be inherited to the
|
||||
* inner ion-button. Otherwise, the setMode callback provided to Stencil will not get called
|
||||
* and we will default to MD mode.
|
||||
*/
|
||||
styleUrls: {
|
||||
ios: 'input-password-toggle.scss',
|
||||
md: 'input-password-toggle.scss',
|
||||
},
|
||||
shadow: true,
|
||||
})
|
||||
export class InputPasswordToggle implements ComponentInterface {
|
||||
private inputElRef!: HTMLIonInputElement | null;
|
||||
|
||||
@Element() el!: HTMLIonInputElement;
|
||||
|
||||
/**
|
||||
* The color to use from your application's color palette.
|
||||
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
||||
* For more information on colors, see [theming](/docs/theming/basics).
|
||||
*/
|
||||
@Prop({ reflect: true }) color?: Color;
|
||||
|
||||
/**
|
||||
* The icon that can be used to represent showing a password. If not set, the "eye" Ionicon will be used.
|
||||
*/
|
||||
@Prop() showIcon?: string;
|
||||
|
||||
/**
|
||||
* The icon that can be used to represent hiding a password. If not set, the "eyeOff" Ionicon will be used.
|
||||
*/
|
||||
@Prop() hideIcon?: string;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@Prop({ mutable: true }) type: TextFieldTypes = 'password';
|
||||
|
||||
/**
|
||||
* Whenever the input type changes we need to re-run validation to ensure the password
|
||||
* toggle is being used with the correct input type. If the application changes the type
|
||||
* outside of this component we also need to re-render so the correct icon is shown.
|
||||
*/
|
||||
@Watch('type')
|
||||
onTypeChange(newValue: TextFieldTypes) {
|
||||
if (newValue !== 'text' && newValue !== 'password') {
|
||||
printIonWarning(
|
||||
`ion-input-password-toggle only supports inputs of type "text" or "password". Input of type "${newValue}" is not compatible.`,
|
||||
this.el
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
const { el } = this;
|
||||
|
||||
const inputElRef = (this.inputElRef = el.closest('ion-input'));
|
||||
|
||||
if (!inputElRef) {
|
||||
printIonWarning(
|
||||
'No ancestor ion-input found for ion-input-password-toggle. This component must be slotted inside of an ion-input.',
|
||||
el
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Important: Set the type in connectedCallback because the default value
|
||||
* of this.type may not always be accurate. Usually inputs have the "password" type
|
||||
* but it is possible to have the input to initially have the "text" type. In that scenario
|
||||
* the wrong icon will show briefly before switching to the correct icon. Setting the
|
||||
* type here allows us to avoid that flicker.
|
||||
*/
|
||||
this.type = inputElRef.type;
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
this.inputElRef = null;
|
||||
}
|
||||
|
||||
private togglePasswordVisibility = () => {
|
||||
const { inputElRef } = this;
|
||||
|
||||
if (!inputElRef) {
|
||||
return;
|
||||
}
|
||||
|
||||
inputElRef.type = inputElRef.type === 'text' ? 'password' : 'text';
|
||||
};
|
||||
|
||||
render() {
|
||||
const { color, type } = this;
|
||||
|
||||
const mode = getIonMode(this);
|
||||
|
||||
const showPasswordIcon = this.showIcon ?? eye;
|
||||
const hidePasswordIcon = this.hideIcon ?? eyeOff;
|
||||
|
||||
const isPasswordVisible = type === 'text';
|
||||
|
||||
return (
|
||||
<Host
|
||||
class={createColorClasses(color, {
|
||||
[mode]: true,
|
||||
})}
|
||||
>
|
||||
<ion-button
|
||||
mode={mode}
|
||||
color={color}
|
||||
fill="clear"
|
||||
shape="round"
|
||||
aria-checked={isPasswordVisible ? 'true' : 'false'}
|
||||
aria-label="show password"
|
||||
role="switch"
|
||||
type="button"
|
||||
onPointerDown={(ev) => {
|
||||
/**
|
||||
* This prevents mobile browsers from
|
||||
* blurring the input when the password toggle
|
||||
* button is activated.
|
||||
*/
|
||||
ev.preventDefault();
|
||||
}}
|
||||
onClick={this.togglePasswordVisibility}
|
||||
>
|
||||
<ion-icon
|
||||
slot="icon-only"
|
||||
aria-hidden="true"
|
||||
icon={isPasswordVisible ? hidePasswordIcon : showPasswordIcon}
|
||||
></ion-icon>
|
||||
</ion-button>
|
||||
</Host>
|
||||
);
|
||||
}
|
||||
}
|
||||