@douglasneuroinformatics/libui 3.1.2 → 3.1.4

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.
@@ -50,7 +50,9 @@ type ActionDropdownOptionKey<T> = T extends readonly string[] ? T[number] : T ex
50
50
  [key: string]: string;
51
51
  } ? Extract<keyof T, string> : never;
52
52
  type ActionDropdownProps<T extends ActionDropdownOptions> = {
53
+ [key: `data-${string}`]: unknown;
53
54
  align?: DropdownMenuContentProps['align'];
55
+ className?: string;
54
56
  contentClassName?: string;
55
57
  disabled?: boolean;
56
58
  /** Callback function invoked when user clicks an option */
@@ -62,7 +64,7 @@ type ActionDropdownProps<T extends ActionDropdownOptions> = {
62
64
  triggerClassName?: string;
63
65
  widthFull?: boolean;
64
66
  };
65
- declare function ActionDropdown<const T extends ActionDropdownOptions>({ align, contentClassName, disabled, onSelection, options, title, triggerClassName, widthFull }: ActionDropdownProps<T>): react_jsx_runtime.JSX.Element;
67
+ declare function ActionDropdown<const T extends ActionDropdownOptions>({ align, className, contentClassName, disabled, onSelection, options, title, triggerClassName, widthFull, ...props }: ActionDropdownProps<T>): react_jsx_runtime.JSX.Element;
66
68
 
67
69
  declare const AlertDialog: React$1.FC<_radix_ui_react_alert_dialog.AlertDialogProps> & {
68
70
  Action: React$1.ForwardRefExoticComponent<Omit<_radix_ui_react_alert_dialog.AlertDialogActionProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
@@ -712,6 +714,7 @@ type ClientTableColumnProps<T extends ClientTableEntry> = {
712
714
  dropdownOptions?: ClientTableDropdownOptions<T>;
713
715
  };
714
716
  type ClientTableProps<T extends ClientTableEntry> = {
717
+ [key: `data-${string}`]: unknown;
715
718
  className?: string;
716
719
  columnDropdownOptions?: ClientTableDropdownOptions<T>;
717
720
  columns: ClientTableColumn<T>[];
@@ -721,7 +724,7 @@ type ClientTableProps<T extends ClientTableEntry> = {
721
724
  noWrap?: boolean;
722
725
  onEntryClick?: (entry: T) => void;
723
726
  };
724
- declare const ClientTable: <T extends ClientTableEntry>({ className, columnDropdownOptions, columns, data, entriesPerPage, minRows, noWrap, onEntryClick }: ClientTableProps<T>) => react_jsx_runtime.JSX.Element;
727
+ declare const ClientTable: <T extends ClientTableEntry>({ className, columnDropdownOptions, columns, data, entriesPerPage, minRows, noWrap, onEntryClick, ...props }: ClientTableProps<T>) => react_jsx_runtime.JSX.Element;
725
728
 
726
729
  declare const Collapsible: React$1.ForwardRefExoticComponent<Omit<_radix_ui_react_collapsible.CollapsibleProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>> & {
727
730
  Content: React$1.ForwardRefExoticComponent<_radix_ui_react_collapsible.CollapsibleContentProps & React$1.RefAttributes<HTMLDivElement>>;
@@ -280,16 +280,18 @@ var DropdownMenu = Object.assign(DropdownMenuPrimitive9.Root.bind(null), {
280
280
  import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
281
281
  function ActionDropdown({
282
282
  align = "start",
283
+ className,
283
284
  contentClassName,
284
285
  disabled,
285
286
  onSelection,
286
287
  options,
287
288
  title,
288
289
  triggerClassName,
289
- widthFull
290
+ widthFull,
291
+ ...props
290
292
  }) {
291
293
  const optionKeys = options instanceof Array ? options : Object.keys(options);
292
- return /* @__PURE__ */ jsx15(DropdownMenu, { children: /* @__PURE__ */ jsxs6("div", { className: "w-full", children: [
294
+ return /* @__PURE__ */ jsx15(DropdownMenu, { children: /* @__PURE__ */ jsxs6("div", { className: cn("w-full", className), ...props, children: [
293
295
  /* @__PURE__ */ jsx15(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx15(DropdownButton, { className: triggerClassName, disabled, children: title }) }),
294
296
  /* @__PURE__ */ jsx15(DropdownMenu.Content, { align, className: contentClassName, widthFull, children: /* @__PURE__ */ jsx15(DropdownMenu.Group, { children: optionKeys.map((option) => /* @__PURE__ */ jsx15(
295
297
  DropdownMenu.Item,
@@ -873,7 +875,8 @@ var ClientTable = ({
873
875
  entriesPerPage = 10,
874
876
  minRows,
875
877
  noWrap,
876
- onEntryClick
878
+ onEntryClick,
879
+ ...props
877
880
  }) => {
878
881
  const [currentPage, setCurrentPage] = useState(1);
879
882
  const pageCount = Math.max(Math.ceil(data.length / entriesPerPage), 1);
@@ -881,7 +884,7 @@ var ClientTable = ({
881
884
  const lastEntry = Math.min(firstEntry + entriesPerPage - 1, data.length);
882
885
  const currentEntries = data.slice(firstEntry - 1, lastEntry);
883
886
  const nRows = Math.max(currentEntries.length, minRows ?? -1);
884
- return /* @__PURE__ */ jsxs11("div", { className, children: [
887
+ return /* @__PURE__ */ jsxs11("div", { className, ...props, children: [
885
888
  /* @__PURE__ */ jsx48("div", { className: "rounded-md border bg-card tracking-tight text-muted-foreground shadow-sm", children: /* @__PURE__ */ jsxs11(Table, { children: [
886
889
  /* @__PURE__ */ jsx48(Table.Header, { children: /* @__PURE__ */ jsx48(Table.Row, { children: columns.map((column, i) => /* @__PURE__ */ jsx48(Table.Head, { className: "whitespace-nowrap text-foreground", children: columnDropdownOptions ? /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
887
890
  /* @__PURE__ */ jsxs11(DropdownMenu.Trigger, { className: "flex items-center justify-between gap-3", children: [
@@ -2230,18 +2233,10 @@ var NumberFieldSelect = ({
2230
2233
  /* @__PURE__ */ jsx107(FieldGroup.Description, { description })
2231
2234
  ] }),
2232
2235
  /* @__PURE__ */ jsxs28(Select, { name, value: value?.toString() ?? "", onValueChange: (value2) => setValue(parseFloat(value2)), children: [
2233
- /* @__PURE__ */ jsx107(
2234
- Select.Trigger,
2235
- {
2236
- "data-cy": `${name}-select-trigger`,
2237
- "data-testid": `${name}-select-trigger`,
2238
- disabled: disabled || readOnly,
2239
- children: /* @__PURE__ */ jsx107(Select.Value, {})
2240
- }
2241
- ),
2242
- /* @__PURE__ */ jsx107(Select.Content, { "data-cy": `${name}-select-content`, "data-testid": `${name}-select-content`, children: Object.keys(options).map((option) => {
2236
+ /* @__PURE__ */ jsx107(Select.Trigger, { "data-testid": `${name}-select-trigger`, disabled: disabled || readOnly, children: /* @__PURE__ */ jsx107(Select.Value, {}) }),
2237
+ /* @__PURE__ */ jsx107(Select.Content, { "data-testid": `${name}-select-content`, children: Object.keys(options).map((option) => {
2243
2238
  const text = (disableAutoPrefix ? "" : `${option} - `) + options[option];
2244
- return /* @__PURE__ */ jsx107(Select.Item, { "data-cy": `${name}-select-item-${option}`, value: option, children: text }, option);
2239
+ return /* @__PURE__ */ jsx107(Select.Item, { "data-testid": `${name}-select-item-${option}`, value: option, children: text }, option);
2245
2240
  }) })
2246
2241
  ] }),
2247
2242
  /* @__PURE__ */ jsx107(FieldGroup.Error, { error })
@@ -2507,7 +2502,6 @@ var DateField = ({ disabled, error, label, name, readOnly, setValue, value }) =>
2507
2502
  Input,
2508
2503
  {
2509
2504
  autoComplete: "off",
2510
- "data-cy": "date-input",
2511
2505
  "data-testid": "date-input",
2512
2506
  disabled: disabled || readOnly,
2513
2507
  name,
@@ -2832,16 +2826,8 @@ var StringFieldSelect = ({
2832
2826
  /* @__PURE__ */ jsx123(FieldGroup.Description, { description })
2833
2827
  ] }),
2834
2828
  /* @__PURE__ */ jsxs40(Select, { name, value: value ?? "", onValueChange: (value2) => setValue(value2), children: [
2835
- /* @__PURE__ */ jsx123(
2836
- Select.Trigger,
2837
- {
2838
- "data-cy": `${name}-select-trigger`,
2839
- "data-testid": `${name}-select-trigger`,
2840
- disabled: disabled || readOnly,
2841
- children: /* @__PURE__ */ jsx123(Select.Value, {})
2842
- }
2843
- ),
2844
- /* @__PURE__ */ jsx123(Select.Content, { "data-cy": `${name}-select-content`, "data-testid": `${name}-select-content`, children: Object.keys(options).map((option) => /* @__PURE__ */ jsx123(Select.Item, { "data-cy": `${name}-select-item-${option}`, value: option, children: options[option] }, option)) })
2829
+ /* @__PURE__ */ jsx123(Select.Trigger, { "data-testid": `${name}-select-trigger`, disabled: disabled || readOnly, children: /* @__PURE__ */ jsx123(Select.Value, {}) }),
2830
+ /* @__PURE__ */ jsx123(Select.Content, { "data-testid": `${name}-select-content`, children: Object.keys(options).map((option) => /* @__PURE__ */ jsx123(Select.Item, { "data-testid": `${name}-select-item-${option}`, value: option, children: options[option] }, option)) })
2845
2831
  ] }),
2846
2832
  /* @__PURE__ */ jsx123(FieldGroup.Error, { error })
2847
2833
  ] });
@@ -3239,22 +3225,11 @@ var Form = ({
3239
3225
  }
3240
3226
  ),
3241
3227
  /* @__PURE__ */ jsxs43("div", { className: "flex w-full gap-3", children: [
3242
- /* @__PURE__ */ jsx131(
3243
- Button,
3244
- {
3245
- "aria-label": "Submit Button",
3246
- className: "block w-full",
3247
- "data-cy": "submit-form",
3248
- disabled: readOnly,
3249
- type: "submit",
3250
- variant: "primary",
3251
- children: submitBtnLabel ?? t("form.submit")
3252
- }
3253
- ),
3228
+ /* @__PURE__ */ jsx131(Button, { "aria-label": "Submit", className: "block w-full", disabled: readOnly, type: "submit", variant: "primary", children: submitBtnLabel ?? t("form.submit") }),
3254
3229
  resetBtn && /* @__PURE__ */ jsx131(
3255
3230
  Button,
3256
3231
  {
3257
- "aria-label": "Reset Button",
3232
+ "aria-label": "Reset",
3258
3233
  className: "block w-full",
3259
3234
  disabled: readOnly,
3260
3235
  type: "button",
@@ -3453,7 +3428,7 @@ var ListboxDropdown = ({
3453
3428
  {
3454
3429
  checked,
3455
3430
  className: "flex w-full items-center whitespace-nowrap bg-slate-50 p-2 text-sm hover:bg-slate-200 dark:bg-slate-800 dark:hover:bg-slate-700",
3456
- "data-cy": "select-dropdown-option",
3431
+ "data-testid": "select-dropdown-option",
3457
3432
  onSelect: (event) => {
3458
3433
  event.preventDefault();
3459
3434
  if (checked) {