@rpg-engine/long-bow 0.5.57 → 0.5.59
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/dist/long-bow.cjs.development.js +24 -5
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +24 -5
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/Dropdown.stories.d.ts +1 -0
- package/package.json +3 -2
- package/src/components/Dropdown.tsx +27 -3
- package/src/stories/Dropdown.stories.tsx +38 -15
|
@@ -17,6 +17,7 @@ var ReactDOM = _interopDefault(require('react-dom'));
|
|
|
17
17
|
var lodash = require('lodash');
|
|
18
18
|
var mobxReactLite = require('mobx-react-lite');
|
|
19
19
|
var uuid = require('uuid');
|
|
20
|
+
var reactSpinners = require('react-spinners');
|
|
20
21
|
var ai = require('react-icons/ai');
|
|
21
22
|
require('rpgui/rpgui.css');
|
|
22
23
|
require('rpgui/rpgui.min.js');
|
|
@@ -14811,6 +14812,13 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
14811
14812
|
var _useState3 = React.useState(false),
|
|
14812
14813
|
opened = _useState3[0],
|
|
14813
14814
|
setOpened = _useState3[1];
|
|
14815
|
+
React.useEffect(function () {
|
|
14816
|
+
if ((options == null ? void 0 : options.length) > 0) {
|
|
14817
|
+
setSelectedValue(options[0].value);
|
|
14818
|
+
setSelectedOption(options[0].option);
|
|
14819
|
+
onChange(options[0].value);
|
|
14820
|
+
}
|
|
14821
|
+
}, [options]);
|
|
14814
14822
|
var handleSelection = function handleSelection(value, option) {
|
|
14815
14823
|
if (value !== selectedValue) {
|
|
14816
14824
|
setSelectedValue(value);
|
|
@@ -14831,10 +14839,13 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
14831
14839
|
return !prev;
|
|
14832
14840
|
});
|
|
14833
14841
|
}
|
|
14834
|
-
}, React__default.createElement(
|
|
14842
|
+
}, React__default.createElement(DropdownDisplay, null, React__default.createElement(DropdownLabel, null, "\u25BC"), " ", selectedOption, !options.length && React__default.createElement(reactSpinners.BeatLoader, {
|
|
14843
|
+
size: 4,
|
|
14844
|
+
color: uiColors.white
|
|
14845
|
+
}))), React__default.createElement(DropdownOptions, {
|
|
14835
14846
|
className: "rpgui-dropdown-imp",
|
|
14836
14847
|
opened: opened
|
|
14837
|
-
}, options.map(function (option) {
|
|
14848
|
+
}, options == null ? void 0 : options.map(function (option) {
|
|
14838
14849
|
return React__default.createElement("li", {
|
|
14839
14850
|
key: option.id,
|
|
14840
14851
|
onPointerUp: function onPointerUp() {
|
|
@@ -14844,19 +14855,27 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
14844
14855
|
}, option.option);
|
|
14845
14856
|
})));
|
|
14846
14857
|
};
|
|
14858
|
+
var DropdownDisplay = /*#__PURE__*/styled__default.span.withConfig({
|
|
14859
|
+
displayName: "Dropdown__DropdownDisplay",
|
|
14860
|
+
componentId: "sc-8arn65-0"
|
|
14861
|
+
})(["display:flex;flex-wrap:wrap;justify-content:start;align-items:center;"]);
|
|
14862
|
+
var DropdownLabel = /*#__PURE__*/styled__default.label.withConfig({
|
|
14863
|
+
displayName: "Dropdown__DropdownLabel",
|
|
14864
|
+
componentId: "sc-8arn65-1"
|
|
14865
|
+
})(["margin-right:0.5rem;"]);
|
|
14847
14866
|
var Container$d = /*#__PURE__*/styled__default.div.withConfig({
|
|
14848
14867
|
displayName: "Dropdown__Container",
|
|
14849
|
-
componentId: "sc-8arn65-
|
|
14868
|
+
componentId: "sc-8arn65-2"
|
|
14850
14869
|
})(["position:relative;width:", ";"], function (props) {
|
|
14851
14870
|
return props.width || '100%';
|
|
14852
14871
|
});
|
|
14853
14872
|
var DropdownSelect = /*#__PURE__*/styled__default.p.withConfig({
|
|
14854
14873
|
displayName: "Dropdown__DropdownSelect",
|
|
14855
|
-
componentId: "sc-8arn65-
|
|
14874
|
+
componentId: "sc-8arn65-3"
|
|
14856
14875
|
})(["width:100%;box-sizing:border-box;label{display:inline-block;transform:translateY(-2px);}"]);
|
|
14857
14876
|
var DropdownOptions = /*#__PURE__*/styled__default.ul.withConfig({
|
|
14858
14877
|
displayName: "Dropdown__DropdownOptions",
|
|
14859
|
-
componentId: "sc-8arn65-
|
|
14878
|
+
componentId: "sc-8arn65-4"
|
|
14860
14879
|
})(["position:absolute;width:100%;max-height:300px;overflow-y:auto;display:", ";box-sizing:border-box;@media (max-width:768px){padding:8px 0;}"], function (props) {
|
|
14861
14880
|
return props.opened ? 'block' : 'none';
|
|
14862
14881
|
});
|