@clayui/shared
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [3.5.0](https://github.com/liferay/clay/compare/@clayui/shared@3.4.0...@clayui/shared@3.5.0) (2021-01-27) | ||
### Features | ||
- **@clayui/drop-down:** add api for controlling the active state of the menu ([28e5191](https://github.com/liferay/clay/commit/28e5191)) | ||
# [3.4.0](https://github.com/liferay/clay/compare/@clayui/shared@3.3.2...@clayui/shared@3.4.0) (2021-01-13) | ||
@@ -8,0 +14,0 @@ |
@@ -18,8 +18,10 @@ "use strict"; | ||
if (element) { | ||
// Cloned into a new array since `.reduce` is not a method on an HTMLCollection | ||
var height = Array.prototype.slice.call(element.children).reduce(function (acc, child) { | ||
return acc + child.clientHeight; | ||
}, 0); | ||
var height = 0; | ||
for (var i = 0; i < element.children.length; i++) { | ||
height += element.children[i].clientHeight; | ||
} | ||
element.setAttribute('style', "height: ".concat(height, "px")); | ||
} | ||
} |
import React from 'react'; | ||
declare type TOnChange<T> = ((val?: T) => void) | React.Dispatch<React.SetStateAction<T>>; | ||
declare type TOnChange<T> = ((val: T) => void) | ((val?: T) => void) | React.Dispatch<React.SetStateAction<T>>; | ||
interface IArgs<T> { | ||
@@ -8,3 +8,3 @@ initialValue?: T; | ||
} | ||
export declare function useInternalState<TValue>({ initialValue, onChange, value, }: IArgs<TValue>): [TValue, React.Dispatch<React.SetStateAction<TValue>> | ((val?: TValue | undefined) => void)]; | ||
export declare function useInternalState<TValue>({ initialValue, onChange, value, }: IArgs<TValue>): [TValue, TOnChange<TValue>]; | ||
export {}; |
@@ -32,3 +32,3 @@ "use strict"; | ||
internalValue = _React$useState2[0], | ||
setInteralValue = _React$useState2[1]; | ||
setInternalValue = _React$useState2[1]; | ||
@@ -40,3 +40,3 @@ if (typeof value === 'undefined') { | ||
if (typeof onChange === 'undefined') { | ||
onChange = setInteralValue; | ||
onChange = setInternalValue; | ||
} | ||
@@ -43,0 +43,0 @@ |
{ | ||
"name": "@clayui/shared", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "ClayShared component", | ||
@@ -29,3 +29,3 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"@clayui/button": "^3.5.0", | ||
"@clayui/button": "^3.6.0", | ||
"@clayui/link": "^3.2.0" | ||
@@ -41,3 +41,3 @@ }, | ||
], | ||
"gitHead": "43c148edeb94b1b615ab874769b3e140bd018359" | ||
"gitHead": "9234e530ba7c105105276166fc3bb4471c0887f0" | ||
} |
@@ -11,12 +11,10 @@ /** | ||
if (element) { | ||
// Cloned into a new array since `.reduce` is not a method on an HTMLCollection | ||
const height = Array.prototype.slice | ||
.call(element.children) | ||
.reduce( | ||
(acc: number, child: HTMLElement) => acc + child.clientHeight, | ||
0 | ||
); | ||
let height = 0; | ||
for (let i = 0; i < element.children.length; i++) { | ||
height += element.children[i].clientHeight; | ||
} | ||
element.setAttribute('style', `height: ${height}px`); | ||
} | ||
} |
@@ -9,2 +9,3 @@ /** | ||
type TOnChange<T> = | ||
| ((val: T) => void) | ||
| ((val?: T) => void) | ||
@@ -24,3 +25,3 @@ | React.Dispatch<React.SetStateAction<T>>; | ||
}: IArgs<TValue>) { | ||
const [internalValue, setInteralValue] = React.useState(initialValue); | ||
const [internalValue, setInternalValue] = React.useState(initialValue); | ||
@@ -32,3 +33,3 @@ if (typeof value === 'undefined') { | ||
if (typeof onChange === 'undefined') { | ||
onChange = setInteralValue; | ||
onChange = setInternalValue; | ||
} | ||
@@ -35,0 +36,0 @@ |
60221
1397
Updated@clayui/button@^3.6.0