ar-design 0.2.5 → 0.2.7
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.
|
@@ -6,7 +6,7 @@ import Chip from "../../data-display/chip";
|
|
|
6
6
|
import Checkbox from "../checkbox";
|
|
7
7
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
8
8
|
import ReactDOM from "react-dom";
|
|
9
|
-
const Select = ({ variant = "outlined", status, border = { radius: "sm" }, options, value, onChange, onCreate, multiple, placeholder, validation, upperCase, disabled, }) => {
|
|
9
|
+
const Select = ({ variant = "outlined", status, border = { radius: "sm" }, options, value, onChange, onClick, onCreate, multiple, placeholder, validation, upperCase, disabled, }) => {
|
|
10
10
|
const _selectionClassName = ["selections"];
|
|
11
11
|
// refs
|
|
12
12
|
const _arSelect = useRef(null);
|
|
@@ -242,7 +242,12 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
|
|
|
242
242
|
multiple ? (React.createElement("div", { className: _selectionClassName.map((c) => c).join(" "), onClick: () => setOptionsOpen((x) => !x) },
|
|
243
243
|
React.createElement("div", { className: "items" }, value.length > 0 ? (value.map((_value, index) => (React.createElement(Chip, { key: index, variant: status?.selected?.variant || "filled", status: status?.selected?.color || status?.color, text: _value.text })))) : (React.createElement("span", { className: "placeholder" },
|
|
244
244
|
validation ? "* " : "",
|
|
245
|
-
placeholder))))) : (React.createElement(Input, { ref: _singleInput, variant: variant, status: !Utils.IsNullOrEmpty(validation?.text) ? "danger" : status, border: { radius: border.radius }, value: singleInputText, onClick: () =>
|
|
245
|
+
placeholder))))) : (React.createElement(Input, { ref: _singleInput, variant: variant, status: !Utils.IsNullOrEmpty(validation?.text) ? "danger" : status, border: { radius: border.radius }, value: singleInputText, onClick: () => {
|
|
246
|
+
onClick && onClick();
|
|
247
|
+
(() => {
|
|
248
|
+
setOptionsOpen((prev) => !prev);
|
|
249
|
+
})();
|
|
250
|
+
}, onChange: (event) => {
|
|
246
251
|
!optionsOpen && setOptionsOpen(true);
|
|
247
252
|
if (upperCase)
|
|
248
253
|
event.target.value = convertToUpperCase(event.target.value);
|