atom-nuclide
Version:
A unified developer experience for web and mobile development, built as a suite of features on top of Atom to provide hackability and the support of an active community.
170 lines (154 loc) • 5.22 kB
JavaScript
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
/*
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
var _atom2;
function _atom() {
return _atom2 = require('atom');
}
var _reactForAtom2;
function _reactForAtom() {
return _reactForAtom2 = require('react-for-atom');
}
var _Block2;
function _Block() {
return _Block2 = require('./Block');
}
var _AtomInput2;
function _AtomInput() {
return _AtomInput2 = require('./AtomInput');
}
var _AtomTextEditor2;
function _AtomTextEditor() {
return _AtomTextEditor2 = require('./AtomTextEditor');
}
var AtomInputExample = function AtomInputExample() {
return (_reactForAtom2 || _reactForAtom()).React.createElement(
'div',
null,
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
disabled: false,
initialValue: 'atom input',
placeholderText: 'placeholder text'
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
disabled: true,
initialValue: 'disabled atom input',
placeholderText: 'placeholder text'
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
initialValue: 'xs atom input',
placeholderText: 'placeholder text',
size: 'xs'
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
initialValue: 'sm atom input',
placeholderText: 'placeholder text',
size: 'sm'
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
initialValue: 'lg atom input',
placeholderText: 'placeholder text',
size: 'lg'
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
initialValue: 'unstyled atom input',
placeholderText: 'placeholder text',
unstyled: true
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomInput2 || _AtomInput()).AtomInput, {
initialValue: 'atom input with custom width',
placeholderText: 'placeholder text',
width: 200
})
)
);
};
var buffer1 = new (_atom2 || _atom()).TextBuffer({
text: '/**\n * Hi!\n */\n\n// I am a TextBuffer.\nconst a = 42;'
});
var buffer2 = new (_atom2 || _atom()).TextBuffer({
text: '/**\n * Hi!\n */\n\n// I am a read-only, gutter-less TextBuffer.\nconst a = 42;'
});
var editorWrapperStyle = {
display: 'flex',
flexGrow: 1,
height: '12em',
boxShadow: '0 0 20px 0 rgba(0, 0, 0, 0.3)'
};
var AtomTextEditorExample = function AtomTextEditorExample() {
return (_reactForAtom2 || _reactForAtom()).React.createElement(
(_Block2 || _Block()).Block,
null,
(_reactForAtom2 || _reactForAtom()).React.createElement(
'div',
{ style: editorWrapperStyle },
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomTextEditor2 || _AtomTextEditor()).AtomTextEditor, {
gutterHidden: false,
readOnly: false,
syncTextContents: false,
autoGrow: false,
path: 'aJavaScriptFile.js',
textBuffer: buffer1
})
),
(_reactForAtom2 || _reactForAtom()).React.createElement(
'div',
{ style: _extends({}, editorWrapperStyle, { marginTop: '2em' }) },
(_reactForAtom2 || _reactForAtom()).React.createElement((_AtomTextEditor2 || _AtomTextEditor()).AtomTextEditor, {
gutterHidden: true,
readOnly: true,
syncTextContents: false,
autoGrow: false,
path: 'aJavaScriptFile.js',
textBuffer: buffer2
})
)
);
};
var TextInputExamples = {
sectionName: 'Text Inputs',
description: '',
examples: [{
title: 'AtomInput',
component: AtomInputExample
}, {
title: 'AtomTextEditor',
component: AtomTextEditorExample
}]
};
exports.TextInputExamples = TextInputExamples;