UNPKG

lu2

Version:

Simple and flexible UI component library based on native HTML and JavaScript

215 lines (193 loc) 5.55 kB
/** * * @Drop.css * @author zhangxinxu * @create 20-12-15 * **/ ui-drop[tabindex="0"] { cursor: pointer; } ui-drop ~ .ui-drop-target { position: absolute; z-index: 9; } ui-drop:not([open]) ~ .ui-drop-target { display: none; } /** * * @DropList.css * @author xinxuzhang * @create 15-07-01 * @edit 19-10-20 sunmeiye * **/ .ui-droplist-x { position: absolute; width: 111px; padding: 7px 0; background-color: var(--ui-white, #ffffff); box-shadow: 0 2px 5px rgba(0, 0, 0, .25); --safe-area: 3px; border: 1px solid var(--ui-border, #d0d0d5); border-radius: var(--ui-radius, 4px); font-size: var(--ui-font, 14px); animation: fadeIn var(--ui-animate-time, .2s); z-index: 9; } .ui-droplist-li { display: block; line-height: 20px; padding: 7px 12px 8px; color: var(--ui-dark, #4c5161); text-decoration: none; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .ui-droplist-hr { border: 0; border-bottom: 1px solid var(--ui-border, #d0d0d5); margin: 7px 12px; opacity: .4; } .ui-droplist-hr:first-child { display: none; } a.ui-droplist-li:hover { color: var(--ui-dark, #4c5161); background-color: var(--ui-list-hover, #f0f7ff); } a.ui-droplist-li:hover::after { background-position: 0 -20px; } span.ui-droplist-li { color: var(--ui-gray, #a2a9b6); cursor: default; } .ui-droplist-li[role="heading"] { font-weight: 700; padding-bottom: 5px; cursor: default; } [role="heading"] ~ .ui-droplist-li:not([role="heading"]) { padding-left: 24px; } .ui-droplist-li.disabled { opacity: var(--ui-opacity, .4); } .ui-droplist-li[data-sublist]::before { transform: rotate(-90deg); margin-top: 1px; float: right; } .ui-droplist-x > .selected { background-color: var(--ui-list-selected, #e0f0ff); } .selected + .ui-droplist-xx > .ui-droplist-x { display: block; } .ui-droplist-xx { position: relative; } .ui-droplist-xx > .ui-droplist-x { display: none; left: calc(100% - 5px); top: -35px; } .ui-droplist-xx > .reverse { left: auto; right: calc(100% - 5px); } .ui-droplist-arrow:empty, .ui-droplist-arrow:not(:empty)::after, .ui-droplist-li[data-sublist]::before { content: ''; display: inline-block; width: 20px; height: 20px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-205 197 200 400'%3E%3Cpath d='M-59.7 271.6c-4.2-4.1-11-4.1-15.3 0l-30.5 29.6-30.5-29.6c-4.2-4.1-11-4.1-15.3 0-4.2 4.1-4.2 10.7 0 14.8l38.2 37c4.2 4.1 11 4.1 15.3 0l38.2-37c4.1-4.1 4.1-10.7-.1-14.8z' fill='%23a2a9b6'/%3E%3Cpath d='M-58.7 471.6c-4.2-4.1-11-4.1-15.3 0l-30.5 29.6-30.5-29.6c-4.2-4.1-11-4.1-15.3 0-4.2 4.1-4.2 10.7 0 14.8l38.2 37c4.2 4.1 11 4.1 15.3 0l38.2-37c4.1-4.1 4.1-10.7-.1-14.8z' fill='%232a80eb'/%3E%3C/svg%3E"), none; background-size: 20px 40px; vertical-align: -5px; } a:hover .ui-droplist-arrow:empty, .ui-droplist-arrow:not(:empty):hover::after { background-position: 0 -20px; } /** * * @DropPanel.css * @author xinxuzhang * @create 15-07-01 * **/ .ui-dropanel-x { position: absolute; width: 260px; padding: 20px; background-color: var(--ui-white, #ffffff); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); --safe-area: 3px; border: 1px solid var(--ui-border, #d0d0d5); border: 0 rgba(0, 0, 0, 0.2); font-size: var(--ui-font, 14px); animation: fadeIn var(--ui-animate-time, .2s); z-index: 9; } .ui-dropanel-title { line-height: 20px; margin-top: -2px; margin-bottom: 0; font-size: var(--ui-font, 14px); font-weight: bold; } .ui-dropanel-close { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border: 0; padding: 0; background: none; cursor: pointer; z-index: 1; } .ui-dropanel-close::before { content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--ui-dark-gray, #b6bbc6); transition: background-color var(--ui-animate-time, .2s); --mask-image: url("data:image/svg+xml,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22200%22%20height%3D%22200%22%20viewBox%3D%220%200%20200%20200%22%20%3E%3Cpath%20d%3D%22M116.152%2C99.999l36.482-36.486c2.881-2.881%2C2.881-7.54%2C0-10.42%20l-5.215-5.215c-2.871-2.881-7.539-2.881-10.42%2C0l-36.484%2C36.484L64.031%2C47.877c-2.881-2.881-7.549-2.881-10.43%2C0l-5.205%2C5.215%20c-2.881%2C2.881-2.881%2C7.54%2C0%2C10.42l36.482%2C36.486l-36.482%2C36.482c-2.881%2C2.881-2.881%2C7.549%2C0%2C10.43l5.205%2C5.215%20c2.881%2C2.871%2C7.549%2C2.871%2C10.43%2C0l36.484-36.488L137%2C152.126c2.881%2C2.871%2C7.549%2C2.871%2C10.42%2C0l5.215-5.215%20c2.881-2.881%2C2.881-7.549%2C0-10.43L116.152%2C99.999z%22%2F%3E%3C%2Fsvg%3E"); -webkit-mask: var(--mask-image) no-repeat center / 100% 100%; mask: var(--mask-image) no-repeat center / 100% 100%; } .ui-dropanel-close:hover::before { background-color: var(--ui-dark, #4c5161); } .ui-dropanel-content { display: block; min-height: 40px; padding: 10px 0 20px; } .ui-dropanel-footer { text-align: right; } .ui-dropanel-footer .ui-button { margin-left: 15px; } .ui-dropanel-footer .ui-button:first-child { margin-left: 0; } @media (prefers-reduced-motion: reduce) { .ui-droplist-x, .ui-dropanel-x { animation: none; } .ui-dropanel-close::before { transition: none; } }