@idds/react 1.5.8 → 1.5.9
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 +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +20 -14
- package/dist/index.umd.js +1 -1
- package/dist/types/components/SelectDropdown.d.ts +5 -1
- package/dist/types/components/SelectDropdown.d.ts.map +1 -1
- package/dist/types/components/TimePicker.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -4678,7 +4678,9 @@ function SelectDropdown({
|
|
|
4678
4678
|
disabled = false,
|
|
4679
4679
|
showPreviewValue = true,
|
|
4680
4680
|
searchable = true,
|
|
4681
|
-
onSelectedRawChange
|
|
4681
|
+
onSelectedRawChange,
|
|
4682
|
+
label,
|
|
4683
|
+
required
|
|
4682
4684
|
}) {
|
|
4683
4685
|
const [isOpen, setIsOpen] = useState(false);
|
|
4684
4686
|
const [internalSearchTerm, setInternalSearchTerm] = useState("");
|
|
@@ -4755,9 +4757,9 @@ function SelectDropdown({
|
|
|
4755
4757
|
return null;
|
|
4756
4758
|
};
|
|
4757
4759
|
const getOptionForValue = (value) => {
|
|
4758
|
-
const
|
|
4759
|
-
if (
|
|
4760
|
-
return { label, value };
|
|
4760
|
+
const label2 = getLabelForValue(value);
|
|
4761
|
+
if (label2 !== null) {
|
|
4762
|
+
return { label: label2, value };
|
|
4761
4763
|
}
|
|
4762
4764
|
const found = options.find((o) => o.value === value);
|
|
4763
4765
|
return found || null;
|
|
@@ -4819,12 +4821,12 @@ function SelectDropdown({
|
|
|
4819
4821
|
else if (selectedArray.length > 3)
|
|
4820
4822
|
triggerLabel = `${selectedArray.length} data terpilih`;
|
|
4821
4823
|
else {
|
|
4822
|
-
const labels = selectedArray.map((val) => getLabelForValue(val)).filter((
|
|
4824
|
+
const labels = selectedArray.map((val) => getLabelForValue(val)).filter((label2) => label2 !== null);
|
|
4823
4825
|
triggerLabel = labels.length > 0 ? labels.join(", ") : placeholder;
|
|
4824
4826
|
}
|
|
4825
4827
|
} else {
|
|
4826
|
-
const
|
|
4827
|
-
triggerLabel =
|
|
4828
|
+
const label2 = getLabelForValue(singleSelected);
|
|
4829
|
+
triggerLabel = label2 || placeholder;
|
|
4828
4830
|
}
|
|
4829
4831
|
const filteredOptions = onSearch ? options : !searchable ? options : options.filter(
|
|
4830
4832
|
(o) => o.label.toLowerCase().includes(searchTerm.toLowerCase())
|
|
@@ -4858,8 +4860,8 @@ function SelectDropdown({
|
|
|
4858
4860
|
if (multiple && selectedArray.length > 0) {
|
|
4859
4861
|
return /* @__PURE__ */ jsxs("div", { className: "ina-select-dropdown__preview-content", children: [
|
|
4860
4862
|
selectedArray.slice(0, 3).map((value, index) => {
|
|
4861
|
-
const
|
|
4862
|
-
const displayLabel =
|
|
4863
|
+
const label2 = getLabelForValue(value);
|
|
4864
|
+
const displayLabel = label2 || value;
|
|
4863
4865
|
return /* @__PURE__ */ jsxs(
|
|
4864
4866
|
"div",
|
|
4865
4867
|
{
|
|
@@ -4893,8 +4895,8 @@ function SelectDropdown({
|
|
|
4893
4895
|
] });
|
|
4894
4896
|
}
|
|
4895
4897
|
if (!multiple && singleSelected !== null && singleSelected !== void 0 && singleSelected !== "") {
|
|
4896
|
-
const
|
|
4897
|
-
const displayLabel =
|
|
4898
|
+
const label2 = getLabelForValue(singleSelected);
|
|
4899
|
+
const displayLabel = label2 || singleSelected;
|
|
4898
4900
|
return /* @__PURE__ */ jsx("div", { className: "ina-select-dropdown__preview-content", children: /* @__PURE__ */ jsxs("div", { className: "ina-select-dropdown__preview-item ina-select-dropdown__preview-item--single", children: [
|
|
4899
4901
|
/* @__PURE__ */ jsx("span", { className: "ina-select-dropdown__preview-item-text", children: displayLabel }),
|
|
4900
4902
|
!disabled && /* @__PURE__ */ jsx(
|
|
@@ -4943,6 +4945,10 @@ function SelectDropdown({
|
|
|
4943
4945
|
style: { width: toCssSize(width) },
|
|
4944
4946
|
className: containerClasses,
|
|
4945
4947
|
children: [
|
|
4948
|
+
label && /* @__PURE__ */ jsxs("label", { className: "ina-select-dropdown__label", children: [
|
|
4949
|
+
label,
|
|
4950
|
+
required && /* @__PURE__ */ jsx("span", { className: "ina-select-dropdown__required", children: "*" })
|
|
4951
|
+
] }),
|
|
4946
4952
|
/* @__PURE__ */ jsxs(
|
|
4947
4953
|
"button",
|
|
4948
4954
|
{
|
|
@@ -6296,7 +6302,7 @@ const TimePicker = forwardRef(
|
|
|
6296
6302
|
const inputClasses = clsx(
|
|
6297
6303
|
"ina-time-picker__input",
|
|
6298
6304
|
`ina-time-picker__input--size-${size}`,
|
|
6299
|
-
|
|
6305
|
+
"ina-time-picker__input--with-prefix",
|
|
6300
6306
|
(suffixIcon || allowClear) && "ina-time-picker__input--with-suffix"
|
|
6301
6307
|
);
|
|
6302
6308
|
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: containerClasses, children: [
|
|
@@ -6325,7 +6331,7 @@ const TimePicker = forwardRef(
|
|
|
6325
6331
|
}
|
|
6326
6332
|
},
|
|
6327
6333
|
children: [
|
|
6328
|
-
|
|
6334
|
+
/* @__PURE__ */ jsx("div", { className: "ina-time-picker__prefix-icon", children: prefixIcon || /* @__PURE__ */ jsx(IconClock, { size: 16 }) }),
|
|
6329
6335
|
/* @__PURE__ */ jsx(
|
|
6330
6336
|
"input",
|
|
6331
6337
|
{
|
|
@@ -6367,7 +6373,7 @@ const TimePicker = forwardRef(
|
|
|
6367
6373
|
"aria-label": "Clear time",
|
|
6368
6374
|
children: /* @__PURE__ */ jsx(IconX, { size: 16 })
|
|
6369
6375
|
}
|
|
6370
|
-
) : suffixIcon
|
|
6376
|
+
) : suffixIcon && /* @__PURE__ */ jsx("div", { className: "ina-time-picker__suffix-icon", children: suffixIcon })
|
|
6371
6377
|
]
|
|
6372
6378
|
}
|
|
6373
6379
|
),
|