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

Fixes #1285, #1341, #1330 - Create ClayMultiSelector, ClayDataProvider and ClayAutocomplete #1351

Merged
merged 43 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
aa03dce
Fixes #1285 - Fixes ClayLabel Event Consistency
matuzalemsteles Nov 5, 2018
f4aa7f6
Fixes #1285 - Update the test with the label emit the event
matuzalemsteles Nov 5, 2018
926ece9
Fixes #1285 - Create ClayLabelsInputField component
matuzalemsteles Nov 7, 2018
0df4ded
Fixes #1285 - SF
matuzalemsteles Nov 7, 2018
b51ccfb
Fixes #1285 - Rename ClayLabelsInputField by ClayMultiSelect
matuzalemsteles Nov 26, 2018
1eccc75
Fixes #1285 - Regen snapshots
matuzalemsteles Nov 26, 2018
6ea3024
Fixes #1285 - SF
matuzalemsteles Nov 26, 2018
2a3c545
Fixes #1285 - Remove Label reference and replace with Item
matuzalemsteles Nov 26, 2018
131ca6f
Fixes #1285 - Add inputName to API
matuzalemsteles Nov 26, 2018
8cff801
Fixes #1285 - Creates a new itemSelected event when select a dropdown…
matuzalemsteles Nov 27, 2018
498fbcf
Fixes #1285 - Update demos
matuzalemsteles Nov 27, 2018
5956a75
Fixes #1285 - Add the input hidden with values the selected items
matuzalemsteles Nov 27, 2018
bcda7aa
Fixes #1285 - Move ClayMultiSelect to ClayMultiSelectBase
matuzalemsteles Nov 30, 2018
83f50af
Fixes #1285 - Move clay-multi-select/utils to clay-data-provider/utils
matuzalemsteles Nov 30, 2018
f577fc9
Fixes #1330 - Create ClayDataProvider
matuzalemsteles Nov 30, 2018
b2dc075
Fixes #1330 - Pass the date data to _dataSource when the data is locally
matuzalemsteles Nov 30, 2018
cebd197
Fixes #1330 - Rename data to dataSource
matuzalemsteles Nov 30, 2018
cf2d7b6
Fixes #1341 - Create ClayAutocomplete
matuzalemsteles Nov 30, 2018
581ad39
Fixes #1285 - Remove unused code and integrate with ClayAutocomplete
matuzalemsteles Nov 30, 2018
29027aa
Fixes #1285 - Update demos
matuzalemsteles Nov 30, 2018
2b7ace1
Fixes #1285 - Rename ClayMultiSelectBase to ClayMultiSelect
matuzalemsteles Nov 30, 2018
6695ce2
Fixes #1285 - Add doc to soy
matuzalemsteles Nov 30, 2018
f6aa4d6
Fixes #1285 - Update packages version
matuzalemsteles Dec 3, 2018
28da1ef
Fixes #1330 - Update packages version
matuzalemsteles Dec 3, 2018
60494ba
Fixes #1341 - Update packages version
matuzalemsteles Dec 3, 2018
c8ca3da
Fixes #1341 - Move the onKeydown to root element
matuzalemsteles Dec 3, 2018
3dfc9f4
Fixes #1285 - Add focus to element
matuzalemsteles Dec 3, 2018
0a885cf
Fixes #1285 - Add the tabIndex API to ClayButton
matuzalemsteles Dec 3, 2018
25ba1ef
Fixes #1285 - Add the tabIndex API to ClayLabel
matuzalemsteles Dec 3, 2018
c5d54d5
Fixes #1285 - Update demos
matuzalemsteles Dec 3, 2018
13d55b4
Fixes #1341 - Adds tests to cover autocomplete use cases
matuzalemsteles Dec 4, 2018
5e97840
Fixes #1285 - Remove the clearInput method in favor of the inputValue…
matuzalemsteles Dec 4, 2018
32e8ee0
Fixes #1285 - Replace ref formGroupInput by autocomplete
matuzalemsteles Dec 4, 2018
9828b52
Fixes #1285 - Adds tests to cover multi select use cases
matuzalemsteles Dec 4, 2018
d2a553f
Fixes #1285 - Update package README.md
matuzalemsteles Dec 4, 2018
cba5eaf
Fixes #1330 - Fixes the request retries logic
matuzalemsteles Dec 4, 2018
cc2d52f
Fixes #1330 - Set up the fetch mock and move the jest configs to scri…
matuzalemsteles Dec 4, 2018
0baba22
Fixes #1330 - Adds tests to cover data provider use cases
matuzalemsteles Dec 4, 2018
7318887
Fixes #1285 - Add test to ClayButton with API use case tabIndex
matuzalemsteles Dec 4, 2018
828a205
Fixes #1285 - Add test to ClayLabel with API use case tabIndex
matuzalemsteles Dec 4, 2018
4993706
Fixes #1285 - Removes the default tabIndex API in ClayLabel
matuzalemsteles Dec 4, 2018
88f3f32
Fixes #1341, #1330, #1285 - Adds tests isomorphic
matuzalemsteles Dec 4, 2018
6370854
Fixes #1285 - SF
matuzalemsteles Dec 4, 2018
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
11 changes: 0 additions & 11 deletions jest-clay-lerna-resolver.js

This file was deleted.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,23 @@
"http-server": "^0.9.0",
"husky": "^0.14.2",
"jest": "^20.0.4",
"jest-fetch-mock": "^2.0.1",
"lerna": "^3.4.0",
"metal-jest-serializer": "^2.0.0",
"metal-soy-critic": "^2.4.0",
"pa11y-ci": "^2.1.1",
"prettier-eslint-cli": "^4.7.0"
},
"jest": {
"setupFiles": [
"./scripts/setupTests.js"
],
"collectCoverage": true,
"coverageReporters": [
"json",
"lcov"
],
"resolver": "./jest-clay-lerna-resolver",
"resolver": "./scripts/jest-clay-lerna-resolver",
"snapshotSerializers": [
"metal-jest-serializer"
],
Expand All @@ -56,8 +60,12 @@
]
},
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/clay-charts-shared"]
"packages": [
"packages/*"
],
"nohoist": [
"**/clay-charts-shared"
]
},
"resolutions": {
"js-beautify": "1.7.5",
Expand Down
29 changes: 29 additions & 0 deletions packages/clay-autocomplete/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Software License Agreement (BSD License)

Copyright (c) 2014, Liferay Inc.
All rights reserved.

Redistribution and use of this software in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.

* The name of Liferay Inc. may not be used to endorse or promote products
derived from this software without specific prior
written permission of Liferay Inc.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 26 additions & 0 deletions packages/clay-autocomplete/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ClayAutocomplete

Autocomplete consumes local and remote data, you can use the `dataSource` API for this by passing the URL where your data is or the local data.

## Setup

1. Install NodeJS >= v0.12.0 and NPM >= v3.0.0, if you don't have it yet. You
can find it [here](https://nodejs.org).

2. Install local dependencies:

```
npm install
```

3. Build the code:

```
npm run build
```

4. Open the demo at demos/index.html on your browser.

## Contribute

We'd love to get contributions from you! Please, check our [Contributing Guidelines](CONTRIBUTING.md) to see how you can help us improve.
93 changes: 93 additions & 0 deletions packages/clay-autocomplete/demos/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo: ClayAutocomplete</title>

<link rel="stylesheet" href="../../../node_modules/clay-css/lib/css/atlas.css">

<style>
body {
background-color: #FFF;
}

.row {
margin-bottom: 20px;
}
</style>

<script src="../build/globals/clay-autocomplete.js"></script>
</head>
<body class="container" role="main">
<h1 class="page-title" id="pageTitle">
ClayAutocomplete
</h1>

<div class="row row-spacing">
<div class="col">
<h2>Default State</h2>
<div id="default-block"></div>
</div>
</div>

<div class="row row-spacing">
<div class="col">
<h2>With disabled autocomplete</h2>
<div id="disabled-autocomplete-block"></div>
</div>
</div>

<div class="row row-spacing">
<div class="col">
<h2>With data remote</h2>
<div id="data-remote-block"></div>
</div>
</div>

<script type="text/javascript">
const dataSource = [
'Bread',
'Ammonia cookie',
'Cuisine of Antebellum America',
'Apple butter',
'Apple sauce',
'Baked potato',
'Barbecue',
'Bear claw',
'Beef Manhattan',
'Blue cheese dressing',
'Blue-plate special',
'Bookbinder soup',
'Breakfast burrito',
'Brunswick stew',
'Buffalo burger',
'Buffalo wing',
'Bull roast',
'Burnt ends',
'Butter cookie',
];

// Default State
new metal.ClayAutocomplete({
data: dataSource,
inputName: 'defaultState',
}, '#default-block');

// With disabled autocomplete
new metal.ClayAutocomplete({
data: dataSource,
enableAutocomplete: false,
inputName: 'disabledAutocomplete',
}, '#disabled-autocomplete-block');

// With data remote
new metal.ClayAutocomplete({
data: 'https://api.pro.coinbase.com/currencies',
extractData: (elem) => elem.name,
inputName: 'dataRemote',
}, '#data-remote-block');

</script>
</body>
</html>
90 changes: 90 additions & 0 deletions packages/clay-autocomplete/demos/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo: ClayAutocomplete</title>

<link rel="stylesheet" href="../../../node_modules/clay-css/lib/css/atlas.css">

<style>
body {
background-color: #FFF;
}

.row {
margin-bottom: 20px;
}
</style>

<script src="../build/globals/clay-autocomplete.js"></script>
</head>
<body class="container" role="main">
<h1 class="page-title" id="pageTitle">
ClayAutocomplete
</h1>

<div class="row row-spacing">
<div class="col">
<h2>Default State</h2>
<div id="default-block"></div>
</div>
</div>

<div class="row row-spacing">
<div class="col">
<h2>With disabled autocomplete</h2>
<div id="disabled-autocomplete-block"></div>
</div>
</div>

<div class="row row-spacing">
<div class="col">
<h2>With data remote</h2>
<div id="data-remote-block"></div>
</div>
</div>

<script type="text/javascript">
const dataSource = [
'Bread',
'Ammonia cookie',
'Cuisine of Antebellum America',
'Apple butter',
'Apple sauce',
'Baked potato',
'Barbecue',
'Bear claw',
'Beef Manhattan',
'Blue cheese dressing',
'Blue-plate special',
'Bookbinder soup',
'Breakfast burrito',
'Brunswick stew',
'Buffalo burger',
'Buffalo wing',
'Bull roast',
'Burnt ends',
'Butter cookie',
];

// Default State
new metal.ClayAutocomplete({
dataSource,
}, '#default-block');

// With disabled autocomplete
new metal.ClayAutocomplete({
dataSource,
enableAutocomplete: false,
}, '#disabled-autocomplete-block');

// With data remote
new metal.ClayAutocomplete({
dataSource: 'https://api.pro.coinbase.com/currencies',
extractData: (elem) => elem.name,
}, '#data-remote-block');

</script>
</body>
</html>
53 changes: 53 additions & 0 deletions packages/clay-autocomplete/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "clay-autocomplete",
"version": "2.4.0",
"description": "Metal ClayAutocomplete component",
"license": "BSD",
"repository": "https://github.com/liferay/clay/tree/master/packages/clay-autocomplete",
"engines": {
"node": ">=0.12.0",
"npm": ">=3.0.0"
},
"main": "lib/ClayAutocomplete.js",
"esnext:main": "src/ClayAutocomplete.js",
"jsnext:main": "src/ClayAutocomplete.js",
"files": [
"lib",
"src",
"test"
],
"scripts": {
"build": "npm run soy && webpack",
"compile": "babel -d lib/ src/ -s --ignore src/__tests__",
"prepublish": "npm run soy && npm run compile",
"soy": "metalsoy --soyDeps '../../node_modules/clay-data-provider/src/**/*.soy'"
},
"keywords": [
"clay",
"metal"
],
"dependencies": {
"clay-data-provider": "^2.4.0",
"metal": "^2.16.0",
"metal-component": "^2.16.0",
"metal-soy": "^2.16.0",
"metal-state": "^2.16.0",
"metal-web-component": "^2.16.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-loader": "^7.0.0",
"babel-plugin-transform-node-env-inline": "^0.1.1",
"babel-preset-env": "^1.6.0",
"browserslist-config-clay": "^2.1.12",
"clay-css": "^2.1.12",
"metal-dom": "^2.13.2",
"metal-tools-soy": "^6.0.0",
"webpack": "^3.0.0",
"webpack-config-clay": "^2.1.12"
},
"browserslist": [
"extends browserslist-config-clay"
]
}
Loading