@kaanolin/react 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Badge-BdwYClmA.js +46 -0
- package/dist/Badge-D-fw1KUp.cjs +1 -0
- package/dist/Button-DeGRO_vB.cjs +1 -0
- package/dist/Button-DqS-IYl4.js +412 -0
- package/dist/Card-D4IOT1yc.js +218 -0
- package/dist/Card-JKuBVmXq.cjs +1 -0
- package/dist/DatePickerRange-BPYe2jNs.cjs +1 -0
- package/dist/DatePickerRange-DVctX_Qb.js +5029 -0
- package/dist/Input-BpWJLED2.js +223 -0
- package/dist/Input-CstnV1U8.cjs +1 -0
- package/dist/InputGroup-SVC5Ep6J.js +97 -0
- package/dist/InputGroup-whgNDsHd.cjs +1 -0
- package/dist/Modal-DAyvQW7Z.js +260 -0
- package/dist/Modal-DQLhEOJ2.cjs +1 -0
- package/dist/Select-1U2YyMRi.cjs +1 -0
- package/dist/Select-C2A4HgEF.js +551 -0
- package/dist/Textarea-BHhXafu9.js +117 -0
- package/dist/Textarea-Ceix8Thf.cjs +1 -0
- package/dist/_shared/form-field.styles.d.ts +7 -0
- package/dist/_shared/form-field.styles.d.ts.map +1 -0
- package/dist/_shared/icons.d.ts +2 -0
- package/dist/_shared/icons.d.ts.map +1 -0
- package/dist/_shared/index.d.ts +3 -0
- package/dist/_shared/index.d.ts.map +1 -0
- package/dist/badge/Badge.d.ts +8 -0
- package/dist/badge/Badge.d.ts.map +1 -0
- package/dist/badge/Badge.styles.d.ts +5 -0
- package/dist/badge/Badge.styles.d.ts.map +1 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge.cjs +1 -0
- package/dist/badge.js +5 -0
- package/dist/button/Button.d.ts +22 -0
- package/dist/button/Button.d.ts.map +1 -0
- package/dist/button/Button.styles.d.ts +21 -0
- package/dist/button/Button.styles.d.ts.map +1 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button.cjs +1 -0
- package/dist/button.js +10 -0
- package/dist/card/Card.d.ts +26 -0
- package/dist/card/Card.d.ts.map +1 -0
- package/dist/card/Card.styles.d.ts +28 -0
- package/dist/card/Card.styles.d.ts.map +1 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.d.ts.map +1 -0
- package/dist/card.cjs +1 -0
- package/dist/card.js +20 -0
- package/dist/cx-C5SviAs-.cjs +1 -0
- package/dist/cx-CMoRfr5S.js +2304 -0
- package/dist/date-picker-range/DatePickerRange.d.ts +36 -0
- package/dist/date-picker-range/DatePickerRange.d.ts.map +1 -0
- package/dist/date-picker-range/DatePickerRange.styles.d.ts +16 -0
- package/dist/date-picker-range/DatePickerRange.styles.d.ts.map +1 -0
- package/dist/date-picker-range/index.d.ts +3 -0
- package/dist/date-picker-range/index.d.ts.map +1 -0
- package/dist/date-picker-range.cjs +1 -0
- package/dist/date-picker-range.js +11 -0
- package/dist/form-field.styles-BHdf4QA5.cjs +1 -0
- package/dist/form-field.styles-Bt9srSak.js +32 -0
- package/dist/icons-BFvETcdo.js +22 -0
- package/dist/icons-jGx5qsVM.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +94 -0
- package/dist/input/Input.d.ts +22 -0
- package/dist/input/Input.d.ts.map +1 -0
- package/dist/input/Input.styles.d.ts +18 -0
- package/dist/input/Input.styles.d.ts.map +1 -0
- package/dist/input/index.d.ts +6 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input-group/InputGroup.d.ts +36 -0
- package/dist/input-group/InputGroup.d.ts.map +1 -0
- package/dist/input-group/InputGroup.styles.d.ts +7 -0
- package/dist/input-group/InputGroup.styles.d.ts.map +1 -0
- package/dist/input-group/index.d.ts +3 -0
- package/dist/input-group/index.d.ts.map +1 -0
- package/dist/input-group.cjs +1 -0
- package/dist/input-group.js +7 -0
- package/dist/input.cjs +1 -0
- package/dist/input.js +23 -0
- package/dist/modal/Modal.d.ts +37 -0
- package/dist/modal/Modal.d.ts.map +1 -0
- package/dist/modal/Modal.styles.d.ts +16 -0
- package/dist/modal/Modal.styles.d.ts.map +1 -0
- package/dist/modal/index.d.ts +3 -0
- package/dist/modal/index.d.ts.map +1 -0
- package/dist/modal.cjs +1 -0
- package/dist/modal.js +21 -0
- package/dist/select/Select.d.ts +51 -0
- package/dist/select/Select.d.ts.map +1 -0
- package/dist/select/Select.styles.d.ts +20 -0
- package/dist/select/Select.styles.d.ts.map +1 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.d.ts.map +1 -0
- package/dist/select.cjs +1 -0
- package/dist/select.js +14 -0
- package/dist/styles/colors.css +391 -0
- package/dist/styles/index.css +487 -0
- package/dist/styles/shadows.css +32 -0
- package/dist/styles/spacing.css +20 -0
- package/dist/styles/typography.css +44 -0
- package/dist/textarea/Textarea.d.ts +18 -0
- package/dist/textarea/Textarea.d.ts.map +1 -0
- package/dist/textarea/Textarea.styles.d.ts +6 -0
- package/dist/textarea/Textarea.styles.d.ts.map +1 -0
- package/dist/textarea/index.d.ts +3 -0
- package/dist/textarea/index.d.ts.map +1 -0
- package/dist/textarea.cjs +1 -0
- package/dist/textarea.js +5 -0
- package/package.json +162 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as g from "react";
|
|
3
|
+
import { c as r } from "./cx-CMoRfr5S.js";
|
|
4
|
+
import { cva as t } from "class-variance-authority";
|
|
5
|
+
import { r as S, a as I, l as w, h as k } from "./form-field.styles-Bt9srSak.js";
|
|
6
|
+
import { H as z } from "./icons-BFvETcdo.js";
|
|
7
|
+
const L = t(
|
|
8
|
+
[
|
|
9
|
+
"flex",
|
|
10
|
+
"w-full",
|
|
11
|
+
"rounded-lg",
|
|
12
|
+
"border",
|
|
13
|
+
"border-border-primary",
|
|
14
|
+
"bg-bg-primary",
|
|
15
|
+
"text-text-primary",
|
|
16
|
+
"font-body",
|
|
17
|
+
"shadow-xs",
|
|
18
|
+
"outline-none",
|
|
19
|
+
"transition-colors",
|
|
20
|
+
"placeholder:text-text-placeholder",
|
|
21
|
+
"focus:ring-4"
|
|
22
|
+
],
|
|
23
|
+
{
|
|
24
|
+
variants: {
|
|
25
|
+
size: {
|
|
26
|
+
small: ["text-sm", "py-2", "px-3", "h-10"],
|
|
27
|
+
medium: ["text-md", "py-2.5", "px-3.5", "h-11"],
|
|
28
|
+
large: ["text-lg", "py-3", "px-4", "h-12"]
|
|
29
|
+
},
|
|
30
|
+
variant: {
|
|
31
|
+
default: ["focus:border-brand-300", "focus:ring-focus-ring/24"],
|
|
32
|
+
error: [
|
|
33
|
+
"border-border-error_subtle",
|
|
34
|
+
"focus:border-border-error",
|
|
35
|
+
"focus:ring-focus-ring-error/24"
|
|
36
|
+
],
|
|
37
|
+
success: [
|
|
38
|
+
"border-border-brand",
|
|
39
|
+
"focus:border-border-brand_alt",
|
|
40
|
+
"focus:ring-focus-ring/24"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
false: null,
|
|
45
|
+
true: [
|
|
46
|
+
"bg-bg-disabled",
|
|
47
|
+
"border-border-disabled",
|
|
48
|
+
"text-text-disabled",
|
|
49
|
+
"cursor-not-allowed",
|
|
50
|
+
"pointer-events-none",
|
|
51
|
+
"shadow-none",
|
|
52
|
+
"focus:ring-0"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
size: "medium",
|
|
58
|
+
variant: "default",
|
|
59
|
+
disabled: !1
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
), V = t(["relative", "flex", "items-center", "w-full"]), j = t(
|
|
63
|
+
["pointer-events-none", "absolute", "size-5", "text-fg-quaternary"],
|
|
64
|
+
{
|
|
65
|
+
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
small: ["left-3"],
|
|
68
|
+
medium: ["left-3.5"],
|
|
69
|
+
large: ["left-4"]
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
false: null,
|
|
73
|
+
true: ["text-fg-disabled"]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
defaultVariants: { size: "medium", disabled: !1 }
|
|
77
|
+
}
|
|
78
|
+
), q = t(
|
|
79
|
+
["pointer-events-none", "absolute", "size-4", "text-fg-error-secondary"],
|
|
80
|
+
{
|
|
81
|
+
variants: {
|
|
82
|
+
size: {
|
|
83
|
+
small: ["right-3"],
|
|
84
|
+
medium: ["right-3.5"],
|
|
85
|
+
large: ["right-4"]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: { size: "medium" }
|
|
89
|
+
}
|
|
90
|
+
), C = t(
|
|
91
|
+
[
|
|
92
|
+
"pointer-events-none",
|
|
93
|
+
"absolute",
|
|
94
|
+
"inset-y-0.5",
|
|
95
|
+
"right-0.5",
|
|
96
|
+
"z-10",
|
|
97
|
+
"flex",
|
|
98
|
+
"items-center",
|
|
99
|
+
"rounded-r-[inherit]",
|
|
100
|
+
"bg-gradient-to-r",
|
|
101
|
+
"from-transparent",
|
|
102
|
+
"to-bg-primary",
|
|
103
|
+
"to-40%",
|
|
104
|
+
"pl-8"
|
|
105
|
+
],
|
|
106
|
+
{
|
|
107
|
+
variants: {
|
|
108
|
+
size: {
|
|
109
|
+
small: ["pr-2"],
|
|
110
|
+
medium: ["pr-2.5"],
|
|
111
|
+
large: ["pr-3"]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
defaultVariants: { size: "medium" }
|
|
115
|
+
}
|
|
116
|
+
), W = t([
|
|
117
|
+
"pointer-events-none",
|
|
118
|
+
"rounded",
|
|
119
|
+
"px-1",
|
|
120
|
+
"py-px",
|
|
121
|
+
"text-xs",
|
|
122
|
+
"font-medium",
|
|
123
|
+
"text-text-quaternary",
|
|
124
|
+
"ring-1",
|
|
125
|
+
"ring-border-secondary",
|
|
126
|
+
"select-none",
|
|
127
|
+
"ring-inset"
|
|
128
|
+
]), B = g.forwardRef(
|
|
129
|
+
({
|
|
130
|
+
className: l,
|
|
131
|
+
size: a,
|
|
132
|
+
variant: o,
|
|
133
|
+
disabled: d = !1,
|
|
134
|
+
label: f,
|
|
135
|
+
helperText: c,
|
|
136
|
+
id: x,
|
|
137
|
+
icon: u,
|
|
138
|
+
tooltip: m,
|
|
139
|
+
shortcut: s,
|
|
140
|
+
isRequired: b,
|
|
141
|
+
hideRequiredIndicator: h,
|
|
142
|
+
...y
|
|
143
|
+
}, v) => {
|
|
144
|
+
const i = x || g.useId(), p = o === "error", N = r(
|
|
145
|
+
!!u && (a === "small" ? "pl-10" : a === "large" ? "pl-12" : "pl-11"),
|
|
146
|
+
(p || s) && (a === "small" ? "pr-10" : a === "large" ? "pr-12" : "pr-11")
|
|
147
|
+
);
|
|
148
|
+
return /* @__PURE__ */ n("div", { className: "flex w-full flex-col items-start gap-1.5", children: [
|
|
149
|
+
f && /* @__PURE__ */ n("label", { htmlFor: i, className: r(w()), children: [
|
|
150
|
+
f,
|
|
151
|
+
b && !h && /* @__PURE__ */ e("span", { className: r(S()), children: "*" }),
|
|
152
|
+
m && /* @__PURE__ */ e(
|
|
153
|
+
"span",
|
|
154
|
+
{
|
|
155
|
+
className: r(I()),
|
|
156
|
+
title: m,
|
|
157
|
+
role: "img",
|
|
158
|
+
"aria-label": m,
|
|
159
|
+
children: /* @__PURE__ */ e(z, {})
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ n("div", { className: r(V()), children: [
|
|
164
|
+
u && /* @__PURE__ */ e(
|
|
165
|
+
u,
|
|
166
|
+
{
|
|
167
|
+
"aria-hidden": "true",
|
|
168
|
+
className: r(j({ size: a, disabled: !!d }))
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ e(
|
|
172
|
+
"input",
|
|
173
|
+
{
|
|
174
|
+
id: i,
|
|
175
|
+
className: r(
|
|
176
|
+
L({ size: a, variant: o, disabled: !!d }),
|
|
177
|
+
N,
|
|
178
|
+
l
|
|
179
|
+
),
|
|
180
|
+
ref: v,
|
|
181
|
+
disabled: !!d,
|
|
182
|
+
required: b || void 0,
|
|
183
|
+
"aria-invalid": p || void 0,
|
|
184
|
+
"aria-describedby": c ? `${i}-helper` : void 0,
|
|
185
|
+
...y
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
p && /* @__PURE__ */ e(H, { className: r(q({ size: a })), "aria-hidden": "true" }),
|
|
189
|
+
s && /* @__PURE__ */ e("div", { className: r(C({ size: a })), children: /* @__PURE__ */ e("span", { className: r(W()), "aria-hidden": "true", children: typeof s == "string" ? s : "⌘K" }) })
|
|
190
|
+
] }),
|
|
191
|
+
c && /* @__PURE__ */ e("p", { id: `${i}-helper`, className: r(k({ variant: o })), children: c })
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
B.displayName = "Input";
|
|
196
|
+
const H = (l) => /* @__PURE__ */ n(
|
|
197
|
+
"svg",
|
|
198
|
+
{
|
|
199
|
+
width: "16",
|
|
200
|
+
height: "16",
|
|
201
|
+
viewBox: "0 0 16 16",
|
|
202
|
+
fill: "none",
|
|
203
|
+
stroke: "currentColor",
|
|
204
|
+
strokeWidth: "1.5",
|
|
205
|
+
strokeLinecap: "round",
|
|
206
|
+
strokeLinejoin: "round",
|
|
207
|
+
...l,
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "6.25" }),
|
|
210
|
+
/* @__PURE__ */ e("line", { x1: "8", y1: "5.5", x2: "8", y2: "5.51", strokeWidth: "2" }),
|
|
211
|
+
/* @__PURE__ */ e("line", { x1: "8", y1: "7.5", x2: "8", y2: "10.5" })
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
export {
|
|
216
|
+
B as I,
|
|
217
|
+
W as a,
|
|
218
|
+
C as b,
|
|
219
|
+
L as c,
|
|
220
|
+
q as d,
|
|
221
|
+
V as e,
|
|
222
|
+
j as i
|
|
223
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),O=require("react"),t=require("./cx-C5SviAs-.cjs"),a=require("class-variance-authority"),c=require("./form-field.styles-BHdf4QA5.cjs"),V=require("./icons-jGx5qsVM.cjs");function W(s){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:()=>s[n]})}}return r.default=s,Object.freeze(r)}const b=W(O),g=a.cva(["flex","w-full","rounded-lg","border","border-border-primary","bg-bg-primary","text-text-primary","font-body","shadow-xs","outline-none","transition-colors","placeholder:text-text-placeholder","focus:ring-4"],{variants:{size:{small:["text-sm","py-2","px-3","h-10"],medium:["text-md","py-2.5","px-3.5","h-11"],large:["text-lg","py-3","px-4","h-12"]},variant:{default:["focus:border-brand-300","focus:ring-focus-ring/24"],error:["border-border-error_subtle","focus:border-border-error","focus:ring-focus-ring-error/24"],success:["border-border-brand","focus:border-border-brand_alt","focus:ring-focus-ring/24"]},disabled:{false:null,true:["bg-bg-disabled","border-border-disabled","text-text-disabled","cursor-not-allowed","pointer-events-none","shadow-none","focus:ring-0"]}},defaultVariants:{size:"medium",variant:"default",disabled:!1}}),y=a.cva(["relative","flex","items-center","w-full"]),h=a.cva(["pointer-events-none","absolute","size-5","text-fg-quaternary"],{variants:{size:{small:["left-3"],medium:["left-3.5"],large:["left-4"]},disabled:{false:null,true:["text-fg-disabled"]}},defaultVariants:{size:"medium",disabled:!1}}),v=a.cva(["pointer-events-none","absolute","size-4","text-fg-error-secondary"],{variants:{size:{small:["right-3"],medium:["right-3.5"],large:["right-4"]}},defaultVariants:{size:"medium"}}),j=a.cva(["pointer-events-none","absolute","inset-y-0.5","right-0.5","z-10","flex","items-center","rounded-r-[inherit]","bg-gradient-to-r","from-transparent","to-bg-primary","to-40%","pl-8"],{variants:{size:{small:["pr-2"],medium:["pr-2.5"],large:["pr-3"]}},defaultVariants:{size:"medium"}}),S=a.cva(["pointer-events-none","rounded","px-1","py-px","text-xs","font-medium","text-text-quaternary","ring-1","ring-border-secondary","select-none","ring-inset"]),N=b.forwardRef(({className:s,size:r,variant:n,disabled:i=!1,label:f,helperText:d,id:I,icon:u,tooltip:p,shortcut:l,isRequired:m,hideRequiredIndicator:w,...q},k)=>{const o=I||b.useId(),x=n==="error",_=!!u,z=t.cx(_&&(r==="small"?"pl-10":r==="large"?"pl-12":"pl-11"),(x||l)&&(r==="small"?"pr-10":r==="large"?"pr-12":"pr-11"));return e.jsxs("div",{className:"flex w-full flex-col items-start gap-1.5",children:[f&&e.jsxs("label",{htmlFor:o,className:t.cx(c.labelStyles()),children:[f,m&&!w&&e.jsx("span",{className:t.cx(c.requiredIndicatorStyles()),children:"*"}),p&&e.jsx("span",{className:t.cx(c.labelTooltipStyles()),title:p,role:"img","aria-label":p,children:e.jsx(V.HelpCircleIcon,{})})]}),e.jsxs("div",{className:t.cx(y()),children:[u&&e.jsx(u,{"aria-hidden":"true",className:t.cx(h({size:r,disabled:!!i}))}),e.jsx("input",{id:o,className:t.cx(g({size:r,variant:n,disabled:!!i}),z,s),ref:k,disabled:!!i,required:m||void 0,"aria-invalid":x||void 0,"aria-describedby":d?`${o}-helper`:void 0,...q}),x&&e.jsx(B,{className:t.cx(v({size:r})),"aria-hidden":"true"}),l&&e.jsx("div",{className:t.cx(j({size:r})),children:e.jsx("span",{className:t.cx(S()),"aria-hidden":"true",children:typeof l=="string"?l:"⌘K"})})]}),d&&e.jsx("p",{id:`${o}-helper`,className:t.cx(c.helperTextStyles({variant:n})),children:d})]})});N.displayName="Input";const B=s=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",...s,children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),e.jsx("line",{x1:"8",y1:"5.5",x2:"8",y2:"5.51",strokeWidth:"2"}),e.jsx("line",{x1:"8",y1:"7.5",x2:"8",y2:"10.5"})]});exports.Input=N;exports.inputIconStyles=h;exports.inputShortcutBadgeStyles=S;exports.inputShortcutStyles=j;exports.inputStyles=g;exports.inputTrailingIconStyles=v;exports.inputWrapperStyles=y;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { c as r } from "./cx-CMoRfr5S.js";
|
|
4
|
+
import { r as N, l as I, h as w } from "./form-field.styles-Bt9srSak.js";
|
|
5
|
+
import { cva as c } from "class-variance-authority";
|
|
6
|
+
const S = c([
|
|
7
|
+
"relative",
|
|
8
|
+
"flex",
|
|
9
|
+
"w-full",
|
|
10
|
+
"flex-row",
|
|
11
|
+
"items-stretch",
|
|
12
|
+
"rounded-lg"
|
|
13
|
+
]), P = c(
|
|
14
|
+
[
|
|
15
|
+
"flex",
|
|
16
|
+
"items-center",
|
|
17
|
+
"text-text-tertiary",
|
|
18
|
+
"bg-bg-secondary_subtle",
|
|
19
|
+
"border",
|
|
20
|
+
"border-border-primary"
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
position: {
|
|
25
|
+
leading: ["rounded-l-lg", "-mr-px"],
|
|
26
|
+
trailing: ["rounded-r-lg", "-ml-px"]
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
small: ["px-3", "py-2", "text-sm"],
|
|
30
|
+
medium: ["px-3.5", "py-2.5", "text-md"],
|
|
31
|
+
large: ["px-4", "py-3", "text-lg"]
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
false: null,
|
|
35
|
+
true: ["text-text-disabled", "bg-bg-disabled"]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: { position: "leading", size: "medium", disabled: !1 }
|
|
39
|
+
}
|
|
40
|
+
), m = p.forwardRef(
|
|
41
|
+
({ className: d, position: s, size: l, disabled: a, children: t, ...i }, o) => /* @__PURE__ */ e(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
ref: o,
|
|
45
|
+
className: r(P({ position: s, size: l, disabled: a }), d),
|
|
46
|
+
...i,
|
|
47
|
+
children: t
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
m.displayName = "InputPrefix";
|
|
52
|
+
const u = ({
|
|
53
|
+
size: d = "medium",
|
|
54
|
+
prefix: s,
|
|
55
|
+
leadingAddon: l,
|
|
56
|
+
trailingAddon: a,
|
|
57
|
+
label: t,
|
|
58
|
+
hint: i,
|
|
59
|
+
isRequired: o,
|
|
60
|
+
isInvalid: x,
|
|
61
|
+
disabled: f,
|
|
62
|
+
className: b,
|
|
63
|
+
children: g
|
|
64
|
+
}) => {
|
|
65
|
+
const h = p.useId(), y = !!(l || s), v = !!a;
|
|
66
|
+
return /* @__PURE__ */ n("div", { className: r("flex w-full flex-col items-start gap-1.5", b), children: [
|
|
67
|
+
t && /* @__PURE__ */ n("label", { htmlFor: h, className: r(I()), children: [
|
|
68
|
+
t,
|
|
69
|
+
o && /* @__PURE__ */ e("span", { className: r(N()), children: "*" })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ n("div", { className: r(S()), children: [
|
|
72
|
+
l && /* @__PURE__ */ e("div", { children: l }),
|
|
73
|
+
s && /* @__PURE__ */ e(m, { position: "leading", size: d, disabled: !!f, children: s }),
|
|
74
|
+
/* @__PURE__ */ e(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: r(
|
|
78
|
+
"relative flex w-full",
|
|
79
|
+
y && "[&>*]:rounded-l-none",
|
|
80
|
+
v && "[&>*]:rounded-r-none"
|
|
81
|
+
),
|
|
82
|
+
children: g
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
a && /* @__PURE__ */ e("div", { children: a })
|
|
86
|
+
] }),
|
|
87
|
+
i && /* @__PURE__ */ e("p", { className: r(w({ variant: x ? "error" : "default" })), children: i })
|
|
88
|
+
] });
|
|
89
|
+
};
|
|
90
|
+
u.Prefix = m;
|
|
91
|
+
u.displayName = "InputGroup";
|
|
92
|
+
export {
|
|
93
|
+
u as I,
|
|
94
|
+
m as a,
|
|
95
|
+
P as b,
|
|
96
|
+
S as i
|
|
97
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),I=require("react"),a=require("./cx-C5SviAs-.cjs"),o=require("./form-field.styles-BHdf4QA5.cjs"),p=require("class-variance-authority");function S(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(s,e,l.get?l:{enumerable:!0,get:()=>r[e]})}}return s.default=r,Object.freeze(s)}const x=S(I),m=p.cva(["relative","flex","w-full","flex-row","items-stretch","rounded-lg"]),f=p.cva(["flex","items-center","text-text-tertiary","bg-bg-secondary_subtle","border","border-border-primary"],{variants:{position:{leading:["rounded-l-lg","-mr-px"],trailing:["rounded-r-lg","-ml-px"]},size:{small:["px-3","py-2","text-sm"],medium:["px-3.5","py-2.5","text-md"],large:["px-4","py-3","text-lg"]},disabled:{false:null,true:["text-text-disabled","bg-bg-disabled"]}},defaultVariants:{position:"leading",size:"medium",disabled:!1}}),c=x.forwardRef(({className:r,position:s,size:e,disabled:l,children:i,...n},u)=>t.jsx("span",{ref:u,className:a.cx(f({position:s,size:e,disabled:l}),r),...n,children:i}));c.displayName="InputPrefix";const d=({size:r="medium",prefix:s,leadingAddon:e,trailingAddon:l,label:i,hint:n,isRequired:u,isInvalid:b,disabled:y,className:g,children:j})=>{const h=x.useId(),v=!!(e||s),N=!!l;return t.jsxs("div",{className:a.cx("flex w-full flex-col items-start gap-1.5",g),children:[i&&t.jsxs("label",{htmlFor:h,className:a.cx(o.labelStyles()),children:[i,u&&t.jsx("span",{className:a.cx(o.requiredIndicatorStyles()),children:"*"})]}),t.jsxs("div",{className:a.cx(m()),children:[e&&t.jsx("div",{children:e}),s&&t.jsx(c,{position:"leading",size:r,disabled:!!y,children:s}),t.jsx("div",{className:a.cx("relative flex w-full",v&&"[&>*]:rounded-l-none",N&&"[&>*]:rounded-r-none"),children:j}),l&&t.jsx("div",{children:l})]}),n&&t.jsx("p",{className:a.cx(o.helperTextStyles({variant:b?"error":"default"})),children:n})]})};d.Prefix=c;d.displayName="InputGroup";exports.InputGroup=d;exports.InputPrefix=c;exports.inputGroupWrapperStyles=m;exports.inputPrefixStyles=f;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { jsxs as c, Fragment as y, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { c as s } from "./cx-CMoRfr5S.js";
|
|
4
|
+
import { cva as t } from "class-variance-authority";
|
|
5
|
+
const u = t([
|
|
6
|
+
"fixed",
|
|
7
|
+
"inset-0",
|
|
8
|
+
"z-50",
|
|
9
|
+
"bg-bg-overlay/70",
|
|
10
|
+
"backdrop-blur-sm"
|
|
11
|
+
]), b = t(
|
|
12
|
+
[
|
|
13
|
+
"fixed",
|
|
14
|
+
"z-50",
|
|
15
|
+
"flex",
|
|
16
|
+
"flex-col",
|
|
17
|
+
"bg-bg-primary",
|
|
18
|
+
"border",
|
|
19
|
+
"border-border-secondary",
|
|
20
|
+
"shadow-xl",
|
|
21
|
+
"rounded-xl",
|
|
22
|
+
"w-full",
|
|
23
|
+
"max-h-[85vh]",
|
|
24
|
+
"top-1/2",
|
|
25
|
+
"left-1/2",
|
|
26
|
+
"-translate-x-1/2",
|
|
27
|
+
"-translate-y-1/2",
|
|
28
|
+
"outline-none",
|
|
29
|
+
"overflow-hidden"
|
|
30
|
+
],
|
|
31
|
+
{
|
|
32
|
+
variants: {
|
|
33
|
+
size: {
|
|
34
|
+
sm: ["max-w-sm"],
|
|
35
|
+
md: ["max-w-lg"],
|
|
36
|
+
lg: ["max-w-2xl"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "md"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
), x = t([
|
|
44
|
+
"flex",
|
|
45
|
+
"items-start",
|
|
46
|
+
"justify-between",
|
|
47
|
+
"gap-4",
|
|
48
|
+
"px-6",
|
|
49
|
+
"pt-6"
|
|
50
|
+
]), p = t(
|
|
51
|
+
[
|
|
52
|
+
"shrink-0",
|
|
53
|
+
"inline-flex",
|
|
54
|
+
"items-center",
|
|
55
|
+
"justify-center",
|
|
56
|
+
"rounded-full",
|
|
57
|
+
"border"
|
|
58
|
+
],
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
variant: {
|
|
62
|
+
brand: [
|
|
63
|
+
"bg-brand-50",
|
|
64
|
+
"border-brand-100",
|
|
65
|
+
"text-brand-600"
|
|
66
|
+
],
|
|
67
|
+
success: [
|
|
68
|
+
"bg-success-50",
|
|
69
|
+
"border-success-100",
|
|
70
|
+
"text-success-600"
|
|
71
|
+
],
|
|
72
|
+
error: [
|
|
73
|
+
"bg-error-50",
|
|
74
|
+
"border-error-100",
|
|
75
|
+
"text-error-600"
|
|
76
|
+
],
|
|
77
|
+
warning: [
|
|
78
|
+
"bg-warning-50",
|
|
79
|
+
"border-warning-100",
|
|
80
|
+
"text-warning-600"
|
|
81
|
+
],
|
|
82
|
+
gray: [
|
|
83
|
+
"bg-gray-50",
|
|
84
|
+
"border-gray-100",
|
|
85
|
+
"text-gray-600"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
size: {
|
|
89
|
+
sm: ["size-10", "p-2"],
|
|
90
|
+
md: ["size-12", "p-3"]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
defaultVariants: {
|
|
94
|
+
variant: "brand",
|
|
95
|
+
size: "md"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
), g = t([
|
|
99
|
+
"text-lg",
|
|
100
|
+
"font-semibold",
|
|
101
|
+
"leading-tight",
|
|
102
|
+
"text-text-primary"
|
|
103
|
+
]), v = t([
|
|
104
|
+
"text-sm",
|
|
105
|
+
"text-text-tertiary",
|
|
106
|
+
"mt-1"
|
|
107
|
+
]), w = t([
|
|
108
|
+
"flex-1",
|
|
109
|
+
"overflow-y-auto",
|
|
110
|
+
"px-6",
|
|
111
|
+
"py-5"
|
|
112
|
+
]), h = t([
|
|
113
|
+
"flex",
|
|
114
|
+
"items-center",
|
|
115
|
+
"gap-3",
|
|
116
|
+
"px-6",
|
|
117
|
+
"pb-6"
|
|
118
|
+
]), N = t([
|
|
119
|
+
"border-t",
|
|
120
|
+
"border-border-secondary",
|
|
121
|
+
"w-full"
|
|
122
|
+
]), M = t([
|
|
123
|
+
"inline-flex",
|
|
124
|
+
"items-center",
|
|
125
|
+
"justify-center",
|
|
126
|
+
"shrink-0",
|
|
127
|
+
"rounded-lg",
|
|
128
|
+
"size-9",
|
|
129
|
+
"p-2",
|
|
130
|
+
"text-fg-quaternary",
|
|
131
|
+
"cursor-pointer",
|
|
132
|
+
"transition-colors",
|
|
133
|
+
"outline-none",
|
|
134
|
+
"hover:bg-bg-primary_hover",
|
|
135
|
+
"hover:text-fg-secondary",
|
|
136
|
+
"focus-visible:ring-4",
|
|
137
|
+
"focus-visible:ring-gray-100/80"
|
|
138
|
+
]), k = ({
|
|
139
|
+
open: e,
|
|
140
|
+
onOpenChange: a,
|
|
141
|
+
size: r,
|
|
142
|
+
className: d,
|
|
143
|
+
children: i,
|
|
144
|
+
closeOnOverlayClick: n = !0
|
|
145
|
+
}) => (l.useEffect(() => {
|
|
146
|
+
if (!e) return;
|
|
147
|
+
const m = (f) => {
|
|
148
|
+
f.key === "Escape" && a(!1);
|
|
149
|
+
};
|
|
150
|
+
return document.addEventListener("keydown", m), document.body.style.overflow = "hidden", () => {
|
|
151
|
+
document.removeEventListener("keydown", m), document.body.style.overflow = "";
|
|
152
|
+
};
|
|
153
|
+
}, [e, a]), e ? /* @__PURE__ */ c(y, { children: [
|
|
154
|
+
/* @__PURE__ */ o(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: s(u()),
|
|
158
|
+
onClick: n ? () => a(!1) : void 0,
|
|
159
|
+
"aria-hidden": "true",
|
|
160
|
+
"data-testid": "modal-overlay"
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ o(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
role: "dialog",
|
|
167
|
+
"aria-modal": "true",
|
|
168
|
+
className: s(b({ size: r }), d),
|
|
169
|
+
children: i
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] }) : null);
|
|
173
|
+
k.displayName = "Modal";
|
|
174
|
+
const S = l.forwardRef(
|
|
175
|
+
({ className: e, children: a, onClose: r, icon: d, ...i }, n) => /* @__PURE__ */ c("div", { ref: n, className: s(x(), e), ...i, children: [
|
|
176
|
+
d && /* @__PURE__ */ o("div", { className: "shrink-0", children: d }),
|
|
177
|
+
/* @__PURE__ */ o("div", { className: "flex min-w-0 flex-1 flex-col", children: a }),
|
|
178
|
+
r && /* @__PURE__ */ o(
|
|
179
|
+
"button",
|
|
180
|
+
{
|
|
181
|
+
type: "button",
|
|
182
|
+
className: s(M()),
|
|
183
|
+
onClick: r,
|
|
184
|
+
"aria-label": "Close",
|
|
185
|
+
children: /* @__PURE__ */ o(F, {})
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] })
|
|
189
|
+
);
|
|
190
|
+
S.displayName = "ModalHeader";
|
|
191
|
+
const z = l.forwardRef(
|
|
192
|
+
({ className: e, variant: a, size: r, children: d, ...i }, n) => /* @__PURE__ */ o(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
ref: n,
|
|
196
|
+
className: s(p({ variant: a, size: r }), e),
|
|
197
|
+
...i,
|
|
198
|
+
children: d
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
z.displayName = "ModalIcon";
|
|
203
|
+
const R = l.forwardRef(
|
|
204
|
+
({ className: e, children: a, ...r }, d) => /* @__PURE__ */ o("h2", { ref: d, className: s(g(), e), ...r, children: a })
|
|
205
|
+
);
|
|
206
|
+
R.displayName = "ModalTitle";
|
|
207
|
+
const j = l.forwardRef(
|
|
208
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ o("p", { ref: r, className: s(v(), e), ...a })
|
|
209
|
+
);
|
|
210
|
+
j.displayName = "ModalDescription";
|
|
211
|
+
const D = l.forwardRef(
|
|
212
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ o("div", { ref: r, className: s(w(), e), ...a })
|
|
213
|
+
);
|
|
214
|
+
D.displayName = "ModalBody";
|
|
215
|
+
const B = l.forwardRef(
|
|
216
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ o("div", { ref: r, className: s(h(), e), ...a })
|
|
217
|
+
);
|
|
218
|
+
B.displayName = "ModalFooter";
|
|
219
|
+
const E = l.forwardRef(
|
|
220
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ o("hr", { ref: r, className: s(N(), e), ...a })
|
|
221
|
+
);
|
|
222
|
+
E.displayName = "ModalDivider";
|
|
223
|
+
const F = () => /* @__PURE__ */ c(
|
|
224
|
+
"svg",
|
|
225
|
+
{
|
|
226
|
+
width: "20",
|
|
227
|
+
height: "20",
|
|
228
|
+
viewBox: "0 0 24 24",
|
|
229
|
+
fill: "none",
|
|
230
|
+
stroke: "currentColor",
|
|
231
|
+
strokeWidth: "2",
|
|
232
|
+
strokeLinecap: "round",
|
|
233
|
+
strokeLinejoin: "round",
|
|
234
|
+
"aria-hidden": "true",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ o("path", { d: "M18 6 6 18" }),
|
|
237
|
+
/* @__PURE__ */ o("path", { d: "m6 6 12 12" })
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
export {
|
|
242
|
+
k as M,
|
|
243
|
+
D as a,
|
|
244
|
+
j as b,
|
|
245
|
+
E as c,
|
|
246
|
+
B as d,
|
|
247
|
+
S as e,
|
|
248
|
+
z as f,
|
|
249
|
+
R as g,
|
|
250
|
+
M as h,
|
|
251
|
+
v as i,
|
|
252
|
+
N as j,
|
|
253
|
+
h as k,
|
|
254
|
+
x as l,
|
|
255
|
+
w as m,
|
|
256
|
+
p as n,
|
|
257
|
+
b as o,
|
|
258
|
+
g as p,
|
|
259
|
+
u as q
|
|
260
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("react/jsx-runtime"),B=require("react"),s=require("./cx-C5SviAs-.cjs"),l=require("class-variance-authority");function F(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const d=F(B),m=l.cva(["fixed","inset-0","z-50","bg-bg-overlay/70","backdrop-blur-sm"]),y=l.cva(["fixed","z-50","flex","flex-col","bg-bg-primary","border","border-border-secondary","shadow-xl","rounded-xl","w-full","max-h-[85vh]","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2","outline-none","overflow-hidden"],{variants:{size:{sm:["max-w-sm"],md:["max-w-lg"],lg:["max-w-2xl"]}},defaultVariants:{size:"md"}}),x=l.cva(["flex","items-start","justify-between","gap-4","px-6","pt-6"]),f=l.cva(["shrink-0","inline-flex","items-center","justify-center","rounded-full","border"],{variants:{variant:{brand:["bg-brand-50","border-brand-100","text-brand-600"],success:["bg-success-50","border-success-100","text-success-600"],error:["bg-error-50","border-error-100","text-error-600"],warning:["bg-warning-50","border-warning-100","text-warning-600"],gray:["bg-gray-50","border-gray-100","text-gray-600"]},size:{sm:["size-10","p-2"],md:["size-12","p-3"]}},defaultVariants:{variant:"brand",size:"md"}}),u=l.cva(["text-lg","font-semibold","leading-tight","text-text-primary"]),v=l.cva(["text-sm","text-text-tertiary","mt-1"]),b=l.cva(["flex-1","overflow-y-auto","px-6","py-5"]),g=l.cva(["flex","items-center","gap-3","px-6","pb-6"]),p=l.cva(["border-t","border-border-secondary","w-full"]),w=l.cva(["inline-flex","items-center","justify-center","shrink-0","rounded-lg","size-9","p-2","text-fg-quaternary","cursor-pointer","transition-colors","outline-none","hover:bg-bg-primary_hover","hover:text-fg-secondary","focus-visible:ring-4","focus-visible:ring-gray-100/80"]),h=({open:e,onOpenChange:t,size:r,className:o,children:i,closeOnOverlayClick:n=!0})=>(d.useEffect(()=>{if(!e)return;const c=R=>{R.key==="Escape"&&t(!1)};return document.addEventListener("keydown",c),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=""}},[e,t]),e?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:s.cx(m()),onClick:n?()=>t(!1):void 0,"aria-hidden":"true","data-testid":"modal-overlay"}),a.jsx("div",{role:"dialog","aria-modal":"true",className:s.cx(y({size:r}),o),children:i})]}):null);h.displayName="Modal";const j=d.forwardRef(({className:e,children:t,onClose:r,icon:o,...i},n)=>a.jsxs("div",{ref:n,className:s.cx(x(),e),...i,children:[o&&a.jsx("div",{className:"shrink-0",children:o}),a.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:t}),r&&a.jsx("button",{type:"button",className:s.cx(w()),onClick:r,"aria-label":"Close",children:a.jsx(I,{})})]}));j.displayName="ModalHeader";const M=d.forwardRef(({className:e,variant:t,size:r,children:o,...i},n)=>a.jsx("div",{ref:n,className:s.cx(f({variant:t,size:r}),e),...i,children:o}));M.displayName="ModalIcon";const S=d.forwardRef(({className:e,children:t,...r},o)=>a.jsx("h2",{ref:o,className:s.cx(u(),e),...r,children:t}));S.displayName="ModalTitle";const N=d.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:s.cx(v(),e),...t}));N.displayName="ModalDescription";const k=d.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:s.cx(b(),e),...t}));k.displayName="ModalBody";const D=d.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:s.cx(g(),e),...t}));D.displayName="ModalFooter";const z=d.forwardRef(({className:e,...t},r)=>a.jsx("hr",{ref:r,className:s.cx(p(),e),...t}));z.displayName="ModalDivider";const I=()=>a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M18 6 6 18"}),a.jsx("path",{d:"m6 6 12 12"})]});exports.Modal=h;exports.ModalBody=k;exports.ModalDescription=N;exports.ModalDivider=z;exports.ModalFooter=D;exports.ModalHeader=j;exports.ModalIcon=M;exports.ModalTitle=S;exports.modalBodyStyles=b;exports.modalCloseButtonStyles=w;exports.modalDescriptionStyles=v;exports.modalDividerStyles=p;exports.modalFooterStyles=g;exports.modalHeaderStyles=x;exports.modalIconStyles=f;exports.modalStyles=y;exports.modalTitleStyles=u;exports.overlayStyles=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),pe=require("react"),c=require("./cx-C5SviAs-.cjs"),v=require("class-variance-authority"),L=require("./form-field.styles-BHdf4QA5.cjs"),me=require("./icons-jGx5qsVM.cjs");function ye(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const b=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(a,o,b.get?b:{enumerable:!0,get:()=>t[o]})}}return a.default=t,Object.freeze(a)}const r=ye(pe),W=v.cva(["flex","w-full","items-center","justify-between","gap-2","rounded-lg","border","border-border-primary","bg-bg-primary","text-text-primary","font-body","shadow-xs","outline-none","transition-colors","cursor-pointer","focus:ring-4"],{variants:{size:{small:["text-sm","py-2","px-3","h-10"],medium:["text-md","py-2.5","px-3.5","h-11"],large:["text-lg","py-3","px-4","h-12"]},variant:{default:["focus:border-brand-300","focus:ring-focus-ring/24"],error:["border-border-error_subtle","focus:border-border-error","focus:ring-focus-ring-error/24"],success:["border-border-brand","focus:border-border-brand_alt","focus:ring-focus-ring/24"]},disabled:{false:null,true:["bg-bg-disabled","border-border-disabled","text-text-disabled","cursor-not-allowed","pointer-events-none","shadow-none","focus:ring-0"]},open:{false:null,true:["ring-4","ring-focus-ring/24","border-brand-300"]}},compoundVariants:[{open:!0,variant:"error",class:["ring-focus-ring-error/24","border-border-error"]},{open:!0,variant:"success",class:["ring-focus-ring/24","border-border-brand_alt"]}],defaultVariants:{size:"medium",variant:"default",disabled:!1,open:!1}}),F=v.cva(["size-5","shrink-0","text-fg-quaternary","transition-transform","duration-200"],{variants:{open:{false:null,true:["rotate-180"]},disabled:{false:null,true:["text-fg-disabled"]}},defaultVariants:{open:!1,disabled:!1}}),U=v.cva(["absolute","z-50","mt-1","w-full","bg-bg-primary","border","border-border-secondary","rounded-lg","shadow-lg","overflow-hidden","py-1"]),J=v.cva(["max-h-60","overflow-y-auto"]),Q=v.cva(["flex","items-center","justify-between","w-full","px-3.5","py-2.5","text-sm","text-text-primary","cursor-pointer","transition-colors","outline-none"],{variants:{highlighted:{false:null,true:["bg-bg-primary_hover"]},selected:{false:null,true:null},disabled:{false:null,true:["text-text-disabled","cursor-not-allowed","pointer-events-none"]}},defaultVariants:{highlighted:!1,selected:!1,disabled:!1}}),X=v.cva(["px-3.5","py-2","text-xs","font-medium","text-text-tertiary","select-none"]),Y=v.cva(["border-t","border-border-secondary","my-1"]),Z=r.createContext(null);function he(){const t=r.useContext(Z);if(!t)throw new Error("Select sub-components must be used within <Select>");return t}const O=r.forwardRef(({value:t,defaultValue:a,onValueChange:o,placeholder:b="Select...",label:S,helperText:x,tooltip:d,isRequired:w,hideRequiredIndicator:q,className:D,id:E,children:se,onOpenChange:p,size:le,variant:T,disabled:j=!1},ne)=>{const m=E||r.useId(),z=`${m}-listbox`,[l,G]=r.useState(!1),[oe,ae]=r.useState(a),[i,y]=r.useState(null),[,ce]=r.useReducer(e=>e+1,0),u=t!==void 0?t:oe,V=r.useRef(null),_=r.useRef(null),R=r.useRef(new Map),ie=r.useRef(0),$=r.useRef(""),K=r.useRef(void 0),k=r.useCallback(()=>Array.from(R.current.values()).filter(e=>!e.disabled).sort((e,n)=>e.index-n.index),[]),de=r.useCallback(()=>{if(!u)return null;const e=R.current.get(u);return(e==null?void 0:e.label)??null},[u]),h=r.useCallback(()=>{G(!1),y(null),p==null||p(!1)},[p]),I=r.useCallback(()=>{j||(G(!0),p==null||p(!0))},[j,p]);r.useEffect(()=>{if(!l)return;const e=k();e.length!==0&&(u&&e.some(n=>n.value===u)?y(u):y(e[0].value))},[l,u,k]);const C=r.useCallback(e=>{var n;t===void 0&&ae(e),o==null||o(e),h(),(n=V.current)==null||n.focus()},[t,o,h]),A=r.useCallback((e,n,f)=>{const g=ie.current++;return R.current.set(e,{value:e,label:n,disabled:f,index:g}),ce(),g},[]),H=r.useCallback(e=>{R.current.delete(e)},[]);r.useEffect(()=>{if(!l||!i||!_.current)return;const e=_.current.querySelector(`[data-value="${CSS.escape(i)}"]`);e&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})},[l,i]);const B=r.useCallback(e=>{clearTimeout(K.current),$.current+=e.toLowerCase();const f=k().find(g=>g.label.toLowerCase().startsWith($.current));f&&y(f.value),K.current=setTimeout(()=>{$.current=""},500)},[k]),M=r.useCallback(e=>{var g;const n=k(),f=n.findIndex(N=>N.value===i);switch(e.key){case"ArrowDown":{if(e.preventDefault(),!l){I();return}const N=f<n.length-1?f+1:0;y(n[N].value);break}case"ArrowUp":{if(e.preventDefault(),!l){I();return}const N=f>0?f-1:n.length-1;y(n[N].value);break}case"Enter":case" ":{if(e.preventDefault(),!l){I();return}i&&C(i);break}case"Escape":{e.preventDefault(),h(),(g=V.current)==null||g.focus();break}case"Tab":{h();break}case"Home":{e.preventDefault(),l&&n.length&&y(n[0].value);break}case"End":{e.preventDefault(),l&&n.length&&y(n[n.length-1].value);break}default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&l&&(e.preventDefault(),B(e.key))}},[l,i,k,I,h,C,B]),ue=()=>{l?h():I()},P=de(),fe=!!P,be=T==="error",xe=r.useMemo(()=>({selectId:m,selectedValue:u,highlightedValue:i,onSelect:C,registerItem:A,unregisterItem:H}),[m,u,i,C,A,H]);return s.jsxs("div",{ref:ne,className:"flex w-full flex-col items-start gap-1.5",children:[S&&s.jsxs("label",{htmlFor:m,className:c.cx(L.labelStyles()),children:[S,w&&!q&&s.jsx("span",{className:c.cx(L.requiredIndicatorStyles()),children:"*"}),d&&s.jsx("span",{className:c.cx(L.labelTooltipStyles()),title:d,role:"img","aria-label":d,children:s.jsx(me.HelpCircleIcon,{})})]}),s.jsxs("div",{className:"relative w-full",children:[s.jsxs("button",{ref:V,type:"button",id:m,role:"combobox","aria-haspopup":"listbox","aria-expanded":l,"aria-controls":l?z:void 0,"aria-describedby":x?`${m}-helper`:void 0,"aria-required":w||void 0,"aria-invalid":be||void 0,disabled:!!j,onClick:ue,onKeyDown:M,className:c.cx(W({size:le,variant:T,disabled:!!j,open:l}),D),children:[s.jsx("span",{className:c.cx("truncate text-left",!fe&&"text-text-placeholder"),children:P??b}),s.jsx(ge,{className:c.cx(F({open:l,disabled:!!j}))})]}),l&&s.jsx("div",{className:"fixed inset-0 z-40",onClick:h,"aria-hidden":"true","data-testid":"select-overlay"}),s.jsx(Z.Provider,{value:xe,children:s.jsx("ul",{ref:_,id:z,role:"listbox","aria-activedescendant":l&&i?`${m}-option-${i}`:void 0,tabIndex:-1,onKeyDown:M,className:c.cx(U(),!l&&"hidden"),"aria-hidden":!l||void 0,children:s.jsx("div",{className:c.cx(J()),children:se})})})]}),x&&s.jsx("p",{id:`${m}-helper`,className:c.cx(L.helperTextStyles({variant:T})),children:x})]})});O.displayName="Select";const ee=r.forwardRef(({value:t,disabled:a=!1,children:o,className:b,...S},x)=>{const d=he(),w=d.selectedValue===t,q=d.highlightedValue===t,D=typeof o=="string"?o:typeof o=="number"?String(o):t;r.useEffect(()=>(d.registerItem(t,D,a),()=>d.unregisterItem(t)),[t,D,a]);const E=()=>{a||d.onSelect(t)};return s.jsxs("li",{ref:x,id:`${d.selectId}-option-${t}`,role:"option","aria-selected":w,"aria-disabled":a||void 0,"data-value":t,onClick:E,className:c.cx(Q({highlighted:q,selected:w,disabled:a}),b),...S,children:[s.jsx("span",{className:"truncate",children:o}),w&&s.jsx(ve,{className:"size-5 shrink-0 text-brand-600","aria-hidden":"true"})]})});ee.displayName="SelectItem";const te=r.forwardRef(({label:t,children:a,className:o,...b},S)=>{const x=r.useId();return s.jsxs("div",{ref:S,role:"group","aria-labelledby":x,...b,children:[s.jsx("div",{id:x,className:c.cx(X(),o),children:t}),a]})});te.displayName="SelectGroup";const re=r.forwardRef(({className:t,...a},o)=>s.jsx("hr",{ref:o,className:c.cx(Y(),t),"aria-hidden":"true",...a}));re.displayName="SelectSeparator";function ge(t){return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})}function ve(t){return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}exports.Select=O;exports.SelectGroup=te;exports.SelectItem=ee;exports.SelectSeparator=re;exports.selectChevronStyles=F;exports.selectDropdownInnerStyles=J;exports.selectDropdownStyles=U;exports.selectGroupLabelStyles=X;exports.selectItemStyles=Q;exports.selectSeparatorStyles=Y;exports.selectTriggerStyles=W;
|