uikit-react-public 0.29.5 → 0.29.6
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/dist/components/Overlay/Overlay.d.ts +14 -3
- package/dist/components/Overlay/Overlay.stories.d.ts +31 -2
- package/dist/components/Overlay/__tests__/Overlay.test.d.ts +1 -0
- package/dist/components/Overlay/index.d.ts +1 -1
- package/dist/components/Select/Select.stories.d.ts +12 -0
- package/dist/components/Select/Select.types.d.ts +7 -0
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +1 -1
- package/dist/components/Select/subcomponents/Panel.d.ts +8 -2
- package/dist/index.js +4780 -4662
- package/lib/components/Overlay/Overlay.tsx +67 -21
- package/lib/components/Overlay/__tests__/Overlay.test.tsx +81 -0
- package/lib/components/Overlay/index.ts +1 -1
- package/lib/components/Select/Select.stories.tsx +7 -0
- package/lib/components/Select/Select.tsx +7 -0
- package/lib/components/Select/Select.types.ts +8 -0
- package/lib/components/Select/__tests__/Select.test.tsx +181 -1
- package/lib/components/Select/subcomponents/CustomSelect.tsx +109 -27
- package/lib/components/Select/subcomponents/Panel.tsx +40 -10
- package/package.json +1 -1
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { HTMLAttributes, RefObject, ReactElement } from 'react';
|
|
2
|
-
import { Placement } from '@floating-ui/react-dom';
|
|
2
|
+
import { Placement, FlipOptions, ShiftOptions } from '@floating-ui/react-dom';
|
|
3
3
|
export declare const NAME = "ucl-overlay";
|
|
4
|
+
type OverlaySizeOptions = {
|
|
5
|
+
padding?: number;
|
|
6
|
+
matchReferenceWidth?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type OverlaySize = {
|
|
9
|
+
referenceWidth: number;
|
|
10
|
+
availableWidth: number;
|
|
11
|
+
availableHeight: number;
|
|
12
|
+
};
|
|
4
13
|
export interface OverlayProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
14
|
reference: RefObject<HTMLElement | null>;
|
|
6
15
|
placement?: Placement;
|
|
7
16
|
blanket?: boolean;
|
|
8
|
-
flip?: boolean;
|
|
9
|
-
shift?: boolean;
|
|
17
|
+
flip?: boolean | FlipOptions;
|
|
18
|
+
shift?: boolean | ShiftOptions;
|
|
10
19
|
offset?: number;
|
|
20
|
+
size?: boolean | OverlaySizeOptions;
|
|
11
21
|
arrow?: ReactElement;
|
|
12
22
|
arrowClassName?: string;
|
|
23
|
+
onSizeChange?: (size: OverlaySize) => void;
|
|
13
24
|
onBlanketClick?: (ev: React.MouseEvent<HTMLDivElement>) => void;
|
|
14
25
|
}
|
|
15
26
|
export type Ref = HTMLDivElement | null;
|
|
@@ -43,11 +43,40 @@ declare const meta: {
|
|
|
43
43
|
reference: import('react').RefObject<HTMLElement | null>;
|
|
44
44
|
placement?: import('@floating-ui/utils').Placement | undefined;
|
|
45
45
|
blanket?: boolean | undefined;
|
|
46
|
-
flip?: boolean |
|
|
47
|
-
|
|
46
|
+
flip?: boolean | {
|
|
47
|
+
padding?: import('@floating-ui/utils').Padding | undefined;
|
|
48
|
+
mainAxis?: boolean | undefined;
|
|
49
|
+
crossAxis?: boolean | "alignment" | undefined;
|
|
50
|
+
fallbackPlacements?: Array<import('@floating-ui/utils').Placement> | undefined;
|
|
51
|
+
fallbackStrategy?: "bestFit" | "initialPlacement" | undefined;
|
|
52
|
+
fallbackAxisSideDirection?: "none" | "start" | "end" | undefined;
|
|
53
|
+
flipAlignment?: boolean | undefined;
|
|
54
|
+
rootBoundary?: import('@floating-ui/core').RootBoundary | undefined;
|
|
55
|
+
elementContext?: import('@floating-ui/core').ElementContext | undefined;
|
|
56
|
+
altBoundary?: boolean | undefined;
|
|
57
|
+
boundary?: import('@floating-ui/dom').Boundary | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
shift?: boolean | {
|
|
60
|
+
padding?: import('@floating-ui/utils').Padding | undefined;
|
|
61
|
+
mainAxis?: boolean | undefined;
|
|
62
|
+
crossAxis?: boolean | undefined;
|
|
63
|
+
rootBoundary?: import('@floating-ui/core').RootBoundary | undefined;
|
|
64
|
+
elementContext?: import('@floating-ui/core').ElementContext | undefined;
|
|
65
|
+
altBoundary?: boolean | undefined;
|
|
66
|
+
limiter?: {
|
|
67
|
+
fn: (state: import('@floating-ui/core').MiddlewareState) => import('@floating-ui/utils').Coords;
|
|
68
|
+
options?: any;
|
|
69
|
+
} | undefined;
|
|
70
|
+
boundary?: import('@floating-ui/dom').Boundary | undefined;
|
|
71
|
+
} | undefined;
|
|
48
72
|
offset?: number | undefined;
|
|
73
|
+
size?: (boolean | {
|
|
74
|
+
padding?: number;
|
|
75
|
+
matchReferenceWidth?: boolean;
|
|
76
|
+
}) | undefined;
|
|
49
77
|
arrow?: import('react').ReactElement | undefined;
|
|
50
78
|
arrowClassName?: string | undefined;
|
|
79
|
+
onSizeChange?: ((size: import('./Overlay').OverlaySize) => void) | undefined;
|
|
51
80
|
onBlanketClick?: ((ev: React.MouseEvent<HTMLDivElement>) => void) | undefined;
|
|
52
81
|
defaultChecked?: boolean | undefined | undefined;
|
|
53
82
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Overlay';
|
|
2
|
-
export type { OverlayProps } from './Overlay';
|
|
2
|
+
export type { OverlayProps, OverlaySize } from './Overlay';
|
|
@@ -154,6 +154,18 @@ declare const meta: {
|
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
|
+
dropdownWidth: {
|
|
158
|
+
description: string;
|
|
159
|
+
control: {
|
|
160
|
+
type: "radio";
|
|
161
|
+
};
|
|
162
|
+
options: string[];
|
|
163
|
+
table: {
|
|
164
|
+
type: {
|
|
165
|
+
summary: string;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
157
169
|
panelClassName: {
|
|
158
170
|
description: string;
|
|
159
171
|
control: {
|
|
@@ -26,6 +26,7 @@ export type OptionData<T> = {
|
|
|
26
26
|
* Additional props forwarded to the filter input when `filterable` is true
|
|
27
27
|
*/
|
|
28
28
|
export type FilterInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'disabled' | 'ref' | 'role' | 'aria-autocomplete' | 'aria-label'>;
|
|
29
|
+
export type SelectDropdownWidth = 'content' | 'match-select';
|
|
29
30
|
type SelectBaseProps<T = string | number> = Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> & {
|
|
30
31
|
/**
|
|
31
32
|
* Controls keyboard selection behaviour in the custom select variant.
|
|
@@ -77,6 +78,12 @@ type SelectBaseProps<T = string | number> = Omit<React.HTMLAttributes<HTMLElemen
|
|
|
77
78
|
* Allow long option labels to wrap instead of truncating
|
|
78
79
|
*/
|
|
79
80
|
lineBreak?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Controls the width of the custom options panel.
|
|
83
|
+
* - `content` (default): panel is at least the Select width and can grow to fit option labels.
|
|
84
|
+
* - `match-select`: panel width is capped to the Select width.
|
|
85
|
+
*/
|
|
86
|
+
dropdownWidth?: SelectDropdownWidth;
|
|
80
87
|
/**
|
|
81
88
|
* Custom className for the root element
|
|
82
89
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InternalSelectProps } from '../Select.types';
|
|
2
2
|
type CustomSelectProps<T> = Omit<InternalSelectProps<T>, 'native' | 'nativeHtmlAttributes'>;
|
|
3
|
-
declare const CustomSelect: <T extends string | number>({ selectionBehaviour, value, options, onValueChange, disabled, clearable, placeholder, lineBreak, filterInputProps, width, testId, className, panelClassName, filterable, ref, ...props }: CustomSelectProps<T>) => import("react").JSX.Element;
|
|
3
|
+
declare const CustomSelect: <T extends string | number>({ selectionBehaviour, value, options, onValueChange, disabled, clearable, placeholder, lineBreak, dropdownWidth, filterInputProps, width, testId, className, panelClassName, filterable, ref, ...props }: CustomSelectProps<T>) => import("react").JSX.Element;
|
|
4
4
|
export default CustomSelect;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { SelectDropdownWidth } from '../Select.types';
|
|
2
|
+
type PanelProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
3
|
+
dropdownWidth?: SelectDropdownWidth;
|
|
4
|
+
referenceWidth?: number;
|
|
5
|
+
availableHeight?: number;
|
|
6
|
+
maxWidth?: number;
|
|
7
|
+
};
|
|
8
|
+
declare const Panel: ({ className, dropdownWidth, referenceWidth, availableHeight, maxWidth, ...props }: PanelProps) => import("react").JSX.Element;
|
|
3
9
|
export default Panel;
|