@linzjs/lui 16.0.0 → 16.1.1

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 CHANGED
@@ -1,3 +1,24 @@
1
+ ## [16.1.1](https://github.com/linz/lui/compare/v16.1.0...v16.1.1) (2022-03-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Remove clip-path from icon. ([#633](https://github.com/linz/lui/issues/633)) ([2184c80](https://github.com/linz/lui/commit/2184c804f25b1c1ade2322b244c6e3c0bcbcc268))
7
+
8
+ # [16.1.0](https://github.com/linz/lui/compare/v16.0.1...v16.1.0) (2022-03-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * My whitespace feature ([#631](https://github.com/linz/lui/issues/631)) ([3e31760](https://github.com/linz/lui/commit/3e31760899b757480d2e31f5b98ca06a83011aff))
14
+
15
+ ## [16.0.1](https://github.com/linz/lui/compare/v16.0.0...v16.0.1) (2022-03-21)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * corrects test for global variable in LuiModal ([#628](https://github.com/linz/lui/issues/628)) ([8e7a8b0](https://github.com/linz/lui/commit/8e7a8b0db48cab84789b35bf17b9a9de289dc336))
21
+
1
22
  # [16.0.0](https://github.com/linz/lui/compare/v15.1.14...v16.0.0) (2022-03-17)
2
23
 
3
24
 
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 amazingly great.
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 +1 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path d="m19.571 10.586-8.132 8.132a3.999 3.999 0 0 1-5.657 0 3.999 3.999 0 0 1 0-5.657l8.84-8.84a2.501 2.501 0 0 1 3.535 3.536l-7.425 7.425a1.003 1.003 0 0 1-1.414 0 1.003 1.003 0 0 1 0-1.414l6.717-6.718-1.06-1.06-6.718 6.717a2.501 2.501 0 0 0 3.536 3.536l7.425-7.425a3.999 3.999 0 0 0 0-5.657 3.999 3.999 0 0 0-5.657 0L4.72 12a5.497 5.497 0 0 0 0 7.778 5.497 5.497 0 0 0 7.779 0l8.132-8.131-1.06-1.061Z"/></g><defs><clipPath id="a"><path d="M0 0h24v24H0z"/></clipPath></defs></svg>
1
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m19.571 10.586-8.132 8.132a3.999 3.999 0 0 1-5.657 0 3.999 3.999 0 0 1 0-5.657l8.84-8.84a2.501 2.501 0 0 1 3.535 3.536l-7.425 7.425a1.003 1.003 0 0 1-1.414 0 1.003 1.003 0 0 1 0-1.414l6.717-6.718-1.06-1.06-6.718 6.717a2.501 2.501 0 0 0 3.536 3.536l7.425-7.425a3.999 3.999 0 0 0 0-5.657 3.999 3.999 0 0 0-5.657 0L4.72 12a5.497 5.497 0 0 0 0 7.778 5.497 5.497 0 0 0 7.779 0l8.132-8.131-1.06-1.061Z"/></svg>
@@ -101,14 +101,7 @@ iconMap['ic_arrow_forward_ios'] = (
101
101
 
102
102
  iconMap['ic_attach_file'] = (
103
103
  <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
104
- <g clip-path="url(#a)">
105
- <path d="m19.571 10.586-8.132 8.132a3.999 3.999 0 0 1-5.657 0 3.999 3.999 0 0 1 0-5.657l8.84-8.84a2.501 2.501 0 0 1 3.535 3.536l-7.425 7.425a1.003 1.003 0 0 1-1.414 0 1.003 1.003 0 0 1 0-1.414l6.717-6.718-1.06-1.06-6.718 6.717a2.501 2.501 0 0 0 3.536 3.536l7.425-7.425a3.999 3.999 0 0 0 0-5.657 3.999 3.999 0 0 0-5.657 0L4.72 12a5.497 5.497 0 0 0 0 7.778 5.497 5.497 0 0 0 7.779 0l8.132-8.131-1.06-1.061Z" />
106
- </g>
107
- <defs>
108
- <clipPath id="a">
109
- <path d="M0 0h24v24H0z" />
110
- </clipPath>
111
- </defs>
104
+ <path d="m19.571 10.586-8.132 8.132a3.999 3.999 0 0 1-5.657 0 3.999 3.999 0 0 1 0-5.657l8.84-8.84a2.501 2.501 0 0 1 3.535 3.536l-7.425 7.425a1.003 1.003 0 0 1-1.414 0 1.003 1.003 0 0 1 0-1.414l6.717-6.718-1.06-1.06-6.718 6.717a2.501 2.501 0 0 0 3.536 3.536l7.425-7.425a3.999 3.999 0 0 0 0-5.657 3.999 3.999 0 0 0-5.657 0L4.72 12a5.497 5.497 0 0 0 0 7.778 5.497 5.497 0 0 0 7.779 0l8.132-8.131-1.06-1.061Z" />
112
105
  </svg>
113
106
  );
114
107
 
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface IFilterProperties<T> {
3
3
  showFilter?: boolean;
4
+ isFilterClearable?: boolean;
4
5
  filterFunction: (input: string) => T[];
5
6
  renderFunction: (filteredOptions: T[]) => JSX.Element;
6
7
  }
@@ -0,0 +1,14 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ export interface ClearableLuiTextInputProps {
3
+ inputProps?: InputHTMLAttributes<HTMLInputElement>;
4
+ error?: string;
5
+ hideLabel?: boolean;
6
+ label: JSX.Element | string;
7
+ /**
8
+ * A red star will be shown next to the label, no validation will be performed based on this prop.
9
+ */
10
+ mandatory?: boolean;
11
+ value?: string;
12
+ onValueChange?: (value: string) => void;
13
+ }
14
+ export declare const ClearableLuiTextInput: (props: ClearableLuiTextInputProps) => JSX.Element;
@@ -14,6 +14,7 @@ export interface LuiTextInputProps {
14
14
  */
15
15
  showPadlockIcon?: boolean;
16
16
  value: string;
17
+ icon?: JSX.Element;
17
18
  }
18
19
  export declare function useGenerateOrDefaultId(idFromProps?: string): string;
19
20
  export declare const LuiTextInput: (props: LuiTextInputProps) => 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?: any;
16
+ spanProps?: InputHTMLAttributes<HTMLInputElement>;
17
17
  }
18
18
  export declare const ICON_SIZES: {
19
19
  xs: string;
package/dist/index.js CHANGED
@@ -181,11 +181,7 @@ iconMap['ic_arrow_drop_up'] = (React__default["default"].createElement("svg", {
181
181
  iconMap['ic_arrow_forward_ios'] = (React__default["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
182
182
  React__default["default"].createElement("path", { d: "m5.93 4.125 2.156-2.109L18.07 12l-9.984 9.984-2.156-2.109L13.852 12z" })));
183
183
  iconMap['ic_attach_file'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
184
- React__default["default"].createElement("g", { "clip-path": "url(#a)" },
185
- React__default["default"].createElement("path", { d: "m19.571 10.586-8.132 8.132a3.999 3.999 0 0 1-5.657 0 3.999 3.999 0 0 1 0-5.657l8.84-8.84a2.501 2.501 0 0 1 3.535 3.536l-7.425 7.425a1.003 1.003 0 0 1-1.414 0 1.003 1.003 0 0 1 0-1.414l6.717-6.718-1.06-1.06-6.718 6.717a2.501 2.501 0 0 0 3.536 3.536l7.425-7.425a3.999 3.999 0 0 0 0-5.657 3.999 3.999 0 0 0-5.657 0L4.72 12a5.497 5.497 0 0 0 0 7.778 5.497 5.497 0 0 0 7.779 0l8.132-8.131-1.06-1.061Z" })),
186
- React__default["default"].createElement("defs", null,
187
- React__default["default"].createElement("clipPath", { id: "a" },
188
- React__default["default"].createElement("path", { d: "M0 0h24v24H0z" })))));
184
+ React__default["default"].createElement("path", { d: "m19.571 10.586-8.132 8.132a3.999 3.999 0 0 1-5.657 0 3.999 3.999 0 0 1 0-5.657l8.84-8.84a2.501 2.501 0 0 1 3.535 3.536l-7.425 7.425a1.003 1.003 0 0 1-1.414 0 1.003 1.003 0 0 1 0-1.414l6.717-6.718-1.06-1.06-6.718 6.717a2.501 2.501 0 0 0 3.536 3.536l7.425-7.425a3.999 3.999 0 0 0 0-5.657 3.999 3.999 0 0 0-5.657 0L4.72 12a5.497 5.497 0 0 0 0 7.778 5.497 5.497 0 0 0 7.779 0l8.132-8.131-1.06-1.061Z" })));
189
185
  iconMap['ic_attachment'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
190
186
  React__default["default"].createElement("path", { d: "M2.016 12.023c0-1.531.531-2.836 1.594-3.914C4.673 7.03 5.97 6.492 7.501 6.492h10.5c1.094 0 2.032.398 2.813 1.195.781.797 1.172 1.742 1.172 2.836 0 1.094-.39 2.032-1.172 2.813-.781.781-1.719 1.172-2.813 1.172H9.517a2.472 2.472 0 0 1-1.781-.727c-.5-.485-.75-1.07-.75-1.758 0-.687.25-1.281.75-1.781s1.094-.75 1.781-.75h7.5v2.016H9.423c-.281 0-.422.164-.422.492 0 .328.14.492.422.492h8.578c.531 0 1-.195 1.406-.586.406-.39.609-.852.609-1.383s-.203-1-.609-1.406c-.406-.406-.875-.61-1.406-.61h-10.5c-.969 0-1.797.345-2.484 1.032a3.386 3.386 0 0 0-1.031 2.484c0 .969.344 1.789 1.031 2.46a3.425 3.425 0 0 0 2.484 1.009h9.516v2.016H7.501c-1.531 0-2.828-.531-3.891-1.594-1.063-1.063-1.594-2.36-1.594-3.891Z" })));
191
187
  iconMap['ic_blocked'] = (React__default["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
@@ -878,7 +874,8 @@ var LuiTextInput = function (props) {
878
874
  clsx(props.hideLabel ? 'LuiScreenReadersOnly' : '') }, props.label),
879
875
  React__default["default"].createElement("span", { className: "LuiTextInput-inputWrapper" },
880
876
  React__default["default"].createElement("input", __assign({ type: 'text', className: (props.showPadlockIcon ? 'LuiTextInput-padlock-icon ' : '') +
881
- clsx('LuiTextInput-input'), min: "0", value: props.value, onChange: props.onChange }, props.inputProps, { id: id }))),
877
+ clsx('LuiTextInput-input'), min: "0", value: props.value, onChange: props.onChange }, props.inputProps, { id: id })),
878
+ props.icon),
882
879
  props.error && (React__default["default"].createElement("span", { className: "LuiTextInput-error" },
883
880
  React__default["default"].createElement(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextInput-error-icon", size: "sm", status: "error" }),
884
881
  props.error)))));
@@ -55632,7 +55629,7 @@ var LuiModal = function (props) {
55632
55629
  }, [handleClickOutside]);
55633
55630
  var isTest = false;
55634
55631
  // this is here for the tests
55635
- if (process !== undefined) {
55632
+ if (typeof process !== 'undefined') {
55636
55633
  isTest = ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'test';
55637
55634
  if (!isTest) {
55638
55635
  Modal.setAppElement('#root');
@@ -55834,6 +55831,23 @@ function setSelectedFirmCache(firmId, firmName) {
55834
55831
  }
55835
55832
  }
55836
55833
 
55834
+ var ClearableLuiTextInput = function (props) {
55835
+ var _a = React.useState(props.value ? props.value : ''), currentValue = _a[0], setCurrentValue = _a[1];
55836
+ var clear = function () {
55837
+ setCurrentValue('');
55838
+ if (props.onValueChange) {
55839
+ props.onValueChange('');
55840
+ }
55841
+ };
55842
+ var cancelIcon = currentValue !== '' ? (React__default["default"].createElement(LuiIcon, { alt: "clear", name: "ic_cancel_clear", size: "lg", className: 'LuiTextInput-iconPosition', spanProps: { onClick: clear } })) : undefined;
55843
+ return (React__default["default"].createElement(LuiTextInput, __assign({}, props, { icon: cancelIcon, value: currentValue, onChange: function (e) {
55844
+ setCurrentValue(e.target.value);
55845
+ if (props.onValueChange) {
55846
+ props.onValueChange(e.target.value);
55847
+ }
55848
+ } })));
55849
+ };
55850
+
55837
55851
  /**
55838
55852
  * Filters options and forwards to internal render function.
55839
55853
  * has option for minimum elements to filter
@@ -55841,11 +55855,14 @@ function setSelectedFirmCache(firmId, firmName) {
55841
55855
  * @constructor
55842
55856
  */
55843
55857
  var LuiFilterContainer = function (props) {
55844
- var renderFunction = props.renderFunction, filterFunction = props.filterFunction, _a = props.showFilter, showFilter = _a === void 0 ? true : _a;
55845
- var _b = React.useState(''), filter = _b[0], setFilter = _b[1];
55858
+ 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;
55859
+ var _c = React.useState(''), filter = _c[0], setFilter = _c[1];
55846
55860
  return (React__default["default"].createElement("div", null,
55847
55861
  showFilter && (React__default["default"].createElement("div", { className: 'LuiFilterContainer-filter-container LuiDeprecatedForms' },
55848
- React__default["default"].createElement("input", { type: "text", placeholder: "Type to filter", value: filter, onChange: function (e) { return setFilter(e.target.value); } }))),
55862
+ isFilterClearable && (React__default["default"].createElement(ClearableLuiTextInput, { label: 'Filter', inputProps: {
55863
+ placeholder: 'Type to filter',
55864
+ }, onValueChange: function (value) { return setFilter(value); } })),
55865
+ !isFilterClearable && (React__default["default"].createElement("input", { type: "text", placeholder: "Type to filter", value: filter, onChange: function (e) { return setFilter(e.target.value); } })))),
55849
55866
  renderFunction(filterFunction(filter))));
55850
55867
  };
55851
55868