Skip to content

Commit

Permalink
Merge pull request #669 from liferay/develop
Browse files Browse the repository at this point in the history
v2.0.0-rc.4
  • Loading branch information
carloslancha authored Feb 28, 2018
2 parents 20b9ec7 + e799d75 commit 5ddf0e8
Show file tree
Hide file tree
Showing 238 changed files with 3,743 additions and 600 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ lib
node_modules
**/*.soy.js
*.log
package-lock.json
package-lock.json
.gradle
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jdk:
language: java

script:
- npm run testSoy
- npm run build
- npm run checkFormat
- npm run lint
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"soy": "lerna run soy",
"start": "http-server . -p 4000",
"test": "npm run build && npm run jest && npm run a11y",
"testSoy": "cd packages/clay-isomorphic && ./gradlew testSoy",
"electric": "npm run soy && npm run compile && cd packages/claycss.com && ../../node_modules/electric-cli/bin/electric.js",
"web": "npm run electric -- run",
"deploy": "npm run electric -- deploy"
Expand Down
132 changes: 49 additions & 83 deletions packages/clay-button/src/ClayButton.soy
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,55 @@
{@param? value: string}

{let $attributes kind="attributes"}
{call .attributes}
{param ariaLabel: $ariaLabel /}
{param block: $block /}
{param disabled: $disabled /}
{param elementClasses: $elementClasses /}
{param icon: $icon /}
{param id: $id /}
{param label: $label /}
{param monospaced: $monospaced /}
{param name: $name /}
{param size: $size /}
{param style: $style /}
{param type: $type ?: 'button' /}
{param value: $value /}
{/call}
class="btn
{if $block}
{sp}btn-block
{/if}

{if $elementClasses}
{sp}{$elementClasses}
{/if}

{if $monospaced}
{sp}btn-monospaced
{/if}

{if $size}
{sp}btn-{$size}
{/if}

{if $style}
{sp}btn-{$style}
{else}
{sp}btn-primary
{/if}
"

{if $ariaLabel}
aria-label="{$ariaLabel}"
{elseif $label}
aria-label="{$label}"
{elseif $icon}
aria-label="{$icon}"
{/if}

{if $disabled}
disabled="disabled"
{/if}

{if $id}
id="{$id}"
{/if}

{if $name}
name="{$name}"
{/if}

{if $value}
value="{$value}"
{/if}

type="{$type}"
{/let}

<button {$attributes}>
Expand Down Expand Up @@ -113,71 +147,3 @@
{/if}

{/template}

/**
* Renders html attributes for button element
*/
{template .attributes kind="attributes"}
{@param? ariaLabel: string}
{@param? block: bool}
{@param? disabled: bool}
{@param? elementClasses: string}
{@param? icon: string}
{@param? id: string}
{@param? label: html|string}
{@param? monospaced: bool}
{@param? name: string}
{@param? size: string}
{@param? style: string}
{@param? type: string}
{@param? value: string}

{let $classes kind="text"}
btn
{if $block}
{sp}btn-block
{/if}
{if $elementClasses}
{sp}{$elementClasses}
{/if}
{if $monospaced}
{sp}btn-monospaced
{/if}
{if $size}
{sp}btn-{$size}
{/if}
{if $style}
{sp}btn-{$style}
{else}
{sp}btn-primary
{/if}
{/let}

class="{$classes}"

{if $ariaLabel}
aria-label="{$ariaLabel}"
{elseif $label}
aria-label="{$label}"
{elseif $icon}
aria-label="{$icon}"
{/if}

{if $disabled}
disabled="disabled"
{/if}

{if $id}
id="{$id}"
{/if}

{if $name}
name="{$name}"
{/if}

{if $value}
value="{$value}"
{/if}

type="{$type}"
{/template}
44 changes: 40 additions & 4 deletions packages/clay-card-grid/src/ClayCardGrid.soy
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{if $schema.contentRenderer}
{$schema.contentRenderer}
{elseif $schema and $schema.fieldsMap and $schema.fieldsMap.contentRenderer}
{if $schema.contentRendererMap and $schema.contentRendererMap[$item[$schema.fieldsMap.contentRenderer]]}
{if $schema.contentRendererMap and $item[$schema.fieldsMap.contentRenderer] and $schema.contentRendererMap[$item[$schema.fieldsMap.contentRenderer]]}
{$schema.contentRendererMap[$item[$schema.fieldsMap.contentRenderer]]}
{elseif $schema.contentRendererMap['*']}
{$schema.contentRendererMap['*']}
Expand Down Expand Up @@ -217,13 +217,25 @@
{@param? groupName: string}
{@param? selectable: bool}

{let $icon kind="text"}
{if $schema.iconsMap}
{if $schema.fieldsMap and $schema.fieldsMap.icon and $item[$schema.fieldsMap.icon]}
{$schema.iconsMap[$item[$schema.fieldsMap.icon]]}
{else}
{$schema.iconsMap['*']}
{/if}
{elseif $schema.fieldsMap and $schema.fieldsMap.icon}
{$item[$schema.fieldsMap.icon]}
{/if}
{/let}

{call ClayFileCard.render}
{param actionItems: $item.actionItems /}
{param disabled: $item.disabled /}
{param events: ['itemToggled': $_handleItemToggled ] /}
{param groupName: $groupName /}
{param href: $item[$schema.fieldsMap.href] /}
{param icon: $schema.iconsMap ? $schema.iconsMap[$item[$schema.fieldsMap.icon]] ?: $schema.iconsMap['*'] : $item[$schema.fieldsMap.icon] /}
{param icon: $icon != '' ? $icon : null /}
{param inputName kind="text"}
{if $schema.inputName}
{$schema.inputName}
Expand Down Expand Up @@ -275,13 +287,25 @@
{@param? groupName: string}
{@param? selectable: bool}

{let $icon kind="text"}
{if $schema.iconsMap}
{if $schema.fieldsMap and $schema.fieldsMap.icon and $item[$schema.fieldsMap.icon]}
{$schema.iconsMap[$item[$schema.fieldsMap.icon]]}
{else}
{$schema.iconsMap['*']}
{/if}
{elseif $schema.fieldsMap and $schema.fieldsMap.icon}
{$item[$schema.fieldsMap.icon]}
{/if}
{/let}

{call ClayHorizontalCard.render}
{param actionItems: $item.actionItems /}
{param disabled: $item.disabled /}
{param events: ['itemToggled': $_handleItemToggled ] /}
{param groupName: $groupName /}
{param href: $item[$schema.fieldsMap.href] /}
{param icon: $schema.iconsMap ? $schema.iconsMap[$item[$schema.fieldsMap.icon]] ?: $schema.iconsMap['*'] : $item[$schema.fieldsMap.icon] /}
{param icon: $icon != '' ? $icon : null /}
{param inputName kind="text"}
{if $schema.inputName}
{$schema.inputName}
Expand Down Expand Up @@ -327,13 +351,25 @@
{@param? groupName: string}
{@param? selectable: bool}

{let $icon kind="text"}
{if $schema.iconsMap}
{if $schema.fieldsMap and $schema.fieldsMap.icon and $item[$schema.fieldsMap.icon]}
{$schema.iconsMap[$item[$schema.fieldsMap.icon]]}
{else}
{$schema.iconsMap['*']}
{/if}
{elseif $schema.fieldsMap and $schema.fieldsMap.icon}
{$item[$schema.fieldsMap.icon]}
{/if}
{/let}

{call ClayImageCard.render}
{param actionItems: $item.actionItems /}
{param disabled: $item.disabled /}
{param events: ['itemToggled': $_handleItemToggled ] /}
{param groupName: $groupName /}
{param href: $item[$schema.fieldsMap.href] /}
{param icon: $schema.iconsMap ? $schema.iconsMap[$item[$schema.fieldsMap.icon]] ?: $schema.iconsMap['*'] : $item[$schema.fieldsMap.icon] /}
{param icon: $icon != '' ? $icon : null /}
{param imageAlt: $item[$schema.fieldsMap.imageAlt] /}
{param imageSrc: $item[$schema.fieldsMap.imageSrc] /}
{param inputName kind="text"}
Expand Down
1 change: 1 addition & 0 deletions packages/clay-card/src/ClayUserCard.soy
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
{@param? imageSrc: string}
{@param? spritemap: string}
{@param? stickerLabel: string}
{@param? stickerShape: string}
{@param? stickerStyle: string}

<div class="aspect-ratio-item-center-middle aspect-ratio-item-fluid card-type-asset-icon">
Expand Down
16 changes: 9 additions & 7 deletions packages/clay-charts/src/ChartBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ const ChartBase = {
} else if (isFunction(data)) {
return data().then(val => val);
} else if (isString(data)) {
return fetch(data)
return fetch(data, {cors: 'cors'})
.then(res => res.json())
.then(res => res.data);
}
Expand Down Expand Up @@ -1136,12 +1136,14 @@ ChartBase.STATE = {
* @type {?Object|undefined}
* @default undefined
*/
regions: Config.shapeOf({
class: Config.string(),
enabled: Config.oneOf(['x', 'y']).required(),
end: Config.array().required(),
start: Config.number().required(),
}),
regions: Config.arrayOf(
Config.shapeOf({
class: Config.string(),
enabled: Config.oneOf(['x', 'y']).required(),
end: Config.number().required(),
start: Config.number().required(),
})
),

/**
* Determines if chart auto resizes when viewport size changes.
Expand Down
4 changes: 2 additions & 2 deletions packages/clay-checkbox/demos/a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ <h4>Hidden Label Checkbox</h4>

new metal.ClayCheckbox(
{
hideLabel: true,
label: 'Hidden Label Checkbox'
label: 'Hidden Label Checkbox',
showLabel: false,
},
'#hidden-label-block'
);
Expand Down
4 changes: 2 additions & 2 deletions packages/clay-checkbox/demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ <h4>Hidden Label Checkbox</h4>

new metal.ClayCheckbox(
{
hideLabel: true,
label: 'Hidden Label Checkbox'
label: 'Hidden Label Checkbox',
showLabel: false,
},
'#hidden-label-block'
);
Expand Down
19 changes: 9 additions & 10 deletions packages/clay-checkbox/src/ClayCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ ClayCheckbox.STATE = {
*/
elementClasses: Config.string(),

/**
* Flag to indicate if label should be hide.
* @instance
* @memberof ClayCheckbox
* @type {?bool}
* @default false
*/
hideLabel: Config.bool().value(false),

/**
* Id to be applied to the element.
* @instance
Expand Down Expand Up @@ -106,7 +97,6 @@ ClayCheckbox.STATE = {

/**
* Custom content of the checkbox label. Use it to use your custom html.
* If this is used label and hideLabel params are ignored.
* @instance
* @memberof ClayCheckbox
* @type {?html|undefined}
Expand All @@ -123,6 +113,15 @@ ClayCheckbox.STATE = {
*/
name: Config.string(),

/**
* Flag to indicate if label should be hide.
* @instance
* @memberof ClayCheckbox
* @type {?bool}
* @default true
*/
showLabel: Config.bool().value(true),

/**
* Value to be applied to the element.
* @instance
Expand Down
Loading

0 comments on commit 5ddf0e8

Please sign in to comment.