@douglasneuroinformatics/libui 3.1.3 → 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.
- package/dist/components.d.ts +3 -1
- package/dist/components.js +12 -38
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.1.4.tgz +0 -0
- package/package.json +2 -1
- package/src/components/Accordion/Accordion.spec.tsx +6 -5
- package/src/components/ActionDropdown/ActionDropdown.spec.tsx +35 -0
- package/src/components/ActionDropdown/ActionDropdown.tsx +10 -2
- package/src/components/Form/DateField/DateField.tsx +0 -1
- package/src/components/Form/Form.tsx +2 -9
- package/src/components/Form/NumberField/NumberFieldSelect.tsx +3 -7
- package/src/components/Form/StringField/StringFieldSelect.tsx +3 -7
- package/src/components/ListboxDropdown/ListboxDropdown.tsx +1 -1
- package/src/testing/mocks.ts +9 -0
- package/src/testing/setup-tests.ts +3 -0
- package/dist/douglasneuroinformatics-libui-3.1.3.tgz +0 -0
package/dist/components.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/components.js
CHANGED
|
@@ -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,
|
|
@@ -2231,18 +2233,10 @@ var NumberFieldSelect = ({
|
|
|
2231
2233
|
/* @__PURE__ */ jsx107(FieldGroup.Description, { description })
|
|
2232
2234
|
] }),
|
|
2233
2235
|
/* @__PURE__ */ jsxs28(Select, { name, value: value?.toString() ?? "", onValueChange: (value2) => setValue(parseFloat(value2)), children: [
|
|
2234
|
-
/* @__PURE__ */ jsx107(
|
|
2235
|
-
|
|
2236
|
-
{
|
|
2237
|
-
"data-cy": `${name}-select-trigger`,
|
|
2238
|
-
"data-testid": `${name}-select-trigger`,
|
|
2239
|
-
disabled: disabled || readOnly,
|
|
2240
|
-
children: /* @__PURE__ */ jsx107(Select.Value, {})
|
|
2241
|
-
}
|
|
2242
|
-
),
|
|
2243
|
-
/* @__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) => {
|
|
2244
2238
|
const text = (disableAutoPrefix ? "" : `${option} - `) + options[option];
|
|
2245
|
-
return /* @__PURE__ */ jsx107(Select.Item, { "data-
|
|
2239
|
+
return /* @__PURE__ */ jsx107(Select.Item, { "data-testid": `${name}-select-item-${option}`, value: option, children: text }, option);
|
|
2246
2240
|
}) })
|
|
2247
2241
|
] }),
|
|
2248
2242
|
/* @__PURE__ */ jsx107(FieldGroup.Error, { error })
|
|
@@ -2508,7 +2502,6 @@ var DateField = ({ disabled, error, label, name, readOnly, setValue, value }) =>
|
|
|
2508
2502
|
Input,
|
|
2509
2503
|
{
|
|
2510
2504
|
autoComplete: "off",
|
|
2511
|
-
"data-cy": "date-input",
|
|
2512
2505
|
"data-testid": "date-input",
|
|
2513
2506
|
disabled: disabled || readOnly,
|
|
2514
2507
|
name,
|
|
@@ -2833,16 +2826,8 @@ var StringFieldSelect = ({
|
|
|
2833
2826
|
/* @__PURE__ */ jsx123(FieldGroup.Description, { description })
|
|
2834
2827
|
] }),
|
|
2835
2828
|
/* @__PURE__ */ jsxs40(Select, { name, value: value ?? "", onValueChange: (value2) => setValue(value2), children: [
|
|
2836
|
-
/* @__PURE__ */ jsx123(
|
|
2837
|
-
|
|
2838
|
-
{
|
|
2839
|
-
"data-cy": `${name}-select-trigger`,
|
|
2840
|
-
"data-testid": `${name}-select-trigger`,
|
|
2841
|
-
disabled: disabled || readOnly,
|
|
2842
|
-
children: /* @__PURE__ */ jsx123(Select.Value, {})
|
|
2843
|
-
}
|
|
2844
|
-
),
|
|
2845
|
-
/* @__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)) })
|
|
2846
2831
|
] }),
|
|
2847
2832
|
/* @__PURE__ */ jsx123(FieldGroup.Error, { error })
|
|
2848
2833
|
] });
|
|
@@ -3240,22 +3225,11 @@ var Form = ({
|
|
|
3240
3225
|
}
|
|
3241
3226
|
),
|
|
3242
3227
|
/* @__PURE__ */ jsxs43("div", { className: "flex w-full gap-3", children: [
|
|
3243
|
-
/* @__PURE__ */ jsx131(
|
|
3244
|
-
Button,
|
|
3245
|
-
{
|
|
3246
|
-
"aria-label": "Submit Button",
|
|
3247
|
-
className: "block w-full",
|
|
3248
|
-
"data-cy": "submit-form",
|
|
3249
|
-
disabled: readOnly,
|
|
3250
|
-
type: "submit",
|
|
3251
|
-
variant: "primary",
|
|
3252
|
-
children: submitBtnLabel ?? t("form.submit")
|
|
3253
|
-
}
|
|
3254
|
-
),
|
|
3228
|
+
/* @__PURE__ */ jsx131(Button, { "aria-label": "Submit", className: "block w-full", disabled: readOnly, type: "submit", variant: "primary", children: submitBtnLabel ?? t("form.submit") }),
|
|
3255
3229
|
resetBtn && /* @__PURE__ */ jsx131(
|
|
3256
3230
|
Button,
|
|
3257
3231
|
{
|
|
3258
|
-
"aria-label": "Reset
|
|
3232
|
+
"aria-label": "Reset",
|
|
3259
3233
|
className: "block w-full",
|
|
3260
3234
|
disabled: readOnly,
|
|
3261
3235
|
type: "button",
|
|
@@ -3454,7 +3428,7 @@ var ListboxDropdown = ({
|
|
|
3454
3428
|
{
|
|
3455
3429
|
checked,
|
|
3456
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",
|
|
3457
|
-
"data-
|
|
3431
|
+
"data-testid": "select-dropdown-option",
|
|
3458
3432
|
onSelect: (event) => {
|
|
3459
3433
|
event.preventDefault();
|
|
3460
3434
|
if (checked) {
|