@mantine/core 5.1.2 → 5.1.5
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/cjs/Alert/Alert.js +4 -3
- package/cjs/Alert/Alert.js.map +1 -1
- package/cjs/Alert/Alert.styles.js +7 -2
- package/cjs/Alert/Alert.styles.js.map +1 -1
- package/cjs/AppShell/HorizontalSection/HorizontalSection.styles.js +1 -0
- package/cjs/AppShell/HorizontalSection/HorizontalSection.styles.js.map +1 -1
- package/cjs/Box/use-sx/get-system-styles/get-system-styles.js +6 -6
- package/cjs/Box/use-sx/get-system-styles/get-system-styles.js.map +1 -1
- package/cjs/Button/ButtonGroup/ButtonGroup.styles.js +6 -0
- package/cjs/Button/ButtonGroup/ButtonGroup.styles.js.map +1 -1
- package/cjs/Drawer/Drawer.js +6 -3
- package/cjs/Drawer/Drawer.js.map +1 -1
- package/cjs/HoverCard/HoverCardTarget/HoverCardTarget.js +35 -5
- package/cjs/HoverCard/HoverCardTarget/HoverCardTarget.js.map +1 -1
- package/cjs/Input/InputError/InputError.js +2 -1
- package/cjs/Input/InputError/InputError.js.map +1 -1
- package/cjs/Menu/MenuTarget/MenuTarget.js +35 -5
- package/cjs/Menu/MenuTarget/MenuTarget.js.map +1 -1
- package/cjs/Modal/Modal.js +6 -3
- package/cjs/Modal/Modal.js.map +1 -1
- package/cjs/Notification/Notification.js +1 -1
- package/cjs/Notification/Notification.js.map +1 -1
- package/cjs/Notification/Notification.styles.js +3 -6
- package/cjs/Notification/Notification.styles.js.map +1 -1
- package/cjs/NumberInput/NumberInput.js +4 -0
- package/cjs/NumberInput/NumberInput.js.map +1 -1
- package/cjs/Popover/PopoverTarget/PopoverTarget.js +19 -9
- package/cjs/Popover/PopoverTarget/PopoverTarget.js.map +1 -1
- package/cjs/Select/SelectItems/SelectItems.js +4 -4
- package/cjs/Select/SelectItems/SelectItems.js.map +1 -1
- package/cjs/Slider/RangeSlider/RangeSlider.js +1 -7
- package/cjs/Slider/RangeSlider/RangeSlider.js.map +1 -1
- package/cjs/Slider/Slider/Slider.js +1 -4
- package/cjs/Slider/Slider/Slider.js.map +1 -1
- package/cjs/Slider/SliderRoot/SliderRoot.styles.js +2 -1
- package/cjs/Slider/SliderRoot/SliderRoot.styles.js.map +1 -1
- package/cjs/Slider/Thumb/Thumb.styles.js +4 -2
- package/cjs/Slider/Thumb/Thumb.styles.js.map +1 -1
- package/cjs/Tooltip/Tooltip.js +18 -8
- package/cjs/Tooltip/Tooltip.js.map +1 -1
- package/esm/Alert/Alert.js +4 -3
- package/esm/Alert/Alert.js.map +1 -1
- package/esm/Alert/Alert.styles.js +7 -2
- package/esm/Alert/Alert.styles.js.map +1 -1
- package/esm/AppShell/HorizontalSection/HorizontalSection.styles.js +1 -0
- package/esm/AppShell/HorizontalSection/HorizontalSection.styles.js.map +1 -1
- package/esm/Box/use-sx/get-system-styles/get-system-styles.js +6 -6
- package/esm/Box/use-sx/get-system-styles/get-system-styles.js.map +1 -1
- package/esm/Button/ButtonGroup/ButtonGroup.styles.js +6 -0
- package/esm/Button/ButtonGroup/ButtonGroup.styles.js.map +1 -1
- package/esm/Drawer/Drawer.js +6 -3
- package/esm/Drawer/Drawer.js.map +1 -1
- package/esm/HoverCard/HoverCardTarget/HoverCardTarget.js +36 -6
- package/esm/HoverCard/HoverCardTarget/HoverCardTarget.js.map +1 -1
- package/esm/Input/InputError/InputError.js +2 -1
- package/esm/Input/InputError/InputError.js.map +1 -1
- package/esm/Menu/MenuTarget/MenuTarget.js +36 -6
- package/esm/Menu/MenuTarget/MenuTarget.js.map +1 -1
- package/esm/Modal/Modal.js +6 -3
- package/esm/Modal/Modal.js.map +1 -1
- package/esm/Notification/Notification.js +1 -1
- package/esm/Notification/Notification.js.map +1 -1
- package/esm/Notification/Notification.styles.js +3 -6
- package/esm/Notification/Notification.styles.js.map +1 -1
- package/esm/NumberInput/NumberInput.js +4 -0
- package/esm/NumberInput/NumberInput.js.map +1 -1
- package/esm/Popover/PopoverTarget/PopoverTarget.js +20 -10
- package/esm/Popover/PopoverTarget/PopoverTarget.js.map +1 -1
- package/esm/Select/SelectItems/SelectItems.js +4 -4
- package/esm/Select/SelectItems/SelectItems.js.map +1 -1
- package/esm/Slider/RangeSlider/RangeSlider.js +1 -7
- package/esm/Slider/RangeSlider/RangeSlider.js.map +1 -1
- package/esm/Slider/Slider/Slider.js +1 -4
- package/esm/Slider/Slider/Slider.js.map +1 -1
- package/esm/Slider/SliderRoot/SliderRoot.styles.js +2 -1
- package/esm/Slider/SliderRoot/SliderRoot.styles.js.map +1 -1
- package/esm/Slider/Thumb/Thumb.styles.js +4 -2
- package/esm/Slider/Thumb/Thumb.styles.js.map +1 -1
- package/esm/Tooltip/Tooltip.js +19 -9
- package/esm/Tooltip/Tooltip.js.map +1 -1
- package/lib/Alert/Alert.styles.d.ts.map +1 -1
- package/lib/AppShell/HorizontalSection/HorizontalSection.styles.d.ts.map +1 -1
- package/lib/Button/ButtonGroup/ButtonGroup.styles.d.ts.map +1 -1
- package/lib/Drawer/Drawer.d.ts +2 -0
- package/lib/Drawer/Drawer.d.ts.map +1 -1
- package/lib/HoverCard/HoverCard.d.ts +1 -2
- package/lib/HoverCard/HoverCard.d.ts.map +1 -1
- package/lib/HoverCard/HoverCardTarget/HoverCardTarget.d.ts +2 -5
- package/lib/HoverCard/HoverCardTarget/HoverCardTarget.d.ts.map +1 -1
- package/lib/Menu/Menu.d.ts +1 -2
- package/lib/Menu/Menu.d.ts.map +1 -1
- package/lib/Menu/MenuTarget/MenuTarget.d.ts +1 -4
- package/lib/Menu/MenuTarget/MenuTarget.d.ts.map +1 -1
- package/lib/Modal/Modal.d.ts +2 -0
- package/lib/Modal/Modal.d.ts.map +1 -1
- package/lib/Notification/Notification.styles.d.ts +1 -0
- package/lib/Notification/Notification.styles.d.ts.map +1 -1
- package/lib/NumberInput/NumberInput.d.ts.map +1 -1
- package/lib/Popover/Popover.d.ts +1 -2
- package/lib/Popover/Popover.d.ts.map +1 -1
- package/lib/Popover/PopoverTarget/PopoverTarget.d.ts +1 -4
- package/lib/Popover/PopoverTarget/PopoverTarget.d.ts.map +1 -1
- package/lib/Select/SelectItems/SelectItems.d.ts.map +1 -1
- package/lib/Select/SelectPopover/SelectPopover.d.ts +1 -1
- package/lib/Slider/RangeSlider/RangeSlider.d.ts.map +1 -1
- package/lib/Slider/Slider/Slider.d.ts.map +1 -1
- package/lib/Slider/SliderRoot/SliderRoot.styles.d.ts.map +1 -1
- package/lib/Slider/Thumb/Thumb.styles.d.ts.map +1 -1
- package/lib/Tooltip/Tooltip.d.ts +5 -7
- package/lib/Tooltip/Tooltip.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-styles.js","sources":["../../../../src/Box/use-sx/get-system-styles/get-system-styles.ts"],"sourcesContent":["import { MantineStyleSystemProps, MantineTheme, CSSObject } from '@mantine/styles';\n\nconst SYSTEM_PROPS = {\n mt: 'marginTop',\n mb: 'marginBottom',\n ml: 'marginLeft',\n mr: 'marginRight',\n pt: 'paddingTop',\n pb: 'paddingBottom',\n pl: 'paddingLeft',\n pr: 'paddingRight',\n};\n\nconst NEGATIVE_VALUES = ['-xs', '-sm', '-md', '-lg', '-xl'];\n\nfunction isValidSizeValue(
|
|
1
|
+
{"version":3,"file":"get-system-styles.js","sources":["../../../../src/Box/use-sx/get-system-styles/get-system-styles.ts"],"sourcesContent":["import { MantineStyleSystemProps, MantineTheme, CSSObject } from '@mantine/styles';\n\nconst SYSTEM_PROPS = {\n mt: 'marginTop',\n mb: 'marginBottom',\n ml: 'marginLeft',\n mr: 'marginRight',\n pt: 'paddingTop',\n pb: 'paddingBottom',\n pl: 'paddingLeft',\n pr: 'paddingRight',\n};\n\nconst NEGATIVE_VALUES = ['-xs', '-sm', '-md', '-lg', '-xl'];\n\nfunction isValidSizeValue(size: any) {\n return typeof size === 'string' || typeof size === 'number';\n}\n\nfunction getSizeValue(size: any, theme: MantineTheme) {\n if (NEGATIVE_VALUES.includes(size)) {\n return theme.fn.size({ size: size.replace('-', ''), sizes: theme.spacing }) * -1;\n }\n\n return theme.fn.size({ size, sizes: theme.spacing });\n}\n\nexport function getSystemStyles(systemStyles: MantineStyleSystemProps, theme: MantineTheme) {\n const styles: CSSObject = {};\n\n if (isValidSizeValue(systemStyles.p)) {\n const value = getSizeValue(systemStyles.p, theme);\n styles.padding = value;\n }\n\n if (isValidSizeValue(systemStyles.m)) {\n const value = getSizeValue(systemStyles.m, theme);\n styles.margin = value;\n }\n\n if (isValidSizeValue(systemStyles.py)) {\n const value = getSizeValue(systemStyles.py, theme);\n styles.paddingTop = value;\n styles.paddingBottom = value;\n }\n\n if (isValidSizeValue(systemStyles.px)) {\n const value = getSizeValue(systemStyles.px, theme);\n styles.paddingLeft = value;\n styles.paddingRight = value;\n }\n\n if (isValidSizeValue(systemStyles.my)) {\n const value = getSizeValue(systemStyles.my, theme);\n styles.marginTop = value;\n styles.marginBottom = value;\n }\n\n if (isValidSizeValue(systemStyles.mx)) {\n const value = getSizeValue(systemStyles.mx, theme);\n styles.marginLeft = value;\n styles.marginRight = value;\n }\n\n Object.keys(SYSTEM_PROPS).forEach((property) => {\n if (isValidSizeValue(systemStyles[property])) {\n styles[SYSTEM_PROPS[property]] = theme.fn.size({\n size: getSizeValue(systemStyles[property], theme),\n sizes: theme.spacing,\n });\n }\n });\n\n return styles;\n}\n"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG;AACrB,EAAE,EAAE,EAAE,WAAW;AACjB,EAAE,EAAE,EAAE,cAAc;AACpB,EAAE,EAAE,EAAE,YAAY;AAClB,EAAE,EAAE,EAAE,aAAa;AACnB,EAAE,EAAE,EAAE,YAAY;AAClB,EAAE,EAAE,EAAE,eAAe;AACrB,EAAE,EAAE,EAAE,aAAa;AACnB,EAAE,EAAE,EAAE,cAAc;AACpB,CAAC,CAAC;AACF,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAA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AK,CAAC;AACzD,QAAQ,KAAK,EAAE,KAAK,CAAC,OAAO;AAC5B,OAAO,CAAC,CAAC;AACT,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -19,6 +19,12 @@ var useStyles = createStyles((_theme, { orientation, buttonBorderWidth }) => ({
|
|
|
19
19
|
borderRadius: 0,
|
|
20
20
|
[orientation === "vertical" ? "borderTopWidth" : "borderLeftWidth"]: buttonBorderWidth / 2,
|
|
21
21
|
[orientation === "vertical" ? "borderBottomWidth" : "borderRightWidth"]: buttonBorderWidth / 2
|
|
22
|
+
},
|
|
23
|
+
"& + [data-button]": {
|
|
24
|
+
[orientation === "vertical" ? "marginTop" : "marginLeft"]: -buttonBorderWidth,
|
|
25
|
+
"@media (min-resolution: 192dpi)": {
|
|
26
|
+
[orientation === "vertical" ? "marginTop" : "marginLeft"]: 0
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.styles.js","sources":["../../../src/Button/ButtonGroup/ButtonGroup.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/styles';\n\nexport interface ButtonGroupStylesParams {\n orientation: 'vertical' | 'horizontal';\n buttonBorderWidth: number;\n}\n\nexport default createStyles(\n (_theme, { orientation, buttonBorderWidth }: ButtonGroupStylesParams) => ({\n root: {\n display: 'flex',\n flexDirection: orientation === 'vertical' ? 'column' : 'row',\n\n '& [data-button]': {\n '&:first-of-type': {\n borderBottomRightRadius: 0,\n [orientation === 'vertical' ? 'borderBottomLeftRadius' : 'borderTopRightRadius']: 0,\n [orientation === 'vertical' ? 'borderBottomWidth' : 'borderRightWidth']:\n buttonBorderWidth / 2,\n },\n\n '&:last-of-type': {\n borderTopLeftRadius: 0,\n [orientation === 'vertical' ? 'borderTopRightRadius' : 'borderBottomLeftRadius']: 0,\n [orientation === 'vertical' ? 'borderTopWidth' : 'borderLeftWidth']:\n buttonBorderWidth / 2,\n },\n\n '&:not(:first-of-type):not(:last-of-type)': {\n borderRadius: 0,\n [orientation === 'vertical' ? 'borderTopWidth' : 'borderLeftWidth']:\n buttonBorderWidth / 2,\n [orientation === 'vertical' ? 'borderBottomWidth' : 'borderRightWidth']:\n buttonBorderWidth / 2,\n },\n },\n },\n })\n);\n"],"names":[],"mappings":";;AACA,gBAAe,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM;AAC7E,EAAE,IAAI,EAAE;AACR,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,aAAa,EAAE,WAAW,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK;AAChE,IAAI,iBAAiB,EAAE;AACvB,MAAM,iBAAiB,EAAE;AACzB,QAAQ,uBAAuB,EAAE,CAAC;AAClC,QAAQ,CAAC,WAAW,KAAK,UAAU,GAAG,wBAAwB,GAAG,sBAAsB,GAAG,CAAC;AAC3F,QAAQ,CAAC,WAAW,KAAK,UAAU,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,CAAC;AACtG,OAAO;AACP,MAAM,gBAAgB,EAAE;AACxB,QAAQ,mBAAmB,EAAE,CAAC;AAC9B,QAAQ,CAAC,WAAW,KAAK,UAAU,GAAG,sBAAsB,GAAG,wBAAwB,GAAG,CAAC;AAC3F,QAAQ,CAAC,WAAW,KAAK,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,CAAC;AAClG,OAAO;AACP,MAAM,0CAA0C,EAAE;AAClD,QAAQ,YAAY,EAAE,CAAC;AACvB,QAAQ,CAAC,WAAW,KAAK,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,CAAC;AAClG,QAAQ,CAAC,WAAW,KAAK,UAAU,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,CAAC;AACtG,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ButtonGroup.styles.js","sources":["../../../src/Button/ButtonGroup/ButtonGroup.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/styles';\n\nexport interface ButtonGroupStylesParams {\n orientation: 'vertical' | 'horizontal';\n buttonBorderWidth: number;\n}\n\nexport default createStyles(\n (_theme, { orientation, buttonBorderWidth }: ButtonGroupStylesParams) => ({\n root: {\n display: 'flex',\n flexDirection: orientation === 'vertical' ? 'column' : 'row',\n\n '& [data-button]': {\n '&:first-of-type': {\n borderBottomRightRadius: 0,\n [orientation === 'vertical' ? 'borderBottomLeftRadius' : 'borderTopRightRadius']: 0,\n [orientation === 'vertical' ? 'borderBottomWidth' : 'borderRightWidth']:\n buttonBorderWidth / 2,\n },\n\n '&:last-of-type': {\n borderTopLeftRadius: 0,\n [orientation === 'vertical' ? 'borderTopRightRadius' : 'borderBottomLeftRadius']: 0,\n [orientation === 'vertical' ? 'borderTopWidth' : 'borderLeftWidth']:\n buttonBorderWidth / 2,\n },\n\n '&:not(:first-of-type):not(:last-of-type)': {\n borderRadius: 0,\n [orientation === 'vertical' ? 'borderTopWidth' : 'borderLeftWidth']:\n buttonBorderWidth / 2,\n [orientation === 'vertical' ? 'borderBottomWidth' : 'borderRightWidth']:\n buttonBorderWidth / 2,\n },\n\n '& + [data-button]': {\n [orientation === 'vertical' ? 'marginTop' : 'marginLeft']: -buttonBorderWidth,\n '@media (min-resolution: 192dpi)': {\n [orientation === 'vertical' ? 'marginTop' : 'marginLeft']: 0,\n },\n },\n },\n },\n })\n);\n"],"names":[],"mappings":";;AACA,gBAAe,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM;AAC7E,EAAE,IAAI,EAAE;AACR,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,aAAa,EAAE,WAAW,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK;AAChE,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
|
69
70
|
};
|
|
70
71
|
function Drawer(props) {
|
|
@@ -96,7 +97,8 @@ function Drawer(props) {
|
|
|
96
97
|
target,
|
|
97
98
|
withinPortal,
|
|
98
99
|
overlayBlur,
|
|
99
|
-
unstyled
|
|
100
|
+
unstyled,
|
|
101
|
+
withFocusReturn
|
|
100
102
|
} = _a, others = __objRest(_a, [
|
|
101
103
|
"className",
|
|
102
104
|
"opened",
|
|
@@ -125,7 +127,8 @@ function Drawer(props) {
|
|
|
125
127
|
"target",
|
|
126
128
|
"withinPortal",
|
|
127
129
|
"overlayBlur",
|
|
128
|
-
"unstyled"
|
|
130
|
+
"unstyled",
|
|
131
|
+
"withFocusReturn"
|
|
129
132
|
]);
|
|
130
133
|
const { classes, cx, theme } = useStyles({ size, position, zIndex }, { classNames, styles, unstyled, name: "Drawer" });
|
|
131
134
|
const focusTrapRef = useFocusTrap(trapFocus && opened);
|
|
@@ -144,7 +147,7 @@ function Drawer(props) {
|
|
|
144
147
|
}
|
|
145
148
|
return void 0;
|
|
146
149
|
}, [trapFocus]);
|
|
147
|
-
useFocusReturn({ opened, shouldReturnFocus: trapFocus });
|
|
150
|
+
useFocusReturn({ opened, shouldReturnFocus: trapFocus && withFocusReturn });
|
|
148
151
|
return /* @__PURE__ */ React.createElement(OptionalPortal, {
|
|
149
152
|
withinPortal,
|
|
150
153
|
target
|
package/esm/Drawer/Drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useScrollLock, useFocusTrap, useFocusReturn } from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineShadow,\n Selectors,\n MantineStyleSystemSize,\n getDefaultZIndex,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { Paper } from '../Paper';\nimport { Overlay } from '../Overlay';\nimport { OptionalPortal } from '../Portal';\nimport { Text } from '../Text';\nimport { Box } from '../Box';\nimport { CloseButton } from '../CloseButton';\nimport { GroupedTransition, MantineTransition } from '../Transition';\nimport useStyles, { DrawerPosition } from './Drawer.styles';\n\nexport type DrawerStylesNames = Exclude<Selectors<typeof useStyles>, 'withOverlay'>;\n\nexport interface DrawerProps\n extends Omit<DefaultProps<DrawerStylesNames>, MantineStyleSystemSize>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** If true drawer is mounted to the dom */\n opened: boolean;\n\n /** Called when drawer is closed (Escape key and click outside, depending on options) */\n onClose(): void;\n\n /** Drawer body position */\n position?: DrawerPosition;\n\n /** Drawer body width (right | left position) or height (top | bottom position), cannot exceed 100vh for height and 100% for width */\n size?: string | number;\n\n /** Drawer body shadow from theme or any css shadow value */\n shadow?: MantineShadow;\n\n /** Drawer body padding from theme or number for padding in px */\n padding?: MantineNumberSize;\n\n /** Drawer z-index property */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Disables focus trap */\n trapFocus?: boolean;\n\n /** Disables scroll lock */\n lockScroll?: boolean;\n\n /** Disable onMouseDown trigger for outside events */\n closeOnClickOutside?: boolean;\n\n /** Disable onKeyDownCapture trigger for escape key press */\n closeOnEscape?: boolean;\n\n /** Drawer appear and disappear transition, see Transition component for full documentation */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Drawer transitionTimingFunction css property */\n transitionTimingFunction?: string;\n\n /** Removes overlay entirely */\n withOverlay?: boolean;\n\n /** Overlay opacity, number from 0 to 1 */\n overlayOpacity?: number;\n\n /** Overlay color, for example, #000 */\n overlayColor?: string;\n\n /** Overlay blur in px */\n overlayBlur?: number;\n\n /** Drawer title, displayed in header before close button */\n title?: React.ReactNode;\n\n /** Hides close button if set to false, drawer still can be closed with escape key and by clicking outside */\n withCloseButton?: boolean;\n\n /** Close button aria-label */\n closeButtonLabel?: string;\n\n /** Target element or selector where drawer portal should be rendered */\n target?: HTMLElement | string;\n\n /** Determines whether drawer should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n}\n\nconst transitions: Record<DrawerPosition, MantineTransition> = {\n top: 'slide-down',\n bottom: 'slide-up',\n left: 'slide-right',\n right: 'slide-left',\n};\n\nconst rtlTransitions: Record<DrawerPosition, MantineTransition> = {\n top: 'slide-down',\n bottom: 'slide-up',\n right: 'slide-right',\n left: 'slide-left',\n};\n\nconst defaultProps: Partial<DrawerProps> = {\n position: 'left',\n size: 'md',\n transitionDuration: 250,\n transitionTimingFunction: 'ease',\n zIndex: getDefaultZIndex('modal'),\n shadow: 'md',\n padding: 0,\n lockScroll: true,\n closeOnClickOutside: true,\n closeOnEscape: true,\n trapFocus: true,\n withOverlay: true,\n withCloseButton: true,\n withinPortal: true,\n overlayBlur: 0,\n};\n\nexport function Drawer(props: DrawerProps) {\n const {\n className,\n opened,\n onClose,\n position,\n size,\n trapFocus,\n lockScroll,\n closeOnClickOutside,\n closeOnEscape,\n transition,\n transitionDuration,\n transitionTimingFunction,\n zIndex,\n overlayColor,\n overlayOpacity,\n children,\n withOverlay,\n shadow,\n padding,\n title,\n withCloseButton,\n closeButtonLabel,\n classNames,\n styles,\n target,\n withinPortal,\n overlayBlur,\n unstyled,\n ...others\n } = useComponentDefaultProps('Drawer', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { size, position, zIndex },\n { classNames, styles, unstyled, name: 'Drawer' }\n );\n\n const focusTrapRef = useFocusTrap(trapFocus && opened);\n\n const [, _lockScroll] = useScrollLock();\n\n const drawerTransition =\n transition || (theme.dir === 'rtl' ? rtlTransitions : transitions)[position];\n const _overlayOpacity =\n typeof overlayOpacity === 'number'\n ? overlayOpacity\n : theme.colorScheme === 'dark'\n ? 0.85\n : 0.75;\n\n const _closeOnEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && closeOnEscape) {\n onClose();\n }\n };\n\n useEffect(() => {\n if (!trapFocus) {\n window.addEventListener('keydown', _closeOnEscape);\n return () => window.removeEventListener('keydown', _closeOnEscape);\n }\n\n return undefined;\n }, [trapFocus]);\n\n useFocusReturn({ opened, shouldReturnFocus: trapFocus });\n\n return (\n <OptionalPortal withinPortal={withinPortal} target={target}>\n <GroupedTransition\n onExited={() => _lockScroll(false)}\n onEntered={() => _lockScroll(lockScroll && true)}\n mounted={opened}\n timingFunction={transitionTimingFunction}\n transitions={{\n overlay: { duration: transitionDuration / 2, transition: 'fade', timingFunction: 'ease' },\n drawer: {\n duration: transitionDuration,\n transition: drawerTransition,\n timingFunction: transitionTimingFunction,\n },\n }}\n >\n {(transitionStyles) => (\n <Box className={cx(classes.root, className)} role=\"dialog\" aria-modal {...others}>\n <Paper<'div'>\n className={cx(classes.drawer, className)}\n ref={focusTrapRef}\n style={transitionStyles.drawer}\n radius={0}\n tabIndex={-1}\n onKeyDownCapture={(event) => {\n const shouldTrigger =\n (event.target as any)?.getAttribute('data-mantine-stop-propagation') !== 'true';\n\n shouldTrigger && event.key === 'Escape' && closeOnEscape && onClose();\n }}\n shadow={shadow}\n p={padding}\n unstyled={unstyled}\n >\n {(title || withCloseButton) && (\n <div className={classes.header}>\n <Text className={classes.title} unstyled={unstyled}>\n {title}\n </Text>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n onClick={onClose}\n aria-label={closeButtonLabel}\n className={classes.closeButton}\n unstyled={unstyled}\n />\n )}\n </div>\n )}\n {children}\n </Paper>\n\n {withOverlay && (\n <div style={transitionStyles.overlay}>\n <Overlay\n unstyled={unstyled}\n blur={overlayBlur}\n onMouseDown={() => closeOnClickOutside && onClose()}\n className={classes.overlay}\n opacity={_overlayOpacity}\n zIndex={0}\n color={\n overlayColor ||\n (theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.black)\n }\n />\n </div>\n )}\n </Box>\n )}\n </GroupedTransition>\n </OptionalPortal>\n );\n}\n\nDrawer.displayName = '@mantine/core/Drawer';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,M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AM,EAAE,CAAC;AACb,IAAI,KAAK,EAAE,YAAY,KAAK,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;AAC9F,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACT,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,sBAAsB;;;;"}
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useScrollLock, useFocusTrap, useFocusReturn } from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineShadow,\n Selectors,\n MantineStyleSystemSize,\n getDefaultZIndex,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { Paper } from '../Paper';\nimport { Overlay } from '../Overlay';\nimport { OptionalPortal } from '../Portal';\nimport { Text } from '../Text';\nimport { Box } from '../Box';\nimport { CloseButton } from '../CloseButton';\nimport { GroupedTransition, MantineTransition } from '../Transition';\nimport useStyles, { DrawerPosition } from './Drawer.styles';\n\nexport type DrawerStylesNames = Exclude<Selectors<typeof useStyles>, 'withOverlay'>;\n\nexport interface DrawerProps\n extends Omit<DefaultProps<DrawerStylesNames>, MantineStyleSystemSize>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** If true drawer is mounted to the dom */\n opened: boolean;\n\n /** Called when drawer is closed (Escape key and click outside, depending on options) */\n onClose(): void;\n\n /** Drawer body position */\n position?: DrawerPosition;\n\n /** Drawer body width (right | left position) or height (top | bottom position), cannot exceed 100vh for height and 100% for width */\n size?: string | number;\n\n /** Drawer body shadow from theme or any css shadow value */\n shadow?: MantineShadow;\n\n /** Drawer body padding from theme or number for padding in px */\n padding?: MantineNumberSize;\n\n /** Drawer z-index property */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Disables focus trap */\n trapFocus?: boolean;\n\n /** Disables scroll lock */\n lockScroll?: boolean;\n\n /** Disable onMouseDown trigger for outside events */\n closeOnClickOutside?: boolean;\n\n /** Disable onKeyDownCapture trigger for escape key press */\n closeOnEscape?: boolean;\n\n /** Drawer appear and disappear transition, see Transition component for full documentation */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Drawer transitionTimingFunction css property */\n transitionTimingFunction?: string;\n\n /** Removes overlay entirely */\n withOverlay?: boolean;\n\n /** Overlay opacity, number from 0 to 1 */\n overlayOpacity?: number;\n\n /** Overlay color, for example, #000 */\n overlayColor?: string;\n\n /** Overlay blur in px */\n overlayBlur?: number;\n\n /** Drawer title, displayed in header before close button */\n title?: React.ReactNode;\n\n /** Hides close button if set to false, drawer still can be closed with escape key and by clicking outside */\n withCloseButton?: boolean;\n\n /** Close button aria-label */\n closeButtonLabel?: string;\n\n /** Target element or selector where drawer portal should be rendered */\n target?: HTMLElement | string;\n\n /** Determines whether drawer should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n\n /** Determines whether focus should be returned to the last active element when drawer is closed */\n withFocusReturn?: boolean;\n}\n\nconst transitions: Record<DrawerPosition, MantineTransition> = {\n top: 'slide-down',\n bottom: 'slide-up',\n left: 'slide-right',\n right: 'slide-left',\n};\n\nconst rtlTransitions: Record<DrawerPosition, MantineTransition> = {\n top: 'slide-down',\n bottom: 'slide-up',\n right: 'slide-right',\n left: 'slide-left',\n};\n\nconst defaultProps: Partial<DrawerProps> = {\n position: 'left',\n size: 'md',\n transitionDuration: 250,\n transitionTimingFunction: 'ease',\n zIndex: getDefaultZIndex('modal'),\n shadow: 'md',\n padding: 0,\n lockScroll: true,\n closeOnClickOutside: true,\n closeOnEscape: true,\n trapFocus: true,\n withOverlay: true,\n withCloseButton: true,\n withinPortal: true,\n withFocusReturn: true,\n overlayBlur: 0,\n};\n\nexport function Drawer(props: DrawerProps) {\n const {\n className,\n opened,\n onClose,\n position,\n size,\n trapFocus,\n lockScroll,\n closeOnClickOutside,\n closeOnEscape,\n transition,\n transitionDuration,\n transitionTimingFunction,\n zIndex,\n overlayColor,\n overlayOpacity,\n children,\n withOverlay,\n shadow,\n padding,\n title,\n withCloseButton,\n closeButtonLabel,\n classNames,\n styles,\n target,\n withinPortal,\n overlayBlur,\n unstyled,\n withFocusReturn,\n ...others\n } = useComponentDefaultProps('Drawer', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { size, position, zIndex },\n { classNames, styles, unstyled, name: 'Drawer' }\n );\n\n const focusTrapRef = useFocusTrap(trapFocus && opened);\n\n const [, _lockScroll] = useScrollLock();\n\n const drawerTransition =\n transition || (theme.dir === 'rtl' ? rtlTransitions : transitions)[position];\n const _overlayOpacity =\n typeof overlayOpacity === 'number'\n ? overlayOpacity\n : theme.colorScheme === 'dark'\n ? 0.85\n : 0.75;\n\n const _closeOnEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && closeOnEscape) {\n onClose();\n }\n };\n\n useEffect(() => {\n if (!trapFocus) {\n window.addEventListener('keydown', _closeOnEscape);\n return () => window.removeEventListener('keydown', _closeOnEscape);\n }\n\n return undefined;\n }, [trapFocus]);\n\n useFocusReturn({ opened, shouldReturnFocus: trapFocus && withFocusReturn });\n\n return (\n <OptionalPortal withinPortal={withinPortal} target={target}>\n <GroupedTransition\n onExited={() => _lockScroll(false)}\n onEntered={() => _lockScroll(lockScroll && true)}\n mounted={opened}\n timingFunction={transitionTimingFunction}\n transitions={{\n overlay: { duration: transitionDuration / 2, transition: 'fade', timingFunction: 'ease' },\n drawer: {\n duration: transitionDuration,\n transition: drawerTransition,\n timingFunction: transitionTimingFunction,\n },\n }}\n >\n {(transitionStyles) => (\n <Box className={cx(classes.root, className)} role=\"dialog\" aria-modal {...others}>\n <Paper<'div'>\n className={cx(classes.drawer, className)}\n ref={focusTrapRef}\n style={transitionStyles.drawer}\n radius={0}\n tabIndex={-1}\n onKeyDownCapture={(event) => {\n const shouldTrigger =\n (event.target as any)?.getAttribute('data-mantine-stop-propagation') !== 'true';\n\n shouldTrigger && event.key === 'Escape' && closeOnEscape && onClose();\n }}\n shadow={shadow}\n p={padding}\n unstyled={unstyled}\n >\n {(title || withCloseButton) && (\n <div className={classes.header}>\n <Text className={classes.title} unstyled={unstyled}>\n {title}\n </Text>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n onClick={onClose}\n aria-label={closeButtonLabel}\n className={classes.closeButton}\n unstyled={unstyled}\n />\n )}\n </div>\n )}\n {children}\n </Paper>\n\n {withOverlay && (\n <div style={transitionStyles.overlay}>\n <Overlay\n unstyled={unstyled}\n blur={overlayBlur}\n onMouseDown={() => closeOnClickOutside && onClose()}\n className={classes.overlay}\n opacity={_overlayOpacity}\n zIndex={0}\n color={\n overlayColor ||\n (theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.black)\n }\n />\n </div>\n )}\n </Box>\n )}\n </GroupedTransition>\n </OptionalPortal>\n );\n}\n\nDrawer.displayName = '@mantine/core/Drawer';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GA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E,OAAO,CAAC,MAAM;AAC7B,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE;AAC/C,IAAI,SAAS,EAAE,OAAO,CAAC,KAAK;AAC5B,IAAI,QAAQ;AACZ,GAAG,EAAE,KAAK,CAAC,EAAE,eAAe,oBAAoB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE;AACjF,IAAI,QAAQ,EAAE,EAAE;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,YAAY,EAAE,gBAAgB;AAClC,IAAI,SAAS,EAAE,OAAO,CAAC,WAAW;AAClC,IAAI,QAAQ;AACZ,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,oBAAoB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5E,IAAI,KAAK,EAAE,gBAAgB,CAAC,OAAO;AACnC,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AAClD,IAAI,QAAQ;AACZ,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI,WAAW,EAAE,MAAM,mBAAmB,IAAI,OAAO,EAAE;AACvD,IAAI,SAAS,EAAE,OAAO,CAAC,OAAO;AAC9B,IAAI,OAAO,EAAE,eAAe;AAC5B,IAAI,MAAM,EAAE,CAAC;AACb,IAAI,KAAK,EAAE,YAAY,KAAK,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;AAC9F,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACT,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,sBAAsB;;;;"}
|
|
@@ -1,20 +1,50 @@
|
|
|
1
|
-
import React, { cloneElement } from 'react';
|
|
1
|
+
import React, { forwardRef, cloneElement } from 'react';
|
|
2
2
|
import { isElement, createEventHandler } from '@mantine/utils';
|
|
3
3
|
import { useHoverCardContext } from '../HoverCard.context.js';
|
|
4
4
|
import { HOVER_CARD_ERRORS } from '../HoverCard.errors.js';
|
|
5
5
|
import { Popover } from '../../Popover/Popover.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
const HoverCardTarget = forwardRef((_a, ref) => {
|
|
36
|
+
var _b = _a, { children, refProp } = _b, others = __objRest(_b, ["children", "refProp"]);
|
|
8
37
|
if (!isElement(children)) {
|
|
9
38
|
throw new Error(HOVER_CARD_ERRORS.children);
|
|
10
39
|
}
|
|
11
40
|
const ctx = useHoverCardContext();
|
|
12
41
|
const onMouseEnter = createEventHandler(children.props.onMouseEnter, ctx.openDropdown);
|
|
13
42
|
const onMouseLeave = createEventHandler(children.props.onMouseLeave, ctx.closeDropdown);
|
|
14
|
-
return /* @__PURE__ */ React.createElement(Popover.Target, {
|
|
15
|
-
refProp
|
|
16
|
-
|
|
17
|
-
}
|
|
43
|
+
return /* @__PURE__ */ React.createElement(Popover.Target, __spreadValues({
|
|
44
|
+
refProp,
|
|
45
|
+
ref
|
|
46
|
+
}, others), cloneElement(children, { onMouseEnter, onMouseLeave }));
|
|
47
|
+
});
|
|
18
48
|
HoverCardTarget.displayName = "@mantine/core/HoverCardTarget";
|
|
19
49
|
|
|
20
50
|
export { HoverCardTarget };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverCardTarget.js","sources":["../../../src/HoverCard/HoverCardTarget/HoverCardTarget.tsx"],"sourcesContent":["import React, { cloneElement } from 'react';\nimport { isElement, createEventHandler } from '@mantine/utils';\nimport { Popover, PopoverTargetProps } from '../../Popover';\nimport { useHoverCardContext } from '../HoverCard.context';\nimport { HOVER_CARD_ERRORS } from '../HoverCard.errors';\n\nexport interface HoverCardTargetProps extends PopoverTargetProps {}\n\nexport
|
|
1
|
+
{"version":3,"file":"HoverCardTarget.js","sources":["../../../src/HoverCard/HoverCardTarget/HoverCardTarget.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef } from 'react';\nimport { isElement, createEventHandler } from '@mantine/utils';\nimport { Popover, PopoverTargetProps } from '../../Popover';\nimport { useHoverCardContext } from '../HoverCard.context';\nimport { HOVER_CARD_ERRORS } from '../HoverCard.errors';\n\nexport interface HoverCardTargetProps extends PopoverTargetProps {}\n\nexport const HoverCardTarget = forwardRef<HTMLElement, HoverCardTargetProps>(\n ({ children, refProp, ...others }, ref) => {\n if (!isElement(children)) {\n throw new Error(HOVER_CARD_ERRORS.children);\n }\n\n const ctx = useHoverCardContext();\n const onMouseEnter = createEventHandler(children.props.onMouseEnter, ctx.openDropdown);\n const onMouseLeave = createEventHandler(children.props.onMouseLeave, ctx.closeDropdown);\n\n return (\n <Popover.Target refProp={refProp} ref={ref} {...others}>\n {cloneElement(children as React.ReactElement, { onMouseEnter, onMouseLeave })}\n </Popover.Target>\n );\n }\n);\n\nHoverCardTarget.displayName = '@mantine/core/HoverCardTarget';\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eAAe,CAAC,CAAC,EAAE,IAAI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pC,EAAE,MAAM,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;AACzF,EAAE,MAAM,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;AAC1F,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC;AAC5E,IAAI,OAAO;AACX,IAAI,GAAG;AACP,GAAG,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC,EAAE;AACH,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
|
|
@@ -35,7 +35,8 @@ const InputError = forwardRef((_a, ref) => {
|
|
|
35
35
|
const { classes, cx } = useStyles({ size }, { name: ["InputWrapper", __staticSelector], classNames, styles, unstyled });
|
|
36
36
|
return /* @__PURE__ */ React.createElement(Text, __spreadValues({
|
|
37
37
|
className: cx(classes.error, className),
|
|
38
|
-
ref
|
|
38
|
+
ref,
|
|
39
|
+
role: "alert"
|
|
39
40
|
}, others), children);
|
|
40
41
|
});
|
|
41
42
|
InputError.displayName = "@mantine/core/InputError";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputError.js","sources":["../../../src/Input/InputError/InputError.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, MantineSize, Selectors } from '@mantine/styles';\nimport { Text } from '../../Text';\nimport useStyles, { InputErrorStylesParams } from './InputError.styles';\n\nexport type InputErrorStylesNames = Selectors<typeof useStyles>;\n\nexport interface InputErrorProps\n extends DefaultProps<InputErrorStylesNames, InputErrorStylesParams>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Error content */\n children?: React.ReactNode;\n\n /** Predefined size */\n size?: MantineSize;\n\n __staticSelector?: string;\n}\n\nexport const InputError = forwardRef<HTMLDivElement, InputErrorProps>(\n (\n { children, className, classNames, styles, unstyled, size = 'sm', __staticSelector, ...others },\n ref\n ) => {\n const { classes, cx } = useStyles(\n { size },\n { name: ['InputWrapper', __staticSelector], classNames, styles, unstyled }\n );\n return (\n <Text className={cx(classes.error, className)} ref={ref} {...others}>\n {children}\n </Text>\n );\n }\n);\n\nInputError.displayName = '@mantine/core/InputError';\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,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AM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC1H,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC;AAClE,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;AAC3C,IAAI,GAAG;AACP,GAAG,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
|
|
1
|
+
{"version":3,"file":"InputError.js","sources":["../../../src/Input/InputError/InputError.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, MantineSize, Selectors } from '@mantine/styles';\nimport { Text } from '../../Text';\nimport useStyles, { InputErrorStylesParams } from './InputError.styles';\n\nexport type InputErrorStylesNames = Selectors<typeof useStyles>;\n\nexport interface InputErrorProps\n extends DefaultProps<InputErrorStylesNames, InputErrorStylesParams>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Error content */\n children?: React.ReactNode;\n\n /** Predefined size */\n size?: MantineSize;\n\n __staticSelector?: string;\n}\n\nexport const InputError = forwardRef<HTMLDivElement, InputErrorProps>(\n (\n { children, className, classNames, styles, unstyled, size = 'sm', __staticSelector, ...others },\n ref\n ) => {\n const { classes, cx } = useStyles(\n { size },\n { name: ['InputWrapper', __staticSelector], classNames, styles, unstyled }\n );\n return (\n <Text className={cx(classes.error, className)} ref={ref} role=\"alert\" {...others}>\n {children}\n </Text>\n );\n }\n);\n\nInputError.displayName = '@mantine/core/InputError';\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,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AAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import React, { cloneElement } from 'react';
|
|
1
|
+
import React, { forwardRef, cloneElement } from 'react';
|
|
2
2
|
import { isElement, createEventHandler } from '@mantine/utils';
|
|
3
3
|
import { useMenuContext } from '../Menu.context.js';
|
|
4
4
|
import { MENU_ERRORS } from '../Menu.errors.js';
|
|
5
5
|
import { Popover } from '../../Popover/Popover.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
const MenuTarget = forwardRef((_a, ref) => {
|
|
36
|
+
var _b = _a, { children, refProp = "ref" } = _b, others = __objRest(_b, ["children", "refProp"]);
|
|
8
37
|
if (!isElement(children)) {
|
|
9
38
|
throw new Error(MENU_ERRORS.children);
|
|
10
39
|
}
|
|
@@ -12,16 +41,17 @@ function MenuTarget({ children, refProp = "ref" }) {
|
|
|
12
41
|
const onClick = createEventHandler(children.props.onClick, () => ctx.trigger === "click" && ctx.toggleDropdown());
|
|
13
42
|
const onMouseEnter = createEventHandler(children.props.onMouseEnter, () => ctx.trigger === "hover" && ctx.openDropdown());
|
|
14
43
|
const onMouseLeave = createEventHandler(children.props.onMouseLeave, () => ctx.trigger === "hover" && ctx.closeDropdown());
|
|
15
|
-
return /* @__PURE__ */ React.createElement(Popover.Target, {
|
|
44
|
+
return /* @__PURE__ */ React.createElement(Popover.Target, __spreadValues({
|
|
16
45
|
refProp,
|
|
17
|
-
popupType: "menu"
|
|
18
|
-
|
|
46
|
+
popupType: "menu",
|
|
47
|
+
ref
|
|
48
|
+
}, others), cloneElement(children, {
|
|
19
49
|
onClick,
|
|
20
50
|
onMouseEnter,
|
|
21
51
|
onMouseLeave,
|
|
22
52
|
"data-expanded": ctx.opened ? true : void 0
|
|
23
53
|
}));
|
|
24
|
-
}
|
|
54
|
+
});
|
|
25
55
|
MenuTarget.displayName = "@mantine/core/MenuTarget";
|
|
26
56
|
|
|
27
57
|
export { MenuTarget };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuTarget.js","sources":["../../../src/Menu/MenuTarget/MenuTarget.tsx"],"sourcesContent":["import React, { cloneElement } from 'react';\nimport { isElement, createEventHandler } from '@mantine/utils';\nimport { useMenuContext } from '../Menu.context';\nimport { Popover } from '../../Popover';\nimport { MENU_ERRORS } from '../Menu.errors';\n\nexport interface MenuTargetProps {\n /** Target element */\n children: React.ReactNode;\n\n /** Key of the prop that should be used to get element ref */\n refProp?: string;\n}\n\nexport
|
|
1
|
+
{"version":3,"file":"MenuTarget.js","sources":["../../../src/Menu/MenuTarget/MenuTarget.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef } from 'react';\nimport { isElement, createEventHandler } from '@mantine/utils';\nimport { useMenuContext } from '../Menu.context';\nimport { Popover } from '../../Popover';\nimport { MENU_ERRORS } from '../Menu.errors';\n\nexport interface MenuTargetProps {\n /** Target element */\n children: React.ReactNode;\n\n /** Key of the prop that should be used to get element ref */\n refProp?: string;\n}\n\nexport const MenuTarget = forwardRef<HTMLElement, MenuTargetProps>(\n ({ children, refProp = 'ref', ...others }, ref) => {\n if (!isElement(children)) {\n throw new Error(MENU_ERRORS.children);\n }\n\n const ctx = useMenuContext();\n\n const onClick = createEventHandler(\n children.props.onClick,\n () => ctx.trigger === 'click' && ctx.toggleDropdown()\n );\n\n const onMouseEnter = createEventHandler(\n children.props.onMouseEnter,\n () => ctx.trigger === 'hover' && ctx.openDropdown()\n );\n\n const onMouseLeave = createEventHandler(\n children.props.onMouseLeave,\n () => ctx.trigger === 'hover' && ctx.closeDropdown()\n );\n\n return (\n <Popover.Target refProp={refProp} popupType=\"menu\" ref={ref} {...others}>\n {cloneElement(children, {\n onClick,\n onMouseEnter,\n onMouseLeave,\n 'data-expanded': ctx.opened ? true : undefined,\n })}\n </Popover.Target>\n );\n }\n);\n\nMenuTarget.displayName = '@mantine/core/MenuTarget';\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAA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Aa,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC;AAC5E,IAAI,OAAO;AACX,IAAI,SAAS,EAAE,MAAM;AACrB,IAAI,GAAG;AACP,GAAG,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,EAAE;AACrC,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,eAAe,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;AAC/C,GAAG,CAAC,CAAC,CAAC;AACN,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
|
package/esm/Modal/Modal.js
CHANGED
|
@@ -50,6 +50,7 @@ const defaultProps = {
|
|
|
50
50
|
withCloseButton: true,
|
|
51
51
|
withinPortal: true,
|
|
52
52
|
lockScroll: true,
|
|
53
|
+
withFocusReturn: true,
|
|
53
54
|
overlayBlur: 0,
|
|
54
55
|
zIndex: getDefaultZIndex("modal")
|
|
55
56
|
};
|
|
@@ -85,7 +86,8 @@ function Modal(props) {
|
|
|
85
86
|
transitionTimingFunction,
|
|
86
87
|
fullScreen,
|
|
87
88
|
unstyled,
|
|
88
|
-
lockScroll: shouldLockScroll
|
|
89
|
+
lockScroll: shouldLockScroll,
|
|
90
|
+
withFocusReturn
|
|
89
91
|
} = _a, others = __objRest(_a, [
|
|
90
92
|
"className",
|
|
91
93
|
"opened",
|
|
@@ -117,7 +119,8 @@ function Modal(props) {
|
|
|
117
119
|
"transitionTimingFunction",
|
|
118
120
|
"fullScreen",
|
|
119
121
|
"unstyled",
|
|
120
|
-
"lockScroll"
|
|
122
|
+
"lockScroll",
|
|
123
|
+
"withFocusReturn"
|
|
121
124
|
]);
|
|
122
125
|
const baseId = useId(id);
|
|
123
126
|
const titleId = `${baseId}-title`;
|
|
@@ -138,7 +141,7 @@ function Modal(props) {
|
|
|
138
141
|
}
|
|
139
142
|
return void 0;
|
|
140
143
|
}, [trapFocus]);
|
|
141
|
-
useFocusReturn({ opened, shouldReturnFocus: trapFocus });
|
|
144
|
+
useFocusReturn({ opened, shouldReturnFocus: trapFocus && withFocusReturn });
|
|
142
145
|
return /* @__PURE__ */ React.createElement(OptionalPortal, {
|
|
143
146
|
withinPortal,
|
|
144
147
|
target
|
package/esm/Modal/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useScrollLock, useFocusTrap, useFocusReturn, useId } from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineShadow,\n Selectors,\n MantineStyleSystemSize,\n getDefaultZIndex,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { CloseButton } from '../CloseButton';\nimport { Text } from '../Text';\nimport { Paper } from '../Paper';\nimport { Overlay } from '../Overlay';\nimport { OptionalPortal } from '../Portal';\nimport { Box } from '../Box';\nimport { GroupedTransition, MantineTransition } from '../Transition';\nimport useStyles, { ModalStylesParams } from './Modal.styles';\n\nexport type ModalStylesNames = Selectors<typeof useStyles>;\n\nexport interface ModalProps\n extends Omit<DefaultProps<ModalStylesNames, ModalStylesParams>, MantineStyleSystemSize>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** Mounts modal if true */\n opened: boolean;\n\n /** Called when close button clicked and when escape key is pressed */\n onClose(): void;\n\n /** Modal title, displayed in header before close button */\n title?: React.ReactNode;\n\n /** Modal z-index property */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Control vertical overflow behavior */\n overflow?: 'outside' | 'inside';\n\n /** Hides close button if set to false, modal still can be closed with escape key and by clicking outside */\n withCloseButton?: boolean;\n\n /** Overlay opacity */\n overlayOpacity?: number;\n\n /** Overlay color */\n overlayColor?: string;\n\n /** Overlay blur in px */\n overlayBlur?: number;\n\n /** Determines whether the modal should take the entire screen */\n fullScreen?: boolean;\n\n /** Modal radius */\n radius?: MantineNumberSize;\n\n /** Modal body width */\n size?: string | number;\n\n /** Modal body transition */\n transition?: MantineTransition;\n\n /** Duration in ms of modal transitions, set to 0 to disable all animations */\n transitionDuration?: number;\n\n /** Modal body transitionTimingFunction, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n\n /** Close button aria-label */\n closeButtonLabel?: string;\n\n /** id base, used to generate ids to connect modal title and body with aria- attributes, defaults to random id */\n id?: string;\n\n /** Modal shadow from theme or css value */\n shadow?: MantineShadow;\n\n /** Modal padding from theme or number value for padding in px */\n padding?: MantineNumberSize;\n\n /** Should modal be closed when outside click was registered? */\n closeOnClickOutside?: boolean;\n\n /** Should modal be closed when escape is pressed? */\n closeOnEscape?: boolean;\n\n /** Disables focus trap */\n trapFocus?: boolean;\n\n /** Controls if modal should be centered */\n centered?: boolean;\n\n /** Determines whether scroll should be locked when modal is opened, defaults to true */\n lockScroll?: boolean;\n\n /** Target element or selector where modal portal should be rendered */\n target?: HTMLElement | string;\n\n /** Determines whether modal should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n}\n\nconst defaultProps: Partial<ModalProps> = {\n size: 'md',\n transitionDuration: 250,\n overflow: 'outside',\n padding: 'lg',\n shadow: 'lg',\n closeOnClickOutside: true,\n closeOnEscape: true,\n trapFocus: true,\n withCloseButton: true,\n withinPortal: true,\n lockScroll: true,\n overlayBlur: 0,\n zIndex: getDefaultZIndex('modal'),\n};\n\nexport function Modal(props: ModalProps) {\n const {\n className,\n opened,\n title,\n onClose,\n children,\n withCloseButton,\n overlayOpacity,\n size,\n transitionDuration,\n closeButtonLabel,\n overlayColor,\n overflow,\n transition,\n padding,\n shadow,\n radius,\n id,\n classNames,\n styles,\n closeOnClickOutside,\n trapFocus,\n closeOnEscape,\n centered,\n target,\n withinPortal,\n zIndex,\n overlayBlur,\n transitionTimingFunction,\n fullScreen,\n unstyled,\n lockScroll: shouldLockScroll,\n ...others\n } = useComponentDefaultProps('Modal', defaultProps, props);\n const baseId = useId(id);\n const titleId = `${baseId}-title`;\n const bodyId = `${baseId}-body`;\n const { classes, cx, theme } = useStyles(\n { size, overflow, centered, zIndex, fullScreen },\n { unstyled, classNames, styles, name: 'Modal' }\n );\n const focusTrapRef = useFocusTrap(trapFocus && opened);\n const _overlayOpacity =\n typeof overlayOpacity === 'number'\n ? overlayOpacity\n : theme.colorScheme === 'dark'\n ? 0.85\n : 0.75;\n\n const [, lockScroll] = useScrollLock();\n\n const closeOnEscapePress = (event: KeyboardEvent) => {\n if (!trapFocus && event.key === 'Escape' && closeOnEscape) {\n onClose();\n }\n };\n\n useEffect(() => {\n if (!trapFocus) {\n window.addEventListener('keydown', closeOnEscapePress);\n return () => window.removeEventListener('keydown', closeOnEscapePress);\n }\n\n return undefined;\n }, [trapFocus]);\n\n useFocusReturn({ opened, shouldReturnFocus: trapFocus });\n\n return (\n <OptionalPortal withinPortal={withinPortal} target={target}>\n <GroupedTransition\n onExited={() => shouldLockScroll && lockScroll(false)}\n onEntered={() => shouldLockScroll && lockScroll(true)}\n mounted={opened}\n duration={transitionDuration}\n exitDuration={transitionDuration}\n timingFunction={transitionTimingFunction}\n transitions={{\n modal: {\n duration: transitionDuration,\n transition: transition || (fullScreen ? 'fade' : 'pop'),\n },\n overlay: {\n duration: transitionDuration / 2,\n transition: 'fade',\n timingFunction: 'ease',\n },\n }}\n >\n {(transitionStyles) => (\n <Box id={baseId} className={cx(classes.root, className)} {...others}>\n <div\n className={classes.inner}\n onKeyDownCapture={(event) => {\n const shouldTrigger =\n (event.target as any)?.getAttribute('data-mantine-stop-propagation') !== 'true';\n shouldTrigger && event.key === 'Escape' && closeOnEscape && onClose();\n }}\n ref={focusTrapRef}\n >\n <Paper<'div'>\n className={classes.modal}\n shadow={shadow}\n p={padding}\n radius={radius}\n role=\"dialog\"\n aria-labelledby={titleId}\n aria-describedby={bodyId}\n aria-modal\n tabIndex={-1}\n style={transitionStyles.modal}\n unstyled={unstyled}\n >\n {(title || withCloseButton) && (\n <div className={classes.header}>\n <Text id={titleId} className={classes.title}>\n {title}\n </Text>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n onClick={onClose}\n aria-label={closeButtonLabel}\n className={classes.close}\n />\n )}\n </div>\n )}\n\n <div id={bodyId} className={classes.body}>\n {children}\n </div>\n </Paper>\n <div style={transitionStyles.overlay}>\n <Overlay\n className={classes.overlay}\n sx={{ position: 'fixed' }}\n zIndex={0}\n onMouseDown={() => closeOnClickOutside && onClose()}\n blur={overlayBlur}\n color={\n overlayColor ||\n (theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.black)\n }\n opacity={_overlayOpacity}\n unstyled={unstyled}\n />\n </div>\n </div>\n </Box>\n )}\n </GroupedTransition>\n </OptionalPortal>\n );\n}\n\nModal.displayName = '@mantine/core/Modal';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,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port { useScrollLock, useFocusTrap, useFocusReturn, useId } from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineShadow,\n Selectors,\n MantineStyleSystemSize,\n getDefaultZIndex,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { CloseButton } from '../CloseButton';\nimport { Text } from '../Text';\nimport { Paper } from '../Paper';\nimport { Overlay } from '../Overlay';\nimport { OptionalPortal } from '../Portal';\nimport { Box } from '../Box';\nimport { GroupedTransition, MantineTransition } from '../Transition';\nimport useStyles, { ModalStylesParams } from './Modal.styles';\n\nexport type ModalStylesNames = Selectors<typeof useStyles>;\n\nexport interface ModalProps\n extends Omit<DefaultProps<ModalStylesNames, ModalStylesParams>, MantineStyleSystemSize>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** Mounts modal if true */\n opened: boolean;\n\n /** Called when close button clicked and when escape key is pressed */\n onClose(): void;\n\n /** Modal title, displayed in header before close button */\n title?: React.ReactNode;\n\n /** Modal z-index property */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Control vertical overflow behavior */\n overflow?: 'outside' | 'inside';\n\n /** Hides close button if set to false, modal still can be closed with escape key and by clicking outside */\n withCloseButton?: boolean;\n\n /** Overlay opacity */\n overlayOpacity?: number;\n\n /** Overlay color */\n overlayColor?: string;\n\n /** Overlay blur in px */\n overlayBlur?: number;\n\n /** Determines whether the modal should take the entire screen */\n fullScreen?: boolean;\n\n /** Modal radius */\n radius?: MantineNumberSize;\n\n /** Modal body width */\n size?: string | number;\n\n /** Modal body transition */\n transition?: MantineTransition;\n\n /** Duration in ms of modal transitions, set to 0 to disable all animations */\n transitionDuration?: number;\n\n /** Modal body transitionTimingFunction, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n\n /** Close button aria-label */\n closeButtonLabel?: string;\n\n /** id base, used to generate ids to connect modal title and body with aria- attributes, defaults to random id */\n id?: string;\n\n /** Modal shadow from theme or css value */\n shadow?: MantineShadow;\n\n /** Modal padding from theme or number value for padding in px */\n padding?: MantineNumberSize;\n\n /** Should modal be closed when outside click was registered? */\n closeOnClickOutside?: boolean;\n\n /** Should modal be closed when escape is pressed? */\n closeOnEscape?: boolean;\n\n /** Disables focus trap */\n trapFocus?: boolean;\n\n /** Controls if modal should be centered */\n centered?: boolean;\n\n /** Determines whether scroll should be locked when modal is opened, defaults to true */\n lockScroll?: boolean;\n\n /** Target element or selector where modal portal should be rendered */\n target?: HTMLElement | string;\n\n /** Determines whether modal should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n\n /** Determines whether focus should be returned to the last active element when drawer is closed */\n withFocusReturn?: boolean;\n}\n\nconst defaultProps: Partial<ModalProps> = {\n size: 'md',\n transitionDuration: 250,\n overflow: 'outside',\n padding: 'lg',\n shadow: 'lg',\n closeOnClickOutside: true,\n closeOnEscape: true,\n trapFocus: true,\n withCloseButton: true,\n withinPortal: true,\n lockScroll: true,\n withFocusReturn: true,\n overlayBlur: 0,\n zIndex: getDefaultZIndex('modal'),\n};\n\nexport function Modal(props: ModalProps) {\n const {\n className,\n opened,\n title,\n onClose,\n children,\n withCloseButton,\n overlayOpacity,\n size,\n transitionDuration,\n closeButtonLabel,\n overlayColor,\n overflow,\n transition,\n padding,\n shadow,\n radius,\n id,\n classNames,\n styles,\n closeOnClickOutside,\n trapFocus,\n closeOnEscape,\n centered,\n target,\n withinPortal,\n zIndex,\n overlayBlur,\n transitionTimingFunction,\n fullScreen,\n unstyled,\n lockScroll: shouldLockScroll,\n withFocusReturn,\n ...others\n } = useComponentDefaultProps('Modal', defaultProps, props);\n const baseId = useId(id);\n const titleId = `${baseId}-title`;\n const bodyId = `${baseId}-body`;\n const { classes, cx, theme } = useStyles(\n { size, overflow, centered, zIndex, fullScreen },\n { unstyled, classNames, styles, name: 'Modal' }\n );\n const focusTrapRef = useFocusTrap(trapFocus && opened);\n const _overlayOpacity =\n typeof overlayOpacity === 'number'\n ? overlayOpacity\n : theme.colorScheme === 'dark'\n ? 0.85\n : 0.75;\n\n const [, lockScroll] = useScrollLock();\n\n const closeOnEscapePress = (event: KeyboardEvent) => {\n if (!trapFocus && event.key === 'Escape' && closeOnEscape) {\n onClose();\n }\n };\n\n useEffect(() => {\n if (!trapFocus) {\n window.addEventListener('keydown', closeOnEscapePress);\n return () => window.removeEventListener('keydown', closeOnEscapePress);\n }\n\n return undefined;\n }, [trapFocus]);\n\n useFocusReturn({ opened, shouldReturnFocus: trapFocus && withFocusReturn });\n\n return (\n <OptionalPortal withinPortal={withinPortal} target={target}>\n <GroupedTransition\n onExited={() => shouldLockScroll && lockScroll(false)}\n onEntered={() => shouldLockScroll && lockScroll(true)}\n mounted={opened}\n duration={transitionDuration}\n exitDuration={transitionDuration}\n timingFunction={transitionTimingFunction}\n transitions={{\n modal: {\n duration: transitionDuration,\n transition: transition || (fullScreen ? 'fade' : 'pop'),\n },\n overlay: {\n duration: transitionDuration / 2,\n transition: 'fade',\n timingFunction: 'ease',\n },\n }}\n >\n {(transitionStyles) => (\n <Box id={baseId} className={cx(classes.root, className)} {...others}>\n <div\n className={classes.inner}\n onKeyDownCapture={(event) => {\n const shouldTrigger =\n (event.target as any)?.getAttribute('data-mantine-stop-propagation') !== 'true';\n shouldTrigger && event.key === 'Escape' && closeOnEscape && onClose();\n }}\n ref={focusTrapRef}\n >\n <Paper<'div'>\n className={classes.modal}\n shadow={shadow}\n p={padding}\n radius={radius}\n role=\"dialog\"\n aria-labelledby={titleId}\n aria-describedby={bodyId}\n aria-modal\n tabIndex={-1}\n style={transitionStyles.modal}\n unstyled={unstyled}\n >\n {(title || withCloseButton) && (\n <div className={classes.header}>\n <Text id={titleId} className={classes.title}>\n {title}\n </Text>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n onClick={onClose}\n aria-label={closeButtonLabel}\n className={classes.close}\n />\n )}\n </div>\n )}\n\n <div id={bodyId} className={classes.body}>\n {children}\n </div>\n </Paper>\n <div style={transitionStyles.overlay}>\n <Overlay\n className={classes.overlay}\n sx={{ position: 'fixed' }}\n zIndex={0}\n onMouseDown={() => closeOnClickOutside && onClose()}\n blur={overlayBlur}\n color={\n overlayColor ||\n (theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.black)\n }\n opacity={_overlayOpacity}\n unstyled={unstyled}\n />\n </div>\n </div>\n </Box>\n )}\n </GroupedTransition>\n </OptionalPortal>\n );\n}\n\nModal.displayName = '@mantine/core/Modal';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eAAe,CAA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a,CAAC,WAAW,EAAE;AACjF,IAAI,QAAQ,EAAE,EAAE;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,YAAY,EAAE,gBAAgB;AAClC,IAAI,SAAS,EAAE,OAAO,CAAC,KAAK;AAC5B,GAAG,CAAC,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAClD,IAAI,EAAE,EAAE,MAAM;AACd,IAAI,SAAS,EAAE,OAAO,CAAC,IAAI;AAC3B,GAAG,EAAE,QAAQ,CAAC,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5D,IAAI,KAAK,EAAE,gBAAgB,CAAC,OAAO;AACnC,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AAClD,IAAI,SAAS,EAAE,OAAO,CAAC,OAAO;AAC9B,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC7B,IAAI,MAAM,EAAE,CAAC;AACb,IAAI,WAAW,EAAE,MAAM,mBAAmB,IAAI,OAAO,EAAE;AACvD,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI,KAAK,EAAE,YAAY,KAAK,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;AAC9F,IAAI,OAAO,EAAE,eAAe;AAC5B,IAAI,QAAQ;AACZ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACV,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,qBAAqB;;;;"}
|
|
@@ -67,7 +67,7 @@ const Notification = forwardRef((props, ref) => {
|
|
|
67
67
|
"styles",
|
|
68
68
|
"unstyled"
|
|
69
69
|
]);
|
|
70
|
-
const { classes, cx } = useStyles({ color, radius }, { classNames, styles, unstyled, name: "Notification" });
|
|
70
|
+
const { classes, cx } = useStyles({ color, radius, withTitle: !!title }, { classNames, styles, unstyled, name: "Notification" });
|
|
71
71
|
const withIcon = icon || loading;
|
|
72
72
|
return /* @__PURE__ */ React.createElement(Box, __spreadValues({
|
|
73
73
|
className: cx(classes.root, { [classes.withIcon]: withIcon }, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","sources":["../../src/Notification/Notification.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineColor,\n Selectors,\n MantineNumberSize,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { Text } from '../Text';\nimport { Loader } from '../Loader';\nimport { CloseButton } from '../CloseButton';\nimport { Box } from '../Box';\nimport useStyles, { NotificationStylesParams } from './Notification.styles';\n\nexport type NotificationStylesNames = Exclude<Selectors<typeof useStyles>, 'withIcon'>;\n\nexport interface NotificationProps\n extends DefaultProps<NotificationStylesNames, NotificationStylesParams>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** Called when close button is clicked */\n onClose?(): void;\n\n /** Notification line or icon color */\n color?: MantineColor;\n\n /** Radius from theme.radius, or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Notification icon, replaces color line */\n icon?: React.ReactNode;\n\n /** Notification title, displayed before body */\n title?: React.ReactNode;\n\n /** Notification body, place main text here */\n children?: React.ReactNode;\n\n /** Replaces colored line or icon with Loader component */\n loading?: boolean;\n\n /** Removes close button */\n disallowClose?: boolean;\n\n /** Props spread to close button */\n closeButtonProps?: Record<string, any>;\n}\n\nexport const Notification = forwardRef<HTMLDivElement, NotificationProps>((props, ref) => {\n const {\n className,\n color,\n radius,\n loading,\n disallowClose,\n title,\n icon,\n children,\n onClose,\n closeButtonProps,\n classNames,\n styles,\n unstyled,\n ...others\n } = useComponentDefaultProps('Notification', {}, props);\n\n const { classes, cx } = useStyles(\n { color, radius },\n { classNames, styles, unstyled, name: 'Notification' }\n );\n const withIcon = icon || loading;\n\n return (\n <Box\n className={cx(classes.root, { [classes.withIcon]: withIcon }, className)}\n role=\"alert\"\n ref={ref}\n {...others}\n >\n {icon && !loading && <div className={classes.icon}>{icon}</div>}\n {loading && <Loader size={28} color={color} className={classes.loader} />}\n\n <div className={classes.body}>\n {title && (\n <Text className={classes.title} size=\"sm\" weight={500}>\n {title}\n </Text>\n )}\n\n <Text color=\"dimmed\" className={classes.description} size=\"sm\">\n {children}\n </Text>\n </div>\n\n {!disallowClose && (\n <CloseButton\n {...closeButtonProps}\n iconSize={16}\n color=\"gray\"\n onClick={onClose}\n className={classes.closeButton}\n />\n )}\n </Box>\n );\n});\n\nNotification.displayName = '@mantine/core/Notification';\n"],"names":[],"mappings":";;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI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AK;AACvD,EAAE,MAAM,EAAE,GAAG,wBAAwB,CAAC,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE;AAClE,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,OAAO;AACX,IAAI,aAAa;AACjB,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO;AACX,IAAI,gBAAgB;AACpB,IAAI,UAAU;AACd,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,GAAG,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE;AACjC,IAAI,WAAW;AACf,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,eAAe;AACnB,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,kBAAkB;AACtB,IAAI,YAAY;AAChB,IAAI,QAAQ;AACZ,IAAI,UAAU;AACd,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Notification.js","sources":["../../src/Notification/Notification.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineColor,\n Selectors,\n MantineNumberSize,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { Text } from '../Text';\nimport { Loader } from '../Loader';\nimport { CloseButton } from '../CloseButton';\nimport { Box } from '../Box';\nimport useStyles, { NotificationStylesParams } from './Notification.styles';\n\nexport type NotificationStylesNames = Exclude<Selectors<typeof useStyles>, 'withIcon'>;\n\nexport interface NotificationProps\n extends DefaultProps<NotificationStylesNames, NotificationStylesParams>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** Called when close button is clicked */\n onClose?(): void;\n\n /** Notification line or icon color */\n color?: MantineColor;\n\n /** Radius from theme.radius, or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Notification icon, replaces color line */\n icon?: React.ReactNode;\n\n /** Notification title, displayed before body */\n title?: React.ReactNode;\n\n /** Notification body, place main text here */\n children?: React.ReactNode;\n\n /** Replaces colored line or icon with Loader component */\n loading?: boolean;\n\n /** Removes close button */\n disallowClose?: boolean;\n\n /** Props spread to close button */\n closeButtonProps?: Record<string, any>;\n}\n\nexport const Notification = forwardRef<HTMLDivElement, NotificationProps>((props, ref) => {\n const {\n className,\n color,\n radius,\n loading,\n disallowClose,\n title,\n icon,\n children,\n onClose,\n closeButtonProps,\n classNames,\n styles,\n unstyled,\n ...others\n } = useComponentDefaultProps('Notification', {}, props);\n\n const { classes, cx } = useStyles(\n { color, radius, withTitle: !!title },\n { classNames, styles, unstyled, name: 'Notification' }\n );\n const withIcon = icon || loading;\n\n return (\n <Box\n className={cx(classes.root, { [classes.withIcon]: withIcon }, className)}\n role=\"alert\"\n ref={ref}\n {...others}\n >\n {icon && !loading && <div className={classes.icon}>{icon}</div>}\n {loading && <Loader size={28} color={color} className={classes.loader} />}\n\n <div className={classes.body}>\n {title && (\n <Text className={classes.title} size=\"sm\" weight={500}>\n {title}\n </Text>\n )}\n\n <Text color=\"dimmed\" className={classes.description} size=\"sm\">\n {children}\n </Text>\n </div>\n\n {!disallowClose && (\n <CloseButton\n {...closeButtonProps}\n iconSize={16}\n color=\"gray\"\n onClick={onClose}\n className={classes.closeButton}\n />\n )}\n </Box>\n );\n});\n\nNotification.displayName = '@mantine/core/Notification';\n"],"names":[],"mappings":";;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mB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KAAK,CAAC,aAAa,CAAC,IAAI,EAAE;AACvD,IAAI,KAAK,EAAE,QAAQ;AACnB,IAAI,SAAS,EAAE,OAAO,CAAC,WAAW;AAClC,IAAI,IAAI,EAAE,IAAI;AACd,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,aAAa,oBAAoB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE;AACxI,IAAI,QAAQ,EAAE,EAAE;AAChB,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,SAAS,EAAE,OAAO,CAAC,WAAW;AAClC,GAAG,CAAC,CAAC,CAAC,CAAC;AACP,CAAC,EAAE;AACH,YAAY,CAAC,WAAW,GAAG,4BAA4B;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createStyles } from '@mantine/styles';
|
|
2
2
|
|
|
3
|
-
var useStyles = createStyles((theme, { color, radius }, getRef) => {
|
|
3
|
+
var useStyles = createStyles((theme, { color, radius, withTitle }, getRef) => {
|
|
4
4
|
const _radius = theme.fn.radius(radius);
|
|
5
5
|
const topBottom = Math.min(Math.max(_radius / 1.2, 4), 30);
|
|
6
6
|
const colors = theme.fn.variant({ variant: "filled", color });
|
|
@@ -72,13 +72,10 @@ var useStyles = createStyles((theme, { color, radius }, getRef) => {
|
|
|
72
72
|
color: theme.colorScheme === "dark" ? theme.white : theme.colors.gray[9]
|
|
73
73
|
},
|
|
74
74
|
description: {
|
|
75
|
-
color: theme.colorScheme === "dark" ? theme.colors.dark[2] : theme.colors.gray[6],
|
|
75
|
+
color: withTitle ? theme.colorScheme === "dark" ? theme.colors.dark[2] : theme.colors.gray[6] : theme.colorScheme === "dark" ? theme.colors.dark[0] : theme.black,
|
|
76
76
|
lineHeight: 1.4,
|
|
77
77
|
overflow: "hidden",
|
|
78
|
-
textOverflow: "ellipsis"
|
|
79
|
-
"&:only-child": {
|
|
80
|
-
color: theme.colorScheme === "dark" ? theme.colors.dark[0] : theme.black
|
|
81
|
-
}
|
|
78
|
+
textOverflow: "ellipsis"
|
|
82
79
|
}
|
|
83
80
|
};
|
|
84
81
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.styles.js","sources":["../../src/Notification/Notification.styles.ts"],"sourcesContent":["import { createStyles, MantineColor, MantineNumberSize } from '@mantine/styles';\n\nexport interface NotificationStylesParams {\n color: MantineColor;\n radius: MantineNumberSize;\n}\n\nexport default createStyles((theme, { color, radius }: NotificationStylesParams, getRef) => {\n
|
|
1
|
+
{"version":3,"file":"Notification.styles.js","sources":["../../src/Notification/Notification.styles.ts"],"sourcesContent":["import { createStyles, MantineColor, MantineNumberSize } from '@mantine/styles';\n\nexport interface NotificationStylesParams {\n color: MantineColor;\n radius: MantineNumberSize;\n withTitle: boolean;\n}\n\nexport default createStyles(\n (theme, { color, radius, withTitle }: NotificationStylesParams, getRef) => {\n const _radius = theme.fn.radius(radius) as number;\n const topBottom = Math.min(Math.max(_radius / 1.2, 4), 30);\n const colors = theme.fn.variant({ variant: 'filled', color });\n\n return {\n closeButton: theme.fn.hover({\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[0],\n }),\n\n icon: {\n ref: getRef('icon'),\n boxSizing: 'border-box',\n marginRight: theme.spacing.md,\n width: 28,\n height: 28,\n borderRadius: 28,\n display: 'flex',\n flex: 'none',\n alignItems: 'center',\n justifyContent: 'center',\n color: theme.white,\n },\n\n withIcon: {\n paddingLeft: theme.spacing.xs,\n\n '&::before': {\n display: 'none',\n },\n },\n\n root: {\n boxSizing: 'border-box',\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n paddingLeft: 22,\n paddingRight: 5,\n paddingTop: theme.spacing.xs,\n paddingBottom: theme.spacing.xs,\n borderRadius: _radius,\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,\n boxShadow: theme.shadows.lg,\n border: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[2]\n }`,\n\n '&::before': {\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n width: 6,\n top: topBottom,\n bottom: topBottom,\n left: 4,\n borderRadius: _radius,\n backgroundColor: colors.background,\n },\n\n [`& .${getRef('icon')}`]: {\n backgroundColor: colors.background,\n color: theme.white,\n },\n },\n\n body: {\n flex: 1,\n overflow: 'hidden',\n marginRight: 10,\n },\n\n loader: {\n marginRight: theme.spacing.md,\n },\n\n title: {\n lineHeight: 1.4,\n marginBottom: 2,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n color: theme.colorScheme === 'dark' ? theme.white : theme.colors.gray[9],\n },\n\n description: {\n color: withTitle\n ? theme.colorScheme === 'dark'\n ? theme.colors.dark[2]\n : theme.colors.gray[6]\n : theme.colorScheme === 'dark'\n ? theme.colors.dark[0]\n : theme.black,\n lineHeight: 1.4,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n };\n }\n);\n"],"names":[],"mappings":";;AACA,gBAAe,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,MAAM,KAAK;AAC7E,EAAE,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1C,EAAE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7D,EAAE,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAChE,EAAE,OAAO;AACT,IAAI,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AAChC,MAAM,eAAe,EAAE,KAAK,CAAC,WAAW,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,KAAK;AACL,IAAI,WAAW,EAAE;AACjB,MAAM,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK;AACvK,MAAM,UAAU,EAAE,GAAG;AACrB,MAAM,QAAQ,EAAE,QAAQ;AACxB,MAAM,YAAY,EAAE,UAAU;AAC9B,KAAK;AACL,GAAG,CAAC;AACJ,CAAC,CAAC;;;;"}
|
|
@@ -260,6 +260,10 @@ const NumberInput = forwardRef((props, ref) => {
|
|
|
260
260
|
direction: "down"
|
|
261
261
|
})));
|
|
262
262
|
const handleChange = (event) => {
|
|
263
|
+
const evt = event.nativeEvent;
|
|
264
|
+
if (evt.isComposing) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
263
267
|
const val = event.target.value;
|
|
264
268
|
const parsed = parseNum(val);
|
|
265
269
|
setTempValue(parsed);
|