UNPKG

wix-style-react

Version:
249 lines (208 loc) • 6.36 kB
:import { -st-from: '../Foundation/stylable/colors.st.css'; -st-named: THEME-COLOR-10, THEME-COLOR-20, THEME-COLOR-50, D10, D20, D50, D60, D70, D80; } :import { -st-from: "../Foundation/stylable/mixins/calc.js"; -st-default: calc; } :import { -st-from: "../Foundation/stylable/shadows.st.css"; -st-named: shadow30; } :import { -st-from: "../Foundation/stylable/typography.st.css"; -st-named: heading-h6, text-medium-normal; } :import { -st-from: '../Foundation/stylable/default-scroll-bar.st.css'; -st-named: defaultScrollBar; } :import { -st-from: "../ListItemSelect/ListItemSelect.st.css"; -st-default: ListItemSelect; } @st-import [ --wds-input-value-font-size-medium, --wds-input-value-font-line-height-medium, --wds-dropdown-layout-option-size-small, --wds-dropdown-layout-option-size-big, --wds-color-fill-light-primary-hover, --wds-color-fill-standard-primary-active, --wds-color-fill-standard-primary-hover, --wds-color-fill-standard-secondary-active, --wds-color-fill-surface-overlay, --wds-color-text-disabled, --wds-color-text-standard-primary-light, --wds-color-text-standard-primary, --wds-color-black-100-transparent-10, --wds-color-white, --wds-list-item-select-title, --wds-list-item-select-active-title, --wds-list-item-select-title-disabled, --wds-list-item-select-active-fill-hover, --wds-list-item-select-active-fill, --wds-list-item-select-fill-hover, --wds-list-item-select-padding-horizontal-medium, --wds-list-item-select-padding-vertical-medium, --wds-border-radius-surface-overlay, --wds-shadow-surface-overlay, --wds-space-100, --wds-space-200, --wds-space-250, --wds-space-300, --wds-space-400, ] from "@wix/design-system-tokens/all.st.css"; :vars { option_height: var(--wds-dropdown-layout-option-size-small, 36px); big_option_height: var(--wds-dropdown-layout-option-size-big, 47px); top-arrow-size: 8px; arrowUpShadow: 3px 3px 8px var(--wds-color-black-100-transparent-10, rgba(0, 0, 0, .1)); arrowDownShadow: -3px -3px 8px var(--wds-color-black-100-transparent-10, rgba(0, 0, 0, .1)); } .root { -st-states: visible, withArrow, containerStyles, direction(enum(up, down)); box-sizing: border-box; position: relative; outline: none; border: none; width: 100%; display: flex; justify-content: center; } .root * { box-sizing: border-box; } .contentContainer { background: var(--wds-color-fill-surface-overlay, value(D80)); border: none; display: none; opacity: 0; height: 0; padding: 0; transition: opacity 0.2s ease; width: 100%; z-index: 6; left: 0; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .root:containerStyles .contentContainer { border-radius: var(--wds-border-radius-surface-overlay, 8px); box-shadow: var(--wds-shadow-surface-overlay, value(shadow30)); position: absolute; } .root:visible .contentContainer { display: flex; flex-direction: column; height: auto; overflow: auto; opacity: 1; } .root:visible:withArrow .contentContainer { padding: var(--wds-space-200, 10px) 0; } .root:visible:containerStyles:direction(up) .contentContainer { bottom: 0; margin-top: var(--wds-space-250, 15px); } .root:visible:containerStyles:withArrow:direction(up) .contentContainer { margin-bottom: value(top-arrow-size); } .root:visible:containerStyles:direction(down) .contentContainer { top: 0; margin-bottom: var(--wds-space-250, 15px); } .root:visible:containerStyles:withArrow:direction(down) .contentContainer { margin-top: value(top-arrow-size); } .options { -st-mixin: defaultScrollBar; position: relative; overflow: auto; } /* Using ListItemSelect tokens for .option class, because it is kind of a hack to make element look like ListItemSelect */ .option { -st-states: selected, hovered, disabled, itemHeight(enum(small, big)), overrideStyle; -st-mixin: text-medium-normal; font-size: var(--wds-input-value-font-size-medium, 16px); line-height: var(--wds-input-value-font-line-height-medium, 24px); color: var(--wds-list-item-select-title, value(D10)); overflow: hidden; text-overflow: ellipsis; text-align: left; padding: var(--wds-list-item-select-padding-vertical-medium, 6px) var(--wds-list-item-select-padding-horizontal-medium, 20px) var(--wds-list-item-select-padding-vertical-medium, 6px) var(--wds-list-item-select-padding-horizontal-medium, 24px); cursor: pointer; width: 100%; display: flex; align-items: center; } .option:overrideStyle { padding: 0; } .option:disabled { color: var(--wds-list-item-select-title-disabled, value(D50)); cursor: default; } :global(.rtl) .option, :global([dir='rtl']) .option { text-align: right; direction: rtl; } .option:hovered { background: var(--wds-list-item-select-fill-hover, value(THEME-COLOR-50)); color: var(--wds-list-item-select-title, value(D10)); } .option:focus { outline: none; } .option:selected { background-color: var(--wds-list-item-select-active-fill, value(THEME-COLOR-10)); color: var(--wds-list-item-select-active-title, value(D80)); } .option:selected:hovered { background-color: var(--wds-list-item-select-active-fill-hover, value(THEME-COLOR-20)); color: var(--wds-list-item-select-active-title, value(D80)); } .selectableOption { -st-states: itemHeight(enum(big, small)); -st-extends: ListItemSelect; } .selectableOption:itemHeight(small) { min-height: value(option_height); } .selectableOption:itemHeight(big) { min-height: value(big_option_height); display: flex; align-items: center; } .arrow { position: absolute; left: 50%; z-index: 10; transform: translateX(-50%) rotateZ(45deg); height: value(top-arrow-size); width: value(top-arrow-size); background: var(--wds-color-white, value(D80)); } .root:direction(up) .arrow { bottom: calc(value(top-arrow-size) / 2); box-shadow: value(arrowUpShadow); } .root:direction(down) .arrow { top: calc(value(top-arrow-size) / 2); box-shadow: value(arrowDownShadow); } .loader { display: flex; justify-content: center; padding-bottom: var(--wds-space-400, 24px); padding-top: var(--wds-space-400, 24px); } .linkItem { text-decoration: none; } /* st-namespace-reference="../../../src/DropdownLayout/DropdownLayout.st.css" */