@forgedevstack/bear 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.const.cjs +1 -0
- package/dist/components/AppBar/AppBar.const.d.ts +36 -1
- package/dist/components/AppBar/AppBar.const.js +39 -0
- package/dist/components/AppBar/AppBar.js +65 -42
- package/dist/components/AppBar/AppBar.types.d.ts +9 -3
- package/dist/components/Backdrop/Backdrop.cjs +1 -0
- package/dist/components/Backdrop/Backdrop.const.cjs +1 -0
- package/dist/components/Backdrop/Backdrop.const.d.ts +7 -0
- package/dist/components/Backdrop/Backdrop.const.js +10 -0
- package/dist/components/Backdrop/Backdrop.d.ts +3 -0
- package/dist/components/Backdrop/Backdrop.js +43 -0
- package/dist/components/Backdrop/Backdrop.types.d.ts +12 -0
- package/dist/components/Backdrop/index.d.ts +2 -0
- package/dist/components/BottomNavigation/BottomNavigation.cjs +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.const.cjs +1 -0
- package/dist/components/BottomNavigation/BottomNavigation.const.d.ts +8 -1
- package/dist/components/BottomNavigation/BottomNavigation.const.js +11 -0
- package/dist/components/BottomNavigation/BottomNavigation.js +64 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +65 -64
- package/dist/components/Chip/Chip.cjs +1 -1
- package/dist/components/Chip/Chip.const.cjs +1 -0
- package/dist/components/Chip/Chip.const.d.ts +39 -0
- package/dist/components/Chip/Chip.const.js +43 -0
- package/dist/components/Chip/Chip.js +44 -65
- package/dist/components/ChipGroup/ChipGroup.cjs +1 -0
- package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -0
- package/dist/components/ChipGroup/ChipGroup.const.d.ts +8 -0
- package/dist/components/ChipGroup/ChipGroup.const.js +11 -0
- package/dist/components/ChipGroup/ChipGroup.d.ts +3 -0
- package/dist/components/ChipGroup/ChipGroup.js +41 -0
- package/dist/components/ChipGroup/ChipGroup.types.d.ts +9 -0
- package/dist/components/ChipGroup/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +57 -56
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +63 -62
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +133 -123
- package/dist/components/List/List.types.d.ts +2 -0
- package/dist/components/MessageList/MessageList.cjs +1 -1
- package/dist/components/MessageList/MessageList.const.cjs +1 -1
- package/dist/components/MessageList/MessageList.const.d.ts +6 -0
- package/dist/components/MessageList/MessageList.const.js +26 -20
- package/dist/components/MessageList/MessageList.d.ts +0 -16
- package/dist/components/MessageList/MessageList.js +127 -115
- package/dist/components/MessageList/MessageList.types.d.ts +2 -0
- package/dist/components/MessageList/MessageList.utils.cjs +1 -1
- package/dist/components/MessageList/MessageList.utils.d.ts +7 -0
- package/dist/components/MessageList/MessageList.utils.js +47 -28
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.const.cjs +1 -0
- package/dist/components/Progress/Progress.const.d.ts +16 -1
- package/dist/components/Progress/Progress.const.js +19 -0
- package/dist/components/Progress/Progress.d.ts +0 -10
- package/dist/components/Progress/Progress.js +81 -71
- package/dist/components/Progress/Progress.types.d.ts +2 -11
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -1
- package/dist/components/PropsPlayground/PropsPlayground.js +40 -40
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.const.cjs +1 -0
- package/dist/components/Select/Select.const.d.ts +9 -0
- package/dist/components/Select/Select.const.js +13 -0
- package/dist/components/Select/Select.js +144 -68
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.js +89 -83
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.cjs +1 -0
- package/dist/components/Toast/Toast.const.d.ts +4 -0
- package/dist/components/Toast/Toast.const.js +17 -0
- package/dist/components/Toast/Toast.d.ts +0 -1
- package/dist/components/Toast/Toast.js +90 -84
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +277 -273
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +8 -0
- package/dist/context/BearProvider.js +149 -139
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +12 -10
- package/dist/index.cjs +1 -1
- package/dist/index.js +385 -379
- package/dist/styles.css +67 -19
- package/package.json +1 -1
|
@@ -1,93 +1,94 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useEffect as x, useCallback as O } from "react";
|
|
3
3
|
import { createPortal as R } from "react-dom";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { useBearDirectionOptional as M } from "../../context/BearProvider.js";
|
|
5
|
+
import { cn as S } from "../../utils/cn.js";
|
|
6
|
+
import { XIcon as C } from "../Icon/index.js";
|
|
7
|
+
import { DRAWER_ANIMATION_MS as u, TRANSFORM_OPEN as L, TRANSFORM_CLOSED as T, SIZE_CLASSES as F, POSITION_CLASSES as P, BORDER_SIDE_MAP as j } from "./Drawer.const.js";
|
|
8
|
+
import { lockBodyScroll as B } from "./Drawer.utils.js";
|
|
9
|
+
const U = ({
|
|
10
|
+
isOpen: s,
|
|
10
11
|
onClose: o,
|
|
11
12
|
title: n,
|
|
12
|
-
children:
|
|
13
|
+
children: w,
|
|
13
14
|
side: y = "right",
|
|
14
|
-
anchor:
|
|
15
|
-
variant:
|
|
16
|
-
size:
|
|
17
|
-
showCloseButton:
|
|
18
|
-
closeOnBackdrop:
|
|
19
|
-
closeOnEscape:
|
|
20
|
-
className:
|
|
21
|
-
container:
|
|
22
|
-
id:
|
|
23
|
-
testId:
|
|
15
|
+
anchor: N,
|
|
16
|
+
variant: $ = "temporary",
|
|
17
|
+
size: g = "md",
|
|
18
|
+
showCloseButton: m = !0,
|
|
19
|
+
closeOnBackdrop: E = !0,
|
|
20
|
+
closeOnEscape: f = !0,
|
|
21
|
+
className: I,
|
|
22
|
+
container: _,
|
|
23
|
+
id: q,
|
|
24
|
+
testId: z
|
|
24
25
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
const e = requestAnimationFrame(() =>
|
|
26
|
+
const { direction: h } = M(), i = N ?? y, r = h === "rtl" && (i === "left" || i === "right") ? i === "left" ? "right" : "left" : i, [a, v] = c(s), [k, b] = c(!1), [A, p] = c(!1);
|
|
27
|
+
x(() => {
|
|
28
|
+
if (s) {
|
|
29
|
+
v(!0), b(!1);
|
|
30
|
+
const e = requestAnimationFrame(() => p(!0));
|
|
30
31
|
return () => cancelAnimationFrame(e);
|
|
31
32
|
}
|
|
32
33
|
if (a) {
|
|
33
|
-
|
|
34
|
+
p(!1), b(!0);
|
|
34
35
|
const e = setTimeout(() => {
|
|
35
|
-
|
|
36
|
-
},
|
|
36
|
+
v(!1), b(!1);
|
|
37
|
+
}, u);
|
|
37
38
|
return () => clearTimeout(e);
|
|
38
39
|
}
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
40
|
+
}, [s, a]);
|
|
41
|
+
const l = O(
|
|
41
42
|
(e) => {
|
|
42
|
-
|
|
43
|
+
f && e.key === "Escape" && o();
|
|
43
44
|
},
|
|
44
|
-
[
|
|
45
|
+
[f, o]
|
|
45
46
|
);
|
|
46
|
-
if (
|
|
47
|
+
if (x(() => {
|
|
47
48
|
if (a) {
|
|
48
|
-
document.addEventListener("keydown",
|
|
49
|
-
const e =
|
|
49
|
+
document.addEventListener("keydown", l);
|
|
50
|
+
const e = B();
|
|
50
51
|
return () => {
|
|
51
|
-
document.removeEventListener("keydown",
|
|
52
|
+
document.removeEventListener("keydown", l), e();
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
return () => {
|
|
55
|
-
document.removeEventListener("keydown",
|
|
56
|
+
document.removeEventListener("keydown", l);
|
|
56
57
|
};
|
|
57
|
-
}, [a,
|
|
58
|
-
const
|
|
58
|
+
}, [a, l]), !a) return null;
|
|
59
|
+
const D = /* @__PURE__ */ d("div", { className: "bear-fixed bear-inset-0 bear-z-[11000]", children: [
|
|
59
60
|
/* @__PURE__ */ t(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
62
|
-
className:
|
|
63
|
+
className: S(
|
|
63
64
|
"bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",
|
|
64
|
-
|
|
65
|
+
k ? "bear-opacity-0" : "bear-opacity-100"
|
|
65
66
|
),
|
|
66
|
-
style: { transitionDuration: `${
|
|
67
|
-
onClick:
|
|
67
|
+
style: { transitionDuration: `${u}ms` },
|
|
68
|
+
onClick: E ? o : void 0,
|
|
68
69
|
"aria-hidden": "true"
|
|
69
70
|
}
|
|
70
71
|
),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ d(
|
|
72
73
|
"div",
|
|
73
74
|
{
|
|
74
75
|
role: "dialog",
|
|
75
76
|
"aria-modal": "true",
|
|
76
77
|
"aria-labelledby": n ? "drawer-title" : void 0,
|
|
77
|
-
className:
|
|
78
|
+
className: S(
|
|
78
79
|
"bear-absolute bear-bg-white dark:bear-bg-neutral-900 bear-shadow-2xl",
|
|
79
80
|
"bear-border-neutral-200 dark:bear-border-neutral-700",
|
|
80
81
|
"bear-flex bear-flex-col bear-overflow-hidden",
|
|
81
82
|
"bear-transform bear-transition-transform",
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
j[r],
|
|
84
|
+
P[r],
|
|
85
|
+
F[r][g],
|
|
86
|
+
A && !k ? L[r] : T[r],
|
|
87
|
+
I
|
|
87
88
|
),
|
|
88
|
-
style: { transitionDuration: `${
|
|
89
|
+
style: { transitionDuration: `${u}ms` },
|
|
89
90
|
children: [
|
|
90
|
-
(n ||
|
|
91
|
+
(n || m) && /* @__PURE__ */ d("div", { className: "bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700 bear-shrink-0", dir: h, children: [
|
|
91
92
|
n && /* @__PURE__ */ t(
|
|
92
93
|
"h2",
|
|
93
94
|
{
|
|
@@ -96,23 +97,23 @@ const G = ({
|
|
|
96
97
|
children: n
|
|
97
98
|
}
|
|
98
99
|
),
|
|
99
|
-
|
|
100
|
+
m && /* @__PURE__ */ t(
|
|
100
101
|
"button",
|
|
101
102
|
{
|
|
102
103
|
onClick: o,
|
|
103
104
|
className: "bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors",
|
|
104
105
|
"aria-label": "Close drawer",
|
|
105
|
-
children: /* @__PURE__ */ t(
|
|
106
|
+
children: /* @__PURE__ */ t(C, { className: "bear-w-5 bear-h-5" })
|
|
106
107
|
}
|
|
107
108
|
)
|
|
108
109
|
] }),
|
|
109
|
-
/* @__PURE__ */ t("div", { className: "bear-flex-1 bear-min-h-0 bear-overflow-y-auto bear-overscroll-contain bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300", children:
|
|
110
|
+
/* @__PURE__ */ t("div", { className: "bear-flex-1 bear-min-h-0 bear-overflow-y-auto bear-overscroll-contain bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300", children: w })
|
|
110
111
|
]
|
|
111
112
|
}
|
|
112
113
|
)
|
|
113
114
|
] });
|
|
114
|
-
return R(
|
|
115
|
+
return R(D, _ ?? document.body);
|
|
115
116
|
};
|
|
116
117
|
export {
|
|
117
|
-
|
|
118
|
+
U as Drawer
|
|
118
119
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("../../utils/cn.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("../../utils/cn.cjs"),me=require("../../utils/generateBearId.utils.cjs"),we=require("../../utils/useBearId.cjs"),K=require("../../context/BearProvider.cjs"),Be=require("./components/ClearIcon/ClearIcon.cjs"),Ne=require("./Input.utils.cjs"),je=require("../Form/Form.utils.cjs"),d=require("./Input.const.cjs"),Q=o.forwardRef(({label:C,helperText:V,error:v,success:k,size:T="md",variant:Ce,radius:ke,InputProps:l,leftAddon:Y,rightAddon:Z,prefix:Te,suffix:Ee,fullWidth:P=!1,clearable:ee=!1,onClear:re,showCharCount:E=!1,charCountMax:ae,autoFormat:m,validation:t,validateOnBlur:te,validateOnChange:S=!1,loading:Se,copyable:qe,onCopy:Le,floatingLabel:Ae,multiline:c=!1,rows:se,minRows:ne=d.INPUT_MULTILINE_MIN_ROWS,maxRows:Ue,readOnly:q,inputRef:s,inputProps:L,id:oe,testId:ie,className:le,disabled:u,value:f,defaultValue:x,maxLength:w,onChange:_,onBlur:h,...A},n)=>{var J;const ce=we.useBearId("Input"),B=me.resolveBearId(oe,ce),N=o.useContext(K.BearContext),r=(J=N==null?void 0:N.components)==null?void 0:J.Input,be=r==null?void 0:r.root,de=r==null?void 0:r.input,ue=r==null?void 0:r.label,fe=r==null?void 0:r.helper,xe=r==null?void 0:r.prefix,_e=r==null?void 0:r.suffix,[he,U]=o.useState(null),M=o.useRef(!1),pe=d.INPUT_TEXT_CLASSES,ge=d.INPUT_WRAPPER_HEIGHT_CLASSES,O=t?te??!0:!1,R=v||he,i=!!R,p=!!k&&!i,g=ae??w,j=typeof f=="string"?f.length:typeof x=="string"?x.length:0,H=g!=null&&j>g,Ie=ee&&!u&&j>0,{direction:ye}=K.useBearDirectionOptional(),W=(l==null?void 0:l.startAdornment)??Y,D=(l==null?void 0:l.endAdornment)??Z,F=R||k||V,I=o.useCallback(async e=>{if(!t)return;M.current=!0;const y=await je.validateFieldValue(e,t);M.current=!1,U(y)},[t]);o.useEffect(()=>{v&&U(null)},[v]);const $=o.useCallback(e=>{if(m&&!c){const y=Ne.applyAutoFormat(e.target.value,m);y!==e.target.value&&(e.target.value=y)}_==null||_(e),S&&t&&I(e.target.value)},[m,c,_,S,t,I]),G=o.useCallback(e=>{h==null||h(e),O&&t&&I(e.target.value)},[h,O,t,I]),X=b.cn("Bear-Input__field","bear-flex-1 bear-min-w-0 bear-border-0 bear-outline-none bear-bg-transparent","placeholder:opacity-100 placeholder:[color:var(--bear-text-muted)]",pe[T],c&&"bear-resize-y bear-py-2 bear-min-h-0 bear-h-auto",le),z={color:"var(--bear-text-primary)",...de},ve=se??ne??d.INPUT_MULTILINE_DEFAULT_ROWS;return a.jsxs("div",{id:B,"data-testid":ie,className:b.cn(d.INPUT_ROOT_CLASS,"bear-flex bear-flex-col bear-gap-1.5",P&&"bear-w-full"),style:be,children:[C&&a.jsx("label",{className:"Bear-Input__label bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)",...ue},children:C}),a.jsxs("div",{className:b.cn("Bear-Input__wrapper bear-flex bear-items-center bear-rounded-lg bear-border bear-overflow-hidden bear-transition-all bear-duration-200","focus-within:bear-ring-2 focus-within:bear-ring-offset-2","focus-within:bear-ring-offset-[var(--bear-bg-primary)]",i?"Bear-Input__wrapper--error bear-border-red-500 focus-within:bear-ring-red-500":p?"Bear-Input__wrapper--success bear-border-green-500 focus-within:bear-ring-green-500":"focus-within:bear-border-bear-500 focus-within:bear-ring-bear-500 dark:focus-within:bear-border-bear-500 dark:focus-within:bear-ring-bear-500",u&&"bear-opacity-50 bear-cursor-not-allowed",!c&&ge[T]),dir:ye,style:{backgroundColor:"var(--bear-bg-primary)",borderColor:i||p?void 0:"var(--bear-border-default)"},children:[W&&a.jsx("div",{className:"Bear-Input__addon Bear-Input__addon--left bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-3 bear-text-sm bear-font-medium bear-select-none bear-pointer-events-none",style:{backgroundColor:"var(--bear-bg-tertiary)",borderInlineEnd:"1px solid var(--bear-border-default)",color:"var(--bear-text-secondary)",...xe},children:W}),c?a.jsx("textarea",{ref:e=>{typeof n=="function"?n(e):n&&(n.current=e),typeof s=="function"?s(e):s&&(s.current=e)},id:`${B}-field`,disabled:u,readOnly:q,value:f,defaultValue:x,maxLength:w,rows:ve,"aria-invalid":i||void 0,className:X,style:z,...L,...A,onChange:e=>$(e),onBlur:e=>G(e)}):a.jsx("input",{ref:e=>{typeof n=="function"?n(e):n&&(n.current=e),typeof s=="function"?s(e):s&&(s.current=e)},id:`${B}-field`,disabled:u,readOnly:q,value:f,defaultValue:x,maxLength:w,"aria-invalid":i||void 0,onChange:$,onBlur:G,className:X,style:z,...L,...A}),Ie&&a.jsx("div",{className:"Bear-Input__clear bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-2 bear-cursor-pointer",style:{color:"var(--bear-text-muted)"},children:a.jsx(Be.ClearIcon,{onClick:re})}),D&&a.jsx("div",{className:"Bear-Input__addon Bear-Input__addon--right bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-3 bear-gap-1.5",style:{backgroundColor:"var(--bear-bg-tertiary)",borderInlineStart:"1px solid var(--bear-border-default)",color:"var(--bear-text-secondary)",..._e},children:D})]}),a.jsxs("div",{className:"Bear-Input__footer bear-flex bear-items-center bear-justify-between bear-gap-2",children:[F?a.jsx("p",{className:b.cn("Bear-Input__helper bear-text-sm bear-flex-1",i&&"Bear-Input__helper--error bear-text-red-500",p&&"Bear-Input__helper--success bear-text-green-500"),style:{...i||p?{}:{color:"var(--bear-text-muted)"},...fe},children:F}):E?a.jsx("span",{}):null,E&&g!=null&&a.jsxs("span",{className:b.cn("Bear-Input__char-count bear-text-xs bear-tabular-nums bear-shrink-0",H&&"bear-text-red-500"),style:H?void 0:{color:"var(--bear-text-muted)"},children:[j,"/",g]})]})]})});Q.displayName="Input";exports.Input=Q;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { jsxs as g, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as ye, useContext as ve, useState as Ie, useRef as we, useCallback as C, useEffect as Be } from "react";
|
|
3
3
|
import { cn as b } from "../../utils/cn.js";
|
|
4
4
|
import { resolveBearId as Ne } from "../../utils/generateBearId.utils.js";
|
|
5
|
-
import { useBearId as
|
|
6
|
-
import { BearContext as
|
|
7
|
-
import { ClearIcon as
|
|
8
|
-
import { applyAutoFormat as
|
|
9
|
-
import { validateFieldValue as
|
|
10
|
-
import { INPUT_TEXT_CLASSES as
|
|
11
|
-
const
|
|
5
|
+
import { useBearId as Ce } from "../../utils/useBearId.js";
|
|
6
|
+
import { BearContext as Ee, useBearDirectionOptional as Te } from "../../context/BearProvider.js";
|
|
7
|
+
import { ClearIcon as ke } from "./components/ClearIcon/ClearIcon.js";
|
|
8
|
+
import { applyAutoFormat as Se } from "./Input.utils.js";
|
|
9
|
+
import { validateFieldValue as Le } from "../Form/Form.utils.js";
|
|
10
|
+
import { INPUT_TEXT_CLASSES as Ae, INPUT_MULTILINE_MIN_ROWS as Ue, INPUT_MULTILINE_DEFAULT_ROWS as Me, INPUT_WRAPPER_HEIGHT_CLASSES as Oe, INPUT_ROOT_CLASS as je } from "./Input.const.js";
|
|
11
|
+
const He = ye(
|
|
12
12
|
({
|
|
13
|
-
label:
|
|
13
|
+
label: E,
|
|
14
14
|
helperText: K,
|
|
15
15
|
error: y,
|
|
16
|
-
success:
|
|
17
|
-
size:
|
|
18
|
-
variant:
|
|
19
|
-
radius:
|
|
20
|
-
InputProps:
|
|
16
|
+
success: T,
|
|
17
|
+
size: k = "md",
|
|
18
|
+
variant: We,
|
|
19
|
+
radius: De,
|
|
20
|
+
InputProps: i,
|
|
21
21
|
leftAddon: Q,
|
|
22
22
|
rightAddon: V,
|
|
23
23
|
prefix: Re,
|
|
24
|
-
suffix:
|
|
24
|
+
suffix: $e,
|
|
25
25
|
fullWidth: Y = !1,
|
|
26
26
|
clearable: Z = !1,
|
|
27
27
|
onClear: P,
|
|
28
|
-
showCharCount:
|
|
28
|
+
showCharCount: S = !1,
|
|
29
29
|
charCountMax: ee,
|
|
30
30
|
autoFormat: v,
|
|
31
31
|
validation: t,
|
|
32
32
|
validateOnBlur: re,
|
|
33
|
-
validateOnChange:
|
|
34
|
-
loading:
|
|
35
|
-
copyable:
|
|
36
|
-
onCopy:
|
|
37
|
-
floatingLabel:
|
|
38
|
-
multiline:
|
|
33
|
+
validateOnChange: L = !1,
|
|
34
|
+
loading: Fe,
|
|
35
|
+
copyable: Ge,
|
|
36
|
+
onCopy: Xe,
|
|
37
|
+
floatingLabel: qe,
|
|
38
|
+
multiline: l = !1,
|
|
39
39
|
rows: ae,
|
|
40
|
-
minRows: te =
|
|
41
|
-
maxRows:
|
|
40
|
+
minRows: te = Ue,
|
|
41
|
+
maxRows: ze,
|
|
42
42
|
readOnly: A,
|
|
43
43
|
inputRef: s,
|
|
44
44
|
inputProps: U,
|
|
@@ -46,32 +46,32 @@ const Oe = ge(
|
|
|
46
46
|
testId: oe,
|
|
47
47
|
className: ne,
|
|
48
48
|
disabled: c,
|
|
49
|
-
value:
|
|
50
|
-
defaultValue:
|
|
49
|
+
value: d,
|
|
50
|
+
defaultValue: f,
|
|
51
51
|
maxLength: I,
|
|
52
52
|
onChange: u,
|
|
53
53
|
onBlur: _,
|
|
54
54
|
...M
|
|
55
55
|
}, o) => {
|
|
56
56
|
var J;
|
|
57
|
-
const
|
|
57
|
+
const ie = Ce("Input"), w = Ne(se, ie), B = ve(Ee), r = (J = B == null ? void 0 : B.components) == null ? void 0 : J.Input, le = r == null ? void 0 : r.root, be = r == null ? void 0 : r.input, ce = r == null ? void 0 : r.label, de = r == null ? void 0 : r.helper, fe = r == null ? void 0 : r.prefix, ue = r == null ? void 0 : r.suffix, [_e, O] = Ie(null), j = we(!1), pe = Ae, xe = Oe, H = t ? re ?? !0 : !1, W = y || _e, n = !!W, p = !!T && !n, x = ee ?? I, N = typeof d == "string" ? d.length : typeof f == "string" ? f.length : 0, D = x != null && N > x, me = Z && !c && N > 0, { direction: he } = Te(), R = (i == null ? void 0 : i.startAdornment) ?? Q, $ = (i == null ? void 0 : i.endAdornment) ?? V, F = W || T || K, m = C(async (e) => {
|
|
58
58
|
if (!t) return;
|
|
59
59
|
j.current = !0;
|
|
60
|
-
const h = await
|
|
60
|
+
const h = await Le(e, t);
|
|
61
61
|
j.current = !1, O(h);
|
|
62
62
|
}, [t]);
|
|
63
|
-
|
|
63
|
+
Be(() => {
|
|
64
64
|
y && O(null);
|
|
65
65
|
}, [y]);
|
|
66
66
|
const G = C(
|
|
67
67
|
(e) => {
|
|
68
|
-
if (v && !
|
|
69
|
-
const h =
|
|
68
|
+
if (v && !l) {
|
|
69
|
+
const h = Se(e.target.value, v);
|
|
70
70
|
h !== e.target.value && (e.target.value = h);
|
|
71
71
|
}
|
|
72
|
-
u == null || u(e),
|
|
72
|
+
u == null || u(e), L && t && m(e.target.value);
|
|
73
73
|
},
|
|
74
|
-
[v,
|
|
74
|
+
[v, l, u, L, t, m]
|
|
75
75
|
), X = C(
|
|
76
76
|
(e) => {
|
|
77
77
|
_ == null || _(e), H && t && m(e.target.value);
|
|
@@ -81,22 +81,22 @@ const Oe = ge(
|
|
|
81
81
|
"Bear-Input__field",
|
|
82
82
|
"bear-flex-1 bear-min-w-0 bear-border-0 bear-outline-none bear-bg-transparent",
|
|
83
83
|
"placeholder:opacity-100 placeholder:[color:var(--bear-text-muted)]",
|
|
84
|
-
pe[
|
|
85
|
-
|
|
84
|
+
pe[k],
|
|
85
|
+
l && "bear-resize-y bear-py-2 bear-min-h-0 bear-h-auto",
|
|
86
86
|
ne
|
|
87
87
|
), z = {
|
|
88
88
|
color: "var(--bear-text-primary)",
|
|
89
89
|
...be
|
|
90
|
-
},
|
|
90
|
+
}, ge = ae ?? te ?? Me;
|
|
91
91
|
return /* @__PURE__ */ g(
|
|
92
92
|
"div",
|
|
93
93
|
{
|
|
94
94
|
id: w,
|
|
95
95
|
"data-testid": oe,
|
|
96
|
-
className: b(
|
|
97
|
-
style:
|
|
96
|
+
className: b(je, "bear-flex bear-flex-col bear-gap-1.5", Y && "bear-w-full"),
|
|
97
|
+
style: le,
|
|
98
98
|
children: [
|
|
99
|
-
|
|
99
|
+
E && /* @__PURE__ */ a("label", { className: "Bear-Input__label bear-text-sm bear-font-medium", style: { color: "var(--bear-text-secondary)", ...ce }, children: E }),
|
|
100
100
|
/* @__PURE__ */ g(
|
|
101
101
|
"div",
|
|
102
102
|
{
|
|
@@ -106,27 +106,28 @@ const Oe = ge(
|
|
|
106
106
|
"focus-within:bear-ring-offset-[var(--bear-bg-primary)]",
|
|
107
107
|
n ? "Bear-Input__wrapper--error bear-border-red-500 focus-within:bear-ring-red-500" : p ? "Bear-Input__wrapper--success bear-border-green-500 focus-within:bear-ring-green-500" : "focus-within:bear-border-bear-500 focus-within:bear-ring-bear-500 dark:focus-within:bear-border-bear-500 dark:focus-within:bear-ring-bear-500",
|
|
108
108
|
c && "bear-opacity-50 bear-cursor-not-allowed",
|
|
109
|
-
!
|
|
109
|
+
!l && xe[k]
|
|
110
110
|
),
|
|
111
|
+
dir: he,
|
|
111
112
|
style: {
|
|
112
113
|
backgroundColor: "var(--bear-bg-primary)",
|
|
113
114
|
borderColor: n || p ? void 0 : "var(--bear-border-default)"
|
|
114
115
|
},
|
|
115
116
|
children: [
|
|
116
|
-
|
|
117
|
+
R && /* @__PURE__ */ a(
|
|
117
118
|
"div",
|
|
118
119
|
{
|
|
119
120
|
className: "Bear-Input__addon Bear-Input__addon--left bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-3 bear-text-sm bear-font-medium bear-select-none bear-pointer-events-none",
|
|
120
121
|
style: {
|
|
121
122
|
backgroundColor: "var(--bear-bg-tertiary)",
|
|
122
|
-
|
|
123
|
+
borderInlineEnd: "1px solid var(--bear-border-default)",
|
|
123
124
|
color: "var(--bear-text-secondary)",
|
|
124
|
-
...
|
|
125
|
+
...fe
|
|
125
126
|
},
|
|
126
|
-
children:
|
|
127
|
+
children: R
|
|
127
128
|
}
|
|
128
129
|
),
|
|
129
|
-
|
|
130
|
+
l ? /* @__PURE__ */ a(
|
|
130
131
|
"textarea",
|
|
131
132
|
{
|
|
132
133
|
ref: (e) => {
|
|
@@ -135,10 +136,10 @@ const Oe = ge(
|
|
|
135
136
|
id: `${w}-field`,
|
|
136
137
|
disabled: c,
|
|
137
138
|
readOnly: A,
|
|
138
|
-
value:
|
|
139
|
-
defaultValue:
|
|
139
|
+
value: d,
|
|
140
|
+
defaultValue: f,
|
|
140
141
|
maxLength: I,
|
|
141
|
-
rows:
|
|
142
|
+
rows: ge,
|
|
142
143
|
"aria-invalid": n || void 0,
|
|
143
144
|
className: q,
|
|
144
145
|
style: z,
|
|
@@ -156,8 +157,8 @@ const Oe = ge(
|
|
|
156
157
|
id: `${w}-field`,
|
|
157
158
|
disabled: c,
|
|
158
159
|
readOnly: A,
|
|
159
|
-
value:
|
|
160
|
-
defaultValue:
|
|
160
|
+
value: d,
|
|
161
|
+
defaultValue: f,
|
|
161
162
|
maxLength: I,
|
|
162
163
|
"aria-invalid": n || void 0,
|
|
163
164
|
onChange: G,
|
|
@@ -173,20 +174,20 @@ const Oe = ge(
|
|
|
173
174
|
{
|
|
174
175
|
className: "Bear-Input__clear bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-2 bear-cursor-pointer",
|
|
175
176
|
style: { color: "var(--bear-text-muted)" },
|
|
176
|
-
children: /* @__PURE__ */ a(
|
|
177
|
+
children: /* @__PURE__ */ a(ke, { onClick: P })
|
|
177
178
|
}
|
|
178
179
|
),
|
|
179
|
-
|
|
180
|
+
$ && /* @__PURE__ */ a(
|
|
180
181
|
"div",
|
|
181
182
|
{
|
|
182
183
|
className: "Bear-Input__addon Bear-Input__addon--right bear-flex bear-items-center bear-self-stretch bear-shrink-0 bear-px-3 bear-gap-1.5",
|
|
183
184
|
style: {
|
|
184
185
|
backgroundColor: "var(--bear-bg-tertiary)",
|
|
185
|
-
|
|
186
|
+
borderInlineStart: "1px solid var(--bear-border-default)",
|
|
186
187
|
color: "var(--bear-text-secondary)",
|
|
187
188
|
...ue
|
|
188
189
|
},
|
|
189
|
-
children:
|
|
190
|
+
children: $
|
|
190
191
|
}
|
|
191
192
|
)
|
|
192
193
|
]
|
|
@@ -203,21 +204,21 @@ const Oe = ge(
|
|
|
203
204
|
),
|
|
204
205
|
style: {
|
|
205
206
|
...n || p ? {} : { color: "var(--bear-text-muted)" },
|
|
206
|
-
...
|
|
207
|
+
...de
|
|
207
208
|
},
|
|
208
209
|
children: F
|
|
209
210
|
}
|
|
210
|
-
) :
|
|
211
|
-
|
|
211
|
+
) : S ? /* @__PURE__ */ a("span", {}) : null,
|
|
212
|
+
S && x != null && /* @__PURE__ */ g(
|
|
212
213
|
"span",
|
|
213
214
|
{
|
|
214
215
|
className: b(
|
|
215
216
|
"Bear-Input__char-count bear-text-xs bear-tabular-nums bear-shrink-0",
|
|
216
|
-
|
|
217
|
+
D && "bear-text-red-500"
|
|
217
218
|
),
|
|
218
|
-
style:
|
|
219
|
+
style: D ? void 0 : { color: "var(--bear-text-muted)" },
|
|
219
220
|
children: [
|
|
220
|
-
|
|
221
|
+
N,
|
|
221
222
|
"/",
|
|
222
223
|
x
|
|
223
224
|
]
|
|
@@ -229,7 +230,7 @@ const Oe = ge(
|
|
|
229
230
|
);
|
|
230
231
|
}
|
|
231
232
|
);
|
|
232
|
-
|
|
233
|
+
He.displayName = "Input";
|
|
233
234
|
export {
|
|
234
|
-
|
|
235
|
+
He as Input
|
|
235
236
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),g=require("react"),o=require("../../utils/cn.cjs"),m=require("./List.const.cjs"),L=g.createContext({}),A=()=>g.useContext(L),v=g.forwardRef((a,e)=>{const{variant:s="default",size:t="md",hoverable:i=!1,dense:n=!1,disablePadding:b=!1,className:c,children:y,testId:f,...l}=a;return r.jsx(L.Provider,{value:{dense:n,hoverable:i},children:r.jsx("ul",{ref:e,role:"list",className:o.cn(m.LIST_BASE_CLASSES,!b&&m.LIST_PADDING_CLASSES,m.LIST_SIZE_CLASSES[t],m.LIST_VARIANT_CLASSES[s],c),"data-testid":f,...l,children:y})})});v.displayName="List";const I=g.forwardRef(({primary:a,secondary:e,leading:s,trailing:t,secondaryAction:i,selected:n=!1,disabled:b=!1,clickable:c=!1,divider:y=!1,dense:f,onClick:l,className:h,children:S,testId:N,...j},_)=>{const{dense:k,hoverable:w}=A(),p=f??k,d=c||!!l,u=i??t;return r.jsxs("li",{ref:_,role:d?"button":"listitem",tabIndex:d&&!b?0:void 0,"aria-selected":n,"aria-disabled":b,onClick:b?void 0:l,onKeyDown:x=>{!b&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l==null||l())},className:o.cn("Bear-ListItem","bear-flex bear-items-center bear-gap-3",p?"bear-py-1 bear-px-3":"bear-py-2 bear-px-4",d&&!b&&"bear-cursor-pointer",(w||d)&&!b&&"hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800",n&&"bear-bg-primary-50 dark:bear-bg-primary-900/20",b&&"bear-opacity-50 bear-cursor-not-allowed",y&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",h),"data-testid":N,...j,children:[s&&r.jsx("div",{className:"Bear-ListItem__leading bear-flex-shrink-0 bear-text-gray-500 dark:bear-text-gray-400",children:s}),a||e?r.jsxs("div",{className:"Bear-ListItem__content bear-flex-1 bear-min-w-0",children:[a&&r.jsx("div",{className:"bear-text-gray-900 dark:bear-text-gray-100 bear-truncate",children:a}),e&&r.jsx("div",{className:o.cn("bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",p?"bear-text-xs":"bear-text-sm"),children:e})]}):r.jsx("div",{className:"Bear-ListItem__content bear-flex-1 bear-min-w-0",children:S}),u&&r.jsx("div",{className:"Bear-ListItem__secondary-action bear-flex-shrink-0 bear-text-gray-500 dark:bear-text-gray-400",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:u})]})});I.displayName="ListItem";const B=({sticky:a=!1,inset:e=!1,className:s,children:t,testId:i,...n})=>r.jsx("li",{role:"presentation",className:o.cn("bear-py-2 bear-px-4 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider","bear-text-gray-500 dark:bear-text-gray-400","bear-bg-gray-50 dark:bear-bg-gray-800/50",a&&"bear-sticky bear-top-0 bear-z-10",e&&"bear-pl-12",s),"data-testid":i,...n,children:t}),D=({primary:a,secondary:e,inset:s=!1,dense:t=!1,className:i,...n})=>r.jsxs("div",{className:o.cn("bear-flex-1 bear-min-w-0",s&&"bear-pl-9",i),...n,children:[a&&r.jsx("div",{className:"bear-text-gray-900 dark:bear-text-gray-100",children:a}),e&&r.jsx("div",{className:o.cn("bear-text-gray-500 dark:bear-text-gray-400",t?"bear-text-xs":"bear-text-sm"),children:e})]}),E=({align:a="center",className:e,children:s,...t})=>r.jsx("div",{className:o.cn("bear-flex-shrink-0 bear-min-w-[36px]","bear-text-gray-500 dark:bear-text-gray-400",a==="top"&&"bear-self-start bear-mt-1",e),...t,children:s}),T=({selected:a=!1,disabled:e=!1,dense:s=!1,onClick:t,className:i,children:n,...b})=>r.jsx("div",{role:"button",tabIndex:e?-1:0,"aria-selected":a,"aria-disabled":e,onClick:e?void 0:t,onKeyDown:c=>{!e&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t==null||t())},className:o.cn("bear-flex bear-items-center bear-gap-3 bear-w-full bear-text-left",s?"bear-py-1 bear-px-3":"bear-py-2 bear-px-4","bear-cursor-pointer bear-transition-colors","hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800",a&&"bear-bg-primary-50 dark:bear-bg-primary-900/20",e&&"bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none",i),...b,children:n});exports.List=v;exports.ListItem=I;exports.ListItemButton=T;exports.ListItemIcon=E;exports.ListItemText=D;exports.ListSubheader=B;
|