@bigbinary/neetoui 5.0.4 → 5.0.6

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/index.d.ts CHANGED
@@ -324,6 +324,7 @@ export type SelectProps = {
324
324
  id?: string;
325
325
  loadOptions?: boolean;
326
326
  labelProps?: LabelProps;
327
+ optionRemapping?: { label?: string, value?: string }
327
328
  [key: string]: any;
328
329
  };
329
330
 
package/index.js CHANGED
@@ -10773,7 +10773,7 @@ var UniqueArray = /*#__PURE__*/function () {
10773
10773
  var renderFocusOnFocusableElements = function renderFocusOnFocusableElements(ref) {
10774
10774
  var _ref$current, _ref$current2;
10775
10775
  var shouldFocusFirstFocusableElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
10776
- var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
10776
+ var focusableElements = '[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
10777
10777
  var firstFocusableElement = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelectorAll(focusableElements)[0];
10778
10778
  var focusableContent = ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.querySelectorAll(focusableElements);
10779
10779
  var lastFocusableElement = focusableContent[(focusableContent === null || focusableContent === void 0 ? void 0 : focusableContent.length) - 1];
@@ -17548,12 +17548,12 @@ var useOverlay = function useOverlay(_ref) {
17548
17548
  var focusRequiredElementInOverlay = function focusRequiredElementInOverlay() {
17549
17549
  if (hasTransitionCompleted) {
17550
17550
  var _initialFocusRef;
17551
- if (!((_initialFocusRef = initialFocusRef) !== null && _initialFocusRef !== void 0 && _initialFocusRef.current)) {
17552
- renderFocusOnFocusableElements(overlayWrapper);
17553
- } else {
17551
+ if ((_initialFocusRef = initialFocusRef) !== null && _initialFocusRef !== void 0 && _initialFocusRef.current) {
17554
17552
  var _initialFocusRef2, _initialFocusRef2$cur;
17555
17553
  (_initialFocusRef2 = initialFocusRef) === null || _initialFocusRef2 === void 0 ? void 0 : (_initialFocusRef2$cur = _initialFocusRef2.current) === null || _initialFocusRef2$cur === void 0 ? void 0 : _initialFocusRef2$cur.focus();
17556
17554
  renderFocusOnFocusableElements(overlayWrapper, false);
17555
+ } else {
17556
+ renderFocusOnFocusableElements(overlayWrapper);
17557
17557
  }
17558
17558
  }
17559
17559
  };
@@ -27722,13 +27722,13 @@ var Pane = function Pane(_ref) {
27722
27722
  handleOverlayClose = _useOverlay.handleOverlayClose,
27723
27723
  setFocusField = _useOverlay.setFocusField;
27724
27724
  useEffect(function () {
27725
- if (isOpen) {
27725
+ if (hasTransitionCompleted) {
27726
27726
  var headerHeight = getHeaderHeight(paneWrapper);
27727
27727
  if (headerHeight > DEFAULT_PANE_HEADER_HEIGHT) {
27728
27728
  paneWrapper.current.style.setProperty("--neeto-ui-pane-header-height", "".concat(headerHeight, "px"));
27729
27729
  }
27730
27730
  }
27731
- }, [isOpen]);
27731
+ }, [hasTransitionCompleted]);
27732
27732
  return /*#__PURE__*/React__default.createElement(Portal, {
27733
27733
  rootId: "neeto-ui-portal"
27734
27734
  }, /*#__PURE__*/React__default.createElement(CSSTransition, {
@@ -27736,7 +27736,7 @@ var Pane = function Pane(_ref) {
27736
27736
  appear: isOpen,
27737
27737
  classNames: "neeto-ui-pane",
27738
27738
  "in": isOpen,
27739
- timeout: 300,
27739
+ timeout: 230,
27740
27740
  onEntered: function onEntered() {
27741
27741
  return setHasTransitionCompleted(true);
27742
27742
  },
@@ -27764,9 +27764,9 @@ var Pane = function Pane(_ref) {
27764
27764
  size: "small",
27765
27765
  style: "text",
27766
27766
  onClick: handleOverlayClose
27767
- }), typeof children === "function" ? children({
27767
+ }), hasTransitionCompleted && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, typeof children === "function" ? children({
27768
27768
  setFocusField: setFocusField
27769
- }) : children))));
27769
+ }) : children)))));
27770
27770
  };
27771
27771
  Pane.Header = Header;
27772
27772
  Pane.Body = Body;
@@ -28024,7 +28024,7 @@ var AsyncCreatableSelect = /*#__PURE__*/forwardRef$1(function (props, ref) {
28024
28024
  }, selectProps));
28025
28025
  });
28026
28026
 
28027
- var _excluded$b = ["size", "label", "required", "error", "helpText", "className", "innerRef", "isCreateable", "strategy", "id", "labelProps", "value", "defaultValue", "components"];
28027
+ var _excluded$b = ["size", "label", "required", "error", "helpText", "className", "innerRef", "isCreateable", "strategy", "id", "labelProps", "value", "defaultValue", "components", "optionRemapping"];
28028
28028
  function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
28029
28029
  function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty$7(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28030
28030
  var SIZES$3 = {
@@ -28067,6 +28067,8 @@ var Select = function Select(_ref) {
28067
28067
  value = _ref.value,
28068
28068
  defaultValue = _ref.defaultValue,
28069
28069
  componentOverrides = _ref.components,
28070
+ _ref$optionRemapping = _ref.optionRemapping,
28071
+ optionRemapping = _ref$optionRemapping === void 0 ? {} : _ref$optionRemapping,
28070
28072
  otherProps = _objectWithoutProperties$1(_ref, _excluded$b);
28071
28073
  var inputId = useId(id);
28072
28074
  var Parent = StateManagedSelect;
@@ -28076,6 +28078,12 @@ var Select = function Select(_ref) {
28076
28078
  if (otherProps.loadOptions) {
28077
28079
  Parent = isCreateable ? AsyncCreatableSelect : AsyncSelect;
28078
28080
  }
28081
+ if (optionRemapping.value) {
28082
+ otherProps.getOptionValue = prop(optionRemapping.value);
28083
+ }
28084
+ if (optionRemapping.label) {
28085
+ otherProps.getOptionLabel = prop(optionRemapping.label);
28086
+ }
28079
28087
  var portalProps = strategy === STRATEGIES.fixed && {
28080
28088
  menuPortalTarget: document.body,
28081
28089
  styles: {
@@ -32652,9 +32660,16 @@ var Table = function Table(_ref) {
32652
32660
  }
32653
32661
  }
32654
32662
  }, [resizeObserver.current, fixedHeight]);
32663
+ var handleHeaderClasses = function handleHeaderClasses() {
32664
+ var _headerRef$current;
32665
+ Object.values((_headerRef$current = headerRef.current) === null || _headerRef$current === void 0 ? void 0 : _headerRef$current.children).forEach(function (child) {
32666
+ child.setAttribute("data-text-align", child.style["text-align"]);
32667
+ });
32668
+ };
32655
32669
  useTimeout(function () {
32656
32670
  var headerHeight = headerRef.current ? headerRef.current.offsetHeight : TABLE_DEFAULT_HEADER_HEIGHT;
32657
32671
  setHeaderHeight(headerHeight);
32672
+ handleHeaderClasses();
32658
32673
  }, 0);
32659
32674
  var _useReorderColumns = useReorderColumns({
32660
32675
  isEnabled: enableColumnReorder,
@@ -32771,6 +32786,7 @@ var Table = function Table(_ref) {
32771
32786
  x: "max-content",
32772
32787
  y: calculateTableContainerHeight()
32773
32788
  }, scroll),
32789
+ onChange: handleHeaderClasses,
32774
32790
  onHeaderRow: function onHeaderRow() {
32775
32791
  return {
32776
32792
  ref: headerRef,