@dt-dds/react-dropdown 1.0.0-beta.81 → 1.0.0-beta.83
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 +21 -0
- package/README.md +12 -11
- package/dist/index.d.mts +9 -10
- package/dist/index.d.ts +9 -10
- package/dist/index.mjs +5 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @dt-ui/react-dropdown
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.83
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: guard against SSR access to document.body
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies [223664b]
|
|
10
|
+
- @dt-dds/react-core@1.0.0-beta.54
|
|
11
|
+
- @dt-dds/react-icon@1.0.0-beta.57
|
|
12
|
+
- @dt-dds/react-icon-button@1.0.0-beta.23
|
|
13
|
+
- @dt-dds/react-typography@1.0.0-beta.45
|
|
14
|
+
- @dt-dds/react-box@1.0.0-beta.62
|
|
15
|
+
|
|
16
|
+
## 1.0.0-beta.82
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- refactor: simplify dropdown types
|
|
21
|
+
- Updated dependencies [223664b]
|
|
22
|
+
- @dt-dds/react-box@1.0.0-beta.61
|
|
23
|
+
|
|
3
24
|
## 1.0.0-beta.81
|
|
4
25
|
|
|
5
26
|
### 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
|
|
47
|
-
| --------------- |
|
|
48
|
-
| `style` | `React.CSSProperties`
|
|
49
|
-
| `children` | `ReactNode`
|
|
50
|
-
| `dataTestId` | `string`
|
|
51
|
-
| `isDisabled` | `boolean`
|
|
52
|
-
| `isSelected` | `boolean`
|
|
53
|
-
| `isHighlighted` | `boolean`
|
|
54
|
-
| `isMulti` | `boolean`
|
|
55
|
-
| `onClick` | `(event: MouseEvent<HTMLLIElement>) => void`
|
|
56
|
-
| `...rest` | `
|
|
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,
|
|
3
|
+
import { HTMLAttributes, ElementType, MouseEvent, RefObject } from 'react';
|
|
4
4
|
import { BaseProps } from '@dt-dds/react-core';
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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<
|
|
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
|
|
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,
|
|
3
|
+
import { HTMLAttributes, ElementType, MouseEvent, RefObject } from 'react';
|
|
4
4
|
import { BaseProps } from '@dt-dds/react-core';
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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<
|
|
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
|
|
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 {
|
|
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.
|
|
3
|
+
"version": "1.0.0-beta.83",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"test:update:snapshot": "jest -u"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dt-dds/react-box": "1.0.0-beta.
|
|
24
|
-
"@dt-dds/react-core": "1.0.0-beta.
|
|
25
|
-
"@dt-dds/react-icon": "1.0.0-beta.
|
|
26
|
-
"@dt-dds/react-icon-button": "1.0.0-beta.
|
|
27
|
-
"@dt-dds/react-typography": "1.0.0-beta.
|
|
23
|
+
"@dt-dds/react-box": "1.0.0-beta.62",
|
|
24
|
+
"@dt-dds/react-core": "1.0.0-beta.54",
|
|
25
|
+
"@dt-dds/react-icon": "1.0.0-beta.57",
|
|
26
|
+
"@dt-dds/react-icon-button": "1.0.0-beta.23",
|
|
27
|
+
"@dt-dds/react-typography": "1.0.0-beta.45",
|
|
28
28
|
"@dt-dds/themes": "1.0.0-beta.10",
|
|
29
29
|
"focus-trap-react": "^11.0.4"
|
|
30
30
|
},
|