UNPKG

@stories-js/core

Version:

Stories web components to build stories

118 lines (109 loc) 2.78 kB
:host { /** * @prop --size: Size of the checkbox icon * * @prop --background: Background of the checkbox icon * @prop --background-checked: Background of the checkbox icon when checked * * @prop --border-color: Border color of the checkbox icon * @prop --border-radius: Border radius of the checkbox icon * @prop --border-width: Border width of the checkbox icon * @prop --border-style: Border style of the checkbox icon * @prop --border-color-checked: Border color of the checkbox icon when checked * * @prop --transition: Transition of the checkbox icon * * @prop --checkmark-color: Color of the checkbox checkmark when checked * @prop --checkmark-width: Stroke width of the checkbox checkmark */ --background-checked: var(--stories-color-primary, #3880ff); --border-color-checked: var(--stories-color-primary, #3880ff); --checkmark-color: var(--stories-color-primary-contrast, #fff); --checkmark-width: 1; --transition: none; display: inline-block; position: relative; user-select: none; z-index: 2; } :host(.stories-color) { --background-checked: var(--stories-color-base); --border-color-checked: var(--stories-color-base); --checkmark-color: var(--stories-color-contrast); } label { left: 0; top: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; position: absolute; width: 100%; height: 100%; border: 0; background: transparent; cursor: pointer; appearance: none; outline: none; display: flex; align-items: center; opacity: 0; } [dir=rtl] label, :host-context([dir=rtl]) label { left: unset; right: unset; right: 0; } label::-moz-focus-inner { border: 0; } input { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; outline: 0; clip: rect(0 0 0 0); opacity: 0; overflow: hidden; -webkit-appearance: none; -moz-appearance: none; } .checkbox-icon { border-radius: var(--border-radius); display: block; position: relative; width: 100%; height: 100%; transition: var(--transition); border-width: var(--border-width); border-style: var(--border-style); border-color: var(--border-color); background: var(--background); box-sizing: border-box; } .checkbox-icon path { fill: none; stroke: var(--checkmark-color); stroke-width: var(--checkmark-width); opacity: 0; } :host(.checkbox-checked) .checkbox-icon, :host(.checkbox-indeterminate) .checkbox-icon { border-color: var(--border-color-checked); background: var(--background-checked); } :host(.checkbox-checked) .checkbox-icon path, :host(.checkbox-indeterminate) .checkbox-icon path { opacity: 1; } :host(.checkbox-disabled) { pointer-events: none; }