Home / Class/ DevToolbarRadioCheckbox Class — astro Architecture

DevToolbarRadioCheckbox Class — astro Architecture

Architecture documentation for the DevToolbarRadioCheckbox class in radio-checkbox.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  04f58904_0d97_86ee_add0_b47eed49defc["DevToolbarRadioCheckbox"]
  9e7b6b7e_6525_bcb9_82d2_804a8a939ee9["radio-checkbox.ts"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|defined in| 9e7b6b7e_6525_bcb9_82d2_804a8a939ee9
  3ba3a162_2e0b_93c1_7fc9_8e8870b095aa["radioStyle()"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|method| 3ba3a162_2e0b_93c1_7fc9_8e8870b095aa
  6fad9fd8_abc0_b85e_089d_a790461877a9["constructor()"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|method| 6fad9fd8_abc0_b85e_089d_a790461877a9
  f5dc59b5_3fa5_ae5e_0ff2_a790bb8bdb31["connectedCallback()"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|method| f5dc59b5_3fa5_ae5e_0ff2_a790bb8bdb31
  4d20cf3f_90b4_1511_4f44_71f4b8d4c417["updateStyle()"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|method| 4d20cf3f_90b4_1511_4f44_71f4b8d4c417
  d7781143_da85_efaf_3b08_e265e1a4c38c["updateInputState()"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|method| d7781143_da85_efaf_3b08_e265e1a4c38c
  f9923869_4de8_1c1c_143f_81bf5b35f7cf["attributeChangedCallback()"]
  04f58904_0d97_86ee_add0_b47eed49defc -->|method| f9923869_4de8_1c1c_143f_81bf5b35f7cf

Relationship Graph

Source Code

packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts lines 5–121

export class DevToolbarRadioCheckbox extends HTMLElement {
	private _radioStyle: RadioStyle = 'purple';
	input: HTMLInputElement;

	shadowRoot: ShadowRoot;

	get radioStyle() {
		return this._radioStyle;
	}

	set radioStyle(value) {
		if (!styles.includes(value)) {
			console.error(`Invalid style: ${value}, expected one of ${styles.join(', ')}.`);
			return;
		}
		this._radioStyle = value;
		this.updateStyle();
	}

	static observedAttributes = ['radio-style', 'checked', 'disabled', 'name', 'value'];

	constructor() {
		super();
		this.shadowRoot = this.attachShadow({ mode: 'open' });

		this.shadowRoot.innerHTML = `
		<style>
			:host {
				--purple-unchecked: rgba(224, 204, 250, 0.33);
				--purple-checked: rgba(224, 204, 250, 1);

				--gray-unchecked: rgba(191, 193, 201, 0.33);
				--gray-checked: rgba(191, 193, 201, 1);

				--red-unchecked: rgba(249, 196, 215, 0.33);
				--red-checked: rgba(179, 62, 102, 1);

				--green-unchecked: rgba(213, 249, 196, 0.33);
				--green-checked: rgba(61, 125, 31, 1);

				--yellow-unchecked: rgba(255, 236, 179, 0.33);
				--yellow-checked: rgba(181, 138, 45, 1);

				--blue-unchecked: rgba(189, 195, 255, 0.33);
				--blue-checked: rgba(54, 69, 217, 1);
			}

			input[type="radio"] {
				appearance: none;
				-webkit-appearance: none;
				display: flex;
				align-content: center;
				justify-content: center;
				border: 2px solid var(--unchecked-color);
				border-radius: 9999px;
				width: 16px;
				height: 16px;
			}

			input[type="radio"]::before {
				content: "";
				background-color: var(--checked-color);
				width: 8px;
				height: 8px;
				border-radius: 9999px;
				visibility: hidden;
				margin: 2px;
			}

			input[type="radio"]:checked {
				border-color: var(--checked-color);
			}

			input[type="radio"]:checked::before {
				visibility: visible;
			}
		</style>
		<style id="selected-style"></style>
		`;
		this.input = document.createElement('input');
		this.input.type = 'radio';

Frequently Asked Questions

What is the DevToolbarRadioCheckbox class?
DevToolbarRadioCheckbox is a class in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts.
Where is DevToolbarRadioCheckbox defined?
DevToolbarRadioCheckbox is defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts at line 5.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free