Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Container.sketch({
dom: {
tag: 'div',
attributes: {
role: 'alert'
},
classes: [ 'tox-notification', 'tox-notification--in', `tox-notification--${spec.level}` ]
},
components: [
{
dom: {
tag: 'div',
classes: [ 'tox-notification__icon' ]
},
components: [
Button.sketch({
dom: {
tag: 'button',
classes: [ 'tox-button', 'tox-button--naked', 'tox-button--icon' ],
innerHtml: Icons.get(spec.icon, providersBackstage.icons),
attributes: {
title: providersBackstage.translate(spec.iconTooltip)
}
},
// TODO: aria label this button!
action: (comp) => {
AlloyTriggers.emitWith(comp, formActionEvent, { name: 'alert-banner', value: spec.url });
}
})
]
},
{const pClose = (onClose, providersBackstage: UiFactoryBackstageProviders) => ModalDialog.parts().close(
// Need to find a way to make it clear in the docs whether parts can be sketches
Button.sketch({
dom: {
tag: 'button',
classes: [ 'tox-button', 'tox-button--icon', 'tox-button--naked' ],
attributes: {
'type': 'button',
'aria-label': providersBackstage.translate('Close')
}
},
action: onClose,
buttonBehaviours: Behaviour.derive([
Tabstopping.config({ })
])
})
);const createSelector = (snaps: DraggingTypes.SnapsConfig) => Memento.record(
Button.sketch({
dom: {
tag: 'div',
classes: ['tox-selector']
},
buttonBehaviours: Behaviour.derive([
Dragging.config({
mode: 'mouseOrTouch',
blockerClass: 'blocker',
snaps
}),
Unselecting.config({ })
]),
eventOrder: {
// Because this is a button, allow dragging. It will stop clicking.
mousedown: [ 'dragging', 'alloy.base.behaviour' ],export const renderButton = (spec: ButtonSpec, action: (comp: AlloyComponent) => void, providersBackstage: UiFactoryBackstageProviders, extraBehaviours = [], extraClasses = []): SketchSpec => {
const buttonSpec = renderButtonSpec(spec, Option.some(action), providersBackstage, extraBehaviours, extraClasses);
return AlloyButton.sketch(buttonSpec);
};export const renderTypeahead = (spec: TypeaheadInput, backstage: UiFactoryBackstage): SketchSpec => {
return AlloyContainer.sketch({
dom: {
tag: 'div'
},
components: [
renderAutocomplete(spec, backstage),
AlloyButton.sketch({
dom: {
tag: 'button',
innerHtml: Icons.get(spec.icon, backstage.shared.providers.icons)
}
})
],
containerBehaviours: Behaviour.derive([
ComposingConfigs.self(),
RepresentingConfigs.memory('NOT IMPLEMENTED')
])
});
};} as AlloySpec,
{
dom: {
tag: 'div',
classes: [ 'tox-notification__body'],
},
components: [
memBannerText.asSpec()
],
behaviours: Behaviour.derive([
Replacing.config({ })
])
} as AlloySpec
]
.concat(detail.progress ? [memBannerProgress.asSpec()] : [])
.concat(Button.sketch({
dom: {
tag: 'button',
classes: [ 'tox-notification__dismiss', 'tox-button', 'tox-button--naked', 'tox-button--icon' ]
},
components: [{
dom: {
tag: 'div',
classes: ['tox-icon'],
innerHtml: getIcon('close', detail.iconProvider),
attributes: {
'aria-label': detail.translationProvider('Close')
}
}
}],
action: (comp) => {
detail.onAction(comp);const navigationButton = function (direction, directionName, enabled) {
return Button.sketch({
dom: UiDomFactory.dom('<span class="${prefix}-icon-' + directionName + ' ${prefix}-icon"></span>'),
action (button) {
AlloyTriggers.emitWith(button, navigateEvent, { direction });
},
buttonBehaviours: Behaviour.derive([
Disabling.config({
disableClass: Styles.resolve('toolbar-navigation-disabled'),
disabled: !enabled
})
])
});
};export const renderIconButton = (spec: IconButtonWrapper, action: (comp: AlloyComponent) => void, providersBackstage: UiFactoryBackstageProviders, extraBehaviours = []): SketchSpec => {
const iconButtonSpec = renderIconButtonSpec(spec, Option.some(action), providersBackstage, extraBehaviours);
return AlloyButton.sketch(iconButtonSpec);
};]),
components: [
{
dom: {
tag: 'div',
classes: [ 'tox-dropzone' ],
styles: {}
},
components: [
{
dom: {
tag: 'p',
innerHtml: providersBackstage.translate('Drop an image here')
}
},
Button.sketch({
dom: {
tag: 'button',
innerHtml: providersBackstage.translate('Browse for an image'),
styles: {
position: 'relative'
},
classes: [ 'tox-button', 'tox-button--secondary']
},
components: [
memInput.asSpec()
],
action: (comp) => {
const inputComp = memInput.get(comp);
inputComp.element().dom().click();
},
buttonBehaviours: Behaviour.derive([