diff --git a/.eslintignore b/.eslintignore index 6578c3edd84b..c516d7511b78 100644 --- a/.eslintignore +++ b/.eslintignore @@ -29,5 +29,4 @@ target /packages/osd-test/src/functional_test_runner/__tests__/fixtures/ /packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/ /packages/osd-ui-framework/dist -/packages/osd-ui-framework/doc_site/build /packages/osd-ui-shared-deps/flot_charts diff --git a/.eslintrc.js b/.eslintrc.js index f1d6f30a527e..0786eee66228 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -393,7 +393,6 @@ module.exports = { { files: [ '**/public/**/*.js', - 'packages/osd-ui-framework/doc_site/src/**/*.js', 'src/fixtures/**/*.js', // TODO: this directory needs to be more obviously "public" (or go away) ], settings: { @@ -433,7 +432,6 @@ module.exports = { { files: [ 'packages/osd-ui-framework/**/*.test.js', - 'packages/osd-ui-framework/doc_site/**/*.js', 'packages/osd-ui-framework/Gruntfile.js', 'packages/osd-opensearch/src/**/*.js', 'packages/osd-interpreter/tasks/**/*.js', diff --git a/.gitignore b/.gitignore index d516495bceba..01c2aaeaf9ef 100644 --- a/.gitignore +++ b/.gitignore @@ -39,8 +39,6 @@ selenium *.swp *.swo *.out -/packages/osd-ui-framework/doc_site/build/* -!/packages/osd-ui-framework/doc_site/build/index.html package-lock.json .yo-rc.json .vscode diff --git a/package.json b/package.json index 6ec4df5157dc..7437954f6d53 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,7 @@ "lint:es": "node scripts/eslint", "lint:sass": "node scripts/sasslint", "makelogs": "node scripts/makelogs", - "uiFramework:start": "cd packages/osd-ui-framework && yarn docSiteStart", - "uiFramework:build": "cd packages/osd-ui-framework && yarn docSiteBuild", + "uiFramework:compileCss": "cd packages/osd-ui-framework && yarn compileCss", "osd:watch": "node scripts/opensearch_dashboards --dev --logging.json=false", "build:types": "rm -rf ./target/types && tsc --p tsconfig.types.json", "docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept", diff --git a/packages/osd-ui-framework/Gruntfile.js b/packages/osd-ui-framework/Gruntfile.js index bf94c32727b9..c5e8d6d83d2e 100644 --- a/packages/osd-ui-framework/Gruntfile.js +++ b/packages/osd-ui-framework/Gruntfile.js @@ -33,11 +33,6 @@ const sass = require('node-sass'); const postcss = require('postcss'); const postcssConfig = require('@osd/optimizer/postcss.config.js'); -const chokidar = require('chokidar'); -const { debounce } = require('lodash'); - -const platform = require('os').platform(); -const isPlatformWindows = /^win/.test(platform); module.exports = function (grunt) { grunt.initConfig({ @@ -73,122 +68,18 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.registerTask('prodBuild', ['clean:target', 'copy:makeProdBuild', 'babel:prodBuild']); - - grunt.registerTask('docSiteBuild', function () { - const done = this.async(); - - const serverCmd = { - cmd: isPlatformWindows ? '.\\node_modules\\.bin\\webpack.cmd' : './node_modules/.bin/webpack', - args: [ - '-p', - '--config=doc_site/webpack.config.js', - '--devtool=null', // Prevent the source map from being generated - ], - opts: { stdio: 'inherit' }, - }; - - const uiFrameworkServerBuild = new Promise((resolve, reject) => { - grunt.util.spawn(serverCmd, (error, result, code) => { - if (error || code !== 0) { - const message = result.stderr || result.stdout; - - grunt.log.error(message); - - return reject(); - } - - grunt.log.writeln(result); - - resolve(); - }); - }); - - uiFrameworkServerBuild.then(done); - }); - - grunt.registerTask('docSiteStart', function () { - const done = this.async(); - Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done); - }); - grunt.registerTask('compileCssLight', function () { - const done = this.async(); - uiFrameworkCompileLight().then(done); - }); + grunt.registerTask('prodBuild', ['clean:target', 'copy:makeProdBuild', 'babel:prodBuild']); - grunt.registerTask('compileCssDark', function () { + grunt.registerTask('compileCss', function () { const done = this.async(); - uiFrameworkCompileDark().then(done); + Promise.all([ + uiFrameworkCompile('src/kui_light.scss', 'dist/kui_light.css'), + uiFrameworkCompile('src/kui_dark.scss', 'dist/kui_dark.css'), + ]).then(done); }); - function uiFrameworkServerStart() { - const serverCmd = { - cmd: isPlatformWindows - ? '.\\node_modules\\.bin\\webpack-dev-server.cmd' - : './node_modules/.bin/webpack-dev-server', - args: [ - '--config=doc_site/webpack.config.js', - '--hot', - '--inline', - '--content-base=doc_site/build', - '--host=0.0.0.0', - '--port=8020', - ], - opts: { stdio: 'inherit' }, - }; - - return new Promise((resolve, reject) => { - grunt.util.spawn(serverCmd, (error, result, code) => { - if (error || code !== 0) { - const message = result.stderr || result.stdout; - - grunt.log.error(message); - - return reject(); - } - - grunt.log.writeln(result); - - resolve(); - }); - }); - } - - function uiFrameworkCompileLight() { - const src = 'src/kui_light.scss'; - const dest = 'dist/kui_light.css'; - - return new Promise((resolve) => { - sass.render( - { - file: src, - }, - function (error, result) { - if (error) { - grunt.log.error(error); - } - - postcss([postcssConfig]) - .process(result.css, { from: src, to: dest }) - .then((result) => { - grunt.file.write(dest, result.css); - - if (result.map) { - grunt.file.write(`${dest}.map`, result.map); - } - - resolve(); - }); - } - ); - }); - } - - function uiFrameworkCompileDark() { - const src = 'src/kui_dark.scss'; - const dest = 'dist/kui_dark.css'; - + function uiFrameworkCompile(src, dest) { return new Promise((resolve) => { sass.render( { @@ -214,39 +105,4 @@ module.exports = function (grunt) { ); }); } - - function uiFrameworkWatch() { - const debouncedCompile = debounce( - () => { - // Compile the SCSS in a separate process because node-sass throws a fatal error if it fails - // to compile. - grunt.util.spawn( - { - cmd: isPlatformWindows - ? '.\\node_modules\\.bin\\grunt.cmd' - : './node_modules/.bin/grunt', - args: ['compileCssLight', 'compileCssDark'], - }, - (error, result) => { - if (error) { - grunt.log.error(result.stdout); - } else { - grunt.log.writeln(result); - } - } - ); - }, - 400, - { leading: true } - ); - - return new Promise(() => { - debouncedCompile(); - - chokidar.watch('src', { ignoreInitial: true }).on('all', (event, path) => { - grunt.log.writeln(event, path); - debouncedCompile(); - }); - }); - } }; diff --git a/packages/osd-ui-framework/README.md b/packages/osd-ui-framework/README.md index f0b92f547fc6..fbc4f819acc2 100644 --- a/packages/osd-ui-framework/README.md +++ b/packages/osd-ui-framework/README.md @@ -6,12 +6,7 @@ This framework was used to build legacy layouts in Kibana 5.x and 6.x and is rep ## Documentation -Compile the CSS with `./node_modules/grunt/bin/grunt uiFramework:compileCss` (OS X) or -`.\node_modules\grunt\bin\grunt uiFramework:compileCss` (Windows). - -You can view interactive documentation by running `yarn uiFramework:start` and then visiting -[http://localhost:8020/](http://localhost:8020/). This will also start watching the SCSS files, and will recompile the CSS -automatically for you when you make changes. +Compile the CSS with `yarn uiFramework:compileCss`. You can run `node scripts/jest --watch` to watch for changes and run the tests as you code. diff --git a/packages/osd-ui-framework/doc_site/build/index.html b/packages/osd-ui-framework/doc_site/build/index.html deleted file mode 100644 index aed4fcf3ba4e..000000000000 --- a/packages/osd-ui-framework/doc_site/build/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - -
- - - diff --git a/packages/osd-ui-framework/doc_site/src/actions/action_types.js b/packages/osd-ui-framework/doc_site/src/actions/action_types.js deleted file mode 100644 index e134c123c47d..000000000000 --- a/packages/osd-ui-framework/doc_site/src/actions/action_types.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import keyMirror from 'keymirror'; - -export default keyMirror({ - // Source code viewer actions - OPEN_CODE_VIEWER: null, - CLOSE_CODE_VIEWER: null, - - // Sandbox actions - OPEN_SANDBOX: null, - CLOSE_SANDBOX: null, - - // Example nav actions - REGISTER_SECTION: null, - UNREGISTER_SECTION: null, -}); diff --git a/packages/osd-ui-framework/doc_site/src/actions/code_viewer_actions.js b/packages/osd-ui-framework/doc_site/src/actions/code_viewer_actions.js deleted file mode 100644 index 825389441718..000000000000 --- a/packages/osd-ui-framework/doc_site/src/actions/code_viewer_actions.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import ActionTypes from './action_types'; - -export const openCodeViewer = (source, title) => ({ - type: ActionTypes.OPEN_CODE_VIEWER, - source, - title, -}); - -export const closeCodeViewer = () => ({ - type: ActionTypes.CLOSE_CODE_VIEWER, -}); diff --git a/packages/osd-ui-framework/doc_site/src/actions/example_nav_actions.js b/packages/osd-ui-framework/doc_site/src/actions/example_nav_actions.js deleted file mode 100644 index f5245f81f6e9..000000000000 --- a/packages/osd-ui-framework/doc_site/src/actions/example_nav_actions.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import ActionTypes from './action_types'; - -export const registerSection = (id, name) => ({ - type: ActionTypes.REGISTER_SECTION, - id, - name, -}); - -export const unregisterSection = (id) => ({ - type: ActionTypes.UNREGISTER_SECTION, - id, -}); diff --git a/packages/osd-ui-framework/doc_site/src/actions/index.js b/packages/osd-ui-framework/doc_site/src/actions/index.js deleted file mode 100644 index fc10a9e4c0f8..000000000000 --- a/packages/osd-ui-framework/doc_site/src/actions/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export { openCodeViewer, closeCodeViewer } from './code_viewer_actions'; - -export { openSandbox, closeSandbox } from './sandbox_actions'; - -export { registerSection, unregisterSection } from './example_nav_actions'; diff --git a/packages/osd-ui-framework/doc_site/src/actions/sandbox_actions.js b/packages/osd-ui-framework/doc_site/src/actions/sandbox_actions.js deleted file mode 100644 index 5c250982b173..000000000000 --- a/packages/osd-ui-framework/doc_site/src/actions/sandbox_actions.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import ActionTypes from './action_types'; - -export const openSandbox = () => ({ - type: ActionTypes.OPEN_SANDBOX, -}); - -export const closeSandbox = () => ({ - type: ActionTypes.CLOSE_SANDBOX, -}); diff --git a/packages/osd-ui-framework/doc_site/src/components/guide/_guide.scss b/packages/osd-ui-framework/doc_site/src/components/guide/_guide.scss deleted file mode 100644 index 64c5a63cf207..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide/_guide.scss +++ /dev/null @@ -1,108 +0,0 @@ -html { - height: 100%; -} - -.guideBody { - height: 100%; - background-color: $euiColorFullShade; - margin: 0; - min-width: $guideMinWidth; -} - -/** - * 1. Expand container to fit the page if the content is shorter than the page, or expand with the - * content if it's taller than the page. - */ -.guide { - display: flex; - min-height: 100%; /* 1 */ -} - -.guideContent { - display: flex; - flex-direction: column; - flex: 1 1 auto; - padding-top: $guideNavHeight; - background-color: $guideBaseBackgroundColor; - transition: - padding-top $guideChromeTransition, - padding-right $guideCodeViewerTransition, - opacity $guideCodeViewerTransition; - - &.is-code-viewer-open { - padding-right: $guideCodeViewerWidth; - - @include whenNarrowerThan($guideNormalBreakpoint) { - padding-right: $guideCodeViewerSmallWidth; - } - } - - .is-guide-nav-open + & { - opacity: 0.7; - } - - &.is-chrome-hidden { - padding-top: 0; - } -} - -@media only screen and (max-width: 1300px) { - .guideHomePage { - justify-content: flex-start !important; - - .guideContentPage__content { - margin-left: 250px; - } - } -} - -.guideContentPage { - position: relative; - display: flex; - justify-content: center; - flex: 1 0 auto; - background-color: $euiColorEmptyShade; -} - - .guideContentPage__hint { - position: absolute; - top: 0; - left: 0; - width: 100%; - max-width: 260px; - max-height: 500px; - padding: 30px; - margin: 20px; - border-radius: 4px; - background-color: $euiColorLightestShade; - line-height: $guideLineHeight; - } - - .guideContentPage__content { - width: 100%; - max-width: 800px; - padding: 30px 60px; - } - -.guideHintArrow { - position: absolute; - top: -15px; - left: 12px; - background-image: url("images/hint-arrow.svg"); - width: 26px; - height: 40px; - background-repeat: no-repeat; - background-size: contain; -} - -.guideWarning { - border-left: 5px solid $euiColorAccent; - margin-top: 19px; - padding: 0 14px; - line-height: 21px; - color: $euiColorAccent; -} - -.guideBreak { - border: none; -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_code/_guide_code.scss b/packages/osd-ui-framework/doc_site/src/components/guide_code/_guide_code.scss deleted file mode 100644 index 14fdae066c11..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_code/_guide_code.scss +++ /dev/null @@ -1,6 +0,0 @@ -.guideCode { - padding: 2px 4px; - font-family: 'Ubuntu Mono', monospace; - background-color: $euiColorLightestShade; - color: $euiColorDarkShade; -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_code/guide_code.js b/packages/osd-ui-framework/doc_site/src/components/guide_code/guide_code.js deleted file mode 100644 index 3d570d514585..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_code/guide_code.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -export const GuideCode = (props) => {props.children}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/_guide_code_viewer.scss b/packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/_guide_code_viewer.scss deleted file mode 100644 index a4dc2eecc57d..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/_guide_code_viewer.scss +++ /dev/null @@ -1,113 +0,0 @@ -.guideCodeViewer { - position: fixed; - top: $guideNavHeight; - right: 0; - bottom: 0; - width: $guideCodeViewerWidth; - padding: 6px 0 40px; - background-color: $euiColorEmptyShade; - transform: translateX($guideCodeViewerWidth); - transition: transform $guideCodeViewerTransition; - overflow: auto; - border-left: $euiBorderThin; - - @include scrollbar; - - @include whenNarrowerThan($guideNormalBreakpoint) { - width: $guideCodeViewerSmallWidth; - } - - &.is-code-viewer-open { - transform: translateX(0); - } -} - - .guideCodeViewer__header { - padding: 0 20px 6px; - line-height: $guideLineHeight; - border-bottom: $euiBorderThin; - font-size: 14px; - font-weight: 700; - margin-bottom: 10px; - } - - .guideCodeViewer__closeButton { - position: absolute; - top: 0; - right: 10px; - cursor: pointer; - padding: 10px; - border-radius: 3px; - color: $guideTextColor; - - &:hover { - color: $guideLinkHoverColor; - } - } - - .guideCodeViewer__title { - padding: 0 20px 6px; - border-bottom: $euiBorderThin; - line-height: $guideLineHeight; - font-size: 14px; - } - - .guideCodeViewer__content { - margin: 0 0 16px; - } - -// HLJS - -.hljs { - display: block; - padding: 15px 20px; - color: $euiColorDarkShade; - font-size: 14px; - line-height: 1.3; - font-family: 'Ubuntu Mono', monospace; -} - -.hljs-keyword { - color: #b58900; -} - -.hljs-function { - .hljs-keyword { - color: #268bd2; - } - - .hljs-title { - color: #7441c6; - } -} - -.hljs-built_in { - color: #268bd2; -} - -.hljs-string { - color: #36958e; -} - -.hljs-comment { - color: #9d9d9d; -} - -.hljs-number, -.hljs-literal { - color: #d84a7e; -} - -.hljs-tag { - .hljs-name { - color: #63a35c; - } - - .hljs-attr { - color: #795da3; - } - - .hljs-string { - color: #df5000; - } -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/guide_code_viewer.js b/packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/guide_code_viewer.js deleted file mode 100644 index 4438ef98c769..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/guide_code_viewer.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -import classNames from 'classnames'; -import hljs from 'highlight.js'; - -export class GuideCodeViewer extends Component { - constructor(props) { - super(props); - } - - componentDidUpdate() { - if (this.refs.html) { - hljs.highlightBlock(this.refs.html); - } - - if (this.refs.javascript) { - hljs.highlightBlock(this.refs.javascript); - } - } - - renderSection(type, code) { - const typeToCodeClassMap = { - JavaScript: 'javascript', - HTML: 'html', - }; - - const codeClass = typeToCodeClassMap[type]; - - if (code) { - return ( -
-
{type}
-
-            
-              {code}
-            
-          
-
- ); - } - } - - render() { - const classes = classNames('guideCodeViewer', { - 'is-code-viewer-open': this.props.isOpen, - }); - - const codeSections = this.props.source.map((sourceObject) => - this.renderSection(sourceObject.type, sourceObject.code) - ); - - return ( -
-
{this.props.title}
- -
- - {codeSections} -
- ); - } -} - -GuideCodeViewer.propTypes = { - isOpen: PropTypes.bool, - onClose: PropTypes.func, - title: PropTypes.string, - source: PropTypes.array, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_components.scss b/packages/osd-ui-framework/doc_site/src/components/guide_components.scss deleted file mode 100644 index 42e55ac6a00f..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_components.scss +++ /dev/null @@ -1,62 +0,0 @@ -$guideVerticalRhythm: $euiSize; -$guideLineHeight: $euiSizeL; -$guideNavHeight: 60px; -$guideSideNavWidth: 400px; -$guideSideNavSmallWidth: 220px; -$guideCodeViewerWidth: 660px; -$guideCodeViewerSmallWidth: 520px; -$guideCodeViewerTransition: 0.2s ease; -$guideChromeTransition: 0.3s ease; - -// Colors -$guideBaseBackgroundColor: $euiColorLightestShade; -$guidePanelBackgroundColor: $euiColorEmptyShade; -$guideTextColor: $euiColorDarkestShade; -$guideLinkColor: $euiColorPrimary; -$guideLinkHoverColor: darken($euiColorPrimary, 10%); - -// Breakpoints -$guideMinWidth: 840px; -$guideNormalBreakpoint: 1900px; - -@mixin whenNarrowerThan($browserWidth) { - @media only screen and (max-width: #{$browserWidth}) { - @content; - } -} - -@mixin whenWiderThan($browserWidth) { - @media only screen and (min-width: #{$browserWidth}) { - @content; - } -} - -@mixin scrollbar($color: $euiBorderColor) { - &::-webkit-scrollbar { - width: 16px; - height: 16px; - } - - &::-webkit-scrollbar-thumb { - background-color: $color; - border: 6px solid transparent; - background-clip: content-box; - } - - &::-webkit-scrollbar-track { - background-color: transparent; - } -} - - -@import "guide/guide"; -@import "guide_code/guide_code"; -@import "guide_code_viewer/guide_code_viewer"; -@import "guide_demo/guide_demo"; -@import "guide_link/guide_link"; -@import "guide_nav/guide_nav"; -@import "guide_page/guide_page"; -@import "guide_page_side_nav/guide_page_side_nav"; -@import "guide_sandbox/guide_sandbox"; -@import "guide_section/guide_section"; -@import "guide_text/guide_text"; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_demo/_guide_demo.scss b/packages/osd-ui-framework/doc_site/src/components/guide_demo/_guide_demo.scss deleted file mode 100644 index e97cb0613995..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_demo/_guide_demo.scss +++ /dev/null @@ -1,23 +0,0 @@ -.guideDemo { - margin-top: $guideVerticalRhythm; -} - -.guideDemo--fullScreen { - width: 100%; - height: 100%; - margin-top: 0; -} - -.guideDemo__highlightGrid { - .kuiFlexItem { - background: transparentize($euiColorPrimary, .9); - padding: 16px; - } -} - -.guideDemo__highlightGridWrap { - .kuiFlexItem div { - background: transparentize($euiColorPrimary, .9); - padding: 16px; - } -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_demo/guide_demo.js b/packages/osd-ui-framework/doc_site/src/components/guide_demo/guide_demo.js deleted file mode 100644 index bb106b48b163..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_demo/guide_demo.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -import classNames from 'classnames'; - -export class GuideDemo extends Component { - componentDidMount() { - this.update(); - } - - componentDidUpdate() { - this.update(); - } - - update() { - // We'll just render the children if we have them. - if (this.props.children) { - return; - } - - // Inject HTML. - this.content.innerHTML = this.props.html; // eslint-disable-line no-unsanitized/property - - // Inject JS. - const js = document.createElement('script'); - js.type = 'text/javascript'; - js.innerHTML = this.props.js; // eslint-disable-line no-unsanitized/property - this.content.appendChild(js); - - // Inject CSS. - const css = document.createElement('style'); - css.innerHTML = this.props.css; // eslint-disable-line no-unsanitized/property - this.content.appendChild(css); - } - - render() { - const { - isFullScreen, - children, - className, - js, // eslint-disable-line no-unused-vars - html, // eslint-disable-line no-unused-vars - css, // eslint-disable-line no-unused-vars - ...rest - } = this.props; - - const classes = classNames('guideDemo', className, { - 'guideDemo--fullScreen': isFullScreen, - }); - - return ( -
(this.content = c)} {...rest}> - {children} -
- ); - } -} - -GuideDemo.propTypes = { - children: PropTypes.node, - js: PropTypes.string.isRequired, - html: PropTypes.string.isRequired, - css: PropTypes.string.isRequired, - isFullScreen: PropTypes.bool.isRequired, -}; - -GuideDemo.defaultProps = { - js: '', - html: '', - css: '', - isFullScreen: false, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_link/_guide_link.scss b/packages/osd-ui-framework/doc_site/src/components/guide_link/_guide_link.scss deleted file mode 100644 index 921ecac96b9b..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_link/_guide_link.scss +++ /dev/null @@ -1,9 +0,0 @@ -.guideLink { - color: $guideLinkColor; - text-decoration: none; - - &:hover { - color: $guideLinkHoverColor; - text-decoration: underline; - } -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_link/guide_link.js b/packages/osd-ui-framework/doc_site/src/components/guide_link/guide_link.js deleted file mode 100644 index 48509d5cc3d4..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_link/guide_link.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -export const GuideLink = (props) => ( - - {props.children} - -); diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_nav/_guide_nav.scss b/packages/osd-ui-framework/doc_site/src/components/guide_nav/_guide_nav.scss deleted file mode 100644 index a0bfd08957e8..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_nav/_guide_nav.scss +++ /dev/null @@ -1,205 +0,0 @@ -.guideNav { - display: flex; - flex-direction: column; - position: fixed; - z-index: 10000; - top: 0; - left: 0; - right: 0; - min-width: $guideMinWidth; - height: $guideNavHeight; - border-bottom: $euiBorderThin; - color: $guideTextColor; - background-color: $guidePanelBackgroundColor; - transition: - top $guideChromeTransition, - height 0.3s ease, - box-shadow 0.3s linear; - overflow: hidden; - @include euiBottomShadowMedium; - - &.is-guide-nav-open { - height: 100%; - @include euiBottomShadow; - } - - &.is-chrome-hidden { - top: -$guideNavHeight; - } -} - - .guideNav__showButton { - position: fixed; - z-index: 9999; - top: 5px; - right: 5px; - font-size: 10px; - opacity: 0; - transition: opacity $guideChromeTransition; - - .is-chrome-hidden & { - opacity: 1; - } - } - - .guideNav__header { - position: relative; - flex: 0 0 auto; - display: flex; - align-items: center; - height: 60px; - padding: 0 20px; - } - - .guideNav__menu { - cursor: pointer; - margin-right: 10px; - padding: 10px; - border-radius: 3px; - - &.is-menu-button-pinned, - &:hover { - background-color: rgba(black, 0.05); - } - - &:active { - background-color: rgba(black, 0.2); - box-shadow: inset 0 2px 8px rgba(black, 0.1); - } - } - - .guideNav__title { - color: $guideTextColor; - text-decoration: none; - font-size: 18px; - } - - .guideNav__version { - margin-left: 10px; - font-weight: 300; - font-size: 14px; - } - - // TODO: [RENAMEME] replacement background-image might be needed - .guideNav__opensearchLogo { - position: absolute; - background-image: url("images/react-logo.svg"); - width: 106px; - height: 36px; - background-repeat: no-repeat; - background-size: contain; - left: 50%; - transform: translateX(-50%); - } - -.guideNavSearch { - margin: 0 20px; - width: 100%; - max-width: 400px; - font-size: 16px; - padding: 8px; - border: 1px solid rgba($guideTextColor, 0.2); - - &:focus { - border-color: $guideLinkHoverColor; - outline: none; - } -} - -/** - * 1. Height of the searchbox. - */ -.guideNavItemsContainer { - @include scrollbar; - display: flex; - overflow: auto; - min-height: calc(100vh - #{$guideNavHeight + 40px}); /* 1 */ -} - -.guideNavItems { - display: flex; - flex-direction: column; - align-items: flex-start; - flex-wrap: wrap; - align-content: flex-start; -} - -.guideNavSectionTitle { - min-width: 200px; - padding: 8px 20px; - margin-left: 5px; - font-size: 14px; - line-height: 20px; - font-weight: 700; -} - -.guideNavItem, -.guideNavNoItems { - min-width: 200px; - font-size: 20px; - line-height: 20px; - padding: 8px 20px; - margin-left: 5px; -} - -.guideNavItem { - display: flex; - align-items: center; -} - - .guideNavItem__link { - color: $guideTextColor; - text-decoration: none; - - &:hover { - color: $guideLinkHoverColor; - } - } - - .guideNavItem__reactLogo { - margin-left: 10px; - background-image: url("images/react-logo.svg"); - width: 24px; - height: 22px; - background-repeat: no-repeat; - background-size: contain; - } - -.guideNavNoItems { - color: rgba($guideTextColor, 0.5); - margin-top: 0; - margin-bottom: 0; -} - -.guideNavPaginationButtons { - position: absolute; - top: 20px; - right: 10px; -} - -.guideNavPaginationButton { - appearance: none; - border: none; - line-height: 10px; - padding: 4px 20px; - color: $guideLinkHoverColor; - background-color: $euiColorEmptyShade; - border: 1px solid $guideLinkHoverColor; - border-radius: 3px; - cursor: pointer; - - &:hover, - &:active { - background-color: $euiColorLightestShade; - } - - &.guideNavPaginationButton-isDisabled { - pointer-events: none; - color: rgba($guideTextColor, 0.25); - border-color: rgba($guideTextColor, 0.25); - } - - & + & { - margin-left: 10px; - } -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_nav/guide_nav.js b/packages/osd-ui-framework/doc_site/src/components/guide_nav/guide_nav.js deleted file mode 100644 index d97bbb75a811..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_nav/guide_nav.js +++ /dev/null @@ -1,226 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -import { Link } from 'react-router'; // eslint-disable-line - -import classNames from 'classnames'; - -export class GuideNav extends Component { - constructor(props) { - super(props); - - const currentRoute = props.routes[1]; - const nextRoute = this.props.getNextRoute(currentRoute.name); - const previousRoute = this.props.getPreviousRoute(currentRoute.name); - - this.state = { - search: '', - nextRoute, - previousRoute, - }; - - this.onSearchChange = this.onSearchChange.bind(this); - } - - onSearchChange(event) { - this.setState({ - search: event.target.value, - }); - } - - UNSAFE_componentWillReceiveProps(nextProps) { - const currentRoute = nextProps.routes[1]; - const nextRoute = this.props.getNextRoute(currentRoute.name); - const previousRoute = this.props.getPreviousRoute(currentRoute.name); - - this.setState({ - nextRoute, - previousRoute, - }); - } - - renderNoItems(name) { - return

{`No ${name} match your search`}

; - } - - renderPagination() { - const previousClasses = classNames('guideNavPaginationButton', { - 'guideNavPaginationButton-isDisabled': !this.state.previousRoute, - }); - - const previousButton = ( - - - - ); - - const nextClasses = classNames('guideNavPaginationButton', { - 'guideNavPaginationButton-isDisabled': !this.state.nextRoute, - }); - - const nextButton = ( - - - - ); - - let hideChromeButton; - - if (this.props.isSandbox) { - hideChromeButton = ( - - ); - } - - return ( -
- {hideChromeButton} - {previousButton} - {nextButton} -
- ); - } - - render() { - const classes = classNames('guideNav', { - 'is-guide-nav-open': this.props.isNavOpen, - 'is-chrome-hidden': !this.props.isChromeVisible, - }); - - const buttonClasses = classNames('guideNav__menu fa fa-bars', { - 'is-menu-button-pinned': this.props.isNavOpen, - }); - - const componentNavItems = this.props.components - .filter((item) => item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1) - .map((item, index) => { - const icon = item.hasReact ?
: undefined; - return ( -
- - {item.name} - - - {icon} -
- ); - }); - - const sandboxNavItems = this.props.sandboxes - .filter((item) => item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1) - .map((item, index) => { - const icon = item.hasReact ?
: undefined; - return ( -
- - {item.name} - - - {icon} -
- ); - }); - - return ( -
- - ); - } -} - -GuideNav.propTypes = { - isChromeVisible: PropTypes.bool, - isNavOpen: PropTypes.bool, - isSandbox: PropTypes.bool, - onToggleNav: PropTypes.func, - onHideChrome: PropTypes.func, - onShowChrome: PropTypes.func, - onClickNavItem: PropTypes.func, - version: PropTypes.string, - routes: PropTypes.array, - getNextRoute: PropTypes.func, - getPreviousRoute: PropTypes.func, - components: PropTypes.array, - sandboxes: PropTypes.array, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_page/_guide_page.scss b/packages/osd-ui-framework/doc_site/src/components/guide_page/_guide_page.scss deleted file mode 100644 index 92b55359fdaa..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_page/_guide_page.scss +++ /dev/null @@ -1,42 +0,0 @@ -.guidePage { - display: flex; - flex: 1 0 auto; - padding-bottom: 20px; -} - -.guidePageBody { - $topMargin: 40px; - $leftMargin: 120px + $guideSideNavWidth; - $rightMargin: 80px; - $scrollBarWidth: 20px; - - background-color: $guidePanelBackgroundColor; - border: $euiBorderThin; - border-radius: 4px; - flex: 1 1 auto; - padding: 40px 60px; - margin: $topMargin $rightMargin 0 $leftMargin; - width: calc(100vw - #{$leftMargin + $rightMargin + $scrollBarWidth}); - - .is-code-viewer-open & { - width: calc(100vw - #{$leftMargin + $rightMargin + $scrollBarWidth + $guideCodeViewerWidth}); - } - - @include whenNarrowerThan($guideNormalBreakpoint) { - $leftMargin: 20px + $guideSideNavSmallWidth; - $rightMargin: 20px; - - margin: $topMargin $rightMargin 0 $leftMargin; - width: calc(100vw - #{$leftMargin + $rightMargin + $scrollBarWidth}); - - .is-code-viewer-open & { - width: calc(100vw - #{$leftMargin + $rightMargin + $scrollBarWidth + $guideCodeViewerSmallWidth}); - } - } -} - -.guidePageKillScreen { - background-color: tintOrShade($euiColorDanger, 90%, 70%); - padding: $euiSizeL; - margin-bottom: $euiSizeL; -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_page/guide_page.js b/packages/osd-ui-framework/doc_site/src/components/guide_page/guide_page.js deleted file mode 100644 index 07441e4620b2..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_page/guide_page.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -import { GuidePageSideNav, GuidePageSideNavItem } from '../'; - -export class GuidePage extends Component { - constructor(props) { - super(props); - - this.onClickLink = this.onClickLink.bind(this); - } - - onClickLink(id) { - // Scroll to element. - // eslint-disable-next-line no-undef - $('html, body').animate( - { - // eslint-disable-next-line no-undef - scrollTop: $(`#${id}`).offset().top - 100, - }, - 250 - ); - } - - renderSideNavMenu() { - // Traverse sections and build side nav from it. - return this.props.sections.map((section, index) => { - return ( - - {section.name} - - ); - }); - } - - render() { - return ( - - ); - } -} - -GuidePage.propTypes = { - children: PropTypes.any, - title: PropTypes.string, - sections: PropTypes.array, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_page/guide_page_container.js b/packages/osd-ui-framework/doc_site/src/components/guide_page/guide_page_container.js deleted file mode 100644 index 613418b263dc..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_page/guide_page_container.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { connect } from 'react-redux'; -import { getSections } from '../../store'; -import { GuidePage } from './guide_page'; - -const mapStateToProps = (state) => ({ - sections: getSections(state), -}); - -export const GuidePageContainer = connect(mapStateToProps)(GuidePage); diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/_guide_page_side_nav.scss b/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/_guide_page_side_nav.scss deleted file mode 100644 index 747464719e84..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/_guide_page_side_nav.scss +++ /dev/null @@ -1,44 +0,0 @@ -.guidePageSideNav { - position: fixed; - top: 70px; - left: 10px; - bottom: 10px; - width: $guideSideNavWidth; - overflow: auto; - z-index: 100; - padding: 12px 20px; - - @include scrollbar; - - @include whenNarrowerThan($guideNormalBreakpoint) { - width: $guideSideNavSmallWidth; - } -} - - .guidePageSideNav__title { - padding-bottom: 10px; - margin-bottom: 7px; - font-size: 22px; - line-height: $guideLineHeight; - opacity: 0.8; - } - - .guidePageSideNavMenu { - line-height: $guideLineHeight; - } - - .guidePageSideNavMenu__item { - & + & { - margin-top: 6px; - } - } - - .guidePageSideNavMenu__itemLink { - cursor: pointer; - color: $guideTextColor; - text-decoration: none; - - &:hover { - color: $guideLinkHoverColor; - } - } diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/guide_page_side_nav.js b/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/guide_page_side_nav.js deleted file mode 100644 index 37cb9acc2871..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/guide_page_side_nav.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React from 'react'; - -export const GuidePageSideNav = (props) => { - return ( -
-
{props.title}
- -
{props.children}
-
- ); -}; - -GuidePageSideNav.propTypes = { - title: PropTypes.string, - children: PropTypes.any, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/guide_page_side_nav_item.js b/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/guide_page_side_nav_item.js deleted file mode 100644 index e776cc272357..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_page_side_nav/guide_page_side_nav_item.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -export class GuidePageSideNavItem extends Component { - constructor(props) { - super(props); - - this.onClick = this.onClick.bind(this); - } - - onClick() { - this.props.onClick(this.props.id); - } - - render() { - return ( -
-
- {this.props.children} -
-
- ); - } -} - -GuidePageSideNavItem.propTypes = { - id: PropTypes.string, - children: PropTypes.any, - onClick: PropTypes.func, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/_guide_sandbox.scss b/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/_guide_sandbox.scss deleted file mode 100644 index 9a13abd7e8e6..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/_guide_sandbox.scss +++ /dev/null @@ -1,10 +0,0 @@ -.guideSandbox { - width: 100%; - height: 100%; -} - -.guideSandboxCodeToggle { - position: fixed; - top: 70px; - right: 10px; -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox.js b/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox.js deleted file mode 100644 index ab0272fc9366..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { bindActionCreators } from 'redux'; -import { connect } from 'react-redux'; - -import { getIsSandbox } from '../../store'; - -import { openSandbox, closeSandbox } from '../../actions'; - -function mapStateToProps(state) { - return { - isSandbox: getIsSandbox(state), - }; -} - -function mapDispatchToProps(dispatch) { - const actions = { - openSandbox, - closeSandbox, - }; - - return bindActionCreators(actions, dispatch); -} - -class GuideSandboxComponent extends Component { - UNSAFE_componentWillMount() { - this.props.openSandbox(); - } - - componentWillUnmount() { - this.props.closeSandbox(); - } - - render() { - return
{this.props.children}
; - } -} - -GuideSandboxComponent.propTypes = { - openSandbox: PropTypes.func, - closeSandbox: PropTypes.func, -}; - -export const GuideSandbox = connect(mapStateToProps, mapDispatchToProps)(GuideSandboxComponent); diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle.js b/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle.js deleted file mode 100644 index aa52b5c1361a..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -export class GuideSandboxCodeToggle extends Component { - constructor(props) { - super(props); - this.onClickSource = this.onClickSource.bind(this); - } - - onClickSource() { - this.props.openCodeViewer(this.props.source, this.props.title); - } - - render() { - return ( - - ); - } -} - -GuideSandboxCodeToggle.propTypes = { - source: PropTypes.array, - title: PropTypes.string, - openCodeViewer: PropTypes.func, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle_container.js b/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle_container.js deleted file mode 100644 index 44e13c57c261..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_sandbox/guide_sandbox_code_toggle_container.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { connect } from 'react-redux'; - -import { GuideSandboxCodeToggle } from './guide_sandbox_code_toggle'; -import { openCodeViewer } from '../../actions'; - -export const GuideSandboxCodeToggleContainer = connect(null, { - openCodeViewer, -})(GuideSandboxCodeToggle); diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_section/_guide_section.scss b/packages/osd-ui-framework/doc_site/src/components/guide_section/_guide_section.scss deleted file mode 100644 index 62f3f1b1686e..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_section/_guide_section.scss +++ /dev/null @@ -1,39 +0,0 @@ -.guideSection { - margin-bottom: 40px; -} - - .guideSection__header { - display: flex; - justify-content: space-between; - align-items: center; - padding-bottom: 2px; - line-height: $guideLineHeight; - } - - .guideSection__title { - font-size: 18px; - font-weight: 700; - } - - .guideSection__sourceButton { - appearance: none; - border: none; - line-height: 10px; - padding: 4px 10px; - color: $guideLinkHoverColor; - background-color: $euiColorEmptyShade; - border: 1px solid $guideLinkHoverColor; - border-radius: 3px; - cursor: pointer; - transform: translateX(0); - transition: transform $guideChromeTransition; - - &:hover, - &:active { - background-color: $euiColorLightestShade; - } - - .is-chrome-hidden & { - transform: translateX(60px); - } - } diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section.js b/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section.js deleted file mode 100644 index 53e6eaab723e..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section.js +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -import Slugify from '../../services/string/slugify'; - -export class GuideSection extends Component { - constructor(props) { - super(props); - this.onClickSource = this.onClickSource.bind(this); - } - - getId() { - return Slugify.one(this.props.title); - } - - onClickSource() { - this.props.openCodeViewer(this.props.source, this.props.title); - } - - UNSAFE_componentWillMount() { - this.props.registerSection(this.getId(), this.props.title); - } - - componentWillUnmount() { - this.props.unregisterSection(this.getId()); - } - - render() { - return ( -
-
-
{this.props.title}
- -
- - {this.props.children} -
- ); - } -} - -GuideSection.propTypes = { - title: PropTypes.string, - source: PropTypes.array, - children: PropTypes.any, - openCodeViewer: PropTypes.func, - registerSection: PropTypes.func, - unregisterSection: PropTypes.func, -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section_container.js b/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section_container.js deleted file mode 100644 index eebd39c0e205..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section_container.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { connect } from 'react-redux'; - -import { GuideSection } from './guide_section'; -import { openCodeViewer, registerSection, unregisterSection } from '../../actions'; - -export const GuideSectionContainer = connect(null, { - openCodeViewer, - registerSection, - unregisterSection, -})(GuideSection); diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section_types.js b/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section_types.js deleted file mode 100644 index fa8c6273e528..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_section/guide_section_types.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export const GuideSectionTypes = { - JS: 'JavaScript', - HTML: 'HTML', -}; diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_text/_guide_text.scss b/packages/osd-ui-framework/doc_site/src/components/guide_text/_guide_text.scss deleted file mode 100644 index 11c6be092180..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_text/_guide_text.scss +++ /dev/null @@ -1,16 +0,0 @@ -.guideTitle { - font-weight: 700; - font-size: 22px; - line-height: 1.5; - margin: 0; -} - -.guideText { - font-size: 14px; - line-height: 1.5; - margin: $guideVerticalRhythm 0 0; -} - -.guideText--noMargin { - margin-top: 0; -} diff --git a/packages/osd-ui-framework/doc_site/src/components/guide_text/guide_text.js b/packages/osd-ui-framework/doc_site/src/components/guide_text/guide_text.js deleted file mode 100644 index f1ba5260efc8..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/guide_text/guide_text.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -export const GuideText = (props) =>
{props.children}
; diff --git a/packages/osd-ui-framework/doc_site/src/components/index.js b/packages/osd-ui-framework/doc_site/src/components/index.js deleted file mode 100644 index cff4ae154c61..000000000000 --- a/packages/osd-ui-framework/doc_site/src/components/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export { GuideCode } from './guide_code/guide_code'; -export { GuideCodeViewer } from './guide_code_viewer/guide_code_viewer'; -export { GuideDemo } from './guide_demo/guide_demo'; -export { GuideLink } from './guide_link/guide_link'; -export { GuideNav } from './guide_nav/guide_nav'; -export { GuidePageContainer as GuidePage } from './guide_page/guide_page_container'; -export { GuidePageSideNav } from './guide_page_side_nav/guide_page_side_nav'; -export { GuidePageSideNavItem } from './guide_page_side_nav/guide_page_side_nav_item'; -export { GuideSandbox } from './guide_sandbox/guide_sandbox'; -export { GuideSandboxCodeToggleContainer as GuideSandboxCodeToggle } from './guide_sandbox/guide_sandbox_code_toggle_container'; -export { GuideSectionContainer as GuideSection } from './guide_section/guide_section_container'; -export { GuideSectionTypes } from './guide_section/guide_section_types'; -export { GuideText } from './guide_text/guide_text'; diff --git a/packages/osd-ui-framework/doc_site/src/images/hint-arrow.svg b/packages/osd-ui-framework/doc_site/src/images/hint-arrow.svg deleted file mode 100644 index b78f16f4bef4..000000000000 --- a/packages/osd-ui-framework/doc_site/src/images/hint-arrow.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - arrow - Created with Sketch. - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/osd-ui-framework/doc_site/src/images/react-logo.svg b/packages/osd-ui-framework/doc_site/src/images/react-logo.svg deleted file mode 100644 index 360cb427c9e6..000000000000 --- a/packages/osd-ui-framework/doc_site/src/images/react-logo.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - react-logo - Created with Sketch. - - - - - \ No newline at end of file diff --git a/packages/osd-ui-framework/doc_site/src/index.js b/packages/osd-ui-framework/doc_site/src/index.js deleted file mode 100644 index 90605addb4ed..000000000000 --- a/packages/osd-ui-framework/doc_site/src/index.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -require('./main.scss'); - -import 'core-js/stable'; -import 'regenerator-runtime/runtime'; -import React from 'react'; -import ReactDOM from 'react-dom'; -import { Provider } from 'react-redux'; -import { Router, hashHistory } from 'react-router'; // eslint-disable-line - -// Store. -import configureStore from './store/configure_store'; - -// Guide views. -import AppContainer from './views/app_container'; -import { HomeView } from './views/home/home_view'; -import { NotFoundView } from './views/not_found/not_found_view'; - -import { Routes } from './services'; - -const store = configureStore(); - -const childRoutes = [].concat(Routes.getAppRoutes()); -childRoutes.push({ - path: '*', - component: NotFoundView, - name: 'Page Not Found', -}); - -const routes = [ - { - path: '/', - component: AppContainer, - indexRoute: { - component: HomeView, - source: 'views/home/HomeView', - }, - childRoutes, - }, -]; - -// Update document title with route name. -const onRouteEnter = (route) => { - const leafRoute = route.routes[route.routes.length - 1]; - document.title = leafRoute.name - ? `OpenSearch Dashboards UI Framework - ${leafRoute.name}` - : 'OpenSearch Dashboards UI Framework'; -}; - -const syncTitleWithRoutes = (routesList) => { - if (!routesList) return; - routesList.forEach((route) => { - route.onEnter = onRouteEnter; // eslint-disable-line no-param-reassign - if (route.indexRoute) { - // Index routes have a weird relationship with their "parent" routes, - // so it seems we need to give their own onEnter hooks. - route.indexRoute.onEnter = onRouteEnter; // eslint-disable-line no-param-reassign - } - syncTitleWithRoutes(route.childRoutes); - }); -}; - -syncTitleWithRoutes(routes); - -ReactDOM.render( - - - , - document.getElementById('guide') -); diff --git a/packages/osd-ui-framework/doc_site/src/main.scss b/packages/osd-ui-framework/doc_site/src/main.scss deleted file mode 100644 index 266a9eb7a933..000000000000 --- a/packages/osd-ui-framework/doc_site/src/main.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import '~@elastic/eui/src/themes/eui/eui_colors_dark'; -@import '~@elastic/eui/src/global_styling/functions/index'; -@import '~@elastic/eui/src/global_styling/variables/index'; -@import '~@elastic/eui/src/global_styling/mixins/index'; -@import '~@elastic/eui/src/global_styling/reset/index'; -@import '../../dist/kui_dark.css'; -@import './components/guide_components'; diff --git a/packages/osd-ui-framework/doc_site/src/services/example/create_example.js b/packages/osd-ui-framework/doc_site/src/services/example/create_example.js deleted file mode 100644 index ad4ad40c40a2..000000000000 --- a/packages/osd-ui-framework/doc_site/src/services/example/create_example.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* eslint import/named: 0 */ -import { GuideExample } from '../../components'; - -export default function creatExample(examples) { - class Example extends GuideExample { - constructor(props) { - super(props, examples); - } - } - - Example.propTypes = { - ...GuideExample.propTypes, - }; - - return Example; -} diff --git a/packages/osd-ui-framework/doc_site/src/services/index.js b/packages/osd-ui-framework/doc_site/src/services/index.js deleted file mode 100644 index 6b33d028f250..000000000000 --- a/packages/osd-ui-framework/doc_site/src/services/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export { renderToHtml } from './string/render_to_html'; - -export { default as createExample } from './example/create_example'; - -export { default as JsInjector } from './js_injector/js_injector'; - -export { default as Routes } from './routes/routes'; - -export { default as Slugify } from './string/slugify'; diff --git a/packages/osd-ui-framework/doc_site/src/services/js_injector/js_injector.js b/packages/osd-ui-framework/doc_site/src/services/js_injector/js_injector.js deleted file mode 100644 index 9d3bd62ff992..000000000000 --- a/packages/osd-ui-framework/doc_site/src/services/js_injector/js_injector.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import $ from 'jquery'; - -const ID_ATTRIBUTE = 'injected-js-tag-id'; - -export default { - inject(js, id) { - if (id) { - $(`[${ID_ATTRIBUTE}=${id}]`).remove(); - } - - const script = $(``); - $('body').append(script); - }, - - remove(id) { - $(`[${ID_ATTRIBUTE}=${id}]`).remove(); - }, -}; diff --git a/packages/osd-ui-framework/doc_site/src/services/routes/routes.js b/packages/osd-ui-framework/doc_site/src/services/routes/routes.js deleted file mode 100644 index e5c36f62d090..000000000000 --- a/packages/osd-ui-framework/doc_site/src/services/routes/routes.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import Slugify from '../string/slugify'; - -import BarExample from '../../views/bar/bar_example'; - -import ButtonExample from '../../views/button/button_example'; - -import CollapseButtonExample from '../../views/collapse_button/collapse_button_example'; - -import FormExample from '../../views/form/form_example'; - -import FormLayoutExample from '../../views/form_layout/form_layout_example'; - -import IconExample from '../../views/icon/icon_example'; - -import InfoPanelExample from '../../views/info_panel/info_panel_example'; - -import LinkExample from '../../views/link/link_example'; - -import LocalNavExample from '../../views/local_nav/local_nav_example'; - -import PagerExample from '../../views/pager/pager_example'; - -import PanelExample from '../../views/panel/panel_example'; - -import EmptyTablePromptExample from '../../views/empty_table_prompt/empty_table_prompt_example'; - -import StatusTextExample from '../../views/status_text/status_text_example'; - -import TableExample from '../../views/table/table_example'; - -import TabsExample from '../../views/tabs/tabs_example'; - -import ToolBarExample from '../../views/tool_bar/tool_bar_example'; - -import TypographyExample from '../../views/typography/typography_example'; - -import VerticalRhythmExample from '../../views/vertical_rhythm/vertical_rhythm_example'; - -import ViewSandbox from '../../views/view/view_sandbox'; - -// Component route names should match the component name exactly. -const components = [ - { - name: 'Bar', - component: BarExample, - hasReact: true, - }, - { - name: 'Button', - component: ButtonExample, - hasReact: true, - }, - { - name: 'CollapseButton', - component: CollapseButtonExample, - hasReact: true, - }, - { - name: 'EmptyTablePrompt', - component: EmptyTablePromptExample, - hasReact: true, - }, - { - name: 'Form', - component: FormExample, - }, - { - name: 'FormLayout', - component: FormLayoutExample, - hasReact: true, - }, - { - name: 'Icon', - component: IconExample, - }, - { - name: 'InfoPanel', - component: InfoPanelExample, - }, - { - name: 'Link', - component: LinkExample, - }, - { - name: 'LocalNav', - component: LocalNavExample, - hasReact: true, - }, - { - name: 'Pager', - component: PagerExample, - hasReact: true, - }, - { - name: 'Panel', - component: PanelExample, - }, - { - name: 'StatusText', - component: StatusTextExample, - }, - { - name: 'Table', - component: TableExample, - hasReact: true, - }, - { - name: 'Tabs', - component: TabsExample, - hasReact: true, - }, - { - name: 'ToolBar', - component: ToolBarExample, - hasReact: true, - }, - { - name: 'Typography', - component: TypographyExample, - }, - { - name: 'VerticalRhythm', - component: VerticalRhythmExample, - }, -]; - -const sandboxes = [ - { - name: 'View', - component: ViewSandbox, - }, -]; - -const allRoutes = components.concat(sandboxes); - -export default { - components: Slugify.each(components, 'name', 'path'), - sandboxes: Slugify.each(sandboxes, 'name', 'path'), - getAppRoutes: function getAppRoutes() { - return allRoutes; - }, - getPreviousRoute: function getPreviousRoute(routeName) { - const index = allRoutes.findIndex((item) => { - return item.name === routeName; - }); - - return index >= 0 ? allRoutes[index - 1] : undefined; - }, - getNextRoute: function getNextRoute(routeName) { - const index = allRoutes.findIndex((item) => { - return item.name === routeName; - }); - - return index < allRoutes.length - 1 ? allRoutes[index + 1] : undefined; - }, -}; diff --git a/packages/osd-ui-framework/doc_site/src/services/string/render_to_html.js b/packages/osd-ui-framework/doc_site/src/services/string/render_to_html.js deleted file mode 100644 index 747e411c20c9..000000000000 --- a/packages/osd-ui-framework/doc_site/src/services/string/render_to_html.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { render, configure } from 'enzyme'; - -import EnzymeAdapter from 'enzyme-adapter-react-16'; - -import html from 'html'; - -configure({ adapter: new EnzymeAdapter() }); - -export function renderToHtml(componentReference, props = {}) { - // If there's a failure, just return an empty string. The actual component itself should - // trip an error boundary in the UI when it fails. - try { - // Create the React element, render it and get its HTML, then format it prettily. - const element = React.createElement(componentReference, props); - const htmlString = render(element).html(); - return html.prettyPrint(htmlString, { - indent_size: 2, - unformatted: [], // Expand all tags, including spans - }); - } catch (e) { - return ''; - } -} diff --git a/packages/osd-ui-framework/doc_site/src/services/string/slugify.js b/packages/osd-ui-framework/doc_site/src/services/string/slugify.js deleted file mode 100644 index 3a61143710e0..000000000000 --- a/packages/osd-ui-framework/doc_site/src/services/string/slugify.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/** - * Lowercases input and replaces spaces with hyphens: - * e.g. 'GridView Example' -> 'gridview-example' - */ -function one(str) { - const parts = str - .toLowerCase() - .replace(/[-]+/g, ' ') - .replace(/[^\w^\s]+/g, '') - .replace(/ +/g, ' ') - .split(' '); - return parts.join('-'); -} - -function each(items, src, dest) { - return items.map((item) => { - const _item = item; - _item[dest] = one(_item[src]); - return _item; - }); -} - -export default { - one, - each, -}; diff --git a/packages/osd-ui-framework/doc_site/src/store/configure_store.js b/packages/osd-ui-framework/doc_site/src/store/configure_store.js deleted file mode 100644 index a3e38af7c90b..000000000000 --- a/packages/osd-ui-framework/doc_site/src/store/configure_store.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { applyMiddleware, createStore, compose } from 'redux'; -import thunk from 'redux-thunk'; -import { browserHistory } from 'react-router'; // eslint-disable-line -import { routerMiddleware, routerReducer } from 'react-router-redux'; - -import codeViewerReducer from './reducers/code_viewer_reducer'; -import sandboxReducer from './reducers/sandbox_reducer'; -import sectionsReducer from './reducers/sections_reducer'; - -/** - * @param {Object} initialState An object defining the application's initial - * state. - */ -export default function configureStore(initialState) { - function rootReducer(state = {}, action) { - return { - routing: routerReducer(state.routing, action), - codeViewer: codeViewerReducer(state.codeViewer, action), - sandbox: sandboxReducer(state.sandbox, action), - sections: sectionsReducer(state.sections, action), - }; - } - - const finalStore = compose(applyMiddleware(thunk, routerMiddleware(browserHistory)))(createStore)( - rootReducer, - initialState - ); - - return finalStore; -} diff --git a/packages/osd-ui-framework/doc_site/src/store/index.js b/packages/osd-ui-framework/doc_site/src/store/index.js deleted file mode 100644 index ad6e9c27c1b3..000000000000 --- a/packages/osd-ui-framework/doc_site/src/store/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export function getIsCodeViewerOpen(state) { - return state.codeViewer.isOpen; -} - -export function getIsSandbox(state) { - return state.sandbox.isSandbox; -} - -export function getSections(state) { - return state.sections.sections; -} - -export function getSource(state) { - return state.codeViewer.source; -} - -export function getTitle(state) { - return state.codeViewer.title; -} diff --git a/packages/osd-ui-framework/doc_site/src/store/reducers/code_viewer_reducer.js b/packages/osd-ui-framework/doc_site/src/store/reducers/code_viewer_reducer.js deleted file mode 100644 index d25f3e9d7b0b..000000000000 --- a/packages/osd-ui-framework/doc_site/src/store/reducers/code_viewer_reducer.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { LOCATION_CHANGE } from 'react-router-redux'; - -import ActionTypes from '../../actions/action_types'; - -const defaultState = { - isOpen: false, - codesBySlug: {}, - source: undefined, - title: undefined, -}; - -export default function codeViewerReducer(state = defaultState, action) { - switch (action.type) { - case ActionTypes.OPEN_CODE_VIEWER: { - const { source, title } = action; - - if (state.code === source) { - // If we are opening the existing code, then close the viewer. - return { - ...state, - isOpen: false, - source: undefined, - title: undefined, - }; - } - - return { - ...state, - isOpen: true, - source, - title, - }; - } - - case LOCATION_CHANGE: // Close Code Viewer when we navigate somewhere. - case ActionTypes.CLOSE_CODE_VIEWER: { - return { - ...state, - isOpen: false, - source: undefined, - }; - } - - default: - break; - } - - return state; -} diff --git a/packages/osd-ui-framework/doc_site/src/store/reducers/sandbox_reducer.js b/packages/osd-ui-framework/doc_site/src/store/reducers/sandbox_reducer.js deleted file mode 100644 index 1baa9b32ca55..000000000000 --- a/packages/osd-ui-framework/doc_site/src/store/reducers/sandbox_reducer.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import ActionTypes from '../../actions/action_types'; - -const defaultState = { - isSandbox: false, -}; - -export default function sandboxReducer(state = defaultState, action) { - switch (action.type) { - case ActionTypes.OPEN_SANDBOX: { - return { - ...state, - isSandbox: true, - }; - } - - case ActionTypes.CLOSE_SANDBOX: { - return { - ...state, - isSandbox: false, - }; - } - - default: - break; - } - - return state; -} diff --git a/packages/osd-ui-framework/doc_site/src/store/reducers/sections_reducer.js b/packages/osd-ui-framework/doc_site/src/store/reducers/sections_reducer.js deleted file mode 100644 index b190dbf8e630..000000000000 --- a/packages/osd-ui-framework/doc_site/src/store/reducers/sections_reducer.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import ActionTypes from '../../actions/action_types'; - -const defaultState = { - sections: [], -}; - -export default function sectionsReducer(state = defaultState, action) { - switch (action.type) { - case ActionTypes.REGISTER_SECTION: { - const sections = state.sections.slice(); - sections.push({ - id: action.id, - name: action.name, - }); - - return { - ...state, - sections: sections, - }; - } - - case ActionTypes.UNREGISTER_SECTION: { - const sections = state.sections.slice(); - const index = sections.findIndex((section) => section.id === action.id); - sections.splice(index, 1); - - return { - ...state, - sections: sections, - }; - } - - default: - break; - } - - return state; -} diff --git a/packages/osd-ui-framework/doc_site/src/views/app_container.js b/packages/osd-ui-framework/doc_site/src/views/app_container.js deleted file mode 100644 index ac31894d1007..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/app_container.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { bindActionCreators } from 'redux'; -import { connect } from 'react-redux'; - -import { getIsCodeViewerOpen, getIsSandbox, getSections, getSource, getTitle } from '../store'; - -import { AppView } from './app_view'; - -import { openCodeViewer, closeCodeViewer, registerSection, unregisterSection } from '../actions'; - -function mapStateToProps(state, ownProps) { - return { - routes: ownProps.routes, - isCodeViewerOpen: getIsCodeViewerOpen(state), - isSandbox: getIsSandbox(state), - source: getSource(state), - title: getTitle(state), - sections: getSections(state), - }; -} - -function mapDispatchToProps(dispatch) { - const actions = { - openCodeViewer, - closeCodeViewer, - registerSection, - unregisterSection, - }; - - return bindActionCreators(actions, dispatch); -} - -export default connect(mapStateToProps, mapDispatchToProps)(AppView); diff --git a/packages/osd-ui-framework/doc_site/src/views/app_view.js b/packages/osd-ui-framework/doc_site/src/views/app_view.js deleted file mode 100644 index 0a9e7a9d6695..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/app_view.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -import classNames from 'classnames'; - -import { Routes } from '../services'; - -import { GuideCodeViewer, GuideNav } from '../components'; - -// Inject version into header. -const pkg = require('../../../../../package.json'); - -export class AppView extends Component { - constructor(props) { - super(props); - - this.state = { - isNavOpen: false, - isChromeVisible: !props.isSandbox, - }; - - this.onClickNavItem = this.onClickNavItem.bind(this); - this.onToggleNav = this.onToggleNav.bind(this); - this.onCloseCodeViewer = this.onCloseCodeViewer.bind(this); - this.onHideChrome = this.onHideChrome.bind(this); - this.onShowChrome = this.onShowChrome.bind(this); - } - - onClickNavItem() { - this.setState({ - isNavOpen: false, - }); - } - - onCloseCodeViewer() { - this.props.closeCodeViewer(); - } - - onToggleNav() { - this.setState({ - isNavOpen: !this.state.isNavOpen, - }); - } - - onHideChrome() { - this.setState({ - isChromeVisible: false, - isNavOpen: false, - }); - - this.props.closeCodeViewer(); - } - - onShowChrome() { - this.setState({ - isChromeVisible: true, - }); - } - - UNSAFE_componentWillReceiveProps(nextProps) { - // Only force the chrome to be hidden if we're navigating from a non-sandbox to a sandbox. - if (!this.props.isSandbox && nextProps.isSandbox) { - this.setState({ - isChromeVisible: false, - }); - } - } - - render() { - const contentClasses = classNames('guideContent', { - 'is-code-viewer-open': this.props.isCodeViewerOpen, - 'is-chrome-hidden': !this.state.isChromeVisible, - }); - - return ( -
- - -
{this.props.children}
- - -
- ); - } -} - -AppView.propTypes = { - children: PropTypes.any, - routes: PropTypes.array.isRequired, - isSandbox: PropTypes.bool, - openCodeViewer: PropTypes.func, - closeCodeViewer: PropTypes.func, - isCodeViewerOpen: PropTypes.bool, - registerSection: PropTypes.func, - unregisterSection: PropTypes.func, - sections: PropTypes.array, - source: PropTypes.array, - title: PropTypes.string, -}; - -AppView.defaultProps = { - source: [], -}; diff --git a/packages/osd-ui-framework/doc_site/src/views/bar/bar.js b/packages/osd-ui-framework/doc_site/src/views/bar/bar.js deleted file mode 100644 index bc1bf6ba920a..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/bar/bar.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiBar, KuiBarSection } from '../../../../components'; - -export default () => ( - - -
The Great American Novel
-
- - - - -
pages
-
-
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/bar/bar_example.js b/packages/osd-ui-framework/doc_site/src/views/bar/bar_example.js deleted file mode 100644 index 8f0f08f14db5..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/bar/bar_example.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* eslint-disable import/no-duplicates */ - -import React from 'react'; -import { renderToHtml } from '../../services'; - -import { GuideDemo, GuidePage, GuideSection, GuideSectionTypes, GuideText } from '../../components'; - -import Bar from './bar'; -import barSource from '!!raw-loader!./bar'; -const barHtml = renderToHtml(Bar); - -import BarOneSection from './bar_one_section'; -import barOneSectionSource from '!!raw-loader!./bar_one_section'; -const barOneSectionHtml = renderToHtml(BarOneSection); - -import BarThreeSections from './bar_three_sections'; -import barThreeSectionsSource from '!!raw-loader!./bar_three_sections'; -const barThreeSectionsHtml = renderToHtml(BarThreeSections); - -export default (props) => ( - - - - Use the Bar to organize controls in a horizontal layout. This is especially useful for - surfacing controls in the corners of a view. - - - - Note: Instead of using this component with a Table, try using the - ControlledTable, ToolBar, and ToolBarFooter components. - - - - - - - - - - A Bar with one section will align it to the right, by default. To align it to the left, just - add another section and leave it empty, or don’t use a Bar at all. - - - - - - - - - - Technically the Bar can contain three or more sections, but there’s no established - use-case for this. - - - - - - - -); diff --git a/packages/osd-ui-framework/doc_site/src/views/bar/bar_one_section.js b/packages/osd-ui-framework/doc_site/src/views/bar/bar_one_section.js deleted file mode 100644 index a2662a9e7ff6..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/bar/bar_one_section.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiBar, KuiBarSection, KuiButton } from '../../../../components'; - -export default () => ( - - -
- See previous 10 pages - See next 10 pages -
-
-
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/bar/bar_three_sections.js b/packages/osd-ui-framework/doc_site/src/views/bar/bar_three_sections.js deleted file mode 100644 index 86bbb8b9ed17..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/bar/bar_three_sections.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiBar, KuiBarSection, KuiButton, KuiButtonGroup } from '../../../../components'; - -export default () => ( - - -
The Great American Novel
-
- - - - Create new page - Clear all pages - - - - - - -
pages
- - - Undo - Redo - -
-
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_basic.js b/packages/osd-ui-framework/doc_site/src/views/button/button_basic.js deleted file mode 100644 index 12c0ffcb6471..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_basic.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton } from '../../../../components'; - -export default () => ( -
- window.alert('Button clicked')}> - Basic button - - -
-
- - window.alert('Button clicked')} disabled> - Basic button, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_danger.js b/packages/osd-ui-framework/doc_site/src/views/button/button_danger.js deleted file mode 100644 index 0e608933c9cc..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_danger.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton } from '../../../../components'; - -export default () => ( -
- Danger button - -
-
- - - Danger button, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_elements.js b/packages/osd-ui-framework/doc_site/src/views/button/button_elements.js deleted file mode 100644 index 865bb7625344..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_elements.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton, KuiLinkButton, KuiSubmitButton } from '../../../../components'; - -export default () => ( -
- Button element - -
-
- -
{ - e.preventDefault(); - window.alert('Submit'); - }} - > - Submit input element -
- -
- -
{ - e.preventDefault(); - window.alert('Submit'); - }} - > - - Submit input element, disabled - -
- -
- - - Anchor element - - -
-
- - - Anchor element, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_example.js b/packages/osd-ui-framework/doc_site/src/views/button/button_example.js deleted file mode 100644 index 5b0f25b4c625..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_example.js +++ /dev/null @@ -1,345 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* eslint-disable import/no-duplicates */ - -import React from 'react'; - -import { renderToHtml } from '../../services'; - -import { GuideDemo, GuidePage, GuideSection, GuideSectionTypes, GuideText } from '../../components'; - -import Basic from './button_basic'; -import basicSource from '!!raw-loader!./button_basic'; -const basicHtml = renderToHtml(Basic); - -import Hollow from './button_hollow'; -import hollowSource from '!!raw-loader!./button_hollow'; -const hollowHtml = renderToHtml(Hollow); - -import Primary from './button_primary'; -import primarySource from '!!raw-loader!./button_primary'; -const primaryHtml = renderToHtml(Primary); - -import Secondary from './button_secondary'; -import secondarySource from '!!raw-loader!./button_secondary'; -const secondaryHtml = renderToHtml(Secondary); - -import Danger from './button_danger'; -import dangerSource from '!!raw-loader!./button_danger'; -const dangerHtml = renderToHtml(Danger); - -import Warning from './button_warning'; -import warningSource from '!!raw-loader!./button_danger'; -const warningHtml = renderToHtml(Warning); - -import Loading from './button_loading'; -import loadingSource from '!!raw-loader!./button_loading'; -const loadingHtml = renderToHtml(Loading, { isLoading: true }); - -import WithIcon from './button_with_icon'; -import withIconSource from '!!raw-loader!./button_with_icon'; -const withIconHtml = renderToHtml(WithIcon); - -import ButtonGroup from './button_group'; -import buttonGroupSource from '!!raw-loader!./button_group'; -const buttonGroupHtml = renderToHtml(ButtonGroup); - -import ButtonGroupUnited from './button_group_united'; -import buttonGroupUnitedSource from '!!raw-loader!./button_group_united'; -const buttonGroupUnitedHtml = renderToHtml(ButtonGroupUnited); - -import Elements from './button_elements'; -import elementsSource from '!!raw-loader!./button_elements'; -const elementsHtml = renderToHtml(Elements); - -import sizesHtml from './button_sizes.html'; - -export default (props) => ( - - - - Use the basic button for navigation elements or controls that are not the primary focus of - the page (ex: pagination, toggles...etc). - - - - - - - - - - Use the hollow Button when presenting a neutral action, e.g. a “Cancel” button. - - - - - - - - - - Use the primary Button to represent the most common action. Generally, there won’t be - a need to present more than one of these at a time. - - - - - - - - - - Secondary buttons are usually used for actions (“do this”) that are optional - actions on a page. - - - - - - - - - Danger Buttons represent irreversible, potentially regrettable actions. - - - - - - - - Warning Buttons represent potentially notable actions. - - - - - - - - - - - - - - -

- You can toss an icon into a Button, with or without text. You can also use a predefined - icon or specify custom icon classes. If you have a button without textual content, make - sure you set the aria-label attribute with a textual representation for - screen readers (see last example below). -

-
- - - - -
- - - - - - - - - - Use the united version of the ButtonGroup to emphasize the close relationship within a set - of Buttons, and differentiate them from Buttons outside of the set. - - - - They support containing a single Button, so that Buttons can be dynamically added and - removed. - - - - - - - - - - You can create a Button using a button element, link, or input[type=“submit”]. - - - - - - - - - - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_group.js b/packages/osd-ui-framework/doc_site/src/views/button/button_group.js deleted file mode 100644 index 95267dcfdba7..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_group.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton, KuiButtonGroup } from '../../../../components'; - -export default () => ( -
- - Cancel - - Duplicate - - Save - - -
- - - Button group with one button - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_group_united.js b/packages/osd-ui-framework/doc_site/src/views/button/button_group_united.js deleted file mode 100644 index 994087b7af2f..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_group_united.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton, KuiButtonGroup, KuiButtonIcon } from '../../../../components'; - -export default () => ( -
- - Option A - - Option B - - Option C - - -
- - - } - /> - - } /> - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_hollow.js b/packages/osd-ui-framework/doc_site/src/views/button/button_hollow.js deleted file mode 100644 index 8e60ad9428e7..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_hollow.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton } from '../../../../components'; - -export default () => ( -
- Hollow button - -
-
- - - Hollow button, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_loading.js b/packages/osd-ui-framework/doc_site/src/views/button/button_loading.js deleted file mode 100644 index c0c20bd91c9f..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_loading.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React, { Component } from 'react'; - -import { KuiButtonIcon, KuiButton } from '../../../../components'; - -export default class LoadingButton extends Component { - constructor(props) { - super(); - - this.state = { - isLoading: props.isLoading || false, - }; - - this.onClick = this.onClick.bind(this); - } - - onClick() { - this.setState({ - isLoading: true, - }); - - setTimeout(() => { - this.setState({ - isLoading: false, - }); - }, 3000); - } - - render() { - return ( -
- - {this.state.isLoading ? 'Loading...' : 'Load more'} - - -
-
- - } - isLoading={this.state.isLoading} - disabled={this.state.isLoading} - > - {this.state.isLoading ? 'Creating...' : 'Create'} - -
- ); - } -} diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_primary.js b/packages/osd-ui-framework/doc_site/src/views/button/button_primary.js deleted file mode 100644 index c990bb2f5e81..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_primary.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton } from '../../../../components'; - -export default () => ( -
- Primary button - -
-
- - - Primary button, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_secondary.js b/packages/osd-ui-framework/doc_site/src/views/button/button_secondary.js deleted file mode 100644 index 6f12768fdd85..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_secondary.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton } from '../../../../components'; - -export default () => ( -
- Secondary button - -
-
- - - Secondary button, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_sizes.html b/packages/osd-ui-framework/doc_site/src/views/button/button_sizes.html deleted file mode 100644 index 36a27c78a48c..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_sizes.html +++ /dev/null @@ -1,55 +0,0 @@ -
- Small button -
- -
- -
- Small button with icon -
- -
- -
- Full-width button -
- -
- -
- Full-width button with icon -
- -
- -
-
- Button A -
- -
- Button B -
- -
- Button C -
-
- -
- -
-
- Button A -
- -
- Button B -
- -
- Button C -
-
diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_warning.js b/packages/osd-ui-framework/doc_site/src/views/button/button_warning.js deleted file mode 100644 index 36c6da1177b0..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_warning.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton } from '../../../../components'; - -export default () => ( -
- Warning button - -
-
- - - Warning button, disabled - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/button/button_with_icon.js b/packages/osd-ui-framework/doc_site/src/views/button/button_with_icon.js deleted file mode 100644 index d18609be979b..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/button/button_with_icon.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiButton, KuiButtonIcon } from '../../../../components'; - -export default () => ( -
- }> - Create - - -
-
- - }> - Delete - - -
-
- - }> - Previous - - -
-
- - } iconPosition="right"> - Next - - -
-
- - }> - Loading - - -
-
- - } - /> -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button.js b/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button.js deleted file mode 100644 index b464eb26a981..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiCollapseButton } from '../../../../components'; - -export default () => ( -
- - - - -
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button_aria.js b/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button_aria.js deleted file mode 100644 index c4721e645694..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button_aria.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React, { Component } from 'react'; - -import { KuiCollapseButton } from '../../../../components'; - -import { htmlIdGenerator } from '../../../../src/services'; - -export default class extends Component { - constructor(props) { - super(props); - this.state = { - isExpanded: false, - }; - } - - onToggleContent = (ev) => { - ev.preventDefault(); - this.setState((state) => ({ - isExpanded: !state.isExpanded, - })); - }; - - render() { - const { isExpanded } = this.state; - const idGen = htmlIdGenerator(); - return ( -
- -
- Here is some collapsible content. -
-
- ); - } -} diff --git a/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button_example.js b/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button_example.js deleted file mode 100644 index 4f509e33fae3..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/collapse_button/collapse_button_example.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* eslint-disable import/no-duplicates */ - -import React from 'react'; -import { renderToHtml } from '../../services'; - -import { GuideDemo, GuidePage, GuideSection, GuideSectionTypes, GuideText } from '../../components'; - -import CollapseButton from './collapse_button'; -import collapseButtonSource from '!!raw-loader!./collapse_button'; -const collapseButtonHtml = renderToHtml(CollapseButton); - -import CollapseButtonAria from './collapse_button_aria'; -import collapseButtonAriaSource from '!!raw-loader!./collapse_button_aria'; -const collapseButtonAriaHtml = renderToHtml(CollapseButtonAria); - -export default (props) => ( - - - - Use this button to collapse and expand panels, drawers, sidebars, legends, and other - containers. - - - - - - - - - - To make an expandable element properly accessible you should add the following - ARIA-attributes to it: -
-
- aria-expanded -
-
- should be true or false depending on the state of the - collapsable content. -
-
- aria-controls -
-
- should reference the id of the actual collapsable content element. -
-
- aria-label -
-
- should contain a label like "Toggle panel" or preferably more specific what it - toggles (e.g. "Toggle filter actions"). You don’t need to switch the - label when the state changes, since a screen reader will use aria-expanded{' '} - to read out the current state. -
-
- The following example demonstrate the usage of these attributes. -
- - - - -
-
-); diff --git a/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/empty_table_prompt.js b/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/empty_table_prompt.js deleted file mode 100644 index fcd7376fbaa4..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/empty_table_prompt.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { KuiEmptyTablePrompt, KuiLinkButton, KuiButtonIcon } from '../../../../components'; - -export function EmptyTablePrompt() { - return ( - } - aria-label="Add a new item" - data-test-subj="addNewPromptButton" - buttonType="primary" - href="#" - > - Add a new item - - } - message="Uh oh, You have no items!" - /> - ); -} diff --git a/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/empty_table_prompt_example.js b/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/empty_table_prompt_example.js deleted file mode 100644 index 8a673ed3d8c3..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/empty_table_prompt_example.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* eslint-disable import/no-duplicates */ - -import React from 'react'; -import { renderToHtml } from '../../services'; - -import { GuideDemo, GuidePage, GuideSection, GuideSectionTypes, GuideText } from '../../components'; - -import { EmptyTablePrompt } from './empty_table_prompt'; -import emptyTablePromptSource from '!!raw-loader!./empty_table_prompt'; // eslint-disable-line import/default -const emptyTablePromptHtml = renderToHtml(EmptyTablePrompt); - -import { ControlledTableWithEmptyPrompt } from './table_with_empty_prompt'; -import tableWithEmptyPromptSource from '!!raw-loader!./table_with_empty_prompt'; // eslint-disable-line import/default -const tableWithEmptyPromptHtml = renderToHtml(ControlledTableWithEmptyPrompt); - -export default (props) => ( - - - - Use this prompt when a table has no results. It helps create space and provides a place to - prompt the user to follow some next actions, such as creating an item. - - - - - - - - - Wrap in an EmptyTablePromptPanel when using with a controlled table. - - - - - - -); diff --git a/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/table_with_empty_prompt.js b/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/table_with_empty_prompt.js deleted file mode 100644 index a4a03f329222..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/empty_table_prompt/table_with_empty_prompt.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React from 'react'; - -import { - KuiEmptyTablePrompt, - KuiEmptyTablePromptPanel, - KuiToolBar, - KuiToolBarSearchBox, - KuiPager, - KuiLinkButton, - KuiButtonIcon, - KuiButtonGroup, -} from '../../../../components'; - -export function ControlledTableWithEmptyPrompt() { - return ( -
- - {}} /> -
- {}} - onPreviousPage={() => {}} - /> -
-
- - - } - aria-label="Add a new dashboard" - data-test-subj="addNewDashPromptButton" - buttonType="primary" - href="#" - > - Add a new dashboard - - - } - aria-label="Add a new visualization" - data-test-subj="addNewVizPromptButton" - buttonType="primary" - href="#" - > - Add a new visualization - - - } - message="You have no items. Would you like to add one?" - /> - -
- ); -} diff --git a/packages/osd-ui-framework/doc_site/src/views/form/assisted_input.html b/packages/osd-ui-framework/doc_site/src/views/form/assisted_input.html deleted file mode 100644 index d950f0e50119..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/form/assisted_input.html +++ /dev/null @@ -1,14 +0,0 @@ -
- - -
-

- API docs -

-
-
diff --git a/packages/osd-ui-framework/doc_site/src/views/form/check_box.js b/packages/osd-ui-framework/doc_site/src/views/form/check_box.js deleted file mode 100644 index bceaf18efd9c..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/form/check_box.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import React, { Component } from 'react'; -import { KuiCheckBox, KuiCheckBoxLabel } from '../../../../components'; - -class KuiCheckBoxExample extends Component { - state = { - value1: false, - value2: true, - value3: true, - value4: false, - }; - - handleChange = (event, key) => { - this.setState({ [key]: event.target.checked }); - }; - - render() { - return ( -
- this.handleChange(event, 'value1')} - /> -
- this.handleChange(event, 'value2')} - /> -
- this.handleChange(event, 'value3')} - isDisabled - /> -
- this.handleChange(event, 'value4')} - /> -
- ); - } -} - -export default KuiCheckBoxExample; diff --git a/packages/osd-ui-framework/doc_site/src/views/form/form_example.js b/packages/osd-ui-framework/doc_site/src/views/form/form_example.js deleted file mode 100644 index 61f2ff5a7e28..000000000000 --- a/packages/osd-ui-framework/doc_site/src/views/form/form_example.js +++ /dev/null @@ -1,246 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* eslint-disable import/no-duplicates */ - -import React from 'react'; -import { renderToHtml } from '../../services'; - -import { - GuideCode, - GuideDemo, - GuidePage, - GuideSection, - GuideSectionTypes, - GuideText, -} from '../../components'; - -import assistedInputHtml from './assisted_input.html'; -import searchInputHtml from './search_input.html'; -import staticInputHtml from './static_input.html'; - -import Label from './label'; -import labelSource from '!!raw-loader!./label'; -const labelHtml = renderToHtml(Label); - -import TextInput from './text_input'; -import textInputSource from '!!raw-loader!./text_input'; -const textInputHtml = renderToHtml(TextInput, { id: '1' }); - -import TextArea from './text_area'; -import textAreaSource from '!!raw-loader!./text_area'; -const textAreaHtml = renderToHtml(TextArea); - -import TextAreaNonResizable from './text_area_non_resizable'; -import textAreaNonResizableSource from '!!raw-loader!./text_area_non_resizable'; -const textAreaNonResizableHtml = renderToHtml(TextAreaNonResizable); - -import Select from './select'; -import selectSource from '!!raw-loader!./select'; -const selectHtml = renderToHtml(Select); - -import CheckBox from './check_box'; -import checkBoxSource from '!!raw-loader!./check_box'; -const checkBoxHtml = renderToHtml(CheckBox); - -export default (props) => ( - - - - Never forget to label every input element. You can either use a label{' '} - element with a for attribute referencing the{' '} - id of the input field, wrap the input field - within the label element or use aria-label or{' '} - aria-labelledby. - - - - For the sake of simplicity we haven’t labeled the input elements on this page - correctly. - - - - - - - - - - - - - - - Note: You have to specify right-side padding using a custom class or inline - style to keep the input text from overlapping with the assistance content. Use{' '} - em units for this padding so that it scales appropriately if the user - changes their root font-size. - - - - - - - - - - - - Use StaticInput to display dynamic content in a form which the user isn’t allowed to - edit. - - - - - - - -