Skip to content

Commit

Permalink
feat: Add schema for BoltActionElement in element package
Browse files Browse the repository at this point in the history
  • Loading branch information
remydenton committed Mar 24, 2020
1 parent d2ce4eb commit 864f38c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/base-element/element.schemas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const boltActionElement = require('./src/BoltActionElement.schema');

module.exports = {
boltActionElement,
};
3 changes: 2 additions & 1 deletion packages/base-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
},
"publishConfig": {
"access": "public"
}
},
"schema": "element.schemas.js"
}
36 changes: 36 additions & 0 deletions packages/base-element/src/BoltActionElement.schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
$schema: 'http://json-schema.org/draft-04/schema#',
title: 'Bolt Action Element',
description:
'A starting point for components that have an "action" (e.g. button, link, etc.)',
type: 'object',
properties: {
url: {
type: 'string',
description:
'If present, users will be directed to this URL when clicking this element.',
},
target: {
type: 'string',
description:
'A valid HTML target attribute to modify the behavior when clicking this element. Only valid when "url" is also present.',
enum: ['_blank', '_self', '_parent', '_top', 'framename'],
},
disabled: {
type: 'boolean',
description:
'Whether the click action should be disabled for this element.',
default: false,
},
onClick: {
type: 'string',
description:
'When used with onClickTarget, an event to fire on the targeted elements when this element is clicked. When used without onClickTarget, arbitrary javascript to execute when this element is clicked.',
},
onClickTarget: {
type: 'string',
description:
'Requires onClick. A CSS selector for elements that the onClick event will fire on when this element is clicked.',
},
},
};

0 comments on commit 864f38c

Please sign in to comment.