@forgedevstack/bear 1.1.3 → 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/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/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/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/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 +99 -66
- package/dist/components/Input/Input.types.d.ts +10 -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/index.d.ts +1 -1
- 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/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/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/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 +44 -0
- package/dist/components/index.js +353 -306
- package/dist/index.cjs +1 -1
- package/dist/index.js +439 -392
- 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/package.json +10 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const r = {
|
|
2
|
+
default: "bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-bg-transparent",
|
|
3
|
+
filled: "bear-border-0 bear-bg-gray-50 dark:bear-bg-gray-800/50",
|
|
4
|
+
unstyled: "bear-border-0 bear-bg-transparent"
|
|
5
|
+
}, e = {
|
|
6
|
+
sm: "bear-rounded-sm",
|
|
7
|
+
md: "bear-rounded-md",
|
|
8
|
+
lg: "bear-rounded-lg"
|
|
9
|
+
}, a = "bear-px-2 bear-ml-2 bear-text-gray-900 dark:bear-text-gray-100", b = "bear-mt-1 bear-mb-3 bear-text-gray-600 dark:bear-text-gray-400", t = "Bear-Fieldset bear-w-full bear-p-4 bear-pt-5";
|
|
10
|
+
export {
|
|
11
|
+
b as DESCRIPTION_CLASSES,
|
|
12
|
+
a as LEGEND_CLASSES,
|
|
13
|
+
e as RADIUS_MAP,
|
|
14
|
+
t as ROOT_CLASS,
|
|
15
|
+
r as VARIANT_CLASSES
|
|
16
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs as S, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cn as d } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Typography as o } from "../Typography/Typography.js";
|
|
5
|
+
import { LEGEND_CLASSES as p, DESCRIPTION_CLASSES as A, RADIUS_MAP as f, VARIANT_CLASSES as N, ROOT_CLASS as b } from "./Fieldset.const.js";
|
|
6
|
+
const h = ({
|
|
7
|
+
legend: e,
|
|
8
|
+
description: a,
|
|
9
|
+
variant: i = "default",
|
|
10
|
+
radius: m = "md",
|
|
11
|
+
disabled: t = !1,
|
|
12
|
+
children: s,
|
|
13
|
+
testId: c,
|
|
14
|
+
className: l,
|
|
15
|
+
...n
|
|
16
|
+
}) => /* @__PURE__ */ S(
|
|
17
|
+
"fieldset",
|
|
18
|
+
{
|
|
19
|
+
disabled: t,
|
|
20
|
+
className: d(
|
|
21
|
+
b,
|
|
22
|
+
N[i],
|
|
23
|
+
f[m],
|
|
24
|
+
t && "bear-opacity-50 bear-pointer-events-none",
|
|
25
|
+
l
|
|
26
|
+
),
|
|
27
|
+
"data-testid": c,
|
|
28
|
+
...n,
|
|
29
|
+
children: [
|
|
30
|
+
e && /* @__PURE__ */ r("legend", { className: p, children: /* @__PURE__ */ r(o, { variant: "body2", weight: "medium", children: e }) }),
|
|
31
|
+
a && /* @__PURE__ */ r(
|
|
32
|
+
o,
|
|
33
|
+
{
|
|
34
|
+
variant: "caption",
|
|
35
|
+
color: "secondary",
|
|
36
|
+
className: e ? A : "bear-mb-3 bear-block",
|
|
37
|
+
children: a
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
s
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
h.displayName = "Fieldset";
|
|
45
|
+
export {
|
|
46
|
+
h as Fieldset
|
|
47
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode, FieldsetHTMLAttributes } from 'react';
|
|
2
|
+
export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
3
|
+
legend?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
variant?: 'default' | 'filled' | 'unstyled';
|
|
6
|
+
radius?: 'sm' | 'md' | 'lg';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
testId?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),h=require("../../utils/cn.cjs"),l=require("./ImageGallery.const.cjs"),j=({images:S,currentIndex:s,onClose:t,onNavigate:a})=>{const i=S[s],o=S.length;return d.useEffect(()=>{const r=n=>{n.key==="Escape"&&t(),n.key==="ArrowLeft"&&s>0&&a(s-1),n.key==="ArrowRight"&&s<o-1&&a(s+1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[s,o,t,a]),e.jsxs("div",{className:l.OVERLAY_CLASSES,onClick:t,role:"dialog","aria-label":"Image lightbox",children:[e.jsx("div",{onClick:r=>r.stopPropagation(),children:e.jsx("img",{src:i.src,alt:i.alt??"",className:l.LIGHTBOX_IMG_CLASSES})}),e.jsx("button",{className:l.CLOSE_BTN_CLASSES,onClick:t,"aria-label":"Close",children:"✕"}),s>0&&e.jsx("button",{className:h.cn(l.NAV_BTN_CLASSES,"bear-left-4"),onClick:()=>a(s-1),"aria-label":"Previous",children:e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),s<o-1&&e.jsx("button",{className:h.cn(l.NAV_BTN_CLASSES,"bear-right-4"),onClick:()=>a(s+1),"aria-label":"Next",children:e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}),i.caption&&e.jsx("div",{className:l.CAPTION_CLASSES,children:i.caption}),e.jsxs("div",{className:l.COUNTER_CLASSES,children:[s+1," / ",o]})]})},k=S=>{const{images:s,columns:t=l.DEFAULT_COLUMNS,gap:a=l.DEFAULT_GAP,rounded:i=!0,enableLightbox:o=!0,thumbnailHeight:r=l.DEFAULT_THUMB_HEIGHT,className:n,testId:C,...b}=S,[L,m]=d.useState(null),g=d.useCallback(()=>m(null),[]),E=d.useCallback(c=>m(c),[]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:h.cn(l.ROOT_CLASSES,n),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,gap:a},"data-testid":C,...b,children:s.map((c,u)=>e.jsx("div",{className:h.cn(l.THUMB_CLASSES,i&&l.ROUNDED_CLASSES),style:{height:r},onClick:()=>o&&m(u),children:e.jsx("img",{src:c.thumbnail??c.src,alt:c.alt??"",className:l.THUMB_IMG_CLASSES,loading:"lazy"})},u))}),L!==null&&e.jsx(j,{images:s,currentIndex:L,onClose:g,onNavigate:E})]})};exports.ImageGallery=k;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=3,r=8,a=200,b="Bear-ImageGallery bear-grid",t="bear-overflow-hidden bear-cursor-pointer bear-transition-transform hover:bear-scale-[1.02] bear-bg-gray-100 dark:bear-bg-zinc-800",S="bear-w-full bear-h-full bear-object-cover",o="bear-rounded-lg",n="bear-fixed bear-inset-0 bear-z-[99999] bear-bg-black/90 bear-flex bear-items-center bear-justify-center bear-animate-in",s="bear-max-w-[90vw] bear-max-h-[85vh] bear-object-contain bear-select-none",l="bear-absolute bear-top-1/2 bear--translate-y-1/2 bear-bg-white/10 hover:bear-bg-white/20 bear-text-white bear-rounded-full bear-w-10 bear-h-10 bear-flex bear-items-center bear-justify-center bear-transition-colors bear-backdrop-blur-sm",c="bear-absolute bear-top-4 bear-right-4 bear-text-white bear-bg-white/10 hover:bear-bg-white/20 bear-rounded-full bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-transition-colors bear-backdrop-blur-sm",E="bear-absolute bear-bottom-4 bear-left-1/2 bear--translate-x-1/2 bear-text-white bear-text-sm bear-bg-black/50 bear-px-4 bear-py-2 bear-rounded-full bear-backdrop-blur-sm",_="bear-absolute bear-top-4 bear-left-4 bear-text-white/70 bear-text-sm";exports.CAPTION_CLASSES=E;exports.CLOSE_BTN_CLASSES=c;exports.COUNTER_CLASSES=_;exports.DEFAULT_COLUMNS=e;exports.DEFAULT_GAP=r;exports.DEFAULT_THUMB_HEIGHT=a;exports.LIGHTBOX_IMG_CLASSES=s;exports.NAV_BTN_CLASSES=l;exports.OVERLAY_CLASSES=n;exports.ROOT_CLASSES=b;exports.ROUNDED_CLASSES=o;exports.THUMB_CLASSES=t;exports.THUMB_IMG_CLASSES=S;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const DEFAULT_COLUMNS = 3;
|
|
2
|
+
export declare const DEFAULT_GAP = 8;
|
|
3
|
+
export declare const DEFAULT_THUMB_HEIGHT = 200;
|
|
4
|
+
export declare const ROOT_CLASSES = "Bear-ImageGallery bear-grid";
|
|
5
|
+
export declare const THUMB_CLASSES = "bear-overflow-hidden bear-cursor-pointer bear-transition-transform hover:bear-scale-[1.02] bear-bg-gray-100 dark:bear-bg-zinc-800";
|
|
6
|
+
export declare const THUMB_IMG_CLASSES = "bear-w-full bear-h-full bear-object-cover";
|
|
7
|
+
export declare const ROUNDED_CLASSES = "bear-rounded-lg";
|
|
8
|
+
export declare const OVERLAY_CLASSES = "bear-fixed bear-inset-0 bear-z-[99999] bear-bg-black/90 bear-flex bear-items-center bear-justify-center bear-animate-in";
|
|
9
|
+
export declare const LIGHTBOX_IMG_CLASSES = "bear-max-w-[90vw] bear-max-h-[85vh] bear-object-contain bear-select-none";
|
|
10
|
+
export declare const NAV_BTN_CLASSES = "bear-absolute bear-top-1/2 bear--translate-y-1/2 bear-bg-white/10 hover:bear-bg-white/20 bear-text-white bear-rounded-full bear-w-10 bear-h-10 bear-flex bear-items-center bear-justify-center bear-transition-colors bear-backdrop-blur-sm";
|
|
11
|
+
export declare const CLOSE_BTN_CLASSES = "bear-absolute bear-top-4 bear-right-4 bear-text-white bear-bg-white/10 hover:bear-bg-white/20 bear-rounded-full bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-transition-colors bear-backdrop-blur-sm";
|
|
12
|
+
export declare const CAPTION_CLASSES = "bear-absolute bear-bottom-4 bear-left-1/2 bear--translate-x-1/2 bear-text-white bear-text-sm bear-bg-black/50 bear-px-4 bear-py-2 bear-rounded-full bear-backdrop-blur-sm";
|
|
13
|
+
export declare const COUNTER_CLASSES = "bear-absolute bear-top-4 bear-left-4 bear-text-white/70 bear-text-sm";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const e = 3, r = 8, a = 200, b = "Bear-ImageGallery bear-grid", t = "bear-overflow-hidden bear-cursor-pointer bear-transition-transform hover:bear-scale-[1.02] bear-bg-gray-100 dark:bear-bg-zinc-800", o = "bear-w-full bear-h-full bear-object-cover", n = "bear-rounded-lg", s = "bear-fixed bear-inset-0 bear-z-[99999] bear-bg-black/90 bear-flex bear-items-center bear-justify-center bear-animate-in", c = "bear-max-w-[90vw] bear-max-h-[85vh] bear-object-contain bear-select-none", l = "bear-absolute bear-top-1/2 bear--translate-y-1/2 bear-bg-white/10 hover:bear-bg-white/20 bear-text-white bear-rounded-full bear-w-10 bear-h-10 bear-flex bear-items-center bear-justify-center bear-transition-colors bear-backdrop-blur-sm", S = "bear-absolute bear-top-4 bear-right-4 bear-text-white bear-bg-white/10 hover:bear-bg-white/20 bear-rounded-full bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-transition-colors bear-backdrop-blur-sm", i = "bear-absolute bear-bottom-4 bear-left-1/2 bear--translate-x-1/2 bear-text-white bear-text-sm bear-bg-black/50 bear-px-4 bear-py-2 bear-rounded-full bear-backdrop-blur-sm", u = "bear-absolute bear-top-4 bear-left-4 bear-text-white/70 bear-text-sm";
|
|
2
|
+
export {
|
|
3
|
+
i as CAPTION_CLASSES,
|
|
4
|
+
S as CLOSE_BTN_CLASSES,
|
|
5
|
+
u as COUNTER_CLASSES,
|
|
6
|
+
e as DEFAULT_COLUMNS,
|
|
7
|
+
r as DEFAULT_GAP,
|
|
8
|
+
a as DEFAULT_THUMB_HEIGHT,
|
|
9
|
+
c as LIGHTBOX_IMG_CLASSES,
|
|
10
|
+
l as NAV_BTN_CLASSES,
|
|
11
|
+
s as OVERLAY_CLASSES,
|
|
12
|
+
b as ROOT_CLASSES,
|
|
13
|
+
n as ROUNDED_CLASSES,
|
|
14
|
+
t as THUMB_CLASSES,
|
|
15
|
+
o as THUMB_IMG_CLASSES
|
|
16
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as S, Fragment as N, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useCallback as C, useEffect as _ } from "react";
|
|
3
|
+
import { cn as d } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_COLUMNS as u, DEFAULT_GAP as f, DEFAULT_THUMB_HEIGHT as T, THUMB_IMG_CLASSES as v, ROUNDED_CLASSES as w, THUMB_CLASSES as y, ROOT_CLASSES as O, OVERLAY_CLASSES as U, LIGHTBOX_IMG_CLASSES as B, CLOSE_BTN_CLASSES as M, NAV_BTN_CLASSES as b, CAPTION_CLASSES as H, COUNTER_CLASSES as G } from "./ImageGallery.const.js";
|
|
5
|
+
const D = ({ images: c, currentIndex: e, onClose: t, onNavigate: a }) => {
|
|
6
|
+
const o = c[e], i = c.length;
|
|
7
|
+
return _(() => {
|
|
8
|
+
const s = (r) => {
|
|
9
|
+
r.key === "Escape" && t(), r.key === "ArrowLeft" && e > 0 && a(e - 1), r.key === "ArrowRight" && e < i - 1 && a(e + 1);
|
|
10
|
+
};
|
|
11
|
+
return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
|
|
12
|
+
}, [e, i, t, a]), /* @__PURE__ */ S("div", { className: U, onClick: t, role: "dialog", "aria-label": "Image lightbox", children: [
|
|
13
|
+
/* @__PURE__ */ l("div", { onClick: (s) => s.stopPropagation(), children: /* @__PURE__ */ l("img", { src: o.src, alt: o.alt ?? "", className: B }) }),
|
|
14
|
+
/* @__PURE__ */ l("button", { className: M, onClick: t, "aria-label": "Close", children: "✕" }),
|
|
15
|
+
e > 0 && /* @__PURE__ */ l("button", { className: d(b, "bear-left-4"), onClick: () => a(e - 1), "aria-label": "Previous", children: /* @__PURE__ */ l("svg", { className: "bear-w-5 bear-h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }),
|
|
16
|
+
e < i - 1 && /* @__PURE__ */ l("button", { className: d(b, "bear-right-4"), onClick: () => a(e + 1), "aria-label": "Next", children: /* @__PURE__ */ l("svg", { className: "bear-w-5 bear-h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) }),
|
|
17
|
+
o.caption && /* @__PURE__ */ l("div", { className: H, children: o.caption }),
|
|
18
|
+
/* @__PURE__ */ S("div", { className: G, children: [
|
|
19
|
+
e + 1,
|
|
20
|
+
" / ",
|
|
21
|
+
i
|
|
22
|
+
] })
|
|
23
|
+
] });
|
|
24
|
+
}, P = (c) => {
|
|
25
|
+
const {
|
|
26
|
+
images: e,
|
|
27
|
+
columns: t = u,
|
|
28
|
+
gap: a = f,
|
|
29
|
+
rounded: o = !0,
|
|
30
|
+
enableLightbox: i = !0,
|
|
31
|
+
thumbnailHeight: s = T,
|
|
32
|
+
className: r,
|
|
33
|
+
testId: E,
|
|
34
|
+
...k
|
|
35
|
+
} = c, [m, h] = p(null), g = C(() => h(null), []), A = C((n) => h(n), []);
|
|
36
|
+
return /* @__PURE__ */ S(N, { children: [
|
|
37
|
+
/* @__PURE__ */ l(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: d(O, r),
|
|
41
|
+
style: { gridTemplateColumns: `repeat(${t}, 1fr)`, gap: a },
|
|
42
|
+
"data-testid": E,
|
|
43
|
+
...k,
|
|
44
|
+
children: e.map((n, L) => /* @__PURE__ */ l(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: d(y, o && w),
|
|
48
|
+
style: { height: s },
|
|
49
|
+
onClick: () => i && h(L),
|
|
50
|
+
children: /* @__PURE__ */ l("img", { src: n.thumbnail ?? n.src, alt: n.alt ?? "", className: v, loading: "lazy" })
|
|
51
|
+
},
|
|
52
|
+
L
|
|
53
|
+
))
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
m !== null && /* @__PURE__ */ l(D, { images: e, currentIndex: m, onClose: g, onNavigate: A })
|
|
57
|
+
] });
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
P as ImageGallery
|
|
61
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface GalleryImage {
|
|
3
|
+
src: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
thumbnail?: string;
|
|
6
|
+
caption?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ImageGalleryProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
images: GalleryImage[];
|
|
10
|
+
columns?: number;
|
|
11
|
+
gap?: number;
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
enableLightbox?: boolean;
|
|
14
|
+
thumbnailHeight?: number;
|
|
15
|
+
testId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface LightboxProps {
|
|
18
|
+
images: GalleryImage[];
|
|
19
|
+
currentIndex: number;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
onNavigate: (index: number) => void;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),a=require("../../utils/cn.cjs");require("react");const g=require("../Typography/Typography.cjs"),t=require("./Indicator.const.cjs"),L=({children:c,label:s,color:e,size:n=t.DEFAULT_SIZE,position:d="top-end",radius:S="full",processing:u=!1,disabled:l=!1,offset:r,withBorder:C=!1,inline:p=!1,className:y,testId:m,...I})=>{const O=t.POSITION_MAP[d],f=t.RADIUS_MAP[S],o=typeof e=="string"&&!e.startsWith("bear-"),h=o?void 0:e??t.DEFAULT_COLOR,A=typeof n=="number"?{width:n,height:n,minWidth:n}:void 0,_=typeof r=="number"?{margin:r}:void 0;return i.jsxs("div",{className:a.cn(t.ROOT_CLASS,p&&t.ROOT_INLINE_CLASS,y),"data-testid":m,...I,children:[c,!l&&i.jsx("span",{className:a.cn(t.INDICATOR_CLASS,O,f,h,C&&t.BORDER_CLASS,u&&t.PROCESSING_CLASS),style:{...A,..._,...o?{backgroundColor:e}:void 0},children:s!=null&&i.jsx(g.Typography,{variant:"caption",className:"bear-text-white dark:bear-text-zinc-100 bear-font-medium",children:s})})]})};exports.Indicator=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=10,a="bear-bg-pink-500 dark:bear-bg-pink-400",r={"top-start":"bear-top-0 bear-left-0 bear-translate-x-[-50%] bear-translate-y-[-50%]","top-center":"bear-top-0 bear-left-1/2 bear-translate-x-[-50%] bear-translate-y-[-50%]","top-end":"bear-top-0 bear-right-0 bear-translate-x-[50%] bear-translate-y-[-50%]","middle-start":"bear-top-1/2 bear-left-0 bear-translate-x-[-50%] bear-translate-y-[-50%]","middle-end":"bear-top-1/2 bear-right-0 bear-translate-x-[50%] bear-translate-y-[-50%]","bottom-start":"bear-bottom-0 bear-left-0 bear-translate-x-[-50%] bear-translate-y-[50%]","bottom-center":"bear-bottom-0 bear-left-1/2 bear-translate-x-[-50%] bear-translate-y-[50%]","bottom-end":"bear-bottom-0 bear-right-0 bear-translate-x-[50%] bear-translate-y-[50%]"},t={sm:"bear-rounded-sm",md:"bear-rounded-md",lg:"bear-rounded-lg",full:"bear-rounded-full"},b="Bear-Indicator bear-relative",n="Bear-Indicator bear-relative bear-inline-flex",o="Bear-Indicator__dot bear-absolute bear-flex bear-items-center bear-justify-center bear-pointer-events-none",l="bear-ring-2 bear-ring-white dark:bear-ring-zinc-900",s="bear-animate-pulse";exports.BORDER_CLASS=l;exports.DEFAULT_COLOR=a;exports.DEFAULT_SIZE=e;exports.INDICATOR_CLASS=o;exports.POSITION_MAP=r;exports.PROCESSING_CLASS=s;exports.RADIUS_MAP=t;exports.ROOT_CLASS=b;exports.ROOT_INLINE_CLASS=n;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IndicatorPosition } from './Indicator.types';
|
|
2
|
+
export declare const DEFAULT_SIZE = 10;
|
|
3
|
+
export declare const DEFAULT_COLOR = "bear-bg-pink-500 dark:bear-bg-pink-400";
|
|
4
|
+
export declare const POSITION_MAP: Record<IndicatorPosition, string>;
|
|
5
|
+
export declare const RADIUS_MAP: {
|
|
6
|
+
readonly sm: "bear-rounded-sm";
|
|
7
|
+
readonly md: "bear-rounded-md";
|
|
8
|
+
readonly lg: "bear-rounded-lg";
|
|
9
|
+
readonly full: "bear-rounded-full";
|
|
10
|
+
};
|
|
11
|
+
export declare const ROOT_CLASS = "Bear-Indicator bear-relative";
|
|
12
|
+
export declare const ROOT_INLINE_CLASS = "Bear-Indicator bear-relative bear-inline-flex";
|
|
13
|
+
export declare const INDICATOR_CLASS = "Bear-Indicator__dot bear-absolute bear-flex bear-items-center bear-justify-center bear-pointer-events-none";
|
|
14
|
+
export declare const BORDER_CLASS = "bear-ring-2 bear-ring-white dark:bear-ring-zinc-900";
|
|
15
|
+
export declare const PROCESSING_CLASS = "bear-animate-pulse";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const e = 10, a = "bear-bg-pink-500 dark:bear-bg-pink-400", r = {
|
|
2
|
+
"top-start": "bear-top-0 bear-left-0 bear-translate-x-[-50%] bear-translate-y-[-50%]",
|
|
3
|
+
"top-center": "bear-top-0 bear-left-1/2 bear-translate-x-[-50%] bear-translate-y-[-50%]",
|
|
4
|
+
"top-end": "bear-top-0 bear-right-0 bear-translate-x-[50%] bear-translate-y-[-50%]",
|
|
5
|
+
"middle-start": "bear-top-1/2 bear-left-0 bear-translate-x-[-50%] bear-translate-y-[-50%]",
|
|
6
|
+
"middle-end": "bear-top-1/2 bear-right-0 bear-translate-x-[50%] bear-translate-y-[-50%]",
|
|
7
|
+
"bottom-start": "bear-bottom-0 bear-left-0 bear-translate-x-[-50%] bear-translate-y-[50%]",
|
|
8
|
+
"bottom-center": "bear-bottom-0 bear-left-1/2 bear-translate-x-[-50%] bear-translate-y-[50%]",
|
|
9
|
+
"bottom-end": "bear-bottom-0 bear-right-0 bear-translate-x-[50%] bear-translate-y-[50%]"
|
|
10
|
+
}, t = {
|
|
11
|
+
sm: "bear-rounded-sm",
|
|
12
|
+
md: "bear-rounded-md",
|
|
13
|
+
lg: "bear-rounded-lg",
|
|
14
|
+
full: "bear-rounded-full"
|
|
15
|
+
}, b = "Bear-Indicator bear-relative", n = "Bear-Indicator bear-relative bear-inline-flex", o = "Bear-Indicator__dot bear-absolute bear-flex bear-items-center bear-justify-center bear-pointer-events-none", l = "bear-ring-2 bear-ring-white dark:bear-ring-zinc-900", s = "bear-animate-pulse";
|
|
16
|
+
export {
|
|
17
|
+
l as BORDER_CLASS,
|
|
18
|
+
a as DEFAULT_COLOR,
|
|
19
|
+
e as DEFAULT_SIZE,
|
|
20
|
+
o as INDICATOR_CLASS,
|
|
21
|
+
r as POSITION_MAP,
|
|
22
|
+
s as PROCESSING_CLASS,
|
|
23
|
+
t as RADIUS_MAP,
|
|
24
|
+
b as ROOT_CLASS,
|
|
25
|
+
n as ROOT_INLINE_CLASS
|
|
26
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs as y, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { cn as a } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Typography as L } from "../Typography/Typography.js";
|
|
5
|
+
import { DEFAULT_SIZE as N, PROCESSING_CLASS as R, BORDER_CLASS as g, DEFAULT_COLOR as v, RADIUS_MAP as T, POSITION_MAP as E, INDICATOR_CLASS as x, ROOT_INLINE_CLASS as D, ROOT_CLASS as b } from "./Indicator.const.js";
|
|
6
|
+
const F = ({
|
|
7
|
+
children: e,
|
|
8
|
+
label: t,
|
|
9
|
+
color: s,
|
|
10
|
+
size: o = N,
|
|
11
|
+
position: d = "top-end",
|
|
12
|
+
radius: m = "full",
|
|
13
|
+
processing: S = !1,
|
|
14
|
+
disabled: p = !1,
|
|
15
|
+
offset: i,
|
|
16
|
+
withBorder: c = !1,
|
|
17
|
+
inline: f = !1,
|
|
18
|
+
className: C,
|
|
19
|
+
testId: l,
|
|
20
|
+
...A
|
|
21
|
+
}) => {
|
|
22
|
+
const O = E[d], h = T[m], r = typeof s == "string" && !s.startsWith("bear-"), I = r ? void 0 : s ?? v, _ = typeof o == "number" ? { width: o, height: o, minWidth: o } : void 0, u = typeof i == "number" ? { margin: i } : void 0;
|
|
23
|
+
return /* @__PURE__ */ y(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: a(b, f && D, C),
|
|
27
|
+
"data-testid": l,
|
|
28
|
+
...A,
|
|
29
|
+
children: [
|
|
30
|
+
e,
|
|
31
|
+
!p && /* @__PURE__ */ n(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: a(
|
|
35
|
+
x,
|
|
36
|
+
O,
|
|
37
|
+
h,
|
|
38
|
+
I,
|
|
39
|
+
c && g,
|
|
40
|
+
S && R
|
|
41
|
+
),
|
|
42
|
+
style: {
|
|
43
|
+
..._,
|
|
44
|
+
...u,
|
|
45
|
+
...r ? { backgroundColor: s } : void 0
|
|
46
|
+
},
|
|
47
|
+
children: t != null && /* @__PURE__ */ n(L, { variant: "caption", className: "bear-text-white dark:bear-text-zinc-100 bear-font-medium", children: t })
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
F as Indicator
|
|
56
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export type IndicatorPosition = 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
3
|
+
export interface IndicatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
position?: IndicatorPosition;
|
|
9
|
+
radius?: 'sm' | 'md' | 'lg' | 'full';
|
|
10
|
+
processing?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
offset?: number;
|
|
13
|
+
withBorder?: boolean;
|
|
14
|
+
inline?: boolean;
|
|
15
|
+
testId?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),b=require("../../utils/cn.cjs"),s=require("./InfiniteScroll.const.cjs"),A=m=>{const{onLoadMore:a,hasMore:n,loading:t=!1,threshold:d=s.DEFAULT_THRESHOLD,manual:r=!1,loader:u,endMessage:S,loadMoreLabel:v="Load more",inverse:o=!1,children:I,className:g,testId:j,...x}=m,i=c.useRef(null),f=c.useRef(t);f.current=t;const l=c.useCallback(()=>{f.current||!n||a()},[a,n]);c.useEffect(()=>{if(r||!n)return;const E=i.current;if(!E)return;const L=new IntersectionObserver(_=>{var N;(N=_[0])!=null&&N.isIntersecting&&l()},{threshold:0,rootMargin:`${Math.round(d*100)}px`});return L.observe(E),()=>L.disconnect()},[r,n,l,d]);const h=e.jsx("div",{className:s.LOADER_CLASSES,children:e.jsx("div",{className:s.SPINNER_CLASSES})}),R=e.jsxs(e.Fragment,{children:[o&&n&&!r&&e.jsx("div",{ref:i,style:{height:s.SENTINEL_HEIGHT}}),o&&t&&(u??h),I,!o&&t&&(u??h),!o&&n&&!r&&e.jsx("div",{ref:i,style:{height:s.SENTINEL_HEIGHT}}),n&&r&&!t&&e.jsx("button",{type:"button",onClick:l,className:s.MANUAL_BTN_CLASSES,children:v}),!n&&S&&e.jsx("div",{className:s.END_CLASSES,children:S})]});return e.jsx("div",{className:b.cn(s.ROOT_CLASSES,g),"data-testid":j,...x,children:R})};exports.InfiniteScroll=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=.8,r=1,a="Bear-InfiniteScroll bear-relative",t="bear-flex bear-items-center bear-justify-center bear-py-4",b="bear-text-center bear-py-4 bear-text-sm bear-text-gray-400 dark:bear-text-zinc-500",S="bear-w-full bear-py-2.5 bear-text-sm bear-font-medium bear-text-pink-600 dark:bear-text-pink-400 bear-bg-pink-50 dark:bear-bg-pink-900/20 bear-rounded-lg bear-transition-colors hover:bear-bg-pink-100 dark:hover:bear-bg-pink-900/30 bear-cursor-pointer",n="bear-w-5 bear-h-5 bear-border-2 bear-border-pink-200 bear-border-t-pink-500 bear-rounded-full bear-animate-spin";exports.DEFAULT_THRESHOLD=e;exports.END_CLASSES=b;exports.LOADER_CLASSES=t;exports.MANUAL_BTN_CLASSES=S;exports.ROOT_CLASSES=a;exports.SENTINEL_HEIGHT=r;exports.SPINNER_CLASSES=n;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DEFAULT_THRESHOLD = 0.8;
|
|
2
|
+
export declare const SENTINEL_HEIGHT = 1;
|
|
3
|
+
export declare const ROOT_CLASSES = "Bear-InfiniteScroll bear-relative";
|
|
4
|
+
export declare const LOADER_CLASSES = "bear-flex bear-items-center bear-justify-center bear-py-4";
|
|
5
|
+
export declare const END_CLASSES = "bear-text-center bear-py-4 bear-text-sm bear-text-gray-400 dark:bear-text-zinc-500";
|
|
6
|
+
export declare const MANUAL_BTN_CLASSES = "bear-w-full bear-py-2.5 bear-text-sm bear-font-medium bear-text-pink-600 dark:bear-text-pink-400 bear-bg-pink-50 dark:bear-bg-pink-900/20 bear-rounded-lg bear-transition-colors hover:bear-bg-pink-100 dark:hover:bear-bg-pink-900/30 bear-cursor-pointer";
|
|
7
|
+
export declare const SPINNER_CLASSES = "bear-w-5 bear-h-5 bear-border-2 bear-border-pink-200 bear-border-t-pink-500 bear-rounded-full bear-animate-spin";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e = 0.8, r = 1, a = "Bear-InfiniteScroll bear-relative", b = "bear-flex bear-items-center bear-justify-center bear-py-4", t = "bear-text-center bear-py-4 bear-text-sm bear-text-gray-400 dark:bear-text-zinc-500", n = "bear-w-full bear-py-2.5 bear-text-sm bear-font-medium bear-text-pink-600 dark:bear-text-pink-400 bear-bg-pink-50 dark:bear-bg-pink-900/20 bear-rounded-lg bear-transition-colors hover:bear-bg-pink-100 dark:hover:bear-bg-pink-900/30 bear-cursor-pointer", o = "bear-w-5 bear-h-5 bear-border-2 bear-border-pink-200 bear-border-t-pink-500 bear-rounded-full bear-animate-spin";
|
|
2
|
+
export {
|
|
3
|
+
e as DEFAULT_THRESHOLD,
|
|
4
|
+
t as END_CLASSES,
|
|
5
|
+
b as LOADER_CLASSES,
|
|
6
|
+
n as MANUAL_BTN_CLASSES,
|
|
7
|
+
a as ROOT_CLASSES,
|
|
8
|
+
r as SENTINEL_HEIGHT,
|
|
9
|
+
o as SPINNER_CLASSES
|
|
10
|
+
};
|
|
@@ -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 r=require("react/jsx-runtime"),
|
|
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;
|