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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactNode, SelectHTMLAttributes, InputHTMLAttributes, JSX, Dispatch, SetStateAction, ImgHTMLAttributes, ComponentPropsWithoutRef, HTMLAttributes, TdHTMLAttributes, TableHTMLAttributes, ThHTMLAttributes, FC, ComponentType, MouseEvent, HTMLAttributeAnchorTarget, BlockquoteHTMLAttributes, AnchorHTMLAttributes, OlHTMLAttributes, LiHTMLAttributes, DetailsHTMLAttributes, ClassAttributes, TextareaHTMLAttributes, FocusEventHandler, MutableRefObject } from 'react';
3
- import { l as BaseComponentProps, V as Variant, A as Appearance, S as Shape, m as Size, O as OctilePosition, T as TitleBannerLevel, L as ListBulletType, n as ListDirection, o as ListAlign, p as CurrencyCode, q as SpinnerType, s as SpinnerDirection, t as TextDecoration, B as ButtonProps, C as CheckboxProps, v as Shape$1, F as FormProps, a as FormResponseProps, I as InputProps, b as InputLabelProps, c as InputResponseProps, w as ToastStatus, x as ToastPosition, y as Target, z as TextVariant, D as Decoration, R as RouteTabMode, G as Variant$1 } from './resolveGlobalConfigs-CL-Puk7Y.mjs';
4
- export { d as ButtonIcon, e as ButtonMode, H as CardinalPosition, f as CheckboxOption, J as CornerPosition, E as EUIComponentDefaults, g as EUIConfigs, h as EUIProvider, i as EUIRoute, j as FormChangeMeta, k as FormChildren, K as HorizontalPosition, M as HyperRefTarget, N as VerticalPosition, r as resolveWithGlobal, u as useEUIConfig } from './resolveGlobalConfigs-CL-Puk7Y.mjs';
3
+ import { m as BaseComponentProps, V as Variant, A as Appearance, S as Shape, n as Size, O as OctilePosition, T as TitleBannerLevel, L as ListBulletType, o as ListDirection, p as ListAlign, q as CurrencyCode, s as SpinnerType, t as SpinnerDirection, v as TextDecoration, B as ButtonProps, C as CheckboxProps, w as Shape$1, F as FormProps, a as FormResponseProps, I as InputProps, b as InputLabelProps, c as InputResponseProps, x as ToastStatus, y as ToastPosition, z as Target, D as TextVariant, G as Decoration, R as RouteTabMode, H as Variant$1 } from './resolveGlobalConfigs-PbcnVEZr.mjs';
4
+ export { d as ButtonIcon, e as ButtonMode, J as CardinalPosition, f as CheckboxColumns, g as CheckboxOption, K as CornerPosition, E as EUIComponentDefaults, h as EUIConfigs, i as EUIProvider, j as EUIRoute, k as FormChangeMeta, l as FormChildren, M as HorizontalPosition, N as HyperRefTarget, P as VerticalPosition, r as resolveWithGlobal, u as useEUIConfig } from './resolveGlobalConfigs-PbcnVEZr.mjs';
5
5
  import * as d3 from 'd3';
6
6
  import * as formik from 'formik';
7
7
  import { FieldHookConfig, FormikValues } from 'formik';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactNode, SelectHTMLAttributes, InputHTMLAttributes, JSX, Dispatch, SetStateAction, ImgHTMLAttributes, ComponentPropsWithoutRef, HTMLAttributes, TdHTMLAttributes, TableHTMLAttributes, ThHTMLAttributes, FC, ComponentType, MouseEvent, HTMLAttributeAnchorTarget, BlockquoteHTMLAttributes, AnchorHTMLAttributes, OlHTMLAttributes, LiHTMLAttributes, DetailsHTMLAttributes, ClassAttributes, TextareaHTMLAttributes, FocusEventHandler, MutableRefObject } from 'react';
3
- import { l as BaseComponentProps, V as Variant, A as Appearance, S as Shape, m as Size, O as OctilePosition, T as TitleBannerLevel, L as ListBulletType, n as ListDirection, o as ListAlign, p as CurrencyCode, q as SpinnerType, s as SpinnerDirection, t as TextDecoration, B as ButtonProps, C as CheckboxProps, v as Shape$1, F as FormProps, a as FormResponseProps, I as InputProps, b as InputLabelProps, c as InputResponseProps, w as ToastStatus, x as ToastPosition, y as Target, z as TextVariant, D as Decoration, R as RouteTabMode, G as Variant$1 } from './resolveGlobalConfigs-CL-Puk7Y.js';
4
- export { d as ButtonIcon, e as ButtonMode, H as CardinalPosition, f as CheckboxOption, J as CornerPosition, E as EUIComponentDefaults, g as EUIConfigs, h as EUIProvider, i as EUIRoute, j as FormChangeMeta, k as FormChildren, K as HorizontalPosition, M as HyperRefTarget, N as VerticalPosition, r as resolveWithGlobal, u as useEUIConfig } from './resolveGlobalConfigs-CL-Puk7Y.js';
3
+ import { m as BaseComponentProps, V as Variant, A as Appearance, S as Shape, n as Size, O as OctilePosition, T as TitleBannerLevel, L as ListBulletType, o as ListDirection, p as ListAlign, q as CurrencyCode, s as SpinnerType, t as SpinnerDirection, v as TextDecoration, B as ButtonProps, C as CheckboxProps, w as Shape$1, F as FormProps, a as FormResponseProps, I as InputProps, b as InputLabelProps, c as InputResponseProps, x as ToastStatus, y as ToastPosition, z as Target, D as TextVariant, G as Decoration, R as RouteTabMode, H as Variant$1 } from './resolveGlobalConfigs-PbcnVEZr.js';
4
+ export { d as ButtonIcon, e as ButtonMode, J as CardinalPosition, f as CheckboxColumns, g as CheckboxOption, K as CornerPosition, E as EUIComponentDefaults, h as EUIConfigs, i as EUIProvider, j as EUIRoute, k as FormChangeMeta, l as FormChildren, M as HorizontalPosition, N as HyperRefTarget, P as VerticalPosition, r as resolveWithGlobal, u as useEUIConfig } from './resolveGlobalConfigs-PbcnVEZr.js';
5
5
  import * as d3 from 'd3';
6
6
  import * as formik from 'formik';
7
7
  import { FieldHookConfig, FormikValues } from 'formik';
package/dist/index.js CHANGED
@@ -7788,6 +7788,17 @@ var InputListGroup = ({
7788
7788
  function isMultiCheckbox(props) {
7789
7789
  return Array.isArray(props.options);
7790
7790
  }
7791
+ function resolveCheckboxColumns(columns) {
7792
+ return columns ?? 1;
7793
+ }
7794
+ function chunkCheckboxOptions(options, columns) {
7795
+ const resolvedColumns = resolveCheckboxColumns(columns);
7796
+ const chunkSize = Math.ceil(options.length / resolvedColumns);
7797
+ return Array.from(
7798
+ { length: resolvedColumns },
7799
+ (_2, columnIndex) => options.slice(columnIndex * chunkSize, (columnIndex + 1) * chunkSize)
7800
+ ).filter((columnOptions) => columnOptions.length > 0);
7801
+ }
7791
7802
  function useResolvedCheckboxConfig({
7792
7803
  label,
7793
7804
  placeholder,
@@ -7797,7 +7808,7 @@ function useResolvedCheckboxConfig({
7797
7808
  const eui = useEUIConfig();
7798
7809
  return {
7799
7810
  shape: shape ?? eui?.config?.global?.shape ?? "roundedSquare",
7800
- variant: variant ?? "secondary",
7811
+ variant: variant ?? "success",
7801
7812
  label: label ?? placeholder
7802
7813
  };
7803
7814
  }
@@ -7946,6 +7957,7 @@ function Checkbox(checkboxProps) {
7946
7957
  const activeFieldName = isMulti ? multiField.name : singleField.name;
7947
7958
  const activeMeta = isMulti ? multiMeta : singleMeta;
7948
7959
  const multiProps = isMultiCheckbox(checkboxProps) ? checkboxProps : null;
7960
+ const optionColumns = multiProps ? chunkCheckboxOptions(multiProps.options, multiProps.columns) : [];
7949
7961
  const singleChecked = singleField.value;
7950
7962
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(checkboxGroupClassName, groupClassName), children: [
7951
7963
  !isMulti && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(checkboxOptionRowClassName, optionClassName), children: [
@@ -7989,67 +8001,74 @@ function Checkbox(checkboxProps) {
7989
8001
  }
7990
8002
  ) : null
7991
8003
  ] }),
7992
- isMulti && multiProps?.options.map((option) => {
7993
- const values = multiField.value ?? [];
7994
- const checked = values.includes(option.value);
7995
- const optionDisabled = disabled || option.disabled === true;
7996
- return /* @__PURE__ */ jsxRuntime.jsxs(
7997
- "div",
7998
- {
7999
- className: cn(checkboxOptionRowClassName, optionClassName),
8000
- children: [
8001
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative inline-flex h-5 w-5 shrink-0 items-center justify-center", children: [
8002
- /* @__PURE__ */ jsxRuntime.jsx(
8003
- "input",
8004
- {
8005
- id: option.value,
8006
- name: multiField.name,
8007
- type: "checkbox",
8008
- checked,
8009
- disabled: optionDisabled,
8010
- onBlur: multiField.onBlur,
8011
- onChange: () => {
8012
- multiHelpers.setValue(
8013
- checked ? values.filter((value) => value !== option.value) : [...values, option.value]
8014
- );
8015
- },
8016
- className: getIndicatorClassName({
8017
- checked,
8018
- className,
8019
- disabled: optionDisabled,
8020
- indicatorClassName,
8021
- checkedIndicatorClassName,
8022
- resolvedShape,
8023
- variantCheckedClassName: variantStyles.checkedClassName
8024
- })
8025
- }
8026
- ),
8027
- /* @__PURE__ */ jsxRuntime.jsx(
8028
- Tick,
8029
- {
8030
- checked,
8031
- checkedIconClassName,
8032
- iconClassName: variantStyles.iconClassName
8033
- }
8034
- )
8035
- ] }),
8036
- /* @__PURE__ */ jsxRuntime.jsx(
8037
- "label",
8038
- {
8039
- htmlFor: option.value,
8040
- className: cn(
8041
- checkboxLabelClassName,
8042
- optionDisabled && "cursor-not-allowed opacity-60",
8043
- labelClassName
8044
- ),
8045
- children: option.label
8046
- }
8047
- )
8048
- ]
8049
- },
8050
- option.value
8051
- );
8052
- }),
8004
+ isMulti && multiProps ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-row gap-6", children: optionColumns.map((columnOptions, columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(
8005
+ "div",
8006
+ {
8007
+ className: "flex min-w-0 flex-1 flex-col gap-2",
8008
+ children: columnOptions.map((option) => {
8009
+ const values = multiField.value ?? [];
8010
+ const checked = values.includes(option.value);
8011
+ const optionDisabled = disabled || option.disabled === true;
8012
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8013
+ "div",
8014
+ {
8015
+ className: cn(checkboxOptionRowClassName, optionClassName),
8016
+ children: [
8017
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative inline-flex h-5 w-5 shrink-0 items-center justify-center", children: [
8018
+ /* @__PURE__ */ jsxRuntime.jsx(
8019
+ "input",
8020
+ {
8021
+ id: option.value,
8022
+ name: multiField.name,
8023
+ type: "checkbox",
8024
+ checked,
8025
+ disabled: optionDisabled,
8026
+ onBlur: multiField.onBlur,
8027
+ onChange: () => {
8028
+ multiHelpers.setValue(
8029
+ checked ? values.filter((value) => value !== option.value) : [...values, option.value]
8030
+ );
8031
+ },
8032
+ className: getIndicatorClassName({
8033
+ checked,
8034
+ className,
8035
+ disabled: optionDisabled,
8036
+ indicatorClassName,
8037
+ checkedIndicatorClassName,
8038
+ resolvedShape,
8039
+ variantCheckedClassName: variantStyles.checkedClassName
8040
+ })
8041
+ }
8042
+ ),
8043
+ /* @__PURE__ */ jsxRuntime.jsx(
8044
+ Tick,
8045
+ {
8046
+ checked,
8047
+ checkedIconClassName,
8048
+ iconClassName: variantStyles.iconClassName
8049
+ }
8050
+ )
8051
+ ] }),
8052
+ /* @__PURE__ */ jsxRuntime.jsx(
8053
+ "label",
8054
+ {
8055
+ htmlFor: option.value,
8056
+ className: cn(
8057
+ checkboxLabelClassName,
8058
+ optionDisabled && "cursor-not-allowed opacity-60",
8059
+ labelClassName
8060
+ ),
8061
+ children: option.label
8062
+ }
8063
+ )
8064
+ ]
8065
+ },
8066
+ option.value
8067
+ );
8068
+ })
8069
+ },
8070
+ `${multiField.name}-column-${columnIndex}`
8071
+ )) }) : null,
8053
8072
  /* @__PURE__ */ jsxRuntime.jsx(
8054
8073
  InputResponse,
8055
8074
  {
@@ -8445,6 +8464,7 @@ function MultiImageInput({
8445
8464
  );
8446
8465
  const [imageUrls, setImageUrls] = React26.useState(fieldImageUrls);
8447
8466
  const imageInputRef = React26.useRef(null);
8467
+ const replaceInputRefs = React26.useRef({});
8448
8468
  const [draggedIndex, setDraggedIndex] = React26.useState(null);
8449
8469
  const [replacingIndex, setReplacingIndex] = React26.useState(null);
8450
8470
  const isOrganizerBusy = replacingIndex !== null;
@@ -8538,6 +8558,9 @@ function MultiImageInput({
8538
8558
  moveImage(draggedIndex, index3);
8539
8559
  setDraggedIndex(null);
8540
8560
  };
8561
+ const openReplacePicker = (index3) => {
8562
+ replaceInputRefs.current[index3]?.click();
8563
+ };
8541
8564
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8542
8565
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row flex-wrap gap-5 w-full", children: [
8543
8566
  imageUrls.map((url, index3) => {
@@ -8564,65 +8587,74 @@ function MultiImageInput({
8564
8587
  ] }),
8565
8588
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute right-2 top-2 flex gap-1", children: [
8566
8589
  /* @__PURE__ */ jsxRuntime.jsx(
8567
- "button",
8590
+ Button_web_default,
8568
8591
  {
8569
- type: "button",
8570
8592
  title: "Move image left",
8571
- "aria-label": "Move image left",
8593
+ accessibilityLabel: "Move image left",
8572
8594
  disabled: index3 === 0 || isOrganizerBusy,
8573
- onClick: () => moveImage(index3, index3 - 1),
8574
- className: "inline-flex h-8 w-8 items-center justify-center rounded bg-black/60 text-xl text-white transition-colors hover:bg-black/80 disabled:cursor-not-allowed disabled:opacity-40",
8575
- children: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdKeyboardArrowLeft, {})
8595
+ glow: false,
8596
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdKeyboardArrowLeft, {}),
8597
+ onPress: () => moveImage(index3, index3 - 1),
8598
+ size: "xs",
8599
+ className: "h-8 w-8 bg-black/60 p-0 text-xl text-white hover:bg-black/80 disabled:opacity-40"
8576
8600
  }
8577
8601
  ),
8578
8602
  /* @__PURE__ */ jsxRuntime.jsx(
8579
- "button",
8603
+ Button_web_default,
8580
8604
  {
8581
- type: "button",
8582
8605
  title: "Move image right",
8583
- "aria-label": "Move image right",
8606
+ accessibilityLabel: "Move image right",
8584
8607
  disabled: index3 === imageUrls.length - 1 || isOrganizerBusy,
8585
- onClick: () => moveImage(index3, index3 + 1),
8586
- className: "inline-flex h-8 w-8 items-center justify-center rounded bg-black/60 text-xl text-white transition-colors hover:bg-black/80 disabled:cursor-not-allowed disabled:opacity-40",
8587
- children: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdKeyboardArrowRight, {})
8608
+ glow: false,
8609
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdKeyboardArrowRight, {}),
8610
+ onPress: () => moveImage(index3, index3 + 1),
8611
+ size: "xs",
8612
+ className: "h-8 w-8 bg-black/60 p-0 text-xl text-white hover:bg-black/80 disabled:opacity-40"
8588
8613
  }
8589
8614
  )
8590
8615
  ] }),
8591
8616
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2", children: [
8592
- /* @__PURE__ */ jsxRuntime.jsxs(
8593
- "label",
8617
+ /* @__PURE__ */ jsxRuntime.jsx(
8618
+ "input",
8594
8619
  {
8620
+ ref: (input) => {
8621
+ replaceInputRefs.current[index3] = input;
8622
+ },
8623
+ type: "file",
8624
+ className: "hidden",
8625
+ accept: "image/*",
8626
+ disabled: isOrganizerBusy,
8627
+ onChange: (event) => void handleReplaceImage(index3, event)
8628
+ }
8629
+ ),
8630
+ /* @__PURE__ */ jsxRuntime.jsx(
8631
+ Button_web_default,
8632
+ {
8633
+ block: true,
8634
+ appearance: "solid",
8595
8635
  title: "Change image",
8596
- className: classNames73__default.default(
8597
- "inline-flex h-9 flex-1 items-center justify-center gap-2 rounded bg-green-600 px-3 text-sm font-semibold text-white transition-colors",
8598
- isOrganizerBusy ? "pointer-events-none cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-green-700"
8599
- ),
8600
- children: [
8601
- /* @__PURE__ */ jsxRuntime.jsx(
8602
- "input",
8603
- {
8604
- type: "file",
8605
- className: "hidden",
8606
- accept: "image/*",
8607
- disabled: isOrganizerBusy,
8608
- onChange: (event) => void handleReplaceImage(index3, event)
8609
- }
8610
- ),
8611
- /* @__PURE__ */ jsxRuntime.jsx(index_js.MdUpload, {}),
8612
- "Change"
8613
- ]
8636
+ accessibilityLabel: "Change image",
8637
+ disabled: isOrganizerBusy,
8638
+ glow: false,
8639
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdUpload, {}),
8640
+ onPress: () => openReplacePicker(index3),
8641
+ size: "sm",
8642
+ text: "Change",
8643
+ variant: "success"
8614
8644
  }
8615
8645
  ),
8616
8646
  /* @__PURE__ */ jsxRuntime.jsx(
8617
- "button",
8647
+ Button_web_default,
8618
8648
  {
8619
- type: "button",
8649
+ appearance: "solid",
8620
8650
  title: "Delete image",
8621
- "aria-label": "Delete image",
8651
+ accessibilityLabel: "Delete image",
8622
8652
  disabled: isOrganizerBusy,
8623
- onClick: () => removeImage(index3),
8624
- className: "inline-flex h-9 w-10 items-center justify-center rounded bg-red-600 text-xl text-white transition-colors hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-50",
8625
- children: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdOutlineDelete, {})
8653
+ glow: false,
8654
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index_js.MdOutlineDelete, {}),
8655
+ onPress: () => removeImage(index3),
8656
+ size: "sm",
8657
+ variant: "danger"
8626
8658
  }
8627
8659
  )
8628
8660
  ] }),