@forgedevstack/bear 1.1.9 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +2 -2
- package/dist/components/AlertDialog/AlertDialog.const.js +4 -4
- package/dist/components/AlertDialog/AlertDialog.js +76 -62
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/CloseButton/CloseButton.cjs +1 -0
- package/dist/components/CloseButton/CloseButton.d.ts +4 -0
- package/dist/components/CloseButton/CloseButton.js +60 -0
- package/dist/components/CloseButton/CloseButton.types.d.ts +15 -0
- package/dist/components/CloseButton/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +12 -11
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/commerce.cjs +1 -0
- package/dist/components/Icon/icons/commerce.d.ts +25 -0
- package/dist/components/Icon/icons/commerce.js +124 -0
- package/dist/components/Icon/icons/device.cjs +1 -0
- package/dist/components/Icon/icons/device.d.ts +27 -0
- package/dist/components/Icon/icons/device.js +122 -0
- package/dist/components/Icon/icons/file.cjs +1 -0
- package/dist/components/Icon/icons/file.d.ts +25 -0
- package/dist/components/Icon/icons/file.js +120 -0
- package/dist/components/Icon/icons/social.cjs +1 -0
- package/dist/components/Icon/icons/social.d.ts +24 -0
- package/dist/components/Icon/icons/social.js +89 -0
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +93 -56
- package/dist/components/Icon/index.js +38 -26
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/Overlay/Overlay.cjs +1 -0
- package/dist/components/Overlay/Overlay.d.ts +4 -0
- package/dist/components/Overlay/Overlay.js +38 -0
- package/dist/components/Overlay/Overlay.types.d.ts +23 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -0
- package/dist/components/Portal/Portal.d.ts +8 -0
- package/dist/components/Portal/Portal.js +6 -0
- package/dist/components/Portal/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +3 -2
- package/dist/components/Stepper/Stepper.const.js +15 -14
- package/dist/components/Stepper/Stepper.d.ts +0 -7
- package/dist/components/Stepper/Stepper.js +164 -117
- package/dist/components/Stepper/Stepper.types.d.ts +3 -0
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/ThemeIcon/ThemeIcon.cjs +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.d.ts +4 -0
- package/dist/components/ThemeIcon/ThemeIcon.js +54 -0
- package/dist/components/ThemeIcon/ThemeIcon.types.d.ts +22 -0
- package/dist/components/ThemeIcon/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/VisuallyHidden/VisuallyHidden.cjs +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +22 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +15 -3
- package/dist/components/index.js +296 -280
- package/dist/hooks/bearStyled.cjs +1 -1
- package/dist/hooks/bearStyled.d.ts +31 -9
- package/dist/hooks/bearStyled.js +17 -12
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +9 -1
- package/dist/hooks/useResponsive.cjs +1 -1
- package/dist/hooks/useResponsive.d.ts +2 -17
- package/dist/hooks/useResponsive.js +47 -41
- package/dist/index.cjs +1 -1
- package/dist/index.js +383 -366
- package/dist/styles/_effects.css +26 -0
- package/dist/styles.css +1 -1
- package/dist/types/theme.types.d.ts +1 -0
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ Strong, reliable React UI components. Tailwind-powered, zero config required. Th
|
|
|
6
6
|
|
|
7
7
|
Visit the [Bear UI Portal](https://bearui.com/) to explore all components, view live examples, and browse the documentation.
|
|
8
8
|
|
|
9
|
+
## Changelog
|
|
10
|
+
|
|
11
|
+
**Current release: 1.2.1** — Portaled overlays (Dropdown, Select, NavigableSelect, Menu, Autocomplete, MultiSelect, MentionsInput, TreeSelect, Popconfirm) use fixed positioning tied to the trigger, **z-index 10000**, and scroll/resize updates where applicable so panels are not clipped by parent `overflow` or stacking contexts. **Popover** and **Tooltip** also reposition on scroll/resize. **`useClickOutsideMultiple`** is available from `@forgedevstack/bear/hooks` for trigger + floating-root outside detection. Details: [CHANGELOG.md](./CHANGELOG.md).
|
|
12
|
+
|
|
9
13
|
## Features
|
|
10
14
|
|
|
11
15
|
- **Tailwind-Powered**: Built with Tailwind CSS, zero config required
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),B=require("react-dom"),a=require("../../utils/cn.cjs"),v=require("../Button/Button.cjs"),x=require("../Typography/Typography.cjs"),o=require("./AlertDialog.const.cjs"),N=p=>{const{isOpen:d,onClose:i,onConfirm:D,title:L,description:u,confirmText:S="Confirm",cancelText:T="Cancel",confirmVariant:C="danger",loading:n=!1,loadingText:R,closeOnBackdrop:I=!1,closeOnEscape:m=!0,icon:c,className:O,testId:j}=p,A=r.useId(),_=`bear-alert-title-${A}`,y=`bear-alert-desc-${A}`,l=r.useRef(null),E=r.useRef(null),b=r.useCallback(e=>{m&&e.key==="Escape"&&!n&&i()},[m,i,n]),f=r.useCallback(e=>{if(e.key!=="Tab"||!l.current)return;const s=l.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');if(s.length===0)return;const g=s[0],h=s[s.length-1];e.shiftKey&&document.activeElement===g?(e.preventDefault(),h.focus()):!e.shiftKey&&document.activeElement===h&&(e.preventDefault(),g.focus())},[]);if(r.useEffect(()=>(d&&(E.current=document.activeElement,document.addEventListener("keydown",b),document.addEventListener("keydown",f),document.body.style.overflow="hidden",requestAnimationFrame(()=>{var e;return(e=l.current)==null?void 0:e.focus()})),()=>{var e;document.removeEventListener("keydown",b),document.removeEventListener("keydown",f),document.body.style.overflow="",(e=E.current)==null||e.focus()}),[d,b,f]),!d)return null;const k=t.jsxs("div",{className:"Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4","data-testid":j,children:[t.jsx("div",{className:a.cn("Bear-AlertDialog__backdrop",o.ALERT_DIALOG_BACKDROP_CLASSES),onClick:I&&!n?i:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:l,role:"alertdialog","aria-modal":"true","aria-labelledby":_,"aria-describedby":u?y:void 0,tabIndex:-1,className:a.cn("Bear-AlertDialog__container",o.ALERT_DIALOG_CONTAINER_CLASSES,"bear-p-6",O),children:[c&&t.jsx("div",{className:"Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center",children:c}),t.jsx(x.Typography,{variant:"h6",id:_,className:a.cn("Bear-AlertDialog__title",o.ALERT_DIALOG_TITLE_CLASSES,c&&"bear-text-center"),children:L}),u&&t.jsx(x.Typography,{variant:"body2",id:y,className:a.cn("Bear-AlertDialog__description",o.ALERT_DIALOG_DESCRIPTION_CLASSES,c&&"bear-text-center"),children:u}),t.jsxs("div",{className:a.cn("Bear-AlertDialog__footer",o.ALERT_DIALOG_FOOTER_CLASSES),children:[t.jsx(v.Button,{variant:"ghost",onClick:i,disabled:n,children:T}),t.jsx(v.Button,{variant:C,onClick:D,loading:n,loadingText:R,children:S})]})]})]});return B.createPortal(k,document.body)};exports.AlertDialog=N;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in",a="bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in",r="bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white",b="bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2",t="bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";exports.ALERT_DIALOG_BACKDROP_CLASSES=e;exports.ALERT_DIALOG_CONTAINER_CLASSES=a;exports.ALERT_DIALOG_DESCRIPTION_CLASSES=b;exports.ALERT_DIALOG_FOOTER_CLASSES=t;exports.ALERT_DIALOG_TITLE_CLASSES=r;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const ALERT_DIALOG_BACKDROP_CLASSES = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity";
|
|
2
|
-
export declare const ALERT_DIALOG_CONTAINER_CLASSES = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all
|
|
1
|
+
export declare const ALERT_DIALOG_BACKDROP_CLASSES = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in";
|
|
2
|
+
export declare const ALERT_DIALOG_CONTAINER_CLASSES = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in";
|
|
3
3
|
export declare const ALERT_DIALOG_TITLE_CLASSES = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white";
|
|
4
4
|
export declare const ALERT_DIALOG_DESCRIPTION_CLASSES = "bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2";
|
|
5
5
|
export declare const ALERT_DIALOG_FOOTER_CLASSES = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in", e = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in", r = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white", b = "bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2", t = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
a as ALERT_DIALOG_BACKDROP_CLASSES,
|
|
4
|
+
e as ALERT_DIALOG_CONTAINER_CLASSES,
|
|
5
5
|
b as ALERT_DIALOG_DESCRIPTION_CLASSES,
|
|
6
6
|
t as ALERT_DIALOG_FOOTER_CLASSES,
|
|
7
|
-
|
|
7
|
+
r as ALERT_DIALOG_TITLE_CLASSES
|
|
8
8
|
};
|
|
@@ -1,96 +1,110 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useId as w, useRef as y, useCallback as h, useEffect as G } from "react";
|
|
3
|
+
import { createPortal as j } from "react-dom";
|
|
4
4
|
import { cn as a } from "../../utils/cn.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Typography as
|
|
7
|
-
import { ALERT_DIALOG_BACKDROP_CLASSES as
|
|
8
|
-
const
|
|
5
|
+
import { Button as L } from "../Button/Button.js";
|
|
6
|
+
import { Typography as g } from "../Typography/Typography.js";
|
|
7
|
+
import { ALERT_DIALOG_BACKDROP_CLASSES as F, ALERT_DIALOG_TITLE_CLASSES as K, ALERT_DIALOG_DESCRIPTION_CLASSES as P, ALERT_DIALOG_FOOTER_CLASSES as q, ALERT_DIALOG_CONTAINER_CLASSES as $ } from "./AlertDialog.const.js";
|
|
8
|
+
const W = (C) => {
|
|
9
9
|
const {
|
|
10
|
-
isOpen:
|
|
11
|
-
onClose:
|
|
12
|
-
onConfirm:
|
|
13
|
-
title:
|
|
14
|
-
description:
|
|
15
|
-
confirmText:
|
|
16
|
-
cancelText:
|
|
17
|
-
confirmVariant:
|
|
10
|
+
isOpen: c,
|
|
11
|
+
onClose: n,
|
|
12
|
+
onConfirm: D,
|
|
13
|
+
title: S,
|
|
14
|
+
description: d,
|
|
15
|
+
confirmText: T = "Confirm",
|
|
16
|
+
cancelText: x = "Cancel",
|
|
17
|
+
confirmVariant: I = "danger",
|
|
18
18
|
loading: r = !1,
|
|
19
|
-
loadingText:
|
|
20
|
-
closeOnBackdrop:
|
|
21
|
-
closeOnEscape:
|
|
22
|
-
icon:
|
|
23
|
-
className:
|
|
24
|
-
testId:
|
|
25
|
-
} = _,
|
|
26
|
-
(
|
|
27
|
-
|
|
19
|
+
loadingText: O,
|
|
20
|
+
closeOnBackdrop: k = !1,
|
|
21
|
+
closeOnEscape: f = !0,
|
|
22
|
+
icon: o,
|
|
23
|
+
className: R,
|
|
24
|
+
testId: N
|
|
25
|
+
} = C, b = w(), A = `bear-alert-title-${b}`, _ = `bear-alert-desc-${b}`, i = y(null), E = y(null), s = h(
|
|
26
|
+
(e) => {
|
|
27
|
+
f && e.key === "Escape" && !r && n();
|
|
28
28
|
},
|
|
29
|
-
[
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
[f, n, r]
|
|
30
|
+
), u = h((e) => {
|
|
31
|
+
if (e.key !== "Tab" || !i.current) return;
|
|
32
|
+
const l = i.current.querySelectorAll(
|
|
33
|
+
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
34
|
+
);
|
|
35
|
+
if (l.length === 0) return;
|
|
36
|
+
const p = l[0], v = l[l.length - 1];
|
|
37
|
+
e.shiftKey && document.activeElement === p ? (e.preventDefault(), v.focus()) : !e.shiftKey && document.activeElement === v && (e.preventDefault(), p.focus());
|
|
38
|
+
}, []);
|
|
39
|
+
if (G(() => (c && (E.current = document.activeElement, document.addEventListener("keydown", s), document.addEventListener("keydown", u), document.body.style.overflow = "hidden", requestAnimationFrame(() => {
|
|
40
|
+
var e;
|
|
41
|
+
return (e = i.current) == null ? void 0 : e.focus();
|
|
42
|
+
})), () => {
|
|
43
|
+
var e;
|
|
44
|
+
document.removeEventListener("keydown", s), document.removeEventListener("keydown", u), document.body.style.overflow = "", (e = E.current) == null || e.focus();
|
|
45
|
+
}), [c, s, u]), !c) return null;
|
|
46
|
+
const B = /* @__PURE__ */ m(
|
|
35
47
|
"div",
|
|
36
48
|
{
|
|
37
49
|
className: "Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4",
|
|
38
|
-
"data-testid":
|
|
50
|
+
"data-testid": N,
|
|
39
51
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ t(
|
|
41
53
|
"div",
|
|
42
54
|
{
|
|
43
|
-
className: a("Bear-AlertDialog__backdrop",
|
|
44
|
-
onClick:
|
|
55
|
+
className: a("Bear-AlertDialog__backdrop", F),
|
|
56
|
+
onClick: k && !r ? n : void 0,
|
|
45
57
|
"aria-hidden": "true"
|
|
46
58
|
}
|
|
47
59
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ m(
|
|
49
61
|
"div",
|
|
50
62
|
{
|
|
63
|
+
ref: i,
|
|
51
64
|
role: "alertdialog",
|
|
52
65
|
"aria-modal": "true",
|
|
53
|
-
"aria-labelledby":
|
|
54
|
-
"aria-describedby":
|
|
55
|
-
|
|
66
|
+
"aria-labelledby": A,
|
|
67
|
+
"aria-describedby": d ? _ : void 0,
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
className: a("Bear-AlertDialog__container", $, "bear-p-6", R),
|
|
56
70
|
children: [
|
|
57
|
-
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
71
|
+
o && /* @__PURE__ */ t("div", { className: "Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center", children: o }),
|
|
72
|
+
/* @__PURE__ */ t(
|
|
73
|
+
g,
|
|
60
74
|
{
|
|
61
75
|
variant: "h6",
|
|
62
|
-
id:
|
|
63
|
-
className: a("Bear-AlertDialog__title",
|
|
64
|
-
children:
|
|
76
|
+
id: A,
|
|
77
|
+
className: a("Bear-AlertDialog__title", K, o && "bear-text-center"),
|
|
78
|
+
children: S
|
|
65
79
|
}
|
|
66
80
|
),
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
d && /* @__PURE__ */ t(
|
|
82
|
+
g,
|
|
69
83
|
{
|
|
70
84
|
variant: "body2",
|
|
71
|
-
id:
|
|
72
|
-
className: a("Bear-AlertDialog__description",
|
|
73
|
-
children:
|
|
85
|
+
id: _,
|
|
86
|
+
className: a("Bear-AlertDialog__description", P, o && "bear-text-center"),
|
|
87
|
+
children: d
|
|
74
88
|
}
|
|
75
89
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
90
|
+
/* @__PURE__ */ m("div", { className: a("Bear-AlertDialog__footer", q), children: [
|
|
91
|
+
/* @__PURE__ */ t(
|
|
92
|
+
L,
|
|
79
93
|
{
|
|
80
94
|
variant: "ghost",
|
|
81
|
-
onClick:
|
|
95
|
+
onClick: n,
|
|
82
96
|
disabled: r,
|
|
83
|
-
children:
|
|
97
|
+
children: x
|
|
84
98
|
}
|
|
85
99
|
),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
100
|
+
/* @__PURE__ */ t(
|
|
101
|
+
L,
|
|
88
102
|
{
|
|
89
|
-
variant:
|
|
90
|
-
onClick:
|
|
103
|
+
variant: I,
|
|
104
|
+
onClick: D,
|
|
91
105
|
loading: r,
|
|
92
|
-
loadingText:
|
|
93
|
-
children:
|
|
106
|
+
loadingText: O,
|
|
107
|
+
children: T
|
|
94
108
|
}
|
|
95
109
|
)
|
|
96
110
|
] })
|
|
@@ -100,8 +114,8 @@ const z = (_) => {
|
|
|
100
114
|
]
|
|
101
115
|
}
|
|
102
116
|
);
|
|
103
|
-
return
|
|
117
|
+
return j(B, document.body);
|
|
104
118
|
};
|
|
105
119
|
export {
|
|
106
|
-
|
|
120
|
+
W as AlertDialog
|
|
107
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),x=require("../../utils/cn.cjs"),D=require("../Portal/Portal.cjs"),V=require("./Autocomplete.utils.cjs"),M=require("./Autocomplete.const.cjs"),C=({options:z,value:b="",onChange:i,onSelect:g,placeholder:I="Start typing...",label:k,helperText:v,error:u,disabled:f=!1,freeSolo:j=!1,loading:E=!1,filterOptions:q=V.defaultFilter,className:_,testId:B})=>{const[c,s]=a.useState(!1),[n,m]=a.useState(-1),[l,T]=a.useState({top:0,left:0,width:0}),N=a.useRef(null),P=a.useRef(null),h=a.useRef(null),A=a.useRef(null),w=a.useRef(null),o=q(z,b),y=c&&!f&&o.length>0,p=c&&!f&&o.length===0&&!!b&&!E;a.useEffect(()=>{if(!y&&!p)return;const e=()=>{var d;const r=(d=P.current)==null?void 0:d.getBoundingClientRect();r&&T({top:r.bottom+4,left:Math.max(8,Math.min(r.left,window.innerWidth-r.width-8)),width:r.width})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[y,p]),a.useEffect(()=>{if(!c)return;const e=r=>{var R,O;const d=r.target;(R=N.current)!=null&&R.contains(d)||(O=h.current)!=null&&O.contains(d)||s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c]),a.useEffect(()=>{m(-1)},[b]),a.useEffect(()=>{if(n>=0&&w.current){const e=w.current.children[n];e&&e.scrollIntoView({block:"nearest"})}},[n]);const U=e=>{const r=e.target.value;i==null||i(r),s(!0)},L=e=>{var r;i==null||i(e.label),g==null||g(e),s(!1),(r=A.current)==null||r.blur()},W=e=>{if(!c){(e.key==="ArrowDown"||e.key==="ArrowUp")&&(s(!0),e.preventDefault());return}switch(e.key){case"ArrowDown":e.preventDefault(),m(r=>r<o.length-1?r+1:0);break;case"ArrowUp":e.preventDefault(),m(r=>r>0?r-1:o.length-1);break;case"Enter":e.preventDefault(),n>=0&&o[n]?L(o[n]):j&&b&&s(!1);break;case"Escape":s(!1);break}};return t.jsxs("div",{className:x.cn("bear-w-full bear-relative",_),ref:N,"data-testid":B,children:[k&&t.jsx("label",{className:"bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5",children:k}),t.jsxs("div",{className:"bear-relative",ref:P,children:[t.jsx("input",{ref:A,type:"text",value:b,onChange:U,onFocus:()=>s(!0),onKeyDown:W,placeholder:I,disabled:f,className:x.cn("bear-w-full bear-px-4 bear-py-2.5 bear-pr-10 bear-rounded-lg bear-border","bear-bg-white dark:bear-bg-gray-900","bear-text-sm bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400","bear-transition-colors bear-outline-none",u?"bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20":"bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-amber-500 focus:bear-ring-2 focus:bear-ring-amber-500/20",f&&"bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800")}),t.jsx("div",{className:"bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2",children:E?t.jsxs("svg",{className:"bear-animate-spin bear-w-4 bear-h-4 bear-text-gray-400",viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"bear-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"bear-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):t.jsx("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]}),y&&t.jsx(D.Portal,{children:t.jsx("div",{ref:h,className:"bear-fixed bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-shadow-lg bear-bg-white dark:bear-bg-gray-800",style:{top:l.top,left:l.left,width:l.width,zIndex:M.AUTOCOMPLETE_PANEL_Z},children:t.jsx("div",{ref:w,className:"bear-max-h-60 bear-overflow-auto bear-py-1",children:o.map((e,r)=>t.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>L(e),className:x.cn("bear-w-full bear-px-4 bear-py-2 bear-text-left bear-text-sm bear-transition-colors","bear-text-gray-900 dark:bear-text-white",r===n?"bear-bg-amber-50 dark:bear-bg-amber-900/20":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-700",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),children:[t.jsx("div",{className:"bear-font-medium",children:e.label}),e.description&&t.jsx("div",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-mt-0.5",children:e.description})]},e.value))})})}),p&&t.jsx(D.Portal,{children:t.jsx("div",{ref:h,className:"bear-fixed bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",style:{top:l.top,left:l.left,width:l.width,zIndex:M.AUTOCOMPLETE_PANEL_Z},children:j?"Press Enter to use this value":"No results found"})}),(v||u)&&t.jsx("p",{className:x.cn("bear-mt-1.5 bear-text-xs",u?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),children:u||v})]})};exports.Autocomplete=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=11e3;exports.AUTOCOMPLETE_PANEL_Z=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AUTOCOMPLETE_PANEL_Z = 11000;
|
|
@@ -1,130 +1,168 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as c, useEffect as h } from "react";
|
|
3
|
+
import { cn as g } from "../../utils/cn.js";
|
|
4
|
+
import { Portal as B } from "../Portal/Portal.js";
|
|
5
|
+
import { defaultFilter as T } from "./Autocomplete.utils.js";
|
|
6
|
+
import { AUTOCOMPLETE_PANEL_Z as W } from "./Autocomplete.const.js";
|
|
7
|
+
const Y = ({
|
|
8
|
+
options: j,
|
|
9
|
+
value: b = "",
|
|
10
|
+
onChange: o,
|
|
11
|
+
onSelect: w,
|
|
12
|
+
placeholder: U = "Start typing...",
|
|
13
|
+
label: E,
|
|
14
|
+
helperText: L,
|
|
15
|
+
error: u,
|
|
16
|
+
disabled: f = !1,
|
|
17
|
+
freeSolo: P = !1,
|
|
18
|
+
loading: A = !1,
|
|
19
|
+
filterOptions: V = T,
|
|
20
|
+
className: F,
|
|
21
|
+
testId: H
|
|
20
22
|
}) => {
|
|
21
|
-
const [
|
|
22
|
-
|
|
23
|
+
const [l, a] = N(!1), [n, p] = N(-1), [i, K] = N({ top: 0, left: 0, width: 0 }), D = c(null), z = c(null), y = c(null), I = c(null), x = c(null), s = V(j, b), k = l && !f && s.length > 0, v = l && !f && s.length === 0 && !!b && !A;
|
|
24
|
+
h(() => {
|
|
25
|
+
if (!k && !v) return;
|
|
26
|
+
const e = () => {
|
|
27
|
+
var d;
|
|
28
|
+
const r = (d = z.current) == null ? void 0 : d.getBoundingClientRect();
|
|
29
|
+
r && K({
|
|
30
|
+
top: r.bottom + 4,
|
|
31
|
+
left: Math.max(8, Math.min(r.left, window.innerWidth - r.width - 8)),
|
|
32
|
+
width: r.width
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
36
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
37
|
+
};
|
|
38
|
+
}, [k, v]), h(() => {
|
|
39
|
+
if (!l) return;
|
|
23
40
|
const e = (r) => {
|
|
24
|
-
|
|
41
|
+
var M, O;
|
|
42
|
+
const d = r.target;
|
|
43
|
+
(M = D.current) != null && M.contains(d) || (O = y.current) != null && O.contains(d) || a(!1);
|
|
25
44
|
};
|
|
26
45
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
27
|
-
}, []),
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
if (
|
|
31
|
-
const e =
|
|
46
|
+
}, [l]), h(() => {
|
|
47
|
+
p(-1);
|
|
48
|
+
}, [b]), h(() => {
|
|
49
|
+
if (n >= 0 && x.current) {
|
|
50
|
+
const e = x.current.children[n];
|
|
32
51
|
e && e.scrollIntoView({ block: "nearest" });
|
|
33
52
|
}
|
|
34
|
-
}, [
|
|
35
|
-
const
|
|
53
|
+
}, [n]);
|
|
54
|
+
const _ = (e) => {
|
|
36
55
|
const r = e.target.value;
|
|
37
|
-
|
|
38
|
-
},
|
|
56
|
+
o == null || o(r), a(!0);
|
|
57
|
+
}, R = (e) => {
|
|
39
58
|
var r;
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
if (!
|
|
43
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (
|
|
59
|
+
o == null || o(e.label), w == null || w(e), a(!1), (r = I.current) == null || r.blur();
|
|
60
|
+
}, C = (e) => {
|
|
61
|
+
if (!l) {
|
|
62
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (a(!0), e.preventDefault());
|
|
44
63
|
return;
|
|
45
64
|
}
|
|
46
65
|
switch (e.key) {
|
|
47
66
|
case "ArrowDown":
|
|
48
|
-
e.preventDefault(),
|
|
67
|
+
e.preventDefault(), p(
|
|
49
68
|
(r) => r < s.length - 1 ? r + 1 : 0
|
|
50
69
|
);
|
|
51
70
|
break;
|
|
52
71
|
case "ArrowUp":
|
|
53
|
-
e.preventDefault(),
|
|
72
|
+
e.preventDefault(), p(
|
|
54
73
|
(r) => r > 0 ? r - 1 : s.length - 1
|
|
55
74
|
);
|
|
56
75
|
break;
|
|
57
76
|
case "Enter":
|
|
58
|
-
e.preventDefault(),
|
|
77
|
+
e.preventDefault(), n >= 0 && s[n] ? R(s[n]) : P && b && a(!1);
|
|
59
78
|
break;
|
|
60
79
|
case "Escape":
|
|
61
|
-
|
|
80
|
+
a(!1);
|
|
62
81
|
break;
|
|
63
82
|
}
|
|
64
83
|
};
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ m("div", { className: g("bear-w-full bear-relative", F), ref: D, "data-testid": H, children: [
|
|
85
|
+
E && /* @__PURE__ */ t("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5", children: E }),
|
|
86
|
+
/* @__PURE__ */ m("div", { className: "bear-relative", ref: z, children: [
|
|
87
|
+
/* @__PURE__ */ t(
|
|
69
88
|
"input",
|
|
70
89
|
{
|
|
71
|
-
ref:
|
|
90
|
+
ref: I,
|
|
72
91
|
type: "text",
|
|
73
|
-
value:
|
|
74
|
-
onChange:
|
|
75
|
-
onFocus: () =>
|
|
76
|
-
onKeyDown:
|
|
77
|
-
placeholder:
|
|
78
|
-
disabled:
|
|
79
|
-
className:
|
|
92
|
+
value: b,
|
|
93
|
+
onChange: _,
|
|
94
|
+
onFocus: () => a(!0),
|
|
95
|
+
onKeyDown: C,
|
|
96
|
+
placeholder: U,
|
|
97
|
+
disabled: f,
|
|
98
|
+
className: g(
|
|
80
99
|
"bear-w-full bear-px-4 bear-py-2.5 bear-pr-10 bear-rounded-lg bear-border",
|
|
81
100
|
"bear-bg-white dark:bear-bg-gray-900",
|
|
82
101
|
"bear-text-sm bear-text-gray-900 dark:bear-text-white",
|
|
83
102
|
"placeholder:bear-text-gray-400",
|
|
84
103
|
"bear-transition-colors bear-outline-none",
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
u ? "bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-amber-500 focus:bear-ring-2 focus:bear-ring-amber-500/20",
|
|
105
|
+
f && "bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800"
|
|
87
106
|
)
|
|
88
107
|
}
|
|
89
108
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
] }) : /* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ t("div", { className: "bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2", children: A ? /* @__PURE__ */ m("svg", { className: "bear-animate-spin bear-w-4 bear-h-4 bear-text-gray-400", viewBox: "0 0 24 24", fill: "none", children: [
|
|
110
|
+
/* @__PURE__ */ t("circle", { className: "bear-opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
111
|
+
/* @__PURE__ */ t("path", { className: "bear-opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
112
|
+
] }) : /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) })
|
|
94
113
|
] }),
|
|
95
|
-
|
|
114
|
+
k && /* @__PURE__ */ t(B, { children: /* @__PURE__ */ t(
|
|
96
115
|
"div",
|
|
97
116
|
{
|
|
98
117
|
ref: y,
|
|
99
|
-
className: "bear-
|
|
100
|
-
|
|
118
|
+
className: "bear-fixed bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-shadow-lg bear-bg-white dark:bear-bg-gray-800",
|
|
119
|
+
style: {
|
|
120
|
+
top: i.top,
|
|
121
|
+
left: i.left,
|
|
122
|
+
width: i.width,
|
|
123
|
+
zIndex: W
|
|
124
|
+
},
|
|
125
|
+
children: /* @__PURE__ */ t("div", { ref: x, className: "bear-max-h-60 bear-overflow-auto bear-py-1", children: s.map((e, r) => /* @__PURE__ */ m(
|
|
101
126
|
"button",
|
|
102
127
|
{
|
|
103
128
|
type: "button",
|
|
104
129
|
disabled: e.disabled,
|
|
105
|
-
onClick: () =>
|
|
106
|
-
className:
|
|
130
|
+
onClick: () => R(e),
|
|
131
|
+
className: g(
|
|
107
132
|
"bear-w-full bear-px-4 bear-py-2 bear-text-left bear-text-sm bear-transition-colors",
|
|
108
133
|
"bear-text-gray-900 dark:bear-text-white",
|
|
109
|
-
r ===
|
|
134
|
+
r === n ? "bear-bg-amber-50 dark:bear-bg-amber-900/20" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-700",
|
|
110
135
|
e.disabled && "bear-opacity-50 bear-cursor-not-allowed"
|
|
111
136
|
),
|
|
112
137
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
e.description && /* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ t("div", { className: "bear-font-medium", children: e.label }),
|
|
139
|
+
e.description && /* @__PURE__ */ t("div", { className: "bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-mt-0.5", children: e.description })
|
|
115
140
|
]
|
|
116
141
|
},
|
|
117
142
|
e.value
|
|
118
|
-
))
|
|
143
|
+
)) })
|
|
144
|
+
}
|
|
145
|
+
) }),
|
|
146
|
+
v && /* @__PURE__ */ t(B, { children: /* @__PURE__ */ t(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: y,
|
|
150
|
+
className: "bear-fixed bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",
|
|
151
|
+
style: {
|
|
152
|
+
top: i.top,
|
|
153
|
+
left: i.left,
|
|
154
|
+
width: i.width,
|
|
155
|
+
zIndex: W
|
|
156
|
+
},
|
|
157
|
+
children: P ? "Press Enter to use this value" : "No results found"
|
|
119
158
|
}
|
|
120
|
-
),
|
|
121
|
-
|
|
122
|
-
(w || n) && /* @__PURE__ */ a("p", { className: c(
|
|
159
|
+
) }),
|
|
160
|
+
(L || u) && /* @__PURE__ */ t("p", { className: g(
|
|
123
161
|
"bear-mt-1.5 bear-text-xs",
|
|
124
|
-
|
|
125
|
-
), children:
|
|
162
|
+
u ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
163
|
+
), children: u || L })
|
|
126
164
|
] });
|
|
127
165
|
};
|
|
128
166
|
export {
|
|
129
|
-
|
|
167
|
+
Y as Autocomplete
|
|
130
168
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),S=require("react-dom"),s=require("../../utils/cn.cjs"),q=require("../Icon/index.cjs"),h=300,E={sm:"bear-max-h-[40%]",md:"bear-max-h-[60%]",lg:"bear-max-h-[80%]",full:"bear-max-h-[95%]"},I=({isOpen:l,onClose:b,title:n,children:x,size:v="md",showCloseButton:d=!0,closeOnBackdrop:y=!0,closeOnEscape:u=!0,showHandle:k=!0,enableScroll:g=!0,isSticky:j=!1,className:w})=>{const[a,c]=r.useState(l),[m,o]=r.useState(!1),[p,f]=r.useState(!1);r.useEffect(()=>{if(l){c(!0),o(!1);const t=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(t)}if(a){f(!1),o(!0);const t=setTimeout(()=>{c(!1),o(!1)},h);return()=>clearTimeout(t)}},[l,a]);const i=r.useCallback(t=>{u&&t.key==="Escape"&&b()},[u,b]);if(r.useEffect(()=>(a&&(document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}),[a,i]),!a)return null;const N=e.jsxs("div",{className:"bear-fixed bear-inset-0 bear-z-[11000] bear-flex bear-items-end bear-justify-center",children:[e.jsx("div",{className:s.cn("bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",m?"bear-opacity-0":"bear-opacity-100"),style:{transitionDuration:`${h}ms`},onClick:y?b:void 0,"aria-hidden":"true"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":n?"bottom-sheet-title":void 0,className:s.cn("Bear-BottomSheet bear-relative bear-w-full bear-rounded-t-2xl bear-shadow-2xl bear-transition-transform bear-duration-300","bear-flex bear-flex-col bear-min-h-0 bear-overflow-hidden","bear-bg-white dark:bear-bg-neutral-900 bear-border-t bear-border-neutral-200 dark:bear-border-neutral-700",E[v],p&&!m?"bear-translate-y-0":"bear-translate-y-full",w),children:[k&&e.jsx("div",{className:"bear-flex bear-justify-center bear-pt-2 bear-pb-1",children:e.jsx("div",{className:"bear-w-12 bear-h-1 bear-rounded-full bear-bg-neutral-300 dark:bear-bg-neutral-600","aria-hidden":!0})}),(n||d)&&e.jsxs("div",{className:s.cn("bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700 bear-shrink-0",j&&"bear-sticky bear-top-0 bear-z-10 bear-bg-white dark:bear-bg-neutral-900"),children:[n&&e.jsx("h2",{id:"bottom-sheet-title",className:"bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",children:n}),d&&e.jsx("button",{onClick:b,className:"bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors","aria-label":"Close",children:e.jsx(q.XIcon,{className:"bear-w-5 bear-h-5"})})]}),e.jsx("div",{className:s.cn("bear-flex-1 bear-min-h-0 bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",g?"bear-overflow-y-auto":"bear-overflow-hidden"),children:x})]})]});return S.createPortal(N,document.body)};exports.BottomSheet=I;
|