0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

View file

@ -0,0 +1,194 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _extends = require('@babel/runtime/helpers/extends');
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
var _createClass = require('@babel/runtime/helpers/createClass');
var _inherits = require('@babel/runtime/helpers/inherits');
var index = require('../../dist/index-fe3694ff.cjs.dev.js');
var React = require('react');
var base_dist_reactSelect = require('../../dist/Select-92d95971.cjs.dev.js');
var stateManager = require('../../dist/stateManager-80f4e9df.cjs.dev.js');
require('@emotion/react');
require('@babel/runtime/helpers/taggedTemplateLiteral');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/typeof');
require('react-input-autosize');
require('@babel/runtime/helpers/defineProperty');
require('react-dom');
require('memoize-one');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var _extends__default = /*#__PURE__*/_interopDefault(_extends);
var _toConsumableArray__default = /*#__PURE__*/_interopDefault(_toConsumableArray);
var _classCallCheck__default = /*#__PURE__*/_interopDefault(_classCallCheck);
var _createClass__default = /*#__PURE__*/_interopDefault(_createClass);
var _inherits__default = /*#__PURE__*/_interopDefault(_inherits);
var React__default = /*#__PURE__*/_interopDefault(React);
var compareOption = function compareOption() {
var inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var option = arguments.length > 1 ? arguments[1] : undefined;
var accessors = arguments.length > 2 ? arguments[2] : undefined;
var candidate = String(inputValue).toLowerCase();
var optionValue = String(accessors.getOptionValue(option)).toLowerCase();
var optionLabel = String(accessors.getOptionLabel(option)).toLowerCase();
return optionValue === candidate || optionLabel === candidate;
};
var builtins = {
formatCreateLabel: function formatCreateLabel(inputValue) {
return "Create \"".concat(inputValue, "\"");
},
isValidNewOption: function isValidNewOption(inputValue, selectValue, selectOptions, accessors) {
return !(!inputValue || selectValue.some(function (option) {
return compareOption(inputValue, option, accessors);
}) || selectOptions.some(function (option) {
return compareOption(inputValue, option, accessors);
}));
},
getNewOptionData: function getNewOptionData(inputValue, optionLabel) {
return {
label: optionLabel,
value: inputValue,
__isNew__: true
};
},
getOptionValue: base_dist_reactSelect.getOptionValue,
getOptionLabel: base_dist_reactSelect.getOptionLabel
};
var defaultProps = index._objectSpread2({
allowCreateWhileLoading: false,
createOptionPosition: 'last'
}, builtins);
var makeCreatableSelect = function makeCreatableSelect(SelectComponent) {
var _class, _temp;
return _temp = _class = /*#__PURE__*/function (_Component) {
_inherits__default['default'](Creatable, _Component);
var _super = index._createSuper(Creatable);
function Creatable(props) {
var _this;
_classCallCheck__default['default'](this, Creatable);
_this = _super.call(this, props);
_this.select = void 0;
_this.onChange = function (newValue, actionMeta) {
var _this$props = _this.props,
getNewOptionData = _this$props.getNewOptionData,
inputValue = _this$props.inputValue,
isMulti = _this$props.isMulti,
onChange = _this$props.onChange,
onCreateOption = _this$props.onCreateOption,
value = _this$props.value,
name = _this$props.name;
if (actionMeta.action !== 'select-option') {
return onChange(newValue, actionMeta);
}
var newOption = _this.state.newOption;
var valueArray = Array.isArray(newValue) ? newValue : [newValue];
if (valueArray[valueArray.length - 1] === newOption) {
if (onCreateOption) onCreateOption(inputValue);else {
var newOptionData = getNewOptionData(inputValue, inputValue);
var newActionMeta = {
action: 'create-option',
name: name,
option: newOptionData
};
if (isMulti) {
onChange([].concat(_toConsumableArray__default['default'](index.cleanValue(value)), [newOptionData]), newActionMeta);
} else {
onChange(newOptionData, newActionMeta);
}
}
return;
}
onChange(newValue, actionMeta);
};
var options = props.options || [];
_this.state = {
newOption: undefined,
options: options
};
return _this;
}
_createClass__default['default'](Creatable, [{
key: "focus",
value: function focus() {
this.select.focus();
}
}, {
key: "blur",
value: function blur() {
this.select.blur();
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var options = this.state.options;
return /*#__PURE__*/React__default['default'].createElement(SelectComponent, _extends__default['default']({}, this.props, {
ref: function ref(_ref) {
_this2.select = _ref;
},
options: options,
onChange: this.onChange
}));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
var allowCreateWhileLoading = props.allowCreateWhileLoading,
createOptionPosition = props.createOptionPosition,
formatCreateLabel = props.formatCreateLabel,
getNewOptionData = props.getNewOptionData,
inputValue = props.inputValue,
isLoading = props.isLoading,
isValidNewOption = props.isValidNewOption,
value = props.value,
getOptionValue = props.getOptionValue,
getOptionLabel = props.getOptionLabel;
var options = props.options || [];
var newOption = state.newOption;
if (isValidNewOption(inputValue, index.cleanValue(value), options, {
getOptionValue: getOptionValue,
getOptionLabel: getOptionLabel
})) {
newOption = getNewOptionData(inputValue, formatCreateLabel(inputValue));
} else {
newOption = undefined;
}
return {
newOption: newOption,
options: (allowCreateWhileLoading || !isLoading) && newOption ? createOptionPosition === 'first' ? [newOption].concat(_toConsumableArray__default['default'](options)) : [].concat(_toConsumableArray__default['default'](options), [newOption]) : options
};
}
}]);
return Creatable;
}(React.Component), _class.defaultProps = defaultProps, _temp;
}; // TODO: do this in package entrypoint
var SelectCreatable = makeCreatableSelect(base_dist_reactSelect.Select);
var Creatable = stateManager.manageState(SelectCreatable);
exports.default = Creatable;
exports.defaultProps = defaultProps;
exports.makeCreatableSelect = makeCreatableSelect;

View file

@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./react-select.cjs.prod.js");
} else {
module.exports = require("./react-select.cjs.dev.js");
}

View file

@ -0,0 +1,3 @@
// @flow
export * from "../../src/Creatable.js";
export { default } from "../../src/Creatable.js";

View file

@ -0,0 +1,111 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _extends = require("@babel/runtime/helpers/extends"), _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray"), _classCallCheck = require("@babel/runtime/helpers/classCallCheck"), _createClass = require("@babel/runtime/helpers/createClass"), _inherits = require("@babel/runtime/helpers/inherits"), index = require("../../dist/index-ea9e225d.cjs.prod.js"), React = require("react"), base_dist_reactSelect = require("../../dist/Select-fd7cb895.cjs.prod.js"), stateManager = require("../../dist/stateManager-799f6a0f.cjs.prod.js");
function _interopDefault(e) {
return e && e.__esModule ? e : {
default: e
};
}
require("@emotion/react"), require("@babel/runtime/helpers/taggedTemplateLiteral"),
require("@babel/runtime/helpers/objectWithoutProperties"), require("@babel/runtime/helpers/typeof"),
require("react-input-autosize"), require("@babel/runtime/helpers/defineProperty"),
require("react-dom"), require("memoize-one");
var _extends__default = _interopDefault(_extends), _toConsumableArray__default = _interopDefault(_toConsumableArray), _classCallCheck__default = _interopDefault(_classCallCheck), _createClass__default = _interopDefault(_createClass), _inherits__default = _interopDefault(_inherits), React__default = _interopDefault(React), compareOption = function() {
var inputValue = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", option = arguments.length > 1 ? arguments[1] : void 0, accessors = arguments.length > 2 ? arguments[2] : void 0, candidate = String(inputValue).toLowerCase(), optionValue = String(accessors.getOptionValue(option)).toLowerCase(), optionLabel = String(accessors.getOptionLabel(option)).toLowerCase();
return optionValue === candidate || optionLabel === candidate;
}, builtins = {
formatCreateLabel: function(inputValue) {
return 'Create "'.concat(inputValue, '"');
},
isValidNewOption: function(inputValue, selectValue, selectOptions, accessors) {
return !(!inputValue || selectValue.some((function(option) {
return compareOption(inputValue, option, accessors);
})) || selectOptions.some((function(option) {
return compareOption(inputValue, option, accessors);
})));
},
getNewOptionData: function(inputValue, optionLabel) {
return {
label: optionLabel,
value: inputValue,
__isNew__: !0
};
},
getOptionValue: base_dist_reactSelect.getOptionValue,
getOptionLabel: base_dist_reactSelect.getOptionLabel
}, defaultProps = index._objectSpread2({
allowCreateWhileLoading: !1,
createOptionPosition: "last"
}, builtins), makeCreatableSelect = function(SelectComponent) {
var _class, _temp;
return _temp = _class = function(_Component) {
_inherits__default.default(Creatable, _Component);
var _super = index._createSuper(Creatable);
function Creatable(props) {
var _this;
_classCallCheck__default.default(this, Creatable), (_this = _super.call(this, props)).select = void 0,
_this.onChange = function(newValue, actionMeta) {
var _this$props = _this.props, getNewOptionData = _this$props.getNewOptionData, inputValue = _this$props.inputValue, isMulti = _this$props.isMulti, onChange = _this$props.onChange, onCreateOption = _this$props.onCreateOption, value = _this$props.value, name = _this$props.name;
if ("select-option" !== actionMeta.action) return onChange(newValue, actionMeta);
var newOption = _this.state.newOption, valueArray = Array.isArray(newValue) ? newValue : [ newValue ];
if (valueArray[valueArray.length - 1] !== newOption) onChange(newValue, actionMeta); else if (onCreateOption) onCreateOption(inputValue); else {
var newOptionData = getNewOptionData(inputValue, inputValue), newActionMeta = {
action: "create-option",
name: name,
option: newOptionData
};
onChange(isMulti ? [].concat(_toConsumableArray__default.default(index.cleanValue(value)), [ newOptionData ]) : newOptionData, newActionMeta);
}
};
var options = props.options || [];
return _this.state = {
newOption: void 0,
options: options
}, _this;
}
return _createClass__default.default(Creatable, [ {
key: "focus",
value: function() {
this.select.focus();
}
}, {
key: "blur",
value: function() {
this.select.blur();
}
}, {
key: "render",
value: function() {
var _this2 = this, options = this.state.options;
return React__default.default.createElement(SelectComponent, _extends__default.default({}, this.props, {
ref: function(_ref) {
_this2.select = _ref;
},
options: options,
onChange: this.onChange
}));
}
} ], [ {
key: "getDerivedStateFromProps",
value: function(props, state) {
var allowCreateWhileLoading = props.allowCreateWhileLoading, createOptionPosition = props.createOptionPosition, formatCreateLabel = props.formatCreateLabel, getNewOptionData = props.getNewOptionData, inputValue = props.inputValue, isLoading = props.isLoading, isValidNewOption = props.isValidNewOption, value = props.value, getOptionValue = props.getOptionValue, getOptionLabel = props.getOptionLabel, options = props.options || [], newOption = state.newOption;
return {
newOption: newOption = isValidNewOption(inputValue, index.cleanValue(value), options, {
getOptionValue: getOptionValue,
getOptionLabel: getOptionLabel
}) ? getNewOptionData(inputValue, formatCreateLabel(inputValue)) : void 0,
options: !allowCreateWhileLoading && isLoading || !newOption ? options : "first" === createOptionPosition ? [ newOption ].concat(_toConsumableArray__default.default(options)) : [].concat(_toConsumableArray__default.default(options), [ newOption ])
};
}
} ]), Creatable;
}(React.Component), _class.defaultProps = defaultProps, _temp;
}, SelectCreatable = makeCreatableSelect(base_dist_reactSelect.Select), Creatable = stateManager.manageState(SelectCreatable);
exports.default = Creatable, exports.defaultProps = defaultProps, exports.makeCreatableSelect = makeCreatableSelect;

View file

@ -0,0 +1,180 @@
import _extends from '@babel/runtime/helpers/esm/extends';
import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
import _createClass from '@babel/runtime/helpers/esm/createClass';
import _inherits from '@babel/runtime/helpers/esm/inherits';
import { a as _objectSpread2, _ as _createSuper, E as cleanValue } from '../../dist/index-4bd03571.esm.js';
import React, { Component } from 'react';
import { S as Select, g as getOptionValue, a as getOptionLabel } from '../../dist/Select-dbb12e54.esm.js';
import { m as manageState } from '../../dist/stateManager-845a3300.esm.js';
import '@emotion/react';
import '@babel/runtime/helpers/taggedTemplateLiteral';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/typeof';
import 'react-input-autosize';
import '@babel/runtime/helpers/defineProperty';
import 'react-dom';
import 'memoize-one';
var compareOption = function compareOption() {
var inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var option = arguments.length > 1 ? arguments[1] : undefined;
var accessors = arguments.length > 2 ? arguments[2] : undefined;
var candidate = String(inputValue).toLowerCase();
var optionValue = String(accessors.getOptionValue(option)).toLowerCase();
var optionLabel = String(accessors.getOptionLabel(option)).toLowerCase();
return optionValue === candidate || optionLabel === candidate;
};
var builtins = {
formatCreateLabel: function formatCreateLabel(inputValue) {
return "Create \"".concat(inputValue, "\"");
},
isValidNewOption: function isValidNewOption(inputValue, selectValue, selectOptions, accessors) {
return !(!inputValue || selectValue.some(function (option) {
return compareOption(inputValue, option, accessors);
}) || selectOptions.some(function (option) {
return compareOption(inputValue, option, accessors);
}));
},
getNewOptionData: function getNewOptionData(inputValue, optionLabel) {
return {
label: optionLabel,
value: inputValue,
__isNew__: true
};
},
getOptionValue: getOptionValue,
getOptionLabel: getOptionLabel
};
var defaultProps = _objectSpread2({
allowCreateWhileLoading: false,
createOptionPosition: 'last'
}, builtins);
var makeCreatableSelect = function makeCreatableSelect(SelectComponent) {
var _class, _temp;
return _temp = _class = /*#__PURE__*/function (_Component) {
_inherits(Creatable, _Component);
var _super = _createSuper(Creatable);
function Creatable(props) {
var _this;
_classCallCheck(this, Creatable);
_this = _super.call(this, props);
_this.select = void 0;
_this.onChange = function (newValue, actionMeta) {
var _this$props = _this.props,
getNewOptionData = _this$props.getNewOptionData,
inputValue = _this$props.inputValue,
isMulti = _this$props.isMulti,
onChange = _this$props.onChange,
onCreateOption = _this$props.onCreateOption,
value = _this$props.value,
name = _this$props.name;
if (actionMeta.action !== 'select-option') {
return onChange(newValue, actionMeta);
}
var newOption = _this.state.newOption;
var valueArray = Array.isArray(newValue) ? newValue : [newValue];
if (valueArray[valueArray.length - 1] === newOption) {
if (onCreateOption) onCreateOption(inputValue);else {
var newOptionData = getNewOptionData(inputValue, inputValue);
var newActionMeta = {
action: 'create-option',
name: name,
option: newOptionData
};
if (isMulti) {
onChange([].concat(_toConsumableArray(cleanValue(value)), [newOptionData]), newActionMeta);
} else {
onChange(newOptionData, newActionMeta);
}
}
return;
}
onChange(newValue, actionMeta);
};
var options = props.options || [];
_this.state = {
newOption: undefined,
options: options
};
return _this;
}
_createClass(Creatable, [{
key: "focus",
value: function focus() {
this.select.focus();
}
}, {
key: "blur",
value: function blur() {
this.select.blur();
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var options = this.state.options;
return /*#__PURE__*/React.createElement(SelectComponent, _extends({}, this.props, {
ref: function ref(_ref) {
_this2.select = _ref;
},
options: options,
onChange: this.onChange
}));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
var allowCreateWhileLoading = props.allowCreateWhileLoading,
createOptionPosition = props.createOptionPosition,
formatCreateLabel = props.formatCreateLabel,
getNewOptionData = props.getNewOptionData,
inputValue = props.inputValue,
isLoading = props.isLoading,
isValidNewOption = props.isValidNewOption,
value = props.value,
getOptionValue = props.getOptionValue,
getOptionLabel = props.getOptionLabel;
var options = props.options || [];
var newOption = state.newOption;
if (isValidNewOption(inputValue, cleanValue(value), options, {
getOptionValue: getOptionValue,
getOptionLabel: getOptionLabel
})) {
newOption = getNewOptionData(inputValue, formatCreateLabel(inputValue));
} else {
newOption = undefined;
}
return {
newOption: newOption,
options: (allowCreateWhileLoading || !isLoading) && newOption ? createOptionPosition === 'first' ? [newOption].concat(_toConsumableArray(options)) : [].concat(_toConsumableArray(options), [newOption]) : options
};
}
}]);
return Creatable;
}(Component), _class.defaultProps = defaultProps, _temp;
}; // TODO: do this in package entrypoint
var SelectCreatable = makeCreatableSelect(Select);
var Creatable = manageState(SelectCreatable);
export default Creatable;
export { defaultProps, makeCreatableSelect };

7
web/node_modules/react-select/creatable/package.json generated vendored Normal file
View file

@ -0,0 +1,7 @@
{
"main": "dist/react-select.cjs.js",
"module": "dist/react-select.esm.js",
"preconstruct": {
"source": "../src/Creatable"
}
}