"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "PickerItem", {
  enumerable: true,
  get: function get() {
    return _PickerItem2["default"];
  }
});
exports.PickerDecorator = exports.PickerBase = exports.Picker = exports.ChangeAdapter = exports["default"] = void 0;

var _jsxRuntime = require("react/jsx-runtime");

var _handle = require("@enact/core/handle");

var _kind = _interopRequireDefault(require("@enact/core/kind"));

var _hoc = _interopRequireDefault(require("@enact/core/hoc"));

var _Spottable = _interopRequireDefault(require("@enact/spotlight/Spottable"));

var _Changeable = _interopRequireDefault(require("@enact/ui/Changeable"));

var _IdProvider = _interopRequireDefault(require("@enact/ui/internal/IdProvider"));

var _Touchable = _interopRequireDefault(require("@enact/ui/Touchable"));

var _ViewManager = require("@enact/ui/ViewManager");

var _propTypes = _interopRequireDefault(require("prop-types"));

var _clamp = _interopRequireDefault(require("ramda/src/clamp"));

var _compose = _interopRequireDefault(require("ramda/src/compose"));

var _$L = _interopRequireDefault(require("../$L"));

var _Picker = require("./Picker");

var _Skinnable = _interopRequireDefault(require("../../Skinnable"));

var _PickerModule = _interopRequireDefault(require("./Picker.module.css"));

var _PickerItem2 = _interopRequireDefault(require("./PickerItem"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var PickerRoot = (0, _Touchable["default"])('div');
var PickerButtonItem = (0, _Spottable["default"])('div');

var wrapRange = function wrapRange(min, max, value) {
  if (value > max) {
    return min + (value - max - 1);
  } else if (value < min) {
    return max - (min - value - 1);
  } else {
    return value;
  }
};

var handleChange = function handleChange(direction) {
  return (0, _handle.handle)((0, _handle.adaptEvent)(function (ev, _ref) {
    var min = _ref.min,
        max = _ref.max,
        step = _ref.step,
        value = _ref.value,
        wrap = _ref.wrap;
    return {
      value: wrap ? wrapRange(min, max, value + direction * step) : (0, _clamp["default"])(min, max, value + direction * step),
      reverseTransition: direction < 0
    };
  }, (0, _handle.forward)('onChange')));
};

var increment = handleChange(1);
var decrement = handleChange(-1);
/**
 * The base component for {@link agate/internal/Picker.Picker}.
 *
 * @class Picker
 * @memberof agate/internal/Picker
 * @ui
 * @private
 */

var PickerBase = (0, _kind["default"])({
  name: 'Picker',
  propTypes:
  /** @lends agate/internal/Picker.Picker.prototype */
  {
    /**
     * Index for internal ViewManager
     *
     * @type {Number}
     * @required
     * @public
     */
    index: _propTypes["default"].number.isRequired,

    /**
     * The maximum value selectable by the picker (inclusive).
     *
     * The range between `min` and `max` should be evenly divisible by
     * [step]{@link agate/internal/Picker.Picker.step}.
     *
     * @type {Number}
     * @required
     * @public
     */
    max: _propTypes["default"].number.isRequired,

    /**
     * The minimum value selectable by the picker (inclusive).
     *
     * The range between `min` and `max` should be evenly divisible by
     * [step]{@link agate/internal/Picker.Picker.step}.
     *
     * @type {Number}
     * @required
     * @public
     */
    min: _propTypes["default"].number.isRequired,

    /**
     * Accessibility hint
     *
     * For example, `hour`, `year`, and `meridiem`
     *
     * @type {String}
     * @default ''
     * @public
     */
    accessibilityHint: _propTypes["default"].string,

    /**
     * The "aria-label" for the picker.
     *
     * By default, `aria-valuetext` is set to the current value.
     * This should only be used when the parent controls the value of
     * the picker directly through the props.
     *
     * @type {String}
     * @public
     */
    'aria-label': _propTypes["default"].string,

    /**
     * Overrides the `aria-valuetext` for the picker. By default, `aria-valuetext` is set
     * to the current value. This should only be used when the parent controls the value of
     * the picker directly through the props.
     *
     * @type {String|Number}
     * @memberof agate/internal/Picker.Picker.prototype
     * @public
     */
    'aria-valuetext': _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),

    /**
     * Children from which to pick
     *
     * @type {Node}
     * @public
     */
    children: _propTypes["default"].node,

    /**
     * Class name for component.
     *
     * @type {String}
     * @public
     */
    className: _propTypes["default"].string,

    /**
     * Customize component style
     *
     * @type {Object}
     * @private
     */
    css: _propTypes["default"].object,

    /**
     * Sets the hint string read when focusing the decrement button.
     *
     * @type {String}
     * @default 'previous item'
     * @public
     */
    decrementAriaLabel: _propTypes["default"].string,

    /**
     * Disables the picker.
     *
     * @type {Boolean}
     * @public
     */
    disabled: _propTypes["default"].bool,

    /**
     * The picker id reference for setting aria-controls.
     *
     * @type {String}
     * @private
     */
    id: _propTypes["default"].string,

    /**
     * Sets the hint string read when focusing the increment button.
     *
     * @default 'next item'
     * @type {String}
     * @public
     */
    incrementAriaLabel: _propTypes["default"].string,

    /**
     * By default, the picker will animate transitions between items if it has a defined
     * `width`. Specifying `noAnimation` will prevent any transition animation for the
     * component.
     *
     * @type {Boolean}
     * @public
     */
    noAnimation: _propTypes["default"].bool,

    /**
     * A function to run when the control should increment or decrement.
     *
     * @type {Function}
     * @public
     */
    onChange: _propTypes["default"].func,

    /**
     * A function to run when the picker is removed while retaining focus.
     *
     * @type {Function}
     * @private
     */
    onSpotlightDisappear: _propTypes["default"].func,

    /**
     * Orientation of the picker.
     *
     * Controls whether the buttons are arranged horizontally or vertically around the value.
     *
     * * Values: `'horizontal'`, `'vertical'`
     *
     * @type {String}
     * @default 'vertical'
     * @public
     */
    orientation: _propTypes["default"].oneOf(['horizontal', 'vertical']),

    /**
     * When it's `true` it changes the direction of the transition animation.
     *
     * @type {Boolean}
     * @public
     */
    reverseTransition: _propTypes["default"].bool,

    /**
     * The current skin for this component.
     *
     * @type {String}
     * @public
     */
    skin: _propTypes["default"].string,

    /**
     * When `true`, the component cannot be navigated using spotlight.
     *
     * @type {Boolean}
     * @public
     */
    spotlightDisabled: _propTypes["default"].bool,

    /**
     * Allow the picker to only increment or decrement by a given value.
     *
     * A step of `2` would cause a picker to increment from 10 to 12 to 14, etc. It must evenly
     * divide into the range designated by `min` and `max`.
     *
     * @type {Number}
     * @default 1
     * @public
     */
    step: _propTypes["default"].number,

    /**
     * The type of picker. It determines the aria-label for the next and previous buttons.
     *
     * Depending on the `type`, `decrementAriaLabel`, and `incrementAriaLabel`,
     * the screen readers read out differently when Spotlight is on the next button, the previous button,
     * or the picker itself.
     *
     * For example, if Spotlight is on the next button
     * and aria label props(`decrementAriaLabel` and `incrementAriaLabel`) are not defined,
     * then the screen readers read out as follows.
     *	`'string'` type: `'next item'`
     * 	`'number'` type: `'increase the value'`
     *
     * @type {('number'|'string')}
     * @default 'string'
     * @public
     */
    type: _propTypes["default"].oneOf(['number', 'string']),

    /**
     * Index of the selected child.
     *
     * @type {Number}
     * @default 0
     * @public
     */
    value: _propTypes["default"].number,

    /**
     * Choose a specific size for your picker. `'small'`, `'medium'`, `'large'`, or set to `null` to
     * assume auto-sizing. `'small'` is good for numeric pickers, `'medium'` for single or short
     * word pickers, `'large'` for maximum-sized pickers.
     *
     * You may also supply a number. This number will determine the minimum size of the Picker.
     * Setting a number to less than the number of characters in your longest value may produce
     * unexpected results.
     *
     * @type {('small'|'medium'|'large'|Number)}
     * @public
     */
    width: _propTypes["default"].oneOfType([_propTypes["default"].oneOf([null, 'small', 'medium', 'large']), _propTypes["default"].number]),

    /**
     * Should the picker stop incrementing when the picker reaches the last element? Set `wrap`
     * to `true` to allow the picker to continue from the opposite end of the list of options.
     *
     * @type {Boolean}
     * @public
     */
    wrap: _propTypes["default"].bool
  },
  defaultProps: {
    accessibilityHint: '',
    orientation: 'vertical',
    step: 1,
    type: 'string',
    value: 0
  },
  styles: {
    css: _PickerModule["default"],
    className: 'picker',
    publicClassNames: true
  },
  handlers: {
    handleDecrement: decrement,
    handleFlick: (0, _handle.handle)((0, _handle.forEventProp)('direction', 'vertical'), // ignore "slow" flicks by filtering out velocity below a threshold
    (0, _handle.oneOf)([function (_ref2) {
      var velocityY = _ref2.velocityY;
      return velocityY < 0;
    }, increment], [function (_ref3) {
      var velocityY = _ref3.velocityY;
      return velocityY > 0;
    }, decrement])),
    handleIncrement: increment
  },
  computed: {
    activeClassName: function activeClassName(_ref4) {
      var styler = _ref4.styler;
      return styler.join('active', 'item');
    },
    'aria-label': function ariaLabel(_ref5) {
      var _ariaLabel = _ref5['aria-label'],
          valueText = _ref5['aria-valuetext'];

      if (_ariaLabel != null) {
        return _ariaLabel;
      }

      return valueText;
    },
    className: function className(_ref6) {
      var orientation = _ref6.orientation,
          styler = _ref6.styler;
      return styler.append(orientation);
    },
    currentItemIndex: function currentItemIndex(_ref7) {
      var values = _ref7.children,
          index = _ref7.index,
          max = _ref7.max,
          min = _ref7.min,
          wrap = _ref7.wrap;

      if (Array.isArray(values)) {
        if (wrap) {
          return wrapRange(min, max, index);
        } else return index;
      } else return 0;
    },
    currentValueText: function currentValueText(_ref8) {
      var accessibilityHint = _ref8.accessibilityHint,
          ariaValueText = _ref8['aria-valuetext'],
          children = _ref8.children,
          value = _ref8.value;

      if (ariaValueText != null) {
        return ariaValueText;
      }

      var valueText = value;

      if (children && Array.isArray(children)) {
        if (children[value] && children[value].props) {
          valueText = children[value].props.children;
        } else {
          valueText = children[value];
        }
      }

      if (accessibilityHint) {
        valueText = "".concat(valueText, " ").concat(accessibilityHint);
      }

      return valueText;
    },
    decrementAriaLabel: function decrementAriaLabel(_ref9) {
      var _decrementAriaLabel = _ref9.decrementAriaLabel,
          type = _ref9.type;

      if (_decrementAriaLabel != null) {
        return _decrementAriaLabel;
      }

      if (type === 'number') {
        return "".concat((0, _$L["default"])('decrease the value'));
      } else {
        return "".concat((0, _$L["default"])('previous item'));
      }
    },
    decrementItemIndex: function decrementItemIndex(_ref10) {
      var values = _ref10.children,
          index = _ref10.index,
          max = _ref10.max,
          min = _ref10.min,
          wrap = _ref10.wrap;

      if (Array.isArray(values)) {
        if (wrap) {
          return wrapRange(min, max, index - 1);
        } else return index - 1;
      } else return 0;
    },
    incrementAriaLabel: function incrementAriaLabel(_ref11) {
      var _incrementAriaLabel = _ref11.incrementAriaLabel,
          type = _ref11.type;

      if (_incrementAriaLabel != null) {
        return _incrementAriaLabel;
      }

      if (type === 'number') {
        return "".concat((0, _$L["default"])('increase the value'));
      } else {
        return "".concat((0, _$L["default"])('next item'));
      }
    },
    incrementItemIndex: function incrementItemIndex(_ref12) {
      var values = _ref12.children,
          index = _ref12.index,
          max = _ref12.max,
          min = _ref12.min,
          wrap = _ref12.wrap;

      if (Array.isArray(values)) {
        if (wrap) {
          return wrapRange(min, max, index + 1);
        } else return index + 1;
      } else return 0;
    },
    secondaryDecrementItemIndex: function secondaryDecrementItemIndex(_ref13) {
      var values = _ref13.children,
          index = _ref13.index,
          max = _ref13.max,
          min = _ref13.min,
          wrap = _ref13.wrap;

      if (Array.isArray(values)) {
        if (wrap) {
          return wrapRange(min, max, index - 2);
        } else return index - 2;
      } else return 0;
    },
    secondaryIncrementItemIndex: function secondaryIncrementItemIndex(_ref14) {
      var values = _ref14.children,
          index = _ref14.index,
          max = _ref14.max,
          min = _ref14.min,
          wrap = _ref14.wrap;

      if (Array.isArray(values)) {
        if (wrap) {
          return wrapRange(min, max, index + 2);
        } else return index + 2;
      } else return 0;
    },
    valueId: function valueId(_ref15) {
      var id = _ref15.id;
      return "".concat(id, "_value");
    }
  },
  render: function render(props) {
    var activeClassName = props.activeClassName,
        ariaLabel = props['aria-label'],
        values = props.children,
        currentItemIndex = props.currentItemIndex,
        currentValueText = props.currentValueText,
        decAriaLabel = props.decrementAriaLabel,
        decrementItemIndex = props.decrementItemIndex,
        disabled = props.disabled,
        handleDecrement = props.handleDecrement,
        handleFlick = props.handleFlick,
        handleIncrement = props.handleIncrement,
        incAriaLabel = props.incrementAriaLabel,
        incrementItemIndex = props.incrementItemIndex,
        min = props.min,
        max = props.max,
        noAnimation = props.noAnimation,
        onSpotlightDisappear = props.onSpotlightDisappear,
        orientation = props.orientation,
        reverseTransition = props.reverseTransition,
        secondaryDecrementItemIndex = props.secondaryDecrementItemIndex,
        secondaryIncrementItemIndex = props.secondaryIncrementItemIndex,
        skin = props.skin,
        spotlightDisabled = props.spotlightDisabled,
        step = props.step,
        value = props.value,
        valueId = props.valueId,
        width = props.width,
        wrap = props.wrap,
        rest = _objectWithoutProperties(props, ["activeClassName", "aria-label", "children", "currentItemIndex", "currentValueText", "decrementAriaLabel", "decrementItemIndex", "disabled", "handleDecrement", "handleFlick", "handleIncrement", "incrementAriaLabel", "incrementItemIndex", "min", "max", "noAnimation", "onSpotlightDisappear", "orientation", "reverseTransition", "secondaryDecrementItemIndex", "secondaryIncrementItemIndex", "skin", "spotlightDisabled", "step", "value", "valueId", "width", "wrap"]);

    var isFirst = value <= min;
    var isLast = value >= max;
    var isSecond = value <= min + step;
    var isPenultimate = value >= max - step;
    var decrementAriaLabel = "".concat(currentValueText, " ").concat(decAriaLabel);
    var incrementAriaLabel = "".concat(currentValueText, " ").concat(incAriaLabel);
    var transitionDuration = 150;

    var decrementValue = function decrementValue() {
      var clampledValue = min < max ? (0, _clamp["default"])(min, max, value - step) : min;
      var restrictedDecrementValue = wrap ? wrapRange(min, max, value - step) : clampledValue;

      if (isFirst && !wrap) {
        return '';
      } else if (Array.isArray(values)) {
        return values;
      } else {
        return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.PickerItem, {
          style: {
            direction: 'ltr'
          },
          children: restrictedDecrementValue
        }, restrictedDecrementValue);
      }
    };

    var incrementValue = function incrementValue() {
      var clampledValue = min < max ? (0, _clamp["default"])(min, max, value + step) : max;
      var restrictedIncrementValue = wrap ? wrapRange(min, max, value + step) : clampledValue;

      if (isLast && !wrap) {
        return '';
      } else if (Array.isArray(values)) {
        return values;
      } else {
        return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.PickerItem, {
          style: {
            direction: 'ltr'
          },
          children: restrictedIncrementValue
        }, restrictedIncrementValue);
      }
    };

    var secondaryDecrementValue = function secondaryDecrementValue() {
      var restrictedSecondaryDecrementValue = wrap ? wrapRange(min, max, value - 2 * step) : (0, _clamp["default"])(min, max, value - 2 * step);

      if (isSecond && !wrap) {
        return '';
      } else if (Array.isArray(values)) {
        return values;
      } else {
        return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.PickerItem, {
          style: {
            direction: 'ltr'
          },
          children: restrictedSecondaryDecrementValue
        }, restrictedSecondaryDecrementValue);
      }
    };

    var secondaryIncrementValue = function secondaryIncrementValue() {
      var restrictedSecondaryIncrementValue = wrap ? wrapRange(min, max, value + 2 * step) : (0, _clamp["default"])(min, max, value + 2 * step);

      if (isPenultimate && !wrap) {
        return '';
      } else if (Array.isArray(values)) {
        return values;
      } else {
        return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.PickerItem, {
          style: {
            direction: 'ltr'
          },
          children: restrictedSecondaryIncrementValue
        }, restrictedSecondaryIncrementValue);
      }
    };

    var sizingPlaceholder = null;

    if (typeof width === 'number' && width > 0) {
      sizingPlaceholder = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        "aria-hidden": true,
        className: _PickerModule["default"].sizingPlaceholder,
        children: '0'.repeat(width)
      });
    }

    var horizontal = orientation === 'horizontal';
    var arranger = horizontal ? _ViewManager.SlideLeftArranger : _ViewManager.SlideTopArranger;
    delete rest['aria-valuetext'];
    delete rest.accessibilityHint;
    delete rest.decrementAriaLabel;
    delete rest.incrementAriaLabel;
    delete rest.noAnimation;
    delete rest.onChange;
    delete rest.orientation;
    delete rest.wrap;
    return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickerRoot, _objectSpread(_objectSpread({}, rest), {}, {
      onFlick: handleFlick,
      children: [skin === 'silicon' && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerButtonItem, {
        "aria-controls": valueId,
        "aria-disabled": isSecond,
        "aria-label": decrementAriaLabel,
        className: _PickerModule["default"].secondaryItemDecrement,
        disabled: disabled || isSecond,
        onClick: secondaryDecrementValue() === '' ? function () {} : function () {
          handleDecrement();
          setTimeout(function () {
            return handleDecrement();
          }, transitionDuration);
        },
        onSpotlightDisappear: onSpotlightDisappear,
        spotlightDisabled: spotlightDisabled || secondaryDecrementValue() === '',
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewManager.ViewManager, {
          "aria-hidden": true,
          arranger: arranger,
          className: _PickerModule["default"].viewManager,
          duration: transitionDuration,
          index: secondaryDecrementItemIndex,
          noAnimation: noAnimation || disabled,
          reverseTransition: reverseTransition,
          children: secondaryDecrementValue()
        })
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerButtonItem, {
        "aria-controls": valueId,
        "aria-disabled": disabled || isFirst,
        "aria-label": decrementAriaLabel,
        className: _PickerModule["default"].itemDecrement,
        disabled: disabled || isFirst,
        onClick: decrementValue() === '' ? function () {} : handleDecrement,
        onSpotlightDisappear: onSpotlightDisappear,
        spotlightDisabled: spotlightDisabled || decrementValue() === '',
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewManager.ViewManager, {
          "aria-hidden": true,
          arranger: arranger,
          className: _PickerModule["default"].viewManager,
          duration: transitionDuration,
          index: decrementItemIndex,
          noAnimation: noAnimation || disabled,
          reverseTransition: reverseTransition,
          children: decrementValue()
        })
      }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
        "aria-label": ariaLabel,
        "aria-valuetext": currentValueText,
        className: activeClassName,
        id: valueId,
        role: "spinbutton",
        children: [sizingPlaceholder, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewManager.ViewManager, {
          "aria-hidden": true,
          arranger: arranger,
          className: _PickerModule["default"].viewManager,
          duration: transitionDuration,
          index: currentItemIndex,
          noAnimation: noAnimation || disabled,
          reverseTransition: reverseTransition,
          children: values
        })]
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerButtonItem, {
        "aria-controls": valueId,
        "aria-disabled": disabled || isLast,
        "aria-label": incrementAriaLabel,
        className: _PickerModule["default"].itemIncrement,
        disabled: disabled || isLast,
        onClick: incrementValue() === '' ? function () {} : handleIncrement,
        onSpotlightDisappear: onSpotlightDisappear,
        spotlightDisabled: spotlightDisabled || incrementValue() === '',
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewManager.ViewManager, {
          "aria-hidden": true,
          arranger: arranger,
          className: _PickerModule["default"].viewManager,
          duration: transitionDuration,
          index: incrementItemIndex,
          noAnimation: noAnimation || disabled,
          reverseTransition: reverseTransition,
          children: incrementValue()
        })
      }), skin === 'silicon' && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerButtonItem, {
        "aria-controls": valueId,
        "aria-disabled": isPenultimate,
        "aria-label": incrementAriaLabel,
        className: _PickerModule["default"].secondaryItemIncrement,
        disabled: disabled || isPenultimate,
        onClick: secondaryIncrementValue() === '' ? function () {} : function () {
          handleIncrement();
          setTimeout(function () {
            return handleIncrement();
          }, transitionDuration);
        },
        onSpotlightDisappear: onSpotlightDisappear,
        spotlightDisabled: spotlightDisabled || secondaryIncrementValue() === '',
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewManager.ViewManager, {
          "aria-hidden": true,
          arranger: arranger,
          className: _PickerModule["default"].viewManager,
          duration: transitionDuration,
          index: secondaryIncrementItemIndex,
          noAnimation: noAnimation || disabled,
          reverseTransition: reverseTransition,
          children: secondaryIncrementValue()
        })
      })]
    }));
  }
});
/**
 * A higher-order component that filters the values returned by the onChange event on {@link agate/internal/Picker.Picker}
 *
 * @class ChangeAdapter
 * @hoc
 * @memberof agate/internal/Picker
 * @private
 */

exports.PickerBase = PickerBase;
var ChangeAdapter = (0, _hoc["default"])(function (config, Wrapped) {
  return (0, _kind["default"])({
    name: 'ChangeAdapter',
    handlers: {
      onChange: (0, _handle.handle)((0, _handle.adaptEvent)(function (_ref16) {
        var value = _ref16.value;
        return {
          value: value
        };
      }, (0, _handle.forward)('onChange')))
    },
    render: function render(props) {
      return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props));
    }
  });
});
/**
 * Applies Agate specific behaviors to [Picker]{@link agate/Picker.Picker}.
 *
 * @hoc
 * @memberof agate/internal/Picker
 * @mixes ui/Changeable.Changeable
 * @mixes agate/Skinnable.Skinnable
 * @private
 */

exports.ChangeAdapter = ChangeAdapter;
var PickerDecorator = (0, _compose["default"])((0, _IdProvider["default"])({
  generateProp: null
}), _Changeable["default"], (0, _Changeable["default"])({
  prop: 'reverseTransition'
}), (0, _Skinnable["default"])({
  prop: 'skin'
}));
exports.PickerDecorator = PickerDecorator;
var Picker = PickerDecorator(PickerBase);
exports.Picker = Picker;
var _default = Picker;
exports["default"] = _default;