@forgedevstack/bear 1.2.0 → 1.2.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/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
- package/dist/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
- package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
- package/dist/components/DiffViewer/DiffViewer.js +97 -105
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
- package/dist/components/DiffViewer/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/GlowCard/GlowCard.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
- package/dist/components/GlowCard/GlowCard.const.js +13 -0
- package/dist/components/GlowCard/GlowCard.d.ts +3 -0
- package/dist/components/GlowCard/GlowCard.js +185 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
- package/dist/components/GlowCard/index.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
- package/dist/components/Heatmap/Heatmap.const.js +11 -0
- package/dist/components/Heatmap/Heatmap.d.ts +3 -0
- package/dist/components/Heatmap/Heatmap.js +103 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
- package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.utils.js +18 -0
- package/dist/components/Heatmap/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
- package/dist/components/ImageAnnotation/index.d.ts +2 -0
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
- package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
- package/dist/components/MediaPlayer/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +26 -4
- package/dist/components/Stepper/Stepper.const.js +39 -20
- package/dist/components/Stepper/Stepper.d.ts +3 -10
- package/dist/components/Stepper/Stepper.js +189 -130
- package/dist/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/components/Stepper/Stepper.utils.cjs +1 -0
- package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
- package/dist/components/Stepper/Stepper.utils.js +19 -0
- package/dist/components/Stepper/components/StepperControls.cjs +1 -0
- package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
- package/dist/components/Stepper/components/StepperControls.js +32 -0
- package/dist/components/Stepper/index.d.ts +2 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
- package/dist/components/TagCloud/TagCloud.const.js +8 -0
- package/dist/components/TagCloud/TagCloud.d.ts +3 -0
- package/dist/components/TagCloud/TagCloud.js +76 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
- package/dist/components/TagCloud/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
- package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.js +65 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
- package/dist/components/TimelineChart/index.d.ts +2 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -4
- package/dist/components/index.js +319 -296
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +412 -388
- package/dist/styles/_effects.css +32 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as p, jsx as r, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as C, useMemo as D, useEffect as P, useCallback as y } from "react";
|
|
3
|
+
import { cn as m } from "../../utils/cn.js";
|
|
4
|
+
import { Portal as Y } from "../Portal/Portal.js";
|
|
5
|
+
import { DEFAULT_MAX_HEIGHT as $, LABEL_CLASSES as ee, SIZE_CLASSES as re, TRIGGER_CLASSES as te, SEARCH_CLASSES as ae, DROPDOWN_CLASSES as se, ERROR_CLASSES as ne, HELPER_CLASSES as le, ROOT_CLASSES as ie, TAG_CLASSES as oe, CHEVRON_CLASSES as ce, INDENT_PX as de, NODE_DISABLED_CLASSES as be, NODE_SELECTED_CLASSES as me, NODE_CLASSES as ue } from "./TreeSelect.const.js";
|
|
6
|
+
import { collectAllIds as he, filterNodes as pe, findNodeById as z } from "./TreeSelect.utils.js";
|
|
7
|
+
const Se = 1e4, M = ({ node: a, depth: l, selected: o, expanded: s, multiple: i, onToggleExpand: S, onSelect: f }) => {
|
|
8
|
+
const c = a.children && a.children.length > 0, E = s.has(a.id), u = o.has(a.id);
|
|
9
|
+
return /* @__PURE__ */ p(Q, { children: [
|
|
10
|
+
/* @__PURE__ */ p(
|
|
10
11
|
"div",
|
|
11
12
|
{
|
|
12
|
-
className:
|
|
13
|
-
style: { paddingLeft: l *
|
|
14
|
-
onClick: () => !a.disabled &&
|
|
13
|
+
className: m(ue, u && me, a.disabled && be),
|
|
14
|
+
style: { paddingLeft: l * de + 12 },
|
|
15
|
+
onClick: () => !a.disabled && f(a.id),
|
|
15
16
|
role: "treeitem",
|
|
16
|
-
"aria-selected":
|
|
17
|
-
"aria-expanded":
|
|
17
|
+
"aria-selected": u,
|
|
18
|
+
"aria-expanded": c ? E : void 0,
|
|
18
19
|
children: [
|
|
19
|
-
|
|
20
|
+
c ? /* @__PURE__ */ r(
|
|
20
21
|
"svg",
|
|
21
22
|
{
|
|
22
|
-
className:
|
|
23
|
-
onClick: (
|
|
24
|
-
|
|
23
|
+
className: m(ce, E && "bear-rotate-90"),
|
|
24
|
+
onClick: (h) => {
|
|
25
|
+
h.stopPropagation(), S(a.id);
|
|
25
26
|
},
|
|
26
27
|
fill: "none",
|
|
27
28
|
viewBox: "0 0 24 24",
|
|
@@ -29,100 +30,131 @@ const R = ({ node: a, depth: l, selected: c, expanded: t, multiple: n, onToggleE
|
|
|
29
30
|
children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
30
31
|
}
|
|
31
32
|
) : /* @__PURE__ */ r("span", { className: "bear-w-4 bear-mr-1" }),
|
|
32
|
-
|
|
33
|
+
i && /* @__PURE__ */ r("span", { className: m("bear-w-4 bear-h-4 bear-mr-2 bear-border bear-rounded bear-flex bear-items-center bear-justify-center bear-text-xs", u ? "bear-bg-pink-500 bear-border-pink-500 bear-text-white" : "bear-border-gray-300 dark:bear-border-zinc-600"), children: u && "✓" }),
|
|
33
34
|
a.icon && /* @__PURE__ */ r("span", { className: "bear-mr-1.5", children: a.icon }),
|
|
34
35
|
/* @__PURE__ */ r("span", { className: "bear-truncate", children: a.label })
|
|
35
36
|
]
|
|
36
37
|
}
|
|
37
38
|
),
|
|
38
|
-
|
|
39
|
+
c && E && a.children.map((h) => /* @__PURE__ */ r(M, { node: h, depth: l + 1, selected: o, expanded: s, multiple: i, onToggleExpand: S, onSelect: f }, h.id))
|
|
39
40
|
] });
|
|
40
|
-
},
|
|
41
|
+
}, Ae = (a) => {
|
|
41
42
|
const {
|
|
42
43
|
nodes: l,
|
|
43
|
-
value:
|
|
44
|
-
onChange:
|
|
45
|
-
multiple:
|
|
46
|
-
label:
|
|
47
|
-
placeholder:
|
|
48
|
-
disabled:
|
|
49
|
-
clearable:
|
|
50
|
-
searchable:
|
|
51
|
-
expandAll:
|
|
52
|
-
size:
|
|
53
|
-
error:
|
|
54
|
-
helperText:
|
|
55
|
-
maxHeight:
|
|
56
|
-
className:
|
|
57
|
-
testId:
|
|
58
|
-
...
|
|
59
|
-
} = a, [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
value: o,
|
|
45
|
+
onChange: s,
|
|
46
|
+
multiple: i = !1,
|
|
47
|
+
label: S,
|
|
48
|
+
placeholder: f = "Select…",
|
|
49
|
+
disabled: c = !1,
|
|
50
|
+
clearable: E = !0,
|
|
51
|
+
searchable: u = !0,
|
|
52
|
+
expandAll: h = !1,
|
|
53
|
+
size: B = "md",
|
|
54
|
+
error: w,
|
|
55
|
+
helperText: _,
|
|
56
|
+
maxHeight: H = $,
|
|
57
|
+
className: j,
|
|
58
|
+
testId: G,
|
|
59
|
+
...W
|
|
60
|
+
} = a, [d, x] = N(!1), [L, A] = N(""), g = C(null), k = C(null), R = C(null), [v, F] = N({ top: 0, left: 0, width: 0 }), V = D(() => he(l), [l]), [X, Z] = N(() => h ? V : /* @__PURE__ */ new Set()), b = D(() => o ? new Set(Array.isArray(o) ? o : [o]) : /* @__PURE__ */ new Set(), [o]);
|
|
61
|
+
P(() => {
|
|
62
|
+
if (!d) return;
|
|
63
|
+
const e = () => {
|
|
64
|
+
var n;
|
|
65
|
+
const t = (n = k.current) == null ? void 0 : n.getBoundingClientRect();
|
|
66
|
+
t && F({
|
|
67
|
+
top: t.bottom + 4,
|
|
68
|
+
left: Math.max(8, Math.min(t.left, window.innerWidth - t.width - 8)),
|
|
69
|
+
width: t.width
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
73
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
74
|
+
};
|
|
75
|
+
}, [d]), P(() => {
|
|
76
|
+
if (!d) return;
|
|
77
|
+
const e = (t) => {
|
|
78
|
+
var I, O;
|
|
79
|
+
const n = t.target;
|
|
80
|
+
(I = g.current) != null && I.contains(n) || (O = R.current) != null && O.contains(n) || (x(!1), A(""));
|
|
63
81
|
};
|
|
64
82
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
65
|
-
}, []);
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
return
|
|
83
|
+
}, [d]);
|
|
84
|
+
const U = y((e) => {
|
|
85
|
+
Z((t) => {
|
|
86
|
+
const n = new Set(t);
|
|
87
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
70
88
|
});
|
|
71
|
-
}, []),
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
|
|
89
|
+
}, []), q = y((e) => {
|
|
90
|
+
if (i) {
|
|
91
|
+
const t = new Set(b);
|
|
92
|
+
t.has(e) ? t.delete(e) : t.add(e), s == null || s(Array.from(t));
|
|
75
93
|
} else
|
|
76
|
-
|
|
77
|
-
}, [
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
if (
|
|
81
|
-
if (
|
|
82
|
-
return /* @__PURE__ */ r("div", { className: "bear-flex bear-flex-wrap bear-gap-1", children: Array.from(
|
|
83
|
-
const
|
|
84
|
-
return
|
|
94
|
+
s == null || s(e), x(!1), A("");
|
|
95
|
+
}, [i, b, s]), J = y(() => {
|
|
96
|
+
s == null || s(i ? [] : "");
|
|
97
|
+
}, [i, s]), T = L ? pe(l, L) : l, K = () => {
|
|
98
|
+
if (b.size === 0) return /* @__PURE__ */ r("span", { className: "bear-text-gray-400 dark:bear-text-zinc-500", children: f });
|
|
99
|
+
if (i)
|
|
100
|
+
return /* @__PURE__ */ r("div", { className: "bear-flex bear-flex-wrap bear-gap-1", children: Array.from(b).map((t) => {
|
|
101
|
+
const n = z(l, t);
|
|
102
|
+
return n ? /* @__PURE__ */ r("span", { className: oe, children: n.label }, t) : null;
|
|
85
103
|
}) });
|
|
86
|
-
const e =
|
|
87
|
-
return (e == null ? void 0 : e.label) ??
|
|
104
|
+
const e = z(l, Array.from(b)[0]);
|
|
105
|
+
return (e == null ? void 0 : e.label) ?? f;
|
|
88
106
|
};
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ p("div", { ref: g, className: m(ie, j), "data-testid": G, ...W, children: [
|
|
108
|
+
S && /* @__PURE__ */ r("label", { className: ee, children: S }),
|
|
109
|
+
/* @__PURE__ */ p(
|
|
92
110
|
"button",
|
|
93
111
|
{
|
|
112
|
+
ref: k,
|
|
94
113
|
type: "button",
|
|
95
|
-
disabled:
|
|
96
|
-
onClick: () => !
|
|
97
|
-
className:
|
|
114
|
+
disabled: c,
|
|
115
|
+
onClick: () => !c && x(!d),
|
|
116
|
+
className: m(te, re[B], c && "bear-opacity-50 bear-cursor-not-allowed"),
|
|
98
117
|
children: [
|
|
99
|
-
/* @__PURE__ */ r("span", { className: "bear-flex-1 bear-text-left bear-truncate", children:
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
|
|
102
|
-
e.stopPropagation(),
|
|
118
|
+
/* @__PURE__ */ r("span", { className: "bear-flex-1 bear-text-left bear-truncate", children: K() }),
|
|
119
|
+
/* @__PURE__ */ p("div", { className: "bear-flex bear-items-center bear-gap-1", children: [
|
|
120
|
+
E && b.size > 0 && /* @__PURE__ */ r("span", { className: "bear-text-gray-400 hover:bear-text-gray-600 bear-cursor-pointer", onClick: (e) => {
|
|
121
|
+
e.stopPropagation(), J();
|
|
103
122
|
}, children: "✕" }),
|
|
104
|
-
/* @__PURE__ */ r("svg", { className:
|
|
123
|
+
/* @__PURE__ */ r("svg", { className: m("bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform", d && "bear-rotate-180"), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })
|
|
105
124
|
] })
|
|
106
125
|
]
|
|
107
126
|
}
|
|
108
127
|
),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
d && /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ p(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
ref: R,
|
|
132
|
+
className: m(se, "bear-fixed"),
|
|
133
|
+
style: {
|
|
134
|
+
top: v.top,
|
|
135
|
+
left: v.left,
|
|
136
|
+
width: v.width,
|
|
137
|
+
zIndex: Se
|
|
138
|
+
},
|
|
139
|
+
children: [
|
|
140
|
+
u && /* @__PURE__ */ r(
|
|
141
|
+
"input",
|
|
142
|
+
{
|
|
143
|
+
className: ae,
|
|
144
|
+
placeholder: "Search…",
|
|
145
|
+
value: L,
|
|
146
|
+
onChange: (e) => A(e.target.value),
|
|
147
|
+
autoFocus: !0
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ r("div", { style: { maxHeight: H }, className: "bear-overflow-y-auto", role: "tree", children: T.length > 0 ? T.map((e) => /* @__PURE__ */ r(M, { node: e, depth: 0, selected: b, expanded: X, multiple: i, onToggleExpand: U, onSelect: q }, e.id)) : /* @__PURE__ */ r("div", { className: "bear-py-6 bear-text-center bear-text-sm bear-text-gray-400", children: "No results" }) })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
w && /* @__PURE__ */ r("p", { className: ne, children: w }),
|
|
155
|
+
!w && _ && /* @__PURE__ */ r("p", { className: le, children: _ })
|
|
124
156
|
] });
|
|
125
157
|
};
|
|
126
158
|
export {
|
|
127
|
-
|
|
159
|
+
Ae as TreeSelect
|
|
128
160
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),s=require("react"),z=require("../../context/BearProvider.cjs"),C=require("../../utils/cn.cjs"),t=require("./Watermark.const.cjs"),Y=w=>{const{children:S,text:c,image:d,fontSize:E=t.DEFAULT_FONT_SIZE,color:T,rotate:g=t.DEFAULT_ROTATE,opacity:_=t.DEFAULT_OPACITY,patternRepeat:v=t.PATTERN_REPEAT_MIN,gap:F=t.DEFAULT_GAP,offset:D=t.DEFAULT_OFFSET,zIndex:U=t.DEFAULT_Z_INDEX,fontFamily:L,fontWeight:k=t.DEFAULT_FONT_WEIGHT,visible:b=!0,className:W,style:G,testId:q}=w,i=s.useRef(null),R=s.useRef(null),m=s.useContext(z.BearContext),[$,B]=s.useState(!1);s.useEffect(()=>{if(m)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>{const o=document.documentElement,h=o.classList.contains("dark")||o.classList.contains("bear-dark")||r.matches;B(h)};e();const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),r.addEventListener("change",e),()=>{n.disconnect(),r.removeEventListener("change",e)}},[m]);const I=m?m.mode==="dark":$,p=s.useMemo(()=>{if(L)return L;if(typeof window<"u"){const r=document.documentElement,e=getComputedStyle(r).getPropertyValue("--bear-font-sans");if(e.trim())return e.trim();const n=getComputedStyle(r).getPropertyValue("--bear-font-family");if(n.trim())return n.trim()}return t.DEFAULT_FONT_FAMILY},[L]),y=s.useMemo(()=>T||(I?t.DEFAULT_COLOR_DARK:t.DEFAULT_COLOR_LIGHT),[T,I]),x=s.useCallback(()=>{if(!b||!c&&!d)return"";const r=document.createElement("canvas"),e=r.getContext("2d");if(!e)return"";const n=Array.isArray(c)?c:c?[c]:[],o=E*t.LINE_HEIGHT_MULTIPLIER,h=n.length*o,A=F[0]+t.CANVAS_WIDTH_OFFSET,f=F[1]+h+t.CANVAS_EXTRA_PADDING;r.width=A,r.height=f;const l=Math.min(t.PATTERN_REPEAT_MAX,Math.max(t.PATTERN_REPEAT_MIN,Math.floor(v))),O=A/l,N=f/l,M=(a,u)=>{e.save(),e.translate(a,u),e.rotate(g*t.DEG_TO_RAD),e.font=`${k} ${E}px ${p}`,e.fillStyle=y,e.globalAlpha=_,e.textAlign="center",e.textBaseline="middle",n.forEach((j,V)=>{const X=(V-(n.length-1)/t.HALF)*o;e.fillText(j,0,X)}),e.restore()};if(d){e.save(),e.translate(A/t.HALF,f/t.HALF),e.rotate(g*t.DEG_TO_RAD);const a=new Image;a.crossOrigin="anonymous",a.src=d,e.globalAlpha=_,e.drawImage(a,-a.width/t.HALF,-a.height/t.HALF),e.restore()}else if(l<=1)M(A/t.HALF,f/t.HALF);else for(let a=0;a<l;a++)for(let u=0;u<l;u++)M(u*O+O/t.HALF,a*N+N/t.HALF);return r.toDataURL()},[c,d,E,y,g,_,F,p,k,b,v]),H=s.useMemo(()=>x(),[x]);return s.useEffect(()=>{const r=R.current;if(!r)return;const e=new MutationObserver(()=>{var n,o;(n=i.current)!=null&&n.contains(r)||(o=i.current)==null||o.appendChild(r)});return i.current&&e.observe(i.current,{childList:!0}),()=>e.disconnect()},[]),P.jsxs("div",{ref:i,className:C.cn("Bear-Watermark","bear-relative",W),style:G,"data-testid":q,children:[S,b&&H&&P.jsx("div",{ref:R,className:C.cn("Bear-Watermark__overlay","bear-absolute bear-inset-0 bear-pointer-events-none bear-bg-repeat"),style:{backgroundImage:`url(${H})`,backgroundPosition:`${D[0]}px ${D[1]}px`,zIndex:U},"aria-hidden":"true"})]})};exports.Watermark=Y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=16,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=16,A=-22,_=.22,E=[100,100],F=[0,0],L=9,D=400,I="rgba(0, 0, 0, 0.28)",s="rgba(255, 255, 255, 0.22)",t="system-ui, -apple-system, sans-serif",O=1.5,N=40,R=200,U=2,o=Math.PI/180,n=1,c=4;exports.CANVAS_EXTRA_PADDING=N;exports.CANVAS_WIDTH_OFFSET=R;exports.DEFAULT_COLOR_DARK=s;exports.DEFAULT_COLOR_LIGHT=I;exports.DEFAULT_FONT_FAMILY=t;exports.DEFAULT_FONT_SIZE=T;exports.DEFAULT_FONT_WEIGHT=D;exports.DEFAULT_GAP=E;exports.DEFAULT_OFFSET=F;exports.DEFAULT_OPACITY=_;exports.DEFAULT_ROTATE=A;exports.DEFAULT_Z_INDEX=L;exports.DEG_TO_RAD=o;exports.HALF=U;exports.LINE_HEIGHT_MULTIPLIER=O;exports.PATTERN_REPEAT_MAX=c;exports.PATTERN_REPEAT_MIN=n;
|
|
@@ -3,7 +3,7 @@ export declare const DEFAULT_FONT_SIZE = 16;
|
|
|
3
3
|
/** Default rotation in degrees */
|
|
4
4
|
export declare const DEFAULT_ROTATE = -22;
|
|
5
5
|
/** Default opacity */
|
|
6
|
-
export declare const DEFAULT_OPACITY = 0.
|
|
6
|
+
export declare const DEFAULT_OPACITY = 0.22;
|
|
7
7
|
/** Default gap [horizontal, vertical] in pixels */
|
|
8
8
|
export declare const DEFAULT_GAP: [number, number];
|
|
9
9
|
/** Default offset [x, y] in pixels */
|
|
@@ -13,9 +13,9 @@ export declare const DEFAULT_Z_INDEX = 9;
|
|
|
13
13
|
/** Default font weight */
|
|
14
14
|
export declare const DEFAULT_FONT_WEIGHT = 400;
|
|
15
15
|
/** Default light mode color */
|
|
16
|
-
export declare const DEFAULT_COLOR_LIGHT = "rgba(0, 0, 0, 0.
|
|
16
|
+
export declare const DEFAULT_COLOR_LIGHT = "rgba(0, 0, 0, 0.28)";
|
|
17
17
|
/** Default dark mode color */
|
|
18
|
-
export declare const DEFAULT_COLOR_DARK = "rgba(255, 255, 255, 0.
|
|
18
|
+
export declare const DEFAULT_COLOR_DARK = "rgba(255, 255, 255, 0.22)";
|
|
19
19
|
/** Default font family */
|
|
20
20
|
export declare const DEFAULT_FONT_FAMILY = "system-ui, -apple-system, sans-serif";
|
|
21
21
|
/** Line height multiplier */
|
|
@@ -28,3 +28,6 @@ export declare const CANVAS_WIDTH_OFFSET = 200;
|
|
|
28
28
|
export declare const HALF = 2;
|
|
29
29
|
/** Degrees to radians conversion */
|
|
30
30
|
export declare const DEG_TO_RAD: number;
|
|
31
|
+
/** Min / max pattern repeat per axis */
|
|
32
|
+
export declare const PATTERN_REPEAT_MIN = 1;
|
|
33
|
+
export declare const PATTERN_REPEAT_MAX = 4;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
const T = 16,
|
|
1
|
+
const T = 16, A = -22, _ = 0.22, E = [100, 100], s = [0, 0], t = 9, F = 400, n = "rgba(0, 0, 0, 0.28)", o = "rgba(255, 255, 255, 0.22)", L = "system-ui, -apple-system, sans-serif", c = 1.5, D = 40, I = 200, O = 2, N = Math.PI / 180, R = 1, U = 4;
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
D as CANVAS_EXTRA_PADDING,
|
|
4
4
|
I as CANVAS_WIDTH_OFFSET,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
o as DEFAULT_COLOR_DARK,
|
|
6
|
+
n as DEFAULT_COLOR_LIGHT,
|
|
7
|
+
L as DEFAULT_FONT_FAMILY,
|
|
8
8
|
T as DEFAULT_FONT_SIZE,
|
|
9
9
|
F as DEFAULT_FONT_WEIGHT,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
E as DEFAULT_GAP,
|
|
11
|
+
s as DEFAULT_OFFSET,
|
|
12
|
+
_ as DEFAULT_OPACITY,
|
|
13
|
+
A as DEFAULT_ROTATE,
|
|
14
14
|
t as DEFAULT_Z_INDEX,
|
|
15
|
-
|
|
15
|
+
N as DEG_TO_RAD,
|
|
16
16
|
O as HALF,
|
|
17
|
-
|
|
17
|
+
c as LINE_HEIGHT_MULTIPLIER,
|
|
18
|
+
U as PATTERN_REPEAT_MAX,
|
|
19
|
+
R as PATTERN_REPEAT_MIN
|
|
18
20
|
};
|
|
@@ -1,88 +1,114 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsxs as K, jsx as J } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as U, useContext as Q, useState as ee, useEffect as M, useMemo as F, useCallback as te } from "react";
|
|
3
|
+
import { BearContext as re } from "../../context/BearProvider.js";
|
|
4
|
+
import { cn as P } from "../../utils/cn.js";
|
|
5
|
+
import { DEFAULT_FONT_SIZE as ne, DEFAULT_ROTATE as ae, DEFAULT_OPACITY as oe, PATTERN_REPEAT_MIN as H, DEFAULT_GAP as se, DEFAULT_OFFSET as ce, DEFAULT_Z_INDEX as ie, DEFAULT_FONT_WEIGHT as le, DEFAULT_FONT_FAMILY as me, DEFAULT_COLOR_DARK as ue, DEFAULT_COLOR_LIGHT as de, CANVAS_WIDTH_OFFSET as fe, CANVAS_EXTRA_PADDING as ge, HALF as a, DEG_TO_RAD as S, LINE_HEIGHT_MULTIPLIER as Ee, PATTERN_REPEAT_MAX as Ae } from "./Watermark.const.js";
|
|
6
|
+
const Fe = (W) => {
|
|
6
7
|
const {
|
|
7
|
-
children:
|
|
8
|
-
text:
|
|
9
|
-
image:
|
|
10
|
-
fontSize:
|
|
11
|
-
color:
|
|
12
|
-
rotate:
|
|
13
|
-
opacity:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
children: G,
|
|
9
|
+
text: s,
|
|
10
|
+
image: m,
|
|
11
|
+
fontSize: g = ne,
|
|
12
|
+
color: E,
|
|
13
|
+
rotate: A = ae,
|
|
14
|
+
opacity: T = oe,
|
|
15
|
+
patternRepeat: L = H,
|
|
16
|
+
gap: h = se,
|
|
17
|
+
offset: v = ce,
|
|
18
|
+
zIndex: $ = ie,
|
|
19
|
+
fontFamily: _,
|
|
20
|
+
fontWeight: D = le,
|
|
21
|
+
visible: b = !0,
|
|
22
|
+
className: B,
|
|
23
|
+
style: V,
|
|
24
|
+
testId: X
|
|
25
|
+
} = W, c = U(null), k = U(null), u = Q(re), [j, z] = ee(!1);
|
|
26
|
+
M(() => {
|
|
27
|
+
if (u) return;
|
|
25
28
|
const t = window.matchMedia("(prefers-color-scheme: dark)"), e = () => {
|
|
26
|
-
const
|
|
27
|
-
|
|
29
|
+
const o = document.documentElement, p = o.classList.contains("dark") || o.classList.contains("bear-dark") || t.matches;
|
|
30
|
+
z(p);
|
|
28
31
|
};
|
|
29
32
|
e();
|
|
30
33
|
const r = new MutationObserver(e);
|
|
31
34
|
return r.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("change", e), () => {
|
|
32
35
|
r.disconnect(), t.removeEventListener("change", e);
|
|
33
36
|
};
|
|
34
|
-
}, []);
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
+
}, [u]);
|
|
38
|
+
const I = u ? u.mode === "dark" : j, x = F(() => {
|
|
39
|
+
if (_) return _;
|
|
37
40
|
if (typeof window < "u") {
|
|
38
|
-
const t =
|
|
39
|
-
if (
|
|
41
|
+
const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--bear-font-sans");
|
|
42
|
+
if (e.trim()) return e.trim();
|
|
43
|
+
const r = getComputedStyle(t).getPropertyValue("--bear-font-family");
|
|
44
|
+
if (r.trim()) return r.trim();
|
|
40
45
|
}
|
|
41
|
-
return
|
|
42
|
-
}, [
|
|
43
|
-
if (!
|
|
46
|
+
return me;
|
|
47
|
+
}, [_]), y = F(() => E || (I ? ue : de), [E, I]), R = te(() => {
|
|
48
|
+
if (!b || !s && !m) return "";
|
|
44
49
|
const t = document.createElement("canvas"), e = t.getContext("2d");
|
|
45
50
|
if (!e) return "";
|
|
46
|
-
const r = Array.isArray(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const r = Array.isArray(s) ? s : s ? [s] : [], o = g * Ee, p = r.length * o, d = h[0] + fe, f = h[1] + p + ge;
|
|
52
|
+
t.width = d, t.height = f;
|
|
53
|
+
const i = Math.min(Ae, Math.max(H, Math.floor(L))), N = d / i, C = f / i, w = (n, l) => {
|
|
54
|
+
e.save(), e.translate(n, l), e.rotate(A * S), e.font = `${D} ${g}px ${x}`, e.fillStyle = y, e.globalAlpha = T, e.textAlign = "center", e.textBaseline = "middle", r.forEach((Y, Z) => {
|
|
55
|
+
const q = (Z - (r.length - 1) / a) * o;
|
|
56
|
+
e.fillText(Y, 0, q);
|
|
57
|
+
}), e.restore();
|
|
58
|
+
};
|
|
59
|
+
if (m) {
|
|
60
|
+
e.save(), e.translate(d / a, f / a), e.rotate(A * S);
|
|
61
|
+
const n = new Image();
|
|
62
|
+
n.crossOrigin = "anonymous", n.src = m, e.globalAlpha = T, e.drawImage(n, -n.width / a, -n.height / a), e.restore();
|
|
63
|
+
} else if (i <= 1)
|
|
64
|
+
w(d / a, f / a);
|
|
65
|
+
else
|
|
66
|
+
for (let n = 0; n < i; n++)
|
|
67
|
+
for (let l = 0; l < i; l++)
|
|
68
|
+
w(l * N + N / a, n * C + C / a);
|
|
55
69
|
return t.toDataURL();
|
|
56
|
-
}, [
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
}, [
|
|
71
|
+
s,
|
|
72
|
+
m,
|
|
73
|
+
g,
|
|
74
|
+
y,
|
|
75
|
+
A,
|
|
76
|
+
T,
|
|
77
|
+
h,
|
|
78
|
+
x,
|
|
79
|
+
D,
|
|
80
|
+
b,
|
|
81
|
+
L
|
|
82
|
+
]), O = F(() => R(), [R]);
|
|
83
|
+
return M(() => {
|
|
84
|
+
const t = k.current;
|
|
59
85
|
if (!t) return;
|
|
60
86
|
const e = new MutationObserver(() => {
|
|
61
|
-
var r,
|
|
62
|
-
(r =
|
|
87
|
+
var r, o;
|
|
88
|
+
(r = c.current) != null && r.contains(t) || (o = c.current) == null || o.appendChild(t);
|
|
63
89
|
});
|
|
64
|
-
return
|
|
65
|
-
}, []), /* @__PURE__ */
|
|
90
|
+
return c.current && e.observe(c.current, { childList: !0 }), () => e.disconnect();
|
|
91
|
+
}, []), /* @__PURE__ */ K(
|
|
66
92
|
"div",
|
|
67
93
|
{
|
|
68
|
-
ref:
|
|
69
|
-
className:
|
|
70
|
-
style:
|
|
71
|
-
"data-testid":
|
|
94
|
+
ref: c,
|
|
95
|
+
className: P("Bear-Watermark", "bear-relative", B),
|
|
96
|
+
style: V,
|
|
97
|
+
"data-testid": X,
|
|
72
98
|
children: [
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
G,
|
|
100
|
+
b && O && /* @__PURE__ */ J(
|
|
75
101
|
"div",
|
|
76
102
|
{
|
|
77
|
-
ref:
|
|
78
|
-
className:
|
|
103
|
+
ref: k,
|
|
104
|
+
className: P(
|
|
79
105
|
"Bear-Watermark__overlay",
|
|
80
106
|
"bear-absolute bear-inset-0 bear-pointer-events-none bear-bg-repeat"
|
|
81
107
|
),
|
|
82
108
|
style: {
|
|
83
|
-
backgroundImage: `url(${
|
|
84
|
-
backgroundPosition: `${
|
|
85
|
-
zIndex:
|
|
109
|
+
backgroundImage: `url(${O})`,
|
|
110
|
+
backgroundPosition: `${v[0]}px ${v[1]}px`,
|
|
111
|
+
zIndex: $
|
|
86
112
|
},
|
|
87
113
|
"aria-hidden": "true"
|
|
88
114
|
}
|
|
@@ -92,5 +118,5 @@ const ie = (y) => {
|
|
|
92
118
|
);
|
|
93
119
|
};
|
|
94
120
|
export {
|
|
95
|
-
|
|
121
|
+
Fe as Watermark
|
|
96
122
|
};
|
|
@@ -14,6 +14,8 @@ export interface WatermarkProps {
|
|
|
14
14
|
rotate?: number;
|
|
15
15
|
/** Opacity (0-1) */
|
|
16
16
|
opacity?: number;
|
|
17
|
+
/** How many staggered copies of the mark to paint inside each pattern tile (1–4 per axis). Higher = denser field. */
|
|
18
|
+
patternRepeat?: number;
|
|
17
19
|
/** Gap between watermarks [horizontal, vertical] */
|
|
18
20
|
gap?: [number, number];
|
|
19
21
|
/** Offset from top-left [x, y] */
|