Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lerna": "2.0.0-beta.32",
"lerna": "2.2.0",
"version": "independent",
"packages": [
"packages/*"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
],
"repository": "ovh-ux/ovh-ui-angular",
"main": "./packages/oui-angular/dist/oui-angular.js",
"webpack": "packages/oui-angular/src/index.js",
"browser": "./packages/oui-angular/dist/oui-angular.js",
"module": "packages/oui-angular/src/index.js",
"scripts": {
"bootstrap": "lerna bootstrap",
"wipe": "lerna clean",
Expand Down Expand Up @@ -63,7 +64,7 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.4",
"lerna": "2.0.0-beta.32",
"lerna": "~2.2.0",
"less": "^2.7.2",
"less-loader": "^2.2.3",
"loader-utils": "^0.2.16",
Expand Down
24 changes: 13 additions & 11 deletions packages/oui-angular/dist/oui-angular.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/oui-angular/dist/oui-angular.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/oui-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"@oui-angular/checkbox": "^1.0.0",
"@oui-angular/message": "^1.0.0",
"@oui-angular/radio": "^1.0.0",
"@oui-angular/radio-group": "^1.0.0"
"@oui-angular/radio-group": "^1.0.0",
"@oui-angular/loader": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/oui-angular/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import '@oui-angular/checkbox/src'
import '@oui-angular/radio/src'
import '@oui-angular/radio-group/src'
import '@oui-angular/message/src'
import '@oui-angular/loader/src'

angular.module('oui', [
'oui.checkbox',
'oui.radio',
'oui.radio-group',
'oui.message'
'oui.message',
'oui.loader'
])
1 change: 1 addition & 0 deletions packages/oui-angular/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ loadTests(require.context('../../oui-checkbox/src/', true, /.*((\.spec)|(index))
loadTests(require.context('../../oui-message/src/', true, /.*((\.spec)|(index))$/))
loadTests(require.context('../../oui-radio/src/', true, /.*((\.spec)|(index))$/))
loadTests(require.context('../../oui-radio-group/src/', true, /.*((\.spec)|(index))$/))
loadTests(require.context('../../oui-loader/src/', true, /.*((\.spec)|(index))$/))

function loadTests (context) {
context.keys().forEach(context)
Expand Down
2 changes: 2 additions & 0 deletions packages/oui-checkbox/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Checkbox

<component-status cx-design="partial" ux="rc"></component-status>

## Usage

### Label
Expand Down
5 changes: 5 additions & 0 deletions packages/oui-loader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
coverage/
*.log
yarn.lock
32 changes: 32 additions & 0 deletions packages/oui-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Loader

<component-status cx-design="partial" ux="rc"></component-status>

## Usage

### Small
```html:preview
<oui-loader size="s"></oui-loader>
```

By default, small loader is the only one displayed as an inline element.

### Medium
```html:preview
<oui-loader size="m"></oui-loader>
```

### Big
```html:preview
<oui-loader size="l"></oui-loader>
```

### Inline
```html:preview
<oui-loader size="m" inline="true"></oui-loader>
```

| Name | Type | Values | Default | Description |
| ---- | ---- | ---- | ---- | ---- |
| `size` | String | s, m, l | m | Loader size |
| `inline` | Boolean | | `false` (`true` for small loader) | Inline display |
13 changes: 13 additions & 0 deletions packages/oui-loader/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { configure as configureKarma } from '../../build/karma.single.conf'

module.exports = (config) => {
const karmaConfig = configureKarma(__dirname)

karmaConfig.files.unshift(require.resolve('angular-mocks'))
karmaConfig.files.unshift(require.resolve('angular'))
karmaConfig.webpack.devtool = 'inline-source-map'

config.set({
...karmaConfig
})
}
31 changes: 31 additions & 0 deletions packages/oui-loader/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@oui-angular/loader",
"version": "1.0.0",
"main": "dist/component.js",
"license": "MIT",
"scripts": {
"build": "rimraf dist && webpack --progress --colors --hide-modules --config webpack.config.babel.js",
"karma:watch": "cross-env NODE_ENV=test babel-node $(npm bin)/karma start karma.conf.js --watch",
"karma:chrome": "cross-env NODE_ENV=test babel-node $(npm bin)/karma start karma.conf.js --browsers Chromium",
"karma": "cross-env NODE_ENV=test babel-node $(npm bin)/karma start karma.conf.js --reporters spec,coverage-istanbul --single-run",
"webdriver:update": "webdriver-manager update",
"protractor": "babel-node $(yarn bin)/protractor",
"test": "yarn karma && yarn protractor"
},
"dependencies": {
"angular": "^1.6.5"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"cross-env": "^3.2.4",
"karma": "^1.7.0",
"protractor": "^4.0.14",
"rimraf": "^2.6.1",
"webpack": "^1.15.0"
},
"engines": {
"node": ">= 6.9.0",
"npm": ">= 3.10.0",
"yarn": ">= 0.17.0"
}
}
8 changes: 8 additions & 0 deletions packages/oui-loader/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import fs from 'fs'
import path from 'path'
import protractorConfig from '../../build/protractor.conf'

exports.config = Object.assign(protractorConfig, {
specs: [path.join('.', 'e2e', '**', '*.spec.js')],
baseUrl: fs.readFileSync('.preview-host').toString()
})
3 changes: 3 additions & 0 deletions packages/oui-loader/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Loader from './loader.component.js'

angular.module('oui.loader', []).component('ouiLoader', Loader)
100 changes: 100 additions & 0 deletions packages/oui-loader/src/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
describe('ouiLoader', () => {
let $componentController

beforeEach(angular.mock.module('oui.loader'))

beforeEach(inject((_$componentController_) => {
$componentController = _$componentController_
}))

describe('Controller', () => {
it('should exist', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {}
})
ctrl.$onInit()
expect(ctrl).toBeDefined()
})

describe('Default', () => {
it('should have default size and not inline', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {}
})
ctrl.$onInit()
expect(ctrl.size).toEqual('m')
expect(ctrl.inline).toBeFalsy()
})
})

describe('Small', () => {
it('should have right size and inline', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {}
}, {
size: 's'
})
ctrl.$onInit()
expect(ctrl.size).toEqual('s')
expect(ctrl.inline).toBeTruthy()
})

describe('forced not inline', () => {
it('should not be inline', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {
inline: 'false'
}
}, {
size: 's',
inline: false
})
ctrl.$onInit()
expect(ctrl.size).toEqual('s')
expect(ctrl.inline).toBeFalsy()
})
})
})

describe('Medium', () => {
it('should have default size', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {}
}, {
size: 'm'
})
ctrl.$onInit()
expect(ctrl.size).toEqual('m')
expect(ctrl.inline).toBeFalsy()
})

describe('forced inline', () => {
it('should be inline', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {
inline: {}
}
}, {
size: 'm'
})
ctrl.$onInit()
expect(ctrl.size).toEqual('m')
expect(ctrl.inline).toBeTruthy()
})
})
})

describe('Large', () => {
it('should have default size', () => {
const ctrl = $componentController('ouiLoader', {
$attrs: {}
}, {
size: 'l'
})
ctrl.$onInit()
expect(ctrl.size).toEqual('l')
expect(ctrl.inline).toBeFalsy()
})
})
})
})
11 changes: 11 additions & 0 deletions packages/oui-loader/src/loader.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import template from './loader.html'
import controller from './loader.controller'

export default {
template,
controller,
bindings: {
inline: '<?',
size: '@?'
}
}
21 changes: 21 additions & 0 deletions packages/oui-loader/src/loader.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import _ from 'lodash'

export default class {
constructor ($attrs) {
'ngInject'

this.$attrs = $attrs
}

$onInit () {
this.size = this.size || 'm'

if (_.has(this.$attrs, 'inline') && _.isEmpty(this.$attrs.inline)) {
this.inline = true
}

if (this.size === 's' && !_.has(this.$attrs, 'inline')) {
this.inline = true
}
}
}
9 changes: 9 additions & 0 deletions packages/oui-loader/src/loader.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="oui-loader"
data-ng-class="[
{ 'oui-loader_inline': $ctrl.inline },
'oui-loader_' + $ctrl.size
]">
<div class="oui-loader__container">
<div class="oui-loader__image"></div>
</div>
</div>
7 changes: 7 additions & 0 deletions packages/oui-loader/webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import merge from 'webpack-merge'

const env = process.env.NODE_ENV || 'dist'

export default merge(require(`../../build/webpack.${env}.config`).default, {
context: __dirname
})
2 changes: 2 additions & 0 deletions packages/oui-message/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# oui-message

<component-status cx-design="partial" ux="rc"></component-status>

## Usage

### Success
Expand Down
4 changes: 3 additions & 1 deletion packages/oui-radio-group/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Radio group

<component-status cx-design="partial" ux="rc"></component-status>

## One-way binding properties

### value
Expand All @@ -22,4 +24,4 @@
<oui-radio label="Second" value="second"></oui-radio>
<oui-radio label="Third" value="third"></oui-radio>
</oui-radio-group>
```
```
4 changes: 3 additions & 1 deletion packages/oui-radio/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Radio

<component-status cx-design="partial" ux="rc"></component-status>

## Usage

### Label
Expand Down Expand Up @@ -94,4 +96,4 @@

## Groups

see `oui-radio-group` for details
see `oui-radio-group` for details
Loading