@agentero/design-system 0.31.8 → 0.32.1
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/mcp/manifests/components.html +492 -111
- package/mcp/manifests/components.json +176 -12
- package/package.json +5 -1
- package/src/combobox/combobox.d.ts +91 -28
- package/src/combobox/combobox.js +95 -64
- package/src/combobox/icons.d.ts +16 -0
- package/src/combobox/icons.js +19 -1
- package/src/combobox/index.d.ts +6 -2
- package/src/input-group/index.d.ts +16 -0
- package/src/input-group/index.js +9 -0
- package/src/input-group/input-group.d.ts +130 -0
- package/src/input-group/input-group.js +79 -0
package/src/combobox/combobox.js
CHANGED
|
@@ -4,20 +4,22 @@ import { useMergeProps as t } from "../../lib/merge-props.js";
|
|
|
4
4
|
import { useFieldContext as n } from "../field/context.js";
|
|
5
5
|
import { InputContext as r } from "../input/context.js";
|
|
6
6
|
import { inputRecipe as i } from "../input/input.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { InputGroup as a } from "../input-group/index.js";
|
|
8
|
+
import { IconCancel as o, IconCheck as s, IconKeyboardArrowDown as c, IconSearch as l } from "./icons.js";
|
|
9
|
+
import { tv as u } from "tailwind-variants";
|
|
10
|
+
import { createContext as d, use as f, useRef as p, useState as m } from "react";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { Combobox as _ } from "@base-ui/react/combobox";
|
|
12
13
|
//#region src/combobox/combobox.tsx
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"hover:[&>svg>path]:fill-icon-default-base-primary",
|
|
14
|
+
var v = u({ slots: {
|
|
15
|
+
action: [
|
|
16
|
+
"flex size-6 shrink-0 cursor-pointer items-center justify-center self-center rounded-sm",
|
|
17
|
+
"[&>svg>path]:fill-icon-input-default hover:[&>svg>path]:fill-icon-default-base-primary",
|
|
18
|
+
"focus-visible:outline-2 focus-visible:outline-border-input-focus",
|
|
19
19
|
"disabled:cursor-default disabled:[&>svg>path]:fill-icon-input-disable"
|
|
20
20
|
],
|
|
21
|
+
trigger: "transition-[rotate] duration-100 data-popup-open:rotate-180 motion-reduce:transition-none",
|
|
22
|
+
triggerReplaced: "[[data-slot=combobox-field]:not([data-placeholder])_&]:hidden",
|
|
21
23
|
content: [
|
|
22
24
|
"w-(--anchor-width) max-h-(--available-height) overflow-hidden rounded-md",
|
|
23
25
|
"border border-border-default-base-primary bg-bg-default-base-primary shadow-lg",
|
|
@@ -27,7 +29,7 @@ var p = s({ slots: {
|
|
|
27
29
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
28
30
|
"motion-reduce:transition-none"
|
|
29
31
|
],
|
|
30
|
-
list: ["max-h-[min(10.25rem,var(--available-height))] overflow-y-auto scroll-py-2 py-2 outline-none", "
|
|
32
|
+
list: ["max-h-[min(10.25rem,var(--available-height))] overflow-y-auto scroll-py-2 py-2 outline-none", "empty:py-0"],
|
|
31
33
|
item: [
|
|
32
34
|
"group/item mx-2 my-px flex cursor-pointer items-center rounded-[calc(var(--radius-md)-2px)]",
|
|
33
35
|
"px-3 py-2 text-sm text-text-default-base-primary select-none",
|
|
@@ -45,49 +47,78 @@ var p = s({ slots: {
|
|
|
45
47
|
"group-data-disabled/item:data-selected:bg-bg-checkbox-disabled"
|
|
46
48
|
],
|
|
47
49
|
message: ["mx-2 my-px px-3 py-2 text-sm text-text-default-base-tertiary", "empty:m-0 empty:p-0"]
|
|
48
|
-
} }),
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
} }), y = v(), b = d(!1), x = ({ minInputLength: e = 0, open: t, defaultOpen: n = !1, onOpenChange: r, onOpenChangeComplete: i, onInputValueChange: a, ...o }) => {
|
|
51
|
+
let s = !!o.multiple, [c, l] = m(n), u = p(String(o.inputValue ?? o.defaultInputValue ?? ""));
|
|
52
|
+
o.inputValue !== void 0 && (u.current = String(o.inputValue));
|
|
53
|
+
let d = (t) => t.trim().length < e, f = p(!1), g = p(!1), v = (e, t) => {
|
|
54
|
+
if (e && d(u.current)) {
|
|
55
|
+
t.cancel();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
f.current = !1, r?.(e, t), s && !e && t.reason === "item-press" && t.cancel(), t.isCanceled || l(e);
|
|
59
|
+
}, y = (e) => {
|
|
60
|
+
i?.(e), !e && f.current && (f.current = !1, g.current = !0, queueMicrotask(() => g.current = !1));
|
|
61
|
+
}, x = (e, n) => {
|
|
62
|
+
if (g.current) {
|
|
63
|
+
g.current = !1, n.cancel();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
u.current = e, a?.(e, n), d(e) && t === void 0 && c && (f.current = !0, l(!1));
|
|
67
|
+
}, S = t ?? (e > 0 ? c : void 0);
|
|
68
|
+
return /* @__PURE__ */ h(b, {
|
|
69
|
+
value: s,
|
|
70
|
+
children: /* @__PURE__ */ h(_.Root, {
|
|
71
|
+
open: S,
|
|
72
|
+
defaultOpen: n,
|
|
73
|
+
onOpenChange: v,
|
|
74
|
+
onOpenChangeComplete: y,
|
|
75
|
+
onInputValueChange: x,
|
|
76
|
+
...o
|
|
57
77
|
})
|
|
58
78
|
});
|
|
59
79
|
};
|
|
60
|
-
|
|
61
|
-
var
|
|
80
|
+
x.displayName = "Combobox.Root";
|
|
81
|
+
var S = /* @__PURE__ */ new Set([
|
|
62
82
|
"value",
|
|
63
83
|
"defaultValue",
|
|
64
84
|
"onChange"
|
|
65
|
-
]),
|
|
66
|
-
let i =
|
|
85
|
+
]), C = (e) => {
|
|
86
|
+
let i = f(r), a = n(), o = i ? Object.fromEntries(Object.entries(i).filter(([e]) => !S.has(e))) : null, s = !("aria-label" in e || "aria-labelledby" in e) && a ? { "aria-labelledby": a.labelId } : null;
|
|
67
87
|
return t({
|
|
68
88
|
...o,
|
|
69
89
|
...s
|
|
70
90
|
}, e);
|
|
71
|
-
},
|
|
72
|
-
let { className:
|
|
73
|
-
return /* @__PURE__ */
|
|
91
|
+
}, w = ({ variant: t = "search", showClear: n = t === "search", clearLabel: r = "Clear", triggerLabel: s = "Show options", ...u }) => {
|
|
92
|
+
let { className: d, size: p = "md", ...m } = C(u), v = f(b);
|
|
93
|
+
return /* @__PURE__ */ g(_.InputGroup, {
|
|
94
|
+
render: /* @__PURE__ */ h(a.Root, {}),
|
|
74
95
|
"data-slot": "combobox-field",
|
|
75
|
-
className:
|
|
76
|
-
children: [
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
className: t === "plain" ? "px-4" : void 0,
|
|
97
|
+
children: [
|
|
98
|
+
t === "search" && /* @__PURE__ */ h(a.Addon, { children: /* @__PURE__ */ h(l, {}) }),
|
|
99
|
+
/* @__PURE__ */ h(_.Input, {
|
|
100
|
+
"data-slot": "combobox-input",
|
|
101
|
+
"data-size": p,
|
|
102
|
+
className: e(i({ size: p }), d),
|
|
103
|
+
...m
|
|
104
|
+
}),
|
|
105
|
+
n && !v && /* @__PURE__ */ h(_.Clear, {
|
|
106
|
+
"data-slot": "combobox-clear",
|
|
107
|
+
"aria-label": r,
|
|
108
|
+
className: y.action(),
|
|
109
|
+
children: /* @__PURE__ */ h(o, {})
|
|
110
|
+
}),
|
|
111
|
+
t === "select" && !v && /* @__PURE__ */ h(_.Trigger, {
|
|
112
|
+
"data-slot": "combobox-trigger",
|
|
113
|
+
"aria-label": s,
|
|
114
|
+
className: e(y.action(), y.trigger(), n && y.triggerReplaced()),
|
|
115
|
+
children: /* @__PURE__ */ h(c, {})
|
|
116
|
+
})
|
|
117
|
+
]
|
|
87
118
|
});
|
|
88
119
|
};
|
|
89
|
-
|
|
90
|
-
var
|
|
120
|
+
w.displayName = "Combobox.Input";
|
|
121
|
+
var T = ({ className: t, side: n = "bottom", align: r = "start", sideOffset: i = 12, alignOffset: a, anchor: o, collisionPadding: s = 8, ...c }) => /* @__PURE__ */ h(_.Portal, { children: /* @__PURE__ */ h(_.Positioner, {
|
|
91
122
|
side: n,
|
|
92
123
|
align: r,
|
|
93
124
|
sideOffset: i,
|
|
@@ -95,49 +126,49 @@ var b = ({ className: t, side: n = "bottom", align: r = "start", sideOffset: i =
|
|
|
95
126
|
anchor: o,
|
|
96
127
|
collisionPadding: s,
|
|
97
128
|
className: "isolate z-(--z-index-top-layer) pointer-events-auto",
|
|
98
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ h(_.Popup, {
|
|
99
130
|
"data-slot": "combobox-content",
|
|
100
|
-
className: e(
|
|
131
|
+
className: e(y.content(), t),
|
|
101
132
|
...c
|
|
102
133
|
})
|
|
103
134
|
}) });
|
|
104
|
-
|
|
105
|
-
var
|
|
135
|
+
T.displayName = "Combobox.Content";
|
|
136
|
+
var E = ({ className: t, ...n }) => {
|
|
106
137
|
let r = "aria-label" in n || "aria-labelledby" in n;
|
|
107
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ h(_.List, {
|
|
108
139
|
"data-slot": "combobox-list",
|
|
109
140
|
"aria-label": r ? void 0 : "Suggestions",
|
|
110
|
-
className: e(
|
|
141
|
+
className: e(y.list(), t),
|
|
111
142
|
...n
|
|
112
143
|
});
|
|
113
144
|
};
|
|
114
|
-
|
|
115
|
-
var
|
|
116
|
-
let i =
|
|
117
|
-
return /* @__PURE__ */
|
|
145
|
+
E.displayName = "Combobox.List";
|
|
146
|
+
var D = ({ className: t, children: n, ...r }) => {
|
|
147
|
+
let i = f(b);
|
|
148
|
+
return /* @__PURE__ */ g(_.Item, {
|
|
118
149
|
"data-slot": "combobox-item",
|
|
119
|
-
className: e(
|
|
150
|
+
className: e(y.item(), t),
|
|
120
151
|
...r,
|
|
121
|
-
children: [i && /* @__PURE__ */
|
|
152
|
+
children: [i && /* @__PURE__ */ h(_.ItemIndicator, {
|
|
122
153
|
keepMounted: !0,
|
|
123
154
|
"data-slot": "combobox-item-indicator",
|
|
124
|
-
className:
|
|
125
|
-
children: /* @__PURE__ */
|
|
155
|
+
className: y.indicator(),
|
|
156
|
+
children: /* @__PURE__ */ h(s, { className: "size-3.5" })
|
|
126
157
|
}), n]
|
|
127
158
|
});
|
|
128
159
|
};
|
|
129
|
-
|
|
130
|
-
var
|
|
160
|
+
D.displayName = "Combobox.Item";
|
|
161
|
+
var O = ({ className: t, ...n }) => /* @__PURE__ */ h(_.Empty, {
|
|
131
162
|
"data-slot": "combobox-empty",
|
|
132
|
-
className: e(
|
|
163
|
+
className: e(y.message(), t),
|
|
133
164
|
...n
|
|
134
165
|
});
|
|
135
|
-
|
|
136
|
-
var
|
|
166
|
+
O.displayName = "Combobox.Empty";
|
|
167
|
+
var k = ({ className: t, ...n }) => /* @__PURE__ */ h(_.Status, {
|
|
137
168
|
"data-slot": "combobox-status",
|
|
138
|
-
className: e(
|
|
169
|
+
className: e(y.message(), t),
|
|
139
170
|
...n
|
|
140
171
|
});
|
|
141
|
-
|
|
172
|
+
k.displayName = "Combobox.Status";
|
|
142
173
|
//#endregion
|
|
143
|
-
export {
|
|
174
|
+
export { T as Content, O as Empty, w as Input, D as Item, E as List, x as Root, k as Status, v as comboboxRecipe };
|
package/src/combobox/icons.d.ts
CHANGED
|
@@ -16,3 +16,19 @@ export declare const IconCancel: (props: SVGProps<SVGSVGElement>) => import("rea
|
|
|
16
16
|
* @summary 24px check used by the Combobox selection indicator
|
|
17
17
|
*/
|
|
18
18
|
export declare const IconCheck: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Magnifier leading the `search` variant of `Combobox.Input`, the same glyph
|
|
21
|
+
* `Command` uses. Fill color comes from the input group addon, so it follows
|
|
22
|
+
* the field's disabled state.
|
|
23
|
+
*
|
|
24
|
+
* @summary 24px search icon leading the Combobox search field
|
|
25
|
+
*/
|
|
26
|
+
export declare const IconSearch: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Downward chevron inside the `chevron` variant's trigger, the same glyph
|
|
29
|
+
* `Accordion` uses. Fill color is supplied by the trigger's class so it
|
|
30
|
+
* follows the button's state.
|
|
31
|
+
*
|
|
32
|
+
* @summary 24px chevron-down icon used as the Combobox list trigger
|
|
33
|
+
*/
|
|
34
|
+
export declare const IconKeyboardArrowDown: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
package/src/combobox/icons.js
CHANGED
|
@@ -18,6 +18,24 @@ var t = (t) => /* @__PURE__ */ e("svg", {
|
|
|
18
18
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
19
|
...t,
|
|
20
20
|
children: /* @__PURE__ */ e("path", { d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" })
|
|
21
|
+
}), r = (t) => /* @__PURE__ */ e("svg", {
|
|
22
|
+
width: "24",
|
|
23
|
+
height: "24",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
+
...t,
|
|
29
|
+
children: /* @__PURE__ */ e("path", { d: "M9.52 15.615q-2.562 0-4.34-1.777Q3.405 12.062 3.405 9.5T5.18 5.162q1.776-1.777 4.338-1.777t4.339 1.777q1.777 1.776 1.777 4.338 0 1.071-.36 2.046a5.7 5.7 0 0 1-.96 1.696l5.754 5.754q.209.209.213.522a.7.7 0 0 1-.213.532.72.72 0 0 1-.527.217.72.72 0 0 1-.527-.217l-5.753-5.754q-.75.62-1.725.97t-2.018.35m0-1.5q1.933 0 3.273-1.341 1.342-1.34 1.342-3.274 0-1.932-1.342-3.274-1.34-1.341-3.274-1.341-1.932 0-3.274 1.34Q4.904 7.569 4.904 9.5q0 1.933 1.341 3.274 1.342 1.341 3.274 1.341" })
|
|
30
|
+
}), i = (t) => /* @__PURE__ */ e("svg", {
|
|
31
|
+
width: "24",
|
|
32
|
+
height: "24",
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
fill: "none",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
+
...t,
|
|
38
|
+
children: /* @__PURE__ */ e("path", { d: "M12 14.677a.83.83 0 0 1-.633-.256L6.873 9.927a.73.73 0 0 1-.212-.522.7.7 0 0 1 .212-.532.72.72 0 0 1 .527-.217q.31 0 .527.217L12 12.946l4.073-4.073a.73.73 0 0 1 .522-.212.7.7 0 0 1 .532.212q.217.217.217.527a.72.72 0 0 1-.217.527l-4.494 4.494a.83.83 0 0 1-.633.256" })
|
|
21
39
|
});
|
|
22
40
|
//#endregion
|
|
23
|
-
export { t as IconCancel, n as IconCheck };
|
|
41
|
+
export { t as IconCancel, n as IconCheck, i as IconKeyboardArrowDown, r as IconSearch };
|
package/src/combobox/index.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export { comboboxRecipe } from './combobox';
|
|
2
|
+
export type { ComboboxRootProps } from './combobox';
|
|
2
3
|
export declare const Combobox: {
|
|
3
4
|
Root: {
|
|
4
|
-
<Value, Multiple extends boolean | undefined = false, Item = Value>({ onOpenChange, ...props }: import(
|
|
5
|
+
<Value, Multiple extends boolean | undefined = false, Item = Value>({ minInputLength, open: openProp, defaultOpen, onOpenChange, onOpenChangeComplete, onInputValueChange, ...props }: import('./combobox').ComboboxRootProps<Value, Multiple, Item>): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
displayName: string;
|
|
6
7
|
};
|
|
7
8
|
Input: {
|
|
8
|
-
({ clearLabel, ...props }: Omit<Omit<import('@base-ui/react/combobox').ComboboxInputProps, "ref"> & import('react').RefAttributes<HTMLInputElement>, "size"> & {
|
|
9
|
+
({ variant, showClear, clearLabel, triggerLabel, ...props }: Omit<Omit<import('@base-ui/react/combobox').ComboboxInputProps, "ref"> & import('react').RefAttributes<HTMLInputElement>, "size"> & {
|
|
9
10
|
size?: import('../input').InputSize;
|
|
11
|
+
variant?: "search" | "plain" | "select";
|
|
12
|
+
showClear?: boolean;
|
|
10
13
|
clearLabel?: string;
|
|
14
|
+
triggerLabel?: string;
|
|
11
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
displayName: string;
|
|
13
17
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { inputGroupRecipe } from './input-group';
|
|
2
|
+
export type { InputGroupAddonProps, InputGroupRootProps, InputGroupTextProps } from './input-group';
|
|
3
|
+
export declare const InputGroup: {
|
|
4
|
+
Root: {
|
|
5
|
+
({ className, ...props }: import('./input-group').InputGroupRootProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
Addon: {
|
|
9
|
+
({ className, variant, onMouseDown, ...props }: import('./input-group').InputGroupAddonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
Text: {
|
|
13
|
+
({ className, ...props }: import('./input-group').InputGroupTextProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
/**
|
|
4
|
+
* Style recipe for InputGroup. Slots: `root` (the bordered frame), `addon` and
|
|
5
|
+
* `text`. Focus, disabled, invalid and size all come from the `<input>` or
|
|
6
|
+
* `<textarea>` inside through `:has()`, so the frame can never disagree with
|
|
7
|
+
* its control.
|
|
8
|
+
*
|
|
9
|
+
* @summary tailwind-variants recipe backing the InputGroup frame and addons
|
|
10
|
+
*/
|
|
11
|
+
export declare const inputGroupRecipe: import('tailwind-variants').TVReturnType<{
|
|
12
|
+
variant: {
|
|
13
|
+
default: {};
|
|
14
|
+
action: {
|
|
15
|
+
addon: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
root: string[];
|
|
20
|
+
addon: string[];
|
|
21
|
+
text: string[];
|
|
22
|
+
}, undefined, {
|
|
23
|
+
variant: {
|
|
24
|
+
default: {};
|
|
25
|
+
action: {
|
|
26
|
+
addon: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
root: string[];
|
|
31
|
+
addon: string[];
|
|
32
|
+
text: string[];
|
|
33
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
34
|
+
variant: {
|
|
35
|
+
default: {};
|
|
36
|
+
action: {
|
|
37
|
+
addon: string[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
root: string[];
|
|
42
|
+
addon: string[];
|
|
43
|
+
text: string[];
|
|
44
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
45
|
+
type InputGroupVariants = VariantProps<typeof inputGroupRecipe>;
|
|
46
|
+
export type InputGroupRootProps = ComponentPropsWithRef<'div'>;
|
|
47
|
+
/**
|
|
48
|
+
* The bordered frame of an input group: one box around an `Input` and its
|
|
49
|
+
* addons, drawn as a single control. It carries the border, the shadow, the
|
|
50
|
+
* focus ring and the horizontal padding; the `Input` inside renders bare and
|
|
51
|
+
* gives the frame its state — focus, `disabled`, `aria-invalid` and `size`
|
|
52
|
+
* all propagate through `:has()`, so nothing is passed to the frame by hand.
|
|
53
|
+
*
|
|
54
|
+
* Put the `Input` and any `InputGroup.Addon` or `InputGroup.Text` inside, in
|
|
55
|
+
* reading order. Inside a `FieldText` the `Input` still takes its label and
|
|
56
|
+
* messages from the field, at any depth; the frame needs nothing.
|
|
57
|
+
*
|
|
58
|
+
* Use it for an input with a leading icon, a currency or unit affix, or a
|
|
59
|
+
* trailing action. A plain input with nothing around it is just `Input`, and a
|
|
60
|
+
* button beside an input that submits on its own is a form layout, not a group.
|
|
61
|
+
* Not a `role="group"`, like `Field`.
|
|
62
|
+
*
|
|
63
|
+
* @summary Bordered frame drawing an Input and its addons as one control
|
|
64
|
+
* @dataAttribute {string} data-slot - Always set to "input-group"
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* <InputGroup.Root>
|
|
68
|
+
* <InputGroup.Text>$</InputGroup.Text>
|
|
69
|
+
* <Input inputMode="decimal" placeholder="0.00" />
|
|
70
|
+
* <InputGroup.Text>USD</InputGroup.Text>
|
|
71
|
+
* </InputGroup.Root>
|
|
72
|
+
*/
|
|
73
|
+
export declare const Root: {
|
|
74
|
+
({ className, ...props }: InputGroupRootProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
displayName: string;
|
|
76
|
+
};
|
|
77
|
+
export type InputGroupAddonProps = ComponentPropsWithRef<'div'> & {
|
|
78
|
+
/**
|
|
79
|
+
* `action` runs a button edge to edge at the frame's height.
|
|
80
|
+
*
|
|
81
|
+
* @default 'default'
|
|
82
|
+
*/
|
|
83
|
+
variant?: InputGroupVariants['variant'];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* A slot for an icon, a tag or a button inside the frame. Icons take the input
|
|
87
|
+
* colour and size (24px) and follow the disabled state. A press on the addon
|
|
88
|
+
* itself focuses the input, so the whole frame reads as the control; a press on
|
|
89
|
+
* a button or link inside it is left alone.
|
|
90
|
+
*
|
|
91
|
+
* For a text affix use `InputGroup.Text`, which sets the type and colour a
|
|
92
|
+
* prefix needs.
|
|
93
|
+
*
|
|
94
|
+
* @summary Icon, tag or button slot inside the input group frame
|
|
95
|
+
* @dataAttribute {string} data-slot - Always set to "input-group-addon"
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* <InputGroup.Root>
|
|
99
|
+
* <InputGroup.Addon><IconSearch /></InputGroup.Addon>
|
|
100
|
+
* <Input type="search" placeholder="Search agencies" />
|
|
101
|
+
* </InputGroup.Root>
|
|
102
|
+
*/
|
|
103
|
+
export declare const Addon: {
|
|
104
|
+
({ className, variant, onMouseDown, ...props }: InputGroupAddonProps): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
displayName: string;
|
|
106
|
+
};
|
|
107
|
+
export type InputGroupTextProps = ComponentPropsWithRef<'span'>;
|
|
108
|
+
/**
|
|
109
|
+
* A text affix inside the frame: a currency symbol, a protocol, a unit. Set in
|
|
110
|
+
* the placeholder colour so the typed value stands out, at the input's text
|
|
111
|
+
* size (`base` when the input is `lg`), and greyed out with a disabled input.
|
|
112
|
+
* It is decoration only: a screen reader does not read it as part of the value,
|
|
113
|
+
* so say the unit in the label or the description when it matters — and the
|
|
114
|
+
* value excludes it too, so a `https://` prefix goes with a `type="text"`
|
|
115
|
+
* input, not `type="url"`, whose native validation would reject the bare host.
|
|
116
|
+
*
|
|
117
|
+
* @summary Currency, protocol or unit affix set beside the input
|
|
118
|
+
* @dataAttribute {string} data-slot - Always set to "input-group-text"
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* <InputGroup.Root>
|
|
122
|
+
* <InputGroup.Text>https://</InputGroup.Text>
|
|
123
|
+
* <Input type="text" inputMode="url" autoCapitalize="none" placeholder="www.agentero.com" />
|
|
124
|
+
* </InputGroup.Root>
|
|
125
|
+
*/
|
|
126
|
+
export declare const Text: {
|
|
127
|
+
({ className, ...props }: InputGroupTextProps): import("react/jsx-runtime").JSX.Element;
|
|
128
|
+
displayName: string;
|
|
129
|
+
};
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { tv as t } from "tailwind-variants";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/input-group/input-group.tsx
|
|
6
|
+
var r = t({
|
|
7
|
+
slots: {
|
|
8
|
+
root: [
|
|
9
|
+
"group/input-group [--input-group-gap:0.75rem]",
|
|
10
|
+
"flex gap-(--input-group-gap) rounded-md border border-solid border-border-input-default",
|
|
11
|
+
"bg-bg-input-normal px-3 text-text-input-normal shadow-sm",
|
|
12
|
+
"cursor-text overflow-hidden outline-0 -outline-offset-1 outline-[transparent]",
|
|
13
|
+
"transition-[color,box-shadow,outline-color,outline-offset,outline-width] duration-75",
|
|
14
|
+
"has-[input:focus-within,textarea:focus-within]:border-border-input-focus",
|
|
15
|
+
"has-[input:focus-within,textarea:focus-within]:outline-border-input-focus",
|
|
16
|
+
"has-[input:focus-within,textarea:focus-within]:outline-[0.125rem]",
|
|
17
|
+
"has-[input:focus-within,textarea:focus-within]:outline-offset-[-0.0625rem]",
|
|
18
|
+
"has-[input:disabled,textarea:disabled]:cursor-default",
|
|
19
|
+
"has-[input:disabled,textarea:disabled]:border-border-input-disable",
|
|
20
|
+
"has-[input:disabled,textarea:disabled]:bg-bg-input-disable",
|
|
21
|
+
"has-[input:disabled,textarea:disabled]:text-text-input-disable",
|
|
22
|
+
"has-[input:disabled,textarea:disabled]:shadow-none",
|
|
23
|
+
"has-[input[data-size=\"lg\"],textarea[data-size=\"lg\"]]:rounded-lg",
|
|
24
|
+
"has-[input[aria-invalid=\"true\"],textarea[aria-invalid=\"true\"]]:border-border-input-destructive",
|
|
25
|
+
"has-[input[aria-invalid=\"true\"]:focus-within,textarea[aria-invalid=\"true\"]:focus-within]:outline-outline-input-destructive",
|
|
26
|
+
"**:[input,textarea]:-my-0.25 **:[input,textarea]:border-none **:[input,textarea]:bg-transparent",
|
|
27
|
+
"**:[input,textarea]:px-0 **:[input,textarea]:pb-0.125 **:[input,textarea]:shadow-none",
|
|
28
|
+
"**:[input,textarea]:outline-none **:[input,textarea]:focus-visible:outline-none",
|
|
29
|
+
"**:[[data-slot=separator]]:bg-border-input-default",
|
|
30
|
+
"**:[[data-slot=tag]]:-ms-1 **:[[data-slot=tag]]:rounded-sm",
|
|
31
|
+
"**:[input+[data-slot=input-group-addon]>[data-slot=tag]]:ms-0",
|
|
32
|
+
"**:[input+[data-slot=input-group-addon]>[data-slot=tag]]:-me-1"
|
|
33
|
+
],
|
|
34
|
+
addon: [
|
|
35
|
+
"flex h-auto cursor-text items-center justify-center",
|
|
36
|
+
"*:[svg]:-mx-1 *:[svg]:size-6 [&_path]:fill-icon-input-default",
|
|
37
|
+
"group-has-[input:disabled,textarea:disabled]/input-group:[&_path]:fill-icon-input-disable"
|
|
38
|
+
],
|
|
39
|
+
text: [
|
|
40
|
+
"flex items-center text-sm text-text-input-placeholder",
|
|
41
|
+
"group-has-[input[data-size=\"lg\"]]/input-group:text-base",
|
|
42
|
+
"group-has-[input:disabled,textarea:disabled]/input-group:text-text-input-disable"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
variants: { variant: {
|
|
46
|
+
default: {},
|
|
47
|
+
action: { addon: [
|
|
48
|
+
"-mx-(--input-group-gap) shrink-0 items-stretch rounded-[inherit]",
|
|
49
|
+
"*:[button]:h-auto *:[button]:rounded-none *:[button]:focus-visible:-outline-offset-2",
|
|
50
|
+
"first:*:[button]:rounded-s-[inherit] last:*:[button]:rounded-e-[inherit]"
|
|
51
|
+
] }
|
|
52
|
+
} },
|
|
53
|
+
defaultVariants: { variant: "default" }
|
|
54
|
+
}), i = r(), a = ({ className: t, ...r }) => /* @__PURE__ */ n("div", {
|
|
55
|
+
"data-slot": "input-group",
|
|
56
|
+
className: e(i.root(), t),
|
|
57
|
+
...r
|
|
58
|
+
});
|
|
59
|
+
a.displayName = "InputGroup.Root";
|
|
60
|
+
var o = ({ className: t, variant: i, onMouseDown: a, ...o }) => /* @__PURE__ */ n("div", {
|
|
61
|
+
"data-slot": "input-group-addon",
|
|
62
|
+
className: e(r({ variant: i }).addon(), t),
|
|
63
|
+
onMouseDown: (e) => {
|
|
64
|
+
if (a?.(e), e.defaultPrevented || e.target.closest("button, a")) return;
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
let t = e.currentTarget.parentElement, n = t?.querySelector("input, textarea");
|
|
67
|
+
n && !t?.querySelector("input:focus, textarea:focus") && n.focus();
|
|
68
|
+
},
|
|
69
|
+
...o
|
|
70
|
+
});
|
|
71
|
+
o.displayName = "InputGroup.Addon";
|
|
72
|
+
var s = ({ className: t, ...r }) => /* @__PURE__ */ n("span", {
|
|
73
|
+
"data-slot": "input-group-text",
|
|
74
|
+
className: e(i.text(), t),
|
|
75
|
+
...r
|
|
76
|
+
});
|
|
77
|
+
s.displayName = "InputGroup.Text";
|
|
78
|
+
//#endregion
|
|
79
|
+
export { o as Addon, a as Root, s as Text, r as inputGroupRecipe };
|