@forgedevstack/bear 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
- package/dist/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
- package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
- package/dist/components/DiffViewer/DiffViewer.js +97 -105
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
- package/dist/components/DiffViewer/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/GlowCard/GlowCard.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
- package/dist/components/GlowCard/GlowCard.const.js +13 -0
- package/dist/components/GlowCard/GlowCard.d.ts +3 -0
- package/dist/components/GlowCard/GlowCard.js +185 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
- package/dist/components/GlowCard/index.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
- package/dist/components/Heatmap/Heatmap.const.js +11 -0
- package/dist/components/Heatmap/Heatmap.d.ts +3 -0
- package/dist/components/Heatmap/Heatmap.js +103 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
- package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.utils.js +18 -0
- package/dist/components/Heatmap/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
- package/dist/components/ImageAnnotation/index.d.ts +2 -0
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
- package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
- package/dist/components/MediaPlayer/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +26 -4
- package/dist/components/Stepper/Stepper.const.js +39 -20
- package/dist/components/Stepper/Stepper.d.ts +3 -10
- package/dist/components/Stepper/Stepper.js +189 -130
- package/dist/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/components/Stepper/Stepper.utils.cjs +1 -0
- package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
- package/dist/components/Stepper/Stepper.utils.js +19 -0
- package/dist/components/Stepper/components/StepperControls.cjs +1 -0
- package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
- package/dist/components/Stepper/components/StepperControls.js +32 -0
- package/dist/components/Stepper/index.d.ts +2 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
- package/dist/components/TagCloud/TagCloud.const.js +8 -0
- package/dist/components/TagCloud/TagCloud.d.ts +3 -0
- package/dist/components/TagCloud/TagCloud.js +76 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
- package/dist/components/TagCloud/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
- package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.js +65 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
- package/dist/components/TimelineChart/index.d.ts +2 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -4
- package/dist/components/index.js +319 -296
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +412 -388
- package/dist/styles/_effects.css +32 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a={placeholder:"Phone number",searchCountry:"Search country...",noResults:"No countries found"},e={sm:"bear-py-1.5 bear-px-3 bear-text-sm",md:"bear-py-2 bear-px-4 bear-text-sm",lg:"bear-py-2.5 bear-px-5 bear-text-base"},o={default:"bear-bg-white dark:bear-bg-zinc-800 bear-border-zinc-300 dark:bear-border-zinc-600",filled:"bear-bg-zinc-100 dark:bear-bg-zinc-700 bear-border-transparent",outline:"bear-bg-transparent bear-border-zinc-300 dark:bear-border-zinc-500"},d=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a={placeholder:"Phone number",searchCountry:"Search country...",noResults:"No countries found"},e={sm:"bear-py-1.5 bear-px-3 bear-text-sm",md:"bear-py-2 bear-px-4 bear-text-sm",lg:"bear-py-2.5 bear-px-5 bear-text-base"},o={default:"bear-bg-white dark:bear-bg-zinc-800 bear-border-zinc-300 dark:bear-border-zinc-600",filled:"bear-bg-zinc-100 dark:bear-bg-zinc-700 bear-border-transparent",outline:"bear-bg-transparent bear-border-zinc-300 dark:bear-border-zinc-500"},d=1e4,l=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸",format:"(###) ###-####"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧",format:"#### ### ####"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦",format:"(###) ###-####"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺",format:"#### ### ###"},{code:"DE",name:"Germany",dialCode:"+49",flag:"🇩🇪",format:"#### #######"},{code:"FR",name:"France",dialCode:"+33",flag:"🇫🇷",format:"## ## ## ## ##"},{code:"IT",name:"Italy",dialCode:"+39",flag:"🇮🇹",format:"### ### ####"},{code:"ES",name:"Spain",dialCode:"+34",flag:"🇪🇸",format:"### ## ## ##"},{code:"NL",name:"Netherlands",dialCode:"+31",flag:"🇳🇱",format:"## ### ####"},{code:"BE",name:"Belgium",dialCode:"+32",flag:"🇧🇪",format:"### ## ## ##"},{code:"CH",name:"Switzerland",dialCode:"+41",flag:"🇨🇭",format:"## ### ## ##"},{code:"AT",name:"Austria",dialCode:"+43",flag:"🇦🇹",format:"### #######"},{code:"SE",name:"Sweden",dialCode:"+46",flag:"🇸🇪",format:"##-### ## ##"},{code:"NO",name:"Norway",dialCode:"+47",flag:"🇳🇴",format:"### ## ###"},{code:"DK",name:"Denmark",dialCode:"+45",flag:"🇩🇰",format:"## ## ## ##"},{code:"FI",name:"Finland",dialCode:"+358",flag:"🇫🇮",format:"## ### ####"},{code:"PL",name:"Poland",dialCode:"+48",flag:"🇵🇱",format:"### ### ###"},{code:"PT",name:"Portugal",dialCode:"+351",flag:"🇵🇹",format:"### ### ###"},{code:"IE",name:"Ireland",dialCode:"+353",flag:"🇮🇪",format:"## ### ####"},{code:"GR",name:"Greece",dialCode:"+30",flag:"🇬🇷",format:"### ### ####"},{code:"CZ",name:"Czech Republic",dialCode:"+420",flag:"🇨🇿",format:"### ### ###"},{code:"HU",name:"Hungary",dialCode:"+36",flag:"🇭🇺",format:"## ### ####"},{code:"RO",name:"Romania",dialCode:"+40",flag:"🇷🇴",format:"### ### ###"},{code:"BG",name:"Bulgaria",dialCode:"+359",flag:"🇧🇬",format:"### ### ###"},{code:"HR",name:"Croatia",dialCode:"+385",flag:"🇭🇷",format:"## ### ####"},{code:"SK",name:"Slovakia",dialCode:"+421",flag:"🇸🇰",format:"### ### ###"},{code:"SI",name:"Slovenia",dialCode:"+386",flag:"🇸🇮",format:"## ### ###"},{code:"LT",name:"Lithuania",dialCode:"+370",flag:"🇱🇹",format:"### #####"},{code:"LV",name:"Latvia",dialCode:"+371",flag:"🇱🇻",format:"## ### ###"},{code:"EE",name:"Estonia",dialCode:"+372",flag:"🇪🇪",format:"### ####"},{code:"JP",name:"Japan",dialCode:"+81",flag:"🇯🇵",format:"##-####-####"},{code:"KR",name:"South Korea",dialCode:"+82",flag:"🇰🇷",format:"##-####-####"},{code:"CN",name:"China",dialCode:"+86",flag:"🇨🇳",format:"### #### ####"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳",format:"##### #####"},{code:"SG",name:"Singapore",dialCode:"+65",flag:"🇸🇬",format:"#### ####"},{code:"HK",name:"Hong Kong",dialCode:"+852",flag:"🇭🇰",format:"#### ####"},{code:"TW",name:"Taiwan",dialCode:"+886",flag:"🇹🇼",format:"### ### ###"},{code:"TH",name:"Thailand",dialCode:"+66",flag:"🇹🇭",format:"## ### ####"},{code:"MY",name:"Malaysia",dialCode:"+60",flag:"🇲🇾",format:"##-### ####"},{code:"ID",name:"Indonesia",dialCode:"+62",flag:"🇮🇩",format:"### ### ####"},{code:"PH",name:"Philippines",dialCode:"+63",flag:"🇵🇭",format:"### ### ####"},{code:"VN",name:"Vietnam",dialCode:"+84",flag:"🇻🇳",format:"### ### ####"},{code:"RU",name:"Russia",dialCode:"+7",flag:"🇷🇺",format:"### ###-##-##"},{code:"UA",name:"Ukraine",dialCode:"+380",flag:"🇺🇦",format:"## ### ## ##"},{code:"TR",name:"Turkey",dialCode:"+90",flag:"🇹🇷",format:"### ### ## ##"},{code:"IL",name:"Israel",dialCode:"+972",flag:"🇮🇱",format:"##-###-####"},{code:"AE",name:"United Arab Emirates",dialCode:"+971",flag:"🇦🇪",format:"## ### ####"},{code:"SA",name:"Saudi Arabia",dialCode:"+966",flag:"🇸🇦",format:"## ### ####"},{code:"EG",name:"Egypt",dialCode:"+20",flag:"🇪🇬",format:"### ### ####"},{code:"ZA",name:"South Africa",dialCode:"+27",flag:"🇿🇦",format:"## ### ####"},{code:"NG",name:"Nigeria",dialCode:"+234",flag:"🇳🇬",format:"### ### ####"},{code:"KE",name:"Kenya",dialCode:"+254",flag:"🇰🇪",format:"### ### ###"},{code:"BR",name:"Brazil",dialCode:"+55",flag:"🇧🇷",format:"(##) #####-####"},{code:"MX",name:"Mexico",dialCode:"+52",flag:"🇲🇽",format:"## #### ####"},{code:"AR",name:"Argentina",dialCode:"+54",flag:"🇦🇷",format:"## ####-####"},{code:"CO",name:"Colombia",dialCode:"+57",flag:"🇨🇴",format:"### ### ####"},{code:"CL",name:"Chile",dialCode:"+56",flag:"🇨🇱",format:"# #### ####"},{code:"PE",name:"Peru",dialCode:"+51",flag:"🇵🇪",format:"### ### ###"},{code:"VE",name:"Venezuela",dialCode:"+58",flag:"🇻🇪",format:"### ### ####"},{code:"NZ",name:"New Zealand",dialCode:"+64",flag:"🇳🇿",format:"## ### ####"}],r="US";exports.COUNTRIES=l;exports.DEFAULT_COUNTRY_CODE=r;exports.PHONE_INPUT_DEFAULT_TRANSLATIONS=a;exports.PHONE_INPUT_DROPDOWN_Z_INDEX=d;exports.PHONE_INPUT_SIZE_CLASSES=e;exports.PHONE_INPUT_VARIANT_CLASSES=o;
|
|
@@ -10,7 +10,7 @@ const a = {
|
|
|
10
10
|
default: "bear-bg-white dark:bear-bg-zinc-800 bear-border-zinc-300 dark:bear-border-zinc-600",
|
|
11
11
|
filled: "bear-bg-zinc-100 dark:bear-bg-zinc-700 bear-border-transparent",
|
|
12
12
|
outline: "bear-bg-transparent bear-border-zinc-300 dark:bear-border-zinc-500"
|
|
13
|
-
}, d =
|
|
13
|
+
}, d = 1e4, l = [
|
|
14
14
|
{ code: "US", name: "United States", dialCode: "+1", flag: "🇺🇸", format: "(###) ###-####" },
|
|
15
15
|
{ code: "GB", name: "United Kingdom", dialCode: "+44", flag: "🇬🇧", format: "#### ### ####" },
|
|
16
16
|
{ code: "CA", name: "Canada", dialCode: "+1", flag: "🇨🇦", format: "(###) ###-####" },
|
|
@@ -1,84 +1,89 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { useState as u, useRef as x, useMemo as _, useEffect as
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useRef as x, useMemo as _, useEffect as w, useCallback as j } from "react";
|
|
3
3
|
import { createPortal as re } from "react-dom";
|
|
4
4
|
import { cn as s } from "../../utils/cn.js";
|
|
5
5
|
import { PHONE_INPUT_DEFAULT_TRANSLATIONS as te, COUNTRIES as ae, DEFAULT_COUNTRY_CODE as ne, PHONE_INPUT_SIZE_CLASSES as Q, PHONE_INPUT_VARIANT_CLASSES as oe, PHONE_INPUT_DROPDOWN_Z_INDEX as be } from "./PhoneInput.const.js";
|
|
6
|
-
import { sortCountriesWithPreferred as ce, getCountryByCode as
|
|
6
|
+
import { sortCountriesWithPreferred as ce, getCountryByCode as ie, filterCountries as de, formatPhoneNumber as Z, createPhoneValue as F, parsePhoneDigits as se } from "./PhoneInput.utils.js";
|
|
7
7
|
const xe = ({
|
|
8
|
-
value:
|
|
8
|
+
value: t,
|
|
9
9
|
onChange: b,
|
|
10
10
|
defaultCountry: E = ne,
|
|
11
|
-
placeholder:
|
|
11
|
+
placeholder: X,
|
|
12
12
|
label: S,
|
|
13
|
-
helperText:
|
|
14
|
-
error:
|
|
15
|
-
disabled:
|
|
16
|
-
required:
|
|
17
|
-
size:
|
|
13
|
+
helperText: L,
|
|
14
|
+
error: f,
|
|
15
|
+
disabled: h = !1,
|
|
16
|
+
required: Y = !1,
|
|
17
|
+
size: O = "md",
|
|
18
18
|
variant: q = "default",
|
|
19
|
-
onlyCountries:
|
|
19
|
+
onlyCountries: p,
|
|
20
20
|
excludeCountries: l,
|
|
21
|
-
preferredCountries:
|
|
22
|
-
searchable:
|
|
23
|
-
showFlags:
|
|
21
|
+
preferredCountries: R = [],
|
|
22
|
+
searchable: N = !0,
|
|
23
|
+
showFlags: D = !0,
|
|
24
24
|
showDialCode: G = !0,
|
|
25
25
|
className: J,
|
|
26
26
|
testId: K,
|
|
27
|
-
translations:
|
|
27
|
+
translations: T,
|
|
28
28
|
icon: $
|
|
29
29
|
}) => {
|
|
30
|
-
const [
|
|
30
|
+
const [i, g] = u(!1), [k, P] = u(""), [I, U] = u(""), [A, v] = u({ top: 0, left: 0 }), V = x(null), z = x(null), W = x(null), y = x(null), B = _(() => ({
|
|
31
31
|
...te,
|
|
32
|
-
...
|
|
33
|
-
}), [
|
|
32
|
+
...T
|
|
33
|
+
}), [T]), m = _(() => {
|
|
34
34
|
let e = [...ae];
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
e = e.filter((
|
|
35
|
+
if (p != null && p.length) {
|
|
36
|
+
const n = new Set(p.map((r) => r.toUpperCase()));
|
|
37
|
+
e = e.filter((r) => n.has(r.code));
|
|
38
38
|
}
|
|
39
39
|
if (l != null && l.length) {
|
|
40
|
-
const
|
|
41
|
-
e = e.filter((
|
|
40
|
+
const n = new Set(l.map((r) => r.toUpperCase()));
|
|
41
|
+
e = e.filter((r) => !n.has(r.code));
|
|
42
42
|
}
|
|
43
|
-
return ce(e,
|
|
44
|
-
}, [
|
|
45
|
-
const e = (
|
|
46
|
-
return
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
if ((
|
|
50
|
-
const e =
|
|
43
|
+
return ce(e, R);
|
|
44
|
+
}, [p, l, R]), a = _(() => {
|
|
45
|
+
const e = (t == null ? void 0 : t.countryCode) || E;
|
|
46
|
+
return ie(m, e) || m[0];
|
|
47
|
+
}, [t == null ? void 0 : t.countryCode, E, m]), H = _(() => de(m, k), [m, k]);
|
|
48
|
+
w(() => {
|
|
49
|
+
if ((t == null ? void 0 : t.number) !== void 0) {
|
|
50
|
+
const e = Z(t.number, a == null ? void 0 : a.format);
|
|
51
51
|
U(e);
|
|
52
52
|
}
|
|
53
|
-
}, [
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
}, [t == null ? void 0 : t.number, a == null ? void 0 : a.format]), w(() => {
|
|
54
|
+
if (!i || !z.current) return;
|
|
55
|
+
const e = 256, n = () => {
|
|
56
|
+
const r = z.current.getBoundingClientRect();
|
|
57
|
+
let c = r.left;
|
|
58
|
+
c = Math.max(8, Math.min(c, window.innerWidth - e - 8)), v({
|
|
59
|
+
top: r.bottom + 4,
|
|
60
|
+
left: c
|
|
59
61
|
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
};
|
|
63
|
+
return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
64
|
+
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
65
|
+
};
|
|
66
|
+
}, [i]), w(() => {
|
|
67
|
+
i && N && y.current && y.current.focus();
|
|
68
|
+
}, [i, N]), w(() => {
|
|
69
|
+
const e = (n) => {
|
|
70
|
+
var c, M;
|
|
71
|
+
const r = n.target;
|
|
72
|
+
(c = V.current) != null && c.contains(r) || (M = r.closest) != null && M.call(r, "[data-bear-phone-dropdown]") || (g(!1), P(""));
|
|
68
73
|
};
|
|
69
74
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
70
75
|
}, []);
|
|
71
|
-
const
|
|
72
|
-
var
|
|
73
|
-
const
|
|
74
|
-
b == null || b(
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
77
|
-
if (U(
|
|
78
|
-
const
|
|
79
|
-
b == null || b(
|
|
76
|
+
const C = j((e) => {
|
|
77
|
+
var r;
|
|
78
|
+
const n = F(e, (t == null ? void 0 : t.number) || I);
|
|
79
|
+
b == null || b(n), g(!1), P(""), (r = W.current) == null || r.focus();
|
|
80
|
+
}, [t == null ? void 0 : t.number, I, b]), ee = j((e) => {
|
|
81
|
+
const n = se(e.target.value), r = Z(n, a == null ? void 0 : a.format);
|
|
82
|
+
if (U(r), a) {
|
|
83
|
+
const c = F(a, n);
|
|
84
|
+
b == null || b(c);
|
|
80
85
|
}
|
|
81
|
-
}, [
|
|
86
|
+
}, [a, b]);
|
|
82
87
|
return /* @__PURE__ */ d(
|
|
83
88
|
"div",
|
|
84
89
|
{
|
|
@@ -88,63 +93,63 @@ const xe = ({
|
|
|
88
93
|
children: [
|
|
89
94
|
S && /* @__PURE__ */ d("label", { className: "Bear-PhoneInput__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5", children: [
|
|
90
95
|
S,
|
|
91
|
-
|
|
96
|
+
Y && /* @__PURE__ */ o("span", { className: "bear-text-red-500 bear-ml-0.5", children: "*" })
|
|
92
97
|
] }),
|
|
93
98
|
/* @__PURE__ */ d("div", { className: s(
|
|
94
99
|
"Bear-PhoneInput__wrapper bear-flex bear-items-center bear-rounded-lg bear-border bear-transition-colors",
|
|
95
100
|
oe[q],
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
f ? "bear-border-red-500" : "focus-within:bear-border-pink-500",
|
|
102
|
+
h && "bear-opacity-50 bear-cursor-not-allowed"
|
|
98
103
|
), children: [
|
|
99
104
|
/* @__PURE__ */ d(
|
|
100
105
|
"button",
|
|
101
106
|
{
|
|
102
107
|
ref: z,
|
|
103
108
|
type: "button",
|
|
104
|
-
onClick: () => !
|
|
105
|
-
disabled:
|
|
109
|
+
onClick: () => !h && g(!i),
|
|
110
|
+
disabled: h,
|
|
106
111
|
className: s(
|
|
107
112
|
"Bear-PhoneInput__country-trigger bear-flex bear-items-center bear-gap-1 bear-border-r bear-border-zinc-300 dark:bear-border-zinc-600 bear-shrink-0 bear-text-gray-900 dark:bear-text-white",
|
|
108
|
-
Q[
|
|
113
|
+
Q[O]
|
|
109
114
|
),
|
|
110
115
|
children: [
|
|
111
|
-
|
|
112
|
-
G &&
|
|
113
|
-
$ ?? /* @__PURE__ */
|
|
116
|
+
D && a && /* @__PURE__ */ o("span", { className: "Bear-PhoneInput__flag bear-text-lg", children: a.flag }),
|
|
117
|
+
G && a && /* @__PURE__ */ o("span", { className: "Bear-PhoneInput__dial-code bear-text-gray-600 dark:bear-text-zinc-400", children: a.dialCode }),
|
|
118
|
+
$ ?? /* @__PURE__ */ o(
|
|
114
119
|
"svg",
|
|
115
120
|
{
|
|
116
121
|
className: s(
|
|
117
122
|
"Bear-PhoneInput__chevron bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-400 bear-transition-transform",
|
|
118
|
-
|
|
123
|
+
i && "bear-rotate-180"
|
|
119
124
|
),
|
|
120
125
|
fill: "none",
|
|
121
126
|
viewBox: "0 0 24 24",
|
|
122
127
|
stroke: "currentColor",
|
|
123
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
124
129
|
}
|
|
125
130
|
)
|
|
126
131
|
]
|
|
127
132
|
}
|
|
128
133
|
),
|
|
129
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ o(
|
|
130
135
|
"input",
|
|
131
136
|
{
|
|
132
|
-
ref:
|
|
137
|
+
ref: W,
|
|
133
138
|
type: "tel",
|
|
134
139
|
value: I,
|
|
135
140
|
onChange: ee,
|
|
136
|
-
placeholder:
|
|
137
|
-
disabled:
|
|
141
|
+
placeholder: X || B.placeholder,
|
|
142
|
+
disabled: h,
|
|
138
143
|
className: s(
|
|
139
144
|
"Bear-PhoneInput__input bear-flex-1 bear-bg-transparent bear-border-0 bear-outline-none bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400 dark:placeholder:bear-text-zinc-500",
|
|
140
|
-
Q[
|
|
145
|
+
Q[O]
|
|
141
146
|
)
|
|
142
147
|
}
|
|
143
148
|
)
|
|
144
149
|
] }),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
f && /* @__PURE__ */ o("p", { className: "Bear-PhoneInput__error bear-mt-1 bear-text-xs bear-text-red-400", children: f }),
|
|
151
|
+
L && !f && /* @__PURE__ */ o("p", { className: "Bear-PhoneInput__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400", children: L }),
|
|
152
|
+
i && typeof document < "u" && re(
|
|
148
153
|
/* @__PURE__ */ d(
|
|
149
154
|
"div",
|
|
150
155
|
{
|
|
@@ -152,30 +157,30 @@ const xe = ({
|
|
|
152
157
|
className: "Bear-PhoneInput__dropdown bear-fixed bear-w-64 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-overflow-hidden",
|
|
153
158
|
style: { top: A.top, left: A.left, zIndex: be },
|
|
154
159
|
children: [
|
|
155
|
-
|
|
160
|
+
N && /* @__PURE__ */ o("div", { className: "Bear-PhoneInput__search bear-p-2 bear-border-b bear-border-zinc-200 dark:bear-border-zinc-700", children: /* @__PURE__ */ o(
|
|
156
161
|
"input",
|
|
157
162
|
{
|
|
158
163
|
ref: y,
|
|
159
164
|
type: "text",
|
|
160
|
-
value:
|
|
161
|
-
onChange: (e) =>
|
|
165
|
+
value: k,
|
|
166
|
+
onChange: (e) => P(e.target.value),
|
|
162
167
|
placeholder: B.searchCountry,
|
|
163
168
|
className: "bear-w-full bear-px-3 bear-py-2 bear-bg-gray-50 dark:bear-bg-zinc-700 bear-border bear-border-zinc-200 dark:bear-border-zinc-600 bear-rounded bear-text-sm bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400 dark:placeholder:bear-text-zinc-500 bear-outline-none focus:bear-border-pink-500"
|
|
164
169
|
}
|
|
165
170
|
) }),
|
|
166
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ o("div", { className: "Bear-PhoneInput__country-list bear-max-h-60 bear-overflow-y-auto", children: H.length === 0 ? /* @__PURE__ */ o("div", { className: "bear-px-3 bear-py-4 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500", children: B.noResults }) : H.map((e) => /* @__PURE__ */ d(
|
|
167
172
|
"button",
|
|
168
173
|
{
|
|
169
174
|
type: "button",
|
|
170
|
-
onClick: () =>
|
|
175
|
+
onClick: () => C(e),
|
|
171
176
|
className: s(
|
|
172
177
|
"Bear-PhoneInput__country-option bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-3 bear-py-2 bear-text-left bear-text-sm bear-transition-colors",
|
|
173
|
-
(
|
|
178
|
+
(a == null ? void 0 : a.code) === e.code ? "bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400" : "bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700"
|
|
174
179
|
),
|
|
175
180
|
children: [
|
|
176
|
-
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
181
|
+
D && /* @__PURE__ */ o("span", { className: "Bear-PhoneInput__country-flag bear-text-lg", children: e.flag }),
|
|
182
|
+
/* @__PURE__ */ o("span", { className: "Bear-PhoneInput__country-name bear-flex-1", children: e.name }),
|
|
183
|
+
/* @__PURE__ */ o("span", { className: "Bear-PhoneInput__country-dial bear-text-gray-500 dark:bear-text-zinc-500", children: e.dialCode })
|
|
179
184
|
]
|
|
180
185
|
},
|
|
181
186
|
e.code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),v=require("../../utils/cn.cjs"),L=require("../Typography/Typography.cjs"),k=require("../Portal/Portal.cjs"),s=require("./Popconfirm.const.cjs"),I=1e4;function F(l,t,a){const e={position:"fixed",zIndex:I};return l==="bottom"?(e.top=t.bottom+a,e.left=t.left+t.width/2,e.transform="translateX(-50%)"):l==="top"?(e.bottom=window.innerHeight-t.top+a,e.left=t.left+t.width/2,e.transform="translateX(-50%)"):l==="left"?(e.right=window.innerWidth-t.left+a,e.top=t.top+t.height/2,e.transform="translateY(-50%)"):(e.left=t.right+a,e.top=t.top+t.height/2,e.transform="translateY(-50%)"),e}const B=n.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),q=l=>{const{title:t,description:a,onConfirm:e,onCancel:f,confirmText:b=s.DEFAULT_CONFIRM_TEXT,cancelText:_=s.DEFAULT_CANCEL_TEXT,icon:T=B,placement:m="bottom",disabled:p=!1,children:x,variant:g="default",testId:w}=l,[o,h]=i.useState(!1),[y,A]=i.useState({}),d=i.useRef(null),E=i.useRef(null),c=i.useCallback(()=>h(!1),[]);i.useEffect(()=>{if(!o||!d.current)return;const r=()=>{if(!d.current)return;const u=d.current.getBoundingClientRect();A(F(m,u,8))};return r(),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[o,m]),i.useEffect(()=>{if(!o)return;const r=u=>{var C,N;const S=u.target;(C=d.current)!=null&&C.contains(S)||(N=E.current)!=null&&N.contains(S)||c()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o,c]),i.useEffect(()=>{const r=u=>{u.key==="Escape"&&c()};return o&&document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,c]);const P=()=>{p||h(!o)},R=()=>{e==null||e(),c()},j=()=>{f==null||f(),c()},O=g==="danger"?s.CONFIRM_BTN_DANGER_CLASSES:s.CONFIRM_BTN_DEFAULT_CLASSES;return n.jsxs("div",{className:v.cn(s.ROOT_CLASS,"bear-inline-block"),"data-testid":w,children:[n.jsx("div",{ref:d,onClick:P,className:v.cn("bear-cursor-pointer",p&&"bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"),children:x}),o&&n.jsx(k.Portal,{children:n.jsxs("div",{ref:E,className:s.POPUP_CLASSES,style:y,children:[n.jsxs("div",{className:s.ICON_AREA_CLASSES,children:[n.jsx("div",{className:s.ICON_WRAPPER_CLASSES,children:T}),n.jsxs("div",{className:s.CONTENT_CLASSES,children:[n.jsx(L.Typography,{variant:"body2",className:"bear-text-gray-900 dark:bear-text-zinc-100",children:t}),a&&n.jsx(L.Typography,{variant:"caption",color:"secondary",className:"bear-mt-0.5",children:a})]})]}),n.jsxs("div",{className:s.BUTTONS_WRAPPER_CLASSES,children:[n.jsx("button",{type:"button",className:s.CANCEL_BTN_CLASSES,onClick:j,children:_}),n.jsx("button",{type:"button",className:O,onClick:R,children:b})]})]})})]})};exports.Popconfirm=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-Popconfirm",r="bear-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-Popconfirm",r="bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-4 bear-min-w-[220px] bear-max-w-[320px]",a="bear-flex bear-items-center bear-gap-3 bear-mb-3",b="bear-flex-shrink-0 bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-amber-100 dark:bear-bg-amber-900/30 bear-text-amber-600 dark:bear-text-amber-400",t="bear-flex-1 bear-min-w-0",S="bear-flex bear-justify-end bear-gap-2 bear-mt-4",o="bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600 dark:hover:bear-bg-pink-600",n="bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-red-500 bear-text-white hover:bear-bg-red-600 dark:hover:bear-bg-red-600",_="bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-white dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-300 bear-border bear-border-gray-300 dark:bear-border-zinc-600 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-600",C="Confirm",E="Cancel";exports.BUTTONS_WRAPPER_CLASSES=S;exports.CANCEL_BTN_CLASSES=_;exports.CONFIRM_BTN_DANGER_CLASSES=n;exports.CONFIRM_BTN_DEFAULT_CLASSES=o;exports.CONTENT_CLASSES=t;exports.DEFAULT_CANCEL_TEXT=E;exports.DEFAULT_CONFIRM_TEXT=C;exports.ICON_AREA_CLASSES=a;exports.ICON_WRAPPER_CLASSES=b;exports.POPUP_CLASSES=r;exports.ROOT_CLASS=e;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { PopconfirmPlacement } from './Popconfirm.types';
|
|
2
1
|
export declare const ROOT_CLASS = "Bear-Popconfirm";
|
|
3
|
-
export declare const POPUP_CLASSES = "bear-
|
|
4
|
-
export declare const PLACEMENT_OFFSETS: Record<PopconfirmPlacement, string>;
|
|
2
|
+
export declare const POPUP_CLASSES = "bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-4 bear-min-w-[220px] bear-max-w-[320px]";
|
|
5
3
|
export declare const ICON_AREA_CLASSES = "bear-flex bear-items-center bear-gap-3 bear-mb-3";
|
|
6
4
|
export declare const ICON_WRAPPER_CLASSES = "bear-flex-shrink-0 bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-amber-100 dark:bear-bg-amber-900/30 bear-text-amber-600 dark:bear-text-amber-400";
|
|
7
5
|
export declare const CONTENT_CLASSES = "bear-flex-1 bear-min-w-0";
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
top: "bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-mb-2",
|
|
3
|
-
bottom: "bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-mt-2",
|
|
4
|
-
left: "bear-right-full bear-top-1/2 -bear-translate-y-1/2 bear-mr-2",
|
|
5
|
-
right: "bear-left-full bear-top-1/2 -bear-translate-y-1/2 bear-ml-2"
|
|
6
|
-
}, b = "bear-flex bear-items-center bear-gap-3 bear-mb-3", t = "bear-flex-shrink-0 bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-amber-100 dark:bear-bg-amber-900/30 bear-text-amber-600 dark:bear-text-amber-400", o = "bear-flex-1 bear-min-w-0", n = "bear-flex bear-justify-end bear-gap-2 bear-mt-4", d = "bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600 dark:hover:bear-bg-pink-600", i = "bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-red-500 bear-text-white hover:bear-bg-red-600 dark:hover:bear-bg-red-600", s = "bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-white dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-300 bear-border bear-border-gray-300 dark:bear-border-zinc-600 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-600", l = "Confirm", m = "Cancel";
|
|
1
|
+
const r = "Bear-Popconfirm", e = "bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-4 bear-min-w-[220px] bear-max-w-[320px]", a = "bear-flex bear-items-center bear-gap-3 bear-mb-3", b = "bear-flex-shrink-0 bear-w-8 bear-h-8 bear-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-amber-100 dark:bear-bg-amber-900/30 bear-text-amber-600 dark:bear-text-amber-400", t = "bear-flex-1 bear-min-w-0", o = "bear-flex bear-justify-end bear-gap-2 bear-mt-4", n = "bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600 dark:hover:bear-bg-pink-600", d = "bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-red-500 bear-text-white hover:bear-bg-red-600 dark:hover:bear-bg-red-600", i = "bear-px-3 bear-py-1.5 bear-text-sm bear-font-medium bear-rounded-md bear-transition-colors bear-bg-white dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-300 bear-border bear-border-gray-300 dark:bear-border-zinc-600 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-600", S = "Confirm", s = "Cancel";
|
|
7
2
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
r as
|
|
19
|
-
e as ROOT_CLASS
|
|
3
|
+
o as BUTTONS_WRAPPER_CLASSES,
|
|
4
|
+
i as CANCEL_BTN_CLASSES,
|
|
5
|
+
d as CONFIRM_BTN_DANGER_CLASSES,
|
|
6
|
+
n as CONFIRM_BTN_DEFAULT_CLASSES,
|
|
7
|
+
t as CONTENT_CLASSES,
|
|
8
|
+
s as DEFAULT_CANCEL_TEXT,
|
|
9
|
+
S as DEFAULT_CONFIRM_TEXT,
|
|
10
|
+
a as ICON_AREA_CLASSES,
|
|
11
|
+
b as ICON_WRAPPER_CLASSES,
|
|
12
|
+
e as POPUP_CLASSES,
|
|
13
|
+
r as ROOT_CLASS
|
|
20
14
|
};
|
|
@@ -1,65 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Typography as
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as L, useRef as v, useCallback as B, useEffect as u } from "react";
|
|
3
|
+
import { cn as b } from "../../utils/cn.js";
|
|
4
|
+
import { Typography as _ } from "../Typography/Typography.js";
|
|
5
|
+
import { Portal as U } from "../Portal/Portal.js";
|
|
6
|
+
import { DEFAULT_CONFIRM_TEXT as z, DEFAULT_CANCEL_TEXT as D, POPUP_CLASSES as M, ICON_AREA_CLASSES as W, ICON_WRAPPER_CLASSES as X, CONTENT_CLASSES as j, BUTTONS_WRAPPER_CLASSES as Y, CANCEL_BTN_CLASSES as G, CONFIRM_BTN_DANGER_CLASSES as H, CONFIRM_BTN_DEFAULT_CLASSES as Z, ROOT_CLASS as q } from "./Popconfirm.const.js";
|
|
7
|
+
const J = 1e4;
|
|
8
|
+
function K(a, t, i) {
|
|
9
|
+
const e = { position: "fixed", zIndex: J };
|
|
10
|
+
return a === "bottom" ? (e.top = t.bottom + i, e.left = t.left + t.width / 2, e.transform = "translateX(-50%)") : a === "top" ? (e.bottom = window.innerHeight - t.top + i, e.left = t.left + t.width / 2, e.transform = "translateX(-50%)") : a === "left" ? (e.right = window.innerWidth - t.left + i, e.top = t.top + t.height / 2, e.transform = "translateY(-50%)") : (e.left = t.right + i, e.top = t.top + t.height / 2, e.transform = "translateY(-50%)"), e;
|
|
11
|
+
}
|
|
12
|
+
const Q = /* @__PURE__ */ r("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }), oe = (a) => {
|
|
7
13
|
const {
|
|
8
|
-
title:
|
|
9
|
-
description:
|
|
10
|
-
onConfirm:
|
|
11
|
-
onCancel:
|
|
12
|
-
confirmText:
|
|
13
|
-
cancelText:
|
|
14
|
-
icon:
|
|
15
|
-
placement:
|
|
16
|
-
disabled:
|
|
17
|
-
children:
|
|
18
|
-
variant:
|
|
19
|
-
testId:
|
|
20
|
-
} =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
title: t,
|
|
15
|
+
description: i,
|
|
16
|
+
onConfirm: e,
|
|
17
|
+
onCancel: m,
|
|
18
|
+
confirmText: w = z,
|
|
19
|
+
cancelText: A = D,
|
|
20
|
+
icon: T = Q,
|
|
21
|
+
placement: f = "bottom",
|
|
22
|
+
disabled: p = !1,
|
|
23
|
+
children: g,
|
|
24
|
+
variant: O = "default",
|
|
25
|
+
testId: k
|
|
26
|
+
} = a, [o, h] = L(!1), [R, y] = L({}), l = v(null), E = v(null), s = B(() => h(!1), []);
|
|
27
|
+
u(() => {
|
|
28
|
+
if (!o || !l.current) return;
|
|
29
|
+
const n = () => {
|
|
30
|
+
if (!l.current) return;
|
|
31
|
+
const c = l.current.getBoundingClientRect();
|
|
32
|
+
y(K(f, c, 8));
|
|
24
33
|
};
|
|
25
|
-
return n
|
|
26
|
-
|
|
27
|
-
const r = (i) => {
|
|
28
|
-
i.key === "Escape" && t();
|
|
34
|
+
return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
35
|
+
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
29
36
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
}, [o, f]), u(() => {
|
|
38
|
+
if (!o) return;
|
|
39
|
+
const n = (c) => {
|
|
40
|
+
var S, N;
|
|
41
|
+
const C = c.target;
|
|
42
|
+
(S = l.current) != null && S.contains(C) || (N = E.current) != null && N.contains(C) || s();
|
|
43
|
+
};
|
|
44
|
+
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
45
|
+
}, [o, s]), u(() => {
|
|
46
|
+
const n = (c) => {
|
|
47
|
+
c.key === "Escape" && s();
|
|
48
|
+
};
|
|
49
|
+
return o && document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
50
|
+
}, [o, s]);
|
|
51
|
+
const P = () => {
|
|
52
|
+
p || h(!o);
|
|
53
|
+
}, x = () => {
|
|
54
|
+
e == null || e(), s();
|
|
55
|
+
}, I = () => {
|
|
56
|
+
m == null || m(), s();
|
|
57
|
+
}, F = O === "danger" ? H : Z;
|
|
58
|
+
return /* @__PURE__ */ d("div", { className: b(q, "bear-inline-block"), "data-testid": k, children: [
|
|
59
|
+
/* @__PURE__ */ r(
|
|
41
60
|
"div",
|
|
42
61
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
ref: l,
|
|
63
|
+
onClick: P,
|
|
64
|
+
className: b("bear-cursor-pointer", p && "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"),
|
|
65
|
+
children: g
|
|
46
66
|
}
|
|
47
67
|
),
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
68
|
+
o && /* @__PURE__ */ r(U, { children: /* @__PURE__ */ d("div", { ref: E, className: M, style: R, children: [
|
|
69
|
+
/* @__PURE__ */ d("div", { className: W, children: [
|
|
70
|
+
/* @__PURE__ */ r("div", { className: X, children: T }),
|
|
71
|
+
/* @__PURE__ */ d("div", { className: j, children: [
|
|
72
|
+
/* @__PURE__ */ r(_, { variant: "body2", className: "bear-text-gray-900 dark:bear-text-zinc-100", children: t }),
|
|
73
|
+
i && /* @__PURE__ */ r(_, { variant: "caption", color: "secondary", className: "bear-mt-0.5", children: i })
|
|
54
74
|
] })
|
|
55
75
|
] }),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ d("div", { className: Y, children: [
|
|
77
|
+
/* @__PURE__ */ r("button", { type: "button", className: G, onClick: I, children: A }),
|
|
78
|
+
/* @__PURE__ */ r("button", { type: "button", className: F, onClick: x, children: w })
|
|
59
79
|
] })
|
|
60
|
-
] })
|
|
80
|
+
] }) })
|
|
61
81
|
] });
|
|
62
82
|
};
|
|
63
83
|
export {
|
|
64
|
-
|
|
84
|
+
oe as Popconfirm
|
|
65
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),l=require("react"),D=require("react-dom"),p=require("../../utils/cn.cjs"),H=11e3;function X(d,t,s){const e={position:"fixed",zIndex:H},a=d.split("-")[0],n=d.includes("start"),o=d.includes("end");return a==="bottom"?(e.top=t.bottom+s,n?e.left=t.left:o?e.left=t.right:e.left=t.left+t.width/2):a==="top"?(e.bottom=window.innerHeight-t.top+s,n?e.left=t.left:o?e.left=t.right:e.left=t.left+t.width/2):a==="left"?(e.right=window.innerWidth-t.left+s,n?e.top=t.top:o?e.bottom=window.innerHeight-t.bottom:e.top=t.top+t.height/2):(e.left=t.right+s,n?e.top=t.top:o?e.bottom=window.innerHeight-t.bottom:e.top=t.top+t.height/2),a==="bottom"||a==="top"?!n&&!o?e.transform="translateX(-50%)":o&&(e.transform="translateX(-100%)"):!n&&!o?e.transform="translateY(-50%)":o&&(e.transform="translateY(-100%)"),e}const T=({children:d,content:t,placement:s="bottom",trigger:e="click",open:a,onOpenChange:n,className:o,contentClassName:x,arrow:L=!0,closeOnClickOutside:m=!0,closeOnEscape:v=!0,offset:w=8})=>{const[k,z]=l.useState(!1),[R,S]=l.useState({}),f=l.useRef(null),h=l.useRef(null),i=a!==void 0?a:k,b=l.useCallback(r=>{z(r),n==null||n(r)},[n]);l.useEffect(()=>{if(!i||!f.current)return;const r=()=>{if(!f.current)return;const u=f.current.getBoundingClientRect();S(X(s,u,w))};return r(),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[i,s,w]),l.useEffect(()=>{if(!m)return;const r=u=>{var y,g;const E=u.target;(y=f.current)!=null&&y.contains(E)||(g=h.current)!=null&&g.contains(E)||b(!1)};return i&&document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[i,m,b]),l.useEffect(()=>{if(!v)return;const r=u=>{u.key==="Escape"&&b(!1)};return i&&document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[i,v,b]);const j=()=>{e==="click"&&b(!i)},P=()=>{e==="hover"&&b(!0)},M=()=>{e==="hover"&&b(!1)},N={top:"bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-border-t-zinc-700 bear-border-x-transparent bear-border-b-transparent",bottom:"bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-border-b-zinc-700 bear-border-x-transparent bear-border-t-transparent",left:"bear-left-full bear-top-1/2 -bear-translate-y-1/2 bear-border-l-zinc-700 bear-border-y-transparent bear-border-r-transparent",right:"bear-right-full bear-top-1/2 -bear-translate-y-1/2 bear-border-r-zinc-700 bear-border-y-transparent bear-border-l-transparent"},q=s.split("-")[0],I=i&&typeof document<"u"&&D.createPortal(c.jsxs("div",{ref:h,"data-bear-popover":!0,className:p.cn("bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3",x),style:R,children:[t,L&&c.jsx("div",{className:p.cn("bear-absolute bear-w-0 bear-h-0 bear-border-8",N[q])})]}),document.body);return c.jsxs("div",{ref:f,className:p.cn("bear-relative bear-inline-block",o),onMouseEnter:P,onMouseLeave:M,children:[c.jsx("div",{onClick:j,className:"bear-cursor-pointer",children:d}),I]})};exports.Popover=T;
|