pesona-ui 1.0.26 → 1.0.27
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.cjs.js +10 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8194,9 +8194,17 @@ const Select = React.forwardRef(({ name, label, message, selectLabel, size = 'md
|
|
|
8194
8194
|
const dropdownRef = React.useRef(null);
|
|
8195
8195
|
const dropdownOptionsRef = React.useRef(null);
|
|
8196
8196
|
const handleOptionClick = (optionValue) => {
|
|
8197
|
+
const selectedOption = options.find((opt) => opt.value === optionValue);
|
|
8198
|
+
// Gunakan nilai asli sesuai tipe (number/string)
|
|
8199
|
+
const actualValue = typeof selectedOption?.value === 'number'
|
|
8200
|
+
? Number(selectedOption.value)
|
|
8201
|
+
: selectedOption?.value;
|
|
8197
8202
|
if (onChange) {
|
|
8198
8203
|
onChange({
|
|
8199
|
-
target: {
|
|
8204
|
+
target: {
|
|
8205
|
+
name,
|
|
8206
|
+
value: actualValue,
|
|
8207
|
+
},
|
|
8200
8208
|
});
|
|
8201
8209
|
}
|
|
8202
8210
|
setIsOpen(false);
|
|
@@ -8222,7 +8230,7 @@ const Select = React.forwardRef(({ name, label, message, selectLabel, size = 'md
|
|
|
8222
8230
|
React.createElement("div", { className: `dropdown-header ${isOpen ? 'open' : ''} ${disabled ? 'disabled' : ''}`, onClick: () => !disabled && setIsOpen(!isOpen), ref: ref, "aria-haspopup": "listbox", "aria-expanded": isOpen },
|
|
8223
8231
|
React.createElement("span", { className: "label" }, displayText),
|
|
8224
8232
|
React.createElement(FiChevronDown, { className: "arrow" })),
|
|
8225
|
-
isOpen && (React.createElement("div", { className: `dropdown-options scrollbar ${disabled ? 'disabled' : ''}`, ref: dropdownOptionsRef, role: "listbox" }, options.map((option, index) => (React.createElement("div", { key: `${option.value}-${index}`, className: `option ${value === option.value ? 'selected' : ''}`, onClick: () => !disabled && handleOptionClick(option.value
|
|
8233
|
+
isOpen && (React.createElement("div", { className: `dropdown-options scrollbar ${disabled ? 'disabled' : ''}`, ref: dropdownOptionsRef, role: "listbox" }, options.map((option, index) => (React.createElement("div", { key: `${option.value}-${index}`, className: `option ${value === option.value ? 'selected' : ''}`, onClick: () => !disabled && handleOptionClick(option.value), role: "option", "aria-selected": value === option.value }, option.label)))))),
|
|
8226
8234
|
label && floatingLabel && (React.createElement("label", { htmlFor: name },
|
|
8227
8235
|
label,
|
|
8228
8236
|
" ",
|