Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ui components/form #3790

Merged
merged 31 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ee83df7
Merge pull request #1 from aws-amplify/master
tjleing Jul 3, 2019
6537c2d
initial commit for amplify ui web components
sammartinez Jul 11, 2019
d4d15f5
Add base styling and cx to emotion css files
sammartinez Jul 12, 2019
5c2bbe5
v0.1.31
Jul 12, 2019
b72ba55
v0.1.30
Jul 12, 2019
286dcea
v0.2.0
Jul 12, 2019
e47427b
v0.1.30
Jul 12, 2019
61d7a0b
v0.1.99
Jul 12, 2019
4529c9c
Tests added to amplify-text-field; prettifier run
Jul 16, 2019
43e1d69
v0.1.30
Jul 16, 2019
9cb0c15
Typo fix
Jul 16, 2019
927b033
(partly just to fix CircleCI): Implement solution #4 on https://githu…
Jul 16, 2019
7e4cbcb
Cleaner code
Jul 16, 2019
c8da1e4
change () -> iconChange () for CircleCI, hopefully it works
Jul 17, 2019
b19e5c0
Merge branch 'master' of https://github.com/aws-amplify/amplify-js
Jul 17, 2019
a0abc65
Merge branch 'master' into amplify-ui-components
Jul 17, 2019
d153505
Merge branch 'master' of github.com:aws-amplify/amplify-js
sammartinez Jul 17, 2019
8811974
Merge branch 'master' into amplify-ui-components
sammartinez Jul 17, 2019
7f51569
Add styling to web components
sammartinez Jul 19, 2019
47968e7
UI component build fix (#3691)
jordanranz Jul 19, 2019
a8586df
Initial commit to fix #3671
Jul 23, 2019
d2faa7c
Move amplify-ui-components package from npm to yarn (#3718)
tjleing Jul 23, 2019
f181a37
Clean up linting (#3711)
jordanranz Jul 24, 2019
d17a059
Merge branch 'amplify-ui-components' of github.com:aws-amplify/amplif…
sammartinez Jul 29, 2019
7f4637c
Add screenshot testing (#3736)
tjleing Jul 30, 2019
6225e71
Bump resource class for CircleCI
jordanranz Jul 31, 2019
024d3aa
Merge branch 'amplify-ui-components' of github.com:aws-amplify/amplif…
jordanranz Jul 31, 2019
35ed85b
Merge branch 'amplify-ui-components' of github.com:aws-amplify/amplif…
sammartinez Jul 31, 2019
6b428ff
fix typo in constants
sammartinez Jul 31, 2019
8bf30f5
Merge branch 'amplify-ui-components' into ui-components/form
sammartinez Aug 1, 2019
b299048
Update LICENSE
sammartinez Aug 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
"devDependencies": {
"@types/jest": "^20.0.7",
"@types/node": "^8.9.5",
"@types/puppeteer": "1.12.4",
"codecov": "^1.0.1",
"compression-webpack-plugin": "^1.1.3",
"cypress": "^3.2.0",
"husky": "^1.3.1",
"jest": "^22.4.3",
"jest-config": "24.8.0",
"json-loader": "^0.5.7",
"lerna": "^3.13.1",
"rimraf": "^2.6.2",
Expand Down
15 changes: 15 additions & 0 deletions packages/amplify-ui-components/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions packages/amplify-ui-components/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
www
.stencil
../../node_modules
18 changes: 18 additions & 0 deletions packages/amplify-ui-components/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
rules: {
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': 0
},
};
27 changes: 27 additions & 0 deletions packages/amplify-ui-components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
dist/
www/

*~
*.sw[mnpcod]
*.log
*.lock
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace

.stencil/
.idea/
.vscode/
.sass-cache/
.versions/
node_modules/
$RECYCLE.BIN/

.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
.env

aws-exports.*
4 changes: 4 additions & 0 deletions packages/amplify-ui-components/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
www
.stencil
11 changes: 11 additions & 0 deletions packages/amplify-ui-components/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: 'avoid',
};
2 changes: 2 additions & 0 deletions packages/amplify-ui-components/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@storybook/addon-a11y/register';
import '@storybook/addon-knobs/register';
14 changes: 14 additions & 0 deletions packages/amplify-ui-components/.storybook/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { configure, addDecorator } from '@storybook/html';
import { withKnobs } from '@storybook/addon-knobs';
import { withA11y } from '@storybook/addon-a11y';

addDecorator(withKnobs);
addDecorator(withA11y);

const req = require.context('../src/components', true, /.stories.tsx$/);

function loadStories() {
req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);
3 changes: 3 additions & 0 deletions packages/amplify-ui-components/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script type="module" src="/build/amplify-ui-components.esm.js"></script>
<script nomodule src="/build/amplify-ui-components.js"></script>
<link href="/build/amplify-ui-components.css" rel="stylesheet" />
16 changes: 16 additions & 0 deletions packages/amplify-ui-components/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const path = require('path');
const webpack = require('webpack');

module.exports = ({ config, mode }) => {
config = Object.assign(
{
module: {
rules: []
},
plugins: []
},
config || {}
);

return config;
};
21 changes: 21 additions & 0 deletions packages/amplify-ui-components/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018
sammartinez marked this conversation as resolved.
Show resolved Hide resolved

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
72 changes: 72 additions & 0 deletions packages/amplify-ui-components/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.sv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3D&colorA=16161d&style=flat-square)

# Stencil Component Starter
sammartinez marked this conversation as resolved.
Show resolved Hide resolved

This is a starter project for building a standalone Web Component using Stencil.

Stencil is also great for building entire apps. For that, use the [stencil-app-starter](https://github.com/ionic-team/stencil-app-starter) instead.

# Stencil

Stencil is a compiler for building fast web apps using Web Components.

Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.

Stencil components are just Web Components, so they work in any major framework or with no framework at all.

## Getting Started

To start building a new web component using Stencil, clone this repo to a new directory:

```bash
git clone https://github.com/ionic-team/stencil-component-starter.git my-component
cd my-component
git remote rm origin
```

and run:

```bash
npm install
npm start
```

To build the component for production, run:

```bash
npm run build
```

To run the unit tests for the components, run:

```bash
npm test
```

Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).


## Naming Components

When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!

Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix `ion`.


## Using this component

### Script tag

- [Publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages)
- Put a script tag similar to this `<script src='https://unpkg.com/my-component@0.0.1/dist/mycomponent.js'></script>` in the head of your index.html
- Then you can use the element anywhere in your template, JSX, html etc

### Node Modules
- Run `npm install my-component --save`
- Put a script tag similar to this `<script src='node_modules/my-component/dist/mycomponent.js'></script>` in the head of your index.html
- Then you can use the element anywhere in your template, JSX, html etc

### In a stencil-starter app
- Run `npm install my-component --save`
- Add an import to the npm packages `import my-component;`
- Then you can use the element anywhere in your template, JSX, html etc
65 changes: 65 additions & 0 deletions packages/amplify-ui-components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@aws-amplify/ui-components",
"version": "0.0.1",
"description": "Stencil Component Starter",
sammartinez marked this conversation as resolved.
Show resolved Hide resolved
"module": "dist/index.mjs",
"main": "dist/index.js",
"unpkg": "dist/ionic.js",
"types": "dist/types/components.d.ts",
"collection": "dist/collection/collection-manifest.json",
"files": [
"dist/"
],
"scripts": {
"lint": "eslint --ext .js,.ts,.tsx .",
"format": "eslint --fix --ext .js,.ts,.tsx .",
"pretest": "npm run lint",
"test": "stencil test --spec --e2e --screenshot",
"test:update-screenshot": "stencil test --spec --e2e --screenshot --update-screenshot",
"test:watch": "stencil test --spec --e2e --watchAll",
"stencil": "stencil build --docs-readme",
"stencil:watch": "stencil build --dev --watch",
"start": "stencil build --dev --watch --serve",
"storybook": "start-storybook -s ./www",
"build-with-test": "npm run clean && npm test && npm run stencil",
"build": "npm run clean && npm run stencil",
"build:watch": "npm run clean && npm run stencil:watch",
"clean": "rimraf dist .stencil"
},
"dependencies": {
"emotion": "^10.0.9"
},
"devDependencies": {
"@stencil/core": "^1.2.3",
"@stencil/state-tunnel": "^1.0.1",
"@storybook/addon-a11y": "^5.1.9",
"@storybook/addon-knobs": "^5.1.9",
"@storybook/html": "^5.1.9",
"@storybook/theming": "^5.1.8",
"@types/jest": "24.0.15",
"@types/node": "^12.6.3",
"@types/webpack": "^4.4.35",
"@types/webpack-env": "^1.14.0",
"@typescript-eslint/eslint-plugin": "^1.12.0",
"@typescript-eslint/parser": "^1.12.0",
"babel-loader": "^8.0.6",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-prettier": "^3.1.0",
"husky": "^2.4.1",
"jest": "24.8.0",
"jest-cli": "24.8.0",
"prettier": "^1.17.1",
"puppeteer": "1.17.0",
"rollup-plugin-node-polyfills": "^0.2.1",
"ts-loader": "^6.0.4",
"typescript": "^3.5.3"
},
"husky": {
"hooks": {
"pre-push": "npm run test"
}
},
"peerDependencies": {},
"license": "Apache-2.0"
}
3 changes: 3 additions & 0 deletions packages/amplify-ui-components/screenshot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
images
builds
compare.html
10 changes: 10 additions & 0 deletions packages/amplify-ui-components/src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Classnames
export const AMPLIFY_UI_BUTTON = 'amplify-ui-button';
export const AMPLIFY_UI_SECTION = 'amplify-ui-section';
export const AMPLIFY_UI_SECTION_HEADER = 'amplify-ui-section-header';
export const AMPLIFY_UI_HINT = 'amplify-ui-hint';
export const AMPLIFY_UI_LABEL = 'amplify-ui-label';
export const AMPLIFY_UI_LINK = 'amplify-ui-link';
export const AMPLIFY_UI_FORM_FIELD = 'amplify-ui-form-field';
export const AMPLIFY_UI_SCENE = 'amplify-ui-scene';
export const AMPLIFY_UI_SCENE_LOADING = 'amplify-ui-scene-loading';
4 changes: 4 additions & 0 deletions packages/amplify-ui-components/src/common/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { cx } from 'emotion';

// TODO: rename
export const styleNuker = (override: boolean, cn: string, ecn: string): string => override ? cn : cx(cn, ecn);
Loading