@forgedevstack/bear 1.2.4 → 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/Card/Card.types.d.ts +1 -2
- package/dist/components/Chat/Chat.const.cjs +1 -1
- package/dist/components/Chat/Chat.const.d.ts +1 -1
- package/dist/components/Chat/Chat.const.js +1 -1
- 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/ColorSwatch/ColorSwatch.cjs +1 -1
- package/dist/components/ColorSwatch/ColorSwatch.js +8 -8
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +71 -71
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -1
- package/dist/components/DiffSquares/DiffSquares.js +11 -11
- 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/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +114 -92
- package/dist/components/MentionsInput/MentionsInput.types.d.ts +4 -0
- package/dist/components/MessageList/MessageList.cjs +1 -0
- package/dist/components/MessageList/MessageList.const.cjs +1 -0
- package/dist/components/MessageList/MessageList.const.d.ts +29 -0
- package/dist/components/MessageList/MessageList.const.js +36 -0
- package/dist/components/MessageList/MessageList.d.ts +3 -0
- package/dist/components/MessageList/MessageList.js +194 -0
- package/dist/components/MessageList/MessageList.types.d.ts +74 -0
- package/dist/components/MessageList/MessageList.utils.cjs +1 -0
- package/dist/components/MessageList/MessageList.utils.d.ts +13 -0
- package/dist/components/MessageList/MessageList.utils.js +54 -0
- package/dist/components/MessageList/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 +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 +3 -7
- package/dist/components/Toast/Toast.js +101 -89
- package/dist/components/Toast/Toast.types.d.ts +9 -0
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.js +22 -22
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +284 -278
- 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 +392 -384
- package/dist/styles/_message-list.css +42 -0
- package/dist/styles/main.css +1 -0
- package/dist/styles.css +114 -19
- package/package.json +15 -2
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { useState as f, useEffect as
|
|
3
|
-
import { useBearThemeOptional as
|
|
4
|
-
import { resolveMaxVisible as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Dropdown as
|
|
7
|
-
import { BearIcons as
|
|
8
|
-
import { BREADCRUMBS_DEFAULTS as
|
|
9
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as R, useMemo as $ } from "react";
|
|
3
|
+
import { useBearThemeOptional as K, useBearDirectionOptional as q } from "../../context/BearProvider.js";
|
|
4
|
+
import { resolveMaxVisible as G } from "../../utils/maxVisible.utils.js";
|
|
5
|
+
import { cn as w } from "../../utils/cn.js";
|
|
6
|
+
import { Dropdown as _ } from "../Dropdown/Dropdown.js";
|
|
7
|
+
import { BearIcons as b } from "../Icon/index.js";
|
|
8
|
+
import { BREADCRUMBS_DEFAULTS as h, BREADCRUMBS_SIZE as J, BREADCRUMBS_ICON_SIZE as I } from "./Breadcrumbs.const.js";
|
|
9
|
+
const le = (D) => {
|
|
10
10
|
const {
|
|
11
11
|
items: a,
|
|
12
12
|
separator: M,
|
|
13
|
-
maxItems:
|
|
14
|
-
itemsBeforeCollapse:
|
|
15
|
-
itemsAfterCollapse:
|
|
13
|
+
maxItems: u,
|
|
14
|
+
itemsBeforeCollapse: x = h.ITEMS_BEFORE_COLLAPSE,
|
|
15
|
+
itemsAfterCollapse: m = h.ITEMS_AFTER_COLLAPSE,
|
|
16
16
|
className: A,
|
|
17
|
-
size:
|
|
18
|
-
showHomeIcon:
|
|
19
|
-
testId:
|
|
20
|
-
"aria-label":
|
|
21
|
-
} =
|
|
22
|
-
|
|
23
|
-
const e = () =>
|
|
17
|
+
size: d = h.SIZE,
|
|
18
|
+
showHomeIcon: L = h.SHOW_HOME_ICON,
|
|
19
|
+
testId: P,
|
|
20
|
+
"aria-label": H = "Breadcrumb"
|
|
21
|
+
} = D, y = K(), { direction: C } = q(), [i, E] = f(null), [T, N] = f({}), [g, U] = f(() => typeof window < "u" ? window.innerWidth : 1200);
|
|
22
|
+
R(() => {
|
|
23
|
+
const e = () => U(window.innerWidth);
|
|
24
24
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
25
|
-
}, []),
|
|
26
|
-
|
|
25
|
+
}, []), R(() => {
|
|
26
|
+
E(null), N({});
|
|
27
27
|
}, [a]);
|
|
28
|
-
const
|
|
29
|
-
() =>
|
|
30
|
-
[
|
|
31
|
-
),
|
|
32
|
-
const
|
|
33
|
-
l === 0 &&
|
|
28
|
+
const k = $(
|
|
29
|
+
() => u == null ? void 0 : G(u, { width: g, theme: y }),
|
|
30
|
+
[u, g, y]
|
|
31
|
+
), j = () => M || (C === "rtl" ? /* @__PURE__ */ r(b.ChevronLeftIcon, { className: w(I[d], "bear-text-zinc-500 bear-mx-2") }) : /* @__PURE__ */ r(b.ChevronRightIcon, { className: w(I[d], "bear-text-zinc-500 bear-mx-2") })), v = (e, l, n) => {
|
|
32
|
+
const t = /* @__PURE__ */ p("span", { className: "bear-flex bear-items-center bear-gap-1 bear-max-w-[12rem] bear-truncate md:bear-max-w-none", children: [
|
|
33
|
+
l === 0 && L && /* @__PURE__ */ r(b.HomeIcon, { className: I[d] }),
|
|
34
34
|
e.icon,
|
|
35
35
|
e.label
|
|
36
|
-
] }), o =
|
|
37
|
-
if (e.dropdownItems && e.dropdownItems.length > 0 && !
|
|
38
|
-
const c =
|
|
36
|
+
] }), o = n ? /* @__PURE__ */ r("span", { className: "bear-text-zinc-300 bear-font-medium", "aria-current": "page", children: t }) : e.href ? /* @__PURE__ */ r("a", { href: e.href, className: "bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors bear-truncate", children: t }) : e.onClick ? /* @__PURE__ */ r("button", { type: "button", onClick: e.onClick, className: "bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors bear-truncate", children: t }) : /* @__PURE__ */ r("span", { className: "bear-text-zinc-400 bear-truncate", children: t });
|
|
37
|
+
if (e.dropdownItems && e.dropdownItems.length > 0 && !n) {
|
|
38
|
+
const c = T[l], B = e.dropdownItems.find((s) => s.key === c);
|
|
39
39
|
return /* @__PURE__ */ r(
|
|
40
|
-
|
|
40
|
+
_,
|
|
41
41
|
{
|
|
42
42
|
placement: "bottom-start",
|
|
43
43
|
closeOnSelect: !0,
|
|
44
|
-
trigger: /* @__PURE__ */
|
|
44
|
+
trigger: /* @__PURE__ */ p(
|
|
45
45
|
"button",
|
|
46
46
|
{
|
|
47
47
|
type: "button",
|
|
48
48
|
className: "bear-inline-flex bear-items-center bear-gap-1 bear-text-zinc-400 hover:bear-text-primary-400 bear-transition-colors",
|
|
49
49
|
"aria-haspopup": "true",
|
|
50
50
|
children: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */ r(
|
|
51
|
+
t,
|
|
52
|
+
B && /* @__PURE__ */ r("span", { className: "bear-ml-1 bear-max-w-[8rem] bear-truncate bear-text-xs bear-text-zinc-300", children: B.label }),
|
|
53
|
+
/* @__PURE__ */ r(b.ChevronDownIcon, { size: 14 })
|
|
54
54
|
]
|
|
55
55
|
}
|
|
56
56
|
),
|
|
@@ -60,40 +60,41 @@ const ne = (_) => {
|
|
|
60
60
|
disabled: s.disabled,
|
|
61
61
|
selected: c === s.key,
|
|
62
62
|
onClick: () => {
|
|
63
|
-
var
|
|
64
|
-
|
|
63
|
+
var O;
|
|
64
|
+
N((V) => ({ ...V, [l]: s.key })), (O = s.onClick) == null || O.call(s);
|
|
65
65
|
}
|
|
66
66
|
}))
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
return o;
|
|
71
|
-
},
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
const e = a.slice(0,
|
|
75
|
-
|
|
76
|
-
...e.map((
|
|
77
|
-
...
|
|
78
|
-
...l.map((
|
|
71
|
+
}, F = k != null && a.length > k, S = x, W = a.length - m;
|
|
72
|
+
let z = a.map((e, l) => ({ type: "item", item: e, index: l }));
|
|
73
|
+
if (F) {
|
|
74
|
+
const e = a.slice(0, x), l = a.slice(-m), n = a.slice(x, a.length - m);
|
|
75
|
+
z = [
|
|
76
|
+
...e.map((t, o) => ({ type: "item", item: t, index: o })),
|
|
77
|
+
...n.length ? [{ type: "ellipsis", hidden: n }] : [],
|
|
78
|
+
...l.map((t, o) => ({
|
|
79
79
|
type: "item",
|
|
80
|
-
item:
|
|
81
|
-
index: a.length -
|
|
80
|
+
item: t,
|
|
81
|
+
index: a.length - m + o
|
|
82
82
|
}))
|
|
83
83
|
];
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const Z = i != null && i >= S && i < W;
|
|
86
86
|
return /* @__PURE__ */ r(
|
|
87
87
|
"nav",
|
|
88
88
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
dir: C,
|
|
90
|
+
"data-testid": P,
|
|
91
|
+
className: w("bear-flex bear-min-w-0 bear-items-center bear-flex-wrap", J[d], A),
|
|
92
|
+
"aria-label": H,
|
|
93
|
+
children: /* @__PURE__ */ r("ol", { className: "bear-flex bear-min-w-0 bear-items-center bear-flex-wrap bear-list-none bear-p-0 bear-m-0", children: z.map((e, l) => /* @__PURE__ */ p("li", { className: "bear-flex bear-min-w-0 bear-items-center", children: [
|
|
94
|
+
l > 0 && /* @__PURE__ */ r("span", { "aria-hidden": "true", children: j() }),
|
|
95
|
+
e.type === "ellipsis" ? /* @__PURE__ */ p("span", { className: "bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-1", children: [
|
|
95
96
|
/* @__PURE__ */ r(
|
|
96
|
-
|
|
97
|
+
_,
|
|
97
98
|
{
|
|
98
99
|
placement: "bottom-start",
|
|
99
100
|
closeOnSelect: !0,
|
|
@@ -103,32 +104,32 @@ const ne = (_) => {
|
|
|
103
104
|
type: "button",
|
|
104
105
|
className: "bear-inline-flex bear-items-center bear-justify-center bear-rounded bear-px-2 bear-py-1 bear-text-zinc-400 hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-primary-400 bear-transition-colors",
|
|
105
106
|
"aria-label": "Hidden breadcrumbs",
|
|
106
|
-
children: /* @__PURE__ */ r(
|
|
107
|
+
children: /* @__PURE__ */ r(b.MoreHorizIcon, { size: 18 })
|
|
107
108
|
}
|
|
108
109
|
),
|
|
109
|
-
items: e.hidden.map((
|
|
110
|
-
const o =
|
|
110
|
+
items: e.hidden.map((n, t) => {
|
|
111
|
+
const o = S + t;
|
|
111
112
|
return {
|
|
112
|
-
key: `${
|
|
113
|
-
label:
|
|
113
|
+
key: `${n.label}-${t}`,
|
|
114
|
+
label: n.label,
|
|
114
115
|
onClick: () => {
|
|
115
116
|
var c;
|
|
116
|
-
|
|
117
|
+
E(o), (c = n.onClick) == null || c.call(n);
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
})
|
|
120
121
|
}
|
|
121
122
|
),
|
|
122
|
-
|
|
123
|
+
Z && i != null && /* @__PURE__ */ r("span", { className: "bear-min-w-0 bear-max-w-[12rem] bear-truncate md:bear-max-w-none bear-inline-flex bear-items-center", children: v(
|
|
123
124
|
a[i],
|
|
124
125
|
i,
|
|
125
126
|
i === a.length - 1
|
|
126
127
|
) })
|
|
127
|
-
] }) :
|
|
128
|
+
] }) : v(e.item, e.index, e.index === a.length - 1)
|
|
128
129
|
] }, l)) })
|
|
129
130
|
}
|
|
130
131
|
);
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
le as Breadcrumbs
|
|
134
135
|
};
|
|
@@ -21,8 +21,7 @@ export interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 't
|
|
|
21
21
|
/** Action element on the right side */
|
|
22
22
|
action?: ReactNode;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
25
|
-
}
|
|
24
|
+
export type CardBodyProps = HTMLAttributes<HTMLDivElement>;
|
|
26
25
|
export interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
27
26
|
/** Whether to add a divider above footer */
|
|
28
27
|
divider?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={PLACEHOLDER:"Type a message...",HEIGHT:400,TYPING_TEXT:"is typing..."},t={sending:"○",sent:"✓",delivered:"✓✓",read:"✓✓",error:"!"},r={user:{bg:"var(--bear-primary-500)",text:"white"},bot:{bg:"var(--bear-bg-secondary)",text:"var(--bear-text-primary)"},system:{bg:"transparent",text:"var(--bear-text-tertiary)"}};exports.CHAT_DEFAULTS=e;exports.MESSAGE_STATUS_ICONS=t;exports.SENDER_COLORS=r;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={PLACEHOLDER:"Type a message...",HEIGHT:400,TYPING_TEXT:"is typing..."},t={sending:"○",sent:"✓",delivered:"✓✓",read:"✓✓",error:"!"},r={user:{bg:"var(--bear-primary-500)",text:"white"},bot:{bg:"var(--bear-bg-secondary)",text:"var(--bear-text-primary)"},system:{bg:"transparent",text:"var(--bear-text-tertiary, var(--bear-text-muted))"}};exports.CHAT_DEFAULTS=e;exports.MESSAGE_STATUS_ICONS=t;exports.SENDER_COLORS=r;
|
|
@@ -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"),e=require("./Chip.const.cjs"),i=require("../../utils/cn.cjs");require("react");const O=require("../../utils/generateBearId.utils.cjs"),L=require("../../utils/useBearId.cjs"),v=c=>{const{children:_,variant:d="filled",color:b="default",size:n="md",icon:s,avatar:t,onDelete:l,onClick:o,disabled:a=!1,className:u,id:C,testId:S}=c,p=L.useBearId("Chip"),m=O.resolveBearId(C,p),I=o?"button":"span";return r.jsxs(I,{id:m,"data-testid":S,onClick:o,disabled:a,className:i.cn(e.C_H_I_P_ROOT_CLASS,"bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",e.CHIP_SIZE_CLASSES[n],e.CHIP_COLOR_CLASSES[d][b],o&&!a&&"bear-cursor-pointer hover:bear-opacity-80",a&&"bear-opacity-50 bear-cursor-not-allowed",u),children:[t&&r.jsx("span",{className:`${e.C_H_I_P_ROOT_CLASS}__avatar bear--ml-1`,children:t}),s&&r.jsx("span",{className:`${e.C_H_I_P_ROOT_CLASS}__icon`,children:s}),r.jsx("span",{className:`${e.C_H_I_P_ROOT_CLASS}__label`,children:_}),l&&r.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),l()},disabled:a,className:i.cn(`${e.C_H_I_P_ROOT_CLASS}__delete`,"bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/10 dark:hover:bear-bg-black/20 bear-transition-colors",a&&"bear-cursor-not-allowed"),"aria-label":"Remove",children:r.jsx("svg",{className:e.CHIP_DELETE_ICON_SIZES[n],fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};exports.Chip=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-Chip",r={filled:{default:"bear-bg-gray-600 bear-text-white dark:bear-bg-zinc-600",primary:"bear-bg-primary-500 bear-text-white",secondary:"bear-bg-purple-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-black",error:"bear-bg-red-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white"},outlined:{default:"bear-border bear-border-gray-400 bear-text-gray-700 dark:bear-border-zinc-500 dark:bear-text-zinc-300",primary:"bear-border bear-border-primary-500 bear-text-primary-600 dark:bear-text-primary-400",secondary:"bear-border bear-border-purple-500 bear-text-purple-600 dark:bear-text-purple-400",success:"bear-border bear-border-green-500 bear-text-green-700 dark:bear-text-green-400",warning:"bear-border bear-border-yellow-500 bear-text-yellow-700 dark:bear-text-yellow-400",error:"bear-border bear-border-red-500 bear-text-red-600 dark:bear-text-red-400",info:"bear-border bear-border-blue-500 bear-text-blue-600 dark:bear-text-blue-400"},soft:{default:"bear-bg-gray-500/15 bear-text-gray-700 dark:bear-bg-zinc-500/20 dark:bear-text-zinc-300",primary:"bear-bg-primary-500/15 bear-text-primary-700 dark:bear-bg-primary-500/20 dark:bear-text-primary-400",secondary:"bear-bg-purple-500/15 bear-text-purple-700 dark:bear-bg-purple-500/20 dark:bear-text-purple-400",success:"bear-bg-green-500/15 bear-text-green-700 dark:bear-bg-green-500/20 dark:bear-text-green-400",warning:"bear-bg-yellow-500/15 bear-text-yellow-800 dark:bear-bg-yellow-500/20 dark:bear-text-yellow-400",error:"bear-bg-red-500/15 bear-text-red-700 dark:bear-bg-red-500/20 dark:bear-text-red-400",info:"bear-bg-blue-500/15 bear-text-blue-700 dark:bear-bg-blue-500/20 dark:bear-text-blue-400"}},a={sm:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",md:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",lg:"bear-h-10 bear-text-base bear-px-4 bear-gap-2"},b={sm:"bear-w-3 bear-h-3",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"};exports.CHIP_COLOR_CLASSES=r;exports.CHIP_DELETE_ICON_SIZES=b;exports.CHIP_SIZE_CLASSES=a;exports.C_H_I_P_ROOT_CLASS=e;
|
|
@@ -1 +1,40 @@
|
|
|
1
1
|
export declare const C_H_I_P_ROOT_CLASS = "Bear-Chip";
|
|
2
|
+
export declare const CHIP_COLOR_CLASSES: {
|
|
3
|
+
readonly filled: {
|
|
4
|
+
readonly default: "bear-bg-gray-600 bear-text-white dark:bear-bg-zinc-600";
|
|
5
|
+
readonly primary: "bear-bg-primary-500 bear-text-white";
|
|
6
|
+
readonly secondary: "bear-bg-purple-500 bear-text-white";
|
|
7
|
+
readonly success: "bear-bg-green-500 bear-text-white";
|
|
8
|
+
readonly warning: "bear-bg-yellow-500 bear-text-black";
|
|
9
|
+
readonly error: "bear-bg-red-500 bear-text-white";
|
|
10
|
+
readonly info: "bear-bg-blue-500 bear-text-white";
|
|
11
|
+
};
|
|
12
|
+
readonly outlined: {
|
|
13
|
+
readonly default: "bear-border bear-border-gray-400 bear-text-gray-700 dark:bear-border-zinc-500 dark:bear-text-zinc-300";
|
|
14
|
+
readonly primary: "bear-border bear-border-primary-500 bear-text-primary-600 dark:bear-text-primary-400";
|
|
15
|
+
readonly secondary: "bear-border bear-border-purple-500 bear-text-purple-600 dark:bear-text-purple-400";
|
|
16
|
+
readonly success: "bear-border bear-border-green-500 bear-text-green-700 dark:bear-text-green-400";
|
|
17
|
+
readonly warning: "bear-border bear-border-yellow-500 bear-text-yellow-700 dark:bear-text-yellow-400";
|
|
18
|
+
readonly error: "bear-border bear-border-red-500 bear-text-red-600 dark:bear-text-red-400";
|
|
19
|
+
readonly info: "bear-border bear-border-blue-500 bear-text-blue-600 dark:bear-text-blue-400";
|
|
20
|
+
};
|
|
21
|
+
readonly soft: {
|
|
22
|
+
readonly default: "bear-bg-gray-500/15 bear-text-gray-700 dark:bear-bg-zinc-500/20 dark:bear-text-zinc-300";
|
|
23
|
+
readonly primary: "bear-bg-primary-500/15 bear-text-primary-700 dark:bear-bg-primary-500/20 dark:bear-text-primary-400";
|
|
24
|
+
readonly secondary: "bear-bg-purple-500/15 bear-text-purple-700 dark:bear-bg-purple-500/20 dark:bear-text-purple-400";
|
|
25
|
+
readonly success: "bear-bg-green-500/15 bear-text-green-700 dark:bear-bg-green-500/20 dark:bear-text-green-400";
|
|
26
|
+
readonly warning: "bear-bg-yellow-500/15 bear-text-yellow-800 dark:bear-bg-yellow-500/20 dark:bear-text-yellow-400";
|
|
27
|
+
readonly error: "bear-bg-red-500/15 bear-text-red-700 dark:bear-bg-red-500/20 dark:bear-text-red-400";
|
|
28
|
+
readonly info: "bear-bg-blue-500/15 bear-text-blue-700 dark:bear-bg-blue-500/20 dark:bear-text-blue-400";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const CHIP_SIZE_CLASSES: {
|
|
32
|
+
readonly sm: "bear-h-6 bear-text-xs bear-px-2 bear-gap-1";
|
|
33
|
+
readonly md: "bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5";
|
|
34
|
+
readonly lg: "bear-h-10 bear-text-base bear-px-4 bear-gap-2";
|
|
35
|
+
};
|
|
36
|
+
export declare const CHIP_DELETE_ICON_SIZES: {
|
|
37
|
+
readonly sm: "bear-w-3 bear-h-3";
|
|
38
|
+
readonly md: "bear-w-4 bear-h-4";
|
|
39
|
+
readonly lg: "bear-w-5 bear-h-5";
|
|
40
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const e = "Bear-Chip", r = {
|
|
2
|
+
filled: {
|
|
3
|
+
default: "bear-bg-gray-600 bear-text-white dark:bear-bg-zinc-600",
|
|
4
|
+
primary: "bear-bg-primary-500 bear-text-white",
|
|
5
|
+
secondary: "bear-bg-purple-500 bear-text-white",
|
|
6
|
+
success: "bear-bg-green-500 bear-text-white",
|
|
7
|
+
warning: "bear-bg-yellow-500 bear-text-black",
|
|
8
|
+
error: "bear-bg-red-500 bear-text-white",
|
|
9
|
+
info: "bear-bg-blue-500 bear-text-white"
|
|
10
|
+
},
|
|
11
|
+
outlined: {
|
|
12
|
+
default: "bear-border bear-border-gray-400 bear-text-gray-700 dark:bear-border-zinc-500 dark:bear-text-zinc-300",
|
|
13
|
+
primary: "bear-border bear-border-primary-500 bear-text-primary-600 dark:bear-text-primary-400",
|
|
14
|
+
secondary: "bear-border bear-border-purple-500 bear-text-purple-600 dark:bear-text-purple-400",
|
|
15
|
+
success: "bear-border bear-border-green-500 bear-text-green-700 dark:bear-text-green-400",
|
|
16
|
+
warning: "bear-border bear-border-yellow-500 bear-text-yellow-700 dark:bear-text-yellow-400",
|
|
17
|
+
error: "bear-border bear-border-red-500 bear-text-red-600 dark:bear-text-red-400",
|
|
18
|
+
info: "bear-border bear-border-blue-500 bear-text-blue-600 dark:bear-text-blue-400"
|
|
19
|
+
},
|
|
20
|
+
soft: {
|
|
21
|
+
default: "bear-bg-gray-500/15 bear-text-gray-700 dark:bear-bg-zinc-500/20 dark:bear-text-zinc-300",
|
|
22
|
+
primary: "bear-bg-primary-500/15 bear-text-primary-700 dark:bear-bg-primary-500/20 dark:bear-text-primary-400",
|
|
23
|
+
secondary: "bear-bg-purple-500/15 bear-text-purple-700 dark:bear-bg-purple-500/20 dark:bear-text-purple-400",
|
|
24
|
+
success: "bear-bg-green-500/15 bear-text-green-700 dark:bear-bg-green-500/20 dark:bear-text-green-400",
|
|
25
|
+
warning: "bear-bg-yellow-500/15 bear-text-yellow-800 dark:bear-bg-yellow-500/20 dark:bear-text-yellow-400",
|
|
26
|
+
error: "bear-bg-red-500/15 bear-text-red-700 dark:bear-bg-red-500/20 dark:bear-text-red-400",
|
|
27
|
+
info: "bear-bg-blue-500/15 bear-text-blue-700 dark:bear-bg-blue-500/20 dark:bear-text-blue-400"
|
|
28
|
+
}
|
|
29
|
+
}, a = {
|
|
30
|
+
sm: "bear-h-6 bear-text-xs bear-px-2 bear-gap-1",
|
|
31
|
+
md: "bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",
|
|
32
|
+
lg: "bear-h-10 bear-text-base bear-px-4 bear-gap-2"
|
|
33
|
+
}, b = {
|
|
34
|
+
sm: "bear-w-3 bear-h-3",
|
|
35
|
+
md: "bear-w-4 bear-h-4",
|
|
36
|
+
lg: "bear-w-5 bear-h-5"
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
r as CHIP_COLOR_CLASSES,
|
|
40
|
+
b as CHIP_DELETE_ICON_SIZES,
|
|
41
|
+
a as CHIP_SIZE_CLASSES,
|
|
42
|
+
e as C_H_I_P_ROOT_CLASS
|
|
43
|
+
};
|
|
@@ -1,80 +1,59 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as I, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { C_H_I_P_ROOT_CLASS as a, CHIP_DELETE_ICON_SIZES as S, CHIP_COLOR_CLASSES as v, CHIP_SIZE_CLASSES as k } from "./Chip.const.js";
|
|
3
|
+
import { cn as i } from "../../utils/cn.js";
|
|
3
4
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
error: "bear-bg-red-500 bear-text-white",
|
|
24
|
-
info: "bear-bg-blue-500 bear-text-white"
|
|
25
|
-
},
|
|
26
|
-
outlined: {
|
|
27
|
-
default: "bear-border bear-border-zinc-500 bear-text-zinc-300",
|
|
28
|
-
primary: "bear-border bear-border-primary-500 bear-text-primary-400",
|
|
29
|
-
secondary: "bear-border bear-border-purple-500 bear-text-purple-400",
|
|
30
|
-
success: "bear-border bear-border-green-500 bear-text-green-400",
|
|
31
|
-
warning: "bear-border bear-border-yellow-500 bear-text-yellow-400",
|
|
32
|
-
error: "bear-border bear-border-red-500 bear-text-red-400",
|
|
33
|
-
info: "bear-border bear-border-blue-500 bear-text-blue-400"
|
|
34
|
-
},
|
|
35
|
-
soft: {
|
|
36
|
-
default: "bear-bg-zinc-500/20 bear-text-zinc-300",
|
|
37
|
-
primary: "bear-bg-primary-500/20 bear-text-primary-400",
|
|
38
|
-
secondary: "bear-bg-purple-500/20 bear-text-purple-400",
|
|
39
|
-
success: "bear-bg-green-500/20 bear-text-green-400",
|
|
40
|
-
warning: "bear-bg-yellow-500/20 bear-text-yellow-400",
|
|
41
|
-
error: "bear-bg-red-500/20 bear-text-red-400",
|
|
42
|
-
info: "bear-bg-blue-500/20 bear-text-blue-400"
|
|
43
|
-
}
|
|
44
|
-
}, x = {
|
|
45
|
-
sm: "bear-h-6 bear-text-xs bear-px-2 bear-gap-1",
|
|
46
|
-
md: "bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",
|
|
47
|
-
lg: "bear-h-10 bear-text-base bear-px-4 bear-gap-2"
|
|
48
|
-
}, u = { sm: "bear-w-3 bear-h-3", md: "bear-w-4 bear-h-4", lg: "bear-w-5 bear-h-5" };
|
|
49
|
-
return /* @__PURE__ */ m(
|
|
50
|
-
a ? "button" : "span",
|
|
5
|
+
import { resolveBearId as L } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as N } from "../../utils/useBearId.js";
|
|
7
|
+
const j = (c) => {
|
|
8
|
+
const {
|
|
9
|
+
children: d,
|
|
10
|
+
variant: m = "filled",
|
|
11
|
+
color: b = "default",
|
|
12
|
+
size: t = "md",
|
|
13
|
+
icon: n,
|
|
14
|
+
avatar: l,
|
|
15
|
+
onDelete: s,
|
|
16
|
+
onClick: o,
|
|
17
|
+
disabled: r = !1,
|
|
18
|
+
className: p,
|
|
19
|
+
id: _,
|
|
20
|
+
testId: u
|
|
21
|
+
} = c, C = N("Chip"), f = L(_, C);
|
|
22
|
+
return /* @__PURE__ */ I(
|
|
23
|
+
o ? "button" : "span",
|
|
51
24
|
{
|
|
52
|
-
|
|
25
|
+
id: f,
|
|
26
|
+
"data-testid": u,
|
|
27
|
+
onClick: o,
|
|
53
28
|
disabled: r,
|
|
54
|
-
className:
|
|
29
|
+
className: i(
|
|
30
|
+
a,
|
|
55
31
|
"bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
k[t],
|
|
33
|
+
v[m][b],
|
|
34
|
+
o && !r && "bear-cursor-pointer hover:bear-opacity-80",
|
|
59
35
|
r && "bear-opacity-50 bear-cursor-not-allowed",
|
|
60
|
-
|
|
36
|
+
p
|
|
61
37
|
),
|
|
62
38
|
children: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */ e("span", { children:
|
|
66
|
-
|
|
39
|
+
l && /* @__PURE__ */ e("span", { className: `${a}__avatar bear--ml-1`, children: l }),
|
|
40
|
+
n && /* @__PURE__ */ e("span", { className: `${a}__icon`, children: n }),
|
|
41
|
+
/* @__PURE__ */ e("span", { className: `${a}__label`, children: d }),
|
|
42
|
+
s && /* @__PURE__ */ e(
|
|
67
43
|
"button",
|
|
68
44
|
{
|
|
69
|
-
|
|
70
|
-
|
|
45
|
+
type: "button",
|
|
46
|
+
onClick: (h) => {
|
|
47
|
+
h.stopPropagation(), s();
|
|
71
48
|
},
|
|
72
49
|
disabled: r,
|
|
73
|
-
className:
|
|
74
|
-
|
|
50
|
+
className: i(
|
|
51
|
+
`${a}__delete`,
|
|
52
|
+
"bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/10 dark:hover:bear-bg-black/20 bear-transition-colors",
|
|
75
53
|
r && "bear-cursor-not-allowed"
|
|
76
54
|
),
|
|
77
|
-
|
|
55
|
+
"aria-label": "Remove",
|
|
56
|
+
children: /* @__PURE__ */ e("svg", { className: S[t], fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
78
57
|
}
|
|
79
58
|
)
|
|
80
59
|
]
|
|
@@ -82,5 +61,5 @@ const z = ({
|
|
|
82
61
|
);
|
|
83
62
|
};
|
|
84
63
|
export {
|
|
85
|
-
|
|
64
|
+
j as Chip
|
|
86
65
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),e=require("./ChipGroup.const.cjs"),o=require("../../utils/cn.cjs"),m=require("../../utils/generateBearId.utils.cjs"),O=require("../../utils/useBearId.cjs"),P=c=>{const{id:a,testId:d,children:l,max:r,spacing:u="md",className:_,...S}=c,C=O.useBearId("ChipGroup"),p=m.resolveBearId(a,C),s=i.Children.toArray(l).filter(i.isValidElement),I=typeof r=="number"?s.slice(0,r):s,t=typeof r=="number"?Math.max(0,s.length-r):0;return n.jsxs("div",{...S,id:p,"data-testid":d,className:o.cn(e.CHIP_GROUP_ROOT_CLASS,e.CHIP_GROUP_BASE_CLASSES,e.CHIP_GROUP_SPACING_CLASSES[u],_),children:[I,t>0&&n.jsxs("span",{className:o.cn(`${e.CHIP_GROUP_ROOT_CLASS}__overflow`,e.CHIP_GROUP_OVERFLOW_CLASSES),children:["+",t]})]})};exports.ChipGroup=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-ChipGroup",r="bear-inline-flex bear-flex-wrap bear-items-center",a={sm:"bear-gap-1",md:"bear-gap-1.5",lg:"bear-gap-2"},S="bear-inline-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-gray-200 dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-200 bear-text-xs bear-font-medium bear-h-8 bear-min-w-[2rem] bear-px-2";exports.CHIP_GROUP_BASE_CLASSES=r;exports.CHIP_GROUP_OVERFLOW_CLASSES=S;exports.CHIP_GROUP_ROOT_CLASS=e;exports.CHIP_GROUP_SPACING_CLASSES=a;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const CHIP_GROUP_ROOT_CLASS = "Bear-ChipGroup";
|
|
2
|
+
export declare const CHIP_GROUP_BASE_CLASSES = "bear-inline-flex bear-flex-wrap bear-items-center";
|
|
3
|
+
export declare const CHIP_GROUP_SPACING_CLASSES: {
|
|
4
|
+
readonly sm: "bear-gap-1";
|
|
5
|
+
readonly md: "bear-gap-1.5";
|
|
6
|
+
readonly lg: "bear-gap-2";
|
|
7
|
+
};
|
|
8
|
+
export declare const CHIP_GROUP_OVERFLOW_CLASSES = "bear-inline-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-gray-200 dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-200 bear-text-xs bear-font-medium bear-h-8 bear-min-w-[2rem] bear-px-2";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const e = "Bear-ChipGroup", r = "bear-inline-flex bear-flex-wrap bear-items-center", a = {
|
|
2
|
+
sm: "bear-gap-1",
|
|
3
|
+
md: "bear-gap-1.5",
|
|
4
|
+
lg: "bear-gap-2"
|
|
5
|
+
}, b = "bear-inline-flex bear-items-center bear-justify-center bear-rounded-full bear-bg-gray-200 dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-200 bear-text-xs bear-font-medium bear-h-8 bear-min-w-[2rem] bear-px-2";
|
|
6
|
+
export {
|
|
7
|
+
r as CHIP_GROUP_BASE_CLASSES,
|
|
8
|
+
b as CHIP_GROUP_OVERFLOW_CLASSES,
|
|
9
|
+
e as CHIP_GROUP_ROOT_CLASS,
|
|
10
|
+
a as CHIP_GROUP_SPACING_CLASSES
|
|
11
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { Children as f, isValidElement as I } from "react";
|
|
3
|
+
import { CHIP_GROUP_OVERFLOW_CLASSES as h, CHIP_GROUP_ROOT_CLASS as s, CHIP_GROUP_SPACING_CLASSES as P, CHIP_GROUP_BASE_CLASSES as A } from "./ChipGroup.const.js";
|
|
4
|
+
import { cn as i } from "../../utils/cn.js";
|
|
5
|
+
import { resolveBearId as O } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as G } from "../../utils/useBearId.js";
|
|
7
|
+
const y = (m) => {
|
|
8
|
+
const {
|
|
9
|
+
id: n,
|
|
10
|
+
testId: a,
|
|
11
|
+
children: d,
|
|
12
|
+
max: r,
|
|
13
|
+
spacing: c = "md",
|
|
14
|
+
className: l,
|
|
15
|
+
...p
|
|
16
|
+
} = m, _ = G("ChipGroup"), S = O(n, _), e = f.toArray(d).filter(I), C = typeof r == "number" ? e.slice(0, r) : e, o = typeof r == "number" ? Math.max(0, e.length - r) : 0;
|
|
17
|
+
return /* @__PURE__ */ t(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
...p,
|
|
21
|
+
id: S,
|
|
22
|
+
"data-testid": a,
|
|
23
|
+
className: i(
|
|
24
|
+
s,
|
|
25
|
+
A,
|
|
26
|
+
P[c],
|
|
27
|
+
l
|
|
28
|
+
),
|
|
29
|
+
children: [
|
|
30
|
+
C,
|
|
31
|
+
o > 0 && /* @__PURE__ */ t("span", { className: i(`${s}__overflow`, h), children: [
|
|
32
|
+
"+",
|
|
33
|
+
o
|
|
34
|
+
] })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
y as ChipGroup
|
|
41
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),L=require("react"),h=require("../../utils/cn.cjs"),t=require("./ColorSwatch.const.cjs"),f=require("./ColorSwatch.utils.cjs"),_=({color:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),L=require("react"),h=require("../../utils/cn.cjs"),t=require("./ColorSwatch.const.cjs"),f=require("./ColorSwatch.utils.cjs"),_=({color:l,selected:r=!1,size:s="md",rounded:c=!0,label:d,onClick:A,className:C,testId:S,...m})=>{const a=t.SIZE_MAP[s],n=f.isLightColor(l),o=Math.max(12,a*.4);return i.jsxs("div",{className:"bear-inline-flex bear-flex-col bear-items-center",children:[i.jsx("div",{className:h.cn(t.SWATCH_CLASSES,r&&t.SWATCH_SELECTED_CLASSES,n?t.SWATCH_LIGHT_BORDER:t.SWATCH_DEFAULT_BORDER,c?"bear-rounded-full":"bear-rounded-md",C),style:{width:a,height:a,backgroundColor:l},onClick:A,role:"option","aria-selected":r,"aria-label":d??l,"data-testid":S,...m,children:r&&i.jsx("svg",{className:h.cn(n?t.LIGHT_CHECK_CLASSES:t.CHECK_CLASSES),width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})})}),d&&i.jsx("span",{className:t.LABEL_CLASSES,style:{maxWidth:a+8},children:d})]})},w=({colors:l,value:r,onChange:s,multiple:c=!1,size:d="md",rounded:A=!0,gap:C=t.DEFAULT_GAP,columns:S,showLabel:m=!1,className:a,testId:n,...o})=>{const E=L.useMemo(()=>r?new Set(Array.isArray(r)?r:[r]):new Set,[r]),x=L.useCallback(e=>{if(c){const u=new Set(E);u.has(e)?u.delete(e):u.add(e),s==null||s(Array.from(u))}else s==null||s(e)},[c,E,s]);return i.jsx("div",{className:h.cn(t.GROUP_CLASSES,a),style:{gap:C,...S?{display:"grid",gridTemplateColumns:`repeat(${S}, 1fr)`}:{}},role:"listbox","aria-multiselectable":c,"data-testid":n,...o,children:l.map(e=>i.jsx(_,{color:e,selected:E.has(e),size:d,rounded:A,label:m?e:void 0,onClick:()=>x(e)},e))})};exports.ColorSwatch=_;exports.ColorSwatchGroup=w;
|