@lumx/react 4.5.2-alpha.3 → 4.5.2-alpha.4
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/index.d.ts +91 -24
- package/index.js +109 -42
- package/index.js.map +1 -1
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Kind as Kind$1, HorizontalAlignment as HorizontalAlignment$1,
|
|
1
|
+
import { Kind as Kind$1, HorizontalAlignment as HorizontalAlignment$1, Theme as Theme$1, Size as Size$1, Orientation as Orientation$1, Alignment as Alignment$1, AspectRatio as AspectRatio$1, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, Emphasis as Emphasis$1 } from '@lumx/core/js/constants';
|
|
2
2
|
export * from '@lumx/core/js/constants';
|
|
3
3
|
import * as _lumx_core_js_types from '@lumx/core/js/types';
|
|
4
|
-
import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf as ValueOf$1, PropsToOverride,
|
|
4
|
+
import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf as ValueOf$1, PropsToOverride, HasCloseMode as HasCloseMode$1, HasClassName as HasClassName$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1 } from '@lumx/core/js/types';
|
|
5
5
|
export * from '@lumx/core/js/types';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, CSSProperties, ImgHTMLAttributes, AriaAttributes as AriaAttributes$1, SetStateAction, Key, ElementType, ComponentProps } from 'react';
|
|
@@ -242,7 +242,7 @@ interface AutocompleteMultipleProps extends AutocompleteProps {
|
|
|
242
242
|
/** Alignment of the chips in the autocomplete. */
|
|
243
243
|
chipsAlignment?: HorizontalAlignment$1;
|
|
244
244
|
/** Selected value render function. Default: Renders the value inside of a Chip. */
|
|
245
|
-
selectedChipRender(choice: any, index: number, onClear?: (event
|
|
245
|
+
selectedChipRender(choice: any, index: number, onClear?: (event?: React.MouseEvent, val?: any) => void, isDisabled?: boolean): ReactNode | string;
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* AutocompleteMultiple component.
|
|
@@ -253,6 +253,24 @@ interface AutocompleteMultipleProps extends AutocompleteProps {
|
|
|
253
253
|
*/
|
|
254
254
|
declare const AutocompleteMultiple: Comp<AutocompleteMultipleProps, HTMLDivElement>;
|
|
255
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Require either `aria-label` or `arial-labelledby` prop.
|
|
258
|
+
* If none are set, the order will prioritize `aria-labelledby` over `aria-label` as it
|
|
259
|
+
* needs a visible element.
|
|
260
|
+
*/
|
|
261
|
+
type HasAriaLabelOrLabelledBy<T = string | undefined> = T extends string ? {
|
|
262
|
+
/**
|
|
263
|
+
* The id of the element to use as title of the dialog. Can be within or out of the dialog.
|
|
264
|
+
* Although it is not recommended, aria-label can be used instead if no visible element is available.
|
|
265
|
+
*/
|
|
266
|
+
'aria-labelledby': T;
|
|
267
|
+
/** The label of the dialog. */
|
|
268
|
+
'aria-label'?: undefined;
|
|
269
|
+
} : {
|
|
270
|
+
'aria-label': string;
|
|
271
|
+
'aria-labelledby'?: undefined;
|
|
272
|
+
};
|
|
273
|
+
|
|
256
274
|
interface HasClassName {
|
|
257
275
|
/**
|
|
258
276
|
* Class name forwarded to the root element of the component.
|
|
@@ -755,7 +773,7 @@ interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
|
755
773
|
* @param ref Component ref.
|
|
756
774
|
* @return React element.
|
|
757
775
|
*/
|
|
758
|
-
declare const Button: Comp<ButtonProps,
|
|
776
|
+
declare const Button: Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>;
|
|
759
777
|
|
|
760
778
|
interface IconButtonProps$1 extends BaseButtonProps {
|
|
761
779
|
/**
|
|
@@ -867,33 +885,72 @@ declare const Checkbox: Comp<CheckboxProps, HTMLDivElement>;
|
|
|
867
885
|
/**
|
|
868
886
|
* Chip sizes.
|
|
869
887
|
*/
|
|
870
|
-
type ChipSize = Extract<Size
|
|
888
|
+
type ChipSize = Extract<Size, 's' | 'm'>;
|
|
871
889
|
/**
|
|
872
890
|
* Defines the props of the component.
|
|
873
891
|
*/
|
|
874
|
-
interface ChipProps extends
|
|
892
|
+
interface ChipProps$1 extends HasClassName, HasDisabled, HasTheme, HasAriaDisabled {
|
|
875
893
|
/** A component to be rendered after the content. */
|
|
876
|
-
after?:
|
|
894
|
+
after?: JSXElement;
|
|
877
895
|
/** A component to be rendered before the content. */
|
|
878
|
-
before?:
|
|
896
|
+
before?: JSXElement;
|
|
879
897
|
/** Color variant. */
|
|
880
|
-
color?: ColorPalette
|
|
898
|
+
color?: ColorPalette;
|
|
881
899
|
/** Whether the component is clickable or not. */
|
|
882
900
|
isClickable?: boolean;
|
|
883
|
-
/** Whether the component is disabled or not. */
|
|
884
|
-
isDisabled?: boolean;
|
|
885
901
|
/** Whether the chip is currently in a highlighted state or not. */
|
|
886
902
|
isHighlighted?: boolean;
|
|
887
903
|
/** Whether the component is selected or not. */
|
|
888
904
|
isSelected?: boolean;
|
|
889
905
|
/** Size variant. */
|
|
890
906
|
size?: ChipSize;
|
|
907
|
+
/** href for the chip if it is a link */
|
|
908
|
+
href?: string;
|
|
909
|
+
/** reference to the root element */
|
|
910
|
+
ref?: CommonRef;
|
|
891
911
|
/** On "after" element clicked callback. */
|
|
892
|
-
|
|
912
|
+
handleAfterClick?: (event?: any) => void;
|
|
913
|
+
/** On element key down callback. */
|
|
914
|
+
handleKeyDown?: (event?: any) => void;
|
|
893
915
|
/** On "before" element clicked callback. */
|
|
894
|
-
|
|
916
|
+
handleBeforeClick?: (event?: any) => void;
|
|
917
|
+
/** On element clicked callback. */
|
|
918
|
+
handleClick?: (event?: any) => void;
|
|
919
|
+
/** name of the prop for handling key down events */
|
|
920
|
+
keyDownProp?: string;
|
|
921
|
+
/** name of the prop for tab index */
|
|
922
|
+
tabIndexProp?: string;
|
|
895
923
|
/** Children */
|
|
896
|
-
children?:
|
|
924
|
+
children?: JSXElement;
|
|
925
|
+
/** Props to apply when the component is in a disabled state. */
|
|
926
|
+
disabledStateProps: GenericProps;
|
|
927
|
+
/** Whether the "after" element has a click handler. */
|
|
928
|
+
hasAfterClick?: boolean;
|
|
929
|
+
/** Whether the "before" element has a click handler. */
|
|
930
|
+
hasBeforeClick?: boolean;
|
|
931
|
+
/** Whether the component has a main click handler. */
|
|
932
|
+
hasOnClick?: boolean;
|
|
933
|
+
/** Whether any part of the component is disabled. */
|
|
934
|
+
isAnyDisabled?: boolean;
|
|
935
|
+
}
|
|
936
|
+
type ChipPropsToOverride = 'disabledStateProps' | 'hasOnClick' | 'hasBeforeClick' | 'hasAfterClick' | 'before' | 'after' | 'keyDownProp' | 'tabIndexProp' | 'isAnyDisabled';
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Defines the props of the component.
|
|
940
|
+
*/
|
|
941
|
+
interface ChipProps extends GenericProps$1, ReactToJSX<ChipProps$1, ChipPropsToOverride> {
|
|
942
|
+
/** A component to be rendered after the content. */
|
|
943
|
+
after?: ReactNode;
|
|
944
|
+
/** A component to be rendered before the content. */
|
|
945
|
+
before?: ReactNode;
|
|
946
|
+
/** On "after" element clicked callback. */
|
|
947
|
+
onAfterClick?: (event?: React.MouseEvent) => void;
|
|
948
|
+
/** On "before" element clicked callback. */
|
|
949
|
+
onBeforeClick?: (event?: React.MouseEvent) => void;
|
|
950
|
+
/** On element clicked callback. */
|
|
951
|
+
onClick?: (event?: React.MouseEvent) => void;
|
|
952
|
+
/** On element key down callback. */
|
|
953
|
+
onKeyDown?: (event?: React.KeyboardEvent) => void;
|
|
897
954
|
}
|
|
898
955
|
/**
|
|
899
956
|
* Chip component.
|
|
@@ -1135,7 +1192,7 @@ declare const DatePickerField: Comp<DatePickerFieldProps, HTMLDivElement>;
|
|
|
1135
1192
|
/**
|
|
1136
1193
|
* Defines the props of the component.
|
|
1137
1194
|
*/
|
|
1138
|
-
interface DialogProps extends GenericProps$1 {
|
|
1195
|
+
interface DialogProps extends GenericProps$1, HasCloseMode$1 {
|
|
1139
1196
|
/** Footer content. */
|
|
1140
1197
|
footer?: ReactNode;
|
|
1141
1198
|
/** Whether the divider between the dialog content and the footer is always displayed (instead of showing it on scroll). */
|
|
@@ -1605,7 +1662,7 @@ declare const GenericBlockGapSize: Pick<{
|
|
|
1605
1662
|
readonly medium: "medium";
|
|
1606
1663
|
readonly big: "big";
|
|
1607
1664
|
readonly huge: "huge";
|
|
1608
|
-
}, "
|
|
1665
|
+
}, "medium" | "tiny" | "regular" | "big" | "huge">;
|
|
1609
1666
|
type GenericBlockGapSize = ValueOf$1<typeof GenericBlockGapSize>;
|
|
1610
1667
|
|
|
1611
1668
|
interface GenericBlockProps extends FlexBoxProps {
|
|
@@ -2290,7 +2347,7 @@ interface LinkProps extends GenericProps$1, ReactToJSX<LinkProps$1> {
|
|
|
2290
2347
|
* @param ref Component ref.
|
|
2291
2348
|
* @return React element.
|
|
2292
2349
|
*/
|
|
2293
|
-
declare const Link: Comp<LinkProps,
|
|
2350
|
+
declare const Link: Comp<LinkProps, HTMLButtonElement | HTMLAnchorElement>;
|
|
2294
2351
|
|
|
2295
2352
|
/**
|
|
2296
2353
|
* Defines the props of the component.
|
|
@@ -2523,7 +2580,7 @@ type NavigationProps = React.ComponentProps<'nav'> & HasClassName$1 & HasTheme$1
|
|
|
2523
2580
|
/** Content of the navigation. These components should be of type NavigationItem to be rendered */
|
|
2524
2581
|
children?: React.ReactNode;
|
|
2525
2582
|
orientation?: Orientation$1;
|
|
2526
|
-
} & HasAriaLabelOrLabelledBy;
|
|
2583
|
+
} & HasAriaLabelOrLabelledBy$1;
|
|
2527
2584
|
type SubComponents = {
|
|
2528
2585
|
Section: typeof NavigationSection;
|
|
2529
2586
|
Item: typeof NavigationItem;
|
|
@@ -2564,13 +2621,23 @@ declare const Notification: Comp<NotificationProps, HTMLDivElement>;
|
|
|
2564
2621
|
* PopoverDialog props.
|
|
2565
2622
|
* The PopoverDialog has the same props as the Popover but requires an accessible label.
|
|
2566
2623
|
*/
|
|
2567
|
-
type PopoverDialogProps = PopoverProps & HasAriaLabelOrLabelledBy
|
|
2624
|
+
type PopoverDialogProps$1 = PopoverProps$1 & HasAriaLabelOrLabelledBy & {
|
|
2625
|
+
/** Accessible label for the dialog (alternative to aria-label prop). */
|
|
2626
|
+
label?: string;
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2629
|
+
/**
|
|
2630
|
+
* PopoverDialog props.
|
|
2631
|
+
* The PopoverDialog has the same props as the Popover but requires an accessible label.
|
|
2632
|
+
*/
|
|
2633
|
+
type PopoverDialogProps = PopoverProps & Omit<PopoverDialogProps$1, keyof PopoverProps$1>;
|
|
2568
2634
|
/**
|
|
2569
2635
|
* PopoverDialog component.
|
|
2570
|
-
* Defines a popover that acts like a dialog
|
|
2571
|
-
*
|
|
2572
|
-
*
|
|
2573
|
-
*
|
|
2636
|
+
* Defines a popover that acts like a dialog:
|
|
2637
|
+
* - Has a dialog aria role
|
|
2638
|
+
* - Sets a focus trap within the popover
|
|
2639
|
+
* - Closes on click away and escape
|
|
2640
|
+
* - Resets heading level context to 2
|
|
2574
2641
|
*/
|
|
2575
2642
|
declare const PopoverDialog: Comp<PopoverDialogProps, HTMLDivElement>;
|
|
2576
2643
|
|
|
@@ -2935,7 +3002,7 @@ interface SelectMultipleProps extends CoreSelectProps {
|
|
|
2935
3002
|
/** Selected values. */
|
|
2936
3003
|
value: string[];
|
|
2937
3004
|
/** Selected value render function. Default: Renders the value inside of a Chip. */
|
|
2938
|
-
selectedChipRender?(choice: string, index: number, onClear?: (event
|
|
3005
|
+
selectedChipRender?(choice: string, index: number, onClear?: (event?: SyntheticEvent, choice?: string) => void, isDisabled?: boolean, theme?: any): ReactNode | string;
|
|
2939
3006
|
}
|
|
2940
3007
|
declare const SelectMultipleField: React.FC<SelectMultipleProps>;
|
|
2941
3008
|
/**
|
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { mdiAlert } from '@lumx/icons/esm/alert.js';
|
|
|
7
7
|
import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle.js';
|
|
8
8
|
import { mdiCheckCircle } from '@lumx/icons/esm/check-circle.js';
|
|
9
9
|
import { mdiInformation } from '@lumx/icons/esm/information.js';
|
|
10
|
-
import { classNames, onEnterPressed, onEscapePressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
|
|
10
|
+
import { classNames, onEnterPressed as onEnterPressed$1, onEscapePressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
|
|
11
11
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
import last from 'lodash/last.js';
|
|
13
13
|
import pull from 'lodash/pull.js';
|
|
@@ -784,6 +784,21 @@ function bem(baseName) {
|
|
|
784
784
|
};
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
+
/**
|
|
788
|
+
* Make sure the pressed key is the enter key before calling the callback.
|
|
789
|
+
*
|
|
790
|
+
* @param handler The handler to call on enter/return press.
|
|
791
|
+
* @return The decorated function.
|
|
792
|
+
*/
|
|
793
|
+
function onEnterPressed(handler) {
|
|
794
|
+
return evt => {
|
|
795
|
+
if (evt.key !== 'Enter') {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
handler(evt);
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
|
|
787
802
|
/**
|
|
788
803
|
* Animation duration constants. Take into consideration that if you change one of these variables,
|
|
789
804
|
* you need to update their scss counterpart as well
|
|
@@ -1918,13 +1933,13 @@ const CLASSNAME$16 = 'lumx-chip';
|
|
|
1918
1933
|
const {
|
|
1919
1934
|
block: block$X,
|
|
1920
1935
|
element: element$J
|
|
1921
|
-
} =
|
|
1936
|
+
} = bem(CLASSNAME$16);
|
|
1922
1937
|
|
|
1923
1938
|
/**
|
|
1924
1939
|
* Component default props.
|
|
1925
1940
|
*/
|
|
1926
1941
|
const DEFAULT_PROPS$_ = {
|
|
1927
|
-
size: Size
|
|
1942
|
+
size: Size.m
|
|
1928
1943
|
};
|
|
1929
1944
|
|
|
1930
1945
|
/**
|
|
@@ -1934,13 +1949,7 @@ const DEFAULT_PROPS$_ = {
|
|
|
1934
1949
|
* @param ref Component ref.
|
|
1935
1950
|
* @return React element.
|
|
1936
1951
|
*/
|
|
1937
|
-
const Chip =
|
|
1938
|
-
const defaultTheme = useTheme() || Theme$1.light;
|
|
1939
|
-
const {
|
|
1940
|
-
isAnyDisabled,
|
|
1941
|
-
disabledStateProps,
|
|
1942
|
-
otherProps
|
|
1943
|
-
} = useDisableStateProps(props);
|
|
1952
|
+
const Chip$1 = props => {
|
|
1944
1953
|
const {
|
|
1945
1954
|
after,
|
|
1946
1955
|
before,
|
|
@@ -1950,41 +1959,48 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1950
1959
|
isClickable: propIsClickable,
|
|
1951
1960
|
isHighlighted,
|
|
1952
1961
|
isSelected,
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1962
|
+
handleAfterClick,
|
|
1963
|
+
handleBeforeClick,
|
|
1964
|
+
handleClick,
|
|
1965
|
+
hasAfterClick,
|
|
1966
|
+
hasBeforeClick,
|
|
1967
|
+
hasOnClick,
|
|
1956
1968
|
size = DEFAULT_PROPS$_.size,
|
|
1957
|
-
theme
|
|
1969
|
+
theme,
|
|
1970
|
+
ref,
|
|
1958
1971
|
href,
|
|
1959
|
-
|
|
1972
|
+
handleKeyDown,
|
|
1973
|
+
disabledStateProps,
|
|
1974
|
+
isAnyDisabled,
|
|
1975
|
+
keyDownProp = 'onKeyDown',
|
|
1976
|
+
tabIndexProp = 'tabIndex',
|
|
1960
1977
|
...forwardedProps
|
|
1961
|
-
} =
|
|
1962
|
-
const hasAfterClick = isFunction(onAfterClick);
|
|
1963
|
-
const hasBeforeClick = isFunction(onBeforeClick);
|
|
1964
|
-
const hasOnClick = isFunction(props.onClick);
|
|
1978
|
+
} = props;
|
|
1965
1979
|
const isButton = hasOnClick && !href;
|
|
1966
1980
|
const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
|
|
1967
1981
|
|
|
1968
1982
|
// Adapt color to the theme.
|
|
1969
|
-
const chipColor = color || (theme === Theme
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
if (hasOnClick) {
|
|
1975
|
-
onEnterPressed(onClick)(evt);
|
|
1983
|
+
const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
|
|
1984
|
+
const handleOnKeyDown = evt => {
|
|
1985
|
+
handleKeyDown?.(evt);
|
|
1986
|
+
if (hasOnClick && handleClick) {
|
|
1987
|
+
onEnterPressed(handleClick)(evt);
|
|
1976
1988
|
}
|
|
1977
1989
|
};
|
|
1990
|
+
const compatibilityProps = {
|
|
1991
|
+
[keyDownProp]: handleOnKeyDown,
|
|
1992
|
+
[tabIndexProp]: isClickable && !disabledStateProps.disabled ? 0 : undefined
|
|
1993
|
+
};
|
|
1978
1994
|
return (
|
|
1979
1995
|
/*#__PURE__*/
|
|
1980
1996
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
1981
1997
|
jsxs("a", {
|
|
1982
1998
|
role: isButton ? 'button' : undefined,
|
|
1983
|
-
|
|
1999
|
+
...compatibilityProps,
|
|
1984
2000
|
...forwardedProps,
|
|
1985
2001
|
href: !disabledStateProps.disabled ? href : undefined,
|
|
1986
2002
|
ref: ref,
|
|
1987
|
-
className:
|
|
2003
|
+
className: classnames(className, block$X({
|
|
1988
2004
|
'is-clickable': isClickable,
|
|
1989
2005
|
[`color-${chipColor}`]: Boolean(chipColor),
|
|
1990
2006
|
'is-disabled': isAnyDisabled,
|
|
@@ -1996,8 +2012,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1996
2012
|
'is-unselected': Boolean(!isSelected)
|
|
1997
2013
|
})),
|
|
1998
2014
|
"aria-disabled": isClickable && isAnyDisabled || undefined,
|
|
1999
|
-
onClick: hasOnClick ?
|
|
2000
|
-
onKeyDown: handleKeyDown,
|
|
2015
|
+
onClick: hasOnClick ? handleClick : undefined,
|
|
2001
2016
|
children: [before &&
|
|
2002
2017
|
/*#__PURE__*/
|
|
2003
2018
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
@@ -2005,7 +2020,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
2005
2020
|
className: element$J('before', {
|
|
2006
2021
|
'is-clickable': hasBeforeClick
|
|
2007
2022
|
}),
|
|
2008
|
-
onClick:
|
|
2023
|
+
onClick: handleBeforeClick,
|
|
2009
2024
|
children: before
|
|
2010
2025
|
}), /*#__PURE__*/jsx("div", {
|
|
2011
2026
|
className: element$J('label'),
|
|
@@ -2017,11 +2032,58 @@ const Chip = forwardRef((props, ref) => {
|
|
|
2017
2032
|
className: element$J('after', {
|
|
2018
2033
|
'is-clickable': hasAfterClick
|
|
2019
2034
|
}),
|
|
2020
|
-
onClick:
|
|
2035
|
+
onClick: handleAfterClick,
|
|
2021
2036
|
children: after
|
|
2022
2037
|
})]
|
|
2023
2038
|
})
|
|
2024
2039
|
);
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* Defines the props of the component.
|
|
2044
|
+
*/
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* Chip component.
|
|
2048
|
+
*
|
|
2049
|
+
* @param props Component props.
|
|
2050
|
+
* @param ref Component ref.
|
|
2051
|
+
* @return React element.
|
|
2052
|
+
*/
|
|
2053
|
+
const Chip = forwardRef((props, ref) => {
|
|
2054
|
+
const defaultTheme = useTheme() || Theme$1.light;
|
|
2055
|
+
const {
|
|
2056
|
+
isAnyDisabled,
|
|
2057
|
+
disabledStateProps,
|
|
2058
|
+
otherProps
|
|
2059
|
+
} = useDisableStateProps(props);
|
|
2060
|
+
const {
|
|
2061
|
+
onAfterClick,
|
|
2062
|
+
onBeforeClick,
|
|
2063
|
+
onClick,
|
|
2064
|
+
theme = defaultTheme,
|
|
2065
|
+
onKeyDown,
|
|
2066
|
+
...forwardedProps
|
|
2067
|
+
} = otherProps;
|
|
2068
|
+
const hasAfterClick = isFunction(onAfterClick);
|
|
2069
|
+
const hasBeforeClick = isFunction(onBeforeClick);
|
|
2070
|
+
const hasOnClick = isFunction(props.onClick);
|
|
2071
|
+
const handleOnBeforeClick = useStopPropagation(onBeforeClick);
|
|
2072
|
+
const handleOnAfterClick = useStopPropagation(onAfterClick);
|
|
2073
|
+
return Chip$1({
|
|
2074
|
+
hasAfterClick,
|
|
2075
|
+
hasBeforeClick,
|
|
2076
|
+
hasOnClick,
|
|
2077
|
+
handleAfterClick: handleOnAfterClick,
|
|
2078
|
+
handleBeforeClick: handleOnBeforeClick,
|
|
2079
|
+
handleClick: onClick,
|
|
2080
|
+
handleKeyDown: onKeyDown,
|
|
2081
|
+
theme,
|
|
2082
|
+
disabledStateProps,
|
|
2083
|
+
isAnyDisabled,
|
|
2084
|
+
ref,
|
|
2085
|
+
...forwardedProps
|
|
2086
|
+
});
|
|
2025
2087
|
});
|
|
2026
2088
|
Chip.displayName = COMPONENT_NAME$16;
|
|
2027
2089
|
Chip.className = CLASSNAME$16;
|
|
@@ -2745,7 +2807,7 @@ const DatePickerControlled = forwardRef((props, ref) => {
|
|
|
2745
2807
|
const updateYear = React__default.useCallback(() => {
|
|
2746
2808
|
updateMonthOffset(currentYear);
|
|
2747
2809
|
}, [updateMonthOffset, currentYear]);
|
|
2748
|
-
const updateYearOnEnterPressed = React__default.useMemo(() => onEnterPressed(updateYear), [updateYear]);
|
|
2810
|
+
const updateYearOnEnterPressed = React__default.useMemo(() => onEnterPressed$1(updateYear), [updateYear]);
|
|
2749
2811
|
const monthYear = selectedMonth.toLocaleDateString(locale, {
|
|
2750
2812
|
year: 'numeric',
|
|
2751
2813
|
month: 'long'
|
|
@@ -3518,6 +3580,7 @@ const {
|
|
|
3518
3580
|
* Component default props.
|
|
3519
3581
|
*/
|
|
3520
3582
|
const DEFAULT_PROPS$X = {
|
|
3583
|
+
closeMode: 'unmount',
|
|
3521
3584
|
size: Size$1.big,
|
|
3522
3585
|
disableBodyScroll: true
|
|
3523
3586
|
};
|
|
@@ -3537,6 +3600,7 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
3537
3600
|
const {
|
|
3538
3601
|
children,
|
|
3539
3602
|
className,
|
|
3603
|
+
closeMode = DEFAULT_PROPS$X.closeMode,
|
|
3540
3604
|
header,
|
|
3541
3605
|
focusElement,
|
|
3542
3606
|
forceFooterDivider,
|
|
@@ -3619,7 +3683,8 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
3619
3683
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3620
3684
|
const isVisible = useTransitionVisibility(rootRef, Boolean(isOpen), DIALOG_TRANSITION_DURATION, onVisibilityChange);
|
|
3621
3685
|
const shouldPreventCloseOnClickAway = preventAutoClose || preventCloseOnClick;
|
|
3622
|
-
|
|
3686
|
+
const isMounted = isOpen || isVisible || closeMode === 'hide';
|
|
3687
|
+
return isMounted ? /*#__PURE__*/jsx(Portal, {
|
|
3623
3688
|
children: /*#__PURE__*/jsxs("div", {
|
|
3624
3689
|
ref: mergeRefs(rootRef, ref),
|
|
3625
3690
|
...forwardedProps,
|
|
@@ -9759,6 +9824,11 @@ Notification.displayName = COMPONENT_NAME$A;
|
|
|
9759
9824
|
Notification.className = CLASSNAME$B;
|
|
9760
9825
|
Notification.defaultProps = DEFAULT_PROPS$E;
|
|
9761
9826
|
|
|
9827
|
+
/**
|
|
9828
|
+
* PopoverDialog props.
|
|
9829
|
+
* The PopoverDialog has the same props as the Popover but requires an accessible label.
|
|
9830
|
+
*/
|
|
9831
|
+
|
|
9762
9832
|
/**
|
|
9763
9833
|
* Component display name.
|
|
9764
9834
|
*/
|
|
@@ -9776,16 +9846,15 @@ const DEFAULT_PROPS$D = {};
|
|
|
9776
9846
|
|
|
9777
9847
|
/**
|
|
9778
9848
|
* PopoverDialog component.
|
|
9779
|
-
* Defines a popover that acts like a dialog
|
|
9780
|
-
*
|
|
9781
|
-
*
|
|
9782
|
-
*
|
|
9849
|
+
* Defines a popover that acts like a dialog:
|
|
9850
|
+
* - Has a dialog aria role
|
|
9851
|
+
* - Sets a focus trap within the popover
|
|
9852
|
+
* - Closes on click away and escape
|
|
9853
|
+
* - Resets heading level context to 2
|
|
9783
9854
|
*/
|
|
9784
9855
|
const PopoverDialog = forwardRef((props, ref) => {
|
|
9785
9856
|
const {
|
|
9786
9857
|
children,
|
|
9787
|
-
isOpen,
|
|
9788
|
-
focusElement,
|
|
9789
9858
|
'aria-label': ariaLabel,
|
|
9790
9859
|
label = ariaLabel,
|
|
9791
9860
|
className,
|
|
@@ -9802,8 +9871,6 @@ const PopoverDialog = forwardRef((props, ref) => {
|
|
|
9802
9871
|
* If it is undefined, the label can be set using the `aria-label` and `aria-labelledby` props
|
|
9803
9872
|
*/,
|
|
9804
9873
|
"aria-label": label,
|
|
9805
|
-
isOpen: isOpen,
|
|
9806
|
-
focusElement: focusElement,
|
|
9807
9874
|
closeOnClickAway: true,
|
|
9808
9875
|
closeOnEscape: true,
|
|
9809
9876
|
withFocusTrap: true,
|