sprint-asia-custom-component 0.1.144 → 0.1.145

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
@@ -24156,6 +24156,7 @@
24156
24156
  const selectedValue = options.filter(val => {
24157
24157
  return val.value === currentOption;
24158
24158
  });
24159
+ const hasData = options.length > 0;
24159
24160
  return /*#__PURE__*/React__default["default"].createElement("div", {
24160
24161
  className: `relative inline-block text-left w-full ${className}`,
24161
24162
  ref: dropdownRef
@@ -24170,11 +24171,11 @@
24170
24171
  }, /*#__PURE__*/React__default["default"].createElement("button", {
24171
24172
  type: "button",
24172
24173
  className: `
24173
- ${!isEdited && "bg-neutral30 cursor-not-allowed"}
24174
- ${mode === "default" && currentOption === "" && "border-neutral50 bg-neutral20 cursor-pointer"}
24175
- ${mode === "default" && currentOption !== "" && "border-black bg-neutral20 cursor-pointer"}
24176
- ${mode === "danger" && "border-danger500 bg-danger50 cursor-pointer"}
24177
- 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`,
24174
+ ${!isEdited && "bg-neutral30 cursor-not-allowed"}
24175
+ ${mode === "default" && currentOption === "" && "border-neutral50 bg-neutral20 cursor-pointer"}
24176
+ ${mode === "default" && currentOption !== "" && "border-black bg-neutral20 cursor-pointer"}
24177
+ ${mode === "danger" && "border-danger500 bg-danger50 cursor-pointer"}
24178
+ 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`,
24178
24179
  onClick: () => isEdited && handleToggleDropdownText()
24179
24180
  }, /*#__PURE__*/React__default["default"].createElement("span", {
24180
24181
  className: "flex-grow overflow-hidden"
@@ -24193,7 +24194,7 @@
24193
24194
  "aria-labelledby": "options-menu"
24194
24195
  }, /*#__PURE__*/React__default["default"].createElement("div", {
24195
24196
  className: "px-1 py-2 max-h-40 overflow-y-auto"
24196
- }, options.map((option, index) => /*#__PURE__*/React__default["default"].createElement("div", {
24197
+ }, hasData ? options.map((option, index) => /*#__PURE__*/React__default["default"].createElement("div", {
24197
24198
  key: index,
24198
24199
  className: "hover:bg-neutral20 bg-white py-2.5 px-4 my-0.5 rounded-md",
24199
24200
  onClick: () => {
@@ -24203,7 +24204,11 @@
24203
24204
  }
24204
24205
  }, /*#__PURE__*/React__default["default"].createElement("p", {
24205
24206
  className: "text-sm text-black"
24206
- }, option.option))))), footer && /*#__PURE__*/React__default["default"].createElement("div", {
24207
+ }, option.option))) : /*#__PURE__*/React__default["default"].createElement("div", {
24208
+ className: "bg-white py-2.5 px-4 my-0.5 rounded-md"
24209
+ }, /*#__PURE__*/React__default["default"].createElement("p", {
24210
+ className: "text-sm text-neutral500"
24211
+ }, "No data")))), footer && /*#__PURE__*/React__default["default"].createElement("div", {
24207
24212
  className: "mt-1"
24208
24213
  }, mode === "danger" ? /*#__PURE__*/React__default["default"].createElement("div", {
24209
24214
  className: "flex"
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.144",
4
+ "version": "0.1.145",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "@headlessui/react": "^1.7.18",
@@ -47,6 +47,8 @@ const DropdownText = ({
47
47
  return val.value === currentOption;
48
48
  });
49
49
 
50
+ const hasData = options.length > 0;
51
+
50
52
  return (
51
53
  <div className={`relative inline-block text-left w-full ${className}`} ref={dropdownRef}>
52
54
  {title && (
@@ -60,11 +62,11 @@ const DropdownText = ({
60
62
  <button
61
63
  type="button"
62
64
  className={`
63
- ${!isEdited && "bg-neutral30 cursor-not-allowed"}
64
- ${mode === "default" && currentOption === "" && "border-neutral50 bg-neutral20 cursor-pointer"}
65
- ${mode === "default" && currentOption !== "" && "border-black bg-neutral20 cursor-pointer"}
66
- ${mode === "danger" && "border-danger500 bg-danger50 cursor-pointer"}
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`}
65
+ ${!isEdited && "bg-neutral30 cursor-not-allowed"}
66
+ ${mode === "default" && currentOption === "" && "border-neutral50 bg-neutral20 cursor-pointer"}
67
+ ${mode === "default" && currentOption !== "" && "border-black bg-neutral20 cursor-pointer"}
68
+ ${mode === "danger" && "border-danger500 bg-danger50 cursor-pointer"}
69
+ 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`}
68
70
  onClick={() => isEdited && handleToggleDropdownText()}
69
71
  >
70
72
  <span className="flex-grow overflow-hidden">
@@ -89,19 +91,25 @@ const DropdownText = ({
89
91
  aria-labelledby="options-menu"
90
92
  >
91
93
  <div className="px-1 py-2 max-h-40 overflow-y-auto">
92
- {options.map((option, index) => (
93
- <div
94
- key={index}
95
- className="hover:bg-neutral20 bg-white py-2.5 px-4 my-0.5 rounded-md"
96
- onClick={() => {
97
- if (option.option !== "Loading...") {
98
- handleOptionClick(option.option, option.value);
99
- }
100
- }}
101
- >
102
- <p className="text-sm text-black">{option.option}</p>
94
+ {hasData ? (
95
+ options.map((option, index) => (
96
+ <div
97
+ key={index}
98
+ className="hover:bg-neutral20 bg-white py-2.5 px-4 my-0.5 rounded-md"
99
+ onClick={() => {
100
+ if (option.option !== "Loading...") {
101
+ handleOptionClick(option.option, option.value);
102
+ }
103
+ }}
104
+ >
105
+ <p className="text-sm text-black">{option.option}</p>
106
+ </div>
107
+ ))
108
+ ) : (
109
+ <div className="bg-white py-2.5 px-4 my-0.5 rounded-md">
110
+ <p className="text-sm text-neutral500">No data</p>
103
111
  </div>
104
- ))}
112
+ )}
105
113
  </div>
106
114
  </div>
107
115
  )}