How to use the @dojo/framework/core/vdom.v function in @dojo/framework

To help you get started, we’ve selected a few @dojo/framework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dojo / widgets / src / slide-pane / index.tsx View on Github external
protected render(): DNode {
		let { aria = {}, closeText, open = false, title = '', theme, classes } = this.properties;

		const contentStyles = this.getStyles();
		const contentClasses = this.getModifierClasses();
		const fixedContentClasses = this.getFixedModifierClasses();

		if (!closeText) {
			const { messages } = this.localizeBundle(commonBundle);
			closeText = `${messages.close} ${title}`;
		}

		// This is a side-effect of rendering, it clears the slide styles for the next render.
		this._slide = undefined;

		return v(
			'div',
			{
				'aria-labelledby': this._titleId,
				classes: this.theme(css.root),
				onmousedown: this._onSwipeStart,
				onmousemove: this._onSwipeMove,
				onmouseup: this._onSwipeEnd,
				ontouchend: this._onSwipeEnd,
				ontouchmove: this._onSwipeMove,
				ontouchstart: this._onSwipeStart
			},
			[
				open ? this.renderUnderlay() : null,
				v(
					'div',
					{
github dojo / widgets / src / tab-controller / TabButton.tsx View on Github external
render(): DNode {
		const { active, controls, disabled, id } = this.properties;
		const { messages } = this.localizeBundle(commonBundle);

		return v(
			'div',
			{
				'aria-controls': controls,
				'aria-disabled': disabled ? 'true' : 'false',
				'aria-selected': active === true ? 'true' : 'false',
				classes: this.theme([css.tabButton, ...this.getModifierClasses()]),
				focus: this.shouldFocus,
				id,
				key: 'tab-button',
				onclick: this._onClick,
				onkeydown: this._onKeyDown,
				role: 'tab',
				tabIndex: active === true ? 0 : -1
			},
			[v('span', { classes: this.theme(css.tabButtonContent) }, this.getContent(messages))]
		);
github dojo / widgets / src / calendar / example / index.ts View on Github external
year: this._year,
				onMonthChange: (month: number) => {
					this._month = month;
					this.invalidate();
				},
				onYearChange: (year: number) => {
					this._year = year;
					this.invalidate();
				},
				onDateSelect: (date: Date) => {
					this._selectedDate = date;
					this.invalidate();
				}
			}),
			this._selectedDate
				? v('p', [`Selected Date: ${this._selectedDate.toDateString()}`])
				: null
		]);
	}
}
github dojo / widgets / src / calendar / index.tsx View on Github external
protected renderPagingButtonContent(type: Paging, labels: CalendarMessages): DNode[] {
		const { theme, classes } = this.properties;
		const iconType = type === Paging.next ? 'rightIcon' : 'leftIcon';
		const labelText = type === Paging.next ? labels.nextMonth : labels.previousMonth;

		return [
			w(Icon, { type: iconType, theme, classes }),
			v('span', { classes: [baseCss.visuallyHidden] }, [labelText])
		];
	}
github dojo / examples / widget-showcase / src / widgets / tabs / BasicFormTab.ts View on Github external
const toggleChecked = icache.getOrSet('toggle-checked', true);
	const selectedRadio = icache.getOrSet('radio', 'first');

	function radioChange(value: string) {
		icache.set('radio', value);
	}

	return v('div', { classes: css.root }, [
		v('h2', ['Buttons']),
		v(
			'div',
			{
				classes: css.buttons
			},
			[
				v('h3', ['Enabled']),
				w(Button, {}, ['Basic Button']),
				w(Button, {}, ['Icon Button ', w(Icon, { type: 'searchIcon' })]),
				w(
					Button,
					{
						popup: { expanded: false, id: 'fakeId' }
					},
					['Popup']
				),
				w(
					Button,
					{
						pressed: togglePressed,
						onClick: () => {
							icache.set('toggle-pressed', !togglePressed);
						}
github dojo / widgets / src / select / example / index.ts View on Github external
render() {
		return v('div', [
			w(Select, {
				key: 'select1',
				...this.getOptionSettings(),
				getOptionSelected: (option: any) => !!this._value1 && option.value === this._value1,
				label: 'Native select',
				options: this._selectOptions,
				useNativeElement: true,
				value: this._value1,
				onChange: (option: any) => {
					this._value1 = option.value;
					this.invalidate();
				}
			}),
			v('p', {
				innerHTML: 'Result value: ' + this._value1
			}),
			w(Select, {
				key: 'select2',
				...this.getOptionSettings(),
				label: 'Custom select box',
				options: this._moreSelectOptions,
				value: this._value2,
				onChange: (option: any) => {
					this._value2 = option.value;
					this.invalidate();
				}
			}),
			v('br'),
			w(Select, {
				key: 'select3',
github dojo / widgets / src / grid / PaginatedFooter.tsx View on Github external
fixedCss.containerFixed,
						this.theme(css.details),
						fixedCss.detailsFixed
					]
				},
				[total ? `${from} - ${total < to ? total : to} of ${total} Results` : '0 Results']
			),
			v(
				'nav',
				{
					role: 'navigation',
					'aria-label': 'Pagination Navigation',
					classes: [this.theme(css.pagination)]
				},
				[
					v(
						'ul',
						{
							classes: [
								fixedCss.containerFixed,
								this.theme(css.paginationList),
								fixedCss.paginationListFixed
							]
						},
						[
							v('li', { classes: [fixedCss.itemFixed, this.theme(css.item)] }, [
								totalPages > 1 &&
									v(
										'button',
										{
											key: 'previous',
											disabled: page === 1,
github dojo / widgets / src / toolbar / index.tsx View on Github external
protected renderActions(): DNode {
		const { close } = this.localizeBundle(commonBundle).messages;

		const { align = Align.right, theme, classes, heading } = this.properties;
		const actions = v(
			'div',
			{
				classes: this.theme(css.actions),
				key: 'menu'
			},
			this.children
		);

		return this._collapsed
			? w(
					SlidePane,
					{
						align,
						closeText: close,
						key: 'slide-pane-menu',
						onRequestClose: this._closeMenu,
github dojo / widgets / src / range-slider / example / index.tsx View on Github external
render(): DNode {
		return v('div', [
			v('h2', {}, ['Range Slider']),
			v('h3', {}, ['Value']),
			w(RangeSlider, {
				key: 'value1',
				label: 'mostly default settings',
				min: 0,
				max: 50,
				value: { min: this._state.value1Min, max: this._state.value1Max },
				onValue: ({ min, max }) => {
					this._state.value1Min = min;
					this._state.value1Max = max;
					this.invalidate();
				}
			}),
			v('div', {}, [`Min: ${this._state.value1Min} - Max: ${this._state.value1Max}`]),
			v('h3', {}, ['Tooltips']),
			v('h4', {}, ['showOutput']),
github dojo / widgets / src / slide-pane / example / index.tsx View on Github external
Nam sollicitudin varius augue, sed lacinia felis tempor in.
				Lorem ipsum dolor sit amet, consectetur adipiscing elit.
				Quisque id purus ipsum. Aenean ac purus purus.
				Nam sollicitudin varius augue, sed lacinia felis tempor in.
				Lorem ipsum dolor sit amet, consectetur adipiscing elit.
				Quisque id purus ipsum. Aenean ac purus purus.
				Nam sollicitudin varius augue, sed lacinia felis tempor in.
				Lorem ipsum dolor sit amet, consectetur adipiscing elit.
				Quisque id purus ipsum. Aenean ac purus purus.
				Nam sollicitudin varius augue, sed lacinia felis tempor in.
				Lorem ipsum dolor sit amet, consectetur adipiscing elit.
				Quisque id purus ipsum. Aenean ac purus purus.
				Nam sollicitudin varius augue, sed lacinia felis tempor in.`
				]
			),
			v('button', {
				id: 'button',
				innerHTML: 'open slidepane',
				onclick: this.openSlidePane
			}),
			v('div', { classes: 'option' }, [
				v('input', {
					type: 'checkbox',
					id: 'underlay',
					onchange: this.toggleUnderlay
				}),
				v('label', {
					for: 'underlay',
					innerHTML: 'underlay'
				})
			]),
			v('div', { classes: 'option' }, [