@uipath/apollo-wind 2.59.0 → 2.60.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.
Files changed (54) hide show
  1. package/README.md +13 -0
  2. package/dist/components/ui/accordion.cjs +1 -0
  3. package/dist/components/ui/accordion.js +1 -0
  4. package/dist/components/ui/datetime-picker.cjs +19 -3
  5. package/dist/components/ui/datetime-picker.d.ts +2 -0
  6. package/dist/components/ui/datetime-picker.js +19 -3
  7. package/dist/components/ui/dialog.cjs +1 -0
  8. package/dist/components/ui/dialog.js +1 -0
  9. package/dist/components/ui/drawer.cjs +1 -1
  10. package/dist/components/ui/drawer.js +1 -1
  11. package/dist/components/ui/field-actions/insert-variable-action.cjs +1 -1
  12. package/dist/components/ui/field-actions/insert-variable-action.d.ts +5 -2
  13. package/dist/components/ui/field-actions/insert-variable-action.js +1 -1
  14. package/dist/components/ui/field-addons/field-menu.cjs +2 -2
  15. package/dist/components/ui/field-addons/field-menu.d.ts +4 -2
  16. package/dist/components/ui/field-addons/field-menu.js +2 -2
  17. package/dist/components/ui/index.cjs +97 -86
  18. package/dist/components/ui/index.d.ts +1 -0
  19. package/dist/components/ui/index.js +1 -0
  20. package/dist/components/ui/lockable-value-field/index.cjs +5 -5
  21. package/dist/components/ui/lockable-value-field/index.d.ts +18 -3
  22. package/dist/components/ui/lockable-value-field/index.js +2 -2
  23. package/dist/components/ui/quick-form-field/components/field-header.cjs +265 -0
  24. package/dist/components/ui/quick-form-field/components/field-header.d.ts +23 -0
  25. package/dist/components/ui/quick-form-field/components/field-header.js +231 -0
  26. package/dist/components/ui/{lockable-value-field → quick-form-field}/components/lock-toggle-button.cjs +3 -3
  27. package/dist/components/ui/{lockable-value-field → quick-form-field}/components/lock-toggle-button.d.ts +4 -1
  28. package/dist/components/ui/{lockable-value-field → quick-form-field}/components/lock-toggle-button.js +3 -3
  29. package/dist/components/ui/quick-form-field/index.cjs +46 -0
  30. package/dist/components/ui/quick-form-field/index.d.ts +3 -0
  31. package/dist/components/ui/quick-form-field/index.js +3 -0
  32. package/dist/components/ui/{lockable-value-field/lockable-value-field.cjs → quick-form-field/quick-form-field.cjs} +190 -119
  33. package/dist/components/ui/quick-form-field/quick-form-field.d.ts +26 -0
  34. package/dist/components/ui/{lockable-value-field/lockable-value-field.js → quick-form-field/quick-form-field.js} +194 -123
  35. package/dist/components/ui/{lockable-value-field → quick-form-field}/types.cjs +70 -0
  36. package/dist/components/ui/quick-form-field/types.d.ts +245 -0
  37. package/dist/components/ui/quick-form-field/types.js +137 -0
  38. package/dist/components/ui/{lockable-value-field → quick-form-field}/utils.cjs +21 -3
  39. package/dist/components/ui/{lockable-value-field → quick-form-field}/utils.d.ts +8 -3
  40. package/dist/components/ui/{lockable-value-field → quick-form-field}/utils.js +19 -4
  41. package/dist/components/ui/sheet.cjs +2 -2
  42. package/dist/components/ui/sheet.js +2 -2
  43. package/dist/index.cjs +9 -2
  44. package/dist/index.d.ts +4 -2
  45. package/dist/index.js +3 -2
  46. package/dist/styles.css +53 -0
  47. package/dist/tailwind.css +72 -0
  48. package/package.json +1 -1
  49. package/dist/components/ui/lockable-value-field/components/field-header.cjs +0 -242
  50. package/dist/components/ui/lockable-value-field/components/field-header.d.ts +0 -19
  51. package/dist/components/ui/lockable-value-field/components/field-header.js +0 -208
  52. package/dist/components/ui/lockable-value-field/lockable-value-field.d.ts +0 -14
  53. package/dist/components/ui/lockable-value-field/types.d.ts +0 -109
  54. package/dist/components/ui/lockable-value-field/types.js +0 -70
package/README.md CHANGED
@@ -31,6 +31,19 @@ import "@uipath/apollo-wind/fonts/font.css";
31
31
  Classic themes keep Tailwind's default `--font-sans` and need no font import.
32
32
  Apps that already import `@uipath/apollo-react/core/fonts/font.css` are covered.
33
33
 
34
+ **Angular Material hosts:** pages that carry `.mat-typography` inject unlayered
35
+ typography rules, so overlays ship with a Material-scoped shield. Inside such
36
+ hosts the shield outranks plain utilities, so these overrides need the `!`
37
+ modifier (`text-xl!`, `font-bold!`, `mb-4!`):
38
+
39
+ - on `DialogTitle`, `SheetTitle`, `AlertDialogTitle`, `DrawerTitle` and
40
+ `AlertTitle`: font family, size, line-height, weight, letter-spacing and margin;
41
+ - on any other `h1` to `h6` inside an overlay: the same set, plus font style;
42
+ - on any `p` inside an overlay: margin.
43
+
44
+ Spacing between a title and its description should come from the header's
45
+ `gap`, not from margins on the title.
46
+
34
47
  **Option 1: Zero Config** (Recommended for quick starts)
35
48
 
36
49
  ```tsx
@@ -49,6 +49,7 @@ const AccordionItem = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({
49
49
  }));
50
50
  AccordionItem.displayName = 'AccordionItem';
51
51
  const AccordionTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_accordion_namespaceObject.Header, {
52
+ "data-slot": "accordion-header",
52
53
  className: "flex",
53
54
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_accordion_namespaceObject.Trigger, {
54
55
  ref: ref,
@@ -18,6 +18,7 @@ const AccordionItem = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/
18
18
  }));
19
19
  AccordionItem.displayName = 'AccordionItem';
20
20
  const AccordionTrigger = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsx(Header, {
21
+ "data-slot": "accordion-header",
21
22
  className: "flex",
22
23
  children: /*#__PURE__*/ jsxs(Trigger, {
23
24
  ref: ref,
@@ -39,12 +39,28 @@ const external_popover_cjs_namespaceObject = require("./popover.cjs");
39
39
  const index_cjs_namespaceObject = require("../../lib/index.cjs");
40
40
  const external_form_field_cjs_namespaceObject = require("./form-field.cjs");
41
41
  const external_input_group_context_cjs_namespaceObject = require("./input-group-context.cjs");
42
- const datetime_picker_DateTimePicker = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ value, onValueChange, disabled, placeholder = 'Pick a date and time', className, use12Hour = false, id, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
43
- const [open, setOpen] = external_react_namespaceObject.useState(false);
42
+ const datetime_picker_DateTimePicker = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ value, onValueChange, onOpenChange, disabled, placeholder = 'Pick a date and time', className, use12Hour = false, id, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
43
+ const [open, setOpenState] = external_react_namespaceObject.useState(false);
44
+ const setOpen = (next)=>{
45
+ setOpenState(next);
46
+ onOpenChange?.(next);
47
+ };
44
48
  const generatedId = external_react_namespaceObject.useId();
45
49
  const validationId = errorId ?? `${id ?? `datetime-picker-${generatedId.replace(/:/g, '')}`}-error`;
46
50
  const [selectedDate, setSelectedDate] = external_react_namespaceObject.useState(value);
47
- const [timeValue, setTimeValue] = external_react_namespaceObject.useState(value ? (0, external_date_fns_namespaceObject.format)(value, use12Hour ? 'hh:mm a' : 'HH:mm') : '');
51
+ const [timeValue, setTimeValue] = external_react_namespaceObject.useState(value ? (0, external_date_fns_namespaceObject.format)(value, 'HH:mm') : '');
52
+ const valueTime = value?.getTime();
53
+ const [seededTime, setSeededTime] = external_react_namespaceObject.useState(valueTime);
54
+ if (!Object.is(valueTime, seededTime)) {
55
+ setSeededTime(valueTime);
56
+ if (void 0 === value) {
57
+ setSelectedDate(void 0);
58
+ setTimeValue('');
59
+ } else if (!Number.isNaN(valueTime)) {
60
+ setSelectedDate(value);
61
+ setTimeValue((0, external_date_fns_namespaceObject.format)(value, 'HH:mm'));
62
+ }
63
+ }
48
64
  const handleDateSelect = (date)=>{
49
65
  if (!date) return;
50
66
  if (selectedDate) {
@@ -4,6 +4,8 @@ export interface DateTimePickerProps {
4
4
  id?: string;
5
5
  value?: Date;
6
6
  onValueChange?: (date: Date | undefined) => void;
7
+ /** Called when the picker opens or closes, e.g. to commit the value on close. */
8
+ onOpenChange?: (open: boolean) => void;
7
9
  disabled?: boolean;
8
10
  placeholder?: string;
9
11
  className?: string;
@@ -11,12 +11,28 @@ import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
11
11
  import { cn } from "../../lib/index.js";
12
12
  import { FormFieldError } from "./form-field.js";
13
13
  import { useControlValidation, useInputGroup } from "./input-group-context.js";
14
- const datetime_picker_DateTimePicker = /*#__PURE__*/ forwardRef(function({ value, onValueChange, disabled, placeholder = 'Pick a date and time', className, use12Hour = false, id, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
15
- const [open, setOpen] = useState(false);
14
+ const datetime_picker_DateTimePicker = /*#__PURE__*/ forwardRef(function({ value, onValueChange, onOpenChange, disabled, placeholder = 'Pick a date and time', className, use12Hour = false, id, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
15
+ const [open, setOpenState] = useState(false);
16
+ const setOpen = (next)=>{
17
+ setOpenState(next);
18
+ onOpenChange?.(next);
19
+ };
16
20
  const generatedId = useId();
17
21
  const validationId = errorId ?? `${id ?? `datetime-picker-${generatedId.replace(/:/g, '')}`}-error`;
18
22
  const [selectedDate, setSelectedDate] = useState(value);
19
- const [timeValue, setTimeValue] = useState(value ? format(value, use12Hour ? 'hh:mm a' : 'HH:mm') : '');
23
+ const [timeValue, setTimeValue] = useState(value ? format(value, 'HH:mm') : '');
24
+ const valueTime = value?.getTime();
25
+ const [seededTime, setSeededTime] = useState(valueTime);
26
+ if (!Object.is(valueTime, seededTime)) {
27
+ setSeededTime(valueTime);
28
+ if (void 0 === value) {
29
+ setSelectedDate(void 0);
30
+ setTimeValue('');
31
+ } else if (!Number.isNaN(valueTime)) {
32
+ setSelectedDate(value);
33
+ setTimeValue(format(value, 'HH:mm'));
34
+ }
35
+ }
20
36
  const handleDateSelect = (date)=>{
21
37
  if (!date) return;
22
38
  if (selectedDate) {
@@ -158,6 +158,7 @@ const dialog_DialogContent = /*#__PURE__*/ external_react_namespaceObject.forwar
158
158
  className: "flex h-12 shrink-0 items-center gap-3 border-b border-border-subtle px-4",
159
159
  children: [
160
160
  null != headerTitle ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_dialog_namespaceObject.Title, {
161
+ "data-slot": "dialog-takeover-title",
161
162
  className: "min-w-0 flex-1 truncate text-sm font-semibold",
162
163
  children: headerTitle
163
164
  }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
@@ -111,6 +111,7 @@ const dialog_DialogContent = /*#__PURE__*/ forwardRef(function({ className, chil
111
111
  className: "flex h-12 shrink-0 items-center gap-3 border-b border-border-subtle px-4",
112
112
  children: [
113
113
  null != headerTitle ? /*#__PURE__*/ jsx(Title, {
114
+ "data-slot": "dialog-takeover-title",
114
115
  className: "min-w-0 flex-1 truncate text-sm font-semibold",
115
116
  children: headerTitle
116
117
  }) : /*#__PURE__*/ jsx("div", {
@@ -79,7 +79,7 @@ const DrawerContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({
79
79
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_vaul_namespaceObject.Drawer.Content, {
80
80
  ref: ref,
81
81
  "data-slot": "drawer-content",
82
- className: (0, index_cjs_namespaceObject.cn)('fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background', className),
82
+ className: (0, index_cjs_namespaceObject.cn)('fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background text-foreground', className),
83
83
  ...props,
84
84
  children: [
85
85
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
@@ -42,7 +42,7 @@ const DrawerContent = /*#__PURE__*/ forwardRef(({ className, children, container
42
42
  /*#__PURE__*/ jsxs(Drawer.Content, {
43
43
  ref: ref,
44
44
  "data-slot": "drawer-content",
45
- className: cn('fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background', className),
45
+ className: cn('fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background text-foreground', className),
46
46
  ...props,
47
47
  children: [
48
48
  /*#__PURE__*/ jsx("div", {
@@ -60,7 +60,7 @@ function InsertVariableAction({ variables, onInsert, disabled, compact, strings
60
60
  if (open && lazy) setOpenedItems(variables());
61
61
  },
62
62
  onSelect: (variable)=>{
63
- if (variable.value) onInsert?.(variable.value);
63
+ if (variable.value) onInsert?.(variable.value, variable);
64
64
  },
65
65
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
66
66
  type: "button",
@@ -21,8 +21,11 @@ export interface InsertVariableActionProps {
21
21
  * source without re-rendering the field whenever it changes.
22
22
  */
23
23
  variables: VariablePickerItem[] | (() => VariablePickerItem[]);
24
- /** Called with the picked variable's value. Omitted, the action is disabled. */
25
- onInsert?: (value: string) => void;
24
+ /**
25
+ * Called with the picked variable's value, and the picked entry itself so a host can recover
26
+ * whatever it attached to it. Omitted, the action is disabled.
27
+ */
28
+ onInsert?: (value: string, item: VariablePickerItem) => void;
26
29
  disabled?: boolean;
27
30
  /** Icon only. Below a 260px `@container` the action also collapses to its icon by itself. */
28
31
  compact?: boolean;
@@ -31,7 +31,7 @@ function InsertVariableAction({ variables, onInsert, disabled, compact, strings
31
31
  if (open && lazy) setOpenedItems(variables());
32
32
  },
33
33
  onSelect: (variable)=>{
34
- if (variable.value) onInsert?.(variable.value);
34
+ if (variable.value) onInsert?.(variable.value, variable);
35
35
  },
36
36
  children: /*#__PURE__*/ jsxs("button", {
37
37
  type: "button",
@@ -67,7 +67,7 @@ function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, o
67
67
  ]
68
68
  });
69
69
  }
70
- function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, strings }) {
70
+ function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, triggerLabel: triggerLabelOverride, strings }) {
71
71
  const text = {
72
72
  ...external_value_mode_strings_cjs_namespaceObject.DEFAULT_VALUE_MODE_STRINGS,
73
73
  ...strings
@@ -85,7 +85,7 @@ function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesD
85
85
  ] : baseModes;
86
86
  const activeMode = resolvedModes.find((item)=>item.id === mode);
87
87
  const TriggerIcon = modesDisabled ? external_lucide_react_namespaceObject.MoreHorizontal : activeMode?.icon ?? external_lucide_react_namespaceObject.Type;
88
- const triggerLabel = modesDisabled ? text.fieldActions : activeMode?.title ?? text.literalTitle;
88
+ const triggerLabel = modesDisabled ? text.fieldActions : triggerLabelOverride ?? activeMode?.title ?? text.literalTitle;
89
89
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
90
90
  children: [
91
91
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
@@ -29,6 +29,8 @@ interface FieldMenuBaseProps<Id extends string> {
29
29
  expectedType?: string;
30
30
  /** Overrides the built-in Fixed value description. */
31
31
  literalDescription?: string;
32
+ /** Names the trigger while it offers modes. Defaults to the active mode's title. */
33
+ triggerLabel?: string;
32
34
  /** Overrides for any subset of the English strings. */
33
35
  strings?: Partial<ValueModeStrings>;
34
36
  }
@@ -49,7 +51,7 @@ type OwnModes<Id extends string> = {
49
51
  };
50
52
  /**
51
53
  * One selectable mode in a value-mode dropdown: icon and label, with an optional description.
52
- * Shared with LockableValueField's mode dropdown, and not exported from the package.
54
+ * Shared with QuickFormField's mode dropdown, and not exported from the package.
53
55
  */
54
56
  export declare function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, onClick, }: {
55
57
  icon: LucideIcon;
@@ -64,5 +66,5 @@ export declare function ValueModeMenuItem({ icon: Icon, label, description, acti
64
66
  * shows the current mode's icon and is named by its title; with the modes hidden it is the field's
65
67
  * overflow menu.
66
68
  */
67
- export declare function FieldMenu<Id extends string = ValueMode>({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, strings, }: FieldMenuProps<Id>): import("react/jsx-runtime").JSX.Element;
69
+ export declare function FieldMenu<Id extends string = ValueMode>({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, triggerLabel: triggerLabelOverride, strings, }: FieldMenuProps<Id>): import("react/jsx-runtime").JSX.Element;
68
70
  export {};
@@ -38,7 +38,7 @@ function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, o
38
38
  ]
39
39
  });
40
40
  }
41
- function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, strings }) {
41
+ function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, triggerLabel: triggerLabelOverride, strings }) {
42
42
  const text = {
43
43
  ...DEFAULT_VALUE_MODE_STRINGS,
44
44
  ...strings
@@ -56,7 +56,7 @@ function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesD
56
56
  ] : baseModes;
57
57
  const activeMode = resolvedModes.find((item)=>item.id === mode);
58
58
  const TriggerIcon = modesDisabled ? MoreHorizontal : activeMode?.icon ?? Type;
59
- const triggerLabel = modesDisabled ? text.fieldActions : activeMode?.title ?? text.literalTitle;
59
+ const triggerLabel = modesDisabled ? text.fieldActions : triggerLabelOverride ?? activeMode?.title ?? text.literalTitle;
60
60
  return /*#__PURE__*/ jsxs(DropdownMenu, {
61
61
  children: [
62
62
  /*#__PURE__*/ jsx(DropdownMenuTrigger, {