@douglasneuroinformatics/libui 3.1.3 → 3.1.5
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 +15 -39
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.1.5.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/components/Slider/Slider.tsx +2 -0
- 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 })
|
|
@@ -2268,6 +2262,7 @@ var Slider = forwardRef79(
|
|
|
2268
2262
|
{
|
|
2269
2263
|
"aria-disabled": disabled,
|
|
2270
2264
|
className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary opacity-15 aria-disabled:cursor-not-allowed aria-disabled:opacity-10",
|
|
2265
|
+
"data-testid": "slider-track",
|
|
2271
2266
|
children: /* @__PURE__ */ jsx108(Range, { className: "absolute h-full bg-primary" })
|
|
2272
2267
|
}
|
|
2273
2268
|
),
|
|
@@ -2275,7 +2270,8 @@ var Slider = forwardRef79(
|
|
|
2275
2270
|
Thumb,
|
|
2276
2271
|
{
|
|
2277
2272
|
"aria-disabled": disabled,
|
|
2278
|
-
className: "block h-4 w-4 rounded-full border border-slate-500 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring aria-disabled:cursor-not-allowed"
|
|
2273
|
+
className: "block h-4 w-4 rounded-full border border-slate-500 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring aria-disabled:cursor-not-allowed",
|
|
2274
|
+
"data-testid": "slider-thumb"
|
|
2279
2275
|
}
|
|
2280
2276
|
)
|
|
2281
2277
|
]
|
|
@@ -2508,7 +2504,6 @@ var DateField = ({ disabled, error, label, name, readOnly, setValue, value }) =>
|
|
|
2508
2504
|
Input,
|
|
2509
2505
|
{
|
|
2510
2506
|
autoComplete: "off",
|
|
2511
|
-
"data-cy": "date-input",
|
|
2512
2507
|
"data-testid": "date-input",
|
|
2513
2508
|
disabled: disabled || readOnly,
|
|
2514
2509
|
name,
|
|
@@ -2833,16 +2828,8 @@ var StringFieldSelect = ({
|
|
|
2833
2828
|
/* @__PURE__ */ jsx123(FieldGroup.Description, { description })
|
|
2834
2829
|
] }),
|
|
2835
2830
|
/* @__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)) })
|
|
2831
|
+
/* @__PURE__ */ jsx123(Select.Trigger, { "data-testid": `${name}-select-trigger`, disabled: disabled || readOnly, children: /* @__PURE__ */ jsx123(Select.Value, {}) }),
|
|
2832
|
+
/* @__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
2833
|
] }),
|
|
2847
2834
|
/* @__PURE__ */ jsx123(FieldGroup.Error, { error })
|
|
2848
2835
|
] });
|
|
@@ -3240,22 +3227,11 @@ var Form = ({
|
|
|
3240
3227
|
}
|
|
3241
3228
|
),
|
|
3242
3229
|
/* @__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
|
-
),
|
|
3230
|
+
/* @__PURE__ */ jsx131(Button, { "aria-label": "Submit", className: "block w-full", disabled: readOnly, type: "submit", variant: "primary", children: submitBtnLabel ?? t("form.submit") }),
|
|
3255
3231
|
resetBtn && /* @__PURE__ */ jsx131(
|
|
3256
3232
|
Button,
|
|
3257
3233
|
{
|
|
3258
|
-
"aria-label": "Reset
|
|
3234
|
+
"aria-label": "Reset",
|
|
3259
3235
|
className: "block w-full",
|
|
3260
3236
|
disabled: readOnly,
|
|
3261
3237
|
type: "button",
|
|
@@ -3454,7 +3430,7 @@ var ListboxDropdown = ({
|
|
|
3454
3430
|
{
|
|
3455
3431
|
checked,
|
|
3456
3432
|
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-
|
|
3433
|
+
"data-testid": "select-dropdown-option",
|
|
3458
3434
|
onSelect: (event) => {
|
|
3459
3435
|
event.preventDefault();
|
|
3460
3436
|
if (checked) {
|