@linzjs/lui 16.0.1 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +2 -2
- package/dist/components/LuiFilterContainer/LuiFilterContainer.d.ts +1 -0
- package/dist/components/LuiFormElements/ClearableLuiTextInput/ClearableLuiTextInput.d.ts +3 -3
- package/dist/components/LuiIcon/LuiIcon.d.ts +2 -2
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/lui.css +2 -2
- package/dist/lui.esm.js +23 -3
- package/dist/lui.esm.js.map +1 -1
- package/dist/scss/Components/LuiFormElements/LuiTextInput/LuiTextInput.scss +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [16.1.0](https://github.com/linz/lui/compare/v16.0.1...v16.1.0) (2022-03-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* My whitespace feature ([#631](https://github.com/linz/lui/issues/631)) ([3e31760](https://github.com/linz/lui/commit/3e31760899b757480d2e31f5b98ca06a83011aff))
|
|
7
|
+
|
|
1
8
|
## [16.0.1](https://github.com/linz/lui/compare/v16.0.0...v16.0.1) (2022-03-21)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Lui - Linz User Interface
|
|
1
|
+
# Lui - Linz User Interface!!
|
|
2
2
|
|
|
3
3
|
> It's written in CSS and a React wrapper!
|
|
4
4
|
>
|
|
@@ -37,7 +37,7 @@ welcoming contributions from across LINZ.
|
|
|
37
37
|
It aims to solve the problem of consistent UI across LINZ while giving squads a bunch of base elements they can start
|
|
38
38
|
using out of the box.
|
|
39
39
|
|
|
40
|
-
We aim to make each component generic, extendable, accessible, and
|
|
40
|
+
We aim to make each component generic, extendable, accessible, and amazing.
|
|
41
41
|
|
|
42
42
|
All styles are implemented in SASS and compiled to plain CSS. This means any team can use the CSS. A ReactJS wrapper
|
|
43
43
|
over the CSS is part of this project.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
export interface ClearableLuiTextInputProps {
|
|
3
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
4
3
|
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
5
4
|
error?: string;
|
|
6
5
|
hideLabel?: boolean;
|
|
@@ -9,6 +8,7 @@ export interface ClearableLuiTextInputProps {
|
|
|
9
8
|
* A red star will be shown next to the label, no validation will be performed based on this prop.
|
|
10
9
|
*/
|
|
11
10
|
mandatory?: boolean;
|
|
12
|
-
|
|
11
|
+
value?: string;
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
13
13
|
}
|
|
14
14
|
export declare const ClearableLuiTextInput: (props: ClearableLuiTextInputProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ICONS } from '../../assets/svg-content';
|
|
2
|
+
import { InputHTMLAttributes } from 'react';
|
|
3
3
|
export declare type IconSize = keyof typeof ICON_SIZES;
|
|
4
4
|
export declare type IconStatus = keyof typeof ICON_STATUS;
|
|
5
5
|
export declare type IconName = keyof typeof ICONS;
|
|
@@ -13,7 +13,7 @@ export interface LuiIconProps {
|
|
|
13
13
|
status?: IconStatus;
|
|
14
14
|
className?: string;
|
|
15
15
|
title?: string;
|
|
16
|
-
spanProps?:
|
|
16
|
+
spanProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
17
17
|
}
|
|
18
18
|
export declare const ICON_SIZES: {
|
|
19
19
|
xs: string;
|
package/dist/index.js
CHANGED
|
@@ -55835,6 +55835,23 @@ function setSelectedFirmCache(firmId, firmName) {
|
|
|
55835
55835
|
}
|
|
55836
55836
|
}
|
|
55837
55837
|
|
|
55838
|
+
var ClearableLuiTextInput = function (props) {
|
|
55839
|
+
var _a = React.useState(props.value ? props.value : ''), currentValue = _a[0], setCurrentValue = _a[1];
|
|
55840
|
+
var clear = function () {
|
|
55841
|
+
setCurrentValue('');
|
|
55842
|
+
if (props.onValueChange) {
|
|
55843
|
+
props.onValueChange('');
|
|
55844
|
+
}
|
|
55845
|
+
};
|
|
55846
|
+
var cancelIcon = currentValue !== '' ? (React__default["default"].createElement(LuiIcon, { alt: "clear", name: "ic_cancel_clear", size: "lg", className: 'LuiTextInput-iconPosition', spanProps: { onClick: clear } })) : undefined;
|
|
55847
|
+
return (React__default["default"].createElement(LuiTextInput, __assign({}, props, { icon: cancelIcon, value: currentValue, onChange: function (e) {
|
|
55848
|
+
setCurrentValue(e.target.value);
|
|
55849
|
+
if (props.onValueChange) {
|
|
55850
|
+
props.onValueChange(e.target.value);
|
|
55851
|
+
}
|
|
55852
|
+
} })));
|
|
55853
|
+
};
|
|
55854
|
+
|
|
55838
55855
|
/**
|
|
55839
55856
|
* Filters options and forwards to internal render function.
|
|
55840
55857
|
* has option for minimum elements to filter
|
|
@@ -55842,11 +55859,14 @@ function setSelectedFirmCache(firmId, firmName) {
|
|
|
55842
55859
|
* @constructor
|
|
55843
55860
|
*/
|
|
55844
55861
|
var LuiFilterContainer = function (props) {
|
|
55845
|
-
var renderFunction = props.renderFunction, filterFunction = props.filterFunction, _a = props.showFilter, showFilter = _a === void 0 ? true : _a;
|
|
55846
|
-
var
|
|
55862
|
+
var renderFunction = props.renderFunction, filterFunction = props.filterFunction, _a = props.showFilter, showFilter = _a === void 0 ? true : _a, _b = props.isFilterClearable, isFilterClearable = _b === void 0 ? true : _b;
|
|
55863
|
+
var _c = React.useState(''), filter = _c[0], setFilter = _c[1];
|
|
55847
55864
|
return (React__default["default"].createElement("div", null,
|
|
55848
55865
|
showFilter && (React__default["default"].createElement("div", { className: 'LuiFilterContainer-filter-container LuiDeprecatedForms' },
|
|
55849
|
-
React__default["default"].createElement(
|
|
55866
|
+
isFilterClearable && (React__default["default"].createElement(ClearableLuiTextInput, { label: 'Filter', inputProps: {
|
|
55867
|
+
placeholder: 'Type to filter',
|
|
55868
|
+
}, onValueChange: function (value) { return setFilter(value); } })),
|
|
55869
|
+
!isFilterClearable && (React__default["default"].createElement("input", { type: "text", placeholder: "Type to filter", value: filter, onChange: function (e) { return setFilter(e.target.value); } })))),
|
|
55850
55870
|
renderFunction(filterFunction(filter))));
|
|
55851
55871
|
};
|
|
55852
55872
|
|