@oliasoft-open-source/react-ui-library 5.11.2-beta-1 → 5.11.2-beta-2
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.ts +0 -7
- package/dist/index.js +59 -61
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1236,13 +1236,6 @@ declare interface IReorderData {
|
|
|
1236
1236
|
export declare interface IRichTextInputProps {
|
|
1237
1237
|
disabled?: boolean;
|
|
1238
1238
|
onChange?: (markdown: string) => void;
|
|
1239
|
-
options?: {
|
|
1240
|
-
disableBold?: boolean;
|
|
1241
|
-
disableItalic?: boolean;
|
|
1242
|
-
disableCode?: boolean;
|
|
1243
|
-
disableBulletList?: boolean;
|
|
1244
|
-
disableOrderedList?: boolean;
|
|
1245
|
-
};
|
|
1246
1239
|
placeholder?: string;
|
|
1247
1240
|
value?: string;
|
|
1248
1241
|
toolbarComponent?: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { SimplifyAP } from "simplify-ts";
|
|
|
25
25
|
import Papa from "papaparse";
|
|
26
26
|
import { Slide, ToastContainer as Toaster, toast as toast$1 } from "react-toastify";
|
|
27
27
|
import { isNullOrUndefined } from "remirror";
|
|
28
|
-
import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension,
|
|
28
|
+
import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, MarkdownExtension, OrderedListExtension, PlaceholderExtension } from "remirror/extensions";
|
|
29
29
|
import { EditorComponent, Remirror, useActive, useCommands, useRemirror } from "@remirror/react";
|
|
30
30
|
import "remirror/styles/all.css";
|
|
31
31
|
import { DndProvider } from "react-dnd";
|
|
@@ -2743,7 +2743,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2743
2743
|
layerFocus: initialLayerFocus(e, C ?? 0),
|
|
2744
2744
|
triggerFocus: initialTriggerFocus,
|
|
2745
2745
|
isLayerOpen: !1
|
|
2746
|
-
})), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds:
|
|
2746
|
+
})), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: Ld } = useCustomSelectLogic({
|
|
2747
2747
|
...e,
|
|
2748
2748
|
state: N,
|
|
2749
2749
|
dispatch: P,
|
|
@@ -2811,7 +2811,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2811
2811
|
closeLayer: () => {
|
|
2812
2812
|
b && G();
|
|
2813
2813
|
},
|
|
2814
|
-
width: q(
|
|
2814
|
+
width: q(Ld),
|
|
2815
2815
|
small: d,
|
|
2816
2816
|
focusedOptionIndex: N.layerFocus.current,
|
|
2817
2817
|
firstSelectedOptionIndex: C ?? 0,
|
|
@@ -5904,50 +5904,50 @@ var rich_text_toolbar_module_default = {
|
|
|
5904
5904
|
let RichTextIcon = /* @__PURE__ */ function(e) {
|
|
5905
5905
|
return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e;
|
|
5906
5906
|
}({});
|
|
5907
|
-
const RichTextToolbar = ({ disabled: e = !1, toolbarComponent: t = null
|
|
5908
|
-
let { focus:
|
|
5909
|
-
|
|
5907
|
+
const RichTextToolbar = ({ disabled: e = !1, toolbarComponent: t = null }) => {
|
|
5908
|
+
let { focus: n, toggleBold: r, toggleBulletList: i, toggleCode: a, toggleItalic: o, toggleOrderedList: s } = useCommands(), c = useActive(), l = [
|
|
5909
|
+
{
|
|
5910
5910
|
icon: RichTextIcon.BOLD,
|
|
5911
|
-
onClick:
|
|
5912
|
-
active:
|
|
5911
|
+
onClick: r,
|
|
5912
|
+
active: c.bold()
|
|
5913
5913
|
},
|
|
5914
|
-
|
|
5914
|
+
{
|
|
5915
5915
|
icon: RichTextIcon.ITALIC,
|
|
5916
|
-
onClick:
|
|
5917
|
-
active:
|
|
5916
|
+
onClick: o,
|
|
5917
|
+
active: c.italic()
|
|
5918
5918
|
},
|
|
5919
|
-
|
|
5919
|
+
{
|
|
5920
5920
|
icon: RichTextIcon.CODE,
|
|
5921
|
-
onClick:
|
|
5922
|
-
active:
|
|
5921
|
+
onClick: a,
|
|
5922
|
+
active: c.code()
|
|
5923
5923
|
},
|
|
5924
|
-
|
|
5924
|
+
{
|
|
5925
5925
|
icon: RichTextIcon.UL,
|
|
5926
|
-
onClick:
|
|
5927
|
-
active:
|
|
5926
|
+
onClick: i,
|
|
5927
|
+
active: c.bulletList()
|
|
5928
5928
|
},
|
|
5929
|
-
|
|
5929
|
+
{
|
|
5930
5930
|
icon: RichTextIcon.OL,
|
|
5931
|
-
onClick:
|
|
5932
|
-
active:
|
|
5931
|
+
onClick: s,
|
|
5932
|
+
active: c.orderedList()
|
|
5933
5933
|
}
|
|
5934
|
-
]
|
|
5934
|
+
];
|
|
5935
5935
|
return /* @__PURE__ */ jsxs("div", {
|
|
5936
5936
|
className: rich_text_toolbar_module_default.richTextToolbarContainer,
|
|
5937
5937
|
children: [/* @__PURE__ */ jsx("div", {
|
|
5938
5938
|
className: rich_text_toolbar_module_default.richTextToolbar,
|
|
5939
|
-
children:
|
|
5939
|
+
children: l.map((t, r) => /* @__PURE__ */ jsx(Button, {
|
|
5940
5940
|
small: !0,
|
|
5941
5941
|
round: !0,
|
|
5942
5942
|
basic: !0,
|
|
5943
5943
|
icon: t.icon,
|
|
5944
5944
|
colored: Color.MUTED,
|
|
5945
5945
|
onClick: () => {
|
|
5946
|
-
t.onClick(),
|
|
5946
|
+
t.onClick(), n();
|
|
5947
5947
|
},
|
|
5948
5948
|
active: t.active,
|
|
5949
5949
|
disabled: e
|
|
5950
|
-
},
|
|
5950
|
+
}, r))
|
|
5951
5951
|
}), t]
|
|
5952
5952
|
});
|
|
5953
5953
|
};
|
|
@@ -5961,37 +5961,35 @@ var rich_text_input_module_default = {
|
|
|
5961
5961
|
hideScrollbars: "_hideScrollbars_1fb4l_67",
|
|
5962
5962
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
5963
5963
|
};
|
|
5964
|
-
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i
|
|
5965
|
-
let
|
|
5964
|
+
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
5965
|
+
let o = useContext(DisabledContext), c = r || o, { manager: u, state: d, setState: f, getContext: p } = useRemirror({
|
|
5966
5966
|
extensions: () => [
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5967
|
+
new BoldExtension({}),
|
|
5968
|
+
new BulletListExtension({}),
|
|
5969
|
+
new CodeExtension(),
|
|
5970
|
+
new ItalicExtension(),
|
|
5971
5971
|
new MarkdownExtension({}),
|
|
5972
|
-
|
|
5973
|
-
new PlaceholderExtension({ placeholder: e })
|
|
5974
|
-
|
|
5975
|
-
].filter((e) => !!e),
|
|
5972
|
+
new OrderedListExtension(),
|
|
5973
|
+
new PlaceholderExtension({ placeholder: e })
|
|
5974
|
+
],
|
|
5976
5975
|
content: n,
|
|
5977
5976
|
selection: "start",
|
|
5978
5977
|
stringHandler: "markdown"
|
|
5979
5978
|
});
|
|
5980
|
-
return useImperativeHandle(
|
|
5979
|
+
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
5981
5980
|
className: rich_text_input_module_default.richTextInput,
|
|
5982
5981
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
5983
|
-
manager:
|
|
5984
|
-
state:
|
|
5982
|
+
manager: u,
|
|
5983
|
+
state: d,
|
|
5985
5984
|
placeholder: e,
|
|
5986
5985
|
onChange: ({ helpers: e, state: n }) => {
|
|
5987
5986
|
let r = e.getMarkdown(n);
|
|
5988
|
-
t && t(r),
|
|
5987
|
+
t && t(r), f(n);
|
|
5989
5988
|
},
|
|
5990
|
-
editable: !
|
|
5989
|
+
editable: !c,
|
|
5991
5990
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
5992
|
-
disabled:
|
|
5993
|
-
toolbarComponent: i
|
|
5994
|
-
options: a
|
|
5991
|
+
disabled: c,
|
|
5992
|
+
toolbarComponent: i
|
|
5995
5993
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
5996
5994
|
})
|
|
5997
5995
|
});
|
|
@@ -6735,7 +6733,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6735
6733
|
} : {
|
|
6736
6734
|
value: G,
|
|
6737
6735
|
unit: U
|
|
6738
|
-
}),
|
|
6736
|
+
}), Ld = k || K?.value === void 0, [J, Rd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), zd = !!(O || n), Y = C && C.find((e) => {
|
|
6739
6737
|
if (!e?.value) return;
|
|
6740
6738
|
if (E) return E === e.valueKey;
|
|
6741
6739
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6744,7 +6742,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6744
6742
|
toUnit: t
|
|
6745
6743
|
});
|
|
6746
6744
|
return withUnit(n, t) === e.value;
|
|
6747
|
-
}),
|
|
6745
|
+
}), Bd = () => {
|
|
6748
6746
|
let e = l ?? "", t = K.unit;
|
|
6749
6747
|
if (checkConversion({
|
|
6750
6748
|
value: e,
|
|
@@ -6758,7 +6756,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6758
6756
|
return null;
|
|
6759
6757
|
}
|
|
6760
6758
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6761
|
-
},
|
|
6759
|
+
}, Vd = (t) => {
|
|
6762
6760
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
|
|
6763
6761
|
h({ target: {
|
|
6764
6762
|
value: s,
|
|
@@ -6771,7 +6769,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6771
6769
|
}), R(() => {
|
|
6772
6770
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6773
6771
|
});
|
|
6774
|
-
},
|
|
6772
|
+
}, Hd = (e, t) => {
|
|
6775
6773
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6776
6774
|
value: e,
|
|
6777
6775
|
unit: t
|
|
@@ -6802,7 +6800,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6802
6800
|
e !== void 0 && q({
|
|
6803
6801
|
value: e,
|
|
6804
6802
|
unit: t
|
|
6805
|
-
}), C &&
|
|
6803
|
+
}), Rd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6806
6804
|
}
|
|
6807
6805
|
}, [
|
|
6808
6806
|
U,
|
|
@@ -6810,7 +6808,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6810
6808
|
i,
|
|
6811
6809
|
T
|
|
6812
6810
|
]);
|
|
6813
|
-
let X =
|
|
6811
|
+
let X = Bd(), Z = label(K.unit) || K.unit || "", Ud = p || !X || X && X.length === 1, Q = getStringName(e), $, Wd = (t) => {
|
|
6814
6812
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6815
6813
|
if (checkConversion({
|
|
6816
6814
|
value: r,
|
|
@@ -6830,7 +6828,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6830
6828
|
type: MenuType.OPTION,
|
|
6831
6829
|
inline: !0,
|
|
6832
6830
|
onClick: () => {
|
|
6833
|
-
validateNumber(i).valid && !n && (
|
|
6831
|
+
validateNumber(i).valid && !n && (Rd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6834
6832
|
value: r,
|
|
6835
6833
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6836
6834
|
predefinedSelected: !0,
|
|
@@ -6857,10 +6855,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6857
6855
|
label: "Custom",
|
|
6858
6856
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6859
6857
|
}], C?.length) {
|
|
6860
|
-
let e = C.map(
|
|
6858
|
+
let e = C.map(Wd);
|
|
6861
6859
|
$ = [...$, ...e];
|
|
6862
6860
|
}
|
|
6863
|
-
let
|
|
6861
|
+
let Gd = (e) => {
|
|
6864
6862
|
if (isValueWithUnit(e)) {
|
|
6865
6863
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6866
6864
|
value: e,
|
|
@@ -6872,7 +6870,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6872
6870
|
return n;
|
|
6873
6871
|
}
|
|
6874
6872
|
return e;
|
|
6875
|
-
},
|
|
6873
|
+
}, Kd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, qd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6876
6874
|
return /* @__PURE__ */ jsx("div", {
|
|
6877
6875
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6878
6876
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6904,31 +6902,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6904
6902
|
name: Q,
|
|
6905
6903
|
testId: x,
|
|
6906
6904
|
disabled: n,
|
|
6907
|
-
placeholder:
|
|
6905
|
+
placeholder: Gd(t),
|
|
6908
6906
|
value: K.value,
|
|
6909
|
-
onChange:
|
|
6907
|
+
onChange: Vd,
|
|
6910
6908
|
onFocus: v,
|
|
6911
6909
|
error: i === null ? void 0 : i,
|
|
6912
6910
|
warning: S === null ? void 0 : S,
|
|
6913
6911
|
left: a,
|
|
6914
|
-
allowEmpty:
|
|
6912
|
+
allowEmpty: Ld,
|
|
6915
6913
|
validationCallback: (e, t) => D(Q, t),
|
|
6916
6914
|
enableCosmeticRounding: j,
|
|
6917
6915
|
enableDisplayRounding: M,
|
|
6918
6916
|
roundDisplayValue: N,
|
|
6919
|
-
groupOrder:
|
|
6920
|
-
disableInternalErrorValidationMessages:
|
|
6917
|
+
groupOrder: Kd,
|
|
6918
|
+
disableInternalErrorValidationMessages: zd,
|
|
6921
6919
|
small: o,
|
|
6922
6920
|
selectOnFocus: P,
|
|
6923
6921
|
tooltip: I
|
|
6924
6922
|
}, Q)
|
|
6925
6923
|
}),
|
|
6926
|
-
Z && (
|
|
6927
|
-
groupOrder:
|
|
6924
|
+
Z && (Ud || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6925
|
+
groupOrder: qd,
|
|
6928
6926
|
small: o,
|
|
6929
6927
|
children: Z
|
|
6930
6928
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6931
|
-
groupOrder:
|
|
6929
|
+
groupOrder: qd,
|
|
6932
6930
|
maxHeight: 380,
|
|
6933
6931
|
disabled: r,
|
|
6934
6932
|
testId: x && `${x}-menu`,
|
|
@@ -6944,7 +6942,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6944
6942
|
label: j ? safeRoundNumbers(i) : i,
|
|
6945
6943
|
inline: !0,
|
|
6946
6944
|
onClick: (n) => {
|
|
6947
|
-
n.stopPropagation(),
|
|
6945
|
+
n.stopPropagation(), Hd(e, t);
|
|
6948
6946
|
},
|
|
6949
6947
|
description: r,
|
|
6950
6948
|
selected: r === Z,
|
package/package.json
CHANGED