@linzjs/lui 17.43.2 → 17.44.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.44.0](https://github.com/linz/lui/compare/v17.43.3...v17.44.0) (2023-03-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * **LuiExpandableBanner:** allow initial state as prop ([#898](https://github.com/linz/lui/issues/898)) ([f453a11](https://github.com/linz/lui/commit/f453a115e671d56f238509bbbcf6a6a15d032113))
7
+
8
+ ## [17.43.3](https://github.com/linz/lui/compare/v17.43.2...v17.43.3) (2023-03-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **LuiSelectInput:** add id to control ([#887](https://github.com/linz/lui/issues/887)) ([d07e3b0](https://github.com/linz/lui/commit/d07e3b069add3a9a1615d3754755e6b4e6891a23))
14
+
1
15
  ## [17.43.2](https://github.com/linz/lui/compare/v17.43.1...v17.43.2) (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>>;
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
  /**
@@ -15804,7 +15766,7 @@ var LuiSelectInput = function (props) {
15804
15766
  props.mandatory && React__default["default"].createElement("span", { className: "LuiSelect-mandatory" }, "*"),
15805
15767
  React__default["default"].createElement("span", { className: clsx$1('LuiSelect-label-text', props.hideLabel ? 'LuiScreenReadersOnly' : '') }, props.label),
15806
15768
  React__default["default"].createElement("div", { className: "LuiSelect-wrapper" },
15807
- React__default["default"].createElement("select", __assign$3({ name: id, onChange: props.onChange, value: props.value, className: "LuiSelect-select" }, props.selectProps),
15769
+ React__default["default"].createElement("select", __assign$3({ name: id, id: id, onChange: props.onChange, value: props.value, className: "LuiSelect-select" }, props.selectProps),
15808
15770
  props.placeholderText && (React__default["default"].createElement("option", { value: "", disabled: true }, props.placeholderText)),
15809
15771
  props.options.map(function (selection) { return (React__default["default"].createElement("option", { key: selection.value, value: selection.value }, selection.label)); })),
15810
15772
  React__default["default"].createElement(LuiIcon, { alt: 'Error', name: "ic_keyboard_arrow_down", className: "LuiSelect-chevron-icon", size: "md" })),