pesona-ui 1.0.26 → 1.0.28
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.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
|
" ",
|
|
@@ -8563,9 +8571,12 @@ const RadioButtonGroup = React.forwardRef(({ name, label, message, size = 'md',
|
|
|
8563
8571
|
label,
|
|
8564
8572
|
" ",
|
|
8565
8573
|
required && React.createElement("span", { className: "text-danger" }, "*"))),
|
|
8566
|
-
React.createElement("div", { className: "btn-group", "data-toggle": "buttons" }, options.map((option) =>
|
|
8567
|
-
|
|
8568
|
-
React.createElement("
|
|
8574
|
+
React.createElement("div", { className: "btn-group", "data-toggle": "buttons" }, options.map((option) => {
|
|
8575
|
+
const isActive = option.value.toString() === selectedValue?.toString();
|
|
8576
|
+
return (React.createElement("label", { key: option.value.toString(), className: `btn auto btn-default btn-${size} ${isActive ? 'active' : ''}` },
|
|
8577
|
+
React.createElement("input", { type: "radio", id: option.value.toString(), name: name, value: option.value.toString(), ref: ref, ...rest }),
|
|
8578
|
+
React.createElement("span", null, option.label)));
|
|
8579
|
+
})),
|
|
8569
8580
|
error ? (React.createElement("small", { className: "form-message text-danger" }, error)) : (message && React.createElement("small", { className: "form-message text-muted" }, message))));
|
|
8570
8581
|
});
|
|
8571
8582
|
RadioButtonGroup.displayName = 'RadioButtonGroup';
|