@seeqdev/qomponents 0.0.194 → 0.0.202

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 (69) hide show
  1. package/dist/example/{.eslintrc.cjs → .eslintrc.js} +1 -1
  2. package/dist/index.esm.js +90 -48
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +90 -47
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/Button/Button.d.ts +2 -1
  7. package/dist/src/Button/Button.types.d.ts +4 -4
  8. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.d.ts +1 -0
  9. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +14 -21
  10. package/dist/src/Icon/Icon.types.d.ts +1 -1
  11. package/dist/src/SvgIcon/SvgIcon.types.d.ts +1 -1
  12. package/dist/src/ToolbarButton/ToolbarButton.types.d.ts +1 -1
  13. package/dist/src/Tooltip/Tooltip.types.d.ts +2 -2
  14. package/dist/src/TriggerWithDropdown/TriggerWithDropdown.d.ts +4 -0
  15. package/dist/src/TriggerWithDropdown/TriggerWithDropdown.types.d.ts +102 -0
  16. package/dist/src/TriggerWithDropdown/index.d.ts +1 -0
  17. package/dist/src/index.d.ts +2 -0
  18. package/dist/src/test-utils/is-browser-mode.d.ts +10 -0
  19. package/dist/src/types.d.ts +1 -0
  20. package/dist/styles.css +227 -12
  21. package/package.json +20 -12
  22. package/dist/src/Accordion/Accordion.stories.d.ts +0 -5
  23. package/dist/src/Accordion/Accordion.test.d.ts +0 -1
  24. package/dist/src/Alert/Alert.stories.d.ts +0 -14
  25. package/dist/src/Alert/Alert.test.d.ts +0 -1
  26. package/dist/src/Button/Button.stories.d.ts +0 -9
  27. package/dist/src/Button/Button.test.d.ts +0 -1
  28. package/dist/src/ButtonGroup/ButtonGroup.stories.d.ts +0 -5
  29. package/dist/src/ButtonGroup/ButtonGroup.test.d.ts +0 -1
  30. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +0 -5
  31. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +0 -1
  32. package/dist/src/ButtonWithPopover/ButtonWithPopover.stories.d.ts +0 -5
  33. package/dist/src/ButtonWithPopover/ButtonWithPopover.test.d.ts +0 -1
  34. package/dist/src/Carousel/Carousel.stories.d.ts +0 -5
  35. package/dist/src/Carousel/Carousel.test.d.ts +0 -1
  36. package/dist/src/Checkbox/Checkbox.stories.d.ts +0 -5
  37. package/dist/src/Checkbox/Checkbox.test.d.ts +0 -1
  38. package/dist/src/Collapse/Collapse.stories.d.ts +0 -5
  39. package/dist/src/Collapse/Collapse.test.d.ts +0 -1
  40. package/dist/src/Icon/Icon.stories.d.ts +0 -5
  41. package/dist/src/Icon/Icon.test.d.ts +0 -1
  42. package/dist/src/InputGroup/InputGroup.stories.d.ts +0 -5
  43. package/dist/src/InputGroup/InputGroup.test.d.ts +0 -1
  44. package/dist/src/Modal/Modal.stories.d.ts +0 -10
  45. package/dist/src/Modal/Modal.test.d.ts +0 -1
  46. package/dist/src/ProgressBar/ProgressBar.stories.d.ts +0 -5
  47. package/dist/src/ProgressBar/ProgressBar.test.d.ts +0 -1
  48. package/dist/src/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +0 -5
  49. package/dist/src/SeeqActionDropdown/SeeqActionDropdown.test.d.ts +0 -1
  50. package/dist/src/Select/Select.stories.d.ts +0 -5
  51. package/dist/src/Select/Select.test.d.ts +0 -1
  52. package/dist/src/Slider/Slider.stories.d.ts +0 -5
  53. package/dist/src/Slider/Slider.test.d.ts +0 -1
  54. package/dist/src/SvgIcon/SvgIcon.stories.d.ts +0 -5
  55. package/dist/src/SvgIcon/SvgIcon.test.d.ts +0 -1
  56. package/dist/src/Tabs/Tabs.stories.d.ts +0 -5
  57. package/dist/src/Tabs/Tabs.test.d.ts +0 -1
  58. package/dist/src/TextArea/TextArea.stories.d.ts +0 -5
  59. package/dist/src/TextArea/TextArea.test.d.ts +0 -1
  60. package/dist/src/TextField/TextField.stories.d.ts +0 -5
  61. package/dist/src/TextField/TextField.test.d.ts +0 -1
  62. package/dist/src/ToolbarButton/ToolbarButton.stories.d.ts +0 -5
  63. package/dist/src/ToolbarButton/ToolbarButton.test.d.ts +0 -1
  64. package/dist/src/Tooltip/QTip.stories.d.ts +0 -6
  65. package/dist/src/Tooltip/QTipPerformance.stories.d.ts +0 -5
  66. package/dist/src/Tooltip/Tooltip.stories.d.ts +0 -5
  67. package/dist/src/Tooltip/TooltipPerformance.stories.d.ts +0 -5
  68. package/dist/src/setupTests.d.ts +0 -1
  69. package/dist/src/utils/validateStyleDimension.test.d.ts +0 -1
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ButtonProps } from './Button.types';
3
+ type ButtonComponentProps = ButtonProps & React.RefAttributes<HTMLButtonElement>;
3
4
  /**
4
5
  * All-in-one Button:
5
6
  * - use "variant" to achieve the desired style
6
7
  * - include tooltips and/or icons
7
8
  */
8
- declare const Button: React.FunctionComponent<ButtonProps>;
9
+ declare const Button: React.FunctionComponent<ButtonComponentProps>;
9
10
  export default Button;
@@ -5,10 +5,10 @@ export declare const buttonTypes: readonly ["button", "reset", "submit", "link"]
5
5
  export declare const buttonSizes: readonly ["xs", "sm", "lg"];
6
6
  export declare const buttonVariants: readonly ["outline", "theme", "theme-light", "warning", "danger", "no-border"];
7
7
  export declare const iconPositions: string[];
8
- export type ButtonType = typeof buttonTypes[number];
9
- export type ButtonSize = typeof buttonSizes[number];
10
- export type ButtonVariant = typeof buttonVariants[number];
11
- export type IconPosition = typeof iconPositions[number];
8
+ export type ButtonType = (typeof buttonTypes)[number];
9
+ export type ButtonSize = (typeof buttonSizes)[number];
10
+ export type ButtonVariant = (typeof buttonVariants)[number];
11
+ export type IconPosition = (typeof iconPositions)[number];
12
12
  export interface ButtonProps {
13
13
  /**
14
14
  * Callback function triggered when the button is clicked.
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { ButtonWithDropdownProps } from './ButtonWithDropdown.types';
3
3
  declare const ButtonWithDropdown: React.FunctionComponent<ButtonWithDropdownProps>;
4
+ export declare const Dropdown: React.FunctionComponent<ButtonWithDropdownProps>;
4
5
  export default ButtonWithDropdown;
@@ -1,9 +1,10 @@
1
1
  import { TooltipComponentProps } from '../Tooltip/Tooltip.types';
2
+ import { ButtonProps } from '..';
2
3
  /**
3
4
  * Interface for sub-menu items that appear in nested dropdown menus.
4
5
  * Used to create hierarchical menu structures within dropdown items.
5
6
  */
6
- interface DropdownSubItem {
7
+ export interface DropdownSubItem {
7
8
  /**
8
9
  * Icon class name to display next to the sub-item label.
9
10
  * Typically uses FontAwesome classes (e.g., 'fc-zoom', 'fc-delete').
@@ -35,7 +36,7 @@ interface DropdownSubItem {
35
36
  * Interface for main dropdown menu items that can contain sub-menus.
36
37
  * Extends TooltipComponentProps for enhanced tooltip functionality.
37
38
  */
38
- interface DropdownItems extends TooltipComponentProps {
39
+ export interface DropdownItems extends TooltipComponentProps {
39
40
  /**
40
41
  * HTML ID attribute for the dropdown item element.
41
42
  * Should be unique for proper HTML semantics and accessibility.
@@ -133,31 +134,29 @@ interface DropdownItems extends TooltipComponentProps {
133
134
  subMenuItems?: DropdownSubItem[];
134
135
  }
135
136
  /**
136
- * Props for the ButtonWithDropdown component that creates a button with an attached dropdown menu.
137
- * Extends TooltipComponentProps to support tooltip functionality on the trigger button.
137
+ * Props for the ButtonWithDropdown component that creates a Qomponents-styled Button
138
+ * with an attached dropdown menu.
139
+ *
140
+ * Unlike TriggerWithDropdown, this component does not allow a custom trigger element.
141
+ * The trigger is always a Qomponents-styled Button whose appearance can be configured
142
+ * via the button-related props (label, variant, size, icon, etc.).
143
+ *
144
+ * Uses the asChild prop on DropdownMenu.Trigger to avoid nesting <button> elements.
138
145
  */
139
- export interface ButtonWithDropdownProps extends TooltipComponentProps {
146
+ export type ButtonWithDropdownProps = TooltipComponentProps & ButtonProps & DropdownProps;
147
+ export interface DropdownProps {
148
+ children?: React.ReactNode;
140
149
  /**
141
150
  * Array of items to display in the dropdown menu.
142
151
  * Each item can be interactive (with onClick) or decorative (labels/dividers).
143
152
  * Items can also contain sub-menus for hierarchical organization.
144
153
  */
145
154
  dropdownItems: DropdownItems[];
146
- /**
147
- * React element to use as the clickable trigger button.
148
- * Typically an icon, text, or button element that users click to open the dropdown.
149
- */
150
- triggerIcon: React.ReactNode;
151
155
  /**
152
156
  * HTML ID attribute for the dropdown trigger element.
153
157
  * Should be unique across the page for proper HTML semantics and accessibility.
154
158
  */
155
159
  id?: string;
156
- /**
157
- * Additional CSS classes to apply to the dropdown trigger button.
158
- * Use this to customize the trigger's appearance beyond default styling.
159
- */
160
- extraClassNames?: string;
161
160
  /**
162
161
  * Test ID attribute for the dropdown container element used in automated testing.
163
162
  * Applied to the main container that wraps both trigger and dropdown content.
@@ -168,11 +167,6 @@ export interface ButtonWithDropdownProps extends TooltipComponentProps {
168
167
  * Use this to customize the dropdown menu's appearance, spacing, or styling.
169
168
  */
170
169
  contentExtraClassNames?: string;
171
- /**
172
- * When true, disables the dropdown trigger preventing user interaction.
173
- * Disabled triggers appear visually dimmed and don't open the dropdown when clicked.
174
- */
175
- disabled?: boolean;
176
170
  /**
177
171
  * Horizontal alignment of the dropdown content relative to the trigger:
178
172
  * - `start`: Aligns to the left edge of the trigger
@@ -229,4 +223,3 @@ export interface ButtonWithDropdownProps extends TooltipComponentProps {
229
223
  */
230
224
  onContainerClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
231
225
  }
232
- export {};
@@ -1,6 +1,6 @@
1
1
  import { TooltipComponentProps } from '../Tooltip/Tooltip.types';
2
2
  export declare const iconTypes: readonly ["theme", "white", "dark-gray", "darkish-gray", "gray", "color", "info", "text", "warning", "inherit", "danger", "theme-light", "success"];
3
- export type IconType = typeof iconTypes[number];
3
+ export type IconType = (typeof iconTypes)[number];
4
4
  export type IconSize = '2xs' | 'xs' | 'sm' | 'lg' | 'xl' | '2xl' | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x';
5
5
  /**
6
6
  * Props for the Icon component that renders customizable icons with various styling options.
@@ -1,6 +1,6 @@
1
1
  import { TooltipComponentProps } from '../Tooltip/Tooltip.types';
2
2
  export declare const svgIconTypes: readonly ["theme", "white", "dark-gray", "darkish-gray", "gray", "color", "info", "text", "warning", "inherit", "danger", "theme-light", "success", "default"];
3
- export type SvgIconType = typeof svgIconTypes[number];
3
+ export type SvgIconType = (typeof svgIconTypes)[number];
4
4
  /**
5
5
  * Props for the SvgIcon component that renders SVG-based icons with various styling options.
6
6
  * Extends TooltipComponentProps to support tooltip functionality on the icon.
@@ -1,7 +1,7 @@
1
1
  import React, { MouseEvent } from 'react';
2
2
  import { TooltipProps } from '../Tooltip/Tooltip.types';
3
3
  export declare const toolbarButtonVariants: readonly ["outline", "theme", "theme-light", "warning", "danger", "no-border"];
4
- export type ToolbarButtonVariant = typeof toolbarButtonVariants[number];
4
+ export type ToolbarButtonVariant = (typeof toolbarButtonVariants)[number];
5
5
  /**
6
6
  * Props for the ToolbarButton component that creates toolbar-style buttons with optional popovers.
7
7
  * Designed for use in toolbars, action bars, and similar UI contexts.
@@ -1,7 +1,7 @@
1
- export declare const DEFAULT_TOOL_TIP_DELAY = 500;
1
+ export declare const DEFAULT_TOOL_TIP_DELAY: number;
2
2
  export declare const tooltipPositions: readonly ["top", "left", "right", "bottom"];
3
3
  import React from 'react';
4
- export type TooltipPosition = typeof tooltipPositions[number];
4
+ export type TooltipPosition = (typeof tooltipPositions)[number];
5
5
  export interface TooltipProps {
6
6
  position?: TooltipPosition;
7
7
  children?: React.JSX.Element | string;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { TriggerWithDropdownProps } from './TriggerWithDropdown.types';
3
+ declare const TriggerWithDropdown: React.FunctionComponent<TriggerWithDropdownProps>;
4
+ export default TriggerWithDropdown;
@@ -0,0 +1,102 @@
1
+ import { TooltipComponentProps } from '../Tooltip/Tooltip.types';
2
+ import { DropdownItems } from '..';
3
+ /**
4
+ * Props for the TriggerWithDropdown component that creates a custom trigger with an attached dropdown menu.
5
+ * Extends TooltipComponentProps to support tooltip functionality on the trigger element.
6
+ *
7
+ * Use this component when you need full control over the trigger element's appearance.
8
+ * If you want a standard Qomponents Button as the trigger, use ButtonWithDropdown instead.
9
+ */
10
+ export interface TriggerWithDropdownProps extends TooltipComponentProps {
11
+ /**
12
+ * Array of items to display in the dropdown menu.
13
+ * Each item can be interactive (with onClick) or decorative (labels/dividers).
14
+ * Items can also contain sub-menus for hierarchical organization.
15
+ */
16
+ dropdownItems: DropdownItems[];
17
+ /**
18
+ * React element to use as the clickable trigger.
19
+ * Can be any React element — icon, text, custom component, etc.
20
+ */
21
+ triggerIcon: React.ReactNode;
22
+ /**
23
+ * HTML ID attribute for the dropdown trigger element.
24
+ * Should be unique across the page for proper HTML semantics and accessibility.
25
+ */
26
+ id?: string;
27
+ /**
28
+ * Additional CSS classes to apply to the dropdown trigger.
29
+ * Use this to customize the trigger's appearance beyond default styling.
30
+ */
31
+ extraClassNames?: string;
32
+ /**
33
+ * Test ID attribute for the dropdown container element used in automated testing.
34
+ * Applied to the main container that wraps both trigger and dropdown content.
35
+ */
36
+ containerTestId?: string;
37
+ /**
38
+ * Additional CSS classes to apply to the dropdown content container.
39
+ * Use this to customize the dropdown menu's appearance, spacing, or styling.
40
+ */
41
+ contentExtraClassNames?: string;
42
+ /**
43
+ * When true, disables the dropdown trigger preventing user interaction.
44
+ * Disabled triggers appear visually dimmed and don't open the dropdown when clicked.
45
+ */
46
+ disabled?: boolean;
47
+ /**
48
+ * Horizontal alignment of the dropdown content relative to the trigger:
49
+ * - `start`: Aligns to the left edge of the trigger
50
+ * - `center`: Centers the dropdown on the trigger
51
+ * - `end`: Aligns to the right edge of the trigger
52
+ */
53
+ align?: 'start' | 'center' | 'end';
54
+ /**
55
+ * Numeric offset in pixels from the aligned position.
56
+ * Positive values move the dropdown further from the trigger in the align direction.
57
+ */
58
+ alignOffset?: number;
59
+ /**
60
+ * Position of the dropdown relative to the trigger element:
61
+ * - `top`: Dropdown appears above the trigger
62
+ * - `bottom`: Dropdown appears below the trigger
63
+ * - `left`: Dropdown appears to the left of the trigger
64
+ * - `right`: Dropdown appears to the right of the trigger
65
+ */
66
+ placement?: 'top' | 'bottom' | 'left' | 'right';
67
+ /**
68
+ * Numeric offset in pixels from the placement position.
69
+ * Positive values move the dropdown further away from the trigger.
70
+ */
71
+ placementOffset?: number;
72
+ /**
73
+ * When true, displays a visual arrow pointing from the dropdown to the trigger.
74
+ * Helps users understand the relationship between trigger and dropdown content.
75
+ */
76
+ hasArrow?: boolean;
77
+ /**
78
+ * Controls whether the dropdown is currently open and visible.
79
+ * Use this for controlled dropdown behavior where you manage open state externally.
80
+ */
81
+ isOpen?: boolean;
82
+ /**
83
+ * Callback function triggered when the dropdown open state changes.
84
+ * Receives the new open state as a boolean parameter. Use this to sync with external state.
85
+ */
86
+ onOpenChange?: (isOpen: boolean) => void;
87
+ /**
88
+ * When true, automatically focuses the trigger button when the dropdown closes.
89
+ * Improves keyboard navigation and accessibility by returning focus to the trigger.
90
+ */
91
+ setFocusOnTriggerOnClose?: boolean;
92
+ /**
93
+ * When true, traps keyboard focus within the dropdown when it's open.
94
+ * Prevents users from tabbing outside the dropdown, improving accessibility.
95
+ */
96
+ keepFocusInsideDropdown?: boolean;
97
+ /**
98
+ * Callback function triggered when the dropdown container is clicked.
99
+ * Receives the click event. Use this for handling container-level interactions.
100
+ */
101
+ onContainerClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
102
+ }
@@ -0,0 +1 @@
1
+ export { default } from './TriggerWithDropdown';
@@ -11,6 +11,7 @@ import Tabs from './Tabs';
11
11
  import Accordion from './Accordion';
12
12
  import ButtonWithPopover from './ButtonWithPopover';
13
13
  import ButtonWithDropdown from './ButtonWithDropdown';
14
+ import TriggerWithDropdown from './TriggerWithDropdown';
14
15
  import Alert from './Alert';
15
16
  import SeeqActionDropdown from './SeeqActionDropdown';
16
17
  import InputGroup from './InputGroup';
@@ -33,6 +34,7 @@ export { Modal };
33
34
  export { Accordion };
34
35
  export { ButtonWithPopover };
35
36
  export { ButtonWithDropdown };
37
+ export { TriggerWithDropdown };
36
38
  export { Alert };
37
39
  export { SeeqActionDropdown };
38
40
  export { InputGroup };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Check if tests are running in Playwright browser mode vs happy-dom/Node mode.
3
+ *
4
+ * Vitest 4.0.x doesn't reliably support import.meta.env in browser projects,
5
+ * so this uses user agent detection for now.
6
+ */
7
+ export declare function isBrowserMode(): boolean;
8
+ export declare function isHappyDomMode(): boolean;
9
+ export declare function isNodeMode(): boolean;
10
+ export declare function isHeadlessBrowserMode(): boolean;
@@ -5,6 +5,7 @@ export * from './Alert/Alert.types';
5
5
  export * from './Button/Button.types';
6
6
  export * from './ButtonGroup/ButtonGroup.types';
7
7
  export * from './ButtonWithDropdown/ButtonWithDropdown.types';
8
+ export * from './TriggerWithDropdown/TriggerWithDropdown.types';
8
9
  export * from './ButtonWithPopover/ButtonWithPopover.types';
9
10
  export * from './Carousel/Carousel.types';
10
11
  export * from './Checkbox/Checkbox.types';