@uipath/apollo-wind 2.56.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.
Files changed (67) hide show
  1. package/dist/components/ui/combobox.cjs +33 -15
  2. package/dist/components/ui/combobox.js +33 -15
  3. package/dist/components/ui/date-picker.cjs +62 -26
  4. package/dist/components/ui/date-picker.js +62 -26
  5. package/dist/components/ui/datetime-picker.cjs +29 -12
  6. package/dist/components/ui/datetime-picker.js +29 -12
  7. package/dist/components/ui/dropdown-menu.cjs +12 -8
  8. package/dist/components/ui/dropdown-menu.js +12 -8
  9. package/dist/components/ui/field-actions/ai-assist-action.cjs +121 -0
  10. package/dist/components/ui/field-actions/ai-assist-action.d.ts +21 -0
  11. package/dist/components/ui/field-actions/ai-assist-action.js +84 -0
  12. package/dist/components/ui/field-actions/collapse.cjs +44 -0
  13. package/dist/components/ui/field-actions/collapse.d.ts +6 -0
  14. package/dist/components/ui/field-actions/collapse.js +4 -0
  15. package/dist/components/ui/field-actions/index.cjs +46 -0
  16. package/dist/components/ui/field-actions/index.d.ts +2 -0
  17. package/dist/components/ui/field-actions/index.js +3 -0
  18. package/dist/components/ui/field-actions/insert-variable-action.cjs +94 -0
  19. package/dist/components/ui/field-actions/insert-variable-action.d.ts +22 -0
  20. package/dist/components/ui/field-actions/insert-variable-action.js +57 -0
  21. package/dist/components/ui/field-addons/index.cjs +50 -0
  22. package/dist/components/ui/field-addons/index.d.ts +3 -0
  23. package/dist/components/ui/field-addons/index.js +4 -0
  24. package/dist/components/ui/field-addons/value-mode-indicator.cjs +57 -0
  25. package/dist/components/ui/field-addons/value-mode-indicator.d.ts +13 -0
  26. package/dist/components/ui/field-addons/value-mode-indicator.js +23 -0
  27. package/dist/components/ui/field-addons/value-mode-menu.cjs +149 -0
  28. package/dist/components/ui/field-addons/value-mode-menu.d.ts +69 -0
  29. package/dist/components/ui/field-addons/value-mode-menu.js +112 -0
  30. package/dist/components/ui/field-addons/value-mode-strings.cjs +69 -0
  31. package/dist/components/ui/field-addons/value-mode-strings.d.ts +32 -0
  32. package/dist/components/ui/field-addons/value-mode-strings.js +29 -0
  33. package/dist/components/ui/form-field.cjs +42 -5
  34. package/dist/components/ui/form-field.d.ts +21 -1
  35. package/dist/components/ui/form-field.js +36 -2
  36. package/dist/components/ui/index.cjs +148 -128
  37. package/dist/components/ui/index.d.ts +2 -0
  38. package/dist/components/ui/index.js +2 -0
  39. package/dist/components/ui/input-group-context.cjs +91 -0
  40. package/dist/components/ui/input-group-context.d.ts +69 -0
  41. package/dist/components/ui/input-group-context.js +42 -0
  42. package/dist/components/ui/input-group.cjs +303 -56
  43. package/dist/components/ui/input-group.d.ts +70 -3
  44. package/dist/components/ui/input-group.js +285 -56
  45. package/dist/components/ui/input.cjs +28 -17
  46. package/dist/components/ui/input.js +28 -17
  47. package/dist/components/ui/lockable-value-field/components/field-header.cjs +16 -114
  48. package/dist/components/ui/lockable-value-field/components/field-header.js +14 -112
  49. package/dist/components/ui/lockable-value-field/lockable-value-field.cjs +4 -12
  50. package/dist/components/ui/lockable-value-field/lockable-value-field.js +4 -12
  51. package/dist/components/ui/multi-select.cjs +82 -58
  52. package/dist/components/ui/multi-select.js +84 -60
  53. package/dist/components/ui/popover.cjs +13 -9
  54. package/dist/components/ui/popover.js +13 -9
  55. package/dist/components/ui/select.cjs +89 -27
  56. package/dist/components/ui/select.d.ts +4 -0
  57. package/dist/components/ui/select.js +90 -28
  58. package/dist/components/ui/textarea.cjs +16 -11
  59. package/dist/components/ui/textarea.js +16 -11
  60. package/dist/index.cjs +61 -11
  61. package/dist/index.d.ts +8 -4
  62. package/dist/index.js +5 -3
  63. package/dist/styles.css +242 -5
  64. package/package.json +1 -1
  65. package/dist/components/ui/lockable-value-field/components/mode-menu-item.cjs +0 -63
  66. package/dist/components/ui/lockable-value-field/components/mode-menu-item.d.ts +0 -9
  67. package/dist/components/ui/lockable-value-field/components/mode-menu-item.js +0 -29
@@ -3,31 +3,98 @@ import * as React from 'react';
3
3
  import { type ButtonProps } from './button';
4
4
  import { type InputProps } from './input';
5
5
  import { type TextareaProps } from './textarea';
6
+ import { type InputGroupLayout, useInputGroup } from './input-group-context';
7
+ export type { InputGroupLayout, InputGroupState } from './input-group-context';
6
8
  export interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement> {
7
- variant?: 'default' | 'ghost';
9
+ /**
10
+ * `default` paints the field box, `ghost` a borderless fill, `outline` a border with no fill and
11
+ * no ring, and `none` nothing at all while keeping the row's height and right-hand padding, so an
12
+ * unboxed control still lines up with the boxed fields around it.
13
+ */
14
+ variant?: 'default' | 'ghost' | 'outline' | 'none';
8
15
  size?: 'default' | 'xs';
16
+ /**
17
+ * `row` is one control row. `grow` keeps that as a minimum and lets the content grow it. `block`
18
+ * stacks an `InputGroupRow` above an `InputGroupBody`, with no padding of its own. `fill` hands
19
+ * the height to a multi-line editor and drops the padding the editor draws itself.
20
+ */
21
+ layout?: InputGroupLayout;
22
+ /** Draws the invalid state for a control that cannot carry `aria-invalid` itself (a code editor). */
23
+ invalid?: boolean;
24
+ /** Draws the disabled state for a control that cannot be `:disabled` itself. */
25
+ disabled?: boolean;
9
26
  /** Field-specific validation feedback rendered below the grouped control. */
10
27
  error?: React.ReactNode;
11
28
  /** Optional id for the inline validation message. */
12
29
  errorId?: string;
13
30
  }
31
+ declare const inputGroupVariants: (props?: ({
32
+ size?: "default" | "xs" | null | undefined;
33
+ layout?: "fill" | "row" | "block" | "grow" | null | undefined;
34
+ variant?: "default" | "outline" | "ghost" | "none" | null | undefined;
35
+ invalid?: boolean | null | undefined;
36
+ disabled?: boolean | null | undefined;
37
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
38
  declare const InputGroup: React.ForwardRefExoticComponent<InputGroupProps & React.RefAttributes<HTMLDivElement>>;
15
39
  declare const inputGroupAddonVariants: (props?: ({
16
40
  align?: "inline-end" | "inline-start" | null | undefined;
41
+ layout?: "fill" | "row" | "block" | "grow" | null | undefined;
17
42
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
18
- export interface InputGroupAddonProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof inputGroupAddonVariants> {
43
+ export interface InputGroupAddonProps extends React.HTMLAttributes<HTMLDivElement>, Pick<VariantProps<typeof inputGroupAddonVariants>, 'align'> {
44
+ /**
45
+ * Focus the group's `[data-slot=input-group-control]` when the addon's own surface is clicked.
46
+ * Turn off for an addon whose clicks mean something else.
47
+ */
48
+ focusControlOnClick?: boolean;
19
49
  }
20
50
  declare const InputGroupAddon: React.ForwardRefExoticComponent<InputGroupAddonProps & React.RefAttributes<HTMLDivElement>>;
51
+ export interface InputGroupRowProps extends React.HTMLAttributes<HTMLDivElement> {
52
+ }
53
+ /**
54
+ * The first row of a `layout="block"` group, holding the control and its addons. The box has no
55
+ * padding in that layout, so the row carries the box's usual padding and trailing trim. Padding the
56
+ * control instead would inset its caret out of line with other fields.
57
+ */
58
+ declare const InputGroupRow: React.ForwardRefExoticComponent<InputGroupRowProps & React.RefAttributes<HTMLDivElement>>;
59
+ export interface InputGroupBodyProps extends React.HTMLAttributes<HTMLDivElement> {
60
+ }
61
+ /**
62
+ * Content below a `layout="block"` group's first row, behind a divider. Controls here are standard
63
+ * fields with their own box, message and popovers; one that needs addons takes its own InputGroup.
64
+ * The divider goes when there is nothing to divide: an empty body, or a closed Radix collapsible,
65
+ * which leaves its content in place and `hidden`.
66
+ */
67
+ declare const InputGroupBody: React.ForwardRefExoticComponent<InputGroupBodyProps & React.RefAttributes<HTMLDivElement>>;
21
68
  export interface InputGroupButtonProps extends ButtonProps {
22
69
  }
23
70
  declare const InputGroupButton: React.ForwardRefExoticComponent<InputGroupButtonProps & React.RefAttributes<HTMLButtonElement>>;
71
+ export interface InputGroupTriggerProps extends Omit<ButtonProps, 'variant' | 'size' | 'icon'> {
72
+ }
73
+ /**
74
+ * A Button rendered as the group's control, for pickers that open a list or a collapsible. In a
75
+ * `layout="block"` group it is the first row, whose height is its content's.
76
+ */
77
+ declare const InputGroupTrigger: React.ForwardRefExoticComponent<InputGroupTriggerProps & React.RefAttributes<HTMLButtonElement>>;
78
+ export interface InputGroupPopoverTriggerProps extends InputGroupTriggerProps {
79
+ /** Shown, dimmed, when there are no children to show. */
80
+ placeholder?: React.ReactNode;
81
+ /** Draws the trailing caret. Pass `false` for a trigger that brings its own. */
82
+ caret?: boolean;
83
+ }
84
+ /**
85
+ * A popover's trigger as the group's control. Must be rendered inside a `Popover`. The panel
86
+ * anchors to the group's box, so it opens below the border at the box's width.
87
+ */
88
+ declare const InputGroupPopoverTrigger: React.ForwardRefExoticComponent<InputGroupPopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
24
89
  export interface InputGroupTextProps extends React.HTMLAttributes<HTMLSpanElement> {
25
90
  }
26
91
  declare const InputGroupText: React.ForwardRefExoticComponent<InputGroupTextProps & React.RefAttributes<HTMLSpanElement>>;
27
92
  export interface InputGroupInputProps extends Omit<InputProps, 'variant' | 'size' | 'error' | 'errorId'> {
28
93
  }
94
+ /** `Input` as the group's control. Inside an InputGroup a plain `Input` is the same; kept for shadcn parity. */
29
95
  declare const InputGroupInput: React.ForwardRefExoticComponent<InputGroupInputProps & React.RefAttributes<HTMLInputElement>>;
30
96
  export interface InputGroupTextareaProps extends Omit<TextareaProps, 'variant' | 'error' | 'errorId'> {
31
97
  }
98
+ /** `Textarea` as the group's control. Inside an InputGroup a plain `Textarea` is the same; kept for shadcn parity. */
32
99
  declare const InputGroupTextarea: React.ForwardRefExoticComponent<Omit<InputGroupTextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
33
- export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
100
+ export { InputGroup, InputGroupAddon, InputGroupBody, InputGroupButton, InputGroupInput, InputGroupPopoverTrigger, InputGroupRow, InputGroupText, InputGroupTextarea, InputGroupTrigger, inputGroupVariants, useInputGroup, };
@@ -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 { createContext, forwardRef, useContext, useId } from "react";
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
- const InputGroupValidationContext = /*#__PURE__*/ createContext({});
10
- const InputGroup = /*#__PURE__*/ forwardRef(({ className, error, errorId, variant = 'default', size = 'default', ...props }, ref)=>{
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
- return /*#__PURE__*/ jsxs(InputGroupValidationContext.Provider, {
14
- value: {
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: ref,
146
+ ref: setBox,
21
147
  role: "group",
22
- className: cn('group/input-group relative flex w-full items-center gap-2 transition-colors has-[>textarea]:h-auto has-[>textarea]:items-start', 'default' === size && 'h-9 rounded-md px-3 py-1 future:h-10 future:rounded-xl future:py-2', 'xs' === size && 'h-6 gap-1 rounded px-2', 'default' === variant && 'border border-input bg-transparent future:border-0 future:bg-surface-overlay', 'ghost' === variant && 'border-0 bg-surface-overlay', 'has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring future:has-[[data-slot=input-group-control]:focus-visible]:ring-offset-2 future:has-[[data-slot=input-group-control]:focus-visible]:ring-offset-background', 'has-[[data-slot][aria-invalid=true]]:border-error 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', error && 'border-error ring-error/20 future:ring-1 future:ring-error/40', 'has-[[data-slot=input-group-control]:disabled]:cursor-not-allowed has-[[data-slot=input-group-control]:disabled]:opacity-50', className),
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 InputGroupAddon = /*#__PURE__*/ forwardRef(({ className, align = 'inline-start', onClick, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
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
- role: "group",
47
- "data-slot": "input-group-addon",
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
- InputGroupAddon.displayName = 'InputGroupAddon';
59
- const InputGroupButton = /*#__PURE__*/ forwardRef(({ className, type = 'button', variant = 'ghost', size = 'xs', ...props }, ref)=>/*#__PURE__*/ jsx(Button, {
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 InputGroupInput = /*#__PURE__*/ forwardRef(({ 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, className, ...props }, ref)=>{
75
- const validation = useContext(InputGroupValidationContext);
76
- const describedBy = [
77
- ariaDescribedBy,
78
- validation.error ? validation.errorId : void 0
79
- ].filter(Boolean).join(' ');
80
- return /*#__PURE__*/ jsx("div", {
81
- className: "min-w-0 flex-1",
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(({ 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, className, ...props }, ref)=>{
95
- const validation = useContext(InputGroupValidationContext);
96
- const describedBy = [
97
- ariaDescribedBy,
98
- validation.error ? validation.errorId : void 0
99
- ].filter(Boolean).join(' ');
100
- return /*#__PURE__*/ jsx(Textarea, {
101
- ref: ref,
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 Input = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, className, error, errorId, id, type, variant = 'default', size = 'default', ...props }, ref)=>{
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 describedBy = [
37
- ariaDescribedBy,
38
- error ? validationId : void 0
39
- ].filter(Boolean).join(' ');
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)("input", {
43
- type: type,
44
- "data-slot": "input",
45
- id: id,
46
- ...props,
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
- const Input = /*#__PURE__*/ forwardRef(({ 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, className, error, errorId, id, type, variant = 'default', size = 'default', ...props }, ref)=>{
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 describedBy = [
9
- ariaDescribedBy,
10
- error ? validationId : void 0
11
- ].filter(Boolean).join(' ');
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("input", {
15
- type: type,
16
- "data-slot": "input",
17
- id: id,
18
- ...props,
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
  })