aio-popup 8.0.1 → 8.1.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/index.css +1 -0
- package/index.d.ts +1 -0
- package/index.js +15 -15
- package/package.json +1 -1
package/index.css
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -195,7 +195,7 @@ const usePopup = (props) => {
|
|
|
195
195
|
};
|
|
196
196
|
const addPrompt = (obj) => {
|
|
197
197
|
const id = 'a' + (Math.round(Math.random() * 100000));
|
|
198
|
-
let { title, text = '', subtitle, submitText = 'Submit', canselText = 'close', onSubmit, onCansel = () => { }, modalAttrs, backdropAttrs, headerAttrs, footerAttrs, bodyAttrs } = obj;
|
|
198
|
+
let { title, text = '', subtitle, submitText = 'Submit', placeholder = '', canselText = 'close', onSubmit, onCansel = () => { }, modalAttrs, backdropAttrs, headerAttrs, footerAttrs, bodyAttrs } = obj;
|
|
199
199
|
const submitAttrs = AddToAttrs(obj.submitAttrs, {
|
|
200
200
|
className: 'active', attrs: {
|
|
201
201
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -230,7 +230,7 @@ const usePopup = (props) => {
|
|
|
230
230
|
position: 'center', header: { title, subtitle },
|
|
231
231
|
modalAttrs: AddToAttrs(modalAttrs, { className: 'aio-popup-prompt' }),
|
|
232
232
|
backdropAttrs, headerAttrs, footerAttrs, bodyAttrs,
|
|
233
|
-
body: _jsx(Prompt, { change: (value) => promptTexts.current = Object.assign(Object.assign({}, promptTexts.current), { [id]: value }), placeholder: text }),
|
|
233
|
+
body: _jsx(Prompt, { change: (value) => promptTexts.current = Object.assign(Object.assign({}, promptTexts.current), { [id]: value }), placeholder: placeholder, text: text }),
|
|
234
234
|
footer: (_jsxs(_Fragment, { children: [_jsx("button", Object.assign({}, canselAttrs, { children: canselText })), _jsx("button", Object.assign({}, submitAttrs, { children: submitText }))] }))
|
|
235
235
|
};
|
|
236
236
|
addModal(config);
|
|
@@ -251,9 +251,9 @@ const usePopup = (props) => {
|
|
|
251
251
|
return { addAlert, addSnackebar, removeModal, addModal, getModals, addHighlight, removeHighlight, render, addConfirm, addPrompt, portal };
|
|
252
252
|
};
|
|
253
253
|
export default usePopup;
|
|
254
|
-
const Prompt = ({ change, placeholder }) => {
|
|
255
|
-
const [
|
|
256
|
-
return (_jsx("textarea", { placeholder: placeholder, value:
|
|
254
|
+
const Prompt = ({ change, placeholder, text = '' }) => {
|
|
255
|
+
const [value, setValue] = useState(text);
|
|
256
|
+
return (_jsx("textarea", { placeholder: placeholder, value: value, onChange: (e) => { const value = e.target.value; setValue(value); change(value); } }));
|
|
257
257
|
};
|
|
258
258
|
const POPUPCTX = createContext({});
|
|
259
259
|
const Popup = ({ modal, isLast }) => {
|
|
@@ -742,16 +742,16 @@ function getEasing(highlight) {
|
|
|
742
742
|
const { easing } = highlight;
|
|
743
743
|
var easingNames = [
|
|
744
744
|
'linear',
|
|
745
|
-
'easeInQuad',
|
|
746
|
-
'easeInSine',
|
|
747
|
-
'easeInCirc',
|
|
748
|
-
'easeInBack',
|
|
749
|
-
'easeOutQuad',
|
|
750
|
-
'easeOutSine',
|
|
751
|
-
'easeOutCirc',
|
|
752
|
-
'easeInOutQuad',
|
|
753
|
-
'easeInOutSine',
|
|
754
|
-
'easeInOutBack',
|
|
745
|
+
'easeInQuad', //1
|
|
746
|
+
'easeInSine', //5
|
|
747
|
+
'easeInCirc', //7
|
|
748
|
+
'easeInBack', //8
|
|
749
|
+
'easeOutQuad', //9
|
|
750
|
+
'easeOutSine', //13
|
|
751
|
+
'easeOutCirc', //15
|
|
752
|
+
'easeInOutQuad', //18
|
|
753
|
+
'easeInOutSine', //22
|
|
754
|
+
'easeInOutBack', //25
|
|
755
755
|
'easeOutBounce', //27
|
|
756
756
|
];
|
|
757
757
|
if (typeof easing === 'number') {
|