elseware-ui 3.0.3 → 3.0.5
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.css +0 -38
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +132 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +132 -100
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.d.mts +2 -2
- package/dist/index.native.d.ts +2 -2
- package/dist/index.native.js +72 -53
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +72 -53
- package/dist/index.native.mjs.map +1 -1
- package/dist/{resolveGlobalConfigs-CL-Puk7Y.d.mts → resolveGlobalConfigs-PbcnVEZr.d.mts} +3 -1
- package/dist/{resolveGlobalConfigs-CL-Puk7Y.d.ts → resolveGlobalConfigs-PbcnVEZr.d.ts} +3 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7778,6 +7778,17 @@ var InputListGroup = ({
|
|
|
7778
7778
|
function isMultiCheckbox(props) {
|
|
7779
7779
|
return Array.isArray(props.options);
|
|
7780
7780
|
}
|
|
7781
|
+
function resolveCheckboxColumns(columns) {
|
|
7782
|
+
return columns ?? 1;
|
|
7783
|
+
}
|
|
7784
|
+
function chunkCheckboxOptions(options, columns) {
|
|
7785
|
+
const resolvedColumns = resolveCheckboxColumns(columns);
|
|
7786
|
+
const chunkSize = Math.ceil(options.length / resolvedColumns);
|
|
7787
|
+
return Array.from(
|
|
7788
|
+
{ length: resolvedColumns },
|
|
7789
|
+
(_2, columnIndex) => options.slice(columnIndex * chunkSize, (columnIndex + 1) * chunkSize)
|
|
7790
|
+
).filter((columnOptions) => columnOptions.length > 0);
|
|
7791
|
+
}
|
|
7781
7792
|
function useResolvedCheckboxConfig({
|
|
7782
7793
|
label,
|
|
7783
7794
|
placeholder,
|
|
@@ -7787,7 +7798,7 @@ function useResolvedCheckboxConfig({
|
|
|
7787
7798
|
const eui = useEUIConfig();
|
|
7788
7799
|
return {
|
|
7789
7800
|
shape: shape ?? eui?.config?.global?.shape ?? "roundedSquare",
|
|
7790
|
-
variant: variant ?? "
|
|
7801
|
+
variant: variant ?? "success",
|
|
7791
7802
|
label: label ?? placeholder
|
|
7792
7803
|
};
|
|
7793
7804
|
}
|
|
@@ -7936,6 +7947,7 @@ function Checkbox(checkboxProps) {
|
|
|
7936
7947
|
const activeFieldName = isMulti ? multiField.name : singleField.name;
|
|
7937
7948
|
const activeMeta = isMulti ? multiMeta : singleMeta;
|
|
7938
7949
|
const multiProps = isMultiCheckbox(checkboxProps) ? checkboxProps : null;
|
|
7950
|
+
const optionColumns = multiProps ? chunkCheckboxOptions(multiProps.options, multiProps.columns) : [];
|
|
7939
7951
|
const singleChecked = singleField.value;
|
|
7940
7952
|
return /* @__PURE__ */ jsxs("div", { className: cn(checkboxGroupClassName, groupClassName), children: [
|
|
7941
7953
|
!isMulti && /* @__PURE__ */ jsxs("div", { className: cn(checkboxOptionRowClassName, optionClassName), children: [
|
|
@@ -7979,67 +7991,74 @@ function Checkbox(checkboxProps) {
|
|
|
7979
7991
|
}
|
|
7980
7992
|
) : null
|
|
7981
7993
|
] }),
|
|
7982
|
-
isMulti && multiProps
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
7994
|
+
isMulti && multiProps ? /* @__PURE__ */ jsx("div", { className: "flex w-full flex-row gap-6", children: optionColumns.map((columnOptions, columnIndex) => /* @__PURE__ */ jsx(
|
|
7995
|
+
"div",
|
|
7996
|
+
{
|
|
7997
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
7998
|
+
children: columnOptions.map((option) => {
|
|
7999
|
+
const values = multiField.value ?? [];
|
|
8000
|
+
const checked = values.includes(option.value);
|
|
8001
|
+
const optionDisabled = disabled || option.disabled === true;
|
|
8002
|
+
return /* @__PURE__ */ jsxs(
|
|
8003
|
+
"div",
|
|
8004
|
+
{
|
|
8005
|
+
className: cn(checkboxOptionRowClassName, optionClassName),
|
|
8006
|
+
children: [
|
|
8007
|
+
/* @__PURE__ */ jsxs("span", { className: "relative inline-flex h-5 w-5 shrink-0 items-center justify-center", children: [
|
|
8008
|
+
/* @__PURE__ */ jsx(
|
|
8009
|
+
"input",
|
|
8010
|
+
{
|
|
8011
|
+
id: option.value,
|
|
8012
|
+
name: multiField.name,
|
|
8013
|
+
type: "checkbox",
|
|
8014
|
+
checked,
|
|
8015
|
+
disabled: optionDisabled,
|
|
8016
|
+
onBlur: multiField.onBlur,
|
|
8017
|
+
onChange: () => {
|
|
8018
|
+
multiHelpers.setValue(
|
|
8019
|
+
checked ? values.filter((value) => value !== option.value) : [...values, option.value]
|
|
8020
|
+
);
|
|
8021
|
+
},
|
|
8022
|
+
className: getIndicatorClassName({
|
|
8023
|
+
checked,
|
|
8024
|
+
className,
|
|
8025
|
+
disabled: optionDisabled,
|
|
8026
|
+
indicatorClassName,
|
|
8027
|
+
checkedIndicatorClassName,
|
|
8028
|
+
resolvedShape,
|
|
8029
|
+
variantCheckedClassName: variantStyles.checkedClassName
|
|
8030
|
+
})
|
|
8031
|
+
}
|
|
8032
|
+
),
|
|
8033
|
+
/* @__PURE__ */ jsx(
|
|
8034
|
+
Tick,
|
|
8035
|
+
{
|
|
8036
|
+
checked,
|
|
8037
|
+
checkedIconClassName,
|
|
8038
|
+
iconClassName: variantStyles.iconClassName
|
|
8039
|
+
}
|
|
8040
|
+
)
|
|
8041
|
+
] }),
|
|
8042
|
+
/* @__PURE__ */ jsx(
|
|
8043
|
+
"label",
|
|
8044
|
+
{
|
|
8045
|
+
htmlFor: option.value,
|
|
8046
|
+
className: cn(
|
|
8047
|
+
checkboxLabelClassName,
|
|
8048
|
+
optionDisabled && "cursor-not-allowed opacity-60",
|
|
8049
|
+
labelClassName
|
|
8050
|
+
),
|
|
8051
|
+
children: option.label
|
|
8052
|
+
}
|
|
8053
|
+
)
|
|
8054
|
+
]
|
|
8055
|
+
},
|
|
8056
|
+
option.value
|
|
8057
|
+
);
|
|
8058
|
+
})
|
|
8059
|
+
},
|
|
8060
|
+
`${multiField.name}-column-${columnIndex}`
|
|
8061
|
+
)) }) : null,
|
|
8043
8062
|
/* @__PURE__ */ jsx(
|
|
8044
8063
|
InputResponse,
|
|
8045
8064
|
{
|
|
@@ -8435,6 +8454,7 @@ function MultiImageInput({
|
|
|
8435
8454
|
);
|
|
8436
8455
|
const [imageUrls, setImageUrls] = useState(fieldImageUrls);
|
|
8437
8456
|
const imageInputRef = useRef(null);
|
|
8457
|
+
const replaceInputRefs = useRef({});
|
|
8438
8458
|
const [draggedIndex, setDraggedIndex] = useState(null);
|
|
8439
8459
|
const [replacingIndex, setReplacingIndex] = useState(null);
|
|
8440
8460
|
const isOrganizerBusy = replacingIndex !== null;
|
|
@@ -8528,6 +8548,9 @@ function MultiImageInput({
|
|
|
8528
8548
|
moveImage(draggedIndex, index3);
|
|
8529
8549
|
setDraggedIndex(null);
|
|
8530
8550
|
};
|
|
8551
|
+
const openReplacePicker = (index3) => {
|
|
8552
|
+
replaceInputRefs.current[index3]?.click();
|
|
8553
|
+
};
|
|
8531
8554
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8532
8555
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row flex-wrap gap-5 w-full", children: [
|
|
8533
8556
|
imageUrls.map((url, index3) => {
|
|
@@ -8554,65 +8577,74 @@ function MultiImageInput({
|
|
|
8554
8577
|
] }),
|
|
8555
8578
|
/* @__PURE__ */ jsxs("div", { className: "absolute right-2 top-2 flex gap-1", children: [
|
|
8556
8579
|
/* @__PURE__ */ jsx(
|
|
8557
|
-
|
|
8580
|
+
Button_web_default,
|
|
8558
8581
|
{
|
|
8559
|
-
type: "button",
|
|
8560
8582
|
title: "Move image left",
|
|
8561
|
-
|
|
8583
|
+
accessibilityLabel: "Move image left",
|
|
8562
8584
|
disabled: index3 === 0 || isOrganizerBusy,
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8585
|
+
glow: false,
|
|
8586
|
+
icon: /* @__PURE__ */ jsx(MdKeyboardArrowLeft, {}),
|
|
8587
|
+
onPress: () => moveImage(index3, index3 - 1),
|
|
8588
|
+
size: "xs",
|
|
8589
|
+
className: "h-8 w-8 bg-black/60 p-0 text-xl text-white hover:bg-black/80 disabled:opacity-40"
|
|
8566
8590
|
}
|
|
8567
8591
|
),
|
|
8568
8592
|
/* @__PURE__ */ jsx(
|
|
8569
|
-
|
|
8593
|
+
Button_web_default,
|
|
8570
8594
|
{
|
|
8571
|
-
type: "button",
|
|
8572
8595
|
title: "Move image right",
|
|
8573
|
-
|
|
8596
|
+
accessibilityLabel: "Move image right",
|
|
8574
8597
|
disabled: index3 === imageUrls.length - 1 || isOrganizerBusy,
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8598
|
+
glow: false,
|
|
8599
|
+
icon: /* @__PURE__ */ jsx(MdKeyboardArrowRight, {}),
|
|
8600
|
+
onPress: () => moveImage(index3, index3 + 1),
|
|
8601
|
+
size: "xs",
|
|
8602
|
+
className: "h-8 w-8 bg-black/60 p-0 text-xl text-white hover:bg-black/80 disabled:opacity-40"
|
|
8578
8603
|
}
|
|
8579
8604
|
)
|
|
8580
8605
|
] }),
|
|
8581
8606
|
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2", children: [
|
|
8582
|
-
/* @__PURE__ */
|
|
8583
|
-
"
|
|
8607
|
+
/* @__PURE__ */ jsx(
|
|
8608
|
+
"input",
|
|
8584
8609
|
{
|
|
8610
|
+
ref: (input) => {
|
|
8611
|
+
replaceInputRefs.current[index3] = input;
|
|
8612
|
+
},
|
|
8613
|
+
type: "file",
|
|
8614
|
+
className: "hidden",
|
|
8615
|
+
accept: "image/*",
|
|
8616
|
+
disabled: isOrganizerBusy,
|
|
8617
|
+
onChange: (event) => void handleReplaceImage(index3, event)
|
|
8618
|
+
}
|
|
8619
|
+
),
|
|
8620
|
+
/* @__PURE__ */ jsx(
|
|
8621
|
+
Button_web_default,
|
|
8622
|
+
{
|
|
8623
|
+
block: true,
|
|
8624
|
+
appearance: "solid",
|
|
8585
8625
|
title: "Change image",
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
),
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
type: "file",
|
|
8595
|
-
className: "hidden",
|
|
8596
|
-
accept: "image/*",
|
|
8597
|
-
disabled: isOrganizerBusy,
|
|
8598
|
-
onChange: (event) => void handleReplaceImage(index3, event)
|
|
8599
|
-
}
|
|
8600
|
-
),
|
|
8601
|
-
/* @__PURE__ */ jsx(MdUpload, {}),
|
|
8602
|
-
"Change"
|
|
8603
|
-
]
|
|
8626
|
+
accessibilityLabel: "Change image",
|
|
8627
|
+
disabled: isOrganizerBusy,
|
|
8628
|
+
glow: false,
|
|
8629
|
+
icon: /* @__PURE__ */ jsx(MdUpload, {}),
|
|
8630
|
+
onPress: () => openReplacePicker(index3),
|
|
8631
|
+
size: "sm",
|
|
8632
|
+
text: "Change",
|
|
8633
|
+
variant: "success"
|
|
8604
8634
|
}
|
|
8605
8635
|
),
|
|
8606
8636
|
/* @__PURE__ */ jsx(
|
|
8607
|
-
|
|
8637
|
+
Button_web_default,
|
|
8608
8638
|
{
|
|
8609
|
-
|
|
8639
|
+
appearance: "solid",
|
|
8610
8640
|
title: "Delete image",
|
|
8611
|
-
|
|
8641
|
+
accessibilityLabel: "Delete image",
|
|
8612
8642
|
disabled: isOrganizerBusy,
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8643
|
+
glow: false,
|
|
8644
|
+
icon: /* @__PURE__ */ jsx(MdOutlineDelete, {}),
|
|
8645
|
+
onPress: () => removeImage(index3),
|
|
8646
|
+
size: "sm",
|
|
8647
|
+
variant: "danger"
|
|
8616
8648
|
}
|
|
8617
8649
|
)
|
|
8618
8650
|
] }),
|