sprint-asia-custom-component 0.1.35 → 0.1.36

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
@@ -143,28 +143,38 @@
143
143
  }), /*#__PURE__*/React__default["default"].createElement("p", null, title)));
144
144
  };
145
145
 
146
- const Alert = _ref => {
147
- let {
148
- title = "Title",
149
- subtitle = "Subtitle",
150
- type = "primary",
151
- titleLeftButton,
152
- titleRightButton,
153
- onClickLeftButton,
154
- onClickRightButton
155
- } = _ref;
146
+ const Alert = ({
147
+ title = "Title",
148
+ subtitle = "Subtitle",
149
+ type = "primary",
150
+ titleLeftButton,
151
+ titleRightButton,
152
+ onCloseButton,
153
+ onClickLeftButton,
154
+ onClickRightButton
155
+ }) => {
156
156
  return /*#__PURE__*/React__default["default"].createElement("div", {
157
- className: "\n ".concat(type === "primary" && "bg-primary50 border-primary600", " \n ").concat(type === "warning" && "bg-warning50 border-warning800", " \n ").concat(type === "success" && "bg-success50 border-success600", " \n ").concat(type === "danger" && "bg-danger50 border-danger500", " \n w-full flex justify-between p-3 border rounded-md")
157
+ className: `
158
+ ${type === "primary" && "bg-primary50 border-primary600"}
159
+ ${type === "warning" && "bg-warning50 border-warning800"}
160
+ ${type === "success" && "bg-success50 border-success600"}
161
+ ${type === "danger" && "bg-danger50 border-danger500"}
162
+ w-full flex justify-between p-3 border rounded-md`
158
163
  }, /*#__PURE__*/React__default["default"].createElement("div", {
159
164
  className: "w-full flex"
160
165
  }, /*#__PURE__*/React__default["default"].createElement("div", null, type === "success" ? /*#__PURE__*/React__default["default"].createElement(PiCheckCircleFill, {
161
166
  size: "24",
162
167
  variant: "Bold",
163
- className: "\n ".concat(type === "success" && "text-success600", " mr-2")
168
+ className: `
169
+ ${type === "success" && "text-success600"} mr-2`
164
170
  }) : /*#__PURE__*/React__default["default"].createElement(PiInfoFill, {
165
171
  size: "24",
166
172
  variant: "Bold",
167
- className: "\n ".concat(type === "primary" && "text-primary600", "\n ").concat(type === "warning" && "text-warning800", "\n ").concat(type === "danger" && "text-danger500", " \n mr-2")
173
+ className: `
174
+ ${type === "primary" && "text-primary600"}
175
+ ${type === "warning" && "text-warning800"}
176
+ ${type === "danger" && "text-danger500"}
177
+ mr-2`
168
178
  })), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("p", {
169
179
  className: "text-md font-semibold text-black"
170
180
  }, title), /*#__PURE__*/React__default["default"].createElement("p", {
@@ -183,6 +193,14 @@
183
193
  title: titleRightButton,
184
194
  onClick: onClickRightButton,
185
195
  size: "small"
196
+ }))), onCloseButton && /*#__PURE__*/React__default["default"].createElement("div", {
197
+ className: "flex"
198
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
199
+ onClick: onCloseButton
200
+ }, /*#__PURE__*/React__default["default"].createElement(PiX, {
201
+ size: "16",
202
+ variant: "Bold",
203
+ className: "text-neutral300 cursor-pointer"
186
204
  }))));
187
205
  };
188
206
 
@@ -23995,14 +24013,12 @@
23995
24013
  options = [{
23996
24014
  option: "Name 1",
23997
24015
  value: "Value 1"
23998
- }, {
23999
- option: "Name 2",
24000
- value: "Value 2"
24001
24016
  }],
24002
24017
  onSelect,
24003
24018
  title = "Title Dropdown",
24004
24019
  placeholder = "Placeholder",
24005
24020
  isRequired = true,
24021
+ isEdited = true,
24006
24022
  currentOption = {
24007
24023
  option: "Name 1",
24008
24024
  value: "Value 1"
@@ -24050,8 +24066,8 @@
24050
24066
  className: "rounded-md shadow-sm"
24051
24067
  }, /*#__PURE__*/React__default["default"].createElement("button", {
24052
24068
  type: "button",
24053
- className: "flex items-center w-full py-2.5 text-left px-4 bg-neutral20 border-neutral50 font-normal text-sm text-neutral300 rounded-md border focus:outline-none overflow-hidden",
24054
- onClick: handleToggleDropdownText
24069
+ className: `${isEdited ? "bg-neutral20 cursor-pointer" : "bg-neutral30 cursor-not-allowed"} flex items-center w-full py-2.5 text-left px-4 border-neutral50 font-normal text-sm text-neutral300 rounded-md border focus:outline-none overflow-hidden`,
24070
+ onClick: () => isEdited && handleToggleDropdownText()
24055
24071
  }, /*#__PURE__*/React__default["default"].createElement("span", {
24056
24072
  className: "flex-grow overflow-hidden"
24057
24073
  }, selectedOption ? selectedOption : currentOption.option ? currentOption.option : placeholder), /*#__PURE__*/React__default["default"].createElement("span", {
@@ -24062,7 +24078,7 @@
24062
24078
  }) : /*#__PURE__*/React__default["default"].createElement(PiCaretDown, {
24063
24079
  size: 16,
24064
24080
  className: "text-neutral300"
24065
- }))))), isOpen && /*#__PURE__*/React__default["default"].createElement("div", {
24081
+ }))))), isOpen && isEdited && /*#__PURE__*/React__default["default"].createElement("div", {
24066
24082
  className: "z-10 origin-top-right absolute left-0 mt-2 w-full rounded-md shadow-md bg-white ring-1 ring-black ring-opacity-5 focus:outline-none overflow-hidden",
24067
24083
  role: "menu",
24068
24084
  "aria-orientation": "vertical",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sprint-asia-custom-component",
3
3
  "main": "dist/index.js",
4
- "version": "0.1.35",
4
+ "version": "0.1.36",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "@headlessui/react": "^1.7.18",
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PiInfoFill, PiCheckCircleFill } from 'react-icons/pi'
2
+ import { PiInfoFill, PiCheckCircleFill, PiX } from 'react-icons/pi'
3
3
  import OutlineButton from '../button/outlinebutton'
4
4
 
5
5
  const Alert = ({
@@ -8,6 +8,7 @@ const Alert = ({
8
8
  type = "primary",
9
9
  titleLeftButton,
10
10
  titleRightButton,
11
+ onCloseButton,
11
12
  onClickLeftButton,
12
13
  onClickRightButton,
13
14
  }) => {
@@ -59,6 +60,18 @@ const Alert = ({
59
60
  </div>
60
61
  }
61
62
  </div>
63
+ {
64
+ onCloseButton &&
65
+ <div className='flex'>
66
+ <div onClick={onCloseButton}>
67
+ <PiX
68
+ size="16"
69
+ variant="Bold"
70
+ className="text-neutral300 cursor-pointer"
71
+ />
72
+ </div>
73
+ </div>
74
+ }
62
75
  </div>
63
76
  )
64
77
  }
@@ -6,16 +6,13 @@ const DropdownText = ({
6
6
  {
7
7
  option: "Name 1",
8
8
  value: "Value 1"
9
- },
10
- {
11
- option: "Name 2",
12
- value: "Value 2"
13
9
  }
14
10
  ],
15
11
  onSelect,
16
12
  title = "Title Dropdown",
17
13
  placeholder = "Placeholder",
18
14
  isRequired = true,
15
+ isEdited = true,
19
16
  currentOption = {option : "Name 1", value:"Value 1"},
20
17
  }) => {
21
18
  const [isOpen, setIsOpen] = useState(false);
@@ -64,8 +61,8 @@ const DropdownText = ({
64
61
  <span className='rounded-md shadow-sm'>
65
62
  <button
66
63
  type='button'
67
- className="flex items-center w-full py-2.5 text-left px-4 bg-neutral20 border-neutral50 font-normal text-sm text-neutral300 rounded-md border focus:outline-none overflow-hidden"
68
- onClick={handleToggleDropdownText}
64
+ className={`${isEdited ? "bg-neutral20 cursor-pointer" : "bg-neutral30 cursor-not-allowed"} flex items-center w-full py-2.5 text-left px-4 border-neutral50 font-normal text-sm text-neutral300 rounded-md border focus:outline-none overflow-hidden`}
65
+ onClick={() => isEdited && handleToggleDropdownText()}
69
66
  >
70
67
  <span className='flex-grow overflow-hidden'>{selectedOption ? selectedOption : currentOption.option ? currentOption.option : placeholder}</span>
71
68
  <span className='ml-2'>
@@ -75,7 +72,7 @@ const DropdownText = ({
75
72
  </span>
76
73
  </div>
77
74
 
78
- {isOpen && (
75
+ {isOpen && isEdited && (
79
76
  <div
80
77
  className='z-10 origin-top-right absolute left-0 mt-2 w-full rounded-md shadow-md bg-white ring-1 ring-black ring-opacity-5 focus:outline-none overflow-hidden'
81
78
  role='menu'
@@ -104,6 +104,7 @@ const Templates = () => {
104
104
  ]);
105
105
 
106
106
  const [isOpen, setIsOpen] = useState(false);
107
+ const [isOpenAlert, setIsOpenAlert] = useState(true);
107
108
 
108
109
  const toggleOpen = () => setIsOpen(!isOpen);
109
110
 
@@ -756,6 +757,13 @@ const Templates = () => {
756
757
  <div className='w-full py-3'>
757
758
  <Alert title='Client & Division Reminder' subtitle='Please ensure you have created the appropriate Client and division for the user before proceeding.' titleLeftButton="Add Client" titleRightButton="Add Division" onClickLeftButton={() => console.log("left button clicked")} onClickRightButton={() => console.log("right button clicked")}/>
758
759
  </div>
760
+ {
761
+ isOpenAlert &&
762
+ <div className='w-full py-3'>
763
+ <Alert title='Client & Division Reminder' subtitle='Please ensure you have created the appropriate Client and division for the user before proceeding.' onCloseButton={() => setIsOpenAlert(false)}/>
764
+ </div>
765
+ }
766
+
759
767
 
760
768
  <div className='m-9'></div>
761
769
  <p className='text-black font-bold text-2xl text-center py-2'>Primary Button</p>
@@ -925,6 +933,16 @@ const Templates = () => {
925
933
  title="Select an Option"
926
934
  />
927
935
 
936
+ <div className='m-9'></div>
937
+ <DropdownText
938
+ options={options}
939
+ currentOption={currentOption}
940
+ onSelectName={handleSelectName}
941
+ onSelectValue={handleSelectValue}
942
+ isEdited={false}
943
+ title="Cannot Edit"
944
+ />
945
+
928
946
  <div className='m-9'></div>
929
947
  <p className='text-black font-bold text-2xl text-center py-2'>Dropzone</p>
930
948
  <DropzoneUploadFile