@forgedevstack/bear 1.1.1 → 1.1.4
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/components/ActionIcon/ActionIcon.cjs +1 -0
- package/dist/components/ActionIcon/ActionIcon.const.cjs +1 -0
- package/dist/components/ActionIcon/ActionIcon.const.d.ts +7 -0
- package/dist/components/ActionIcon/ActionIcon.const.js +68 -0
- package/dist/components/ActionIcon/ActionIcon.d.ts +4 -0
- package/dist/components/ActionIcon/ActionIcon.js +42 -0
- package/dist/components/ActionIcon/ActionIcon.types.d.ts +11 -0
- package/dist/components/ActionIcon/index.d.ts +2 -0
- package/dist/components/Affix/Affix.cjs +1 -0
- package/dist/components/Affix/Affix.const.cjs +1 -0
- package/dist/components/Affix/Affix.const.d.ts +6 -0
- package/dist/components/Affix/Affix.const.js +9 -0
- package/dist/components/Affix/Affix.d.ts +4 -0
- package/dist/components/Affix/Affix.js +69 -0
- package/dist/components/Affix/Affix.types.d.ts +10 -0
- package/dist/components/Affix/index.d.ts +2 -0
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -0
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -0
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +5 -0
- package/dist/components/AlertDialog/AlertDialog.const.js +8 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +4 -0
- package/dist/components/AlertDialog/AlertDialog.js +107 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +34 -0
- package/dist/components/AlertDialog/index.d.ts +3 -0
- package/dist/components/Anchor/Anchor.cjs +1 -0
- package/dist/components/Anchor/Anchor.const.cjs +1 -0
- package/dist/components/Anchor/Anchor.const.d.ts +9 -0
- package/dist/components/Anchor/Anchor.const.js +11 -0
- package/dist/components/Anchor/Anchor.d.ts +4 -0
- package/dist/components/Anchor/Anchor.js +91 -0
- package/dist/components/Anchor/Anchor.types.d.ts +16 -0
- package/dist/components/Anchor/index.d.ts +2 -0
- package/dist/components/AspectRatio/AspectRatio.cjs +1 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +3 -0
- package/dist/components/AspectRatio/AspectRatio.js +29 -0
- package/dist/components/AspectRatio/AspectRatio.types.d.ts +9 -0
- package/dist/components/AspectRatio/index.d.ts +2 -0
- package/dist/components/Blockquote/Blockquote.cjs +1 -0
- package/dist/components/Blockquote/Blockquote.const.cjs +1 -0
- package/dist/components/Blockquote/Blockquote.const.d.ts +5 -0
- package/dist/components/Blockquote/Blockquote.const.js +19 -0
- package/dist/components/Blockquote/Blockquote.d.ts +4 -0
- package/dist/components/Blockquote/Blockquote.js +56 -0
- package/dist/components/Blockquote/Blockquote.types.d.ts +9 -0
- package/dist/components/Blockquote/index.d.ts +2 -0
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +10 -3
- package/dist/components/Button/Button.js +92 -84
- package/dist/components/Button/Button.types.d.ts +2 -0
- package/dist/components/CheckboxCard/CheckboxCard.cjs +1 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.cjs +1 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.d.ts +7 -0
- package/dist/components/CheckboxCard/CheckboxCard.const.js +22 -0
- package/dist/components/CheckboxCard/CheckboxCard.d.ts +5 -0
- package/dist/components/CheckboxCard/CheckboxCard.js +132 -0
- package/dist/components/CheckboxCard/CheckboxCard.types.d.ts +21 -0
- package/dist/components/CheckboxCard/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +26 -0
- package/dist/components/ColorPicker/ColorPicker.const.js +38 -0
- package/dist/components/ColorPicker/ColorPicker.js +61 -78
- package/dist/components/ColorSwatch/ColorSwatch.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.d.ts +16 -0
- package/dist/components/ColorSwatch/ColorSwatch.const.js +19 -0
- package/dist/components/ColorSwatch/ColorSwatch.d.ts +5 -0
- package/dist/components/ColorSwatch/ColorSwatch.js +92 -0
- package/dist/components/ColorSwatch/ColorSwatch.types.d.ts +23 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.cjs +1 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.d.ts +6 -0
- package/dist/components/ColorSwatch/ColorSwatch.utils.js +14 -0
- package/dist/components/ColorSwatch/index.d.ts +2 -0
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.const.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.const.d.ts +9 -0
- package/dist/components/ContextMenu/ContextMenu.const.js +12 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +4 -0
- package/dist/components/ContextMenu/ContextMenu.js +64 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +23 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.d.ts +27 -0
- package/dist/components/DateRangePicker/DateRangePicker.const.js +74 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +115 -0
- package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +26 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.cjs +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.utils.js +22 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/Descriptions/Descriptions.cjs +1 -0
- package/dist/components/Descriptions/Descriptions.const.cjs +1 -0
- package/dist/components/Descriptions/Descriptions.const.d.ts +24 -0
- package/dist/components/Descriptions/Descriptions.const.js +27 -0
- package/dist/components/Descriptions/Descriptions.d.ts +4 -0
- package/dist/components/Descriptions/Descriptions.js +65 -0
- package/dist/components/Descriptions/Descriptions.types.d.ts +16 -0
- package/dist/components/Descriptions/index.d.ts +2 -0
- package/dist/components/Fieldset/Fieldset.cjs +1 -0
- package/dist/components/Fieldset/Fieldset.const.cjs +1 -0
- package/dist/components/Fieldset/Fieldset.const.d.ts +5 -0
- package/dist/components/Fieldset/Fieldset.const.js +16 -0
- package/dist/components/Fieldset/Fieldset.d.ts +4 -0
- package/dist/components/Fieldset/Fieldset.js +47 -0
- package/dist/components/Fieldset/Fieldset.types.d.ts +10 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/FormField/FormField.cjs +1 -0
- package/dist/components/FormField/FormField.const.cjs +1 -0
- package/dist/components/FormField/FormField.const.d.ts +20 -0
- package/dist/components/FormField/FormField.const.js +23 -0
- package/dist/components/FormField/FormField.d.ts +3 -0
- package/dist/components/FormField/FormField.js +127 -0
- package/dist/components/FormField/FormField.types.d.ts +23 -0
- package/dist/components/FormField/index.d.ts +2 -0
- package/dist/components/ImageGallery/ImageGallery.cjs +1 -0
- package/dist/components/ImageGallery/ImageGallery.const.cjs +1 -0
- package/dist/components/ImageGallery/ImageGallery.const.d.ts +13 -0
- package/dist/components/ImageGallery/ImageGallery.const.js +16 -0
- package/dist/components/ImageGallery/ImageGallery.d.ts +4 -0
- package/dist/components/ImageGallery/ImageGallery.js +61 -0
- package/dist/components/ImageGallery/ImageGallery.types.d.ts +22 -0
- package/dist/components/ImageGallery/index.d.ts +2 -0
- package/dist/components/Indicator/Indicator.cjs +1 -0
- package/dist/components/Indicator/Indicator.const.cjs +1 -0
- package/dist/components/Indicator/Indicator.const.d.ts +15 -0
- package/dist/components/Indicator/Indicator.const.js +26 -0
- package/dist/components/Indicator/Indicator.d.ts +4 -0
- package/dist/components/Indicator/Indicator.js +56 -0
- package/dist/components/Indicator/Indicator.types.d.ts +16 -0
- package/dist/components/Indicator/index.d.ts +2 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.d.ts +7 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +10 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts +4 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.types.d.ts +13 -0
- package/dist/components/InfiniteScroll/index.d.ts +2 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +114 -44
- package/dist/components/Input/Input.types.d.ts +20 -0
- package/dist/components/Input/Input.utils.cjs +1 -0
- package/dist/components/Input/Input.utils.d.ts +2 -0
- package/dist/components/Input/Input.utils.js +15 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.cjs +1 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.d.ts +7 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.js +25 -0
- package/dist/components/Input/components/ClearIcon/index.d.ts +1 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/InputGroup/InputGroup.cjs +1 -0
- package/dist/components/InputGroup/InputGroup.d.ts +4 -0
- package/dist/components/InputGroup/InputGroup.js +63 -0
- package/dist/components/InputGroup/InputGroup.types.d.ts +23 -0
- package/dist/components/InputGroup/index.d.ts +2 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.cjs +1 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.cjs +1 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.d.ts +6 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.const.js +9 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.d.ts +4 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.js +42 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.types.d.ts +11 -0
- package/dist/components/LoadingOverlay/index.d.ts +2 -0
- package/dist/components/NumberFormatter/NumberFormatter.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.d.ts +5 -0
- package/dist/components/NumberFormatter/NumberFormatter.const.js +8 -0
- package/dist/components/NumberFormatter/NumberFormatter.d.ts +4 -0
- package/dist/components/NumberFormatter/NumberFormatter.js +53 -0
- package/dist/components/NumberFormatter/NumberFormatter.types.d.ts +20 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.cjs +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.d.ts +2 -0
- package/dist/components/NumberFormatter/NumberFormatter.utils.js +19 -0
- package/dist/components/NumberFormatter/index.d.ts +2 -0
- package/dist/components/PasswordInput/PasswordInput.cjs +1 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput/PasswordInput.js +61 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +18 -0
- package/dist/components/PasswordInput/index.d.ts +2 -0
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -0
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -0
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +13 -0
- package/dist/components/Popconfirm/Popconfirm.const.js +20 -0
- package/dist/components/Popconfirm/Popconfirm.d.ts +4 -0
- package/dist/components/Popconfirm/Popconfirm.js +65 -0
- package/dist/components/Popconfirm/Popconfirm.types.d.ts +16 -0
- package/dist/components/Popconfirm/index.d.ts +2 -0
- package/dist/components/RadioCard/RadioCard.cjs +1 -0
- package/dist/components/RadioCard/RadioCard.const.cjs +1 -0
- package/dist/components/RadioCard/RadioCard.const.d.ts +7 -0
- package/dist/components/RadioCard/RadioCard.const.js +22 -0
- package/dist/components/RadioCard/RadioCard.d.ts +5 -0
- package/dist/components/RadioCard/RadioCard.js +111 -0
- package/dist/components/RadioCard/RadioCard.types.d.ts +22 -0
- package/dist/components/RadioCard/index.d.ts +2 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.cjs +1 -1
- package/dist/components/ResizableTextarea/ResizableTextarea.js +90 -54
- package/dist/components/ResizableTextarea/ResizableTextarea.types.d.ts +10 -0
- package/dist/components/Result/Result.cjs +1 -0
- package/dist/components/Result/Result.const.cjs +1 -0
- package/dist/components/Result/Result.const.d.ts +10 -0
- package/dist/components/Result/Result.const.js +20 -0
- package/dist/components/Result/Result.d.ts +4 -0
- package/dist/components/Result/Result.icons.cjs +1 -0
- package/dist/components/Result/Result.icons.d.ts +3 -0
- package/dist/components/Result/Result.icons.js +31 -0
- package/dist/components/Result/Result.js +35 -0
- package/dist/components/Result/Result.types.d.ts +10 -0
- package/dist/components/Result/index.d.ts +2 -0
- package/dist/components/RichEditor/RichEditor.cjs +1 -1
- package/dist/components/RichEditor/RichEditor.js +186 -169
- package/dist/components/RichEditor/RichEditor.types.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.cjs +1 -0
- package/dist/components/RingProgress/RingProgress.const.cjs +1 -0
- package/dist/components/RingProgress/RingProgress.const.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.const.js +7 -0
- package/dist/components/RingProgress/RingProgress.d.ts +4 -0
- package/dist/components/RingProgress/RingProgress.js +67 -0
- package/dist/components/RingProgress/RingProgress.types.d.ts +15 -0
- package/dist/components/RingProgress/index.d.ts +2 -0
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.js +10 -11
- package/dist/components/SignPad/SignPad.d.ts +4 -6
- package/dist/components/SignPad/SignPad.js +108 -116
- package/dist/components/SignPad/SignPad.types.d.ts +2 -2
- package/dist/components/SplitButton/SplitButton.cjs +1 -0
- package/dist/components/SplitButton/SplitButton.const.cjs +1 -0
- package/dist/components/SplitButton/SplitButton.const.d.ts +25 -0
- package/dist/components/SplitButton/SplitButton.const.js +27 -0
- package/dist/components/SplitButton/SplitButton.d.ts +4 -0
- package/dist/components/SplitButton/SplitButton.js +73 -0
- package/dist/components/SplitButton/SplitButton.types.d.ts +21 -0
- package/dist/components/SplitButton/index.d.ts +2 -0
- package/dist/components/Spoiler/Spoiler.cjs +1 -0
- package/dist/components/Spoiler/Spoiler.const.cjs +1 -0
- package/dist/components/Spoiler/Spoiler.const.d.ts +6 -0
- package/dist/components/Spoiler/Spoiler.const.js +9 -0
- package/dist/components/Spoiler/Spoiler.d.ts +4 -0
- package/dist/components/Spoiler/Spoiler.js +59 -0
- package/dist/components/Spoiler/Spoiler.types.d.ts +10 -0
- package/dist/components/Spoiler/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +63 -57
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.d.ts +0 -7
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +32 -31
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +19 -0
- package/dist/components/TreeSelect/TreeSelect.const.js +22 -0
- package/dist/components/TreeSelect/TreeSelect.d.ts +4 -0
- package/dist/components/TreeSelect/TreeSelect.js +128 -0
- package/dist/components/TreeSelect/TreeSelect.types.d.ts +25 -0
- package/dist/components/TreeSelect/TreeSelect.utils.cjs +1 -0
- package/dist/components/TreeSelect/TreeSelect.utils.d.ts +5 -0
- package/dist/components/TreeSelect/TreeSelect.utils.js +25 -0
- package/dist/components/TreeSelect/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +54 -0
- package/dist/components/index.js +349 -292
- package/dist/index.cjs +1 -1
- package/dist/index.js +439 -382
- package/dist/postcss/bear-plugin.cjs +86 -0
- package/dist/styles/_alerts.css +14 -0
- package/dist/styles/_base.css +56 -0
- package/dist/styles/_buttons.css +108 -0
- package/dist/styles/_effects.css +90 -0
- package/dist/styles/_marquee.css +25 -0
- package/dist/styles/main.css +5 -0
- package/dist/styles.css +1 -1
- package/dist/types/component.types.d.ts +13 -0
- package/package.json +10 -6
|
@@ -1,60 +1,96 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { DEFAULT_MIN_HEIGHT as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useState as j, useCallback as A } from "react";
|
|
3
|
+
import { cn as c } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_MIN_HEIGHT as U, DEFAULT_MAX_HEIGHT as Y } from "./ResizableTextarea.const.js";
|
|
5
|
+
const O = ({
|
|
6
|
+
label: x,
|
|
7
|
+
helperText: m,
|
|
8
|
+
error: u,
|
|
9
|
+
minHeight: e = U,
|
|
10
|
+
maxHeight: t = Y,
|
|
11
|
+
resizable: n = !0,
|
|
12
|
+
showCharCount: v = !1,
|
|
13
|
+
charCountMax: L,
|
|
14
|
+
className: N,
|
|
15
|
+
style: R,
|
|
16
|
+
testId: B,
|
|
17
|
+
...r
|
|
13
18
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
var
|
|
16
|
-
if (!
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
let o =
|
|
21
|
-
e > 0 && (o = Math.max(e, o)), t > 0 && (o = Math.min(t, o)),
|
|
22
|
-
},
|
|
23
|
-
var
|
|
24
|
-
(
|
|
19
|
+
const f = !!u, i = L ?? r.maxLength, y = typeof r.value == "string" ? r.value.length : typeof r.defaultValue == "string" ? r.defaultValue.length : 0, M = i != null && y > i, z = p(null), [g, D] = j(e), h = p(0), _ = p(e), I = A((a) => {
|
|
20
|
+
var T, E;
|
|
21
|
+
if (!n) return;
|
|
22
|
+
a.preventDefault(), h.current = a.clientY, _.current = g, (E = (T = a.target).setPointerCapture) == null || E.call(T, a.pointerId);
|
|
23
|
+
const w = (l) => {
|
|
24
|
+
const b = l.clientY - h.current;
|
|
25
|
+
let o = _.current + b;
|
|
26
|
+
e > 0 && (o = Math.max(e, o)), t > 0 && (o = Math.min(t, o)), D(o);
|
|
27
|
+
}, k = () => {
|
|
28
|
+
var l, b;
|
|
29
|
+
(b = (l = a.target).releasePointerCapture) == null || b.call(l, a.pointerId), window.removeEventListener("pointermove", w), window.removeEventListener("pointerup", k);
|
|
25
30
|
};
|
|
26
|
-
window.addEventListener("pointermove",
|
|
27
|
-
}, [
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
window.addEventListener("pointermove", w), window.addEventListener("pointerup", k);
|
|
32
|
+
}, [n, g, e, t]);
|
|
33
|
+
return /* @__PURE__ */ d("div", { className: c("Bear-ResizableTextarea bear-flex bear-flex-col bear-gap-1.5", N), "data-testid": B, children: [
|
|
34
|
+
x && /* @__PURE__ */ s("label", { className: "Bear-ResizableTextarea__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", children: x }),
|
|
35
|
+
/* @__PURE__ */ d("div", { className: "bear-relative", children: [
|
|
36
|
+
/* @__PURE__ */ s(
|
|
37
|
+
"textarea",
|
|
38
|
+
{
|
|
39
|
+
ref: z,
|
|
40
|
+
"aria-invalid": f || void 0,
|
|
41
|
+
className: c(
|
|
42
|
+
"bear-w-full bear-rounded-lg bear-border",
|
|
43
|
+
"bear-bg-white dark:bear-bg-gray-900 bear-text-gray-900 dark:bear-text-gray-100",
|
|
44
|
+
"bear-p-3 bear-resize-none focus:bear-outline-none focus:bear-ring-2",
|
|
45
|
+
f ? "bear-border-red-500 focus:bear-ring-red-500" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-ring-pink-500/50"
|
|
46
|
+
),
|
|
47
|
+
style: {
|
|
48
|
+
...R,
|
|
49
|
+
minHeight: n ? e : void 0,
|
|
50
|
+
height: n ? g : void 0,
|
|
51
|
+
maxHeight: t > 0 ? t : void 0
|
|
52
|
+
},
|
|
53
|
+
...r
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
n && /* @__PURE__ */ s(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
role: "separator",
|
|
60
|
+
onPointerDown: I,
|
|
61
|
+
className: "Bear-ResizableTextarea__handle bear-absolute bear-right-0 bear-bottom-0 bear-w-4 bear-h-4 bear-cursor-s-resize bear-opacity-50 hover:bear-opacity-100",
|
|
62
|
+
style: { background: "linear-gradient(135deg, transparent 50%, currentColor 50%)" }
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ d("div", { className: "Bear-ResizableTextarea__footer bear-flex bear-items-center bear-justify-between bear-gap-2", children: [
|
|
67
|
+
m || u ? /* @__PURE__ */ s(
|
|
68
|
+
"p",
|
|
69
|
+
{
|
|
70
|
+
className: c(
|
|
71
|
+
"Bear-ResizableTextarea__helper bear-text-sm bear-flex-1",
|
|
72
|
+
f ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
73
|
+
),
|
|
74
|
+
children: u || m
|
|
75
|
+
}
|
|
76
|
+
) : v ? /* @__PURE__ */ s("span", {}) : null,
|
|
77
|
+
v && i != null && /* @__PURE__ */ d(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: c(
|
|
81
|
+
"Bear-ResizableTextarea__char-count bear-text-xs bear-tabular-nums bear-shrink-0",
|
|
82
|
+
M ? "bear-text-red-500" : "bear-text-gray-400 dark:bear-text-gray-500"
|
|
83
|
+
),
|
|
84
|
+
children: [
|
|
85
|
+
y,
|
|
86
|
+
"/",
|
|
87
|
+
i
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] })
|
|
56
92
|
] });
|
|
57
93
|
};
|
|
58
94
|
export {
|
|
59
|
-
|
|
95
|
+
O as ResizableTextarea
|
|
60
96
|
};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { TextareaHTMLAttributes } from 'react';
|
|
2
2
|
export interface ResizableTextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'style'> {
|
|
3
|
+
/** Textarea label */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Helper text below textarea */
|
|
6
|
+
helperText?: string;
|
|
7
|
+
/** Error message (shows red border + text) */
|
|
8
|
+
error?: string;
|
|
3
9
|
/** Minimum height in pixels */
|
|
4
10
|
minHeight?: number;
|
|
5
11
|
/** Maximum height in pixels (0 = unbounded) */
|
|
@@ -12,4 +18,8 @@ export interface ResizableTextareaProps extends Omit<TextareaHTMLAttributes<HTML
|
|
|
12
18
|
style?: React.CSSProperties;
|
|
13
19
|
/** Test ID */
|
|
14
20
|
testId?: string;
|
|
21
|
+
/** Show live character count (requires maxLength or charCountMax) */
|
|
22
|
+
showCharCount?: boolean;
|
|
23
|
+
/** Max chars for counter display (alternative to maxLength when you don't want native enforcement) */
|
|
24
|
+
charCountMax?: number;
|
|
15
25
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../utils/cn.cjs");require("react");const S=require("../Typography/Typography.cjs"),s=require("./Result.const.cjs"),E=require("./Result.icons.cjs"),A=n=>{const{status:t,title:o,subtitle:c,icon:i,extra:a,className:l,testId:u,...T}=n,d=i??E.getStatusIcon(t,s.STATUS_TEXT_CLASSES),_=s.STATUS_ICON_COLORS[t],C=t==="404"||t==="403"||t==="500";return e.jsxs("div",{className:r.cn(s.ROOT_CLASS,s.CONTAINER_CLASSES,l),"data-testid":u,...T,children:[e.jsx("div",{className:r.cn(s.ICON_WRAPPER_CLASSES,!C&&s.ICON_SIZE_CLASSES,_),children:d}),e.jsx(S.Typography,{variant:"h4",className:r.cn(s.TITLE_CLASSES,"bear-text-gray-900 dark:bear-text-zinc-100"),children:o}),c&&e.jsx(S.Typography,{variant:"body1",color:"secondary",className:s.SUBTITLE_CLASSES,children:c}),a&&e.jsx("div",{className:s.EXTRA_CLASSES,children:a})]})};exports.Result=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-Result",r="bear-flex bear-flex-col bear-items-center bear-justify-center bear-text-center bear-py-16 bear-px-6",S="bear-mb-4 bear-flex bear-items-center bear-justify-center",t="bear-w-16 bear-h-16",a={success:"bear-text-green-500 dark:bear-text-green-400",error:"bear-text-red-500 dark:bear-text-red-400",info:"bear-text-blue-500 dark:bear-text-blue-400",warning:"bear-text-amber-500 dark:bear-text-amber-400",404:"bear-text-gray-500 dark:bear-text-zinc-400",403:"bear-text-orange-500 dark:bear-text-orange-400",500:"bear-text-red-600 dark:bear-text-red-500"},b="bear-mb-2",n="bear-mb-6 bear-max-w-md",E="bear-flex bear-flex-wrap bear-gap-2 bear-justify-center",T="bear-text-5xl bear-font-bold bear-leading-none";exports.CONTAINER_CLASSES=r;exports.EXTRA_CLASSES=E;exports.ICON_SIZE_CLASSES=t;exports.ICON_WRAPPER_CLASSES=S;exports.ROOT_CLASS=e;exports.STATUS_ICON_COLORS=a;exports.STATUS_TEXT_CLASSES=T;exports.SUBTITLE_CLASSES=n;exports.TITLE_CLASSES=b;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ResultStatus } from './Result.types';
|
|
2
|
+
export declare const ROOT_CLASS = "Bear-Result";
|
|
3
|
+
export declare const CONTAINER_CLASSES = "bear-flex bear-flex-col bear-items-center bear-justify-center bear-text-center bear-py-16 bear-px-6";
|
|
4
|
+
export declare const ICON_WRAPPER_CLASSES = "bear-mb-4 bear-flex bear-items-center bear-justify-center";
|
|
5
|
+
export declare const ICON_SIZE_CLASSES = "bear-w-16 bear-h-16";
|
|
6
|
+
export declare const STATUS_ICON_COLORS: Record<ResultStatus, string>;
|
|
7
|
+
export declare const TITLE_CLASSES = "bear-mb-2";
|
|
8
|
+
export declare const SUBTITLE_CLASSES = "bear-mb-6 bear-max-w-md";
|
|
9
|
+
export declare const EXTRA_CLASSES = "bear-flex bear-flex-wrap bear-gap-2 bear-justify-center";
|
|
10
|
+
export declare const STATUS_TEXT_CLASSES = "bear-text-5xl bear-font-bold bear-leading-none";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const e = "Bear-Result", r = "bear-flex bear-flex-col bear-items-center bear-justify-center bear-text-center bear-py-16 bear-px-6", a = "bear-mb-4 bear-flex bear-items-center bear-justify-center", t = "bear-w-16 bear-h-16", b = {
|
|
2
|
+
success: "bear-text-green-500 dark:bear-text-green-400",
|
|
3
|
+
error: "bear-text-red-500 dark:bear-text-red-400",
|
|
4
|
+
info: "bear-text-blue-500 dark:bear-text-blue-400",
|
|
5
|
+
warning: "bear-text-amber-500 dark:bear-text-amber-400",
|
|
6
|
+
404: "bear-text-gray-500 dark:bear-text-zinc-400",
|
|
7
|
+
403: "bear-text-orange-500 dark:bear-text-orange-400",
|
|
8
|
+
500: "bear-text-red-600 dark:bear-text-red-500"
|
|
9
|
+
}, S = "bear-mb-2", n = "bear-mb-6 bear-max-w-md", x = "bear-flex bear-flex-wrap bear-gap-2 bear-justify-center", c = "bear-text-5xl bear-font-bold bear-leading-none";
|
|
10
|
+
export {
|
|
11
|
+
r as CONTAINER_CLASSES,
|
|
12
|
+
x as EXTRA_CLASSES,
|
|
13
|
+
t as ICON_SIZE_CLASSES,
|
|
14
|
+
a as ICON_WRAPPER_CLASSES,
|
|
15
|
+
e as ROOT_CLASS,
|
|
16
|
+
b as STATUS_ICON_COLORS,
|
|
17
|
+
c as STATUS_TEXT_CLASSES,
|
|
18
|
+
n as SUBTITLE_CLASSES,
|
|
19
|
+
S as TITLE_CLASSES
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t="0 0 24 24",r=64,n={width:r,height:r,viewBox:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"},i=()=>s.jsxs("svg",{...n,children:[s.jsx("path",{d:"M9 12l2 2 4-4"}),s.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),l=()=>s.jsxs("svg",{...n,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M15 9l-6 6M9 9l6 6"})]}),x=()=>s.jsxs("svg",{...n,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),a=()=>s.jsx("svg",{...n,children:s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01"})}),h={success:i,error:l,info:x,warning:a},j=(c,e)=>{const o=h[c];return o?s.jsx(o,{}):s.jsx("span",{className:e,children:c.toUpperCase()})};exports.getStatusIcon=j;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as c, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
const i = "0 0 24 24", e = 64, n = {
|
|
3
|
+
width: e,
|
|
4
|
+
height: e,
|
|
5
|
+
viewBox: i,
|
|
6
|
+
fill: "none",
|
|
7
|
+
stroke: "currentColor",
|
|
8
|
+
strokeWidth: 1.5,
|
|
9
|
+
strokeLinecap: "round",
|
|
10
|
+
strokeLinejoin: "round"
|
|
11
|
+
}, h = () => /* @__PURE__ */ o("svg", { ...n, children: [
|
|
12
|
+
/* @__PURE__ */ c("path", { d: "M9 12l2 2 4-4" }),
|
|
13
|
+
/* @__PURE__ */ c("circle", { cx: "12", cy: "12", r: "10" })
|
|
14
|
+
] }), l = () => /* @__PURE__ */ o("svg", { ...n, children: [
|
|
15
|
+
/* @__PURE__ */ c("circle", { cx: "12", cy: "12", r: "10" }),
|
|
16
|
+
/* @__PURE__ */ c("path", { d: "M15 9l-6 6M9 9l6 6" })
|
|
17
|
+
] }), a = () => /* @__PURE__ */ o("svg", { ...n, children: [
|
|
18
|
+
/* @__PURE__ */ c("circle", { cx: "12", cy: "12", r: "10" }),
|
|
19
|
+
/* @__PURE__ */ c("path", { d: "M12 16v-4M12 8h.01" })
|
|
20
|
+
] }), d = () => /* @__PURE__ */ c("svg", { ...n, children: /* @__PURE__ */ c("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01" }) }), p = {
|
|
21
|
+
success: h,
|
|
22
|
+
error: l,
|
|
23
|
+
info: a,
|
|
24
|
+
warning: d
|
|
25
|
+
}, v = (r, t) => {
|
|
26
|
+
const s = p[r];
|
|
27
|
+
return s ? /* @__PURE__ */ c(s, {}) : /* @__PURE__ */ c("span", { className: t, children: r.toUpperCase() });
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
v as getStatusIcon
|
|
31
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as E, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { cn as S } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Typography as e } from "../Typography/Typography.js";
|
|
5
|
+
import { STATUS_ICON_COLORS as A, ICON_SIZE_CLASSES as _, ICON_WRAPPER_CLASSES as L, TITLE_CLASSES as N, SUBTITLE_CLASSES as I, EXTRA_CLASSES as p, CONTAINER_CLASSES as O, ROOT_CLASS as h, STATUS_TEXT_CLASSES as u } from "./Result.const.js";
|
|
6
|
+
import { getStatusIcon as x } from "./Result.icons.js";
|
|
7
|
+
const U = (o) => {
|
|
8
|
+
const {
|
|
9
|
+
status: t,
|
|
10
|
+
title: c,
|
|
11
|
+
subtitle: r,
|
|
12
|
+
icon: i,
|
|
13
|
+
extra: a,
|
|
14
|
+
className: n,
|
|
15
|
+
testId: l,
|
|
16
|
+
...m
|
|
17
|
+
} = o, T = i ?? x(t, u), d = A[t], C = t === "404" || t === "403" || t === "500";
|
|
18
|
+
return /* @__PURE__ */ E(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: S(h, O, n),
|
|
22
|
+
"data-testid": l,
|
|
23
|
+
...m,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ s("div", { className: S(L, !C && _, d), children: T }),
|
|
26
|
+
/* @__PURE__ */ s(e, { variant: "h4", className: S(N, "bear-text-gray-900 dark:bear-text-zinc-100"), children: c }),
|
|
27
|
+
r && /* @__PURE__ */ s(e, { variant: "body1", color: "secondary", className: I, children: r }),
|
|
28
|
+
a && /* @__PURE__ */ s("div", { className: p, children: a })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
U as Result
|
|
35
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export type ResultStatus = 'success' | 'error' | 'info' | 'warning' | '404' | '403' | '500';
|
|
3
|
+
export interface ResultProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
status: ResultStatus;
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
extra?: ReactNode;
|
|
9
|
+
testId?: string;
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("react"),m=require("../../utils/cn.cjs"),u=require("./helpers/formatHelpers.cjs"),f=require("./RichEditor.const.cjs"),ce=require("../../hooks/useMediaQuery.cjs"),C=require("./components/ToolbarButton/ToolbarButton.cjs"),ue=require("./components/ToolbarDropdown/ToolbarDropdown.cjs"),z=require("./components/ToolbarColorPicker/ToolbarColorPicker.cjs"),de=require("./components/ToolbarMore/ToolbarMore.cjs"),i=require("../Icon/icons/editor.cjs"),ge=6,fe=A=>{const{value:x,defaultValue:k="",onChange:R,placeholder:v="Start typing...",disabled:o=!1,readOnly:r=!1,minHeight:j=f.RICH_EDITOR_MIN_HEIGHT,maxHeight:b,toolbar:D=f.RICH_EDITOR_DEFAULT_TOOLBAR,className:N="",testId:M,id:F,allowImagePaste:L=!0,showCharCount:p=!1,charCountMax:_,...w}=A,l=c.useRef(null),E=ce.useMediaQuery(`(max-width: ${f.RICH_EDITOR_MOBILE_BREAKPOINT}px)`),O=E?f.RICH_EDITOR_MOBILE_TOOLBAR:D,[q,U]=c.useState(new Set),[P,H]=c.useState("p"),[B,V]=c.useState(0),[J,G]=c.useState("#000000"),[$,Q]=c.useState("#fef08a"),[K,Y]=c.useState([]),[W,X]=c.useState([]);c.useEffect(()=>{const e="bear-rich-editor-styles";if(!document.getElementById(e)){const n=document.createElement("style");n.id=e,n.textContent=f.RICH_EDITOR_CONTENT_STYLES,document.head.appendChild(n)}},[]),c.useEffect(()=>{l.current&&x!==void 0&&l.current.innerHTML!==x&&(l.current.innerHTML=x)},[x]),c.useEffect(()=>{l.current&&k&&!x&&(l.current.innerHTML=k)},[]);const I=c.useCallback(()=>{U(u.getActiveFormats());const e=u.queryCommandValue("formatBlock");e&&H(e.toLowerCase().replace(/[<>]/g,""))},[]),a=c.useCallback(()=>{var e;l.current&&(R&&R(l.current.innerHTML),p&&V(((e=l.current.textContent)==null?void 0:e.length)??0)),I()},[R,I,p]),Z=c.useCallback(e=>{var d;if(o||r)return;(d=l.current)==null||d.focus();const n=f.RICH_EDITOR_BUTTON_CONFIG[e];if(!n)return;const g="value"in n?n.value:void 0;g?u.execCommand(n.command,g):u.execCommand(n.command),I(),a()},[o,r,I,a]),ee=c.useCallback(e=>{var n;o||r||((n=l.current)==null||n.focus(),u.execCommand("formatBlock",e),H(e),a())},[o,r,a]),te=c.useCallback(()=>{var d;if(o||r)return;const e=window.getSelection(),n=e&&e.toString().length>0,g=prompt("Enter URL:",n?"":"https://");g&&((d=l.current)==null||d.focus(),u.insertLink(g),a())},[o,r,a]),T=c.useCallback((e,n)=>{if(!e)return;(n==="text"?Y:X)(d=>{const s=d.filter(h=>h!==e);return[e,...s].slice(0,ge)})},[]),ne=c.useCallback(e=>{var n;o||r||((n=l.current)==null||n.focus(),u.setTextColor(e),G(e),T(e,"text"),a())},[o,r,a,T]),oe=c.useCallback(e=>{var n;o||r||((n=l.current)==null||n.focus(),u.setHighlightColor(e),Q(e),T(e,"highlight"),a())},[o,r,a,T]),re=c.useCallback(e=>{var n;o||r||((n=l.current)==null||n.focus(),u.setTextColor(e),a())},[o,r,a]),ie=c.useCallback(e=>{var n;o||r||((n=l.current)==null||n.focus(),u.setHighlightColor(e),a())},[o,r,a]),se=c.useCallback(async e=>{var g;if(!L)return;const n=(g=e.clipboardData)==null?void 0:g.items;if(n)for(let d=0;d<n.length;d++){const s=n[d];if(s.type.startsWith("image/")){e.preventDefault();const h=s.getAsFile();if(h){const y=await u.fileToDataUrl(h);u.insertImage(y),a()}return}}},[L,a]),ae=c.useCallback(()=>{if(o||r)return;const e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async n=>{var d,s;const g=(d=n.target.files)==null?void 0:d[0];if(g){const h=await u.fileToDataUrl(g);(s=l.current)==null||s.focus(),u.insertImage(h),a()}},e.click()},[o,r,a]),le={bold:t.jsx(i.BoldIcon,{size:16}),italic:t.jsx(i.ItalicIcon,{size:16}),underline:t.jsx(i.UnderlineIcon,{size:16}),strikethrough:t.jsx(i.StrikethroughIcon,{size:16}),heading1:t.jsx(i.Heading1Icon,{size:16}),heading2:t.jsx(i.Heading2Icon,{size:16}),heading3:t.jsx(i.Heading3Icon,{size:16}),bulletList:t.jsx(i.ListBulletIcon,{size:16}),orderedList:t.jsx(i.ListNumberedIcon,{size:16}),blockquote:t.jsx(i.QuoteIcon,{size:16}),code:t.jsx(i.CodeIcon,{size:16}),link:t.jsx(i.InsertLinkIcon,{size:16}),alignLeft:t.jsx(i.AlignLeftIcon,{size:16}),alignCenter:t.jsx(i.AlignCenterIcon,{size:16}),alignRight:t.jsx(i.AlignRightIcon,{size:16}),alignJustify:t.jsx(i.AlignJustifyIcon,{size:16}),image:t.jsx(i.InsertPhotoIcon,{size:16}),indent:t.jsx(i.IndentIncreaseIcon,{size:16}),outdent:t.jsx(i.IndentDecreaseIcon,{size:16}),clearFormat:t.jsx(i.FormatClearIcon,{size:16}),table:t.jsx(i.TableIcon,{size:16})},S=(e,n)=>{if(e==="divider")return t.jsx("div",{className:m.cn("Bear-RichEditor__divider",f.RICH_EDITOR_DIVIDER_CLASSES)},`divider-${n}`);if(e==="headingDropdown")return t.jsx(ue.ToolbarDropdown,{options:f.RICH_EDITOR_HEADING_OPTIONS,value:P,onChange:ee,title:"Text Style",disabled:o||r,icon:t.jsx(i.TextIcon,{size:16})},"heading-dropdown");if(e==="textColor")return t.jsx(z.ToolbarColorPicker,{value:J,onChange:ne,title:"Text Color",disabled:o||r,type:"text",recentColors:K,onApplyLast:re},"text-color");if(e==="highlightColor")return t.jsx(z.ToolbarColorPicker,{value:$,onChange:oe,title:"Highlight Color",disabled:o||r,type:"highlight",recentColors:W,onApplyLast:ie},"highlight-color");if(e==="link")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.InsertLinkIcon,{size:16}),title:"Insert Link",onClick:te,disabled:o||r},"link");if(e==="image")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.InsertPhotoIcon,{size:16}),title:"Insert Image",onClick:ae,disabled:o||r},"image");if(e==="alignLeft")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.AlignLeftIcon,{size:16}),title:"Align Left",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("justifyLeft"),a()},disabled:o||r},"alignLeft");if(e==="alignCenter")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.AlignCenterIcon,{size:16}),title:"Align Center",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("justifyCenter"),a()},disabled:o||r},"alignCenter");if(e==="alignRight")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.AlignRightIcon,{size:16}),title:"Align Right",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("justifyRight"),a()},disabled:o||r},"alignRight");if(e==="alignJustify")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.AlignJustifyIcon,{size:16}),title:"Justify",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("justifyFull"),a()},disabled:o||r},"alignJustify");if(e==="indent")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.IndentIncreaseIcon,{size:16}),title:"Increase Indent",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("indent"),a()},disabled:o||r},"indent");if(e==="outdent")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.IndentDecreaseIcon,{size:16}),title:"Decrease Indent",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("outdent"),a()},disabled:o||r},"outdent");if(e==="clearFormat")return t.jsx(C.ToolbarButton,{icon:t.jsx(i.FormatClearIcon,{size:16}),title:"Clear Formatting",onClick:()=>{var s;(s=l.current)==null||s.focus(),u.execCommand("removeFormat"),a()},disabled:o||r},"clearFormat");if(e==="more"){const s=E?f.RICH_EDITOR_MOBILE_MORE_ITEMS:["alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","blockquote","code","clearFormat"];return t.jsx(de.ToolbarMore,{disabled:o||r,isMobile:E,children:s.map((h,y)=>S(h,y+1e3))},"more")}const g=f.RICH_EDITOR_BUTTON_CONFIG[e],d=le[e];return!g||!d?null:t.jsx(C.ToolbarButton,{icon:d,title:g.title,active:q.has(e),onClick:()=>Z(e),disabled:o||r},e)};return t.jsxs("div",{id:F,"data-testid":M,className:m.cn("Bear-RichEditor",f.RICH_EDITOR_ROOT_CLASSES,o&&"Bear-RichEditor--disabled",r&&"Bear-RichEditor--readonly",N),...w,children:[O.length>0&&t.jsx("div",{className:m.cn("Bear-RichEditor__toolbar",f.RICH_EDITOR_TOOLBAR_CLASSES),children:O.map((e,n)=>S(e,n))}),t.jsx("div",{ref:l,contentEditable:!o&&!r,onInput:a,onSelect:I,onKeyUp:I,onMouseUp:I,onPaste:se,"data-placeholder":v,className:m.cn("Bear-RichEditor__content",f.RICH_EDITOR_CONTENT_CLASSES,"[&:empty]:before:bear-content-[attr(data-placeholder)] [&:empty]:before:bear-text-gray-400 [&:empty]:before:bear-pointer-events-none",o&&"Bear-RichEditor__content--disabled bear-opacity-50 bear-cursor-not-allowed"),style:{minHeight:typeof j=="number"?`${j}px`:j,maxHeight:b?typeof b=="number"?`${b}px`:b:void 0,overflowY:b?"auto":void 0}}),p&&_!=null&&t.jsxs("div",{className:m.cn("Bear-RichEditor__char-count bear-text-xs bear-tabular-nums bear-px-3 bear-py-1.5 bear-text-right bear-border-t bear-border-gray-200 dark:bear-border-gray-700",B>_?"bear-text-red-500":"bear-text-gray-400 dark:bear-text-gray-500"),children:[B,"/",_]})]})};exports.RichEditor=fe;
|