sprint-asia-custom-component 0.1.108 → 0.1.111
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/index.js
CHANGED
|
@@ -24138,7 +24138,8 @@
|
|
|
24138
24138
|
type: "button",
|
|
24139
24139
|
className: `
|
|
24140
24140
|
${!isEdited && "bg-neutral30 cursor-not-allowed"}
|
|
24141
|
-
${mode === "default" && "border-neutral50 bg-neutral20 cursor-pointer"}
|
|
24141
|
+
${mode === "default" && currentOption === "" && "border-neutral50 bg-neutral20 cursor-pointer"}
|
|
24142
|
+
${mode === "default" && currentOption !== "" && "border-black bg-neutral20 cursor-pointer"}
|
|
24142
24143
|
${mode === "danger" && "border-danger500 bg-danger50 cursor-pointer"}
|
|
24143
24144
|
flex items-center w-full py-2.5 text-left px-4 font-normal text-sm text-neutral300 rounded-md border focus:outline-none overflow-hidden`,
|
|
24144
24145
|
onClick: () => isEdited && handleToggleDropdownText()
|
|
@@ -44216,15 +44217,15 @@
|
|
|
44216
44217
|
const ModalState = ({
|
|
44217
44218
|
isOpen = false,
|
|
44218
44219
|
onClose = () => {},
|
|
44219
|
-
title =
|
|
44220
|
-
subtitle =
|
|
44221
|
-
type =
|
|
44220
|
+
title = "Title Modal",
|
|
44221
|
+
subtitle = "Subtitle Modal",
|
|
44222
|
+
type = "default",
|
|
44222
44223
|
addition = "state",
|
|
44223
44224
|
placeholderTextArea,
|
|
44224
44225
|
onChangeTextArea,
|
|
44225
44226
|
valueTextArea,
|
|
44226
|
-
titleButtonLeft =
|
|
44227
|
-
titleButtonRight =
|
|
44227
|
+
titleButtonLeft = "Cancel",
|
|
44228
|
+
titleButtonRight = "Okay",
|
|
44228
44229
|
leftAction = onClose,
|
|
44229
44230
|
rightAction = onClose,
|
|
44230
44231
|
fileUploaded,
|
|
@@ -44233,12 +44234,12 @@
|
|
|
44233
44234
|
const cancelButtonRef = React.useRef(null);
|
|
44234
44235
|
React.useState(false);
|
|
44235
44236
|
const isButtonActive = () => {
|
|
44236
|
-
if (addition ===
|
|
44237
|
+
if (addition === "textarea") {
|
|
44237
44238
|
// Check if valueTextArea is a string before calling .trim()
|
|
44238
|
-
return typeof valueTextArea ===
|
|
44239
|
-
} else if (addition ===
|
|
44240
|
-
return fileUploaded && typeof textInputValue ===
|
|
44241
|
-
} else if (addition ===
|
|
44239
|
+
return typeof valueTextArea === "string" && valueTextArea.trim() !== "";
|
|
44240
|
+
} else if (addition === "dropzone&input") {
|
|
44241
|
+
return fileUploaded && typeof textInputValue === "string" && textInputValue.trim() !== "";
|
|
44242
|
+
} else if (addition === "state") {
|
|
44242
44243
|
return true;
|
|
44243
44244
|
}
|
|
44244
44245
|
return false;
|
|
@@ -44253,7 +44254,7 @@
|
|
|
44253
44254
|
as: "div",
|
|
44254
44255
|
className: "fixed inset-0 overflow-y-auto z-50",
|
|
44255
44256
|
initialFocus: cancelButtonRef,
|
|
44256
|
-
onClose:
|
|
44257
|
+
onClose: onClose,
|
|
44257
44258
|
static: false
|
|
44258
44259
|
}, /*#__PURE__*/React__default["default"].createElement(qe.Child, {
|
|
44259
44260
|
as: React.Fragment,
|
|
@@ -44313,7 +44314,7 @@
|
|
|
44313
44314
|
className: "bg-gray-50 px-4 sm:flex sm:flex-row-reverse"
|
|
44314
44315
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
44315
44316
|
className: "my-3"
|
|
44316
|
-
}, type ===
|
|
44317
|
+
}, type === "default" ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
44317
44318
|
className: "ml-2"
|
|
44318
44319
|
}, /*#__PURE__*/React__default["default"].createElement(PrimaryButton, {
|
|
44319
44320
|
title: titleButtonRight,
|
|
@@ -47905,7 +47906,7 @@
|
|
|
47905
47906
|
onClickRightButton
|
|
47906
47907
|
}) => {
|
|
47907
47908
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
47908
|
-
className: "fixed bottom-0 flex justify-end w-full items-center py-1 px-6 bg-white
|
|
47909
|
+
className: "fixed bottom-0 flex justify-end w-full items-center py-1 px-6 bg-white"
|
|
47909
47910
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
47910
47911
|
className: "flex items-center mr-48"
|
|
47911
47912
|
}, isActiveLeftButton && /*#__PURE__*/React__default["default"].createElement("div", {
|
package/package.json
CHANGED
|
@@ -61,7 +61,8 @@ const DropdownText = ({
|
|
|
61
61
|
type="button"
|
|
62
62
|
className={`
|
|
63
63
|
${!isEdited && "bg-neutral30 cursor-not-allowed"}
|
|
64
|
-
${mode === "default" && "border-neutral50 bg-neutral20 cursor-pointer"}
|
|
64
|
+
${mode === "default" && currentOption === "" && "border-neutral50 bg-neutral20 cursor-pointer"}
|
|
65
|
+
${mode === "default" && currentOption !== "" && "border-black bg-neutral20 cursor-pointer"}
|
|
65
66
|
${mode === "danger" && "border-danger500 bg-danger50 cursor-pointer"}
|
|
66
67
|
flex items-center w-full py-2.5 text-left px-4 font-normal text-sm text-neutral300 rounded-md border focus:outline-none overflow-hidden`}
|
|
67
68
|
onClick={() => isEdited && handleToggleDropdownText()}
|
|
@@ -15,7 +15,7 @@ const Footer = ({
|
|
|
15
15
|
onClickRightButton,
|
|
16
16
|
}) => {
|
|
17
17
|
return (
|
|
18
|
-
<div className="fixed bottom-0 flex justify-end w-full items-center py-1 px-6 bg-white
|
|
18
|
+
<div className="fixed bottom-0 flex justify-end w-full items-center py-1 px-6 bg-white">
|
|
19
19
|
<div className="flex items-center mr-48">
|
|
20
20
|
{isActiveLeftButton && (
|
|
21
21
|
<div className="m-1">
|
|
@@ -1,143 +1,154 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Fragment, useRef, useState
|
|
3
|
-
import { Dialog, Transition } from
|
|
4
|
-
import PrimaryButton from
|
|
5
|
-
import OutlineButton from
|
|
6
|
-
import DangerButton from
|
|
7
|
-
import Dropzone from
|
|
8
|
-
import TextInput from
|
|
9
|
-
import TextEditor from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Fragment, useRef, useState } from "react";
|
|
3
|
+
import { Dialog, Transition } from "@headlessui/react";
|
|
4
|
+
import PrimaryButton from "../../button/primarybutton";
|
|
5
|
+
import OutlineButton from "../../button/outlinebutton";
|
|
6
|
+
import DangerButton from "../../button/dangerbutton";
|
|
7
|
+
import Dropzone from "../../dropzone/uploadfile";
|
|
8
|
+
import TextInput from "../../textinput";
|
|
9
|
+
import TextEditor from "../../texteditor";
|
|
10
10
|
|
|
11
11
|
const ModalState = ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
isOpen = false,
|
|
13
|
+
onClose = () => {},
|
|
14
|
+
title = "Title Modal",
|
|
15
|
+
subtitle = "Subtitle Modal",
|
|
16
|
+
type = "default",
|
|
17
|
+
addition = "state",
|
|
18
|
+
placeholderTextArea,
|
|
19
|
+
onChangeTextArea,
|
|
20
|
+
valueTextArea,
|
|
21
|
+
titleButtonLeft = "Cancel",
|
|
22
|
+
titleButtonRight = "Okay",
|
|
23
|
+
leftAction = onClose,
|
|
24
|
+
rightAction = onClose,
|
|
25
|
+
fileUploaded,
|
|
26
|
+
textInputValue,
|
|
28
27
|
}) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const isButtonActive = () => {
|
|
33
|
-
if (addition === 'textarea') {
|
|
34
|
-
// Check if valueTextArea is a string before calling .trim()
|
|
35
|
-
return typeof valueTextArea === 'string' && valueTextArea.trim() !== '';
|
|
36
|
-
}
|
|
37
|
-
else if (addition === 'dropzone&input') {
|
|
38
|
-
return fileUploaded && typeof textInputValue === 'string' && textInputValue.trim() !== '';
|
|
39
|
-
}
|
|
40
|
-
else if (addition === 'state') {
|
|
41
|
-
return true
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
};
|
|
45
|
-
|
|
28
|
+
const cancelButtonRef = useRef(null);
|
|
29
|
+
const [isActive, setIsActive] = useState(false);
|
|
46
30
|
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
const isButtonActive = () => {
|
|
32
|
+
if (addition === "textarea") {
|
|
33
|
+
// Check if valueTextArea is a string before calling .trim()
|
|
34
|
+
return typeof valueTextArea === "string" && valueTextArea.trim() !== "";
|
|
35
|
+
} else if (addition === "dropzone&input") {
|
|
36
|
+
return fileUploaded && typeof textInputValue === "string" && textInputValue.trim() !== "";
|
|
37
|
+
} else if (addition === "state") {
|
|
38
|
+
return true;
|
|
49
39
|
}
|
|
40
|
+
return false;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function handleBackgroundClick(e) {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
}
|
|
50
46
|
|
|
51
47
|
return (
|
|
52
48
|
<Transition.Root show={isOpen} as={Fragment}>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
<Dialog
|
|
50
|
+
as="div"
|
|
51
|
+
className="fixed inset-0 overflow-y-auto z-50"
|
|
52
|
+
initialFocus={cancelButtonRef}
|
|
53
|
+
onClose={onClose}
|
|
54
|
+
static={false}
|
|
55
|
+
>
|
|
56
|
+
<Transition.Child
|
|
57
|
+
as={Fragment}
|
|
58
|
+
enter="ease-out duration-300"
|
|
59
|
+
enterFrom="opacity-0"
|
|
60
|
+
enterTo="opacity-100"
|
|
61
|
+
leave="ease-in duration-200"
|
|
62
|
+
leaveFrom="opacity-100"
|
|
63
|
+
leaveTo="opacity-0"
|
|
64
|
+
>
|
|
65
|
+
<div className="fixed inset-0 bg-black bg-opacity-25" onClick={handleBackgroundClick} />
|
|
66
|
+
</Transition.Child>
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
68
|
+
<Transition.Child
|
|
69
|
+
as={Fragment}
|
|
70
|
+
enter="ease-out duration-300"
|
|
71
|
+
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
72
|
+
enterTo="opacity-100 translate-y-0 sm:scale-100"
|
|
73
|
+
leave="ease-in duration-200"
|
|
74
|
+
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
|
|
75
|
+
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
76
|
+
>
|
|
77
|
+
<div className="min-h-screen flex items-center justify-center">
|
|
78
|
+
<Dialog.Panel className="relative w-full max-w-lg bg-white rounded-lg shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
|
|
79
|
+
<div className="flex justify-between py-3 px-6">
|
|
80
|
+
<p className="font-semibold text-xl text-black">{title}</p>
|
|
81
|
+
<p className="cursor-pointer text-xl" onClick={onClose}>
|
|
82
|
+
x
|
|
83
|
+
</p>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="border-t border-b border-neutral30 py-6">
|
|
86
|
+
<p className="font-normal text-lg text-neutral500 px-6">{subtitle}</p>
|
|
87
|
+
{addition == "textarea" && (
|
|
88
|
+
<div className="py-3 px-6">
|
|
89
|
+
<textarea
|
|
90
|
+
value={valueTextArea}
|
|
91
|
+
onChange={onChangeTextArea}
|
|
92
|
+
placeholder={placeholderTextArea}
|
|
93
|
+
className="w-full p-3.5 text-sm text-neutral300 border border-neutral50 rounded-md bg-neutral20 focus:outline-none"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
{addition == "dropzone&input" && (
|
|
98
|
+
<div className="py-3 px-6">
|
|
99
|
+
<div>
|
|
100
|
+
<Dropzone />
|
|
101
|
+
</div>
|
|
102
|
+
<div className="pt-3">
|
|
103
|
+
<TextInput title="Limit Amount" />
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
{addition === "texteditor" && (
|
|
108
|
+
<div className="py-3 px-6">
|
|
109
|
+
<TextEditor
|
|
110
|
+
value={valueTextArea}
|
|
111
|
+
onChange={onChangeTextArea}
|
|
112
|
+
title="Your Decline Reason"
|
|
113
|
+
placeholder="Please provide a detailed reason for the decline."
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
<div className="bg-gray-50 px-4 sm:flex sm:flex-row-reverse">
|
|
119
|
+
<div className="my-3">
|
|
120
|
+
{type === "default" ? (
|
|
121
|
+
<div className="ml-2">
|
|
122
|
+
<PrimaryButton
|
|
123
|
+
title={titleButtonRight}
|
|
124
|
+
type="wrap"
|
|
125
|
+
size="large"
|
|
126
|
+
onClick={rightAction}
|
|
127
|
+
isActive={isButtonActive()}
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
) : (
|
|
131
|
+
<div className="ml-2">
|
|
132
|
+
<DangerButton
|
|
133
|
+
title={titleButtonRight}
|
|
134
|
+
type="wrap"
|
|
135
|
+
size="large"
|
|
136
|
+
onClick={rightAction}
|
|
137
|
+
isActive={isButtonActive()}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
<div className="mt-3">
|
|
143
|
+
<OutlineButton title={titleButtonLeft} type="full" size="large" onClick={leftAction} />
|
|
136
144
|
</div>
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
</div>
|
|
146
|
+
</Dialog.Panel>
|
|
147
|
+
</div>
|
|
148
|
+
</Transition.Child>
|
|
149
|
+
</Dialog>
|
|
139
150
|
</Transition.Root>
|
|
140
151
|
);
|
|
141
152
|
};
|
|
142
153
|
|
|
143
|
-
export default ModalState;
|
|
154
|
+
export default ModalState;
|