@xjur-ui/react 1.0.6 → 2.0.0
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/.turbo/turbo-build.log +97 -45
- package/CHANGELOG.md +44 -0
- package/README.md +146 -0
- package/dist/chunk-CBFC4QME.js +2 -0
- package/dist/chunk-CBFC4QME.js.map +1 -0
- package/dist/chunk-EIG6CBTQ.js +2 -0
- package/dist/chunk-EIG6CBTQ.js.map +1 -0
- package/dist/chunk-FASEHVMD.js +2 -0
- package/dist/chunk-FASEHVMD.js.map +1 -0
- package/dist/chunk-KIFR5VIE.js +2 -0
- package/dist/chunk-KIFR5VIE.js.map +1 -0
- package/dist/chunk-KS6WGBHQ.js +2 -0
- package/dist/chunk-KS6WGBHQ.js.map +1 -0
- package/dist/chunk-NELCN6E2.js +2 -0
- package/dist/chunk-NELCN6E2.js.map +1 -0
- package/dist/chunk-NPTLORW5.js +2 -0
- package/dist/chunk-NPTLORW5.js.map +1 -0
- package/dist/chunk-RWMV7APX.js +2 -0
- package/dist/chunk-RWMV7APX.js.map +1 -0
- package/dist/chunk-SHHXKVVR.js +2 -0
- package/dist/chunk-SHHXKVVR.js.map +1 -0
- package/dist/chunk-TB6KI6CL.js +2 -0
- package/dist/chunk-TB6KI6CL.js.map +1 -0
- package/dist/components/avatar-group.js +2 -179
- package/dist/components/avatar-group.js.map +1 -0
- package/dist/components/avatar.js +2 -59
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +2 -111
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.js +2 -98
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.js +2 -751
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/checkbox.js +2 -153
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +3 -1
- package/dist/components/chip.js +2 -256
- package/dist/components/chip.js.map +1 -0
- package/dist/components/collapsible.js +2 -41
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/date-picker.d.ts +8 -3
- package/dist/components/date-picker.js +2 -232
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/divider.js +2 -29
- package/dist/components/divider.js.map +1 -0
- package/dist/components/dropdown-menu.js +2 -295
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/icon.js +2 -177
- package/dist/components/icon.js.map +1 -0
- package/dist/components/input.d.ts +9 -4
- package/dist/components/input.js +2 -315
- package/dist/components/input.js.map +1 -0
- package/dist/components/list.js +2 -179
- package/dist/components/list.js.map +1 -0
- package/dist/components/logo.js +2 -324
- package/dist/components/logo.js.map +1 -0
- package/dist/components/otp-input.js +2 -47
- package/dist/components/otp-input.js.map +1 -0
- package/dist/components/radio.js +2 -156
- package/dist/components/radio.js.map +1 -0
- package/dist/components/rich-editor.d.ts +2 -1
- package/dist/components/rich-editor.js +2 -723
- package/dist/components/rich-editor.js.map +1 -0
- package/dist/components/search-input.js +2 -274
- package/dist/components/search-input.js.map +1 -0
- package/dist/components/select.d.ts +6 -3
- package/dist/components/select.js +2 -550
- package/dist/components/select.js.map +1 -0
- package/dist/components/sheet.js +2 -251
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.js +2 -16
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/status.js +2 -111
- package/dist/components/status.js.map +1 -0
- package/dist/components/switch.js +2 -36
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +2 -196
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +9 -6
- package/dist/components/tabs.js +2 -54
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tag.d.ts +3 -1
- package/dist/components/tag.js +2 -189
- package/dist/components/tag.js.map +1 -0
- package/dist/components/tooltip.js +2 -58
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typography.js +2 -78
- package/dist/components/typography.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.css +2 -2322
- package/dist/index.css.map +1 -0
- package/dist/logo-PQRZORCS.js +3 -0
- package/dist/logo-PQRZORCS.js.map +1 -0
- package/package.json +41 -8
- package/src/components/calendar.tsx +7 -6
- package/src/components/chip.tsx +11 -3
- package/src/components/date-picker.tsx +125 -22
- package/src/components/icon.tsx +1 -1
- package/src/components/input.tsx +124 -60
- package/src/components/logo.tsx +25 -20
- package/src/components/rich-editor.tsx +4 -3
- package/src/components/select.tsx +104 -26
- package/src/components/tabs.tsx +56 -37
- package/src/components/tag.tsx +11 -3
- package/src/index.css +2 -2
- package/src/resources/logo/index.tsx +33 -0
- package/tsup.config.ts +23 -5
- package/dist/components/test.d.ts +0 -5
- package/dist/components/test.js +0 -8
- package/dist/index.js +0 -0
- package/src/components/test.tsx +0 -3
- package/src/index.ts +0 -1
- package/src/resources/logo/index.ts +0 -3
|
@@ -1,550 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cx as cx5 } from "@xjur-ui/util";
|
|
4
|
-
|
|
5
|
-
// src/components/list.tsx
|
|
6
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
7
|
-
import { cx, cva as cva2 } from "@xjur-ui/util";
|
|
8
|
-
|
|
9
|
-
// src/components/typography.tsx
|
|
10
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
11
|
-
import { cva } from "@xjur-ui/util";
|
|
12
|
-
import { memo } from "react";
|
|
13
|
-
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
var typographyVariants = cva("", {
|
|
15
|
-
variants: {
|
|
16
|
-
variant: {
|
|
17
|
-
body: "",
|
|
18
|
-
label: "",
|
|
19
|
-
title: "",
|
|
20
|
-
headline: ""
|
|
21
|
-
},
|
|
22
|
-
size: {
|
|
23
|
-
"sm-2x": "",
|
|
24
|
-
"sm-1x": "",
|
|
25
|
-
sm: "",
|
|
26
|
-
md: "",
|
|
27
|
-
lg: ""
|
|
28
|
-
},
|
|
29
|
-
weight: {
|
|
30
|
-
thin: "font-thin",
|
|
31
|
-
extraLight: "font-extralight",
|
|
32
|
-
light: "font-light",
|
|
33
|
-
normal: "font-normal",
|
|
34
|
-
medium: "font-medium",
|
|
35
|
-
semibold: "font-semibold",
|
|
36
|
-
bold: "font-bold",
|
|
37
|
-
extraBold: "font-extrabold",
|
|
38
|
-
black: "font-black"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
compoundVariants: [
|
|
42
|
-
{ variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
|
|
43
|
-
{ variant: "body", size: "sm", class: "text-size-body-sm" },
|
|
44
|
-
{ variant: "body", size: "md", class: "text-size-body-md" },
|
|
45
|
-
{ variant: "body", size: "lg", class: "text-size-body-lg" },
|
|
46
|
-
{ variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
|
|
47
|
-
{ variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
|
|
48
|
-
{ variant: "label", size: "sm", class: "text-size-label-sm" },
|
|
49
|
-
{ variant: "label", size: "md", class: "text-size-label-md" },
|
|
50
|
-
{ variant: "label", size: "lg", class: "text-size-label-lg" },
|
|
51
|
-
{ variant: "title", size: "sm", class: "text-size-title-sm" },
|
|
52
|
-
{ variant: "title", size: "md", class: "text-size-title-md" },
|
|
53
|
-
{ variant: "title", size: "lg", class: "text-size-title-lg" },
|
|
54
|
-
{ variant: "headline", size: "sm", class: "text-size-headline-sm" },
|
|
55
|
-
{ variant: "headline", size: "md", class: "text-size-headline-md" },
|
|
56
|
-
{ variant: "headline", size: "lg", class: "text-size-headline-lg" }
|
|
57
|
-
],
|
|
58
|
-
defaultVariants: {
|
|
59
|
-
variant: "body",
|
|
60
|
-
size: "md",
|
|
61
|
-
weight: "normal"
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
var Typography = memo(
|
|
65
|
-
({
|
|
66
|
-
variant,
|
|
67
|
-
size,
|
|
68
|
-
weight,
|
|
69
|
-
asChild,
|
|
70
|
-
className,
|
|
71
|
-
...props
|
|
72
|
-
}) => {
|
|
73
|
-
const Component = asChild ? Slot : "span";
|
|
74
|
-
return /* @__PURE__ */ jsx(
|
|
75
|
-
Component,
|
|
76
|
-
{
|
|
77
|
-
className: typographyVariants({ variant, size, weight, className }),
|
|
78
|
-
...props
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
Typography.displayName = "Typography";
|
|
84
|
-
|
|
85
|
-
// src/components/list.tsx
|
|
86
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
87
|
-
function ListRoot({
|
|
88
|
-
className,
|
|
89
|
-
asChild,
|
|
90
|
-
...props
|
|
91
|
-
}) {
|
|
92
|
-
const Comp = asChild ? Slot2 : "div";
|
|
93
|
-
return /* @__PURE__ */ jsx2(
|
|
94
|
-
Comp,
|
|
95
|
-
{
|
|
96
|
-
...props,
|
|
97
|
-
className: cx(
|
|
98
|
-
className,
|
|
99
|
-
"rounded-small scrollbar-hide bg-layer-2-idle border-border-layer-2 shadow-elevation-3 z-10 max-h-[400px] list-none overflow-y-auto border"
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
function ListHeader({
|
|
105
|
-
className,
|
|
106
|
-
asChild,
|
|
107
|
-
...props
|
|
108
|
-
}) {
|
|
109
|
-
const Comp = asChild ? Slot2 : "div";
|
|
110
|
-
return /* @__PURE__ */ jsx2(Comp, { ...props, className: cx(className, "px-small pt-small-1x") });
|
|
111
|
-
}
|
|
112
|
-
function ListHeaderTitle({
|
|
113
|
-
variant = "label",
|
|
114
|
-
size = "sm",
|
|
115
|
-
weight = "medium",
|
|
116
|
-
className,
|
|
117
|
-
...props
|
|
118
|
-
}) {
|
|
119
|
-
return /* @__PURE__ */ jsx2(
|
|
120
|
-
Typography,
|
|
121
|
-
{
|
|
122
|
-
className: cx(className, "text-neutral-placeholder"),
|
|
123
|
-
size,
|
|
124
|
-
variant,
|
|
125
|
-
weight,
|
|
126
|
-
...props
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
function ListContent({
|
|
131
|
-
className,
|
|
132
|
-
asChild,
|
|
133
|
-
...props
|
|
134
|
-
}) {
|
|
135
|
-
const Comp = asChild ? Slot2 : "ul";
|
|
136
|
-
return /* @__PURE__ */ jsx2(
|
|
137
|
-
Comp,
|
|
138
|
-
{
|
|
139
|
-
...props,
|
|
140
|
-
className: cx("gap-small-1x p-small flex flex-col", className)
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
var variants = cva2(
|
|
145
|
-
[
|
|
146
|
-
"py-medium px-small flex items-center gap-small rounded-small-1x",
|
|
147
|
-
"bg-layer-2-idle text-neutral-dark",
|
|
148
|
-
"hover:bg-layer-2-hover transition-colors duration-100 ease-out",
|
|
149
|
-
"active:bg-layer-2-pressed"
|
|
150
|
-
],
|
|
151
|
-
{
|
|
152
|
-
variants: {
|
|
153
|
-
size: {
|
|
154
|
-
md: "h-large-4x",
|
|
155
|
-
lg: "h-large-7x"
|
|
156
|
-
},
|
|
157
|
-
isActive: {
|
|
158
|
-
true: "bg-primary-alt-active text-primary-label-active hover:bg-primary-alt-hover active:bg-primary-alt-pressed"
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
defaultVariants: {
|
|
162
|
-
size: "md",
|
|
163
|
-
isActive: false
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
function ListItem({
|
|
168
|
-
className,
|
|
169
|
-
size,
|
|
170
|
-
isActive,
|
|
171
|
-
asChild,
|
|
172
|
-
...props
|
|
173
|
-
}) {
|
|
174
|
-
const Comp = asChild ? Slot2 : "li";
|
|
175
|
-
return /* @__PURE__ */ jsx2(Comp, { ...props, className: cx(variants({ size, isActive }), className) });
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// src/components/search-input.tsx
|
|
179
|
-
import { cva as cva4, cx as cx3 } from "@xjur-ui/util";
|
|
180
|
-
import { createContext } from "react";
|
|
181
|
-
|
|
182
|
-
// src/components/button.tsx
|
|
183
|
-
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
184
|
-
import { cva as cva3, cx as cx2 } from "@xjur-ui/util";
|
|
185
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
186
|
-
var buttonVariants = cva3(
|
|
187
|
-
[
|
|
188
|
-
"outline-none inline-flex items-center justify-center rounded-circle gap-small cursor-pointer disabled:opacity-38 disabled:pointer-events-none transition-colors"
|
|
189
|
-
],
|
|
190
|
-
{
|
|
191
|
-
variants: {
|
|
192
|
-
size: {
|
|
193
|
-
md: "py-small_1x-alt px-medium text-size-body-md",
|
|
194
|
-
sm: "py-small-1x px-small text-size-label-sm",
|
|
195
|
-
icon_md: "p-small text-size-body-md h-large-4x w-large-4x",
|
|
196
|
-
icon_sm: "p-small-1x text-size-label-sm h-large-2x w-large-2x"
|
|
197
|
-
},
|
|
198
|
-
variant: {
|
|
199
|
-
primary: "",
|
|
200
|
-
secondary: "",
|
|
201
|
-
tertiary: "",
|
|
202
|
-
destructive: "",
|
|
203
|
-
outlined: "bg-layer-2-idle border border-border-layer-2 hover:bg-layer-2-hover active:bg-layer-2-pressed"
|
|
204
|
-
},
|
|
205
|
-
appearance: {
|
|
206
|
-
solid: "",
|
|
207
|
-
ghost: "bg-transparent"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
compoundVariants: [
|
|
211
|
-
{
|
|
212
|
-
variant: "primary",
|
|
213
|
-
appearance: "solid",
|
|
214
|
-
class: "bg-primary-idle text-neutral-label hover:bg-primary-hover active:bg-primary-pressed"
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
variant: "primary",
|
|
218
|
-
appearance: "ghost",
|
|
219
|
-
class: "text-primary-idle hover:bg-primary-alt-idle active:bg-primary-alt-pressed"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
variant: "secondary",
|
|
223
|
-
appearance: "solid",
|
|
224
|
-
class: "bg-layer-1-hover text-neutral-dark hover:bg-layer-1-pressed active:bg-layer-1-active"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
variant: "secondary",
|
|
228
|
-
appearance: "ghost",
|
|
229
|
-
class: "hover:bg-layer-1-hover active:bg-layer-1-pressed"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
variant: "tertiary",
|
|
233
|
-
appearance: "solid",
|
|
234
|
-
class: "bg-layer-2-hover text-neutral-dark hover:bg-layer-2-pressed active:bg-layer-2-active"
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
variant: "tertiary",
|
|
238
|
-
appearance: "ghost",
|
|
239
|
-
class: "hover:bg-layer-2-hover active:bg-layer-2-pressed"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
variant: "destructive",
|
|
243
|
-
appearance: "solid",
|
|
244
|
-
class: "bg-danger-idle text-neutral-label hover:bg-danger-hover active:bg-danger-pressed"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
variant: "destructive",
|
|
248
|
-
appearance: "ghost",
|
|
249
|
-
class: "text-danger-label-idle hover:bg-danger-alt-idle active:bg-danger-alt-pressed"
|
|
250
|
-
}
|
|
251
|
-
],
|
|
252
|
-
defaultVariants: {
|
|
253
|
-
size: "md",
|
|
254
|
-
variant: "primary",
|
|
255
|
-
appearance: "solid"
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
// src/components/search-input.tsx
|
|
261
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
262
|
-
var SearchInputRootContext = createContext({
|
|
263
|
-
variant: "outlined"
|
|
264
|
-
});
|
|
265
|
-
function SearchInputRoot({
|
|
266
|
-
className,
|
|
267
|
-
variant = "outlined",
|
|
268
|
-
...props
|
|
269
|
-
}) {
|
|
270
|
-
return /* @__PURE__ */ jsx4(SearchInputRootContext.Provider, { value: { variant }, children: /* @__PURE__ */ jsx4("div", { className: cx3(className, "relative flex w-full"), ...props }) });
|
|
271
|
-
}
|
|
272
|
-
function SearchInputContent({
|
|
273
|
-
className,
|
|
274
|
-
...props
|
|
275
|
-
}) {
|
|
276
|
-
const contentVarians = cva4(
|
|
277
|
-
[
|
|
278
|
-
"gap-small py-small_1x-alt px-small flex items-center w-full",
|
|
279
|
-
"h-large-4x rounded-circle",
|
|
280
|
-
"border-border-layer-2 placeholder:placeholder-neutral-placeholder text-size-body-md text-neutral-dark border font-normal",
|
|
281
|
-
"group-hover:border-border-layer-3 transition-colors duration-200",
|
|
282
|
-
"disabled:opacity-60",
|
|
283
|
-
"focus-within:border-primary-idle"
|
|
284
|
-
],
|
|
285
|
-
{
|
|
286
|
-
variants: {
|
|
287
|
-
variant: {
|
|
288
|
-
outlined: "rounded-circle focus-within:border-primary-idle ",
|
|
289
|
-
line: "rounded-none border-t-0 border-b-1 border-x-0",
|
|
290
|
-
action: "rounded-tr-none rounded-br-none border-r-0"
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
);
|
|
295
|
-
return /* @__PURE__ */ jsx4(SearchInputRootContext.Consumer, { children: ({ variant }) => /* @__PURE__ */ jsx4(
|
|
296
|
-
"div",
|
|
297
|
-
{
|
|
298
|
-
className: cx3(className, contentVarians({ variant })),
|
|
299
|
-
"data-variant": variant,
|
|
300
|
-
...props
|
|
301
|
-
}
|
|
302
|
-
) });
|
|
303
|
-
}
|
|
304
|
-
function SearchInputText({
|
|
305
|
-
className,
|
|
306
|
-
...props
|
|
307
|
-
}) {
|
|
308
|
-
return /* @__PURE__ */ jsx4("input", { className: cx3(className, "flex-1 outline-none"), ...props });
|
|
309
|
-
}
|
|
310
|
-
function SearchInputSlot(props) {
|
|
311
|
-
return /* @__PURE__ */ jsx4("div", { ...props, "data-slot": "search-input-slot" });
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// src/components/icon.tsx
|
|
315
|
-
import { cx as cx4 } from "@xjur-ui/util";
|
|
316
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
317
|
-
function Icon({ className, filled = false, name, ...props }) {
|
|
318
|
-
return /* @__PURE__ */ jsx5(
|
|
319
|
-
"span",
|
|
320
|
-
{
|
|
321
|
-
...props,
|
|
322
|
-
className: cx4(
|
|
323
|
-
"material-symbols-outlined",
|
|
324
|
-
"text-size-body-lg",
|
|
325
|
-
className
|
|
326
|
-
),
|
|
327
|
-
style: {
|
|
328
|
-
fontVariationSettings: `'FILL' ${filled ? 1 : 0}, 'wght' 600, 'GRAD' 0, 'opsz' 20`,
|
|
329
|
-
...props.style
|
|
330
|
-
},
|
|
331
|
-
children: name
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// src/components/select.tsx
|
|
337
|
-
import { Fragment, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
338
|
-
function SelectRoot(props) {
|
|
339
|
-
return /* @__PURE__ */ jsx6(RadixPopover.Root, { ...props });
|
|
340
|
-
}
|
|
341
|
-
function SelectTrigger({
|
|
342
|
-
className,
|
|
343
|
-
...props
|
|
344
|
-
}) {
|
|
345
|
-
return /* @__PURE__ */ jsx6(
|
|
346
|
-
RadixPopover.Trigger,
|
|
347
|
-
{
|
|
348
|
-
className: cx5(
|
|
349
|
-
className,
|
|
350
|
-
"group h-large-4x rounded-small-1x gap-small py-small_1x-alt px-small relative flex w-full cursor-pointer items-center",
|
|
351
|
-
"bg-layer-2-idle border-border-layer-2 hover:border-border-layer-3 border",
|
|
352
|
-
"data-[state=open]:border-primary-idle",
|
|
353
|
-
"has-[input:not(:placeholder-shown)]:text-primary-idle",
|
|
354
|
-
"has-[input:not(:placeholder-shown)]:border-primary-idle"
|
|
355
|
-
),
|
|
356
|
-
...props
|
|
357
|
-
}
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
function SelectContent({
|
|
361
|
-
className,
|
|
362
|
-
children,
|
|
363
|
-
sideOffset = 4,
|
|
364
|
-
side = "bottom",
|
|
365
|
-
align = "start",
|
|
366
|
-
...props
|
|
367
|
-
}) {
|
|
368
|
-
return /* @__PURE__ */ jsx6(RadixPopover.Portal, { children: /* @__PURE__ */ jsx6(
|
|
369
|
-
RadixPopover.Content,
|
|
370
|
-
{
|
|
371
|
-
align,
|
|
372
|
-
className: cx5(
|
|
373
|
-
className,
|
|
374
|
-
"group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-content-available-width)] min-w-[var(--radix-popover-trigger-width)]"
|
|
375
|
-
),
|
|
376
|
-
side,
|
|
377
|
-
sideOffset,
|
|
378
|
-
...props,
|
|
379
|
-
children: /* @__PURE__ */ jsx6(ListRoot, { children })
|
|
380
|
-
}
|
|
381
|
-
) });
|
|
382
|
-
}
|
|
383
|
-
function SelectValue({
|
|
384
|
-
className,
|
|
385
|
-
displayValue = "",
|
|
386
|
-
...props
|
|
387
|
-
}) {
|
|
388
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
389
|
-
!!displayValue && /* @__PURE__ */ jsx6(Typography, { className: "text-neutral-dark group-has-[div[data-slot=select-left-slot]]:pl-large-1x", children: displayValue }),
|
|
390
|
-
/* @__PURE__ */ jsx6(
|
|
391
|
-
"input",
|
|
392
|
-
{
|
|
393
|
-
...props,
|
|
394
|
-
"aria-readonly": true,
|
|
395
|
-
className: cx5(className, "pointer-events-none"),
|
|
396
|
-
hidden: true,
|
|
397
|
-
placeholder: props.placeholder ?? " ",
|
|
398
|
-
readOnly: true
|
|
399
|
-
}
|
|
400
|
-
)
|
|
401
|
-
] });
|
|
402
|
-
}
|
|
403
|
-
function SelectMultiValue({
|
|
404
|
-
className,
|
|
405
|
-
values,
|
|
406
|
-
children,
|
|
407
|
-
...props
|
|
408
|
-
}) {
|
|
409
|
-
return /* @__PURE__ */ jsxs(
|
|
410
|
-
"div",
|
|
411
|
-
{
|
|
412
|
-
className: cx5(
|
|
413
|
-
className,
|
|
414
|
-
"gap-small-1x scrollbar-hide group-has-[div[data-slot=select-left-slot]]:pl-large-1x overflow-x-small flex"
|
|
415
|
-
),
|
|
416
|
-
...props,
|
|
417
|
-
children: [
|
|
418
|
-
children,
|
|
419
|
-
/* @__PURE__ */ jsx6(
|
|
420
|
-
"input",
|
|
421
|
-
{
|
|
422
|
-
"aria-readonly": true,
|
|
423
|
-
className: cx5(className, "pointer-events-none"),
|
|
424
|
-
hidden: true,
|
|
425
|
-
placeholder: " ",
|
|
426
|
-
readOnly: true,
|
|
427
|
-
value: values.join(",")
|
|
428
|
-
}
|
|
429
|
-
)
|
|
430
|
-
]
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
function SelectLabel({
|
|
435
|
-
className,
|
|
436
|
-
htmlFor,
|
|
437
|
-
children,
|
|
438
|
-
...props
|
|
439
|
-
}) {
|
|
440
|
-
return /* @__PURE__ */ jsx6(
|
|
441
|
-
Typography,
|
|
442
|
-
{
|
|
443
|
-
asChild: true,
|
|
444
|
-
className: cx5(
|
|
445
|
-
"inline-block max-w-full truncate text-left font-normal",
|
|
446
|
-
"left-small right-small pointer-events-none absolute top-1/2 -translate-y-1/2",
|
|
447
|
-
"ease transition-all duration-250",
|
|
448
|
-
// Content Open
|
|
449
|
-
"group-data-[state=open]:text-primary-idle",
|
|
450
|
-
"group-data-[state=open]:-top-[3px]",
|
|
451
|
-
"group-data-[state=open]:text-size-label-sm-1x",
|
|
452
|
-
"group-data-[state=open]:font-medium",
|
|
453
|
-
// Filled
|
|
454
|
-
"group-has-[input:not(:placeholder-shown)]:text-primary-idle",
|
|
455
|
-
"group-has-[input:not(:placeholder-shown)]:-top-[3px]",
|
|
456
|
-
"group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x",
|
|
457
|
-
"group-has-[input:not(:placeholder-shown)]:font-medium",
|
|
458
|
-
// If has left slot
|
|
459
|
-
"group-has-[div[data-slot=select-left-slot]]:left-large-4x",
|
|
460
|
-
"group-has-[div[data-slot=select-left-slot]]:group-data-[state=open]:left-small",
|
|
461
|
-
"group-has-[div[data-slot=select-left-slot]]:group-has-[input:not(:placeholder-shown)]:left-small",
|
|
462
|
-
// If has right slot
|
|
463
|
-
"group-has-[div[data-slot=select-right-slot]]:right-large-4x",
|
|
464
|
-
"group-has-[div[data-slot=select-right-slot]]:group-data-[state=open]:right-small",
|
|
465
|
-
"group-has-[div[data-slot=select-right-slot]]:group-has-[input:not(:placeholder-shown)]:right-small",
|
|
466
|
-
// Animate
|
|
467
|
-
"group-data-[state=open]:animate-in",
|
|
468
|
-
"group-data-[state=closed]:animate-out",
|
|
469
|
-
"group-has-[input:not(:placeholder-shown)]:animate-out",
|
|
470
|
-
className
|
|
471
|
-
),
|
|
472
|
-
weight: "medium",
|
|
473
|
-
...props,
|
|
474
|
-
children: /* @__PURE__ */ jsx6("label", { htmlFor, children: /* @__PURE__ */ jsx6("span", { className: "bg-layer-2-idle rounded-small-1x max-w-full", children }) })
|
|
475
|
-
}
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
function SelectOptions(props) {
|
|
479
|
-
return /* @__PURE__ */ jsx6(ListContent, { ...props });
|
|
480
|
-
}
|
|
481
|
-
function SelectOption({
|
|
482
|
-
className,
|
|
483
|
-
...props
|
|
484
|
-
}) {
|
|
485
|
-
return /* @__PURE__ */ jsx6(ListItem, { className: cx5(className, "cursor-pointer"), ...props });
|
|
486
|
-
}
|
|
487
|
-
function SelectOptionText(props) {
|
|
488
|
-
return /* @__PURE__ */ jsx6(Typography, { ...props });
|
|
489
|
-
}
|
|
490
|
-
function SelectHeader(props) {
|
|
491
|
-
return /* @__PURE__ */ jsx6(ListHeader, { ...props });
|
|
492
|
-
}
|
|
493
|
-
function SelectHeaderTitle(props) {
|
|
494
|
-
return /* @__PURE__ */ jsx6(ListHeaderTitle, { ...props });
|
|
495
|
-
}
|
|
496
|
-
function SelectDropdown(props) {
|
|
497
|
-
return /* @__PURE__ */ jsx6("div", { ...props });
|
|
498
|
-
}
|
|
499
|
-
function SelectLeftSlot({ className, ...props }) {
|
|
500
|
-
return /* @__PURE__ */ jsx6(
|
|
501
|
-
"div",
|
|
502
|
-
{
|
|
503
|
-
...props,
|
|
504
|
-
className: cx5(
|
|
505
|
-
className,
|
|
506
|
-
"left-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center"
|
|
507
|
-
),
|
|
508
|
-
"data-slot": "select-left-slot"
|
|
509
|
-
}
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
function SelectRightSlot({
|
|
513
|
-
className,
|
|
514
|
-
...props
|
|
515
|
-
}) {
|
|
516
|
-
return /* @__PURE__ */ jsx6(
|
|
517
|
-
"div",
|
|
518
|
-
{
|
|
519
|
-
...props,
|
|
520
|
-
className: cx5(
|
|
521
|
-
className,
|
|
522
|
-
"right-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center"
|
|
523
|
-
),
|
|
524
|
-
"data-slot": "select-right-slot"
|
|
525
|
-
}
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
function SelectSearch(props) {
|
|
529
|
-
return /* @__PURE__ */ jsx6(SearchInputRoot, { variant: "line", children: /* @__PURE__ */ jsxs(SearchInputContent, { children: [
|
|
530
|
-
/* @__PURE__ */ jsx6(SearchInputSlot, { children: /* @__PURE__ */ jsx6(Icon, { className: "text-icon-neutral-3", name: "search" }) }),
|
|
531
|
-
/* @__PURE__ */ jsx6(SearchInputText, { ...props })
|
|
532
|
-
] }) });
|
|
533
|
-
}
|
|
534
|
-
export {
|
|
535
|
-
SelectContent,
|
|
536
|
-
SelectDropdown,
|
|
537
|
-
SelectHeader,
|
|
538
|
-
SelectHeaderTitle,
|
|
539
|
-
SelectLabel,
|
|
540
|
-
SelectLeftSlot,
|
|
541
|
-
SelectMultiValue,
|
|
542
|
-
SelectOption,
|
|
543
|
-
SelectOptionText,
|
|
544
|
-
SelectOptions,
|
|
545
|
-
SelectRightSlot,
|
|
546
|
-
SelectRoot,
|
|
547
|
-
SelectSearch,
|
|
548
|
-
SelectTrigger,
|
|
549
|
-
SelectValue
|
|
550
|
-
};
|
|
1
|
+
import {a as a$2,b as b$1,e as e$1,d as d$2}from'../chunk-NPTLORW5.js';import {a,d as d$1,e,b,c}from'../chunk-KIFR5VIE.js';import'../chunk-FASEHVMD.js';import {a as a$1}from'../chunk-EIG6CBTQ.js';import {b as b$2}from'../chunk-SHHXKVVR.js';import {createContext,useContext}from'react';import*as n from'@radix-ui/react-popover';import {twMerge,tv}from'@xjur-ui/util';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var P=createContext({disabled:false,hasError:false});function d(){let e=useContext(P);if(!e)throw new Error("useSelect must be used within a SelectRoot");return e}function k({disabled:e=false,hasError:o=false,...r}){return jsx(P.Provider,{value:{disabled:e,hasError:o},children:jsx(n.Root,{...r})})}function j({className:e,...o}){let{disabled:r,hasError:l}=d();return jsx(n.Trigger,{className:twMerge(e,"group h-large-4x rounded-small-1x gap-small py-small_1x-alt px-small relative flex w-full cursor-pointer items-center","bg-layer-2-idle border-border-layer-2 hover:border-border-layer-3 border","data-[state=open]:border-primary-idle data-[state=open]:data-[has-error=true]:border-danger-label-active","has-[input:not(:placeholder-shown)]:text-primary-idle has-[input:not(:placeholder-shown)]:data-[has-error=true]:text-danger-label-active","has-[input:not(:placeholder-shown)]:border-primary-idle has-[input:not(:placeholder-shown)]:data-[has-error=true]:border-danger-label-active","disabled:bg-layer-2-idle disabled:cursor-text disabled:border-none disabled:select-text","data-[has-error=true]:border-danger-idle data-[has-error=true]:hover:border-danger-idle"),...o,"data-has-error":l,disabled:r})}function F({className:e,children:o,sideOffset:r=4,side:l="bottom",align:s="start",...i}){return jsx(n.Portal,{children:jsx(n.Content,{align:s,className:twMerge(e,"group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-content-available-width)] min-w-[var(--radix-popover-trigger-width)]"),side:l,sideOffset:r,...i,children:jsx(a,{children:o})})})}function M({className:e,displayValue:o="",...r}){return jsxs(Fragment,{children:[!!o&&jsx(a$1,{className:twMerge(e,"text-neutral-dark","group-has-[div[data-slot=select-left-slot]]:pl-large-1x"),children:o}),jsx("input",{...r,"aria-readonly":true,className:twMerge(e,"pointer-events-none"),hidden:true,placeholder:r.placeholder??" ",readOnly:true})]})}function V({className:e,values:o,children:r,...l}){return jsxs("div",{className:twMerge(e,"gap-small-1x scrollbar-hide overflow-x-small flex","group-has-[div[data-slot=select-left-slot]]:pl-large-1x","group-disabled:!pl-0"),...l,children:[r,jsx("input",{"aria-readonly":true,className:twMerge(e,"pointer-events-none"),hidden:true,placeholder:" ",readOnly:true,value:o.join(",")})]})}function _({className:e,htmlFor:o,children:r,...l}){let{hasError:s}=d();return jsx(a$1,{asChild:true,className:twMerge("inline-block max-w-full truncate text-left font-normal","left-small right-small pointer-events-none absolute top-1/2 -translate-y-1/2","ease transition-all duration-250","group-data-[state=open]:!text-primary-idle group-data-[state=open]:data-[has-error=true]:!text-danger-label-active","group-data-[state=open]:-top-[3px]","group-data-[state=open]:text-size-label-sm-1x","group-data-[state=open]:font-medium","group-has-[input:not(:placeholder-shown)]:!text-primary-idle group-has-[input:not(:placeholder-shown)]:data-[has-error=true]:!text-danger-label-active","group-has-[input:not(:placeholder-shown)]:-top-[3px]","group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x","group-has-[input:not(:placeholder-shown)]:font-medium","group-has-[div[data-slot=select-left-slot]]:left-large-4x","group-has-[div[data-slot=select-left-slot]]:group-data-[state=open]:left-small","group-has-[div[data-slot=select-left-slot]]:group-has-[input:not(:placeholder-shown)]:left-small","group-has-[div[data-slot=select-right-slot]]:right-large-4x","group-has-[div[data-slot=select-right-slot]]:group-data-[state=open]:right-small","group-has-[div[data-slot=select-right-slot]]:group-has-[input:not(:placeholder-shown)]:right-small","group-data-[state=open]:animate-in","group-data-[state=closed]:animate-out","group-has-[input:not(:placeholder-shown)]:animate-out","group-disabled:hidden",e),"data-has-error":s,...l,children:jsx("label",{htmlFor:o,children:jsx("span",{className:"bg-layer-2-idle rounded-small-1x max-w-full",children:r})})})}function q(e){return jsx(d$1,{...e})}function A({className:e$1,...o}){return jsx(e,{className:twMerge(e$1,"cursor-pointer"),...o})}function B(e){return jsx(a$1,{...e})}function D(e){return jsx(b,{...e})}function G(e){return jsx(c,{...e})}function J({className:e,...o}){return jsx("div",{...o,className:twMerge(e,"left-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center"),"data-slot":"select-left-slot"})}function K({className:e,...o}){return jsx("div",{...o,className:twMerge(e,"right-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center","group-disabled:hidden"),"data-slot":"select-right-slot"})}function Q(e){return jsx(a$2,{variant:"line",children:jsxs(b$1,{children:[jsx(e$1,{children:jsx(b$2,{className:"text-icon-neutral-3",name:"search"})}),jsx(d$2,{...e})]})})}function U({className:e,variant:o="body",size:r="sm",weight:l="normal",...s}){let{hasError:i}=d(),C=tv({base:"text-size-body-sm mt-small-1x font-normal",variants:{state:{error:"text-danger-label-active",idle:"text-neutral-dark"}}});return jsx(a$1,{className:C({state:i?"error":"idle",className:e}),size:r,variant:o,weight:l,...s})}export{U as SelectCaption,F as SelectContent,D as SelectHeader,G as SelectHeaderTitle,_ as SelectLabel,J as SelectLeftSlot,V as SelectMultiValue,A as SelectOption,B as SelectOptionText,q as SelectOptions,K as SelectRightSlot,k as SelectRoot,Q as SelectSearch,j as SelectTrigger,M as SelectValue};//# sourceMappingURL=select.js.map
|
|
2
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectContext","createContext","useSelect","context","useContext","SelectRoot","disabled","hasError","props","jsx","SelectTrigger","className","twMerge","SelectContent","children","sideOffset","side","align","ListRoot","SelectValue","displayValue","jsxs","Fragment","Typography","SelectMultiValue","values","SelectLabel","htmlFor","SelectOptions","ListContent","SelectOption","ListItem","SelectOptionText","SelectHeader","ListHeader","SelectHeaderTitle","ListHeaderTitle","SelectLeftSlot","SelectRightSlot","SelectSearch","SearchInputRoot","SearchInputContent","SearchInputSlot","Icon","SearchInputText","SelectCaption","variant","size","weight","caption","tv"],"mappings":"gaAmBA,IAAMA,CAAAA,CAAgBC,aAAAA,CAAc,CAClC,QAAA,CAAU,KAAA,CACV,QAAA,CAAU,KACZ,CAAC,CAAA,CAED,SAASC,CAAAA,EAAY,CACnB,IAAMC,CAAAA,CAAUC,UAAAA,CAAWJ,CAAa,EAExC,GAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,4CAA4C,CAAA,CAG9D,OAAOA,CACT,CAEO,SAASE,CAAAA,CAAW,CACzB,QAAA,CAAAC,CAAAA,CAAW,KAAA,CACX,SAAAC,CAAAA,CAAW,KAAA,CACX,GAAGC,CACL,CAAA,CAGG,CACD,OACEC,GAAAA,CAACT,EAAc,QAAA,CAAd,CAAuB,KAAA,CAAO,CAAE,QAAA,CAAAM,CAAAA,CAAU,QAAA,CAAAC,CAAS,EAClD,QAAA,CAAAE,GAAAA,CAAc,CAAA,CAAA,IAAA,CAAb,CAAmB,GAAGD,CAAAA,CAAO,CAAA,CAChC,CAEJ,CAEO,SAASE,CAAAA,CAAc,CAC5B,SAAA,CAAAC,CAAAA,CACA,GAAGH,CACL,CAAA,CAAgD,CAC9C,GAAM,CAAE,QAAA,CAAAF,CAAAA,CAAU,QAAA,CAAAC,CAAS,CAAA,CAAIL,CAAAA,GAE/B,OACEO,GAAAA,CAAc,CAAA,CAAA,OAAA,CAAb,CACC,SAAA,CAAWG,OAAAA,CACTD,CAAAA,CACA,uHAAA,CACA,2EACA,0GAAA,CACA,0IAAA,CACA,8IAAA,CACA,yFAAA,CACA,yFACF,CAAA,CACC,GAAGH,CAAAA,CACJ,iBAAgBD,CAAAA,CAChB,QAAA,CAAUD,CAAAA,CACZ,CAEJ,CAEO,SAASO,CAAAA,CAAc,CAC5B,UAAAF,CAAAA,CACA,QAAA,CAAAG,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAA,CACb,IAAA,CAAAC,CAAAA,CAAO,SAC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AA,CAAK,SAAA,CAAU,qBAAA,CAAsB,IAAA,CAAK,QAAA,CAAS,CAAA,CACtD,CAAA,CACAlC,GAAAA,CAACmC,IAAA,CAAiB,GAAGpC,CAAAA,CAAO,CAAA,CAAA,CAC9B,CAAA,CACF,CAEJ,CAEO,SAASqC,EAAc,CAC5B,SAAA,CAAAlC,CAAAA,CACA,OAAA,CAAAmC,CAAAA,CAAU,MAAA,CACV,IAAA,CAAAC,CAAAA,CAAO,KACP,MAAA,CAAAC,CAAAA,CAAS,QAAA,CACT,GAAGxC,CACL,CAAA,CAAsC,CACpC,GAAM,CAAE,QAAA,CAAAD,CAAS,CAAA,CAAIL,CAAAA,EAAU,CAEzB+C,CAAAA,CAAUC,EAAAA,CAAG,CACjB,KAAM,2CAAA,CACN,QAAA,CAAU,CACR,KAAA,CAAO,CACL,KAAA,CAAO,0BAAA,CACP,IAAA,CAAM,mBACR,CACF,CACF,CAAC,CAAA,CAED,OACEzC,GAAAA,CAACc,GAAAA,CAAA,CACC,UAAW0B,CAAAA,CAAQ,CACjB,KAAA,CAAO1C,CAAAA,CAAW,OAAA,CAAU,MAAA,CAC5B,SAAA,CAAAI,CACF,CAAC,CAAA,CACD,IAAA,CAAMoC,CAAAA,CACN,OAAA,CAASD,CAAAA,CACT,MAAA,CAAQE,CAAAA,CACP,GAAGxC,EACN,CAEJ","file":"select.js","sourcesContent":["import { createContext, useContext, type ComponentProps } from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport { tv, twMerge } from '@xjur-ui/util'\nimport {\n ListContent,\n ListItem,\n ListRoot,\n ListHeader,\n ListHeaderTitle\n} from './list'\nimport {\n SearchInputContent,\n SearchInputText,\n SearchInputRoot,\n SearchInputSlot\n} from './search-input'\nimport { Icon } from './icon'\nimport { Typography, type TypographyProps } from './typography'\n\nconst SelectContext = createContext({\n disabled: false,\n hasError: false\n})\n\nfunction useSelect() {\n const context = useContext(SelectContext)\n\n if (!context) {\n throw new Error('useSelect must be used within a SelectRoot')\n }\n\n return context\n}\n\nexport function SelectRoot({\n disabled = false,\n hasError = false,\n ...props\n}: ComponentProps<typeof RadixPopover.Root> & {\n disabled?: boolean\n hasError?: boolean\n}) {\n return (\n <SelectContext.Provider value={{ disabled, hasError }}>\n <RadixPopover.Root {...props} />\n </SelectContext.Provider>\n )\n}\n\nexport function SelectTrigger({\n className,\n ...props\n}: ComponentProps<typeof RadixPopover.Trigger>) {\n const { disabled, hasError } = useSelect()\n\n return (\n <RadixPopover.Trigger\n className={twMerge(\n className,\n 'group h-large-4x rounded-small-1x gap-small py-small_1x-alt px-small relative flex w-full cursor-pointer items-center',\n 'bg-layer-2-idle border-border-layer-2 hover:border-border-layer-3 border',\n 'data-[state=open]:border-primary-idle data-[state=open]:data-[has-error=true]:border-danger-label-active',\n 'has-[input:not(:placeholder-shown)]:text-primary-idle has-[input:not(:placeholder-shown)]:data-[has-error=true]:text-danger-label-active',\n 'has-[input:not(:placeholder-shown)]:border-primary-idle has-[input:not(:placeholder-shown)]:data-[has-error=true]:border-danger-label-active',\n 'disabled:bg-layer-2-idle disabled:cursor-text disabled:border-none disabled:select-text',\n 'data-[has-error=true]:border-danger-idle data-[has-error=true]:hover:border-danger-idle'\n )}\n {...props}\n data-has-error={hasError}\n disabled={disabled}\n />\n )\n}\n\nexport function SelectContent({\n className,\n children,\n sideOffset = 4,\n side = 'bottom',\n align = 'start',\n ...props\n}: ComponentProps<typeof RadixPopover.Content>) {\n return (\n <RadixPopover.Portal>\n <RadixPopover.Content\n align={align}\n className={twMerge(\n className,\n 'group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-content-available-width)] min-w-[var(--radix-popover-trigger-width)]'\n )}\n side={side}\n sideOffset={sideOffset}\n {...props}\n >\n <ListRoot>{children}</ListRoot>\n </RadixPopover.Content>\n </RadixPopover.Portal>\n )\n}\n\nexport function SelectValue({\n className,\n displayValue = '',\n ...props\n}: ComponentProps<'input'> & { displayValue?: string }) {\n return (\n <>\n {!!displayValue && (\n <Typography\n className={twMerge(\n className,\n 'text-neutral-dark',\n // if has left slot, add the left slot padding\n 'group-has-[div[data-slot=select-left-slot]]:pl-large-1x'\n )}\n >\n {displayValue}\n </Typography>\n )}\n\n <input\n {...props}\n aria-readonly={true}\n className={twMerge(className, 'pointer-events-none')}\n hidden={true}\n placeholder={props.placeholder ?? ' '}\n readOnly={true}\n />\n </>\n )\n}\n\nexport function SelectMultiValue({\n className,\n values,\n children,\n ...props\n}: ComponentProps<'div'> & { values: string[] }) {\n return (\n <div\n className={twMerge(\n className,\n 'gap-small-1x scrollbar-hide overflow-x-small flex',\n // if has left slot, add the left slot padding\n 'group-has-[div[data-slot=select-left-slot]]:pl-large-1x',\n // if the trigger is disabled, remove the left slot padding\n 'group-disabled:!pl-0'\n )}\n {...props}\n >\n {children}\n\n <input\n aria-readonly={true}\n className={twMerge(className, 'pointer-events-none')}\n hidden={true}\n placeholder={' '}\n readOnly={true}\n value={values.join(',')}\n />\n </div>\n )\n}\n\nexport function SelectLabel({\n className,\n htmlFor,\n children,\n ...props\n}: TypographyProps & { htmlFor?: string }) {\n const { hasError } = useSelect()\n\n return (\n <Typography\n asChild={true}\n className={twMerge(\n 'inline-block max-w-full truncate text-left font-normal',\n 'left-small right-small pointer-events-none absolute top-1/2 -translate-y-1/2',\n 'ease transition-all duration-250',\n // Content Open\n 'group-data-[state=open]:!text-primary-idle group-data-[state=open]:data-[has-error=true]:!text-danger-label-active',\n 'group-data-[state=open]:-top-[3px]',\n 'group-data-[state=open]:text-size-label-sm-1x',\n 'group-data-[state=open]:font-medium',\n // Filled\n 'group-has-[input:not(:placeholder-shown)]:!text-primary-idle group-has-[input:not(:placeholder-shown)]:data-[has-error=true]:!text-danger-label-active',\n 'group-has-[input:not(:placeholder-shown)]:-top-[3px]',\n 'group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x',\n 'group-has-[input:not(:placeholder-shown)]:font-medium',\n // If has left slot\n 'group-has-[div[data-slot=select-left-slot]]:left-large-4x',\n 'group-has-[div[data-slot=select-left-slot]]:group-data-[state=open]:left-small',\n 'group-has-[div[data-slot=select-left-slot]]:group-has-[input:not(:placeholder-shown)]:left-small',\n // If has right slot\n 'group-has-[div[data-slot=select-right-slot]]:right-large-4x',\n 'group-has-[div[data-slot=select-right-slot]]:group-data-[state=open]:right-small',\n 'group-has-[div[data-slot=select-right-slot]]:group-has-[input:not(:placeholder-shown)]:right-small',\n // Animate\n 'group-data-[state=open]:animate-in',\n 'group-data-[state=closed]:animate-out',\n 'group-has-[input:not(:placeholder-shown)]:animate-out',\n 'group-disabled:hidden',\n className\n )}\n data-has-error={hasError}\n {...props}\n >\n <label htmlFor={htmlFor}>\n <span className=\"bg-layer-2-idle rounded-small-1x max-w-full\">\n {children}\n </span>\n </label>\n </Typography>\n )\n}\n\nexport function SelectOptions(props: ComponentProps<typeof ListContent>) {\n return <ListContent {...props} />\n}\n\nexport function SelectOption({\n className,\n ...props\n}: ComponentProps<typeof ListItem>) {\n return (\n <ListItem className={twMerge(className, 'cursor-pointer')} {...props} />\n )\n}\n\nexport function SelectOptionText(props: ComponentProps<typeof Typography>) {\n return <Typography {...props} />\n}\n\nexport function SelectHeader(props: ComponentProps<typeof ListHeader>) {\n return <ListHeader {...props} />\n}\n\nexport function SelectHeaderTitle(\n props: ComponentProps<typeof ListHeaderTitle>\n) {\n return <ListHeaderTitle {...props} />\n}\n\nexport function SelectLeftSlot({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n {...props}\n className={twMerge(\n className,\n 'left-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center'\n )}\n data-slot=\"select-left-slot\"\n />\n )\n}\n\nexport function SelectRightSlot({\n className,\n ...props\n}: ComponentProps<'div'>) {\n return (\n <div\n {...props}\n className={twMerge(\n className,\n 'right-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center',\n 'group-disabled:hidden'\n )}\n data-slot=\"select-right-slot\"\n />\n )\n}\n\nexport function SelectSearch(props: ComponentProps<typeof SearchInputText>) {\n return (\n <SearchInputRoot variant=\"line\">\n <SearchInputContent>\n <SearchInputSlot>\n <Icon className=\"text-icon-neutral-3\" name=\"search\" />\n </SearchInputSlot>\n <SearchInputText {...props} />\n </SearchInputContent>\n </SearchInputRoot>\n )\n}\n\nexport function SelectCaption({\n className,\n variant = 'body',\n size = 'sm',\n weight = 'normal',\n ...props\n}: ComponentProps<typeof Typography>) {\n const { hasError } = useSelect()\n\n const caption = tv({\n base: 'text-size-body-sm mt-small-1x font-normal',\n variants: {\n state: {\n error: 'text-danger-label-active',\n idle: 'text-neutral-dark'\n }\n }\n })\n\n return (\n <Typography\n className={caption({\n state: hasError ? 'error' : 'idle',\n className\n })}\n size={size}\n variant={variant}\n weight={weight}\n {...props}\n />\n )\n}\n"]}
|