@rovula/ui 0.1.22 → 0.1.24

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.
@@ -14,6 +14,8 @@ export type MenuOption = {
14
14
  danger?: boolean;
15
15
  checked?: boolean;
16
16
  onClick?: () => void;
17
+ /** data-testid attached to the item element */
18
+ testId?: string;
17
19
  };
18
20
  export type MenuItemType = {
19
21
  type: "item";
@@ -61,9 +63,11 @@ export type MenuProps = {
61
63
  side?: "top" | "right" | "bottom" | "left";
62
64
  sideOffset?: number;
63
65
  contentClassName?: string;
66
+ /** data-testid attached to the menu content element */
67
+ testId?: string;
64
68
  };
65
69
  export declare const Menu: {
66
- ({ trigger, items, selectedValues, onSelect, header, open, onOpenChange, align, side, sideOffset, contentClassName, }: MenuProps): import("react/jsx-runtime").JSX.Element;
70
+ ({ trigger, items, selectedValues, onSelect, header, open, onOpenChange, align, side, sideOffset, contentClassName, testId, }: MenuProps): import("react/jsx-runtime").JSX.Element;
67
71
  displayName: string;
68
72
  };
69
73
  export { DropdownMenuItem as MenuItem, DropdownMenuSeparator as MenuSeparator, DropdownMenuLabel as MenuLabel, } from "../../components/DropdownMenu/DropdownMenu";
@@ -4,7 +4,7 @@ import { Menu, MenuItemType } from "./Menu";
4
4
  declare const meta: {
5
5
  title: string;
6
6
  component: {
7
- ({ trigger, items, selectedValues, onSelect, header, open, onOpenChange, align, side, sideOffset, contentClassName, }: import("./Menu").MenuProps): import("react/jsx-runtime").JSX.Element;
7
+ ({ trigger, items, selectedValues, onSelect, header, open, onOpenChange, align, side, sideOffset, contentClassName, testId, }: import("./Menu").MenuProps): import("react/jsx-runtime").JSX.Element;
8
8
  displayName: string;
9
9
  };
10
10
  parameters: {
@@ -22,6 +22,7 @@ declare const meta: {
22
22
  side?: "top" | "right" | "bottom" | "left" | undefined;
23
23
  sideOffset?: number | undefined;
24
24
  contentClassName?: string | undefined;
25
+ testId?: string | undefined;
25
26
  }>) => import("react/jsx-runtime").JSX.Element)[];
26
27
  };
27
28
  export default meta;
@@ -1,22 +1,27 @@
1
1
  import { cva } from "class-variance-authority";
2
- export const actionButtonVariants = cva(["box-border flex items-center justify-center"], {
2
+ export const actionButtonVariants = cva([
3
+ "box-border flex items-center justify-center outline-none focus-visible:outline-none",
4
+ ], {
3
5
  variants: {
4
6
  variant: {
5
7
  solid: [
6
8
  "bg-action-button-solid-default border-action-button-solid-default text-action-button-solid-default fill-action-button-solid-default",
7
9
  "hover:bg-action-button-solid-hover hover:border-action-button-solid-hover hover:text-action-button-solid-hover hover:fill-action-button-solid-hover",
8
10
  "active:bg-action-button-solid-pressed active:border-action-button-solid-pressed active:text-action-button-solid-pressed active:fill-action-button-solid-pressed",
11
+ "focus-visible:ring-none focus-visible:ring-offset-2 focus-visible:ring-[var(--action-button-solid-default-border)]",
9
12
  ],
10
13
  outline: [
11
14
  "ring-1 ring-inset",
12
15
  "bg-action-button-outline-default text-action-button-outline-default fill-action-button-outline-default ring-[var(--action-button-outline-default-border)]",
13
16
  "hover:bg-action-button-outline-hover hover:text-action-button-outline-hover hover:fill-action-button-outline-hover hover:ring-[var(--action-button-outline-hover-border)]",
14
17
  "active:bg-action-button-outline-pressed active:text-action-button-outline-pressed active:fill-action-button-outline-pressed active:ring-[var(--action-button-outline-pressed-border)]",
18
+ "focus-visible:ring-none focus-visible:ring-[var(--action-button-outline-default-border)]",
15
19
  ],
16
20
  icon: [
17
21
  "bg-action-button-icon-default border-action-button-icon-default text-action-button-icon-default fill-action-button-icon-default",
18
22
  "hover:bg-action-button-icon-hover hover:border-action-button-icon-hover hover:text-action-button-icon-hover hover:fill-action-button-icon-hover",
19
23
  "active:bg-action-button-icon-pressed active:border-action-button-icon-pressed active:text-action-button-icon-pressed active:fill-action-button-icon-pressed",
24
+ "focus-visible:ring-none focus-visible:ring-offset-2 focus-visible:ring-[var(--action-button-icon-default-border)]",
20
25
  ],
21
26
  },
22
27
  size: {
@@ -45,6 +50,7 @@ export const actionButtonVariants = cva(["box-border flex items-center justify-c
45
50
  "bg-action-button-solid-active border-action-button-solid-active text-action-button-solid-active fill-action-button-solid-active",
46
51
  "hover:bg-action-button-solid-active-hover hover:border-action-button-solid-active-hover hover:text-action-button-solid-active-hover hover:fill-action-button-solid-active-hover",
47
52
  "active:bg-action-button-solid-active-pressed active:border-action-button-solid-active-pressed active:text-action-button-solid-active-pressed active:fill-action-button-solid-active-pressed",
53
+ "focus-visible:ring-[var(--action-button-solid-active-border)]",
48
54
  ],
49
55
  },
50
56
  {
@@ -54,6 +60,7 @@ export const actionButtonVariants = cva(["box-border flex items-center justify-c
54
60
  "bg-action-button-outline-active text-action-button-outline-active fill-action-button-outline-active ring-[var(--action-button-outline-active-border)]",
55
61
  "hover:bg-action-button-outline-active-hover hover:text-action-button-outline-active-hover hover:fill-action-button-outline-active-hover hover:ring-[var(--action-button-outline-active-hover-border)]",
56
62
  "active:bg-action-button-outline-active-pressed active:text-action-button-outline-active-pressed active:fill-action-button-outline-active-pressed active:ring-[var(--action-button-outline-active-pressed-border)]",
63
+ "focus-visible:ring-[var(--action-button-outline-active-border)]",
57
64
  ],
58
65
  },
59
66
  {
@@ -63,6 +70,7 @@ export const actionButtonVariants = cva(["box-border flex items-center justify-c
63
70
  "bg-action-button-icon-active border-action-button-icon-active text-action-button-icon-active fill-action-button-icon-active",
64
71
  "hover:bg-action-button-icon-active-hover hover:border-action-button-icon-active-hover hover:text-action-button-icon-active-hover hover:fill-action-button-icon-active-hover",
65
72
  "active:bg-action-button-icon-active-pressed active:border-action-button-icon-active-pressed active:text-action-button-icon-active-pressed active:fill-action-button-icon-active-pressed",
73
+ "focus-visible:ring-[var(--action-button-icon-active-border)]",
66
74
  ],
67
75
  },
68
76
  {
@@ -83,7 +83,7 @@ const Dropdown = forwardRef((_a, ref) => {
83
83
  "bg-[var(--dropdown-menu-hover-bg)] text-[var(--dropdown-menu-hover-text)]", optionItemClassName), children: ({ selected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "shrink-0 size-4 flex items-center justify-center", children: (selected || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value) && (_jsx(Icon, { type: "heroicons", name: "check", className: "size-4 text-[var(--dropdown-menu-selected-text)]" })) }), option.label] })) }, option.value));
84
84
  });
85
85
  };
86
- return (_jsx(Combobox, { value: selectedOption, onChange: handleSelect, immediate: true, by: "value", disabled: disabled, children: ({ open }) => (_jsxs("div", { className: cn("relative", fullwidth && "w-full"), children: [_jsx(ComboboxInput, Object.assign({ as: TextInput, ref: inputRef, hasClearIcon: false, endIcon: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ isFocus: open }) }), label: label, placeholder: " ", autoComplete: "off", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: segmentedInput ? customInputVariant({ size }) : undefined, displayValue: (opt) => { var _a; return (_a = opt === null || opt === void 0 ? void 0 : opt.label) !== null && _a !== void 0 ? _a : ""; }, readOnly: !filterMode, onChange: handleInputChange }, props)), _jsx(ComboboxOptions, { className: cn("absolute top-full left-0 w-full mt-1 z-[51]", "min-w-[154px] max-h-60 overflow-y-auto", "rounded-lg bg-modal-surface text-text-g-contrast-high", optionContainerClassName), style: { boxShadow: "var(--dropdown-menu-shadow)" }, children: renderOptionList() })] })) }));
86
+ return (_jsx(Combobox, { value: selectedOption, onChange: handleSelect, immediate: true, by: "value", disabled: disabled, children: ({ open }) => (_jsxs("div", { className: cn("relative", fullwidth && "w-full"), children: [_jsx(ComboboxInput, Object.assign({ as: TextInput, ref: inputRef, hasClearIcon: false, endIcon: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ isFocus: open }) }), label: label, placeholder: " ", autoComplete: "off", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: segmentedInput ? customInputVariant({ size }) : undefined, displayValue: (opt) => { var _a; return (_a = opt === null || opt === void 0 ? void 0 : opt.label) !== null && _a !== void 0 ? _a : ""; }, readOnly: !filterMode, onChange: handleInputChange }, props)), _jsx(ComboboxOptions, { className: cn("absolute top-full left-0 w-full -mt-3 z-[51]", "min-w-[154px] max-h-60 overflow-y-auto", "rounded-md bg-modal-dropdown-surface border border-bg-stroke3 text-text-g-contrast-high", optionContainerClassName), style: { boxShadow: "var(--dropdown-menu-shadow)" }, children: renderOptionList() })] })) }));
87
87
  });
88
88
  Dropdown.displayName = "Dropdown";
89
89
  export default Dropdown;
@@ -29,13 +29,13 @@ DropdownMenuSubTrigger.displayName =
29
29
  DropdownMenuPrimitive.SubTrigger.displayName;
30
30
  const DropdownMenuSubContent = React.forwardRef((_a, ref) => {
31
31
  var { className } = _a, props = __rest(_a, ["className"]);
32
- return (_jsx(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: cn("z-50 min-w-[154px] overflow-hidden rounded-lg bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })));
32
+ return (_jsx(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: cn("z-50 min-w-[154px] overflow-hidden rounded-md bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })));
33
33
  });
34
34
  DropdownMenuSubContent.displayName =
35
35
  DropdownMenuPrimitive.SubContent.displayName;
36
36
  const DropdownMenuContent = React.forwardRef((_a, ref) => {
37
37
  var { className, sideOffset = 4 } = _a, props = __rest(_a, ["className", "sideOffset"]);
38
- return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[154px] overflow-hidden rounded-lg bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })) }));
38
+ return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[154px] overflow-hidden rounded-md bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })) }));
39
39
  });
40
40
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
41
41
  const DropdownMenuItem = React.forwardRef((_a, ref) => {
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { forwardRef, useCallback, useMemo, useRef, } from "react";
14
14
  import { useStableMergedRef } from "@/utils/mergeRefs";
15
15
  import { helperTextVariant, iconActionVariant, inlineEndIconWrapperVariant, inlineStartIconWrapperVariant, inputVariant, labelVariant, searchIconVariant, segmentedIconWrapperVariant, } from "./TextInput.styles";
16
- import { CircleAlert, CircleX, Search, } from "lucide-react";
16
+ import { CircleAlert, CircleX, Search } from "lucide-react";
17
17
  import { cn } from "@/utils/cn";
18
18
  export const TextInput = forwardRef((_a, ref) => {
19
19
  var { id, label, size = "md", rounded = "normal", variant = "outline", type = "text", iconMode = "solid", helperText, errorMessage, warningMessage, status, fullwidth = true, disabled = false, error = false, warning = false, required = true, isFloatingLabel = true, keepCloseIconOnValue = false, keepFooterSpace = true, hasClearIcon = true, hasSearchIcon = false, startIcon, endIcon, labelClassName, onClickStartIcon, onClickEndIcon, renderStartIcon, renderEndIcon, classes, normalize, format, trimOnCommit, normalizeOnCommit } = _a, props = __rest(_a, ["id", "label", "size", "rounded", "variant", "type", "iconMode", "helperText", "errorMessage", "warningMessage", "status", "fullwidth", "disabled", "error", "warning", "required", "isFloatingLabel", "keepCloseIconOnValue", "keepFooterSpace", "hasClearIcon", "hasSearchIcon", "startIcon", "endIcon", "labelClassName", "onClickStartIcon", "onClickEndIcon", "renderStartIcon", "renderEndIcon", "classes", "normalize", "format", "trimOnCommit", "normalizeOnCommit"]);
@@ -186,7 +186,9 @@ export const TextInput = forwardRef((_a, ref) => {
186
186
  renderEndIcon,
187
187
  handleOnClickRightSectionIcon,
188
188
  ]);
189
- return (_jsxs("div", { className: `inline-flex flex-col ${fullwidth ? "w-full" : ""}`, children: [_jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({}, props, { placeholder: " ", ref: stableRef, type: type, id: _id, disabled: disabled, value: displayValue, className: cn(inputClassname, props.className), onChange: normalize ? handleChange : props.onChange, onBlur: trimOnCommit || normalizeOnCommit ? handleBlur : props.onBlur, onKeyDown: trimOnCommit || normalizeOnCommit ? handleKeyDown : props.onKeyDown })), hasSearchIcon && !hasLeftSectionIcon && (_jsx("div", { className: cn(inlineStartIconWrapperClassname, classes === null || classes === void 0 ? void 0 : classes.iconSearchWrapper), children: _jsx(Search, { className: cn(searchIconClassname, classes === null || classes === void 0 ? void 0 : classes.icon) }) })), startIconElement, hasClearIcon && !hasRightSectionIcon && (_jsx("div", { className: cn(inlineEndIconWrapperClassname, classes === null || classes === void 0 ? void 0 : classes.iconWrapper), style: {
189
+ return (_jsxs("div", { className: `inline-flex flex-col ${fullwidth ? "w-full" : ""}`, children: [_jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({}, props, { placeholder: " ", ref: stableRef, type: type, id: _id, disabled: disabled, value: displayValue, className: cn(inputClassname, props.className), onChange: normalize ? handleChange : props.onChange, onBlur: trimOnCommit || normalizeOnCommit ? handleBlur : props.onBlur, onKeyDown: trimOnCommit || normalizeOnCommit
190
+ ? handleKeyDown
191
+ : props.onKeyDown })), hasSearchIcon && !hasLeftSectionIcon && (_jsx("div", { className: cn(inlineStartIconWrapperClassname, classes === null || classes === void 0 ? void 0 : classes.iconSearchWrapper), children: _jsx(Search, { className: cn(searchIconClassname, classes === null || classes === void 0 ? void 0 : classes.icon) }) })), startIconElement, hasClearIcon && !hasRightSectionIcon && (_jsx("div", { className: cn(inlineEndIconWrapperClassname, classes === null || classes === void 0 ? void 0 : classes.iconWrapper), style: {
190
192
  display: keepCloseIconOnValue && props.value ? "flex" : undefined,
191
193
  }, children: _jsx(CircleX, { className: cn(iconActionClassname,
192
194
  // 'fill-none stroke-current',
@@ -744,6 +744,9 @@ input[type=number] {
744
744
  .-mr-2{
745
745
  margin-right: -0.5rem;
746
746
  }
747
+ .-mt-3{
748
+ margin-top: -0.75rem;
749
+ }
747
750
  .-mt-\[30px\]{
748
751
  margin-top: -30px;
749
752
  }
@@ -1666,6 +1669,10 @@ input[type=number] {
1666
1669
  --tw-border-opacity: 1;
1667
1670
  border-color: color-mix(in srgb, var(--bg-stroke2) calc(100% * var(--tw-border-opacity, 1)), transparent);
1668
1671
  }
1672
+ .border-bg-stroke3{
1673
+ --tw-border-opacity: 1;
1674
+ border-color: color-mix(in srgb, var(--bg-stroke3) calc(100% * var(--tw-border-opacity, 1)), transparent);
1675
+ }
1669
1676
  .border-blue-500{
1670
1677
  --tw-border-opacity: 1;
1671
1678
  border-color: rgb(59 130 246 / var(--tw-border-opacity, 1));
@@ -2552,6 +2559,10 @@ input[type=number] {
2552
2559
  --tw-bg-opacity: 1;
2553
2560
  background-color: color-mix(in srgb, var(--input-label-bg) calc(100% * var(--tw-bg-opacity, 1)), transparent);
2554
2561
  }
2562
+ .bg-modal-dropdown-surface{
2563
+ --tw-bg-opacity: 1;
2564
+ background-color: color-mix(in srgb, var(--modal-dropdown-surface) calc(100% * var(--tw-bg-opacity, 1)), transparent);
2565
+ }
2555
2566
  .bg-modal-highlight{
2556
2567
  --tw-bg-opacity: 1;
2557
2568
  background-color: color-mix(in srgb, var(--modal-highlight) calc(100% * var(--tw-bg-opacity, 1)), transparent);
@@ -5237,6 +5248,24 @@ input[type=number] {
5237
5248
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
5238
5249
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
5239
5250
  }
5251
+ .focus-visible\:ring-\[var\(--action-button-icon-active-border\)\]:focus-visible{
5252
+ --tw-ring-color: var(--action-button-icon-active-border);
5253
+ }
5254
+ .focus-visible\:ring-\[var\(--action-button-icon-default-border\)\]:focus-visible{
5255
+ --tw-ring-color: var(--action-button-icon-default-border);
5256
+ }
5257
+ .focus-visible\:ring-\[var\(--action-button-outline-active-border\)\]:focus-visible{
5258
+ --tw-ring-color: var(--action-button-outline-active-border);
5259
+ }
5260
+ .focus-visible\:ring-\[var\(--action-button-outline-default-border\)\]:focus-visible{
5261
+ --tw-ring-color: var(--action-button-outline-default-border);
5262
+ }
5263
+ .focus-visible\:ring-\[var\(--action-button-solid-active-border\)\]:focus-visible{
5264
+ --tw-ring-color: var(--action-button-solid-active-border);
5265
+ }
5266
+ .focus-visible\:ring-\[var\(--action-button-solid-default-border\)\]:focus-visible{
5267
+ --tw-ring-color: var(--action-button-solid-default-border);
5268
+ }
5240
5269
  .focus-visible\:ring-gray-500:focus-visible{
5241
5270
  --tw-ring-opacity: 1;
5242
5271
  --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity, 1));