@qasa/qds-ui 0.10.0-next.0 → 0.10.0-next.2

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.
@@ -0,0 +1,67 @@
1
+ /// <reference types="react" />
2
+ import * as DropdownPrimitive from '@radix-ui/react-dropdown-menu';
3
+ import type { HTMLQdsProps } from '../../types';
4
+ declare type PrimitiveContentProps = DropdownPrimitive.MenuContentProps;
5
+ interface DropdownMenuContentOptions {
6
+ /**
7
+ * Event handler called when focus moves to the trigger after closing.
8
+ * It can be prevented by calling `event.preventDefault`.
9
+ */
10
+ onCloseAutofocus?: PrimitiveContentProps['onCloseAutoFocus'];
11
+ /**
12
+ * Event handler called when the escape key is down.
13
+ * It can be prevented by calling `event.preventDefault`.
14
+ */
15
+ onEscapeKeyDown?: PrimitiveContentProps['onEscapeKeyDown'];
16
+ /**
17
+ * Event handler called when a pointer event occurs outside the bounds of the component.
18
+ * It can be prevented by calling `event.preventDefault`.
19
+ */
20
+ onPointerDownOutside?: PrimitiveContentProps['onPointerDownOutside'];
21
+ /**
22
+ * Event handler called when focus moves outside the bounds of the component.
23
+ * It can be prevented by calling `event.preventDefault`.
24
+ */
25
+ onFocusOutside?: PrimitiveContentProps['onFocusOutside'];
26
+ /**
27
+ * Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component.
28
+ * It can be prevented by calling `event.preventDefault`.
29
+ */
30
+ onInteractOutside?: PrimitiveContentProps['onInteractOutside'];
31
+ /**
32
+ * The preferred side of the trigger to render against when open.
33
+ * Will be reversed when collisions occur and `avoidCollisions` is enabled.
34
+ *
35
+ * @default "bottom"
36
+ */
37
+ side?: PrimitiveContentProps['side'];
38
+ /**
39
+ * The distance in pixels from the trigger.
40
+ *
41
+ * @default 8
42
+ */
43
+ sideOffset?: PrimitiveContentProps['sideOffset'];
44
+ /**
45
+ * The preferred alignment against the trigger. May change when collisions occur.
46
+ *
47
+ * @default "center"
48
+ */
49
+ align?: PrimitiveContentProps['align'];
50
+ /**
51
+ * The element used as the collision boundary.
52
+ * By default this is the viewport, though you can provide additional element(s) to be included in this check.
53
+ *
54
+ * @default []
55
+ */
56
+ collisionBoundary?: PrimitiveContentProps['collisionBoundary'];
57
+ /**
58
+ * Whether to hide the content when the trigger becomes fully occluded.
59
+ *
60
+ * @default false
61
+ */
62
+ hideWhenDetached?: PrimitiveContentProps['hideWhenDetached'];
63
+ }
64
+ export interface DropdownMenuContentProps extends HTMLQdsProps<'div'>, DropdownMenuContentOptions {
65
+ }
66
+ export declare const DropdownMenuContent: import("react").ForwardRefExoticComponent<DropdownMenuContentProps & import("react").RefAttributes<HTMLDivElement>>;
67
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { HTMLQdsProps } from '../../types';
3
+ export declare type DropdownMenuDividerProps = HTMLQdsProps<'div'>;
4
+ export declare const DropdownMenuDivider: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,28 @@
1
+ import type { ElementType } from 'react';
2
+ import * as DropdownPrimitive from '@radix-ui/react-dropdown-menu';
3
+ import type { IconProps } from '../icon';
4
+ interface DropdownMenuItemOptions {
5
+ /**
6
+ * If `true`, the item will be disabled
7
+ */
8
+ isDisabled?: boolean;
9
+ /**
10
+ * Event handler called when the user selects an item (via mouse or keyboard).
11
+ * Calling `event.preventDefault` in this handler will prevent the dropdown from closing when selecting that item.
12
+ */
13
+ onSelect?: (event: Event) => void;
14
+ /**
15
+ * Optional text used for typeahead purposes.
16
+ * By default the typeahead behavior will use the `.textContent` of the item.
17
+ * Use this when the content is complex, or you have non-textual content inside.
18
+ */
19
+ textValue?: string;
20
+ /**
21
+ * Optional icon to display on the left side of the item content.
22
+ */
23
+ icon?: ElementType<IconProps>;
24
+ }
25
+ export interface DropdownMenuItemProps extends Omit<DropdownPrimitive.DropdownMenuItemProps, 'asChild' | keyof DropdownMenuItemOptions>, DropdownMenuItemOptions {
26
+ }
27
+ export declare const DropdownMenuItem: import("react").ForwardRefExoticComponent<DropdownMenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
28
+ export {};
@@ -0,0 +1,5 @@
1
+ import type * as Polymorphic from '../../utils/polymorphic';
2
+ declare type DropdownTriggerComponent = Polymorphic.ForwardRefComponent<'button'>;
3
+ export declare type DropdownMenuTriggerProps = Polymorphic.PropsOf<DropdownTriggerComponent>;
4
+ export declare const DropdownMenuTrigger: DropdownTriggerComponent;
5
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type DropdownMenuContentProps } from './dropdown-menu-content';
3
+ import { type DropdownMenuDividerProps } from './dropdown-menu-divider';
4
+ import { type DropdownMenuItemProps } from './dropdown-menu-item';
5
+ import type { DropdownMenuTriggerProps } from './dropdown-menu-trigger';
6
+ interface DropdownMenuRootProps {
7
+ children: ReactNode;
8
+ /**
9
+ * If `true` the dropdown menu will be open
10
+ */
11
+ isOpen?: boolean;
12
+ /**
13
+ * The open state of the submenu when it is initially rendered.
14
+ * Use when you do not need to control its open state.
15
+ */
16
+ defaultOpen?: boolean;
17
+ /**
18
+ * Callback invoked open state changes
19
+ */
20
+ onOpenChange?: (isOpen: boolean) => void;
21
+ }
22
+ declare function DropdownMenuRoot(props: DropdownMenuRootProps): JSX.Element;
23
+ export declare const DropdownMenu: typeof DropdownMenuRoot & {
24
+ Trigger: import("../../utils/polymorphic").ForwardRefComponent<"button", {}>;
25
+ Content: import("react").ForwardRefExoticComponent<DropdownMenuContentProps & import("react").RefAttributes<HTMLDivElement>>;
26
+ Item: import("react").ForwardRefExoticComponent<DropdownMenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
27
+ Divider: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>>;
28
+ };
29
+ export type { DropdownMenuRootProps, DropdownMenuTriggerProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuDividerProps, };
@@ -0,0 +1 @@
1
+ export * from './dropdown-menu';
@@ -5,7 +5,6 @@ export * from './heading';
5
5
  export * from './hint-box';
6
6
  export * from './icon';
7
7
  export * from './icon-button';
8
- export * from './image';
9
8
  export * from './text-field';
10
9
  export * from './label';
11
10
  export * from './link';
package/dist/index.d.ts CHANGED
@@ -922,8 +922,8 @@ interface IconOptions {
922
922
  */
923
923
  color?: IconColor;
924
924
  }
925
- declare type OmittedProps$9 = 'color' | 'onClick' | 'width' | 'height' | 'fontSize';
926
- interface IconProps extends Omit<SVGAttributes<SVGElement>, OmittedProps$9>, IconOptions {
925
+ declare type OmittedProps$8 = 'color' | 'onClick' | 'width' | 'height' | 'fontSize';
926
+ interface IconProps extends Omit<SVGAttributes<SVGElement>, OmittedProps$8>, IconOptions {
927
927
  }
928
928
 
929
929
  interface CreateIconOptions {
@@ -3806,19 +3806,6 @@ declare type IconButtonComponent = ForwardRefComponent<'button', IconButtonOptio
3806
3806
  declare type IconButtonProps = PropsOf<IconButtonComponent>;
3807
3807
  declare const IconButton: IconButtonComponent;
3808
3808
 
3809
- interface ImageOptions {
3810
- src?: string;
3811
- alt?: string;
3812
- width: string | number;
3813
- height: string | number;
3814
- loading?: 'eager' | 'lazy';
3815
- borderRadius?: keyof Theme['radii'];
3816
- }
3817
- declare type OmittedProps$8 = 'width' | 'height';
3818
- interface ImageProps extends Omit<HTMLQdsProps<'img'>, OmittedProps$8>, ImageOptions {
3819
- }
3820
- declare function Image({ src, loading, width, height, borderRadius, ...restProps }: ImageProps): JSX.Element;
3821
-
3822
3809
  interface InputBaseOptions {
3823
3810
  /**
3824
3811
  * If `true`, the input will be invalid
@@ -5519,4 +5506,4 @@ declare function useStableId(fixedId?: string | null): string;
5519
5506
  */
5520
5507
  declare const useSafeLayoutEffect: typeof useLayoutEffect;
5521
5508
 
5522
- export { AlertCircleIcon, AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, Avatar, AvatarProps, BellIcon, BellOffIcon, BookmarkIcon, Button, ButtonProps, CalendarIcon, CameraIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CreateIconOptions, Divider, DividerProps, ForwardRefComponent, GlobalStyles, GlobeIcon, Heading, HeadingProps, HeartFilledIcon, HeartIcon, HelpCircleIcon, HintBox, HintBoxProps, HintBoxTitleProps, HistoryIcon, HomeIcon, IconButton, IconButtonProps, IconProps, Image, ImageIcon, ImageProps, InputBase, InputBaseOptions, InputBaseProps, IntrinsicElement, Label, LabelProps, Link, LinkProps, ListFilterIcon, ListIcon, LoadingDots, LoadingDotsProps, LogOutIcon, MapIcon, MapPinIcon, MenuIcon, MessageCircleIcon, MinusIcon, MoreHorizontalIcon, MoreVerticalIcon, OwnProps, Paragraph, ParagraphProps, PenIcon, PlusIcon, PropsOf, QdsProvider, RadioCardProps, RadioGroup, RadioGroupLabelProps, RadioGroupProps, SearchIcon, Select, SelectBase, SelectBaseOptions, SelectOptionProps, SelectProps, SettingsIcon, ShareIcon, SlidersIcon, Spacer, SpacerProps, Stack, StackProps, StarFilledIcon, StarIcon, TextField, TextFieldProps, Textarea, TextareaBase, TextareaBaseOptions, TextareaBaseProps, TextareaProps, Theme, ThemeOverrides, TrashIcon, UseBreakpointOptions, UseBreakpointValueProps, UseFormFieldProps, UseImageProps, UserIcon, VariantProps, XCircleIcon, XIcon, createIcon, createLucideIcon, createStyle, createStyleVariants, getFormFieldBaseStyles, overrideTheme, pxToRem, theme, useBreakpoint, useBreakpointValue, useFormField, useImage, useSafeLayoutEffect, useStableId };
5509
+ export { AlertCircleIcon, AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, Avatar, AvatarProps, BellIcon, BellOffIcon, BookmarkIcon, Button, ButtonProps, CalendarIcon, CameraIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CreateIconOptions, Divider, DividerProps, ForwardRefComponent, GlobalStyles, GlobeIcon, Heading, HeadingProps, HeartFilledIcon, HeartIcon, HelpCircleIcon, HintBox, HintBoxProps, HintBoxTitleProps, HistoryIcon, HomeIcon, IconButton, IconButtonProps, IconProps, ImageIcon, InputBase, InputBaseOptions, InputBaseProps, IntrinsicElement, Label, LabelProps, Link, LinkProps, ListFilterIcon, ListIcon, LoadingDots, LoadingDotsProps, LogOutIcon, MapIcon, MapPinIcon, MenuIcon, MessageCircleIcon, MinusIcon, MoreHorizontalIcon, MoreVerticalIcon, OwnProps, Paragraph, ParagraphProps, PenIcon, PlusIcon, PropsOf, QdsProvider, RadioCardProps, RadioGroup, RadioGroupLabelProps, RadioGroupProps, SearchIcon, Select, SelectBase, SelectBaseOptions, SelectOptionProps, SelectProps, SettingsIcon, ShareIcon, SlidersIcon, Spacer, SpacerProps, Stack, StackProps, StarFilledIcon, StarIcon, TextField, TextFieldProps, Textarea, TextareaBase, TextareaBaseOptions, TextareaBaseProps, TextareaProps, Theme, ThemeOverrides, TrashIcon, UseBreakpointOptions, UseBreakpointValueProps, UseFormFieldProps, UseImageProps, UserIcon, VariantProps, XCircleIcon, XIcon, createIcon, createLucideIcon, createStyle, createStyleVariants, getFormFieldBaseStyles, overrideTheme, pxToRem, theme, useBreakpoint, useBreakpointValue, useFormField, useImage, useSafeLayoutEffect, useStableId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qasa/qds-ui",
3
- "version": "0.10.0-next.0",
3
+ "version": "0.10.0-next.2",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,6 +52,7 @@
52
52
  "@storybook/testing-library": "^0.2.2",
53
53
  "@testing-library/jest-dom": "^5.16.5",
54
54
  "@testing-library/react": "^13.4.0",
55
+ "@testing-library/user-event": "^14.5.2",
55
56
  "@types/jest-axe": "^3.5.5",
56
57
  "@types/node": "^16.0.0",
57
58
  "@types/react": "^18.0.21",
@@ -103,6 +104,7 @@
103
104
  "node": ">=14"
104
105
  },
105
106
  "dependencies": {
106
- "@radix-ui/react-radio-group": "^1.1.3"
107
+ "@radix-ui/react-radio-group": "^1.1.3",
108
+ "@radix-ui/react-dropdown-menu": "^2.0.6"
107
109
  }
108
110
  }
@@ -1,16 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Theme } from '../../theme';
3
- import type { HTMLQdsProps } from '../../types';
4
- interface ImageOptions {
5
- src?: string;
6
- alt?: string;
7
- width: string | number;
8
- height: string | number;
9
- loading?: 'eager' | 'lazy';
10
- borderRadius?: keyof Theme['radii'];
11
- }
12
- declare type OmittedProps = 'width' | 'height';
13
- export interface ImageProps extends Omit<HTMLQdsProps<'img'>, OmittedProps>, ImageOptions {
14
- }
15
- export declare function Image({ src, loading, width, height, borderRadius, ...restProps }: ImageProps): JSX.Element;
16
- export {};
@@ -1 +0,0 @@
1
- export * from './image';
@@ -1,16 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Theme } from '../../theme';
3
- import type { HTMLQdsProps } from '../../types';
4
- interface ImageOptions {
5
- src?: string;
6
- alt?: string;
7
- width: string | number;
8
- height: string | number;
9
- loading?: 'eager' | 'lazy';
10
- borderRadius?: keyof Theme['radii'];
11
- }
12
- declare type OmittedProps = 'width' | 'height';
13
- export interface ImageProps extends Omit<HTMLQdsProps<'img'>, OmittedProps>, ImageOptions {
14
- }
15
- export declare function Image({ src, loading, width, height, borderRadius, ...restProps }: ImageProps): JSX.Element;
16
- export {};
@@ -1 +0,0 @@
1
- export * from './image';