@oliasoft-open-source/react-ui-library 5.11.1 → 5.11.2-beta-1
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 +7 -0
- package/dist/index.js +61 -59
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1236,6 +1236,13 @@ 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
|
+
};
|
|
1239
1246
|
placeholder?: string;
|
|
1240
1247
|
value?: string;
|
|
1241
1248
|
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, MarkdownExtension, OrderedListExtension, PlaceholderExtension } from "remirror/extensions";
|
|
28
|
+
import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, ListItemExtension, 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: Rd } = 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(Rd),
|
|
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, options: n = {} }) => {
|
|
5908
|
+
let { focus: r, toggleBold: i, toggleBulletList: a, toggleCode: o, toggleItalic: s, toggleOrderedList: c } = useCommands(), l = useActive(), { disableBold: u, disableItalic: d, disableCode: f, disableBulletList: p, disableOrderedList: m } = n, h = [
|
|
5909
|
+
!u && {
|
|
5910
5910
|
icon: RichTextIcon.BOLD,
|
|
5911
|
-
onClick:
|
|
5912
|
-
active:
|
|
5911
|
+
onClick: i,
|
|
5912
|
+
active: l.bold()
|
|
5913
5913
|
},
|
|
5914
|
-
{
|
|
5914
|
+
!d && {
|
|
5915
5915
|
icon: RichTextIcon.ITALIC,
|
|
5916
|
-
onClick:
|
|
5917
|
-
active:
|
|
5916
|
+
onClick: s,
|
|
5917
|
+
active: l.italic()
|
|
5918
5918
|
},
|
|
5919
|
-
{
|
|
5919
|
+
!f && {
|
|
5920
5920
|
icon: RichTextIcon.CODE,
|
|
5921
|
-
onClick:
|
|
5922
|
-
active:
|
|
5921
|
+
onClick: o,
|
|
5922
|
+
active: l.code()
|
|
5923
5923
|
},
|
|
5924
|
-
{
|
|
5924
|
+
!p && {
|
|
5925
5925
|
icon: RichTextIcon.UL,
|
|
5926
|
-
onClick:
|
|
5927
|
-
active:
|
|
5926
|
+
onClick: a,
|
|
5927
|
+
active: l.bulletList()
|
|
5928
5928
|
},
|
|
5929
|
-
{
|
|
5929
|
+
!m && {
|
|
5930
5930
|
icon: RichTextIcon.OL,
|
|
5931
|
-
onClick:
|
|
5932
|
-
active:
|
|
5931
|
+
onClick: c,
|
|
5932
|
+
active: l.orderedList()
|
|
5933
5933
|
}
|
|
5934
|
-
];
|
|
5934
|
+
].filter((e) => !!e);
|
|
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: h.map((t, n) => /* @__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(), r();
|
|
5947
5947
|
},
|
|
5948
5948
|
active: t.active,
|
|
5949
5949
|
disabled: e
|
|
5950
|
-
},
|
|
5950
|
+
}, n))
|
|
5951
5951
|
}), t]
|
|
5952
5952
|
});
|
|
5953
5953
|
};
|
|
@@ -5961,35 +5961,37 @@ 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, options: a = {} }, o) => {
|
|
5965
|
+
let c = useContext(DisabledContext), u = r || c, { disableBold: d, disableItalic: f, disableCode: p, disableBulletList: m, disableOrderedList: h } = a, { manager: g, state: _, setState: v, getContext: y } = useRemirror({
|
|
5966
5966
|
extensions: () => [
|
|
5967
|
-
new BoldExtension({}),
|
|
5968
|
-
new BulletListExtension({}),
|
|
5969
|
-
new CodeExtension(),
|
|
5970
|
-
new ItalicExtension(),
|
|
5967
|
+
!d && new BoldExtension({}),
|
|
5968
|
+
!m && new BulletListExtension({}),
|
|
5969
|
+
!p && new CodeExtension(),
|
|
5970
|
+
!f && new ItalicExtension(),
|
|
5971
5971
|
new MarkdownExtension({}),
|
|
5972
|
-
new OrderedListExtension(),
|
|
5973
|
-
new PlaceholderExtension({ placeholder: e })
|
|
5974
|
-
|
|
5972
|
+
!h && new OrderedListExtension(),
|
|
5973
|
+
new PlaceholderExtension({ placeholder: e }),
|
|
5974
|
+
new ListItemExtension({})
|
|
5975
|
+
].filter((e) => !!e),
|
|
5975
5976
|
content: n,
|
|
5976
5977
|
selection: "start",
|
|
5977
5978
|
stringHandler: "markdown"
|
|
5978
5979
|
});
|
|
5979
|
-
return useImperativeHandle(
|
|
5980
|
+
return useImperativeHandle(o, () => y(), [y]), /* @__PURE__ */ jsx("div", {
|
|
5980
5981
|
className: rich_text_input_module_default.richTextInput,
|
|
5981
5982
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
5982
|
-
manager:
|
|
5983
|
-
state:
|
|
5983
|
+
manager: g,
|
|
5984
|
+
state: _,
|
|
5984
5985
|
placeholder: e,
|
|
5985
5986
|
onChange: ({ helpers: e, state: n }) => {
|
|
5986
5987
|
let r = e.getMarkdown(n);
|
|
5987
|
-
t && t(r),
|
|
5988
|
+
t && t(r), v(n);
|
|
5988
5989
|
},
|
|
5989
|
-
editable: !
|
|
5990
|
+
editable: !u,
|
|
5990
5991
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
5991
|
-
disabled:
|
|
5992
|
-
toolbarComponent: i
|
|
5992
|
+
disabled: u,
|
|
5993
|
+
toolbarComponent: i,
|
|
5994
|
+
options: a
|
|
5993
5995
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
5994
5996
|
})
|
|
5995
5997
|
});
|
|
@@ -6733,7 +6735,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6733
6735
|
} : {
|
|
6734
6736
|
value: G,
|
|
6735
6737
|
unit: U
|
|
6736
|
-
}),
|
|
6738
|
+
}), Rd = k || K?.value === void 0, [J, zd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Bd = !!(O || n), Y = C && C.find((e) => {
|
|
6737
6739
|
if (!e?.value) return;
|
|
6738
6740
|
if (E) return E === e.valueKey;
|
|
6739
6741
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6742,7 +6744,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6742
6744
|
toUnit: t
|
|
6743
6745
|
});
|
|
6744
6746
|
return withUnit(n, t) === e.value;
|
|
6745
|
-
}),
|
|
6747
|
+
}), Vd = () => {
|
|
6746
6748
|
let e = l ?? "", t = K.unit;
|
|
6747
6749
|
if (checkConversion({
|
|
6748
6750
|
value: e,
|
|
@@ -6756,7 +6758,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6756
6758
|
return null;
|
|
6757
6759
|
}
|
|
6758
6760
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6759
|
-
},
|
|
6761
|
+
}, Hd = (t) => {
|
|
6760
6762
|
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;
|
|
6761
6763
|
h({ target: {
|
|
6762
6764
|
value: s,
|
|
@@ -6769,7 +6771,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6769
6771
|
}), R(() => {
|
|
6770
6772
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6771
6773
|
});
|
|
6772
|
-
},
|
|
6774
|
+
}, Ud = (e, t) => {
|
|
6773
6775
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6774
6776
|
value: e,
|
|
6775
6777
|
unit: t
|
|
@@ -6800,7 +6802,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6800
6802
|
e !== void 0 && q({
|
|
6801
6803
|
value: e,
|
|
6802
6804
|
unit: t
|
|
6803
|
-
}), C &&
|
|
6805
|
+
}), C && zd(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6804
6806
|
}
|
|
6805
6807
|
}, [
|
|
6806
6808
|
U,
|
|
@@ -6808,7 +6810,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6808
6810
|
i,
|
|
6809
6811
|
T
|
|
6810
6812
|
]);
|
|
6811
|
-
let X =
|
|
6813
|
+
let X = Vd(), Z = label(K.unit) || K.unit || "", Wd = p || !X || X && X.length === 1, Q = getStringName(e), $, Gd = (t) => {
|
|
6812
6814
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6813
6815
|
if (checkConversion({
|
|
6814
6816
|
value: r,
|
|
@@ -6828,7 +6830,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6828
6830
|
type: MenuType.OPTION,
|
|
6829
6831
|
inline: !0,
|
|
6830
6832
|
onClick: () => {
|
|
6831
|
-
validateNumber(i).valid && !n && (
|
|
6833
|
+
validateNumber(i).valid && !n && (zd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6832
6834
|
value: r,
|
|
6833
6835
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6834
6836
|
predefinedSelected: !0,
|
|
@@ -6855,10 +6857,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6855
6857
|
label: "Custom",
|
|
6856
6858
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6857
6859
|
}], C?.length) {
|
|
6858
|
-
let e = C.map(
|
|
6860
|
+
let e = C.map(Gd);
|
|
6859
6861
|
$ = [...$, ...e];
|
|
6860
6862
|
}
|
|
6861
|
-
let
|
|
6863
|
+
let Kd = (e) => {
|
|
6862
6864
|
if (isValueWithUnit(e)) {
|
|
6863
6865
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6864
6866
|
value: e,
|
|
@@ -6870,7 +6872,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6870
6872
|
return n;
|
|
6871
6873
|
}
|
|
6872
6874
|
return e;
|
|
6873
|
-
},
|
|
6875
|
+
}, qd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Jd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6874
6876
|
return /* @__PURE__ */ jsx("div", {
|
|
6875
6877
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6876
6878
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6902,31 +6904,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6902
6904
|
name: Q,
|
|
6903
6905
|
testId: x,
|
|
6904
6906
|
disabled: n,
|
|
6905
|
-
placeholder:
|
|
6907
|
+
placeholder: Kd(t),
|
|
6906
6908
|
value: K.value,
|
|
6907
|
-
onChange:
|
|
6909
|
+
onChange: Hd,
|
|
6908
6910
|
onFocus: v,
|
|
6909
6911
|
error: i === null ? void 0 : i,
|
|
6910
6912
|
warning: S === null ? void 0 : S,
|
|
6911
6913
|
left: a,
|
|
6912
|
-
allowEmpty:
|
|
6914
|
+
allowEmpty: Rd,
|
|
6913
6915
|
validationCallback: (e, t) => D(Q, t),
|
|
6914
6916
|
enableCosmeticRounding: j,
|
|
6915
6917
|
enableDisplayRounding: M,
|
|
6916
6918
|
roundDisplayValue: N,
|
|
6917
|
-
groupOrder:
|
|
6918
|
-
disableInternalErrorValidationMessages:
|
|
6919
|
+
groupOrder: qd,
|
|
6920
|
+
disableInternalErrorValidationMessages: Bd,
|
|
6919
6921
|
small: o,
|
|
6920
6922
|
selectOnFocus: P,
|
|
6921
6923
|
tooltip: I
|
|
6922
6924
|
}, Q)
|
|
6923
6925
|
}),
|
|
6924
|
-
Z && (
|
|
6925
|
-
groupOrder:
|
|
6926
|
+
Z && (Wd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6927
|
+
groupOrder: Jd,
|
|
6926
6928
|
small: o,
|
|
6927
6929
|
children: Z
|
|
6928
6930
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6929
|
-
groupOrder:
|
|
6931
|
+
groupOrder: Jd,
|
|
6930
6932
|
maxHeight: 380,
|
|
6931
6933
|
disabled: r,
|
|
6932
6934
|
testId: x && `${x}-menu`,
|
|
@@ -6942,7 +6944,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6942
6944
|
label: j ? safeRoundNumbers(i) : i,
|
|
6943
6945
|
inline: !0,
|
|
6944
6946
|
onClick: (n) => {
|
|
6945
|
-
n.stopPropagation(),
|
|
6947
|
+
n.stopPropagation(), Ud(e, t);
|
|
6946
6948
|
},
|
|
6947
6949
|
description: r,
|
|
6948
6950
|
selected: r === Z,
|
package/package.json
CHANGED