@forgedevstack/bear 1.2.5 → 1.2.7
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 +20 -1
- 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 +66 -42
- package/dist/components/AppBar/AppBar.types.d.ts +9 -3
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +32 -32
- 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 +8 -0
- package/dist/components/Backdrop/Backdrop.const.js +11 -0
- package/dist/components/Backdrop/Backdrop.d.ts +3 -0
- package/dist/components/Backdrop/Backdrop.js +50 -0
- package/dist/components/Backdrop/Backdrop.types.d.ts +14 -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/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.js +48 -48
- 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 +49 -0
- package/dist/components/Chip/Chip.const.js +53 -0
- package/dist/components/Chip/Chip.js +46 -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 +11 -0
- package/dist/components/ChipGroup/ChipGroup.const.js +14 -0
- package/dist/components/ChipGroup/ChipGroup.d.ts +3 -0
- package/dist/components/ChipGroup/ChipGroup.js +95 -0
- package/dist/components/ChipGroup/ChipGroup.types.d.ts +14 -0
- package/dist/components/ChipGroup/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +68 -64
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -0
- package/dist/components/EmptyState/EmptyState.const.d.ts +26 -1
- package/dist/components/EmptyState/EmptyState.const.js +29 -0
- package/dist/components/EmptyState/EmptyState.js +49 -31
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.const.cjs +1 -1
- package/dist/components/Input/Input.const.d.ts +10 -0
- package/dist/components/Input/Input.const.js +16 -6
- package/dist/components/Input/Input.js +108 -107
- 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 +133 -115
- package/dist/components/MessageList/MessageList.types.d.ts +4 -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/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.js +7 -8
- package/dist/components/Modal/Modal.js +60 -55
- package/dist/components/PageHeader/PageHeader.cjs +1 -0
- package/dist/components/PageHeader/PageHeader.const.cjs +1 -0
- package/dist/components/PageHeader/PageHeader.const.d.ts +6 -0
- package/dist/components/PageHeader/PageHeader.const.js +9 -0
- package/dist/components/PageHeader/PageHeader.d.ts +3 -0
- package/dist/components/PageHeader/PageHeader.js +57 -0
- package/dist/components/PageHeader/PageHeader.types.d.ts +10 -0
- package/dist/components/PageHeader/index.d.ts +2 -0
- 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 +151 -66
- package/dist/components/Select/Select.types.d.ts +3 -1
- package/dist/components/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/Snackbar/Snackbar.js +62 -60
- package/dist/components/Snackbar/Snackbar.types.d.ts +2 -0
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.js +89 -83
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.const.cjs +1 -0
- package/dist/components/Tabs/Tabs.const.d.ts +2 -0
- package/dist/components/Tabs/Tabs.const.js +5 -0
- package/dist/components/Tabs/Tabs.js +40 -35
- package/dist/components/Tabs/Tabs.types.d.ts +1 -0
- 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 +9 -0
- package/dist/components/Toast/Toast.d.ts +0 -1
- package/dist/components/Toast/Toast.js +111 -101
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +285 -279
- 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/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +45 -41
- package/dist/hooks/useBreakpoint/index.d.ts +4 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.cjs +1 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.const.cjs +1 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.const.d.ts +8 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.const.js +10 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +2 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.js +26 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.types.d.ts +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +464 -443
- package/dist/styles.css +67 -23
- package/dist/utils/generateBearId.const.cjs +1 -1
- package/dist/utils/generateBearId.const.d.ts +4 -2
- package/dist/utils/generateBearId.const.js +6 -4
- package/dist/utils/generateBearId.utils.cjs +1 -1
- package/dist/utils/generateBearId.utils.js +33 -21
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.js +27 -18
- package/dist/utils/liveRegion.const.cjs +1 -0
- package/dist/utils/liveRegion.const.d.ts +5 -0
- package/dist/utils/liveRegion.const.js +17 -0
- package/dist/utils/liveRegion.utils.cjs +1 -0
- package/dist/utils/liveRegion.utils.d.ts +7 -0
- package/dist/utils/liveRegion.utils.js +10 -0
- package/dist/utils/useBearId.cjs +1 -1
- package/dist/utils/useBearId.js +5 -4
- package/package.json +1 -1
|
@@ -1 +1,26 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const EMPTY_STATE_ROOT_CLASS = "Bear-EmptyState";
|
|
2
|
+
export declare const EMPTY_STATE_BASE_CLASSES = "bear-flex bear-flex-col bear-items-center bear-text-center";
|
|
3
|
+
export declare const EMPTY_STATE_CARD_CLASSES = "bear-bg-[var(--bear-bg-secondary)] bear-rounded-xl bear-border bear-border-[var(--bear-border-default)]";
|
|
4
|
+
export declare const EMPTY_STATE_ICON_CLASSES = "bear-text-[var(--bear-text-muted)] bear-mb-4";
|
|
5
|
+
export declare const EMPTY_STATE_TITLE_CLASSES = "bear-font-semibold bear-text-[var(--bear-text-primary)] bear-mb-2";
|
|
6
|
+
export declare const EMPTY_STATE_DESCRIPTION_CLASSES = "bear-text-[var(--bear-text-secondary)] bear-max-w-md bear-mb-6";
|
|
7
|
+
export declare const EMPTY_STATE_SIZE_CLASSES: {
|
|
8
|
+
readonly sm: {
|
|
9
|
+
readonly icon: "bear-w-12 bear-h-12";
|
|
10
|
+
readonly title: "bear-text-lg";
|
|
11
|
+
readonly desc: "bear-text-sm";
|
|
12
|
+
readonly padding: "bear-py-6 bear-px-4";
|
|
13
|
+
};
|
|
14
|
+
readonly md: {
|
|
15
|
+
readonly icon: "bear-w-16 bear-h-16";
|
|
16
|
+
readonly title: "bear-text-xl";
|
|
17
|
+
readonly desc: "bear-text-base";
|
|
18
|
+
readonly padding: "bear-py-10 bear-px-6";
|
|
19
|
+
};
|
|
20
|
+
readonly lg: {
|
|
21
|
+
readonly icon: "bear-w-20 bear-h-20";
|
|
22
|
+
readonly title: "bear-text-2xl";
|
|
23
|
+
readonly desc: "bear-text-lg";
|
|
24
|
+
readonly padding: "bear-py-14 bear-px-8";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const e = "Bear-EmptyState", r = "bear-flex bear-flex-col bear-items-center bear-text-center", a = "bear-bg-[var(--bear-bg-secondary)] bear-rounded-xl bear-border bear-border-[var(--bear-border-default)]", b = "bear-text-[var(--bear-text-muted)] bear-mb-4", t = "bear-font-semibold bear-text-[var(--bear-text-primary)] bear-mb-2", S = "bear-text-[var(--bear-text-secondary)] bear-max-w-md bear-mb-6", E = {
|
|
2
|
+
sm: {
|
|
3
|
+
icon: "bear-w-12 bear-h-12",
|
|
4
|
+
title: "bear-text-lg",
|
|
5
|
+
desc: "bear-text-sm",
|
|
6
|
+
padding: "bear-py-6 bear-px-4"
|
|
7
|
+
},
|
|
8
|
+
md: {
|
|
9
|
+
icon: "bear-w-16 bear-h-16",
|
|
10
|
+
title: "bear-text-xl",
|
|
11
|
+
desc: "bear-text-base",
|
|
12
|
+
padding: "bear-py-10 bear-px-6"
|
|
13
|
+
},
|
|
14
|
+
lg: {
|
|
15
|
+
icon: "bear-w-20 bear-h-20",
|
|
16
|
+
title: "bear-text-2xl",
|
|
17
|
+
desc: "bear-text-lg",
|
|
18
|
+
padding: "bear-py-14 bear-px-8"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
r as EMPTY_STATE_BASE_CLASSES,
|
|
23
|
+
a as EMPTY_STATE_CARD_CLASSES,
|
|
24
|
+
S as EMPTY_STATE_DESCRIPTION_CLASSES,
|
|
25
|
+
b as EMPTY_STATE_ICON_CLASSES,
|
|
26
|
+
e as EMPTY_STATE_ROOT_CLASS,
|
|
27
|
+
E as EMPTY_STATE_SIZE_CLASSES,
|
|
28
|
+
t as EMPTY_STATE_TITLE_CLASSES
|
|
29
|
+
};
|
|
@@ -1,36 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { EMPTY_STATE_SIZE_CLASSES as p, EMPTY_STATE_ICON_CLASSES as h, EMPTY_STATE_TITLE_CLASSES as C, EMPTY_STATE_DESCRIPTION_CLASSES as f, EMPTY_STATE_ROOT_CLASS as d, EMPTY_STATE_CARD_CLASSES as I, EMPTY_STATE_BASE_CLASSES as L } from "./EmptyState.const.js";
|
|
3
|
+
import { cn as r } from "../../utils/cn.js";
|
|
3
4
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { resolveBearId as u } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as v } from "../../utils/useBearId.js";
|
|
7
|
+
const M = ({ className: t }) => /* @__PURE__ */ e("svg", { className: t, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
8
|
+
"path",
|
|
9
|
+
{
|
|
10
|
+
strokeLinecap: "round",
|
|
11
|
+
strokeLinejoin: "round",
|
|
12
|
+
strokeWidth: 1.5,
|
|
13
|
+
d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
|
|
14
|
+
}
|
|
15
|
+
) }), k = ({
|
|
16
|
+
icon: t,
|
|
17
|
+
title: E,
|
|
18
|
+
description: s,
|
|
19
|
+
action: S,
|
|
20
|
+
secondaryAction: o,
|
|
21
|
+
className: i,
|
|
22
|
+
size: T = "md",
|
|
23
|
+
variant: m = "default",
|
|
24
|
+
id: n,
|
|
25
|
+
testId: _
|
|
13
26
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const c = v("EmptyState"), A = u(n, c), a = p[T];
|
|
28
|
+
return /* @__PURE__ */ l(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
id: A,
|
|
32
|
+
"data-testid": _,
|
|
33
|
+
className: r(
|
|
34
|
+
d,
|
|
35
|
+
L,
|
|
36
|
+
a.padding,
|
|
37
|
+
m === "card" && I,
|
|
38
|
+
i
|
|
39
|
+
),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ e("div", { className: r(h, a.icon), children: t || /* @__PURE__ */ e(M, { className: "bear-w-full bear-h-full" }) }),
|
|
42
|
+
/* @__PURE__ */ e("h3", { className: r(C, a.title), children: E }),
|
|
43
|
+
s && /* @__PURE__ */ e("p", { className: r(f, a.desc), children: s }),
|
|
44
|
+
(S || o) && /* @__PURE__ */ l("div", { className: `${d}__actions bear-flex bear-items-center bear-gap-3`, children: [
|
|
45
|
+
S,
|
|
46
|
+
o
|
|
47
|
+
] })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
33
51
|
};
|
|
34
52
|
export {
|
|
35
|
-
|
|
53
|
+
k as EmptyState
|
|
36
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),d=require("../../utils/cn.cjs"),we=require("../../utils/generateBearId.utils.cjs"),Ce=require("../../utils/useBearId.cjs"),T=require("../../context/BearProvider.cjs"),Ne=require("./components/ClearIcon/ClearIcon.cjs"),Te=require("./Input.utils.cjs"),Se=require("../Form/Form.utils.cjs"),c=require("./Input.const.cjs"),Q=o.forwardRef(({label:S,helperText:V,error:v,success:E,size:j="md",variant:Ee,radius:je,InputProps:l,leftAddon:Y,rightAddon:Z,prefix:ke,suffix:Ae,fullWidth:ee=!1,clearable:re=!1,onClear:ae,showCharCount:k=!1,charCountMax:te,autoFormat:m,validation:t,validateOnBlur:se,validateOnChange:A=!1,loading:Le,copyable:qe,onCopy:Ue,floatingLabel:Oe,multiline:b=!1,rows:ne,minRows:oe=c.INPUT_MULTILINE_MIN_ROWS,maxRows:Me,readOnly:L,inputRef:s,inputProps:q,id:ie,testId:ce,className:le,disabled:u,value:f,defaultValue:_,maxLength:B,onChange:x,onBlur:p,...U},n)=>{var K;const be=Ce.useBearId("Input"),w=we.resolveBearId(ie,be),{density:de}=T.useBearDensityOptional(),O=de==="compact",C=o.useContext(T.BearContext),r=(K=C==null?void 0:C.components)==null?void 0:K.Input,ue=r==null?void 0:r.root,fe=r==null?void 0:r.input,_e=r==null?void 0:r.label,xe=r==null?void 0:r.helper,pe=r==null?void 0:r.prefix,he=r==null?void 0:r.suffix,[ge,M]=o.useState(null),R=o.useRef(!1),Ie=O?c.INPUT_TEXT_COMPACT_CLASSES:c.INPUT_TEXT_CLASSES,ye=O?c.INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES:c.INPUT_WRAPPER_HEIGHT_CLASSES,H=t?se??!0:!1,P=v||ge,i=!!P,h=!!E&&!i,g=te??B,N=typeof f=="string"?f.length:typeof _=="string"?_.length:0,W=g!=null&&N>g,ve=re&&!u&&N>0,{direction:me}=T.useBearDirectionOptional(),D=(l==null?void 0:l.startAdornment)??Y,F=(l==null?void 0:l.endAdornment)??Z,G=P||E||V,I=o.useCallback(async e=>{if(!t)return;R.current=!0;const y=await Se.validateFieldValue(e,t);R.current=!1,M(y)},[t]);o.useEffect(()=>{v&&M(null)},[v]);const X=o.useCallback(e=>{if(m&&!b){const y=Te.applyAutoFormat(e.target.value,m);y!==e.target.value&&(e.target.value=y)}x==null||x(e),A&&t&&I(e.target.value)},[m,b,x,A,t,I]),$=o.useCallback(e=>{p==null||p(e),H&&t&&I(e.target.value)},[p,H,t,I]),z=d.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)]",Ie[j],b&&"bear-resize-y bear-py-2 bear-min-h-0 bear-h-auto",le),J={color:"var(--bear-text-primary)",...fe},Be=ne??oe??c.INPUT_MULTILINE_DEFAULT_ROWS;return a.jsxs("div",{id:w,"data-testid":ce,className:d.cn(c.INPUT_ROOT_CLASS,"bear-flex bear-flex-col bear-gap-1.5",ee&&"bear-w-full"),style:ue,children:[S&&a.jsx("label",{className:"Bear-Input__label bear-text-sm bear-font-medium",style:{color:"var(--bear-text-secondary)",..._e},children:S}),a.jsxs("div",{className:d.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":h?"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",!b&&ye[j]),dir:me,style:{backgroundColor:"var(--bear-bg-primary)",borderColor:i||h?void 0:"var(--bear-border-default)"},children:[D&&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)",...pe},children:D}),b?a.jsx("textarea",{ref:e=>{typeof n=="function"?n(e):n&&(n.current=e),typeof s=="function"?s(e):s&&(s.current=e)},id:`${w}-field`,disabled:u,readOnly:L,value:f,defaultValue:_,maxLength:B,rows:Be,"aria-invalid":i||void 0,className:z,style:J,...q,...U,onChange:e=>X(e),onBlur:e=>$(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:`${w}-field`,disabled:u,readOnly:L,value:f,defaultValue:_,maxLength:B,"aria-invalid":i||void 0,onChange:X,onBlur:$,className:z,style:J,...q,...U}),ve&&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(Ne.ClearIcon,{onClick:ae})}),F&&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)",...he},children:F})]}),a.jsxs("div",{className:"Bear-Input__footer bear-flex bear-items-center bear-justify-between bear-gap-2",children:[G?a.jsx("p",{className:d.cn("Bear-Input__helper bear-text-sm bear-flex-1",i&&"Bear-Input__helper--error bear-text-red-500",h&&"Bear-Input__helper--success bear-text-green-500"),style:{...i||h?{}:{color:"var(--bear-text-muted)"},...xe},children:G}):k?a.jsx("span",{}):null,k&&g!=null&&a.jsxs("span",{className:d.cn("Bear-Input__char-count bear-text-xs bear-tabular-nums bear-shrink-0",W&&"bear-text-red-500"),style:W?void 0:{color:"var(--bear-text-muted)"},children:[N,"/",g]})]})]})});Q.displayName="Input";exports.Input=Q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="Bear-Input",T={sm:"bear-h-8",md:"bear-h-10",lg:"bear-h-12"},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="Bear-Input",T={sm:"bear-h-8",md:"bear-h-10",lg:"bear-h-12"},e={sm:"bear-h-7",md:"bear-h-8",lg:"bear-h-10"},S={sm:"bear-text-sm bear-px-3",md:"bear-text-base bear-px-4",lg:"bear-text-lg bear-px-5"},I={sm:"bear-text-xs bear-px-2.5",md:"bear-text-sm bear-px-3",lg:"bear-text-base bear-px-4"},P=3,t=4;exports.INPUT_MULTILINE_DEFAULT_ROWS=t;exports.INPUT_MULTILINE_MIN_ROWS=P;exports.INPUT_ROOT_CLASS=_;exports.INPUT_TEXT_CLASSES=S;exports.INPUT_TEXT_COMPACT_CLASSES=I;exports.INPUT_WRAPPER_HEIGHT_CLASSES=T;exports.INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES=e;
|
|
@@ -4,10 +4,20 @@ export declare const INPUT_WRAPPER_HEIGHT_CLASSES: {
|
|
|
4
4
|
readonly md: "bear-h-10";
|
|
5
5
|
readonly lg: "bear-h-12";
|
|
6
6
|
};
|
|
7
|
+
export declare const INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES: {
|
|
8
|
+
readonly sm: "bear-h-7";
|
|
9
|
+
readonly md: "bear-h-8";
|
|
10
|
+
readonly lg: "bear-h-10";
|
|
11
|
+
};
|
|
7
12
|
export declare const INPUT_TEXT_CLASSES: {
|
|
8
13
|
readonly sm: "bear-text-sm bear-px-3";
|
|
9
14
|
readonly md: "bear-text-base bear-px-4";
|
|
10
15
|
readonly lg: "bear-text-lg bear-px-5";
|
|
11
16
|
};
|
|
17
|
+
export declare const INPUT_TEXT_COMPACT_CLASSES: {
|
|
18
|
+
readonly sm: "bear-text-xs bear-px-2.5";
|
|
19
|
+
readonly md: "bear-text-sm bear-px-3";
|
|
20
|
+
readonly lg: "bear-text-base bear-px-4";
|
|
21
|
+
};
|
|
12
22
|
export declare const INPUT_MULTILINE_MIN_ROWS = 3;
|
|
13
23
|
export declare const INPUT_MULTILINE_DEFAULT_ROWS = 4;
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
const e = "Bear-Input",
|
|
1
|
+
const e = "Bear-Input", a = {
|
|
2
2
|
sm: "bear-h-8",
|
|
3
3
|
md: "bear-h-10",
|
|
4
4
|
lg: "bear-h-12"
|
|
5
|
-
},
|
|
5
|
+
}, t = {
|
|
6
|
+
sm: "bear-h-7",
|
|
7
|
+
md: "bear-h-8",
|
|
8
|
+
lg: "bear-h-10"
|
|
9
|
+
}, b = {
|
|
6
10
|
sm: "bear-text-sm bear-px-3",
|
|
7
11
|
md: "bear-text-base bear-px-4",
|
|
8
12
|
lg: "bear-text-lg bear-px-5"
|
|
9
|
-
},
|
|
13
|
+
}, r = {
|
|
14
|
+
sm: "bear-text-xs bear-px-2.5",
|
|
15
|
+
md: "bear-text-sm bear-px-3",
|
|
16
|
+
lg: "bear-text-base bear-px-4"
|
|
17
|
+
}, _ = 3, T = 4;
|
|
10
18
|
export {
|
|
11
19
|
T as INPUT_MULTILINE_DEFAULT_ROWS,
|
|
12
|
-
|
|
20
|
+
_ as INPUT_MULTILINE_MIN_ROWS,
|
|
13
21
|
e as INPUT_ROOT_CLASS,
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
b as INPUT_TEXT_CLASSES,
|
|
23
|
+
r as INPUT_TEXT_COMPACT_CLASSES,
|
|
24
|
+
a as INPUT_WRAPPER_HEIGHT_CLASSES,
|
|
25
|
+
t as INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES
|
|
16
26
|
};
|
|
@@ -1,151 +1,152 @@
|
|
|
1
1
|
import { jsxs as g, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { resolveBearId as
|
|
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
|
|
2
|
+
import { forwardRef as ve, useContext as we, useState as Ne, useRef as Be, useCallback as C, useEffect as Ce } from "react";
|
|
3
|
+
import { cn as c } from "../../utils/cn.js";
|
|
4
|
+
import { resolveBearId as Te } from "../../utils/generateBearId.utils.js";
|
|
5
|
+
import { useBearId as Ee } from "../../utils/useBearId.js";
|
|
6
|
+
import { useBearDensityOptional as Se, BearContext as Ae, useBearDirectionOptional as ke } from "../../context/BearProvider.js";
|
|
7
|
+
import { ClearIcon as Le } from "./components/ClearIcon/ClearIcon.js";
|
|
8
|
+
import { applyAutoFormat as Ue } from "./Input.utils.js";
|
|
9
|
+
import { validateFieldValue as Oe } from "../Form/Form.utils.js";
|
|
10
|
+
import { INPUT_TEXT_COMPACT_CLASSES as Me, INPUT_TEXT_CLASSES as He, INPUT_MULTILINE_MIN_ROWS as Re, INPUT_MULTILINE_DEFAULT_ROWS as We, INPUT_WRAPPER_HEIGHT_COMPACT_CLASSES as je, INPUT_WRAPPER_HEIGHT_CLASSES as De, INPUT_ROOT_CLASS as Ge } from "./Input.const.js";
|
|
11
|
+
const Pe = ve(
|
|
12
12
|
({
|
|
13
13
|
label: T,
|
|
14
14
|
helperText: K,
|
|
15
15
|
error: y,
|
|
16
|
-
success:
|
|
17
|
-
size:
|
|
18
|
-
variant:
|
|
19
|
-
radius:
|
|
20
|
-
InputProps:
|
|
16
|
+
success: E,
|
|
17
|
+
size: S = "md",
|
|
18
|
+
variant: Xe,
|
|
19
|
+
radius: $e,
|
|
20
|
+
InputProps: i,
|
|
21
21
|
leftAddon: Q,
|
|
22
22
|
rightAddon: V,
|
|
23
|
-
prefix:
|
|
24
|
-
suffix:
|
|
23
|
+
prefix: Fe,
|
|
24
|
+
suffix: qe,
|
|
25
25
|
fullWidth: Y = !1,
|
|
26
26
|
clearable: Z = !1,
|
|
27
|
-
onClear:
|
|
28
|
-
showCharCount:
|
|
29
|
-
charCountMax:
|
|
30
|
-
autoFormat:
|
|
27
|
+
onClear: ee,
|
|
28
|
+
showCharCount: A = !1,
|
|
29
|
+
charCountMax: re,
|
|
30
|
+
autoFormat: I,
|
|
31
31
|
validation: t,
|
|
32
|
-
validateOnBlur:
|
|
33
|
-
validateOnChange:
|
|
34
|
-
loading:
|
|
35
|
-
copyable:
|
|
36
|
-
onCopy:
|
|
37
|
-
floatingLabel:
|
|
38
|
-
multiline:
|
|
39
|
-
rows:
|
|
40
|
-
minRows:
|
|
41
|
-
maxRows:
|
|
42
|
-
readOnly:
|
|
32
|
+
validateOnBlur: ae,
|
|
33
|
+
validateOnChange: k = !1,
|
|
34
|
+
loading: ze,
|
|
35
|
+
copyable: Je,
|
|
36
|
+
onCopy: Ke,
|
|
37
|
+
floatingLabel: Qe,
|
|
38
|
+
multiline: l = !1,
|
|
39
|
+
rows: te,
|
|
40
|
+
minRows: se = Re,
|
|
41
|
+
maxRows: Ve,
|
|
42
|
+
readOnly: L,
|
|
43
43
|
inputRef: s,
|
|
44
44
|
inputProps: U,
|
|
45
|
-
id:
|
|
46
|
-
testId:
|
|
47
|
-
className:
|
|
48
|
-
disabled:
|
|
49
|
-
value:
|
|
50
|
-
defaultValue:
|
|
51
|
-
maxLength:
|
|
45
|
+
id: oe,
|
|
46
|
+
testId: ne,
|
|
47
|
+
className: ie,
|
|
48
|
+
disabled: b,
|
|
49
|
+
value: d,
|
|
50
|
+
defaultValue: f,
|
|
51
|
+
maxLength: v,
|
|
52
52
|
onChange: u,
|
|
53
53
|
onBlur: _,
|
|
54
|
-
...
|
|
54
|
+
...O
|
|
55
55
|
}, o) => {
|
|
56
56
|
var J;
|
|
57
|
-
const le =
|
|
57
|
+
const le = Ee("Input"), w = Te(oe, le), { density: ce } = Se(), M = ce === "compact", N = we(Ae), 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, fe = r == null ? void 0 : r.label, ue = r == null ? void 0 : r.helper, _e = r == null ? void 0 : r.prefix, pe = r == null ? void 0 : r.suffix, [me, H] = Ne(null), R = Be(!1), xe = M ? Me : He, he = M ? je : De, W = t ? ae ?? !0 : !1, j = y || me, n = !!j, p = !!E && !n, m = re ?? v, B = typeof d == "string" ? d.length : typeof f == "string" ? f.length : 0, D = m != null && B > m, ge = Z && !b && B > 0, { direction: ye } = ke(), G = (i == null ? void 0 : i.startAdornment) ?? Q, P = (i == null ? void 0 : i.endAdornment) ?? V, X = j || E || K, x = C(async (e) => {
|
|
58
58
|
if (!t) return;
|
|
59
|
-
|
|
60
|
-
const h = await
|
|
61
|
-
|
|
59
|
+
R.current = !0;
|
|
60
|
+
const h = await Oe(e, t);
|
|
61
|
+
R.current = !1, H(h);
|
|
62
62
|
}, [t]);
|
|
63
|
-
|
|
64
|
-
y &&
|
|
63
|
+
Ce(() => {
|
|
64
|
+
y && H(null);
|
|
65
65
|
}, [y]);
|
|
66
|
-
const
|
|
66
|
+
const $ = C(
|
|
67
67
|
(e) => {
|
|
68
|
-
if (
|
|
69
|
-
const h =
|
|
68
|
+
if (I && !l) {
|
|
69
|
+
const h = Ue(e.target.value, I);
|
|
70
70
|
h !== e.target.value && (e.target.value = h);
|
|
71
71
|
}
|
|
72
|
-
u == null || u(e),
|
|
72
|
+
u == null || u(e), k && t && x(e.target.value);
|
|
73
73
|
},
|
|
74
|
-
[
|
|
75
|
-
),
|
|
74
|
+
[I, l, u, k, t, x]
|
|
75
|
+
), F = C(
|
|
76
76
|
(e) => {
|
|
77
|
-
_ == null || _(e),
|
|
77
|
+
_ == null || _(e), W && t && x(e.target.value);
|
|
78
78
|
},
|
|
79
|
-
[_,
|
|
80
|
-
), q =
|
|
79
|
+
[_, W, t, x]
|
|
80
|
+
), q = c(
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
xe[S],
|
|
85
|
+
l && "bear-resize-y bear-py-2 bear-min-h-0 bear-h-auto",
|
|
86
|
+
ie
|
|
87
87
|
), z = {
|
|
88
88
|
color: "var(--bear-text-primary)",
|
|
89
|
-
...
|
|
90
|
-
},
|
|
89
|
+
...de
|
|
90
|
+
}, Ie = te ?? se ?? We;
|
|
91
91
|
return /* @__PURE__ */ g(
|
|
92
92
|
"div",
|
|
93
93
|
{
|
|
94
94
|
id: w,
|
|
95
|
-
"data-testid":
|
|
96
|
-
className:
|
|
97
|
-
style:
|
|
95
|
+
"data-testid": ne,
|
|
96
|
+
className: c(Ge, "bear-flex bear-flex-col bear-gap-1.5", Y && "bear-w-full"),
|
|
97
|
+
style: be,
|
|
98
98
|
children: [
|
|
99
|
-
T && /* @__PURE__ */ a("label", { className: "Bear-Input__label bear-text-sm bear-font-medium", style: { color: "var(--bear-text-secondary)", ...
|
|
99
|
+
T && /* @__PURE__ */ a("label", { className: "Bear-Input__label bear-text-sm bear-font-medium", style: { color: "var(--bear-text-secondary)", ...fe }, children: T }),
|
|
100
100
|
/* @__PURE__ */ g(
|
|
101
101
|
"div",
|
|
102
102
|
{
|
|
103
|
-
className:
|
|
103
|
+
className: c(
|
|
104
104
|
"Bear-Input__wrapper bear-flex bear-items-center bear-rounded-lg bear-border bear-overflow-hidden bear-transition-all bear-duration-200",
|
|
105
105
|
"focus-within:bear-ring-2 focus-within:bear-ring-offset-2",
|
|
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
|
-
|
|
109
|
-
!
|
|
108
|
+
b && "bear-opacity-50 bear-cursor-not-allowed",
|
|
109
|
+
!l && he[S]
|
|
110
110
|
),
|
|
111
|
+
dir: ye,
|
|
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
|
+
G && /* @__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
|
+
..._e
|
|
125
126
|
},
|
|
126
|
-
children:
|
|
127
|
+
children: G
|
|
127
128
|
}
|
|
128
129
|
),
|
|
129
|
-
|
|
130
|
+
l ? /* @__PURE__ */ a(
|
|
130
131
|
"textarea",
|
|
131
132
|
{
|
|
132
133
|
ref: (e) => {
|
|
133
134
|
typeof o == "function" ? o(e) : o && (o.current = e), typeof s == "function" ? s(e) : s && (s.current = e);
|
|
134
135
|
},
|
|
135
136
|
id: `${w}-field`,
|
|
136
|
-
disabled:
|
|
137
|
-
readOnly:
|
|
138
|
-
value:
|
|
139
|
-
defaultValue:
|
|
140
|
-
maxLength:
|
|
141
|
-
rows:
|
|
137
|
+
disabled: b,
|
|
138
|
+
readOnly: L,
|
|
139
|
+
value: d,
|
|
140
|
+
defaultValue: f,
|
|
141
|
+
maxLength: v,
|
|
142
|
+
rows: Ie,
|
|
142
143
|
"aria-invalid": n || void 0,
|
|
143
144
|
className: q,
|
|
144
145
|
style: z,
|
|
145
146
|
...U,
|
|
146
|
-
...
|
|
147
|
-
onChange: (e) =>
|
|
148
|
-
onBlur: (e) =>
|
|
147
|
+
...O,
|
|
148
|
+
onChange: (e) => $(e),
|
|
149
|
+
onBlur: (e) => F(e)
|
|
149
150
|
}
|
|
150
151
|
) : /* @__PURE__ */ a(
|
|
151
152
|
"input",
|
|
@@ -154,72 +155,72 @@ const Oe = ge(
|
|
|
154
155
|
typeof o == "function" ? o(e) : o && (o.current = e), typeof s == "function" ? s(e) : s && (s.current = e);
|
|
155
156
|
},
|
|
156
157
|
id: `${w}-field`,
|
|
157
|
-
disabled:
|
|
158
|
-
readOnly:
|
|
159
|
-
value:
|
|
160
|
-
defaultValue:
|
|
161
|
-
maxLength:
|
|
158
|
+
disabled: b,
|
|
159
|
+
readOnly: L,
|
|
160
|
+
value: d,
|
|
161
|
+
defaultValue: f,
|
|
162
|
+
maxLength: v,
|
|
162
163
|
"aria-invalid": n || void 0,
|
|
163
|
-
onChange:
|
|
164
|
-
onBlur:
|
|
164
|
+
onChange: $,
|
|
165
|
+
onBlur: F,
|
|
165
166
|
className: q,
|
|
166
167
|
style: z,
|
|
167
168
|
...U,
|
|
168
|
-
...
|
|
169
|
+
...O
|
|
169
170
|
}
|
|
170
171
|
),
|
|
171
|
-
|
|
172
|
+
ge && /* @__PURE__ */ a(
|
|
172
173
|
"div",
|
|
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(Le, { onClick: ee })
|
|
177
178
|
}
|
|
178
179
|
),
|
|
179
|
-
|
|
180
|
+
P && /* @__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
|
+
...pe
|
|
188
189
|
},
|
|
189
|
-
children:
|
|
190
|
+
children: P
|
|
190
191
|
}
|
|
191
192
|
)
|
|
192
193
|
]
|
|
193
194
|
}
|
|
194
195
|
),
|
|
195
196
|
/* @__PURE__ */ g("div", { className: "Bear-Input__footer bear-flex bear-items-center bear-justify-between bear-gap-2", children: [
|
|
196
|
-
|
|
197
|
+
X ? /* @__PURE__ */ a(
|
|
197
198
|
"p",
|
|
198
199
|
{
|
|
199
|
-
className:
|
|
200
|
+
className: c(
|
|
200
201
|
"Bear-Input__helper bear-text-sm bear-flex-1",
|
|
201
202
|
n && "Bear-Input__helper--error bear-text-red-500",
|
|
202
203
|
p && "Bear-Input__helper--success bear-text-green-500"
|
|
203
204
|
),
|
|
204
205
|
style: {
|
|
205
206
|
...n || p ? {} : { color: "var(--bear-text-muted)" },
|
|
206
|
-
...
|
|
207
|
+
...ue
|
|
207
208
|
},
|
|
208
|
-
children:
|
|
209
|
+
children: X
|
|
209
210
|
}
|
|
210
|
-
) :
|
|
211
|
-
|
|
211
|
+
) : A ? /* @__PURE__ */ a("span", {}) : null,
|
|
212
|
+
A && m != null && /* @__PURE__ */ g(
|
|
212
213
|
"span",
|
|
213
214
|
{
|
|
214
|
-
className:
|
|
215
|
+
className: c(
|
|
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
|
B,
|
|
221
222
|
"/",
|
|
222
|
-
|
|
223
|
+
m
|
|
223
224
|
]
|
|
224
225
|
}
|
|
225
226
|
)
|
|
@@ -229,7 +230,7 @@ const Oe = ge(
|
|
|
229
230
|
);
|
|
230
231
|
}
|
|
231
232
|
);
|
|
232
|
-
|
|
233
|
+
Pe.displayName = "Input";
|
|
233
234
|
export {
|
|
234
|
-
|
|
235
|
+
Pe 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;
|