@dt-dds/react-dropdown 1.0.0-beta.81 → 1.0.0-beta.82

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @dt-ui/react-dropdown
2
2
 
3
+ ## 1.0.0-beta.82
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: simplify dropdown types
8
+ - Updated dependencies [223664b]
9
+ - @dt-dds/react-box@1.0.0-beta.61
10
+
3
11
  ## 1.0.0-beta.81
4
12
 
5
13
  ### Minor Changes
package/README.md CHANGED
@@ -40,20 +40,21 @@ export const App = () => {
40
40
  | `onClose` | `() => void` | — | Called when a click is detected outside the dropdown/anchor. |
41
41
  | `as` | `keyof JSX.IntrinsicElements` | `"div"` | Underlying HTML element (e.g., `"ul"` for list semantics). |
42
42
  | `placement` | `DropdownPlacement` | `bottom` | Dropdown position. |
43
+ | `...rest` | `HTMLAttributes` | — | Standard HTML attributes. |
43
44
 
44
45
  ### Dropdown.Option
45
46
 
46
- | Property | Type | Default | Description |
47
- | --------------- | ----------------------------------------------------- | ----------------- | ----------------------------------------------------------------------- |
48
- | `style` | `React.CSSProperties` | — | Inline styles for the option element. |
49
- | `children` | `ReactNode` | — | Content of the option. |
50
- | `dataTestId` | `string` | `dropdown-option` | Customizable test identifier for the option element. |
51
- | `isDisabled` | `boolean` | `false` | When `true`, sets `aria-disabled` and blocks click/keyboard activation. |
52
- | `isSelected` | `boolean` | `false` | Reflects selection state via `aria-selected` and styling. |
53
- | `isHighlighted` | `boolean` | `false` | Adds `data-highlighted="true"` for hover/active row styling. |
54
- | `isMulti` | `boolean` | `false` | Optional styling hint for multi-select contexts (no selection logic). |
55
- | `onClick` | `(event: MouseEvent<HTMLLIElement>) => void` | — | Click handler. |
56
- | `...rest` | `React.LiHTMLAttributes<HTMLLIElement>` & `BaseProps` | — | Additional LI attributes (e.g., `role="option"`, `tabIndex`, etc.). |
47
+ | Property | Type | Default | Description |
48
+ | --------------- | -------------------------------------------- | ----------------- | ----------------------------------------------------------------------- |
49
+ | `style` | `React.CSSProperties` | — | Inline styles for the option element. |
50
+ | `children` | `ReactNode` | — | Content of the option. |
51
+ | `dataTestId` | `string` | `dropdown-option` | Customizable test identifier for the option element. |
52
+ | `isDisabled` | `boolean` | `false` | When `true`, sets `aria-disabled` and blocks click/keyboard activation. |
53
+ | `isSelected` | `boolean` | `false` | Reflects selection state via `aria-selected` and styling. |
54
+ | `isHighlighted` | `boolean` | `false` | Adds `data-highlighted="true"` for hover/active row styling. |
55
+ | `isMulti` | `boolean` | `false` | Optional styling hint for multi-select contexts (no selection logic). |
56
+ | `onClick` | `(event: MouseEvent<HTMLLIElement>) => void` | — | Click handler. |
57
+ | `...rest` | `HTMLAttributes` | — | Standard HTML attributes. |
57
58
 
58
59
  ## Stack
59
60
 
package/dist/index.d.mts CHANGED
@@ -1,24 +1,23 @@
1
1
  import { CustomTheme } from '@dt-dds/themes';
2
2
  import * as react from 'react';
3
- import { ElementType, ComponentPropsWithoutRef, RefObject } from 'react';
3
+ import { HTMLAttributes, ElementType, MouseEvent, RefObject } from 'react';
4
4
  import { BaseProps } from '@dt-dds/react-core';
5
5
 
6
- type DropdownOptionBaseProps = BaseProps & {
6
+ interface DropdownOptionProps extends BaseProps, Omit<HTMLAttributes<HTMLElement>, 'onClick'> {
7
7
  isDisabled?: boolean;
8
8
  isSelected?: boolean;
9
9
  isHighlighted?: boolean;
10
10
  isMulti?: boolean;
11
- };
12
- type DropdownOptionProps<E extends ElementType = 'li'> = DropdownOptionBaseProps & {
13
- as?: E;
14
- } & ComponentPropsWithoutRef<E>;
15
- declare const DropdownOption: react.ForwardRefExoticComponent<Omit<DropdownOptionProps<ElementType>, "ref"> & react.RefAttributes<HTMLLIElement>>;
11
+ as?: ElementType;
12
+ onClick?: (e: MouseEvent<HTMLElement>) => void;
13
+ }
14
+ declare const DropdownOption: react.ForwardRefExoticComponent<DropdownOptionProps & react.RefAttributes<HTMLLIElement>>;
16
15
 
17
16
  type DropdownVariant = 'outlined' | 'bottom-line';
18
17
  type DropdownFill = 'default' | 'contrast' | 'light';
19
18
  type DropdownPlacement = 'bottom' | 'top' | 'left' | 'right';
20
19
 
21
- interface DropdownProps extends BaseProps {
20
+ interface DropdownProps extends BaseProps, HTMLAttributes<HTMLElement> {
22
21
  isOpen?: boolean;
23
22
  anchorRef: RefObject<HTMLElement | null>;
24
23
  matchWidth?: boolean;
@@ -30,7 +29,7 @@ interface DropdownProps extends BaseProps {
30
29
  isFocusable?: boolean;
31
30
  }
32
31
  declare const Dropdown: react.ForwardRefExoticComponent<DropdownProps & react.RefAttributes<HTMLElement>> & {
33
- Option: react.ForwardRefExoticComponent<Omit<DropdownOptionProps<react.ElementType>, "ref"> & react.RefAttributes<HTMLLIElement>>;
32
+ Option: react.ForwardRefExoticComponent<DropdownOptionProps & react.RefAttributes<HTMLLIElement>>;
34
33
  };
35
34
 
36
35
  declare module '@emotion/react' {
@@ -38,4 +37,4 @@ declare module '@emotion/react' {
38
37
  }
39
38
  }
40
39
 
41
- export { Dropdown, type DropdownFill, DropdownOption, type DropdownOptionBaseProps, type DropdownOptionProps, type DropdownPlacement, type DropdownProps, type DropdownVariant };
40
+ export { Dropdown, type DropdownFill, DropdownOption, type DropdownOptionProps, type DropdownPlacement, type DropdownProps, type DropdownVariant };
package/dist/index.d.ts CHANGED
@@ -1,24 +1,23 @@
1
1
  import { CustomTheme } from '@dt-dds/themes';
2
2
  import * as react from 'react';
3
- import { ElementType, ComponentPropsWithoutRef, RefObject } from 'react';
3
+ import { HTMLAttributes, ElementType, MouseEvent, RefObject } from 'react';
4
4
  import { BaseProps } from '@dt-dds/react-core';
5
5
 
6
- type DropdownOptionBaseProps = BaseProps & {
6
+ interface DropdownOptionProps extends BaseProps, Omit<HTMLAttributes<HTMLElement>, 'onClick'> {
7
7
  isDisabled?: boolean;
8
8
  isSelected?: boolean;
9
9
  isHighlighted?: boolean;
10
10
  isMulti?: boolean;
11
- };
12
- type DropdownOptionProps<E extends ElementType = 'li'> = DropdownOptionBaseProps & {
13
- as?: E;
14
- } & ComponentPropsWithoutRef<E>;
15
- declare const DropdownOption: react.ForwardRefExoticComponent<Omit<DropdownOptionProps<ElementType>, "ref"> & react.RefAttributes<HTMLLIElement>>;
11
+ as?: ElementType;
12
+ onClick?: (e: MouseEvent<HTMLElement>) => void;
13
+ }
14
+ declare const DropdownOption: react.ForwardRefExoticComponent<DropdownOptionProps & react.RefAttributes<HTMLLIElement>>;
16
15
 
17
16
  type DropdownVariant = 'outlined' | 'bottom-line';
18
17
  type DropdownFill = 'default' | 'contrast' | 'light';
19
18
  type DropdownPlacement = 'bottom' | 'top' | 'left' | 'right';
20
19
 
21
- interface DropdownProps extends BaseProps {
20
+ interface DropdownProps extends BaseProps, HTMLAttributes<HTMLElement> {
22
21
  isOpen?: boolean;
23
22
  anchorRef: RefObject<HTMLElement | null>;
24
23
  matchWidth?: boolean;
@@ -30,7 +29,7 @@ interface DropdownProps extends BaseProps {
30
29
  isFocusable?: boolean;
31
30
  }
32
31
  declare const Dropdown: react.ForwardRefExoticComponent<DropdownProps & react.RefAttributes<HTMLElement>> & {
33
- Option: react.ForwardRefExoticComponent<Omit<DropdownOptionProps<react.ElementType>, "ref"> & react.RefAttributes<HTMLLIElement>>;
32
+ Option: react.ForwardRefExoticComponent<DropdownOptionProps & react.RefAttributes<HTMLLIElement>>;
34
33
  };
35
34
 
36
35
  declare module '@emotion/react' {
@@ -38,4 +37,4 @@ declare module '@emotion/react' {
38
37
  }
39
38
  }
40
39
 
41
- export { Dropdown, type DropdownFill, DropdownOption, type DropdownOptionBaseProps, type DropdownOptionProps, type DropdownPlacement, type DropdownProps, type DropdownVariant };
40
+ export { Dropdown, type DropdownFill, DropdownOption, type DropdownOptionProps, type DropdownPlacement, type DropdownProps, type DropdownVariant };
package/dist/index.mjs CHANGED
@@ -31,7 +31,11 @@ var __objRest = (source, exclude) => {
31
31
  };
32
32
 
33
33
  // src/Dropdown.tsx
34
- import { forwardRef as forwardRef2, useCallback, useRef } from "react";
34
+ import {
35
+ forwardRef as forwardRef2,
36
+ useCallback,
37
+ useRef
38
+ } from "react";
35
39
  import { FocusTrap } from "focus-trap-react";
36
40
  import { Portal, useClickOutside } from "@dt-dds/react-core";
37
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-dds/react-dropdown",
3
- "version": "1.0.0-beta.81",
3
+ "version": "1.0.0-beta.82",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
@@ -20,7 +20,7 @@
20
20
  "test:update:snapshot": "jest -u"
21
21
  },
22
22
  "dependencies": {
23
- "@dt-dds/react-box": "1.0.0-beta.60",
23
+ "@dt-dds/react-box": "1.0.0-beta.61",
24
24
  "@dt-dds/react-core": "1.0.0-beta.53",
25
25
  "@dt-dds/react-icon": "1.0.0-beta.56",
26
26
  "@dt-dds/react-icon-button": "1.0.0-beta.22",