mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
191 lines
3.7 KiB
SCSS
191 lines
3.7 KiB
SCSS
@import "../../themes/ionic.globals";
|
|
|
|
// Picker Column
|
|
// --------------------------------------------------
|
|
|
|
:host {
|
|
display: flex;
|
|
position: relative;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
max-width: 100%;
|
|
|
|
height: 200px;
|
|
|
|
font-size: 22px;
|
|
|
|
text-align: center;
|
|
}
|
|
|
|
/**
|
|
* Renders an invisible element on top of the column that receives focus
|
|
* events. This allows screen readers to navigate the column.
|
|
*/
|
|
.assistive-focusable {
|
|
@include position(0, 0, 0, 0);
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
pointer-events: none;
|
|
}
|
|
|
|
// Hide the focus ring since screen readers will show their own
|
|
.assistive-focusable:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.picker-opts {
|
|
/**
|
|
* This padding must be set here and not on the
|
|
* host to ensure that the focus highlight on the
|
|
* column is not overly narrow.
|
|
*/
|
|
@include padding(0px, 16px, 0px, 16px);
|
|
|
|
/**
|
|
* When using reactive data, such as in datetime's
|
|
* wheel picker, there may be layout shifts between
|
|
* individual columns in a picker as the columns
|
|
* shrink to fit the widest item in the column.
|
|
* Setting a minimum width avoids this layout shifting.
|
|
*
|
|
* Note that we need this min-width set on the same
|
|
* element as the vertical padding (i.e. not on the
|
|
* host).
|
|
*/
|
|
min-width: 26px;
|
|
max-height: 200px;
|
|
|
|
outline: none;
|
|
|
|
/**
|
|
* Added so that text-align can be set on the host
|
|
* from external components. For example, datetime
|
|
* changes the alignment of specific columns in its
|
|
* wheel pickers.
|
|
*/
|
|
text-align: inherit;
|
|
|
|
scroll-snap-type: y mandatory;
|
|
|
|
/**
|
|
* Need to explicitly set overflow-x: hidden
|
|
* for older implementations of scroll snapping.
|
|
*/
|
|
overflow-x: hidden;
|
|
overflow-y: scroll;
|
|
|
|
// Hide scrollbars on Firefox
|
|
scrollbar-width: none;
|
|
}
|
|
|
|
.picker-item-empty {
|
|
@include padding(0);
|
|
@include margin(0);
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
height: 34px;
|
|
|
|
border: 0px;
|
|
|
|
outline: none;
|
|
|
|
background: transparent;
|
|
|
|
color: inherit;
|
|
|
|
font-family: $font-family-base;
|
|
|
|
font-size: inherit;
|
|
|
|
line-height: 34px;
|
|
|
|
text-align: inherit;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
}
|
|
|
|
/**
|
|
* Hide scrollbars on Chrome and Safari
|
|
*/
|
|
.picker-opts::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
::slotted(ion-picker-column-option) {
|
|
display: block;
|
|
|
|
scroll-snap-align: center;
|
|
}
|
|
|
|
.picker-item-empty,
|
|
:host(:not([disabled])) ::slotted(ion-picker-column-option.option-disabled) {
|
|
scroll-snap-align: none;
|
|
}
|
|
|
|
::slotted([slot="prefix"]), ::slotted([slot="suffix"]) {
|
|
max-width: 200px;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
}
|
|
|
|
::slotted([slot="prefix"]) {
|
|
/**
|
|
* This is added in addition to the column's own padding so that there is white
|
|
* space between the slot and the column's focus highlight.
|
|
*/
|
|
@include padding(0, 16px);
|
|
|
|
justify-content: end;
|
|
}
|
|
|
|
::slotted([slot="suffix"]) {
|
|
/**
|
|
* This is added in addition to the column's own padding so that there is white
|
|
* space between the slot and the column's focus highlight.
|
|
*/
|
|
@include padding(0, 16px);
|
|
|
|
justify-content: start;
|
|
}
|
|
|
|
:host(.picker-column-disabled) .picker-opts {
|
|
overflow-y: hidden;
|
|
}
|
|
|
|
/**
|
|
* When the column is disabled, none of the options
|
|
* should be interactive. However, we do not disable
|
|
* the buttons because that would require overriding the
|
|
* app's preference for each option. In this case,
|
|
* the picker column interactive as a whole is
|
|
* disabled, not individual options.
|
|
*/
|
|
:host(.picker-column-disabled) ::slotted(ion-picker-column-option) {
|
|
cursor: default;
|
|
opacity: 0.4;
|
|
pointer-events: none;
|
|
}
|
|
|
|
@media (any-hover: hover) {
|
|
:host(:focus) .picker-opts {
|
|
outline: none;
|
|
|
|
background: current-color(base, 0.2);
|
|
}
|
|
}
|