@linzjs/lui 17.43.3 → 17.45.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [17.45.0](https://github.com/linz/lui/compare/v17.44.0...v17.45.0) (2023-03-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * **LuiTextAreaInput:** Add warning message support for LuiTextAreaInput ([#901](https://github.com/linz/lui/issues/901)) ([296206d](https://github.com/linz/lui/commit/296206d7d07ec2f1d6b4953668117306110252aa))
7
+
8
+ # [17.44.0](https://github.com/linz/lui/compare/v17.43.3...v17.44.0) (2023-03-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * **LuiExpandableBanner:** allow initial state as prop ([#898](https://github.com/linz/lui/issues/898)) ([f453a11](https://github.com/linz/lui/commit/f453a115e671d56f238509bbbcf6a6a15d032113))
14
+
1
15
  ## [17.43.3](https://github.com/linz/lui/compare/v17.43.2...v17.43.3) (2023-03-21)
2
16
 
3
17
 
@@ -3,5 +3,6 @@ export interface Expandable {
3
3
  className?: string;
4
4
  label: ReactNode;
5
5
  labelPrefix?: ReactNode;
6
+ start?: 'collapsed' | 'expanded';
6
7
  }
7
8
  export declare const LuiExpandableBanner: React.FC<React.PropsWithChildren<Expandable>>;
@@ -6,5 +6,6 @@ export interface LuiTextAreaInputProps {
6
6
  onChange?: ChangeEventHandler<HTMLTextAreaElement>;
7
7
  value: string;
8
8
  error?: string | boolean;
9
+ warning?: string;
9
10
  }
10
11
  export declare const LuiTextAreaInput: (props: LuiTextAreaInputProps) => JSX.Element;
package/dist/index.js CHANGED
@@ -13061,55 +13061,17 @@ var LuiMessagingContextProvider = function (props) {
13061
13061
  };
13062
13062
 
13063
13063
  var LuiExpandableBanner = function (props) {
13064
- var display = React$1.useRef(null);
13065
- var _a = React$1.useState(true), collapse = _a[0], setCollapse = _a[1];
13066
- var collapseSection = function (element) {
13067
- // get the height of the element's inner content, regardless of its actual size
13068
- var sectionHeight = element.scrollHeight;
13069
- // on the next frame (as soon as the previous style change has taken effect),
13070
- // explicitly set the element's height to its current pixel height, so we
13071
- // aren't transitioning out of 'auto'
13072
- requestAnimationFrame(function () {
13073
- element.style.height = sectionHeight + 'px';
13074
- // on the next frame (as soon as the previous style change has taken effect),
13075
- // have the element transition to height: 0
13076
- requestAnimationFrame(function () {
13077
- element.style.height = 0 + 'px';
13078
- });
13079
- });
13080
- // mark the section as "currently collapsed"
13081
- setCollapse(true);
13082
- };
13083
- var expandSection = function (element) {
13084
- // get the height of the element's inner content, regardless of its actual size
13085
- var sectionHeight = element.scrollHeight;
13086
- // have the element transition to the height of its inner content
13087
- element.style.height = sectionHeight + 'px';
13088
- // when the next css transition finishes (which should be the one we just triggered)
13089
- setTimeout(function () {
13090
- element.style.height = 'auto';
13091
- }, 500);
13092
- // mark the section as "currently not collapsed"
13093
- setCollapse(false);
13094
- };
13095
- var expandFunction = function () {
13096
- var section = display.current;
13097
- if (collapse) {
13098
- expandSection(section);
13099
- }
13100
- else {
13101
- collapseSection(section);
13102
- }
13103
- };
13064
+ var initiallyCollapsed = props.start === 'expanded' ? false : true;
13065
+ var _a = React$1.useState(initiallyCollapsed), collapse = _a[0], setCollapse = _a[1];
13104
13066
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
13105
13067
  React__default["default"].createElement("div", { className: clsx$1('lui-expand-container', props.className) },
13106
13068
  props.labelPrefix,
13107
- React__default["default"].createElement("div", { className: 'lui-expand-header', onClick: expandFunction, style: { width: '100%' } },
13069
+ React__default["default"].createElement("div", { className: 'lui-expand-header', onClick: function () { return setCollapse(function (prev) { return !prev; }); }, style: { width: '100%' } },
13108
13070
  React__default["default"].createElement("h3", null, props.label),
13109
13071
  React__default["default"].createElement("i", { className: clsx$1(collapse
13110
13072
  ? 'lui-expand-icon material-icons-round'
13111
13073
  : 'lui-expand-icon material-icons-round lui-expand-icon-transform') }, 'expand_more'))),
13112
- React__default["default"].createElement("div", { className: 'lui-collapse-text', ref: display }, props.children)));
13074
+ React__default["default"].createElement("div", { style: collapse ? { maxHeight: '0px' } : undefined, className: 'lui-accordion-content' }, props.children)));
13113
13075
  };
13114
13076
 
13115
13077
  /**
@@ -15816,7 +15778,7 @@ var LuiSelectInput = function (props) {
15816
15778
  var LuiTextAreaInput = function (props) {
15817
15779
  var _a, _b;
15818
15780
  var id = useGenerateOrDefaultId((_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.id);
15819
- return (React__default["default"].createElement("div", { className: clsx$1('LuiTextAreaInput', ((_b = props.inputProps) === null || _b === void 0 ? void 0 : _b.disabled) ? 'isDisabled' : '', (props === null || props === void 0 ? void 0 : props.error) ? 'hasError' : '') },
15781
+ return (React__default["default"].createElement("div", { className: clsx$1('LuiTextAreaInput', ((_b = props.inputProps) === null || _b === void 0 ? void 0 : _b.disabled) ? 'isDisabled' : '', props.error ? 'hasError' : '', props.warning ? 'hasWarning' : '') },
15820
15782
  React__default["default"].createElement("label", { htmlFor: id },
15821
15783
  props.mandatory && (React__default["default"].createElement("span", { className: "LuiTextAreaInput-mandatory" }, "*")),
15822
15784
  React__default["default"].createElement("span", { className: "LuiTextAreaInput-label" }, props.label),
@@ -15825,7 +15787,10 @@ var LuiTextAreaInput = function (props) {
15825
15787
  React__default["default"].createElement("textarea", __assign$3({ id: id, value: props.value, onChange: props.onChange, rows: 5 }, props.inputProps)))),
15826
15788
  props.error && (React__default["default"].createElement("span", { className: "LuiTextAreaInput-error" },
15827
15789
  React__default["default"].createElement(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextAreaInput-error-icon", size: "sm", status: "error" }),
15828
- props.error))));
15790
+ props.error)),
15791
+ props.warning && (React__default["default"].createElement("span", { className: "LuiTextAreaInput-warning" },
15792
+ React__default["default"].createElement(LuiIcon, { alt: "warning", name: "ic_warning", className: "LuiTextAreaInput-warning-icon", size: "sm", status: "warning" }),
15793
+ props.warning))));
15829
15794
  };
15830
15795
 
15831
15796
  var LuiDateInput = function (_a) {