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.esm.js
CHANGED
|
@@ -8192,9 +8192,17 @@ const Select = forwardRef(({ name, label, message, selectLabel, size = 'md', flo
|
|
|
8192
8192
|
const dropdownRef = useRef(null);
|
|
8193
8193
|
const dropdownOptionsRef = useRef(null);
|
|
8194
8194
|
const handleOptionClick = (optionValue) => {
|
|
8195
|
+
const selectedOption = options.find((opt) => opt.value === optionValue);
|
|
8196
|
+
// Gunakan nilai asli sesuai tipe (number/string)
|
|
8197
|
+
const actualValue = typeof selectedOption?.value === 'number'
|
|
8198
|
+
? Number(selectedOption.value)
|
|
8199
|
+
: selectedOption?.value;
|
|
8195
8200
|
if (onChange) {
|
|
8196
8201
|
onChange({
|
|
8197
|
-
target: {
|
|
8202
|
+
target: {
|
|
8203
|
+
name,
|
|
8204
|
+
value: actualValue,
|
|
8205
|
+
},
|
|
8198
8206
|
});
|
|
8199
8207
|
}
|
|
8200
8208
|
setIsOpen(false);
|
|
@@ -8220,7 +8228,7 @@ const Select = forwardRef(({ name, label, message, selectLabel, size = 'md', flo
|
|
|
8220
8228
|
React.createElement("div", { className: `dropdown-header ${isOpen ? 'open' : ''} ${disabled ? 'disabled' : ''}`, onClick: () => !disabled && setIsOpen(!isOpen), ref: ref, "aria-haspopup": "listbox", "aria-expanded": isOpen },
|
|
8221
8229
|
React.createElement("span", { className: "label" }, displayText),
|
|
8222
8230
|
React.createElement(FiChevronDown, { className: "arrow" })),
|
|
8223
|
-
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
|
|
8231
|
+
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)))))),
|
|
8224
8232
|
label && floatingLabel && (React.createElement("label", { htmlFor: name },
|
|
8225
8233
|
label,
|
|
8226
8234
|
" ",
|