mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
chore(packages): move the packages to root
This commit is contained in:
34
core/src/components/item-option/item-option.ios.scss
Normal file
34
core/src/components/item-option/item-option.ios.scss
Normal file
@ -0,0 +1,34 @@
|
||||
@import "./item-option";
|
||||
@import "./item-option.ios.vars";
|
||||
|
||||
// iOS Item Option
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-option-ios {
|
||||
font-size: $item-option-button-ios-font-size;
|
||||
color: $item-option-button-ios-text-color;
|
||||
background-color: $item-option-button-ios-background-color;
|
||||
}
|
||||
|
||||
.list-ios .item-options-right ion-item-option:last-child {
|
||||
@include safe-area-padding-horizontal(null, .7em);
|
||||
}
|
||||
|
||||
.list-ios .item-options-left ion-item-option:first-child {
|
||||
@include safe-area-padding-horizontal(.7em, null);
|
||||
}
|
||||
|
||||
|
||||
// Generate iOS Option Button Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-value in $colors-ios {
|
||||
$color-base: ion-color($colors-ios, $color-name, base, ios);
|
||||
$color-contrast: ion-color($colors-ios, $color-name, contrast, ios);
|
||||
$color-shade: ion-color($colors-ios, $color-name, tint, ios);
|
||||
|
||||
.item-option-ios-#{$color-name} {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
}
|
||||
}
|
||||
16
core/src/components/item-option/item-option.ios.vars.scss
Normal file
16
core/src/components/item-option/item-option.ios.vars.scss
Normal file
@ -0,0 +1,16 @@
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
|
||||
// iOS Item Option
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Font size of the item option button
|
||||
$item-option-button-ios-font-size: 16px !default;
|
||||
|
||||
/// @prop - Background color of the item option button
|
||||
$item-option-button-ios-background-color: ion-color($colors-ios, primary, base, ios) !default;
|
||||
|
||||
/// @prop - Text color of the item option button
|
||||
$item-option-button-ios-text-color: ion-color($colors-ios, $item-option-button-ios-background-color, contrast, ios) !default;
|
||||
|
||||
/// @prop - color of the item option button icon
|
||||
$item-option-button-ios-icon-color: ion-color($colors-ios, $item-option-button-ios-background-color, contrast, ios) !default;
|
||||
31
core/src/components/item-option/item-option.md.scss
Normal file
31
core/src/components/item-option/item-option.md.scss
Normal file
@ -0,0 +1,31 @@
|
||||
@import "./item-option";
|
||||
@import "./item-option.md.vars";
|
||||
|
||||
// Material Design Item Option
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-option-md {
|
||||
font-size: $item-option-button-md-font-size;
|
||||
color: $item-option-button-md-text-color;
|
||||
background-color: $item-option-button-md-background-color;
|
||||
}
|
||||
|
||||
.item-option-md .item-option-button {
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
|
||||
// Generate Material Design Option Button Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-value in $colors-md {
|
||||
$color-base: ion-color($colors-md, $color-name, base, md);
|
||||
$color-contrast: ion-color($colors-md, $color-name, contrast, md);
|
||||
$color-shade: ion-color($colors-md, $color-name, tint, md);
|
||||
|
||||
.item-option-md-#{$color-name} {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
}
|
||||
}
|
||||
16
core/src/components/item-option/item-option.md.vars.scss
Normal file
16
core/src/components/item-option/item-option.md.vars.scss
Normal file
@ -0,0 +1,16 @@
|
||||
@import "../../themes/ionic.globals.md";
|
||||
|
||||
// Material Design Item Option
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Font size of the sliding option button
|
||||
$item-option-button-md-font-size: 14px !default;
|
||||
|
||||
/// @prop - Background color of the sliding option button
|
||||
$item-option-button-md-background-color: ion-color($colors-md, primary, base, md) !default;
|
||||
|
||||
/// @prop - Text color of the sliding option button
|
||||
$item-option-button-md-text-color: ion-color($colors-md, $item-option-button-md-background-color, contrast, md) !default;
|
||||
|
||||
/// @prop - color of the sliding option button icon
|
||||
$item-option-button-md-icon-color: ion-color($colors-md, $item-option-button-md-background-color, contrast, md) !default;
|
||||
89
core/src/components/item-option/item-option.scss
Normal file
89
core/src/components/item-option/item-option.scss
Normal file
@ -0,0 +1,89 @@
|
||||
@import "./item-option.vars";
|
||||
|
||||
// Item Option
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-option-button {
|
||||
@include padding(0, .7em);
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
border: 0;
|
||||
font-size: 1em;
|
||||
|
||||
color: inherit;
|
||||
background: none;
|
||||
}
|
||||
|
||||
ion-item-options .item-option-button-inner {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.item-option-button-inner {
|
||||
display: flex;
|
||||
|
||||
flex-flow: row nowrap;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.item-option-button [slot="icon-only"] {
|
||||
@include padding(0);
|
||||
|
||||
min-width: .9em;
|
||||
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
|
||||
// Item Expandable Animation
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-option-expandable {
|
||||
flex-shrink: 0;
|
||||
|
||||
transition-duration: 0;
|
||||
transition-property: none;
|
||||
transition-timing-function: cubic-bezier(.65, .05, .36, 1);
|
||||
}
|
||||
|
||||
.item-sliding-active-swipe-right .item-options-right .item-option-expandable {
|
||||
transition-duration: .6s;
|
||||
transition-property: padding-left;
|
||||
|
||||
@include multi-dir() {
|
||||
// scss-lint:disable PropertySpelling
|
||||
padding-left: 90%;
|
||||
}
|
||||
|
||||
@include ltr() {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
@include rtl() {
|
||||
order: -1;
|
||||
}
|
||||
}
|
||||
|
||||
.item-sliding-active-swipe-left .item-options-left .item-option-expandable {
|
||||
transition-duration: .6s;
|
||||
transition-property: padding-right;
|
||||
|
||||
@include multi-dir() {
|
||||
// scss-lint:disable PropertySpelling
|
||||
padding-right: 90%;
|
||||
}
|
||||
|
||||
@include ltr() {
|
||||
order: -1;
|
||||
}
|
||||
|
||||
@include rtl() {
|
||||
order: 1;
|
||||
}
|
||||
}
|
||||
79
core/src/components/item-option/item-option.tsx
Normal file
79
core/src/components/item-option/item-option.tsx
Normal file
@ -0,0 +1,79 @@
|
||||
import { Component, Prop } from '@stencil/core';
|
||||
|
||||
|
||||
@Component({
|
||||
tag: 'ion-item-option',
|
||||
host: {
|
||||
theme: 'item-option'
|
||||
},
|
||||
styleUrls: {
|
||||
ios: 'item-option.ios.scss',
|
||||
md: 'item-option.md.scss'
|
||||
}
|
||||
})
|
||||
export class ItemOption {
|
||||
/**
|
||||
* The color to use from your Sass `$colors` map.
|
||||
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
||||
* For more information, see [Theming your App](/docs/theming/theming-your-app).
|
||||
*/
|
||||
@Prop() color: string;
|
||||
|
||||
/**
|
||||
* The mode determines which platform styles to use.
|
||||
* Possible values are: `"ios"` or `"md"`.
|
||||
* For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
|
||||
*/
|
||||
@Prop() mode: 'ios' | 'md';
|
||||
|
||||
/**
|
||||
* If true, the user cannot interact with the item option. Defaults to `false`.
|
||||
*/
|
||||
@Prop() disabled = false;
|
||||
|
||||
/**
|
||||
* If true, the option will expand to take up the available width and cover any other options. Defaults to `false`.
|
||||
*/
|
||||
@Prop() expandable = false;
|
||||
|
||||
/**
|
||||
* Contains a URL or a URL fragment that the hyperlink points to.
|
||||
* If this property is set, an anchor tag will be rendered.
|
||||
*/
|
||||
@Prop() href: string;
|
||||
|
||||
clickedOptionButton(ev: Event): boolean {
|
||||
const el = (ev.target as HTMLElement).closest('ion-item-option');
|
||||
return !!el;
|
||||
}
|
||||
|
||||
hostData() {
|
||||
return {
|
||||
class: {
|
||||
'item-option-expandable': this.expandable
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
const TagType = this.href ? 'a' : 'button';
|
||||
|
||||
return (
|
||||
<TagType
|
||||
class='item-option-button'
|
||||
disabled={this.disabled}
|
||||
href={this.href}
|
||||
onClick={this.clickedOptionButton.bind(this)}>
|
||||
<span class='item-option-button-inner'>
|
||||
<slot name='start'></slot>
|
||||
<slot name='top'></slot>
|
||||
<slot name='icon-only'></slot>
|
||||
<slot></slot>
|
||||
<slot name='bottom'></slot>
|
||||
<slot name='end'></slot>
|
||||
</span>
|
||||
</TagType>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
4
core/src/components/item-option/item-option.vars.scss
Normal file
4
core/src/components/item-option/item-option.vars.scss
Normal file
@ -0,0 +1,4 @@
|
||||
@import "../../themes/ionic.globals";
|
||||
|
||||
// Item Option
|
||||
// --------------------------------------------------
|
||||
98
core/src/components/item-option/readme.md
Normal file
98
core/src/components/item-option/readme.md
Normal file
@ -0,0 +1,98 @@
|
||||
# ion-item-option
|
||||
|
||||
The option button for an `ion-item-sliding`. Must be placed inside of an `<ion-item-options>`.
|
||||
You can combine the `(ionSwipe)` event and the `expandable` directive to create a full swipe
|
||||
action for the item.
|
||||
|
||||
|
||||
<!-- Auto Generated Below -->
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
#### color
|
||||
|
||||
string
|
||||
|
||||
The color to use from your Sass `$colors` map.
|
||||
Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
||||
For more information, see [Theming your App](/docs/theming/theming-your-app).
|
||||
|
||||
|
||||
#### disabled
|
||||
|
||||
boolean
|
||||
|
||||
If true, the user cannot interact with the item option. Defaults to `false`.
|
||||
|
||||
|
||||
#### expandable
|
||||
|
||||
boolean
|
||||
|
||||
If true, the option will expand to take up the available width and cover any other options. Defaults to `false`.
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
|
||||
Contains a URL or a URL fragment that the hyperlink points to.
|
||||
If this property is set, an anchor tag will be rendered.
|
||||
|
||||
|
||||
#### mode
|
||||
|
||||
|
||||
|
||||
The mode determines which platform styles to use.
|
||||
Possible values are: `"ios"` or `"md"`.
|
||||
For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
|
||||
|
||||
|
||||
## Attributes
|
||||
|
||||
#### color
|
||||
|
||||
string
|
||||
|
||||
The color to use from your Sass `$colors` map.
|
||||
Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
||||
For more information, see [Theming your App](/docs/theming/theming-your-app).
|
||||
|
||||
|
||||
#### disabled
|
||||
|
||||
boolean
|
||||
|
||||
If true, the user cannot interact with the item option. Defaults to `false`.
|
||||
|
||||
|
||||
#### expandable
|
||||
|
||||
boolean
|
||||
|
||||
If true, the option will expand to take up the available width and cover any other options. Defaults to `false`.
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
|
||||
Contains a URL or a URL fragment that the hyperlink points to.
|
||||
If this property is set, an anchor tag will be rendered.
|
||||
|
||||
|
||||
#### mode
|
||||
|
||||
|
||||
|
||||
The mode determines which platform styles to use.
|
||||
Possible values are: `"ios"` or `"md"`.
|
||||
For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
|
||||
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
*Built with [StencilJS](https://stenciljs.com/)*
|
||||
Reference in New Issue
Block a user