@uipath/apollo-wind 2.55.0 → 2.57.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/dist/components/ui/combobox.cjs +33 -15
- package/dist/components/ui/combobox.js +33 -15
- package/dist/components/ui/date-picker.cjs +62 -26
- package/dist/components/ui/date-picker.js +62 -26
- package/dist/components/ui/datetime-picker.cjs +29 -12
- package/dist/components/ui/datetime-picker.js +29 -12
- package/dist/components/ui/dropdown-menu.cjs +12 -8
- package/dist/components/ui/dropdown-menu.js +12 -8
- package/dist/components/ui/field-actions/ai-assist-action.cjs +121 -0
- package/dist/components/ui/field-actions/ai-assist-action.d.ts +21 -0
- package/dist/components/ui/field-actions/ai-assist-action.js +84 -0
- package/dist/components/ui/field-actions/collapse.cjs +44 -0
- package/dist/components/ui/field-actions/collapse.d.ts +6 -0
- package/dist/components/ui/field-actions/collapse.js +4 -0
- package/dist/components/ui/field-actions/index.cjs +46 -0
- package/dist/components/ui/field-actions/index.d.ts +2 -0
- package/dist/components/ui/field-actions/index.js +3 -0
- package/dist/components/ui/field-actions/insert-variable-action.cjs +94 -0
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +22 -0
- package/dist/components/ui/field-actions/insert-variable-action.js +57 -0
- package/dist/components/ui/field-addons/index.cjs +50 -0
- package/dist/components/ui/field-addons/index.d.ts +3 -0
- package/dist/components/ui/field-addons/index.js +4 -0
- package/dist/components/ui/field-addons/value-mode-indicator.cjs +57 -0
- package/dist/components/ui/field-addons/value-mode-indicator.d.ts +13 -0
- package/dist/components/ui/field-addons/value-mode-indicator.js +23 -0
- package/dist/components/ui/field-addons/value-mode-menu.cjs +149 -0
- package/dist/components/ui/field-addons/value-mode-menu.d.ts +69 -0
- package/dist/components/ui/field-addons/value-mode-menu.js +112 -0
- package/dist/components/ui/field-addons/value-mode-strings.cjs +69 -0
- package/dist/components/ui/field-addons/value-mode-strings.d.ts +32 -0
- package/dist/components/ui/field-addons/value-mode-strings.js +29 -0
- package/dist/components/ui/form-field.cjs +42 -5
- package/dist/components/ui/form-field.d.ts +21 -1
- package/dist/components/ui/form-field.js +36 -2
- package/dist/components/ui/index.cjs +156 -126
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.js +3 -0
- package/dist/components/ui/input-group-context.cjs +91 -0
- package/dist/components/ui/input-group-context.d.ts +69 -0
- package/dist/components/ui/input-group-context.js +42 -0
- package/dist/components/ui/input-group.cjs +303 -56
- package/dist/components/ui/input-group.d.ts +70 -3
- package/dist/components/ui/input-group.js +285 -56
- package/dist/components/ui/input.cjs +28 -17
- package/dist/components/ui/input.js +28 -17
- package/dist/components/ui/lockable-value-field/components/field-header.cjs +16 -114
- package/dist/components/ui/lockable-value-field/components/field-header.js +14 -112
- package/dist/components/ui/lockable-value-field/lockable-value-field.cjs +4 -12
- package/dist/components/ui/lockable-value-field/lockable-value-field.js +4 -12
- package/dist/components/ui/model-picker/ModelPicker.cjs +495 -0
- package/dist/components/ui/model-picker/ModelPicker.d.ts +304 -0
- package/dist/components/ui/model-picker/ModelPicker.js +451 -0
- package/dist/components/ui/model-picker/ModelTagChip.cjs +101 -0
- package/dist/components/ui/model-picker/ModelTagChip.d.ts +29 -0
- package/dist/components/ui/model-picker/ModelTagChip.js +67 -0
- package/dist/components/ui/model-picker/badges.cjs +52 -0
- package/dist/components/ui/model-picker/badges.d.ts +41 -0
- package/dist/components/ui/model-picker/badges.js +18 -0
- package/dist/components/ui/model-picker/index.cjs +117 -0
- package/dist/components/ui/model-picker/index.d.ts +27 -0
- package/dist/components/ui/model-picker/index.js +14 -0
- package/dist/components/ui/model-picker/labels.cjs +107 -0
- package/dist/components/ui/model-picker/labels.d.ts +81 -0
- package/dist/components/ui/model-picker/labels.js +67 -0
- package/dist/components/ui/model-picker/primitives/FolderSwitcher.cjs +108 -0
- package/dist/components/ui/model-picker/primitives/FolderSwitcher.d.ts +38 -0
- package/dist/components/ui/model-picker/primitives/FolderSwitcher.js +74 -0
- package/dist/components/ui/model-picker/primitives/GroupHeader.cjs +84 -0
- package/dist/components/ui/model-picker/primitives/GroupHeader.d.ts +64 -0
- package/dist/components/ui/model-picker/primitives/GroupHeader.js +50 -0
- package/dist/components/ui/model-picker/primitives/ModelOptionRow.cjs +178 -0
- package/dist/components/ui/model-picker/primitives/ModelOptionRow.d.ts +95 -0
- package/dist/components/ui/model-picker/primitives/ModelOptionRow.js +135 -0
- package/dist/components/ui/model-picker/primitives/OptionList.cjs +295 -0
- package/dist/components/ui/model-picker/primitives/OptionList.d.ts +87 -0
- package/dist/components/ui/model-picker/primitives/OptionList.js +242 -0
- package/dist/components/ui/{lockable-value-field/components/mode-menu-item.cjs → model-picker/primitives/PickerPopup.cjs} +25 -24
- package/dist/components/ui/model-picker/primitives/PickerPopup.d.ts +39 -0
- package/dist/components/ui/model-picker/primitives/PickerPopup.js +30 -0
- package/dist/components/ui/model-picker/primitives/PickerSearchInput.cjs +77 -0
- package/dist/components/ui/model-picker/primitives/PickerSearchInput.d.ts +43 -0
- package/dist/components/ui/model-picker/primitives/PickerSearchInput.js +43 -0
- package/dist/components/ui/model-picker/primitives/PickerTrigger.cjs +112 -0
- package/dist/components/ui/model-picker/primitives/PickerTrigger.d.ts +73 -0
- package/dist/components/ui/model-picker/primitives/PickerTrigger.js +78 -0
- package/dist/components/ui/model-picker/types.cjs +18 -0
- package/dist/components/ui/model-picker/types.d.ts +154 -0
- package/dist/components/ui/model-picker/types.js +0 -0
- package/dist/components/ui/model-picker/useModelPickerState.cjs +250 -0
- package/dist/components/ui/model-picker/useModelPickerState.d.ts +135 -0
- package/dist/components/ui/model-picker/useModelPickerState.js +216 -0
- package/dist/components/ui/model-picker/utils.cjs +327 -0
- package/dist/components/ui/model-picker/utils.d.ts +121 -0
- package/dist/components/ui/model-picker/utils.js +272 -0
- package/dist/components/ui/multi-select.cjs +82 -58
- package/dist/components/ui/multi-select.js +84 -60
- package/dist/components/ui/popover.cjs +13 -9
- package/dist/components/ui/popover.js +13 -9
- package/dist/components/ui/select.cjs +89 -27
- package/dist/components/ui/select.d.ts +4 -0
- package/dist/components/ui/select.js +90 -28
- package/dist/components/ui/textarea.cjs +16 -11
- package/dist/components/ui/textarea.js +16 -11
- package/dist/index.cjs +144 -21
- package/dist/index.d.ts +10 -4
- package/dist/index.js +6 -3
- package/dist/styles.css +350 -5
- package/package.json +2 -1
- package/dist/components/ui/lockable-value-field/components/mode-menu-item.d.ts +0 -9
- package/dist/components/ui/lockable-value-field/components/mode-menu-item.js +0 -29
|
@@ -1,111 +1,340 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
4
5
|
import { Button } from "./button.js";
|
|
5
6
|
import { Input } from "./input.js";
|
|
7
|
+
import { PopoverAnchor, PopoverTrigger } from "./popover.js";
|
|
6
8
|
import { Textarea } from "./textarea.js";
|
|
7
9
|
import { cn } from "../../lib/index.js";
|
|
8
10
|
import { FormFieldError } from "./form-field.js";
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
+
import { InputGroupContext, NO_GROUP, NO_GROUP_DISABLED, controlValidation, useInputGroup } from "./input-group-context.js";
|
|
12
|
+
const ROW_LAYOUTS = [
|
|
13
|
+
'row',
|
|
14
|
+
'grow',
|
|
15
|
+
'fill'
|
|
16
|
+
];
|
|
17
|
+
const FILLED = [
|
|
18
|
+
'default',
|
|
19
|
+
'ghost'
|
|
20
|
+
];
|
|
21
|
+
const BOXED = [
|
|
22
|
+
'default',
|
|
23
|
+
'ghost',
|
|
24
|
+
'outline'
|
|
25
|
+
];
|
|
26
|
+
const inputGroupVariants = cva([
|
|
27
|
+
'group/input-group relative flex w-full items-center gap-2 transition-colors has-[>textarea]:h-auto has-[>textarea]:items-start',
|
|
28
|
+
'has-[[data-slot=input-group-control]:disabled]:cursor-not-allowed has-[[data-slot=input-group-control]:disabled]:opacity-50'
|
|
29
|
+
], {
|
|
30
|
+
variants: {
|
|
31
|
+
size: {
|
|
32
|
+
default: 'h-9 rounded-md px-3 py-1 future:h-10 future:rounded-xl future:py-2 has-[>[data-slot=input-group-addon][data-align=inline-end]]:pr-2 future:has-[>[data-slot=input-group-addon][data-align=inline-end]]:pr-2',
|
|
33
|
+
xs: 'h-6 gap-1 rounded px-2'
|
|
34
|
+
},
|
|
35
|
+
layout: {
|
|
36
|
+
row: '',
|
|
37
|
+
grow: 'h-auto min-h-9 future:h-auto future:min-h-10',
|
|
38
|
+
block: 'h-auto flex-col items-stretch gap-0 overflow-hidden p-0 future:h-auto future:p-0',
|
|
39
|
+
fill: 'h-auto min-h-9 items-stretch py-0 pl-0 pr-0 future:h-auto future:min-h-10 future:py-0 future:pl-0 future:pr-0'
|
|
40
|
+
},
|
|
41
|
+
variant: {
|
|
42
|
+
default: 'border border-input bg-transparent future:border-0 future:bg-surface-overlay',
|
|
43
|
+
ghost: 'border-0 bg-surface-overlay',
|
|
44
|
+
outline: 'border border-input bg-transparent shadow-none future:border future:border-input future:bg-transparent future:has-[[data-slot][aria-invalid=true]]:border-error',
|
|
45
|
+
none: 'border-0 bg-transparent shadow-none future:bg-transparent'
|
|
46
|
+
},
|
|
47
|
+
invalid: {
|
|
48
|
+
true: '',
|
|
49
|
+
false: ''
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
true: 'cursor-not-allowed opacity-50',
|
|
53
|
+
false: ''
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
compoundVariants: [
|
|
57
|
+
{
|
|
58
|
+
variant: 'none',
|
|
59
|
+
layout: ROW_LAYOUTS,
|
|
60
|
+
class: 'px-0 pr-3'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
layout: ROW_LAYOUTS,
|
|
64
|
+
class: 'has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]_:focus-visible]:ring-2 has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus-visible]:ring-error has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]_:focus-visible]:ring-error future:has-[[data-slot=input-group-control]:focus-visible]:ring-offset-2 future:has-[[data-slot=input-group-control]:focus-visible]:ring-offset-background future:has-[[data-slot=input-group-control]_:focus-visible]:ring-offset-2 future:has-[[data-slot=input-group-control]_:focus-visible]:ring-offset-background'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
layout: ROW_LAYOUTS,
|
|
68
|
+
invalid: false,
|
|
69
|
+
class: 'has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]_:focus-visible]:ring-ring'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
layout: ROW_LAYOUTS,
|
|
73
|
+
invalid: true,
|
|
74
|
+
class: 'has-[[data-slot=input-group-control]:focus-visible]:ring-error has-[[data-slot=input-group-control]_:focus-visible]:ring-error'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
variant: BOXED,
|
|
78
|
+
class: 'has-[[data-slot][aria-invalid=true]]:border-error'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
variant: BOXED,
|
|
82
|
+
invalid: true,
|
|
83
|
+
class: 'border-error'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
variant: 'outline',
|
|
87
|
+
invalid: true,
|
|
88
|
+
class: 'future:border-error'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
variant: FILLED,
|
|
92
|
+
class: 'has-[[data-slot][aria-invalid=true]]:ring-error/20 future:has-[[data-slot][aria-invalid=true]]:ring-1 future:has-[[data-slot][aria-invalid=true]]:ring-error/40'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: FILLED,
|
|
96
|
+
invalid: true,
|
|
97
|
+
class: 'ring-error/20 future:ring-1 future:ring-error/40'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
variant: FILLED,
|
|
101
|
+
layout: ROW_LAYOUTS,
|
|
102
|
+
class: 'has-[button[data-slot=input-group-control]:not(:disabled):hover]:bg-accent future:has-[button[data-slot=input-group-control]:not(:disabled):hover]:bg-surface-hover'
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
defaultVariants: {
|
|
106
|
+
size: 'default',
|
|
107
|
+
layout: 'row',
|
|
108
|
+
variant: 'default',
|
|
109
|
+
invalid: false,
|
|
110
|
+
disabled: false
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const InputGroup = /*#__PURE__*/ forwardRef(({ className, error, errorId, variant = 'default', size = 'default', layout = 'row', invalid, disabled, ...props }, ref)=>{
|
|
11
114
|
const generatedId = useId();
|
|
12
115
|
const validationId = errorId ?? `input-group-${generatedId.replace(/:/g, '')}-error`;
|
|
13
|
-
|
|
14
|
-
|
|
116
|
+
const flagged = Boolean(invalid || error);
|
|
117
|
+
const [controlError, setControlError] = useState();
|
|
118
|
+
const boxRef = useRef(null);
|
|
119
|
+
const setBox = useCallback((node)=>{
|
|
120
|
+
boxRef.current = node;
|
|
121
|
+
if ('function' == typeof ref) ref(node);
|
|
122
|
+
else if (ref) ref.current = node;
|
|
123
|
+
}, [
|
|
124
|
+
ref
|
|
125
|
+
]);
|
|
126
|
+
const group = useMemo(()=>({
|
|
127
|
+
inGroup: true,
|
|
128
|
+
layout,
|
|
15
129
|
error,
|
|
16
|
-
errorId: validationId
|
|
17
|
-
|
|
130
|
+
errorId: validationId,
|
|
131
|
+
invalid,
|
|
132
|
+
disabled,
|
|
133
|
+
anchor: boxRef,
|
|
134
|
+
reportError: setControlError
|
|
135
|
+
}), [
|
|
136
|
+
layout,
|
|
137
|
+
error,
|
|
138
|
+
validationId,
|
|
139
|
+
invalid,
|
|
140
|
+
disabled
|
|
141
|
+
]);
|
|
142
|
+
return /*#__PURE__*/ jsxs(InputGroupContext.Provider, {
|
|
143
|
+
value: group,
|
|
18
144
|
children: [
|
|
19
145
|
/*#__PURE__*/ jsx("div", {
|
|
20
|
-
ref:
|
|
146
|
+
ref: setBox,
|
|
21
147
|
role: "group",
|
|
22
|
-
|
|
148
|
+
"data-slot": "input-group",
|
|
149
|
+
"data-layout": layout,
|
|
150
|
+
"data-invalid": flagged ? '' : void 0,
|
|
151
|
+
"data-disabled": disabled ? '' : void 0,
|
|
152
|
+
"aria-disabled": disabled || void 0,
|
|
153
|
+
className: cn(inputGroupVariants({
|
|
154
|
+
size,
|
|
155
|
+
layout,
|
|
156
|
+
variant,
|
|
157
|
+
invalid: flagged,
|
|
158
|
+
disabled
|
|
159
|
+
}), className),
|
|
23
160
|
...props
|
|
24
161
|
}),
|
|
25
162
|
/*#__PURE__*/ jsx(FormFieldError, {
|
|
26
163
|
id: validationId,
|
|
27
|
-
children: error
|
|
164
|
+
children: error || controlError
|
|
28
165
|
})
|
|
29
166
|
]
|
|
30
167
|
});
|
|
31
168
|
});
|
|
32
169
|
InputGroup.displayName = 'InputGroup';
|
|
33
|
-
const inputGroupAddonVariants = cva('flex h-auto cursor-text items-center justify-center gap-1 text-sm text-muted-foreground select-none group-has-[[data-slot=input-group-control]:disabled]/input-group:opacity-50 [&>svg:not([class*="size-"])]:size-4', {
|
|
170
|
+
const inputGroupAddonVariants = cva('flex h-auto cursor-text empty:hidden items-center justify-center gap-1 text-sm text-muted-foreground select-none group-has-[[data-slot=input-group-control]:disabled]/input-group:opacity-50 [&>svg:not([class*="size-"])]:size-4', {
|
|
34
171
|
variants: {
|
|
35
172
|
align: {
|
|
36
173
|
'inline-start': 'order-first',
|
|
37
|
-
'inline-end': 'order-last'
|
|
174
|
+
'inline-end': 'order-last ml-auto'
|
|
175
|
+
},
|
|
176
|
+
layout: {
|
|
177
|
+
row: '',
|
|
178
|
+
grow: 'shrink-0 self-stretch max-h-6.5 future:max-h-6',
|
|
179
|
+
block: 'shrink-0 self-stretch max-h-9 future:max-h-10',
|
|
180
|
+
fill: 'shrink-0 self-stretch max-h-9 future:max-h-10'
|
|
38
181
|
}
|
|
39
182
|
},
|
|
40
183
|
defaultVariants: {
|
|
41
|
-
align: 'inline-start'
|
|
184
|
+
align: 'inline-start',
|
|
185
|
+
layout: 'row'
|
|
42
186
|
}
|
|
43
187
|
});
|
|
44
|
-
const
|
|
188
|
+
const ADDON_INTERACTIVE = 'button, a[href], input, textarea, select, [contenteditable], [tabindex]';
|
|
189
|
+
const InputGroupAddon = /*#__PURE__*/ forwardRef(({ className, align = 'inline-start', focusControlOnClick = true, onClick, ...props }, ref)=>{
|
|
190
|
+
const { layout, disabled } = useInputGroup();
|
|
191
|
+
return /*#__PURE__*/ jsx(InputGroupContext.Provider, {
|
|
192
|
+
value: disabled ? NO_GROUP_DISABLED : NO_GROUP,
|
|
193
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
194
|
+
ref: ref,
|
|
195
|
+
role: "group",
|
|
196
|
+
"data-slot": "input-group-addon",
|
|
197
|
+
"data-align": align,
|
|
198
|
+
className: cn(inputGroupAddonVariants({
|
|
199
|
+
align,
|
|
200
|
+
layout
|
|
201
|
+
}), className),
|
|
202
|
+
onClick: (e)=>{
|
|
203
|
+
const hit = e.target.closest(ADDON_INTERACTIVE);
|
|
204
|
+
if (focusControlOnClick && !(hit && e.currentTarget.contains(hit))) e.currentTarget.parentElement?.querySelector('[data-slot=input-group-control]')?.focus();
|
|
205
|
+
onClick?.(e);
|
|
206
|
+
},
|
|
207
|
+
...props
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
InputGroupAddon.displayName = 'InputGroupAddon';
|
|
212
|
+
const InputGroupRow = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
45
213
|
ref: ref,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"data-align": align,
|
|
49
|
-
className: cn(inputGroupAddonVariants({
|
|
50
|
-
align
|
|
51
|
-
}), className),
|
|
52
|
-
onClick: (e)=>{
|
|
53
|
-
if (!e.target.closest('button')) e.currentTarget.parentElement?.querySelector('input, textarea')?.focus();
|
|
54
|
-
onClick?.(e);
|
|
55
|
-
},
|
|
214
|
+
"data-slot": "input-group-row",
|
|
215
|
+
className: cn('flex min-h-9 min-w-0 items-stretch gap-2 px-3 has-[>[data-slot=input-group-addon][data-align=inline-end]]:pr-2 future:min-h-10', 'rounded-[inherit] has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-inset has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]_:focus-visible]:ring-2 has-[[data-slot=input-group-control]_:focus-visible]:ring-inset has-[[data-slot=input-group-control]_:focus-visible]:ring-ring has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]:focus-visible]:ring-error has-[[data-slot][aria-invalid=true]]:has-[[data-slot=input-group-control]_:focus-visible]:ring-error', className),
|
|
56
216
|
...props
|
|
57
217
|
}));
|
|
58
|
-
|
|
59
|
-
const
|
|
218
|
+
InputGroupRow.displayName = 'InputGroupRow';
|
|
219
|
+
const InputGroupBody = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
220
|
+
const { disabled } = useInputGroup();
|
|
221
|
+
return /*#__PURE__*/ jsx(InputGroupContext.Provider, {
|
|
222
|
+
value: disabled ? NO_GROUP_DISABLED : NO_GROUP,
|
|
223
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
224
|
+
ref: ref,
|
|
225
|
+
"data-slot": "input-group-body",
|
|
226
|
+
className: cn('border-t empty:border-t-0 has-[>[hidden]]:border-t-0', className),
|
|
227
|
+
...props
|
|
228
|
+
})
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
InputGroupBody.displayName = 'InputGroupBody';
|
|
232
|
+
const InputGroupButton = /*#__PURE__*/ forwardRef(({ className, type = 'button', variant = 'ghost', size = 'xs', disabled, ...props }, ref)=>{
|
|
233
|
+
const group = useInputGroup();
|
|
234
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
60
235
|
ref: ref,
|
|
61
236
|
type: type,
|
|
62
237
|
variant: variant,
|
|
63
238
|
size: size,
|
|
239
|
+
disabled: disabled || group.disabled,
|
|
64
240
|
className: cn('gap-1', className),
|
|
65
241
|
...props
|
|
66
|
-
})
|
|
242
|
+
});
|
|
243
|
+
});
|
|
67
244
|
InputGroupButton.displayName = 'InputGroupButton';
|
|
245
|
+
const inputGroupTriggerVariants = cva('flex w-full min-w-0 flex-1 gap-2 rounded-none border-0 bg-transparent text-left font-normal shadow-none hover:bg-transparent focus-visible:ring-offset-0 future:text-foreground future:hover:text-foreground', {
|
|
246
|
+
variants: {
|
|
247
|
+
layout: {
|
|
248
|
+
row: 'h-full min-h-5 justify-between p-0 focus-visible:ring-0',
|
|
249
|
+
block: 'h-auto min-h-9 justify-start px-0 focus-visible:ring-0 future:min-h-10'
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
defaultVariants: {
|
|
253
|
+
layout: 'row'
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
const InputGroupTrigger = /*#__PURE__*/ forwardRef(({ className, type = 'button', disabled, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, ...props }, ref)=>{
|
|
257
|
+
const group = useInputGroup();
|
|
258
|
+
const { layout } = group;
|
|
259
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
260
|
+
ref: ref,
|
|
261
|
+
type: type,
|
|
262
|
+
variant: "ghost",
|
|
263
|
+
disabled: disabled || group.disabled,
|
|
264
|
+
className: cn(inputGroupTriggerVariants({
|
|
265
|
+
layout: 'block' === layout ? 'block' : 'row'
|
|
266
|
+
}), className),
|
|
267
|
+
...props,
|
|
268
|
+
...controlValidation(group, {
|
|
269
|
+
'aria-invalid': ariaInvalid,
|
|
270
|
+
'aria-describedby': ariaDescribedBy,
|
|
271
|
+
'aria-errormessage': ariaErrorMessage
|
|
272
|
+
}),
|
|
273
|
+
"data-slot": "input-group-control"
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
InputGroupTrigger.displayName = 'InputGroupTrigger';
|
|
277
|
+
function isEmpty(children) {
|
|
278
|
+
return null == children || false === children || '' === children;
|
|
279
|
+
}
|
|
280
|
+
const InputGroupPopoverTrigger = /*#__PURE__*/ forwardRef(({ children, placeholder, caret = true, ...props }, ref)=>{
|
|
281
|
+
const { anchor } = useInputGroup();
|
|
282
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
283
|
+
children: [
|
|
284
|
+
/*#__PURE__*/ jsx(PopoverTrigger, {
|
|
285
|
+
asChild: true,
|
|
286
|
+
children: /*#__PURE__*/ jsxs(InputGroupTrigger, {
|
|
287
|
+
ref: ref,
|
|
288
|
+
...props,
|
|
289
|
+
children: [
|
|
290
|
+
isEmpty(children) ? void 0 !== placeholder && /*#__PURE__*/ jsx("span", {
|
|
291
|
+
"data-slot": "input-group-placeholder",
|
|
292
|
+
className: "truncate text-muted-foreground",
|
|
293
|
+
children: placeholder
|
|
294
|
+
}) : children,
|
|
295
|
+
caret && /*#__PURE__*/ jsx(ChevronDown, {
|
|
296
|
+
className: "ml-auto shrink-0 text-muted-foreground"
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
})
|
|
300
|
+
}),
|
|
301
|
+
anchor && /*#__PURE__*/ jsx(PopoverAnchor, {
|
|
302
|
+
virtualRef: anchor
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
InputGroupPopoverTrigger.displayName = 'InputGroupPopoverTrigger';
|
|
68
308
|
const InputGroupText = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("span", {
|
|
69
309
|
ref: ref,
|
|
70
310
|
className: cn('flex items-center gap-1 text-sm text-muted-foreground [&>svg:not([class*="size-"])]:size-4', className),
|
|
71
311
|
...props
|
|
72
312
|
}));
|
|
73
313
|
InputGroupText.displayName = 'InputGroupText';
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return /*#__PURE__*/ jsx(
|
|
81
|
-
|
|
314
|
+
const FORCED_GROUP = {
|
|
315
|
+
...NO_GROUP,
|
|
316
|
+
inGroup: true
|
|
317
|
+
};
|
|
318
|
+
const InputGroupInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
319
|
+
const group = useInputGroup();
|
|
320
|
+
return /*#__PURE__*/ jsx(InputGroupContext.Provider, {
|
|
321
|
+
value: group.inGroup ? group : FORCED_GROUP,
|
|
82
322
|
children: /*#__PURE__*/ jsx(Input, {
|
|
83
323
|
ref: ref,
|
|
84
|
-
"data-slot": "input-group-control",
|
|
85
|
-
"aria-describedby": describedBy || void 0,
|
|
86
|
-
"aria-errormessage": validation.error ? validation.errorId : ariaErrorMessage,
|
|
87
|
-
"aria-invalid": validation.error ? true : ariaInvalid,
|
|
88
|
-
className: cn('h-full w-full rounded-none !border-0 !ring-0 bg-transparent p-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 future:h-full future:rounded-none future:border-0 future:bg-transparent future:p-0 future:focus-visible:ring-offset-0', className),
|
|
89
324
|
...props
|
|
90
325
|
})
|
|
91
326
|
});
|
|
92
327
|
});
|
|
93
328
|
InputGroupInput.displayName = 'InputGroupInput';
|
|
94
|
-
const InputGroupTextarea = /*#__PURE__*/ forwardRef((
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"data-slot": "input-group-control",
|
|
103
|
-
"aria-describedby": describedBy || void 0,
|
|
104
|
-
"aria-errormessage": validation.error ? validation.errorId : ariaErrorMessage,
|
|
105
|
-
"aria-invalid": validation.error ? true : ariaInvalid,
|
|
106
|
-
className: cn('min-h-0 flex-1 resize-none rounded-none !border-0 !ring-0 bg-transparent p-0 py-2 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 future:rounded-none future:border-0 future:bg-transparent future:focus-visible:ring-offset-0', className),
|
|
107
|
-
...props
|
|
329
|
+
const InputGroupTextarea = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
330
|
+
const group = useInputGroup();
|
|
331
|
+
return /*#__PURE__*/ jsx(InputGroupContext.Provider, {
|
|
332
|
+
value: group.inGroup ? group : FORCED_GROUP,
|
|
333
|
+
children: /*#__PURE__*/ jsx(Textarea, {
|
|
334
|
+
ref: ref,
|
|
335
|
+
...props
|
|
336
|
+
})
|
|
108
337
|
});
|
|
109
338
|
});
|
|
110
339
|
InputGroupTextarea.displayName = 'InputGroupTextarea';
|
|
111
|
-
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
340
|
+
export { InputGroup, InputGroupAddon, InputGroupBody, InputGroupButton, InputGroupInput, InputGroupPopoverTrigger, InputGroupRow, InputGroupText, InputGroupTextarea, InputGroupTrigger, inputGroupVariants, useInputGroup };
|
|
@@ -30,27 +30,38 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
31
|
const utils_cjs_namespaceObject = require("../../lib/utils.cjs");
|
|
32
32
|
const external_form_field_cjs_namespaceObject = require("./form-field.cjs");
|
|
33
|
-
const
|
|
33
|
+
const external_input_group_context_cjs_namespaceObject = require("./input-group-context.cjs");
|
|
34
|
+
const IN_GROUP_CLASS = 'h-full w-full rounded-none !border-0 !ring-0 bg-transparent p-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 future:h-full future:rounded-none future:border-0 future:bg-transparent future:p-0 future:focus-visible:ring-offset-0';
|
|
35
|
+
const Input = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, className, error, errorId, id, type, variant: variantProp = 'default', size: sizeProp = 'default', ...props }, ref)=>{
|
|
36
|
+
const group = (0, external_input_group_context_cjs_namespaceObject.useInputGroup)();
|
|
37
|
+
const variant = group.inGroup ? 'default' : variantProp;
|
|
38
|
+
const size = group.inGroup ? 'default' : sizeProp;
|
|
34
39
|
const generatedId = external_react_namespaceObject.useId();
|
|
35
40
|
const validationId = errorId ?? `${id ?? `input-${generatedId.replace(/:/g, '')}`}-error`;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
const validation = (0, external_input_group_context_cjs_namespaceObject.useControlValidation)(group, {
|
|
42
|
+
error,
|
|
43
|
+
errorId: validationId,
|
|
44
|
+
'aria-invalid': ariaInvalid,
|
|
45
|
+
'aria-describedby': ariaDescribedBy,
|
|
46
|
+
'aria-errormessage': ariaErrorMessage
|
|
47
|
+
});
|
|
48
|
+
const input = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("input", {
|
|
49
|
+
type: type,
|
|
50
|
+
"data-slot": group.inGroup ? 'input-group-control' : 'input',
|
|
51
|
+
id: id,
|
|
52
|
+
...props,
|
|
53
|
+
...validation.aria,
|
|
54
|
+
disabled: props.disabled || group.disabled,
|
|
55
|
+
className: (0, utils_cjs_namespaceObject.cn)('flex w-full transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring read-only:cursor-default disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-error aria-invalid:focus-visible:ring-error', 'default' === size && 'h-9 rounded-md px-3 py-1 text-base placeholder:text-muted-foreground md:text-sm', 'xs' === size && 'h-6 rounded px-2 text-xs placeholder:text-muted-foreground', 'default' === variant && 'border border-input bg-transparent', 'ghost' === variant && 'border-0 bg-surface-overlay', 'default' === variant && 'default' === size && 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:py-2 future:text-sm future:placeholder:text-foreground-muted future:placeholder:font-normal future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background future:aria-invalid:ring-1 future:aria-invalid:ring-error/40', group.inGroup && IN_GROUP_CLASS, className),
|
|
56
|
+
ref: ref
|
|
57
|
+
});
|
|
40
58
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
41
59
|
children: [
|
|
42
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"aria-describedby": describedBy || void 0,
|
|
48
|
-
"aria-errormessage": error ? validationId : ariaErrorMessage,
|
|
49
|
-
"aria-invalid": error ? true : ariaInvalid,
|
|
50
|
-
className: (0, utils_cjs_namespaceObject.cn)('flex w-full transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring read-only:cursor-default disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-error aria-invalid:focus-visible:ring-error', 'default' === size && 'h-9 rounded-md px-3 py-1 text-base placeholder:text-muted-foreground md:text-sm', 'xs' === size && 'h-6 rounded px-2 text-xs placeholder:text-muted-foreground', 'default' === variant && 'border border-input bg-transparent', 'ghost' === variant && 'border-0 bg-surface-overlay', 'default' === variant && 'default' === size && 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:py-2 future:text-sm future:placeholder:text-foreground-muted future:placeholder:font-normal future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background future:aria-invalid:ring-1 future:aria-invalid:ring-error/40', className),
|
|
51
|
-
ref: ref
|
|
52
|
-
}),
|
|
53
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_cjs_namespaceObject.FormFieldError, {
|
|
60
|
+
group.inGroup ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
61
|
+
className: "min-w-0 flex-1",
|
|
62
|
+
children: input
|
|
63
|
+
}) : input,
|
|
64
|
+
validation.ownMessage && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_cjs_namespaceObject.FormFieldError, {
|
|
54
65
|
id: validationId,
|
|
55
66
|
children: error
|
|
56
67
|
})
|
|
@@ -2,27 +2,38 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useId } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
4
|
import { FormFieldError } from "./form-field.js";
|
|
5
|
-
|
|
5
|
+
import { useControlValidation, useInputGroup } from "./input-group-context.js";
|
|
6
|
+
const IN_GROUP_CLASS = 'h-full w-full rounded-none !border-0 !ring-0 bg-transparent p-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 future:h-full future:rounded-none future:border-0 future:bg-transparent future:p-0 future:focus-visible:ring-offset-0';
|
|
7
|
+
const Input = /*#__PURE__*/ forwardRef(({ 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, className, error, errorId, id, type, variant: variantProp = 'default', size: sizeProp = 'default', ...props }, ref)=>{
|
|
8
|
+
const group = useInputGroup();
|
|
9
|
+
const variant = group.inGroup ? 'default' : variantProp;
|
|
10
|
+
const size = group.inGroup ? 'default' : sizeProp;
|
|
6
11
|
const generatedId = useId();
|
|
7
12
|
const validationId = errorId ?? `${id ?? `input-${generatedId.replace(/:/g, '')}`}-error`;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
const validation = useControlValidation(group, {
|
|
14
|
+
error,
|
|
15
|
+
errorId: validationId,
|
|
16
|
+
'aria-invalid': ariaInvalid,
|
|
17
|
+
'aria-describedby': ariaDescribedBy,
|
|
18
|
+
'aria-errormessage': ariaErrorMessage
|
|
19
|
+
});
|
|
20
|
+
const input = /*#__PURE__*/ jsx("input", {
|
|
21
|
+
type: type,
|
|
22
|
+
"data-slot": group.inGroup ? 'input-group-control' : 'input',
|
|
23
|
+
id: id,
|
|
24
|
+
...props,
|
|
25
|
+
...validation.aria,
|
|
26
|
+
disabled: props.disabled || group.disabled,
|
|
27
|
+
className: cn('flex w-full transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring read-only:cursor-default disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-error aria-invalid:focus-visible:ring-error', 'default' === size && 'h-9 rounded-md px-3 py-1 text-base placeholder:text-muted-foreground md:text-sm', 'xs' === size && 'h-6 rounded px-2 text-xs placeholder:text-muted-foreground', 'default' === variant && 'border border-input bg-transparent', 'ghost' === variant && 'border-0 bg-surface-overlay', 'default' === variant && 'default' === size && 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:py-2 future:text-sm future:placeholder:text-foreground-muted future:placeholder:font-normal future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background future:aria-invalid:ring-1 future:aria-invalid:ring-error/40', group.inGroup && IN_GROUP_CLASS, className),
|
|
28
|
+
ref: ref
|
|
29
|
+
});
|
|
12
30
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
13
31
|
children: [
|
|
14
|
-
/*#__PURE__*/ jsx("
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"aria-describedby": describedBy || void 0,
|
|
20
|
-
"aria-errormessage": error ? validationId : ariaErrorMessage,
|
|
21
|
-
"aria-invalid": error ? true : ariaInvalid,
|
|
22
|
-
className: cn('flex w-full transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring read-only:cursor-default disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-error aria-invalid:focus-visible:ring-error', 'default' === size && 'h-9 rounded-md px-3 py-1 text-base placeholder:text-muted-foreground md:text-sm', 'xs' === size && 'h-6 rounded px-2 text-xs placeholder:text-muted-foreground', 'default' === variant && 'border border-input bg-transparent', 'ghost' === variant && 'border-0 bg-surface-overlay', 'default' === variant && 'default' === size && 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:py-2 future:text-sm future:placeholder:text-foreground-muted future:placeholder:font-normal future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background future:aria-invalid:ring-1 future:aria-invalid:ring-error/40', className),
|
|
23
|
-
ref: ref
|
|
24
|
-
}),
|
|
25
|
-
/*#__PURE__*/ jsx(FormFieldError, {
|
|
32
|
+
group.inGroup ? /*#__PURE__*/ jsx("div", {
|
|
33
|
+
className: "min-w-0 flex-1",
|
|
34
|
+
children: input
|
|
35
|
+
}) : input,
|
|
36
|
+
validation.ownMessage && /*#__PURE__*/ jsx(FormFieldError, {
|
|
26
37
|
id: validationId,
|
|
27
38
|
children: error
|
|
28
39
|
})
|