@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,151 +1,210 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as i, Fragment as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import D, { forwardRef as oe, useState as ie, useEffect as le, useMemo as U } from "react";
|
|
3
|
+
import { useBearThemeOptional as se } from "../../context/BearProvider.js";
|
|
4
|
+
import { resolveMaxVisible as ae } from "../../utils/maxVisible.utils.js";
|
|
5
|
+
import { cn as s } from "../../utils/cn.js";
|
|
6
|
+
import { Typography as V } from "../Typography/Typography.js";
|
|
7
|
+
import { Dropdown as ce } from "../Dropdown/Dropdown.js";
|
|
8
|
+
import { BearIcons as de } from "../Icon/index.js";
|
|
9
|
+
import { STEP_WRAPPER_VERTICAL as Ee, STEPPER_HORIZONTAL_CLASSES as he, STEPPER_VERTICAL_CLASSES as _e, STEPPER_BASE_CLASSES as me, DEFAULT_ORIENTATION as Te, DEFAULT_SIZE as fe, DEFAULT_SHOW_NUMBERS as Se, DEFAULT_CLICKABLE as Ie, DEFAULT_SHOW_CONNECTORS as Oe, DEFAULT_CONNECTOR_STYLE as Ce, DEFAULT_ALTERNATIVE_LABEL as Ne, CONNECTOR_STATUS as S, CONNECTOR_VERTICAL as ue, CONNECTOR_BASE as Ae, OVERFLOW_LEFT_LABEL as Le, OVERFLOW_RIGHT_LABEL as ge, STEP_STATUS_CLASSES as u, STEP_INDICATOR_SIZES as Re, STEP_INDICATOR_BASE as M, STEP_LABEL_SIZES as pe, STEP_LABEL_BASE as ve, STEP_DESCRIPTION_CLASSES as we, ERROR_ICON_VIEWBOX as be, ERROR_ICON_SIZE as z, CHECK_ICON_VIEWBOX as Be, CHECK_ICON_SIZE as Z, CHECK_ICON_POINTS as Pe } from "./Stepper.const.js";
|
|
10
|
+
import { resolveStepStatus as K, resolveIndicatorContent as ye } from "./Stepper.utils.js";
|
|
11
|
+
const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", { width: Z, height: Z, viewBox: Be, fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ t("polyline", { points: Pe }) }), Ue = () => /* @__PURE__ */ i("svg", { width: z, height: z, viewBox: be, fill: "none", stroke: "currentColor", strokeWidth: "3", children: [
|
|
12
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
13
|
+
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
14
|
+
] }), Ve = oe(
|
|
10
15
|
({
|
|
11
|
-
steps:
|
|
12
|
-
activeStep:
|
|
13
|
-
onStepClick:
|
|
14
|
-
orientation:
|
|
15
|
-
size:
|
|
16
|
-
showNumbers:
|
|
17
|
-
clickable:
|
|
18
|
-
showConnectors:
|
|
19
|
-
connectorStyle:
|
|
20
|
-
alternativeLabel:
|
|
21
|
-
completedIcon:
|
|
22
|
-
errorIcon:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
steps: o,
|
|
17
|
+
activeStep: E,
|
|
18
|
+
onStepClick: h,
|
|
19
|
+
orientation: X = Te,
|
|
20
|
+
size: A = fe,
|
|
21
|
+
showNumbers: j = Se,
|
|
22
|
+
clickable: L = Ie,
|
|
23
|
+
showConnectors: x = Oe,
|
|
24
|
+
connectorStyle: g = Ce,
|
|
25
|
+
alternativeLabel: R = Ne,
|
|
26
|
+
completedIcon: $,
|
|
27
|
+
errorIcon: G,
|
|
28
|
+
labelTypographyProps: Y,
|
|
29
|
+
descriptionTypographyProps: q,
|
|
30
|
+
maxVisibleSteps: I,
|
|
31
|
+
testId: J,
|
|
32
|
+
className: Q,
|
|
33
|
+
...ee
|
|
34
|
+
}, re) => {
|
|
35
|
+
const p = se(), [O, ne] = ie(() => typeof window < "u" ? window.innerWidth : He);
|
|
36
|
+
le(() => {
|
|
37
|
+
const e = () => ne(window.innerWidth);
|
|
38
|
+
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
39
|
+
}, []);
|
|
40
|
+
const _ = U(() => {
|
|
41
|
+
if (I != null)
|
|
42
|
+
return ae(I, { width: O, theme: p });
|
|
43
|
+
if (O < Fe && o.length > k)
|
|
44
|
+
return k;
|
|
45
|
+
}, [I, O, p, o.length]), d = X === "horizontal", v = Re[A], w = pe[A], m = d && _ != null && o.length > _, { visibleIndices: b, leftHidden: B, rightHidden: C } = U(() => {
|
|
46
|
+
if (!m || _ == null)
|
|
47
|
+
return {
|
|
48
|
+
visibleIndices: o.map((c, N) => N),
|
|
49
|
+
leftHidden: [],
|
|
50
|
+
rightHidden: []
|
|
51
|
+
};
|
|
52
|
+
const e = _, r = Math.floor(e / 2), n = Math.max(0, Math.min(E - r, o.length - e)), l = Array.from({ length: e }, (c, N) => n + N), a = [], F = [];
|
|
53
|
+
for (let c = 0; c < n; c++) a.push(c);
|
|
54
|
+
for (let c = n + e; c < o.length; c++) F.push(c);
|
|
55
|
+
return { visibleIndices: l, leftHidden: a, rightHidden: F };
|
|
56
|
+
}, [m, _, o, E]), P = (e, r, n) => {
|
|
57
|
+
const l = u[n], a = ye(
|
|
58
|
+
e,
|
|
59
|
+
r,
|
|
60
|
+
n,
|
|
61
|
+
j,
|
|
62
|
+
$,
|
|
63
|
+
G,
|
|
64
|
+
/* @__PURE__ */ t(De, {}),
|
|
65
|
+
/* @__PURE__ */ t(Ue, {})
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ t(
|
|
31
68
|
"div",
|
|
32
69
|
{
|
|
33
|
-
className:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
70
|
+
className: s(
|
|
71
|
+
M,
|
|
72
|
+
v,
|
|
73
|
+
l.indicator,
|
|
74
|
+
L && !e.disabled && "cursor-pointer hover:scale-105"
|
|
38
75
|
),
|
|
39
76
|
onClick: () => {
|
|
40
|
-
|
|
77
|
+
L && !e.disabled && h && h(r);
|
|
41
78
|
},
|
|
42
|
-
children:
|
|
79
|
+
children: a
|
|
43
80
|
}
|
|
44
81
|
);
|
|
45
|
-
},
|
|
46
|
-
if (!
|
|
47
|
-
const
|
|
48
|
-
return /* @__PURE__ */
|
|
82
|
+
}, T = (e, r) => {
|
|
83
|
+
if (!x || r) return null;
|
|
84
|
+
const n = e < E;
|
|
85
|
+
return d ? /* @__PURE__ */ t(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: s(
|
|
89
|
+
"Bear-Stepper__connector flex-1 self-center mx-1",
|
|
90
|
+
"h-0.5 min-w-[12px] transition-colors",
|
|
91
|
+
n ? S.completed : S.pending,
|
|
92
|
+
g === "dashed" && "border-t-2 border-dashed bg-transparent"
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
) : /* @__PURE__ */ t(
|
|
49
96
|
"div",
|
|
50
97
|
{
|
|
51
|
-
className:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
98
|
+
className: s(
|
|
99
|
+
Ae,
|
|
100
|
+
ue,
|
|
101
|
+
n ? S.completed : S.pending,
|
|
102
|
+
g === "dashed" && "border-t-2 border-dashed bg-transparent"
|
|
56
103
|
)
|
|
57
104
|
}
|
|
58
105
|
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ref: y,
|
|
64
|
-
className: i(
|
|
106
|
+
}, y = (e, r) => {
|
|
107
|
+
const n = u[r], l = { ...Y, ...e.labelTypographyProps }, a = { ...q, ...e.descriptionTypographyProps };
|
|
108
|
+
return /* @__PURE__ */ i(f, { children: [
|
|
109
|
+
/* @__PURE__ */ t(
|
|
65
110
|
V,
|
|
66
|
-
|
|
67
|
-
|
|
111
|
+
{
|
|
112
|
+
variant: "body2",
|
|
113
|
+
...l,
|
|
114
|
+
className: s(ve, w.label, n.label, l == null ? void 0 : l.className),
|
|
115
|
+
children: e.label
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
e.description && /* @__PURE__ */ t(
|
|
119
|
+
V,
|
|
120
|
+
{
|
|
121
|
+
variant: "caption",
|
|
122
|
+
...a,
|
|
123
|
+
className: s(we, w.description, a == null ? void 0 : a.className),
|
|
124
|
+
children: e.description
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] });
|
|
128
|
+
}, H = (e, r) => {
|
|
129
|
+
const n = K(e, r, E);
|
|
130
|
+
return /* @__PURE__ */ i("div", { className: s("Bear-Stepper__content flex shrink-0", R ? "flex-col items-center" : "items-center gap-2"), children: [
|
|
131
|
+
P(e, r, n),
|
|
132
|
+
/* @__PURE__ */ t("div", { className: s(R && "text-center mt-2", "whitespace-nowrap"), children: y(e, n) })
|
|
133
|
+
] });
|
|
134
|
+
}, te = (e, r) => {
|
|
135
|
+
const n = K(e, r, E);
|
|
136
|
+
return /* @__PURE__ */ i(f, { children: [
|
|
137
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0 mr-4", children: P(e, r, n) }),
|
|
138
|
+
/* @__PURE__ */ i("div", { className: "flex-1 pt-0.5", children: [
|
|
139
|
+
y(e, n),
|
|
140
|
+
e.content && n === "active" && /* @__PURE__ */ t("div", { className: "mt-4", children: e.content })
|
|
141
|
+
] })
|
|
142
|
+
] });
|
|
143
|
+
}, W = (e, r) => /* @__PURE__ */ t("div", { className: "Bear-Stepper__overflow shrink-0", children: /* @__PURE__ */ t(
|
|
144
|
+
ce,
|
|
145
|
+
{
|
|
146
|
+
placement: "bottom-start",
|
|
147
|
+
closeOnSelect: !0,
|
|
148
|
+
trigger: /* @__PURE__ */ t(
|
|
149
|
+
"button",
|
|
150
|
+
{
|
|
151
|
+
type: "button",
|
|
152
|
+
className: s(
|
|
153
|
+
M,
|
|
154
|
+
v,
|
|
155
|
+
u.pending.indicator,
|
|
156
|
+
"bear-cursor-pointer bear-border-0"
|
|
157
|
+
),
|
|
158
|
+
"aria-label": r === "left" ? Le : ge,
|
|
159
|
+
children: /* @__PURE__ */ t(de.MoreHorizIcon, { size: We })
|
|
160
|
+
}
|
|
68
161
|
),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
)
|
|
106
|
-
|
|
162
|
+
items: e.map((n) => ({
|
|
163
|
+
key: `step-${n}`,
|
|
164
|
+
label: o[n].label,
|
|
165
|
+
disabled: o[n].disabled,
|
|
166
|
+
onClick: () => {
|
|
167
|
+
o[n].disabled || h == null || h(n);
|
|
168
|
+
}
|
|
169
|
+
}))
|
|
170
|
+
}
|
|
171
|
+
) }, `overflow-${r}`);
|
|
172
|
+
return /* @__PURE__ */ i(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
ref: re,
|
|
176
|
+
className: s(me, d ? he : _e, Q),
|
|
177
|
+
"data-testid": J,
|
|
178
|
+
...ee,
|
|
179
|
+
children: [
|
|
180
|
+
d && !m && o.map((e, r) => /* @__PURE__ */ i(D.Fragment, { children: [
|
|
181
|
+
H(e, r),
|
|
182
|
+
T(r, r === o.length - 1)
|
|
183
|
+
] }, r)),
|
|
184
|
+
d && m && /* @__PURE__ */ i(f, { children: [
|
|
185
|
+
B.length > 0 && /* @__PURE__ */ i(f, { children: [
|
|
186
|
+
W(B, "left"),
|
|
187
|
+
T(-1, !1)
|
|
188
|
+
] }),
|
|
189
|
+
b.map((e, r) => {
|
|
190
|
+
const n = o[e], l = r === b.length - 1 && C.length === 0;
|
|
191
|
+
return /* @__PURE__ */ i(D.Fragment, { children: [
|
|
192
|
+
H(n, e),
|
|
193
|
+
T(e, l)
|
|
194
|
+
] }, e);
|
|
195
|
+
}),
|
|
196
|
+
C.length > 0 && W(C, "right")
|
|
197
|
+
] }),
|
|
198
|
+
!d && o.map((e, r) => /* @__PURE__ */ i("div", { className: s("Bear-Stepper__step", Ee), children: [
|
|
199
|
+
te(e, r),
|
|
200
|
+
T(r, r === o.length - 1)
|
|
201
|
+
] }, r))
|
|
202
|
+
]
|
|
107
203
|
}
|
|
108
204
|
);
|
|
109
205
|
}
|
|
110
206
|
);
|
|
111
|
-
|
|
112
|
-
const X = b(
|
|
113
|
-
({
|
|
114
|
-
activeStep: s,
|
|
115
|
-
totalSteps: o,
|
|
116
|
-
onPrev: a,
|
|
117
|
-
onNext: N,
|
|
118
|
-
onComplete: d,
|
|
119
|
-
disablePrev: f = !1,
|
|
120
|
-
disableNext: m = !1,
|
|
121
|
-
prevLabel: T = "Previous",
|
|
122
|
-
nextLabel: _ = "Next",
|
|
123
|
-
completeLabel: S = "Complete",
|
|
124
|
-
showIndicator: p = !0
|
|
125
|
-
}, u) => {
|
|
126
|
-
const A = s === 0, R = s === o - 1;
|
|
127
|
-
return /* @__PURE__ */ l("div", { ref: u, className: "Bear-StepperControls flex items-center justify-between mt-6", children: [
|
|
128
|
-
/* @__PURE__ */ r(
|
|
129
|
-
v,
|
|
130
|
-
{
|
|
131
|
-
variant: "outline",
|
|
132
|
-
onClick: a,
|
|
133
|
-
disabled: A || f,
|
|
134
|
-
children: T
|
|
135
|
-
}
|
|
136
|
-
),
|
|
137
|
-
p && /* @__PURE__ */ l("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
138
|
-
"Step ",
|
|
139
|
-
s + 1,
|
|
140
|
-
" of ",
|
|
141
|
-
o
|
|
142
|
-
] }),
|
|
143
|
-
R ? /* @__PURE__ */ r(v, { variant: "primary", onClick: d, children: S }) : /* @__PURE__ */ r(v, { variant: "primary", onClick: N, disabled: m, children: _ })
|
|
144
|
-
] });
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
X.displayName = "StepperControls";
|
|
207
|
+
Ve.displayName = "Stepper";
|
|
148
208
|
export {
|
|
149
|
-
|
|
150
|
-
X as StepperControls
|
|
209
|
+
Ve as Stepper
|
|
151
210
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { TypographyProps } from '../Typography/Typography.types';
|
|
3
|
+
import { MaxVisibleInput } from '../../utils/maxVisible.utils';
|
|
2
4
|
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
3
5
|
export type StepStatus = 'pending' | 'active' | 'completed' | 'error';
|
|
4
6
|
export type StepperSize = 'sm' | 'md' | 'lg';
|
|
@@ -15,6 +17,10 @@ export interface Step {
|
|
|
15
17
|
disabled?: boolean;
|
|
16
18
|
/** Optional content for this step */
|
|
17
19
|
content?: ReactNode;
|
|
20
|
+
/** Per-step Typography props for the label */
|
|
21
|
+
labelTypographyProps?: Partial<TypographyProps>;
|
|
22
|
+
/** Per-step Typography props for the description */
|
|
23
|
+
descriptionTypographyProps?: Partial<TypographyProps>;
|
|
18
24
|
}
|
|
19
25
|
export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
20
26
|
/** Array of steps */
|
|
@@ -41,8 +47,14 @@ export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCh
|
|
|
41
47
|
completedIcon?: ReactNode;
|
|
42
48
|
/** Custom error icon */
|
|
43
49
|
errorIcon?: ReactNode;
|
|
50
|
+
/** Typography props applied to all step labels (overridden by per-step labelTypographyProps) */
|
|
51
|
+
labelTypographyProps?: Partial<TypographyProps>;
|
|
52
|
+
/** Typography props applied to all step descriptions (overridden by per-step descriptionTypographyProps) */
|
|
53
|
+
descriptionTypographyProps?: Partial<TypographyProps>;
|
|
44
54
|
/** Test ID */
|
|
45
55
|
testId?: string;
|
|
56
|
+
/** When set on horizontal layout, show at most this many steps with dropdown menus for the rest (breakpoint map supported). */
|
|
57
|
+
maxVisibleSteps?: MaxVisibleInput;
|
|
46
58
|
}
|
|
47
59
|
export interface StepperControlsProps {
|
|
48
60
|
/** Current step */
|
|
@@ -67,4 +79,6 @@ export interface StepperControlsProps {
|
|
|
67
79
|
completeLabel?: string;
|
|
68
80
|
/** Show step indicator */
|
|
69
81
|
showIndicator?: boolean;
|
|
82
|
+
/** Step indicator format function (receives activeStep + 1 and totalSteps) */
|
|
83
|
+
indicatorFormat?: (current: number, total: number) => string;
|
|
70
84
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./Stepper.const.cjs");function l(e,t,r){return e.status?e.status:t<r?"completed":t===r?"active":"pending"}function a(e,t,r,n,o,u,c,i){if(e.icon)return e.icon;switch(r){case"completed":return o??c;case"error":return u??i;default:return n?t+s.STEP_NUMBER_OFFSET:null}}exports.resolveIndicatorContent=a;exports.resolveStepStatus=l;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Step, StepStatus } from './Stepper.types';
|
|
3
|
+
/**
|
|
4
|
+
* Derives the visual status for a step based on its explicit status or its
|
|
5
|
+
* position relative to the active step.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveStepStatus(step: Step, index: number, activeStep: number): StepStatus;
|
|
8
|
+
/**
|
|
9
|
+
* Determines the indicator content for a step circle based on status, custom
|
|
10
|
+
* icons, and the showNumbers flag.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveIndicatorContent(step: Step, index: number, status: StepStatus, showNumbers: boolean, completedIcon: ReactNode | undefined, errorIcon: ReactNode | undefined, defaultCompletedIcon: ReactNode, defaultErrorIcon: ReactNode): ReactNode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { STEP_NUMBER_OFFSET as f } from "./Stepper.const.js";
|
|
2
|
+
function a(r, t, e) {
|
|
3
|
+
return r.status ? r.status : t < e ? "completed" : t === e ? "active" : "pending";
|
|
4
|
+
}
|
|
5
|
+
function l(r, t, e, n, u, o, i, c) {
|
|
6
|
+
if (r.icon) return r.icon;
|
|
7
|
+
switch (e) {
|
|
8
|
+
case "completed":
|
|
9
|
+
return u ?? i;
|
|
10
|
+
case "error":
|
|
11
|
+
return o ?? c;
|
|
12
|
+
default:
|
|
13
|
+
return n ? t + f : null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
l as resolveIndicatorContent,
|
|
18
|
+
a as resolveStepStatus
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),A=require("react"),n=require("../../Button/Button.cjs"),F=require("../../Typography/Typography.cjs"),e=require("../Stepper.const.cjs"),o=A.forwardRef(({activeStep:t,totalSteps:s,onPrev:i,onNext:a,onComplete:l,disablePrev:c=!1,disableNext:T=!1,prevLabel:p=e.DEFAULT_PREV_LABEL,nextLabel:u=e.DEFAULT_NEXT_LABEL,completeLabel:E=e.DEFAULT_COMPLETE_LABEL,showIndicator:d=!0,indicatorFormat:_=e.DEFAULT_INDICATOR_FORMAT},L)=>{const S=t===e.FIRST_STEP_INDEX,y=t===s-e.LAST_STEP_OFFSET;return r.jsxs("div",{ref:L,className:"Bear-StepperControls flex items-center justify-between mt-6",children:[r.jsx(n.Button,{variant:"outline",onClick:i,disabled:S||c,children:p}),d&&r.jsx(F.Typography,{variant:"body2",className:"text-gray-500 dark:text-gray-400",children:_(t+e.LAST_STEP_OFFSET,s)}),y?r.jsx(n.Button,{variant:"primary",onClick:l,children:E}):r.jsx(n.Button,{variant:"primary",onClick:a,disabled:T,children:u})]})});o.displayName="StepperControls";exports.StepperControls=o;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs as A, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y } from "react";
|
|
3
|
+
import { Button as t } from "../../Button/Button.js";
|
|
4
|
+
import { Typography as F } from "../../Typography/Typography.js";
|
|
5
|
+
import { DEFAULT_PREV_LABEL as C, DEFAULT_INDICATOR_FORMAT as S, LAST_STEP_OFFSET as o, DEFAULT_COMPLETE_LABEL as h, DEFAULT_NEXT_LABEL as x, FIRST_STEP_INDEX as D } from "../Stepper.const.js";
|
|
6
|
+
const N = y(
|
|
7
|
+
({
|
|
8
|
+
activeStep: e,
|
|
9
|
+
totalSteps: i,
|
|
10
|
+
onPrev: a,
|
|
11
|
+
onNext: n,
|
|
12
|
+
onComplete: s,
|
|
13
|
+
disablePrev: l = !1,
|
|
14
|
+
disableNext: m = !1,
|
|
15
|
+
prevLabel: p = C,
|
|
16
|
+
nextLabel: E = x,
|
|
17
|
+
completeLabel: d = h,
|
|
18
|
+
showIndicator: T = !0,
|
|
19
|
+
indicatorFormat: L = S
|
|
20
|
+
}, c) => {
|
|
21
|
+
const _ = e === D, f = e === i - o;
|
|
22
|
+
return /* @__PURE__ */ A("div", { ref: c, className: "Bear-StepperControls flex items-center justify-between mt-6", children: [
|
|
23
|
+
/* @__PURE__ */ r(t, { variant: "outline", onClick: a, disabled: _ || l, children: p }),
|
|
24
|
+
T && /* @__PURE__ */ r(F, { variant: "body2", className: "text-gray-500 dark:text-gray-400", children: L(e + o, i) }),
|
|
25
|
+
f ? /* @__PURE__ */ r(t, { variant: "primary", onClick: s, children: d }) : /* @__PURE__ */ r(t, { variant: "primary", onClick: n, disabled: m, children: E })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
N.displayName = "StepperControls";
|
|
30
|
+
export {
|
|
31
|
+
N as StepperControls
|
|
32
|
+
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { Stepper
|
|
1
|
+
export { Stepper } from './Stepper';
|
|
2
|
+
export { StepperControls } from './components/StepperControls';
|
|
2
3
|
export type { StepperProps, StepperControlsProps, Step, StepStatus, StepperOrientation, StepperSize } from './Stepper.types';
|
|
@@ -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"),o=require("react"),C=require("../../utils/cn.cjs"),z=require("../../context/BearProvider.cjs"),B=require("../../utils/maxVisible.utils.cjs"),I=require("../Dropdown/Dropdown.cjs"),L=require("../Icon/index.cjs"),N=require("./Tabs.cjs");function S(n){var l;return o.isValidElement(n)&&typeof n.type!="string"&&((l=n.props)==null?void 0:l.id)!=null}const _=({children:n,maxVisibleTabs:l,wrap:i=!1,className:q})=>{const f=o.useContext(N.TabsContext);if(!f)throw new Error("TabList must be used within Tabs");const v=z.useBearThemeOptional(),[x,E]=o.useState(()=>typeof window<"u"?window.innerWidth:1200);o.useEffect(()=>{const e=()=>E(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a=o.useMemo(()=>B.resolveMaxVisible(l,{width:x,theme:v}),[l,x,v]),{activeTab:b,setActiveTab:M,variant:s}=f,w=o.Children.toArray(n).filter(S),c=w.map(e=>({id:e.props.id,label:e.props.children,disabled:e.props.disabled})),d=b?[b,...c.map(e=>e.id).filter(e=>e!==b)]:c.map(e=>e.id),h=a??d.length,k=d.slice(0,h),u=d.slice(h),p=u.includes(b),y=C.cn("Bear-Tabs__list",`Bear-Tabs__list--${s}`,a!=null&&!i&&"bear-flex bear-w-full bear-min-w-0 bear-items-stretch",(!a||i)&&"bear-flex bear-gap-1",i&&"bear-flex-wrap",!i&&!a&&"bear-gap-1",s==="line"&&"bear-border-b",s==="pills"&&"bear-p-1 bear-rounded-lg",s==="enclosed"&&"bear-border-b",q),g={...s==="line"||s==="enclosed"?{borderColor:"var(--bear-border-default)"}:{},...s==="pills"?{backgroundColor:"var(--bear-bg-tertiary)"}:{}},T=t.jsx(t.Fragment,{children:a!=null?k.map(e=>{const r=w.find(m=>m.props.id===e);return r?o.cloneElement(r,{key:r.props.id}):null}):n}),j=a!=null&&u.length>0?t.jsx("div",{className:"bear-flex bear-h-full bear-flex-shrink-0 bear-items-stretch",children:t.jsx(I.Dropdown,{placement:"bottom-end",closeOnSelect:!0,trigger:t.jsx("button",{type:"button",role:"tab","aria-haspopup":"listbox","aria-label":"More tabs",className:C.cn("bear-flex bear-h-full bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",s==="pills"&&"bear-rounded-md",p&&"bear-shadow-sm",!p&&"hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"),style:p?{backgroundColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:{color:"var(--bear-text-muted)"},children:t.jsx(L.BearIcons.MoreHorizIcon,{size:18})}),items:u.map(e=>{const r=c.find(m=>m.id===e);return{key:e,label:(r==null?void 0:r.label)??e,disabled:r==null?void 0:r.disabled,onClick:()=>M(e)}})})}):null;return a!=null&&!i?t.jsxs("div",{role:"tablist",className:y,style:g,children:[t.jsx("div",{className:"bear-flex bear-min-w-0 bear-flex-1 bear-items-center bear-gap-1 bear-overflow-x-auto bear-overflow-y-visible bear-flex-nowrap",children:T}),j]}):t.jsxs("div",{role:"tablist",className:y,style:g,children:[T,j]})};exports.TabList=_;
|
|
@@ -1,69 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as s, Fragment as N, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as B, useState as L, useEffect as _, useMemo as A, Children as S, cloneElement as j, isValidElement as O } from "react";
|
|
3
|
+
import { cn as E } from "../../utils/cn.js";
|
|
4
|
+
import { useBearThemeOptional as R } from "../../context/BearProvider.js";
|
|
5
|
+
import { resolveMaxVisible as V } from "../../utils/maxVisible.utils.js";
|
|
6
|
+
import { Dropdown as W } from "../Dropdown/Dropdown.js";
|
|
7
|
+
import { BearIcons as D } from "../Icon/index.js";
|
|
8
|
+
import { TabsContext as F } from "./Tabs.js";
|
|
9
|
+
function H(a) {
|
|
10
|
+
var l;
|
|
11
|
+
return O(a) && typeof a.type != "string" && ((l = a.props) == null ? void 0 : l.id) != null;
|
|
10
12
|
}
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
13
|
+
const X = ({ children: a, maxVisibleTabs: l, wrap: n = !1, className: M }) => {
|
|
14
|
+
const u = B(F);
|
|
15
|
+
if (!u) throw new Error("TabList must be used within Tabs");
|
|
16
|
+
const f = R(), [v, k] = L(() => typeof window < "u" ? window.innerWidth : 1200);
|
|
17
|
+
_(() => {
|
|
18
|
+
const e = () => k(window.innerWidth);
|
|
19
|
+
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
20
|
+
}, []);
|
|
21
|
+
const o = A(
|
|
22
|
+
() => V(l, { width: v, theme: f }),
|
|
23
|
+
[l, v, f]
|
|
24
|
+
), { activeTab: i, setActiveTab: z, variant: t } = u, w = S.toArray(a).filter(H), b = w.map((e) => ({ id: e.props.id, label: e.props.children, disabled: e.props.disabled })), d = i ? [i, ...b.map((e) => e.id).filter((e) => e !== i)] : b.map((e) => e.id), x = o ?? d.length, I = d.slice(0, x), c = d.slice(x), m = c.includes(i), h = E(
|
|
15
25
|
"Bear-Tabs__list",
|
|
16
26
|
`Bear-Tabs__list--${t}`,
|
|
17
|
-
"bear-flex bear-
|
|
18
|
-
|
|
27
|
+
o != null && !n && "bear-flex bear-w-full bear-min-w-0 bear-items-stretch",
|
|
28
|
+
(!o || n) && "bear-flex bear-gap-1",
|
|
29
|
+
n && "bear-flex-wrap",
|
|
30
|
+
!n && !o && "bear-gap-1",
|
|
19
31
|
t === "line" && "bear-border-b",
|
|
20
32
|
t === "pills" && "bear-p-1 bear-rounded-lg",
|
|
21
33
|
t === "enclosed" && "bear-border-b",
|
|
22
|
-
|
|
23
|
-
),
|
|
34
|
+
M
|
|
35
|
+
), y = {
|
|
24
36
|
...t === "line" || t === "enclosed" ? { borderColor: "var(--bear-border-default)" } : {},
|
|
25
37
|
...t === "pills" ? { backgroundColor: "var(--bear-bg-tertiary)" } : {}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
38
|
+
}, g = /* @__PURE__ */ s(N, { children: o != null ? I.map((e) => {
|
|
39
|
+
const r = w.find((p) => p.props.id === e);
|
|
40
|
+
return r ? j(r, { key: r.props.id }) : null;
|
|
41
|
+
}) : a }), C = o != null && c.length > 0 ? /* @__PURE__ */ s("div", { className: "bear-flex bear-h-full bear-flex-shrink-0 bear-items-stretch", children: /* @__PURE__ */ s(
|
|
42
|
+
W,
|
|
43
|
+
{
|
|
44
|
+
placement: "bottom-end",
|
|
45
|
+
closeOnSelect: !0,
|
|
46
|
+
trigger: /* @__PURE__ */ s(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
role: "tab",
|
|
51
|
+
"aria-haspopup": "listbox",
|
|
52
|
+
"aria-label": "More tabs",
|
|
53
|
+
className: E(
|
|
54
|
+
"bear-flex bear-h-full bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",
|
|
55
|
+
t === "pills" && "bear-rounded-md",
|
|
56
|
+
m && "bear-shadow-sm",
|
|
57
|
+
!m && "hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"
|
|
58
|
+
),
|
|
59
|
+
style: m ? { backgroundColor: "var(--bear-bg-primary)", color: "var(--bear-text-primary)" } : { color: "var(--bear-text-muted)" },
|
|
60
|
+
children: /* @__PURE__ */ s(D.MoreHorizIcon, { size: 18 })
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
items: c.map((e) => {
|
|
64
|
+
const r = b.find((p) => p.id === e);
|
|
65
|
+
return {
|
|
66
|
+
key: e,
|
|
67
|
+
label: (r == null ? void 0 : r.label) ?? e,
|
|
68
|
+
disabled: r == null ? void 0 : r.disabled,
|
|
69
|
+
onClick: () => z(e)
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
) }) : null;
|
|
74
|
+
return o != null && !n ? /* @__PURE__ */ T("div", { role: "tablist", className: h, style: y, children: [
|
|
75
|
+
/* @__PURE__ */ s("div", { className: "bear-flex bear-min-w-0 bear-flex-1 bear-items-center bear-gap-1 bear-overflow-x-auto bear-overflow-y-visible bear-flex-nowrap", children: g }),
|
|
76
|
+
C
|
|
77
|
+
] }) : /* @__PURE__ */ T("div", { role: "tablist", className: h, style: y, children: [
|
|
78
|
+
g,
|
|
79
|
+
C
|
|
65
80
|
] });
|
|
66
81
|
};
|
|
67
82
|
export {
|
|
68
|
-
|
|
83
|
+
X as TabList
|
|
69
84
|
};
|