@uipath/apollo-wind 2.80.0 → 2.81.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 (40) hide show
  1. package/dist/components/ui/calendar.cjs +5 -2
  2. package/dist/components/ui/calendar.d.ts +1 -1
  3. package/dist/components/ui/calendar.js +5 -2
  4. package/dist/components/ui/date-picker.cjs +27 -14
  5. package/dist/components/ui/date-picker.d.ts +16 -0
  6. package/dist/components/ui/date-picker.js +28 -15
  7. package/dist/components/ui/datetime-picker.cjs +41 -28
  8. package/dist/components/ui/datetime-picker.d.ts +13 -0
  9. package/dist/components/ui/datetime-picker.js +42 -29
  10. package/dist/components/ui/editable-cell.cjs +5 -1
  11. package/dist/components/ui/editable-cell.js +5 -1
  12. package/dist/components/ui/field-addons/field-addon-button.cjs +36 -0
  13. package/dist/components/ui/field-addons/field-addon-button.d.ts +6 -0
  14. package/dist/components/ui/field-addons/field-addon-button.js +2 -0
  15. package/dist/components/ui/field-addons/field-menu.cjs +4 -5
  16. package/dist/components/ui/field-addons/field-menu.js +4 -5
  17. package/dist/components/ui/index.cjs +174 -161
  18. package/dist/components/ui/index.d.ts +1 -0
  19. package/dist/components/ui/index.js +1 -0
  20. package/dist/components/ui/locale-provider.cjs +124 -0
  21. package/dist/components/ui/locale-provider.d.ts +57 -0
  22. package/dist/components/ui/locale-provider.js +78 -0
  23. package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -1
  24. package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -1
  25. package/dist/components/ui/quick-form-field/quick-form-field.cjs +3 -1
  26. package/dist/components/ui/quick-form-field/quick-form-field.js +3 -1
  27. package/dist/components/ui/quick-form-field/utils.cjs +2 -2
  28. package/dist/components/ui/quick-form-field/utils.d.ts +2 -1
  29. package/dist/components/ui/quick-form-field/utils.js +2 -2
  30. package/dist/components/ui/time-field.cjs +191 -0
  31. package/dist/components/ui/time-field.d.ts +24 -0
  32. package/dist/components/ui/time-field.js +157 -0
  33. package/dist/index.cjs +18 -1
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.js +3 -1
  36. package/dist/lib/date-locale.cjs +184 -0
  37. package/dist/lib/date-locale.d.ts +31 -0
  38. package/dist/lib/date-locale.js +129 -0
  39. package/dist/styles.css +23 -0
  40. package/package.json +8 -8
@@ -1,33 +1,45 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { format, isValid } from "date-fns";
2
+ import { isValid } from "date-fns";
3
3
  import { CalendarIcon, Clock } from "lucide-react";
4
4
  import { forwardRef, useId, useState } from "react";
5
5
  import { Button } from "./button.js";
6
6
  import { Calendar } from "./calendar.js";
7
- import { Input } from "./input.js";
8
7
  import { InputGroupPopoverTrigger } from "./input-group.js";
9
- import { Label } from "./label.js";
10
8
  import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
11
9
  import { cn } from "../../lib/index.js";
10
+ import { formatDateTime, resolveUse12Hour } from "../../lib/date-locale.js";
12
11
  import { FormFieldError } from "./form-field.js";
13
12
  import { useControlValidation, useInputGroup } from "./input-group-context.js";
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) {
13
+ import { useDateLocale, useDatePickerStrings } from "./locale-provider.js";
14
+ import { TimeField } from "./time-field.js";
15
+ function timeOf(date) {
16
+ return date ? {
17
+ hours: date.getHours(),
18
+ minutes: date.getMinutes()
19
+ } : void 0;
20
+ }
21
+ const datetime_picker_DateTimePicker = /*#__PURE__*/ forwardRef(function({ value, onValueChange, onOpenChange, disabled, placeholder: placeholderProp, className, use12Hour: use12HourProp, locale: localeProp, strings: stringsProp, id, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
15
22
  const [open, setOpenState] = useState(false);
16
23
  const setOpen = (next)=>{
17
24
  setOpenState(next);
18
25
  onOpenChange?.(next);
19
26
  };
20
27
  const generatedId = useId();
21
- const validationId = errorId ?? `${id ?? `datetime-picker-${generatedId.replace(/:/g, '')}`}-error`;
28
+ const baseId = id ?? `datetime-picker-${generatedId.replace(/:/g, '')}`;
29
+ const validationId = errorId ?? `${baseId}-error`;
30
+ const timeLabelId = `${baseId}-time-label`;
31
+ const locale = useDateLocale(localeProp);
32
+ const strings = useDatePickerStrings(stringsProp);
33
+ const placeholder = placeholderProp ?? strings.pickDateTime;
22
34
  const date = value instanceof Date && isValid(value) ? value : void 0;
23
35
  const [selectedDate, setSelectedDate] = useState(date);
24
- const [timeValue, setTimeValue] = useState(date ? format(date, 'HH:mm') : '');
36
+ const [time, setTime] = useState(()=>timeOf(date));
25
37
  const valueTime = date?.getTime();
26
38
  const [seededTime, setSeededTime] = useState(valueTime);
27
39
  if (!Object.is(valueTime, seededTime)) {
28
40
  setSeededTime(valueTime);
29
41
  setSelectedDate(date);
30
- setTimeValue(date ? format(date, 'HH:mm') : '');
42
+ setTime(timeOf(date));
31
43
  }
32
44
  const handleDateSelect = (date)=>{
33
45
  if (!date) return;
@@ -36,26 +48,22 @@ const datetime_picker_DateTimePicker = /*#__PURE__*/ forwardRef(function({ value
36
48
  date.setMinutes(selectedDate.getMinutes());
37
49
  date.setSeconds(selectedDate.getSeconds());
38
50
  date.setMilliseconds(selectedDate.getMilliseconds());
39
- }
51
+ } else if (time) date.setHours(time.hours, time.minutes);
40
52
  setSelectedDate(date);
41
53
  onValueChange?.(date);
42
54
  };
43
- const handleTimeChange = (e)=>{
44
- const time = e.target.value;
45
- setTimeValue(time);
55
+ const handleTimeChange = (next)=>{
56
+ setTime(next);
46
57
  if (!selectedDate) return;
47
- const [hours, minutes] = time.split(':').map(Number);
48
58
  const newDate = new Date(selectedDate);
49
- newDate.setHours(hours);
50
- newDate.setMinutes(minutes);
59
+ newDate.setHours(next.hours);
60
+ newDate.setMinutes(next.minutes);
51
61
  setSelectedDate(newDate);
52
62
  onValueChange?.(newDate);
53
63
  };
54
64
  const formatDisplayValue = ()=>{
55
65
  if (!selectedDate) return null;
56
- const datePart = format(selectedDate, 'PPP');
57
- const timePart = format(selectedDate, use12Hour ? 'hh:mm a' : 'HH:mm');
58
- return `${datePart} at ${timePart}`;
66
+ return formatDateTime(selectedDate, locale, use12HourProp);
59
67
  };
60
68
  const group = useInputGroup();
61
69
  const grouped = group.inGroup;
@@ -116,25 +124,30 @@ const datetime_picker_DateTimePicker = /*#__PURE__*/ forwardRef(function({ value
116
124
  mode: "single",
117
125
  selected: selectedDate,
118
126
  onSelect: handleDateSelect,
119
- initialFocus: true
127
+ initialFocus: true,
128
+ locale: locale
120
129
  }),
121
130
  /*#__PURE__*/ jsxs("div", {
122
131
  className: "border-t pt-3 space-y-2",
123
132
  children: [
124
- /*#__PURE__*/ jsxs(Label, {
133
+ /*#__PURE__*/ jsxs("div", {
134
+ id: timeLabelId,
125
135
  className: "text-sm font-medium flex items-center gap-2",
126
136
  children: [
127
137
  /*#__PURE__*/ jsx(Clock, {
128
- className: "h-4 w-4"
138
+ className: "h-4 w-4",
139
+ "aria-hidden": "true"
129
140
  }),
130
- "Time"
141
+ strings.time
131
142
  ]
132
143
  }),
133
- /*#__PURE__*/ jsx(Input, {
134
- type: "time",
135
- value: timeValue,
136
- onChange: handleTimeChange,
137
- className: "w-full"
144
+ /*#__PURE__*/ jsx(TimeField, {
145
+ "aria-labelledby": timeLabelId,
146
+ value: time,
147
+ onValueChange: handleTimeChange,
148
+ use12Hour: resolveUse12Hour(use12HourProp, locale),
149
+ locale: locale,
150
+ strings: strings
138
151
  })
139
152
  ]
140
153
  }),
@@ -146,17 +159,17 @@ const datetime_picker_DateTimePicker = /*#__PURE__*/ forwardRef(function({ value
146
159
  className: "w-full",
147
160
  onClick: ()=>{
148
161
  setSelectedDate(void 0);
149
- setTimeValue('');
162
+ setTime(void 0);
150
163
  onValueChange?.(void 0);
151
164
  setOpen(false);
152
165
  },
153
- children: "Clear"
166
+ children: strings.clear
154
167
  }),
155
168
  /*#__PURE__*/ jsx(Button, {
156
169
  className: "w-full",
157
170
  onClick: ()=>setOpen(false),
158
171
  disabled: !selectedDate,
159
- children: "Done"
172
+ children: strings.done
160
173
  })
161
174
  ]
162
175
  })
@@ -36,6 +36,7 @@ const external_input_cjs_namespaceObject = require("./input.cjs");
36
36
  const external_checkbox_cjs_namespaceObject = require("./checkbox.cjs");
37
37
  const external_button_cjs_namespaceObject = require("./button.cjs");
38
38
  const external_calendar_cjs_namespaceObject = require("./calendar.cjs");
39
+ const external_locale_provider_cjs_namespaceObject = require("./locale-provider.cjs");
39
40
  const external_popover_cjs_namespaceObject = require("./popover.cjs");
40
41
  const external_select_cjs_namespaceObject = require("./select.cjs");
41
42
  function EditableCell({ cell, onUpdate }) {
@@ -200,6 +201,7 @@ function createEditableColumn(accessorKey, header, meta) {
200
201
  }
201
202
  function DatePickerCell({ value, onValueChange, onClose, placeholder }) {
202
203
  const [open, setOpen] = external_react_namespaceObject.useState(true);
204
+ const locale = (0, external_locale_provider_cjs_namespaceObject.useDateLocale)();
203
205
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
204
206
  open: open,
205
207
  onOpenChange: (isOpen)=>{
@@ -218,7 +220,9 @@ function DatePickerCell({ value, onValueChange, onClose, placeholder }) {
218
220
  }),
219
221
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
220
222
  className: "truncate",
221
- children: value ? (0, external_date_fns_namespaceObject.format)(value, 'PP') : placeholder
223
+ children: value ? (0, external_date_fns_namespaceObject.format)(value, 'PP', {
224
+ locale
225
+ }) : placeholder
222
226
  })
223
227
  ]
224
228
  })
@@ -7,6 +7,7 @@ import { Input } from "./input.js";
7
7
  import { Checkbox } from "./checkbox.js";
8
8
  import { Button } from "./button.js";
9
9
  import { Calendar } from "./calendar.js";
10
+ import { useDateLocale } from "./locale-provider.js";
10
11
  import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
11
12
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
12
13
  function EditableCell({ cell, onUpdate }) {
@@ -171,6 +172,7 @@ function createEditableColumn(accessorKey, header, meta) {
171
172
  }
172
173
  function DatePickerCell({ value, onValueChange, onClose, placeholder }) {
173
174
  const [open, setOpen] = useState(true);
175
+ const locale = useDateLocale();
174
176
  return /*#__PURE__*/ jsxs(Popover, {
175
177
  open: open,
176
178
  onOpenChange: (isOpen)=>{
@@ -189,7 +191,9 @@ function DatePickerCell({ value, onValueChange, onClose, placeholder }) {
189
191
  }),
190
192
  /*#__PURE__*/ jsx("span", {
191
193
  className: "truncate",
192
- children: value ? format(value, 'PP') : placeholder
194
+ children: value ? format(value, 'PP', {
195
+ locale
196
+ }) : placeholder
193
197
  })
194
198
  ]
195
199
  })
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ FIELD_ADDON_BUTTON_CLASS: ()=>FIELD_ADDON_BUTTON_CLASS
28
+ });
29
+ const FIELD_ADDON_BUTTON_CLASS = 'size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground';
30
+ exports.FIELD_ADDON_BUTTON_CLASS = __webpack_exports__.FIELD_ADDON_BUTTON_CLASS;
31
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
32
+ "FIELD_ADDON_BUTTON_CLASS"
33
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
34
+ Object.defineProperty(exports, '__esModule', {
35
+ value: true
36
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The square icon button an `InputGroupAddon` expects, on a 3xs InputGroupButton. Shared by
3
+ * FieldMenu's trigger and QuickFormField's lock toggle so both addon slots match, and not
4
+ * exported from the package.
5
+ */
6
+ export declare const FIELD_ADDON_BUTTON_CLASS = "size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground";
@@ -0,0 +1,2 @@
1
+ const FIELD_ADDON_BUTTON_CLASS = 'size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground';
2
+ export { FIELD_ADDON_BUTTON_CLASS };
@@ -29,10 +29,11 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
31
  const external_lucide_react_namespaceObject = require("lucide-react");
32
- const external_button_cjs_namespaceObject = require("../button.cjs");
33
32
  const external_dropdown_menu_cjs_namespaceObject = require("../dropdown-menu.cjs");
33
+ const external_input_group_cjs_namespaceObject = require("../input-group.cjs");
34
34
  const index_cjs_namespaceObject = require("../../../lib/index.cjs");
35
35
  const external_built_in_value_modes_cjs_namespaceObject = require("./built-in-value-modes.cjs");
36
+ const external_field_addon_button_cjs_namespaceObject = require("./field-addon-button.cjs");
36
37
  const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
37
38
  const DEFAULT_MODES = [
38
39
  'literal',
@@ -90,13 +91,11 @@ function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesD
90
91
  children: [
91
92
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
92
93
  asChild: true,
93
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
94
- type: "button",
95
- variant: "ghost",
94
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupButton, {
96
95
  size: "3xs",
97
96
  disabled: disabled,
98
97
  "aria-label": triggerLabel,
99
- className: "size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-3.5",
98
+ className: external_field_addon_button_cjs_namespaceObject.FIELD_ADDON_BUTTON_CLASS,
100
99
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TriggerIcon, {})
101
100
  })
102
101
  }),
@@ -1,9 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { MoreHorizontal, Type } from "lucide-react";
3
- import { Button } from "../button.js";
4
3
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../dropdown-menu.js";
4
+ import { InputGroupButton } from "../input-group.js";
5
5
  import { cn } from "../../../lib/index.js";
6
6
  import { builtInValueModes, isBuiltInValueMode } from "./built-in-value-modes.js";
7
+ import { FIELD_ADDON_BUTTON_CLASS } from "./field-addon-button.js";
7
8
  import { DEFAULT_VALUE_MODE_STRINGS } from "./value-mode-strings.js";
8
9
  const DEFAULT_MODES = [
9
10
  'literal',
@@ -61,13 +62,11 @@ function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesD
61
62
  children: [
62
63
  /*#__PURE__*/ jsx(DropdownMenuTrigger, {
63
64
  asChild: true,
64
- children: /*#__PURE__*/ jsx(Button, {
65
- type: "button",
66
- variant: "ghost",
65
+ children: /*#__PURE__*/ jsx(InputGroupButton, {
67
66
  size: "3xs",
68
67
  disabled: disabled,
69
68
  "aria-label": triggerLabel,
70
- className: "size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-3.5",
69
+ className: FIELD_ADDON_BUTTON_CLASS,
71
70
  children: /*#__PURE__*/ jsx(TriggerIcon, {})
72
71
  })
73
72
  }),