@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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as r, jsxs as C, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useCallback as R, useEffect as T } from "react";
|
|
3
|
+
import { cn as O } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_THRESHOLD as x, ROOT_CLASSES as D, SENTINEL_HEIGHT as E, MANUAL_BTN_CLASSES as H, END_CLASSES as y, LOADER_CLASSES as j, SPINNER_CLASSES as k } from "./InfiniteScroll.const.js";
|
|
5
|
+
const G = (N) => {
|
|
6
|
+
const {
|
|
7
|
+
onLoadMore: i,
|
|
8
|
+
hasMore: e,
|
|
9
|
+
loading: t = !1,
|
|
10
|
+
threshold: l = x,
|
|
11
|
+
manual: n = !1,
|
|
12
|
+
loader: c,
|
|
13
|
+
endMessage: d,
|
|
14
|
+
loadMoreLabel: v = "Load more",
|
|
15
|
+
inverse: s = !1,
|
|
16
|
+
children: A,
|
|
17
|
+
className: g,
|
|
18
|
+
testId: M,
|
|
19
|
+
..._
|
|
20
|
+
} = N, o = L(null), f = L(t);
|
|
21
|
+
f.current = t;
|
|
22
|
+
const a = R(() => {
|
|
23
|
+
f.current || !e || i();
|
|
24
|
+
}, [i, e]);
|
|
25
|
+
T(() => {
|
|
26
|
+
if (n || !e) return;
|
|
27
|
+
const h = o.current;
|
|
28
|
+
if (!h) return;
|
|
29
|
+
const m = new IntersectionObserver(
|
|
30
|
+
(p) => {
|
|
31
|
+
var u;
|
|
32
|
+
(u = p[0]) != null && u.isIntersecting && a();
|
|
33
|
+
},
|
|
34
|
+
{ threshold: 0, rootMargin: `${Math.round(l * 100)}px` }
|
|
35
|
+
);
|
|
36
|
+
return m.observe(h), () => m.disconnect();
|
|
37
|
+
}, [n, e, a, l]);
|
|
38
|
+
const S = /* @__PURE__ */ r("div", { className: j, children: /* @__PURE__ */ r("div", { className: k }) }), b = /* @__PURE__ */ C(I, { children: [
|
|
39
|
+
s && e && !n && /* @__PURE__ */ r("div", { ref: o, style: { height: E } }),
|
|
40
|
+
s && t && (c ?? S),
|
|
41
|
+
A,
|
|
42
|
+
!s && t && (c ?? S),
|
|
43
|
+
!s && e && !n && /* @__PURE__ */ r("div", { ref: o, style: { height: E } }),
|
|
44
|
+
e && n && !t && /* @__PURE__ */ r("button", { type: "button", onClick: a, className: H, children: v }),
|
|
45
|
+
!e && d && /* @__PURE__ */ r("div", { className: y, children: d })
|
|
46
|
+
] });
|
|
47
|
+
return /* @__PURE__ */ r("div", { className: O(D, g), "data-testid": M, ..._, children: b });
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
G as InfiniteScroll
|
|
51
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface InfiniteScrollProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
onLoadMore: () => void | Promise<void>;
|
|
4
|
+
hasMore: boolean;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
threshold?: number;
|
|
7
|
+
manual?: boolean;
|
|
8
|
+
loader?: ReactNode;
|
|
9
|
+
endMessage?: ReactNode;
|
|
10
|
+
loadMoreLabel?: string;
|
|
11
|
+
inverse?: boolean;
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),d=require("../../utils/cn.cjs"),ae=require("../../context/BearProvider.cjs"),L=require("./components/ClearIcon/ClearIcon.cjs"),te=require("./Input.utils.cjs"),se=require("../Form/Form.utils.cjs"),be={sm:"bear-h-8 bear-text-sm bear-px-3",md:"bear-h-10 bear-text-base bear-px-4",lg:"bear-h-12 bear-text-lg bear-px-5"},P=s.forwardRef(({label:B,helperText:T,error:f,success:j,size:V="md",leftAddon:x,rightAddon:b,fullWidth:D=!1,clearable:G=!1,onClear:m,showCharCount:N=!1,charCountMax:H,autoFormat:g,validation:t,validateOnBlur:J,validateOnChange:w=!1,className:K,disabled:p,value:_,defaultValue:y,maxLength:v,onChange:l,onBlur:n,...Q},U)=>{var F;const h=s.useContext(ae.BearContext),e=(F=h==null?void 0:h.components)==null?void 0:F.Input,W=e==null?void 0:e.root,X=e==null?void 0:e.input,Y=e==null?void 0:e.label,Z=e==null?void 0:e.helper,$=e==null?void 0:e.prefix,q=e==null?void 0:e.suffix,[S,C]=s.useState(null),E=s.useRef(!1),R=t?J??!0:!1,M=f||S,c=!!M,O=!!j&&!c,u=H??v,I=typeof _=="string"?_.length:typeof y=="string"?y.length:0,A=u!=null&&I>u,k=G&&!p&&I>0,z=M||j||T,i=s.useCallback(async a=>{if(!t)return;E.current=!0;const o=await se.validateFieldValue(a,t);E.current=!1,C(o)},[t]);s.useEffect(()=>{f&&C(null)},[f]);const ee=s.useCallback(a=>{if(g){const o=te.applyAutoFormat(a.target.value,g);o!==a.target.value&&(a.target.value=o)}l==null||l(a),w&&t&&i(a.target.value)},[g,l,w,t,i]),re=s.useCallback(a=>{n==null||n(a),R&&t&&i(a.target.value)},[n,R,t,i]);return r.jsxs("div",{className:d.cn("Bear-Input bear-flex bear-flex-col bear-gap-1.5",D&&"bear-w-full"),style:W,children:[B&&r.jsx("label",{className:"Bear-Input__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",style:Y,children:B}),r.jsxs("div",{className:"Bear-Input__wrapper bear-relative bear-flex bear-items-center",children:[x&&r.jsx("div",{className:"Bear-Input__addon Bear-Input__addon--left bear-absolute bear-left-3 bear-text-gray-500 dark:bear-text-gray-400",style:$,children:x}),r.jsx("input",{ref:U,disabled:p,value:_,defaultValue:y,maxLength:v,"aria-invalid":c||void 0,onChange:ee,onBlur:re,className:d.cn("Bear-Input__field","bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200","bear-bg-white bear-text-gray-900 placeholder:bear-text-gray-400","bear-border-gray-300 focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-white","dark:bear-bg-gray-800 dark:bear-text-white dark:placeholder:bear-text-gray-500 dark:bear-border-gray-600 dark:focus:bear-ring-offset-gray-900",c?"Bear-Input__field--error bear-border-red-500 focus:bear-ring-red-500":O?"Bear-Input__field--success bear-border-green-500 focus:bear-ring-green-500":"focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",p&&"Bear-Input__field--disabled bear-opacity-50 bear-cursor-not-allowed",x&&"bear-pl-10",(b||k)&&"bear-pr-10",be[V],K),style:X,...Q}),k&&!b&&r.jsx("div",{className:"Bear-Input__addon Bear-Input__addon--right bear-absolute bear-right-3 bear-text-gray-500 dark:bear-text-gray-400",style:q,children:r.jsx(L.ClearIcon,{onClick:m})}),b&&r.jsxs("div",{className:"Bear-Input__addon Bear-Input__addon--right bear-absolute bear-right-3 bear-flex bear-items-center bear-gap-1.5 bear-text-gray-500 dark:bear-text-gray-400",style:q,children:[k&&r.jsx(L.ClearIcon,{onClick:m}),b]})]}),r.jsxs("div",{className:"Bear-Input__footer bear-flex bear-items-center bear-justify-between bear-gap-2",children:[z?r.jsx("p",{className:d.cn("Bear-Input__helper bear-text-sm bear-flex-1",c?"Bear-Input__helper--error bear-text-red-500":O?"Bear-Input__helper--success bear-text-green-500":"bear-text-gray-500 dark:bear-text-gray-400"),style:Z,children:z}):N?r.jsx("span",{}):null,N&&u!=null&&r.jsxs("span",{className:d.cn("Bear-Input__char-count bear-text-xs bear-tabular-nums bear-shrink-0",A?"bear-text-red-500":"bear-text-gray-400 dark:bear-text-gray-500"),children:[I,"/",u]})]})]})});P.displayName="Input";exports.Input=P;
|
|
@@ -1,65 +1,135 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ae, useContext as te, useState as se, useRef as be, useCallback as B, useEffect as le } from "react";
|
|
3
|
+
import { cn as f } from "../../utils/cn.js";
|
|
4
|
+
import { BearContext as ne } from "../../context/BearProvider.js";
|
|
5
|
+
import { ClearIcon as D } from "./components/ClearIcon/ClearIcon.js";
|
|
6
|
+
import { applyAutoFormat as ce } from "./Input.utils.js";
|
|
7
|
+
import { validateFieldValue as ie } from "../Form/Form.utils.js";
|
|
8
|
+
const ue = {
|
|
5
9
|
sm: "bear-h-8 bear-text-sm bear-px-3",
|
|
6
10
|
md: "bear-h-10 bear-text-base bear-px-4",
|
|
7
11
|
lg: "bear-h-12 bear-text-lg bear-px-5"
|
|
8
|
-
},
|
|
12
|
+
}, oe = ae(
|
|
9
13
|
({
|
|
10
|
-
label:
|
|
11
|
-
helperText:
|
|
12
|
-
error:
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
label: k,
|
|
15
|
+
helperText: F,
|
|
16
|
+
error: d,
|
|
17
|
+
success: N,
|
|
18
|
+
size: G = "md",
|
|
19
|
+
leftAddon: p,
|
|
15
20
|
rightAddon: b,
|
|
16
|
-
fullWidth:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
fullWidth: H = !1,
|
|
22
|
+
clearable: J = !1,
|
|
23
|
+
onClear: w,
|
|
24
|
+
showCharCount: v = !1,
|
|
25
|
+
charCountMax: K,
|
|
26
|
+
autoFormat: g,
|
|
27
|
+
validation: a,
|
|
28
|
+
validateOnBlur: Q,
|
|
29
|
+
validateOnChange: E = !1,
|
|
30
|
+
className: T,
|
|
31
|
+
disabled: x,
|
|
32
|
+
value: _,
|
|
33
|
+
defaultValue: y,
|
|
34
|
+
maxLength: j,
|
|
35
|
+
onChange: l,
|
|
36
|
+
onBlur: n,
|
|
37
|
+
...U
|
|
38
|
+
}, W) => {
|
|
39
|
+
var q;
|
|
40
|
+
const h = te(ne), e = (q = h == null ? void 0 : h.components) == null ? void 0 : q.Input, X = e == null ? void 0 : e.root, Y = e == null ? void 0 : e.input, Z = e == null ? void 0 : e.label, $ = e == null ? void 0 : e.helper, P = e == null ? void 0 : e.prefix, M = e == null ? void 0 : e.suffix, [S, R] = se(null), z = be(!1), C = a ? Q ?? !0 : !1, L = d || S, c = !!L, O = !!N && !c, i = K ?? j, m = typeof _ == "string" ? _.length : typeof y == "string" ? y.length : 0, A = i != null && m > i, I = J && !x && m > 0, V = L || N || F, u = B(async (r) => {
|
|
41
|
+
if (!a) return;
|
|
42
|
+
z.current = !0;
|
|
43
|
+
const o = await ie(r, a);
|
|
44
|
+
z.current = !1, R(o);
|
|
45
|
+
}, [a]);
|
|
46
|
+
le(() => {
|
|
47
|
+
d && R(null);
|
|
48
|
+
}, [d]);
|
|
49
|
+
const ee = B(
|
|
50
|
+
(r) => {
|
|
51
|
+
if (g) {
|
|
52
|
+
const o = ce(r.target.value, g);
|
|
53
|
+
o !== r.target.value && (r.target.value = o);
|
|
54
|
+
}
|
|
55
|
+
l == null || l(r), E && a && u(r.target.value);
|
|
56
|
+
},
|
|
57
|
+
[g, l, E, a, u]
|
|
58
|
+
), re = B(
|
|
59
|
+
(r) => {
|
|
60
|
+
n == null || n(r), C && a && u(r.target.value);
|
|
61
|
+
},
|
|
62
|
+
[n, C, a, u]
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ s("div", { className: f("Bear-Input bear-flex bear-flex-col bear-gap-1.5", H && "bear-w-full"), style: X, children: [
|
|
65
|
+
k && /* @__PURE__ */ t("label", { className: "Bear-Input__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", style: Z, children: k }),
|
|
66
|
+
/* @__PURE__ */ s("div", { className: "Bear-Input__wrapper bear-relative bear-flex bear-items-center", children: [
|
|
67
|
+
p && /* @__PURE__ */ t("div", { className: "Bear-Input__addon Bear-Input__addon--left bear-absolute bear-left-3 bear-text-gray-500 dark:bear-text-gray-400", style: P, children: p }),
|
|
68
|
+
/* @__PURE__ */ t(
|
|
27
69
|
"input",
|
|
28
70
|
{
|
|
29
|
-
ref:
|
|
30
|
-
disabled:
|
|
31
|
-
|
|
71
|
+
ref: W,
|
|
72
|
+
disabled: x,
|
|
73
|
+
value: _,
|
|
74
|
+
defaultValue: y,
|
|
75
|
+
maxLength: j,
|
|
76
|
+
"aria-invalid": c || void 0,
|
|
77
|
+
onChange: ee,
|
|
78
|
+
onBlur: re,
|
|
79
|
+
className: f(
|
|
32
80
|
"Bear-Input__field",
|
|
33
81
|
"bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200",
|
|
34
82
|
"bear-bg-white bear-text-gray-900 placeholder:bear-text-gray-400",
|
|
35
83
|
"bear-border-gray-300 focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-white",
|
|
36
84
|
"dark:bear-bg-gray-800 dark:bear-text-white dark:placeholder:bear-text-gray-500 dark:bear-border-gray-600 dark:focus:bear-ring-offset-gray-900",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
b && "bear-pr-10",
|
|
41
|
-
|
|
42
|
-
|
|
85
|
+
c ? "Bear-Input__field--error bear-border-red-500 focus:bear-ring-red-500" : O ? "Bear-Input__field--success bear-border-green-500 focus:bear-ring-green-500" : "focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",
|
|
86
|
+
x && "Bear-Input__field--disabled bear-opacity-50 bear-cursor-not-allowed",
|
|
87
|
+
p && "bear-pl-10",
|
|
88
|
+
(b || I) && "bear-pr-10",
|
|
89
|
+
ue[G],
|
|
90
|
+
T
|
|
43
91
|
),
|
|
44
|
-
|
|
92
|
+
style: Y,
|
|
93
|
+
...U
|
|
45
94
|
}
|
|
46
95
|
),
|
|
47
|
-
b && /* @__PURE__ */
|
|
96
|
+
I && !b && /* @__PURE__ */ t("div", { className: "Bear-Input__addon Bear-Input__addon--right bear-absolute bear-right-3 bear-text-gray-500 dark:bear-text-gray-400", style: M, children: /* @__PURE__ */ t(D, { onClick: w }) }),
|
|
97
|
+
b && /* @__PURE__ */ s("div", { className: "Bear-Input__addon Bear-Input__addon--right bear-absolute bear-right-3 bear-flex bear-items-center bear-gap-1.5 bear-text-gray-500 dark:bear-text-gray-400", style: M, children: [
|
|
98
|
+
I && /* @__PURE__ */ t(D, { onClick: w }),
|
|
99
|
+
b
|
|
100
|
+
] })
|
|
48
101
|
] }),
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
102
|
+
/* @__PURE__ */ s("div", { className: "Bear-Input__footer bear-flex bear-items-center bear-justify-between bear-gap-2", children: [
|
|
103
|
+
V ? /* @__PURE__ */ t(
|
|
104
|
+
"p",
|
|
105
|
+
{
|
|
106
|
+
className: f(
|
|
107
|
+
"Bear-Input__helper bear-text-sm bear-flex-1",
|
|
108
|
+
c ? "Bear-Input__helper--error bear-text-red-500" : O ? "Bear-Input__helper--success bear-text-green-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
109
|
+
),
|
|
110
|
+
style: $,
|
|
111
|
+
children: V
|
|
112
|
+
}
|
|
113
|
+
) : v ? /* @__PURE__ */ t("span", {}) : null,
|
|
114
|
+
v && i != null && /* @__PURE__ */ s(
|
|
115
|
+
"span",
|
|
116
|
+
{
|
|
117
|
+
className: f(
|
|
118
|
+
"Bear-Input__char-count bear-text-xs bear-tabular-nums bear-shrink-0",
|
|
119
|
+
A ? "bear-text-red-500" : "bear-text-gray-400 dark:bear-text-gray-500"
|
|
120
|
+
),
|
|
121
|
+
children: [
|
|
122
|
+
m,
|
|
123
|
+
"/",
|
|
124
|
+
i
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
59
129
|
] });
|
|
60
130
|
}
|
|
61
131
|
);
|
|
62
|
-
|
|
132
|
+
oe.displayName = "Input";
|
|
63
133
|
export {
|
|
64
|
-
|
|
134
|
+
oe as Input
|
|
65
135
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ValidationRule } from '../Form/Form.types';
|
|
3
|
+
export type AutoFormatType = 'capitalize' | 'uppercase' | 'lowercase' | 'titleCase' | 'sentenceCase' | 'none';
|
|
2
4
|
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
3
5
|
/** Input label */
|
|
4
6
|
label?: string;
|
|
@@ -6,6 +8,8 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
6
8
|
helperText?: string;
|
|
7
9
|
/** Error message */
|
|
8
10
|
error?: string;
|
|
11
|
+
/** Success message (green helper text) */
|
|
12
|
+
success?: string;
|
|
9
13
|
/** Input size */
|
|
10
14
|
size?: 'sm' | 'md' | 'lg';
|
|
11
15
|
/** Left addon */
|
|
@@ -14,4 +18,20 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
14
18
|
rightAddon?: ReactNode;
|
|
15
19
|
/** Whether input is full width */
|
|
16
20
|
fullWidth?: boolean;
|
|
21
|
+
/** Show a clear (X) button when input has value */
|
|
22
|
+
clearable?: boolean;
|
|
23
|
+
/** Callback when clear button is clicked */
|
|
24
|
+
onClear?: () => void;
|
|
25
|
+
/** Show live character count (requires maxLength or charCountMax) */
|
|
26
|
+
showCharCount?: boolean;
|
|
27
|
+
/** Max chars for counter display (alternative to maxLength when you don't want native enforcement) */
|
|
28
|
+
charCountMax?: number;
|
|
29
|
+
/** Auto-format text on change using Anvil string utils */
|
|
30
|
+
autoFormat?: AutoFormatType;
|
|
31
|
+
/** Validation rules (reuses Form's ValidationRule) */
|
|
32
|
+
validation?: ValidationRule;
|
|
33
|
+
/** Run validation on blur (default true when validation is set) */
|
|
34
|
+
validateOnBlur?: boolean;
|
|
35
|
+
/** Run validation on change */
|
|
36
|
+
validateOnChange?: boolean;
|
|
17
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@forgedevstack/anvil"),n=e=>e.toUpperCase(),a=e=>e.toLowerCase(),r={capitalize:o.capitalize,uppercase:n,lowercase:a,titleCase:o.titleCase,sentenceCase:o.sentenceCase},c=(e,t)=>{if(!t||t==="none")return e;const s=r[t];return s?s(e):e};exports.applyAutoFormat=c;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sentenceCase as s, titleCase as n, capitalize as r } from "@forgedevstack/anvil";
|
|
2
|
+
const p = (e) => e.toUpperCase(), c = (e) => e.toLowerCase(), a = {
|
|
3
|
+
capitalize: r,
|
|
4
|
+
uppercase: p,
|
|
5
|
+
lowercase: c,
|
|
6
|
+
titleCase: n,
|
|
7
|
+
sentenceCase: s
|
|
8
|
+
}, i = (e, t) => {
|
|
9
|
+
if (!t || t === "none") return e;
|
|
10
|
+
const o = a[t];
|
|
11
|
+
return o ? o(e) : e;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
i as applyAutoFormat
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../../../utils/cn.cjs");require("react");const t=({className:r,onClick:a})=>e.jsx("button",{type:"button",tabIndex:-1,onClick:a,className:n.cn("Bear-Input__clear bear-inline-flex bear-items-center bear-justify-center","bear-rounded-full bear-w-4 bear-h-4 bear-bg-gray-300 dark:bear-bg-gray-600","hover:bear-bg-gray-400 dark:hover:bear-bg-gray-500 bear-transition-colors bear-cursor-pointer",r),"aria-label":"Clear input",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[e.jsx("line",{x1:"1",y1:"1",x2:"7",y2:"7"}),e.jsx("line",{x1:"7",y1:"1",x2:"1",y2:"7"})]})});exports.ClearIcon=t;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as o } from "../../../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
const l = ({ className: e, onClick: a }) => /* @__PURE__ */ r(
|
|
5
|
+
"button",
|
|
6
|
+
{
|
|
7
|
+
type: "button",
|
|
8
|
+
tabIndex: -1,
|
|
9
|
+
onClick: a,
|
|
10
|
+
className: o(
|
|
11
|
+
"Bear-Input__clear bear-inline-flex bear-items-center bear-justify-center",
|
|
12
|
+
"bear-rounded-full bear-w-4 bear-h-4 bear-bg-gray-300 dark:bear-bg-gray-600",
|
|
13
|
+
"hover:bear-bg-gray-400 dark:hover:bear-bg-gray-500 bear-transition-colors bear-cursor-pointer",
|
|
14
|
+
e
|
|
15
|
+
),
|
|
16
|
+
"aria-label": "Clear input",
|
|
17
|
+
children: /* @__PURE__ */ t("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
|
|
18
|
+
/* @__PURE__ */ r("line", { x1: "1", y1: "1", x2: "7", y2: "7" }),
|
|
19
|
+
/* @__PURE__ */ r("line", { x1: "7", y1: "1", x2: "1", y2: "7" })
|
|
20
|
+
] })
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
l as ClearIcon
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ClearIcon } from './ClearIcon';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Input } from './Input';
|
|
2
|
-
export type { InputProps } from './Input.types';
|
|
2
|
+
export type { InputProps, AutoFormatType } from './Input.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../utils/cn.cjs");require("react");const r=require("../Typography/Typography.cjs"),y=({label:a,description:t,error:n,helperText:u,required:p=!1,fullWidth:c=!1,children:i,className:d,htmlFor:b,testId:x})=>{const s=!!n,o=n||u;return e.jsxs("div",{className:l.cn("Bear-InputGroup bear-flex bear-flex-col bear-gap-1.5",c&&"bear-w-full",d),"data-testid":x,children:[a&&e.jsx("label",{htmlFor:b,className:"Bear-InputGroup__label",children:e.jsxs(r.Typography,{variant:"body2",className:"bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",inline:!0,children:[a,p&&e.jsx("span",{className:"Bear-InputGroup__required bear-text-red-500 bear-ml-0.5","aria-hidden":"true",children:"*"})]})}),t&&e.jsx(r.Typography,{variant:"caption",className:"Bear-InputGroup__description bear-text-gray-500 dark:bear-text-gray-400",children:t}),e.jsx("div",{className:"Bear-InputGroup__content",children:i}),o&&e.jsx(r.Typography,{variant:"body2",className:l.cn("Bear-InputGroup__helper",s?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),role:s?"alert":void 0,children:o})]})};exports.InputGroup=y;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as p } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Typography as r } from "../Typography/Typography.js";
|
|
5
|
+
const g = ({
|
|
6
|
+
label: a,
|
|
7
|
+
description: t,
|
|
8
|
+
error: n,
|
|
9
|
+
helperText: i,
|
|
10
|
+
required: d = !1,
|
|
11
|
+
fullWidth: c = !1,
|
|
12
|
+
children: u,
|
|
13
|
+
className: b,
|
|
14
|
+
htmlFor: m,
|
|
15
|
+
testId: x
|
|
16
|
+
}) => {
|
|
17
|
+
const o = !!n, l = n || i;
|
|
18
|
+
return /* @__PURE__ */ s(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: p("Bear-InputGroup bear-flex bear-flex-col bear-gap-1.5", c && "bear-w-full", b),
|
|
22
|
+
"data-testid": x,
|
|
23
|
+
children: [
|
|
24
|
+
a && /* @__PURE__ */ e("label", { htmlFor: m, className: "Bear-InputGroup__label", children: /* @__PURE__ */ s(
|
|
25
|
+
r,
|
|
26
|
+
{
|
|
27
|
+
variant: "body2",
|
|
28
|
+
className: "bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",
|
|
29
|
+
inline: !0,
|
|
30
|
+
children: [
|
|
31
|
+
a,
|
|
32
|
+
d && /* @__PURE__ */ e("span", { className: "Bear-InputGroup__required bear-text-red-500 bear-ml-0.5", "aria-hidden": "true", children: "*" })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
) }),
|
|
36
|
+
t && /* @__PURE__ */ e(
|
|
37
|
+
r,
|
|
38
|
+
{
|
|
39
|
+
variant: "caption",
|
|
40
|
+
className: "Bear-InputGroup__description bear-text-gray-500 dark:bear-text-gray-400",
|
|
41
|
+
children: t
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ e("div", { className: "Bear-InputGroup__content", children: u }),
|
|
45
|
+
l && /* @__PURE__ */ e(
|
|
46
|
+
r,
|
|
47
|
+
{
|
|
48
|
+
variant: "body2",
|
|
49
|
+
className: p(
|
|
50
|
+
"Bear-InputGroup__helper",
|
|
51
|
+
o ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
52
|
+
),
|
|
53
|
+
role: o ? "alert" : void 0,
|
|
54
|
+
children: l
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
g as InputGroup
|
|
63
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface InputGroupProps {
|
|
3
|
+
/** Group label */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Description text (below label, above input) */
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Error message (overrides helperText styling) */
|
|
8
|
+
error?: string;
|
|
9
|
+
/** Helper text (below input) */
|
|
10
|
+
helperText?: string;
|
|
11
|
+
/** Whether the field is required (shows asterisk) */
|
|
12
|
+
required?: boolean;
|
|
13
|
+
/** Whether the group takes full width */
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
/** The input element(s) */
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/** Additional class name */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** HTML for attribute linking label to input */
|
|
20
|
+
htmlFor?: string;
|
|
21
|
+
/** Test ID */
|
|
22
|
+
testId?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("../../utils/cn.cjs");require("react");const y=require("../Typography/Typography.cjs"),A=require("../Spinner/Spinner.cjs"),e=require("./LoadingOverlay.const.cjs"),S={sm:"sm",md:"md",lg:"lg"},_=({visible:a,loader:t,overlayOpacity:n=e.DEFAULT_OVERLAY_OPACITY,overlayBlur:i=e.DEFAULT_OVERLAY_BLUR,zIndex:c=e.DEFAULT_Z_INDEX,loaderSize:o="md",label:s,children:d,className:l,testId:p,...L})=>r.jsxs("div",{className:u.cn(e.ROOT_CLASS,l),"data-testid":p,...L,children:[d,a&&r.jsxs("div",{className:e.OVERLAY_CLASS,style:{opacity:n,backdropFilter:`blur(${i}px)`,WebkitBackdropFilter:`blur(${i}px)`,zIndex:c},"aria-busy":!0,"aria-live":"polite",children:[t??r.jsx(A.Spinner,{size:S[o],className:"bear-text-pink-500 dark:bear-text-pink-400"}),s&&r.jsx(y.Typography,{variant:"body2",color:"secondary",className:e.LABEL_CLASS,children:s})]})]});exports.LoadingOverlay=_;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=.5,a=2,r=10,L="Bear-LoadingOverlay bear-relative",t="bear-absolute bear-inset-0 bear-flex bear-flex-col bear-items-center bear-justify-center bear-transition-opacity bear-duration-200 bear-bg-white/50 dark:bear-bg-zinc-900/50",A="Bear-LoadingOverlay__label bear-mt-2";exports.DEFAULT_OVERLAY_BLUR=a;exports.DEFAULT_OVERLAY_OPACITY=e;exports.DEFAULT_Z_INDEX=r;exports.LABEL_CLASS=A;exports.OVERLAY_CLASS=t;exports.ROOT_CLASS=L;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DEFAULT_OVERLAY_OPACITY = 0.5;
|
|
2
|
+
export declare const DEFAULT_OVERLAY_BLUR = 2;
|
|
3
|
+
export declare const DEFAULT_Z_INDEX = 10;
|
|
4
|
+
export declare const ROOT_CLASS = "Bear-LoadingOverlay bear-relative";
|
|
5
|
+
export declare const OVERLAY_CLASS = "bear-absolute bear-inset-0 bear-flex bear-flex-col bear-items-center bear-justify-center bear-transition-opacity bear-duration-200 bear-bg-white/50 dark:bear-bg-zinc-900/50";
|
|
6
|
+
export declare const LABEL_CLASS = "Bear-LoadingOverlay__label bear-mt-2";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const e = 0.5, a = 2, r = 10, t = "Bear-LoadingOverlay bear-relative", b = "bear-absolute bear-inset-0 bear-flex bear-flex-col bear-items-center bear-justify-center bear-transition-opacity bear-duration-200 bear-bg-white/50 dark:bear-bg-zinc-900/50", n = "Bear-LoadingOverlay__label bear-mt-2";
|
|
2
|
+
export {
|
|
3
|
+
a as DEFAULT_OVERLAY_BLUR,
|
|
4
|
+
e as DEFAULT_OVERLAY_OPACITY,
|
|
5
|
+
r as DEFAULT_Z_INDEX,
|
|
6
|
+
n as LABEL_CLASS,
|
|
7
|
+
b as OVERLAY_CLASS,
|
|
8
|
+
t as ROOT_CLASS
|
|
9
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as L } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Typography as A } from "../Typography/Typography.js";
|
|
5
|
+
import { Spinner as _ } from "../Spinner/Spinner.js";
|
|
6
|
+
import { DEFAULT_Z_INDEX as E, DEFAULT_OVERLAY_BLUR as S, DEFAULT_OVERLAY_OPACITY as b, OVERLAY_CLASS as x, LABEL_CLASS as y, ROOT_CLASS as N } from "./LoadingOverlay.const.js";
|
|
7
|
+
const O = { sm: "sm", md: "md", lg: "lg" }, h = ({
|
|
8
|
+
visible: e,
|
|
9
|
+
loader: o,
|
|
10
|
+
overlayOpacity: m = b,
|
|
11
|
+
overlayBlur: r = S,
|
|
12
|
+
zIndex: s = E,
|
|
13
|
+
loaderSize: p = "md",
|
|
14
|
+
label: i,
|
|
15
|
+
children: d,
|
|
16
|
+
className: c,
|
|
17
|
+
testId: l,
|
|
18
|
+
...n
|
|
19
|
+
}) => /* @__PURE__ */ t("div", { className: L(N, c), "data-testid": l, ...n, children: [
|
|
20
|
+
d,
|
|
21
|
+
e && /* @__PURE__ */ t(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: x,
|
|
25
|
+
style: {
|
|
26
|
+
opacity: m,
|
|
27
|
+
backdropFilter: `blur(${r}px)`,
|
|
28
|
+
WebkitBackdropFilter: `blur(${r}px)`,
|
|
29
|
+
zIndex: s
|
|
30
|
+
},
|
|
31
|
+
"aria-busy": !0,
|
|
32
|
+
"aria-live": "polite",
|
|
33
|
+
children: [
|
|
34
|
+
o ?? /* @__PURE__ */ a(_, { size: O[p], className: "bear-text-pink-500 dark:bear-text-pink-400" }),
|
|
35
|
+
i && /* @__PURE__ */ a(A, { variant: "body2", color: "secondary", className: y, children: i })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] });
|
|
40
|
+
export {
|
|
41
|
+
h as LoadingOverlay
|
|
42
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export interface LoadingOverlayProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
loader?: ReactNode;
|
|
5
|
+
overlayOpacity?: number;
|
|
6
|
+
overlayBlur?: number;
|
|
7
|
+
zIndex?: number;
|
|
8
|
+
loaderSize?: 'sm' | 'md' | 'lg';
|
|
9
|
+
label?: string;
|
|
10
|
+
testId?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),r=require("react"),T=require("../../utils/cn.cjs"),u=require("./NumberFormatter.const.cjs"),_=require("./NumberFormatter.utils.cjs"),g=t=>{const{value:e,prefix:A="",suffix:F="",animated:c=!1,animationDuration:o=u.DEFAULT_ANIMATION_DURATION,className:N,testId:y,...D}=t,M=r.useMemo(()=>_.buildFormatter(t),[t.formatStyle,t.locale,t.currency,t.currencyDisplay,t.unit,t.unitDisplay,t.notation,t.minimumFractionDigits,t.maximumFractionDigits,t.signDisplay]),[R,n]=r.useState(e),a=r.useRef(e),i=r.useRef(0);r.useEffect(()=>{if(!c){n(e),a.current=e;return}const m=a.current,l=e-m;if(l===0)return;const f=Math.max(1,Math.round(o/u.ANIMATION_FRAME_RATE));let s=0;const d=()=>{s++;const q=s/f,I=1-Math.pow(1-q,3);n(m+l*I),s<f?i.current=requestAnimationFrame(d):(n(e),a.current=e)};return i.current=requestAnimationFrame(d),()=>cancelAnimationFrame(i.current)},[e,c,o]);const b=M.format(R);return S.jsxs("span",{className:T.cn(u.ROOT_CLASSES,N),"data-testid":y,...D,children:[A,b,F]})};exports.NumberFormatter=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A="en-US",T="USD",E=400,e=16,t="Bear-NumberFormatter bear-inline bear-tabular-nums";exports.ANIMATION_FRAME_RATE=e;exports.DEFAULT_ANIMATION_DURATION=E;exports.DEFAULT_CURRENCY=T;exports.DEFAULT_LOCALE=A;exports.ROOT_CLASSES=t;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DEFAULT_LOCALE = "en-US";
|
|
2
|
+
export declare const DEFAULT_CURRENCY = "USD";
|
|
3
|
+
export declare const DEFAULT_ANIMATION_DURATION = 400;
|
|
4
|
+
export declare const ANIMATION_FRAME_RATE = 16;
|
|
5
|
+
export declare const ROOT_CLASSES = "Bear-NumberFormatter bear-inline bear-tabular-nums";
|