@mantine/core 4.1.3 → 4.2.0
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/components/Accordion/AccordionItem/AccordionItem.styles.js +5 -6
- package/cjs/components/Accordion/AccordionItem/AccordionItem.styles.js.map +1 -1
- package/cjs/components/ActionIcon/ActionIcon.js +1 -1
- package/cjs/components/ActionIcon/ActionIcon.js.map +1 -1
- package/cjs/components/ActionIcon/ActionIcon.styles.js +9 -13
- package/cjs/components/ActionIcon/ActionIcon.styles.js.map +1 -1
- package/cjs/components/Alert/Alert.js +12 -0
- package/cjs/components/Alert/Alert.js.map +1 -1
- package/cjs/components/Alert/Alert.styles.js +6 -6
- package/cjs/components/Alert/Alert.styles.js.map +1 -1
- package/cjs/components/AppShell/HorizontalSection/HorizontalSection.js +2 -1
- package/cjs/components/AppShell/HorizontalSection/HorizontalSection.js.map +1 -1
- package/cjs/components/AppShell/HorizontalSection/HorizontalSection.styles.js +2 -2
- package/cjs/components/AppShell/HorizontalSection/HorizontalSection.styles.js.map +1 -1
- package/cjs/components/Autocomplete/Autocomplete.js +8 -4
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Avatar/Avatar.styles.js +40 -36
- package/cjs/components/Avatar/Avatar.styles.js.map +1 -1
- package/cjs/components/Badge/Badge.styles.js +5 -6
- package/cjs/components/Badge/Badge.styles.js.map +1 -1
- package/cjs/components/Blockquote/Blockquote.styles.js +1 -1
- package/cjs/components/Blockquote/Blockquote.styles.js.map +1 -1
- package/cjs/components/Button/Button.js +1 -1
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/Button/Button.styles.js +9 -15
- package/cjs/components/Button/Button.styles.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.styles.js +3 -2
- package/cjs/components/Checkbox/Checkbox.styles.js.map +1 -1
- package/cjs/components/Chips/Chip/Chip.styles.js +19 -21
- package/cjs/components/Chips/Chip/Chip.styles.js.map +1 -1
- package/cjs/components/Code/Code.styles.js +1 -1
- package/cjs/components/Code/Code.styles.js.map +1 -1
- package/cjs/components/Container/Container.js +0 -1
- package/cjs/components/Container/Container.js.map +1 -1
- package/cjs/components/Container/Container.styles.js +2 -0
- package/cjs/components/Container/Container.styles.js.map +1 -1
- package/cjs/components/Divider/Divider.styles.js +1 -1
- package/cjs/components/Divider/Divider.styles.js.map +1 -1
- package/cjs/components/Drawer/Drawer.js +7 -3
- package/cjs/components/Drawer/Drawer.js.map +1 -1
- package/cjs/components/Grid/Col/Col.js +23 -13
- package/cjs/components/Grid/Col/Col.js.map +1 -1
- package/cjs/components/Indicator/Indicator.js +92 -0
- package/cjs/components/Indicator/Indicator.js.map +1 -0
- package/cjs/components/Indicator/Indicator.styles.js +83 -0
- package/cjs/components/Indicator/Indicator.styles.js.map +1 -0
- package/cjs/components/InputWrapper/InputWrapper.js +2 -1
- package/cjs/components/InputWrapper/InputWrapper.js.map +1 -1
- package/cjs/components/Loader/Loader.js +1 -1
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/Menu/MenuItem/MenuItem.styles.js +3 -3
- package/cjs/components/Menu/MenuItem/MenuItem.styles.js.map +1 -1
- package/cjs/components/Modal/Modal.js +9 -2
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/MultiSelect/MultiSelect.js +21 -9
- package/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/cjs/components/MultiSelect/MultiSelect.styles.js +2 -1
- package/cjs/components/MultiSelect/MultiSelect.styles.js.map +1 -1
- package/cjs/components/Notification/Notification.js +1 -1
- package/cjs/components/Notification/Notification.js.map +1 -1
- package/cjs/components/Notification/Notification.styles.js +6 -4
- package/cjs/components/Notification/Notification.styles.js.map +1 -1
- package/cjs/components/NumberInput/NumberInput.js +3 -1
- package/cjs/components/NumberInput/NumberInput.js.map +1 -1
- package/cjs/components/Pagination/Pagination.styles.js +1 -5
- package/cjs/components/Pagination/Pagination.styles.js.map +1 -1
- package/cjs/components/Popper/Popper.js +3 -4
- package/cjs/components/Popper/Popper.js.map +1 -1
- package/cjs/components/Progress/Progress.js +1 -1
- package/cjs/components/Progress/Progress.js.map +1 -1
- package/cjs/components/Progress/Progress.styles.js +1 -1
- package/cjs/components/Progress/Progress.styles.js.map +1 -1
- package/cjs/components/RadioGroup/Radio/Radio.js +2 -1
- package/cjs/components/RadioGroup/Radio/Radio.js.map +1 -1
- package/cjs/components/RadioGroup/Radio/Radio.styles.js +3 -2
- package/cjs/components/RadioGroup/Radio/Radio.styles.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.js +5 -0
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/RingProgress/Curve/Curve.js +1 -1
- package/cjs/components/RingProgress/Curve/Curve.js.map +1 -1
- package/cjs/components/SegmentedControl/SegmentedControl.js +14 -7
- package/cjs/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/cjs/components/SegmentedControl/SegmentedControl.styles.js +9 -4
- package/cjs/components/SegmentedControl/SegmentedControl.styles.js.map +1 -1
- package/cjs/components/Select/Select.js +17 -6
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/SelectDropdown/SelectDropdown.js +3 -1
- package/cjs/components/Select/SelectDropdown/SelectDropdown.js.map +1 -1
- package/cjs/components/Select/SelectRightSection/SelectRightSection.js +4 -2
- package/cjs/components/Select/SelectRightSection/SelectRightSection.js.map +1 -1
- package/cjs/components/Slider/Marks/Marks.styles.js +4 -3
- package/cjs/components/Slider/Marks/Marks.styles.js.map +1 -1
- package/cjs/components/Slider/Thumb/Thumb.styles.js +3 -3
- package/cjs/components/Slider/Thumb/Thumb.styles.js.map +1 -1
- package/cjs/components/Slider/Track/Track.styles.js +1 -1
- package/cjs/components/Slider/Track/Track.styles.js.map +1 -1
- package/cjs/components/Stepper/Step/Step.styles.js +4 -3
- package/cjs/components/Stepper/Step/Step.styles.js.map +1 -1
- package/cjs/components/Stepper/Stepper.styles.js +1 -1
- package/cjs/components/Stepper/Stepper.styles.js.map +1 -1
- package/cjs/components/Switch/Switch.styles.js +3 -2
- package/cjs/components/Switch/Switch.styles.js.map +1 -1
- package/cjs/components/Text/Text.styles.js +6 -8
- package/cjs/components/Text/Text.styles.js.map +1 -1
- package/cjs/components/ThemeIcon/ThemeIcon.styles.js +2 -3
- package/cjs/components/ThemeIcon/ThemeIcon.styles.js.map +1 -1
- package/cjs/components/Timeline/TimelineItem/TimelineItem.styles.js +70 -67
- package/cjs/components/Timeline/TimelineItem/TimelineItem.styles.js.map +1 -1
- package/cjs/components/Tooltip/FloatingTooltip/FloatingTooltip.js +40 -32
- package/cjs/components/Tooltip/FloatingTooltip/FloatingTooltip.js.map +1 -1
- package/cjs/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.js +3 -2
- package/cjs/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.js +2 -2
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/TransferList/RenderList/RenderList.styles.js +2 -2
- package/cjs/components/TransferList/RenderList/RenderList.styles.js.map +1 -1
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +1 -1
- package/esm/components/Accordion/AccordionItem/AccordionItem.styles.js +5 -6
- package/esm/components/Accordion/AccordionItem/AccordionItem.styles.js.map +1 -1
- package/esm/components/ActionIcon/ActionIcon.js +2 -2
- package/esm/components/ActionIcon/ActionIcon.js.map +1 -1
- package/esm/components/ActionIcon/ActionIcon.styles.js +10 -14
- package/esm/components/ActionIcon/ActionIcon.styles.js.map +1 -1
- package/esm/components/Alert/Alert.js +12 -0
- package/esm/components/Alert/Alert.js.map +1 -1
- package/esm/components/Alert/Alert.styles.js +6 -6
- package/esm/components/Alert/Alert.styles.js.map +1 -1
- package/esm/components/AppShell/HorizontalSection/HorizontalSection.js +2 -1
- package/esm/components/AppShell/HorizontalSection/HorizontalSection.js.map +1 -1
- package/esm/components/AppShell/HorizontalSection/HorizontalSection.styles.js +2 -2
- package/esm/components/AppShell/HorizontalSection/HorizontalSection.styles.js.map +1 -1
- package/esm/components/Autocomplete/Autocomplete.js +8 -4
- package/esm/components/Autocomplete/Autocomplete.js.map +1 -1
- package/esm/components/Avatar/Avatar.styles.js +41 -37
- package/esm/components/Avatar/Avatar.styles.js.map +1 -1
- package/esm/components/Badge/Badge.styles.js +6 -7
- package/esm/components/Badge/Badge.styles.js.map +1 -1
- package/esm/components/Blockquote/Blockquote.styles.js +1 -1
- package/esm/components/Blockquote/Blockquote.styles.js.map +1 -1
- package/esm/components/Button/Button.js +2 -2
- package/esm/components/Button/Button.js.map +1 -1
- package/esm/components/Button/Button.styles.js +10 -16
- package/esm/components/Button/Button.styles.js.map +1 -1
- package/esm/components/Checkbox/Checkbox.styles.js +3 -2
- package/esm/components/Checkbox/Checkbox.styles.js.map +1 -1
- package/esm/components/Chips/Chip/Chip.styles.js +20 -22
- package/esm/components/Chips/Chip/Chip.styles.js.map +1 -1
- package/esm/components/Code/Code.styles.js +2 -2
- package/esm/components/Code/Code.styles.js.map +1 -1
- package/esm/components/Container/Container.js +0 -1
- package/esm/components/Container/Container.js.map +1 -1
- package/esm/components/Container/Container.styles.js +2 -0
- package/esm/components/Container/Container.styles.js.map +1 -1
- package/esm/components/Divider/Divider.styles.js +1 -1
- package/esm/components/Divider/Divider.styles.js.map +1 -1
- package/esm/components/Drawer/Drawer.js +7 -3
- package/esm/components/Drawer/Drawer.js.map +1 -1
- package/esm/components/Grid/Col/Col.js +22 -12
- package/esm/components/Grid/Col/Col.js.map +1 -1
- package/esm/components/Indicator/Indicator.js +84 -0
- package/esm/components/Indicator/Indicator.js.map +1 -0
- package/esm/components/Indicator/Indicator.styles.js +79 -0
- package/esm/components/Indicator/Indicator.styles.js.map +1 -0
- package/esm/components/InputWrapper/InputWrapper.js +2 -1
- package/esm/components/InputWrapper/InputWrapper.js.map +1 -1
- package/esm/components/Loader/Loader.js +1 -1
- package/esm/components/Loader/Loader.js.map +1 -1
- package/esm/components/Menu/MenuItem/MenuItem.styles.js +3 -3
- package/esm/components/Menu/MenuItem/MenuItem.styles.js.map +1 -1
- package/esm/components/Modal/Modal.js +9 -2
- package/esm/components/Modal/Modal.js.map +1 -1
- package/esm/components/MultiSelect/MultiSelect.js +21 -9
- package/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/esm/components/MultiSelect/MultiSelect.styles.js +2 -1
- package/esm/components/MultiSelect/MultiSelect.styles.js.map +1 -1
- package/esm/components/Notification/Notification.js +1 -1
- package/esm/components/Notification/Notification.js.map +1 -1
- package/esm/components/Notification/Notification.styles.js +6 -4
- package/esm/components/Notification/Notification.styles.js.map +1 -1
- package/esm/components/NumberInput/NumberInput.js +3 -1
- package/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/esm/components/Pagination/Pagination.styles.js +2 -6
- package/esm/components/Pagination/Pagination.styles.js.map +1 -1
- package/esm/components/Popper/Popper.js +3 -4
- package/esm/components/Popper/Popper.js.map +1 -1
- package/esm/components/Progress/Progress.js +1 -1
- package/esm/components/Progress/Progress.js.map +1 -1
- package/esm/components/Progress/Progress.styles.js +1 -1
- package/esm/components/Progress/Progress.styles.js.map +1 -1
- package/esm/components/RadioGroup/Radio/Radio.js +2 -1
- package/esm/components/RadioGroup/Radio/Radio.js.map +1 -1
- package/esm/components/RadioGroup/Radio/Radio.styles.js +3 -2
- package/esm/components/RadioGroup/Radio/Radio.styles.js.map +1 -1
- package/esm/components/RadioGroup/RadioGroup.js +5 -0
- package/esm/components/RadioGroup/RadioGroup.js.map +1 -1
- package/esm/components/RingProgress/Curve/Curve.js +1 -1
- package/esm/components/RingProgress/Curve/Curve.js.map +1 -1
- package/esm/components/SegmentedControl/SegmentedControl.js +16 -9
- package/esm/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/esm/components/SegmentedControl/SegmentedControl.styles.js +9 -4
- package/esm/components/SegmentedControl/SegmentedControl.styles.js.map +1 -1
- package/esm/components/Select/Select.js +17 -6
- package/esm/components/Select/Select.js.map +1 -1
- package/esm/components/Select/SelectDropdown/SelectDropdown.js +3 -1
- package/esm/components/Select/SelectDropdown/SelectDropdown.js.map +1 -1
- package/esm/components/Select/SelectRightSection/SelectRightSection.js +4 -2
- package/esm/components/Select/SelectRightSection/SelectRightSection.js.map +1 -1
- package/esm/components/Slider/Marks/Marks.styles.js +4 -3
- package/esm/components/Slider/Marks/Marks.styles.js.map +1 -1
- package/esm/components/Slider/Thumb/Thumb.styles.js +3 -3
- package/esm/components/Slider/Thumb/Thumb.styles.js.map +1 -1
- package/esm/components/Slider/Track/Track.styles.js +1 -1
- package/esm/components/Slider/Track/Track.styles.js.map +1 -1
- package/esm/components/Stepper/Step/Step.styles.js +4 -3
- package/esm/components/Stepper/Step/Step.styles.js.map +1 -1
- package/esm/components/Stepper/Stepper.styles.js +1 -1
- package/esm/components/Stepper/Stepper.styles.js.map +1 -1
- package/esm/components/Switch/Switch.styles.js +3 -2
- package/esm/components/Switch/Switch.styles.js.map +1 -1
- package/esm/components/Text/Text.styles.js +7 -9
- package/esm/components/Text/Text.styles.js.map +1 -1
- package/esm/components/ThemeIcon/ThemeIcon.styles.js +3 -4
- package/esm/components/ThemeIcon/ThemeIcon.styles.js.map +1 -1
- package/esm/components/Timeline/TimelineItem/TimelineItem.styles.js +70 -67
- package/esm/components/Timeline/TimelineItem/TimelineItem.styles.js.map +1 -1
- package/esm/components/Tooltip/FloatingTooltip/FloatingTooltip.js +40 -32
- package/esm/components/Tooltip/FloatingTooltip/FloatingTooltip.js.map +1 -1
- package/esm/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.js +3 -2
- package/esm/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.js.map +1 -1
- package/esm/components/Tooltip/Tooltip.js +2 -2
- package/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/esm/components/TransferList/RenderList/RenderList.styles.js +2 -2
- package/esm/components/TransferList/RenderList/RenderList.styles.js.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/lib/components/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/lib/components/ActionIcon/ActionIcon.styles.d.ts.map +1 -1
- package/lib/components/Alert/Alert.d.ts.map +1 -1
- package/lib/components/Alert/Alert.styles.d.ts.map +1 -1
- package/lib/components/AppShell/HorizontalSection/HorizontalSection.d.ts.map +1 -1
- package/lib/components/AppShell/HorizontalSection/HorizontalSection.styles.d.ts +1 -0
- package/lib/components/AppShell/HorizontalSection/HorizontalSection.styles.d.ts.map +1 -1
- package/lib/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.styles.d.ts.map +1 -1
- package/lib/components/Badge/Badge.styles.d.ts.map +1 -1
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.styles.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.styles.d.ts.map +1 -1
- package/lib/components/Chips/Chip/Chip.styles.d.ts.map +1 -1
- package/lib/components/Code/Code.styles.d.ts.map +1 -1
- package/lib/components/Container/Container.d.ts.map +1 -1
- package/lib/components/Container/Container.styles.d.ts.map +1 -1
- package/lib/components/Divider/Divider.styles.d.ts.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts +4 -2
- package/lib/components/Drawer/Drawer.d.ts.map +1 -1
- package/lib/components/Grid/Col/Col.d.ts +1 -4
- package/lib/components/Grid/Col/Col.d.ts.map +1 -1
- package/lib/components/Indicator/Indicator.d.ts +29 -0
- package/lib/components/Indicator/Indicator.d.ts.map +1 -0
- package/lib/components/Indicator/Indicator.styles.d.ts +19 -0
- package/lib/components/Indicator/Indicator.styles.d.ts.map +1 -0
- package/lib/components/Indicator/Indicator.types.d.ts +5 -0
- package/lib/components/Indicator/Indicator.types.d.ts.map +1 -0
- package/lib/components/Indicator/index.d.ts +4 -0
- package/lib/components/Indicator/index.d.ts.map +1 -0
- package/lib/components/InputWrapper/InputWrapper.d.ts.map +1 -1
- package/lib/components/Loader/Loader.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem/MenuItem.styles.d.ts.map +1 -1
- package/lib/components/Modal/Modal.d.ts +4 -2
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/lib/components/MultiSelect/MultiSelect.styles.d.ts.map +1 -1
- package/lib/components/Notification/Notification.styles.d.ts +0 -1
- package/lib/components/Notification/Notification.styles.d.ts.map +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.styles.d.ts.map +1 -1
- package/lib/components/Popper/Popper.d.ts +1 -6
- package/lib/components/Popper/Popper.d.ts.map +1 -1
- package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
- package/lib/components/RadioGroup/Radio/Radio.styles.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/SegmentedControl/SegmentedControl.d.ts +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/components/SegmentedControl/SegmentedControl.styles.d.ts.map +1 -1
- package/lib/components/Select/Select.d.ts +4 -0
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/SelectDropdown/SelectDropdown.d.ts +1 -0
- package/lib/components/Select/SelectDropdown/SelectDropdown.d.ts.map +1 -1
- package/lib/components/Select/SelectRightSection/SelectRightSection.d.ts +2 -1
- package/lib/components/Select/SelectRightSection/SelectRightSection.d.ts.map +1 -1
- package/lib/components/Slider/Marks/Marks.styles.d.ts.map +1 -1
- package/lib/components/Slider/Thumb/Thumb.styles.d.ts.map +1 -1
- package/lib/components/Stepper/Step/Step.styles.d.ts.map +1 -1
- package/lib/components/Switch/Switch.styles.d.ts.map +1 -1
- package/lib/components/Text/Text.styles.d.ts.map +1 -1
- package/lib/components/ThemeIcon/ThemeIcon.styles.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem/TimelineItem.styles.d.ts.map +1 -1
- package/lib/components/Tooltip/FloatingTooltip/FloatingTooltip.d.ts +14 -4
- package/lib/components/Tooltip/FloatingTooltip/FloatingTooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.d.ts.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -7,13 +7,15 @@ var styles = require('@mantine/styles');
|
|
|
7
7
|
var hooks = require('@mantine/hooks');
|
|
8
8
|
var FloatingTooltip_styles = require('./FloatingTooltip.styles.js');
|
|
9
9
|
var Box = require('../../Box/Box.js');
|
|
10
|
-
var
|
|
10
|
+
var Transition = require('../../Transition/Transition.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
13
13
|
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
15
|
|
|
16
16
|
var __defProp = Object.defineProperty;
|
|
17
|
+
var __defProps = Object.defineProperties;
|
|
18
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
17
19
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
18
20
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
21
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -29,6 +31,7 @@ var __spreadValues = (a, b) => {
|
|
|
29
31
|
}
|
|
30
32
|
return a;
|
|
31
33
|
};
|
|
34
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
32
35
|
var __objRest = (source, exclude) => {
|
|
33
36
|
var target = {};
|
|
34
37
|
for (var prop in source)
|
|
@@ -44,7 +47,6 @@ var __objRest = (source, exclude) => {
|
|
|
44
47
|
const defaultProps = {
|
|
45
48
|
openDelay: 0,
|
|
46
49
|
closeDelay: 0,
|
|
47
|
-
gutter: 0,
|
|
48
50
|
color: "gray",
|
|
49
51
|
disabled: false,
|
|
50
52
|
position: "right",
|
|
@@ -53,8 +55,7 @@ const defaultProps = {
|
|
|
53
55
|
zIndex: styles.getDefaultZIndex("popover"),
|
|
54
56
|
width: "auto",
|
|
55
57
|
wrapLines: false,
|
|
56
|
-
positionDependencies: []
|
|
57
|
-
withinPortal: true
|
|
58
|
+
positionDependencies: []
|
|
58
59
|
};
|
|
59
60
|
const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
60
61
|
const _a = styles.useMantineDefaultProps("FloatingTooltip", defaultProps, props), {
|
|
@@ -63,7 +64,6 @@ const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
|
63
64
|
children,
|
|
64
65
|
openDelay,
|
|
65
66
|
closeDelay,
|
|
66
|
-
gutter,
|
|
67
67
|
color,
|
|
68
68
|
radius,
|
|
69
69
|
disabled,
|
|
@@ -75,7 +75,6 @@ const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
|
75
75
|
width,
|
|
76
76
|
wrapLines,
|
|
77
77
|
positionDependencies,
|
|
78
|
-
withinPortal,
|
|
79
78
|
tooltipRef,
|
|
80
79
|
tooltipId,
|
|
81
80
|
classNames,
|
|
@@ -88,7 +87,6 @@ const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
|
88
87
|
"children",
|
|
89
88
|
"openDelay",
|
|
90
89
|
"closeDelay",
|
|
91
|
-
"gutter",
|
|
92
90
|
"color",
|
|
93
91
|
"radius",
|
|
94
92
|
"disabled",
|
|
@@ -100,7 +98,6 @@ const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
|
100
98
|
"width",
|
|
101
99
|
"wrapLines",
|
|
102
100
|
"positionDependencies",
|
|
103
|
-
"withinPortal",
|
|
104
101
|
"tooltipRef",
|
|
105
102
|
"tooltipId",
|
|
106
103
|
"classNames",
|
|
@@ -116,25 +113,40 @@ const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
|
116
113
|
const [opened, setOpened] = React.useState(false);
|
|
117
114
|
const { ref: mouseRef, x, y } = hooks.useMouse();
|
|
118
115
|
const visible = opened && !disabled;
|
|
119
|
-
const
|
|
120
|
-
const mergedRefs = hooks.useMergedRef(ref, setReferenceElement, mouseRef);
|
|
116
|
+
const mergedRefs = hooks.useMergedRef(ref, mouseRef);
|
|
121
117
|
const coordinates = React.useMemo(() => {
|
|
122
|
-
var _a2;
|
|
118
|
+
var _a2, _b;
|
|
123
119
|
const estimatedCursorSize = 32;
|
|
124
|
-
const tooltipWidth = ((_a2 = _tooltipRef.current) == null ? void 0 : _a2.offsetWidth) || 0;
|
|
120
|
+
const tooltipWidth = typeof width === "number" ? width : ((_a2 = _tooltipRef.current) == null ? void 0 : _a2.offsetWidth) || 0;
|
|
121
|
+
const tooltipHeight = ((_b = _tooltipRef.current) == null ? void 0 : _b.offsetHeight) || 0;
|
|
125
122
|
switch (position) {
|
|
126
123
|
case "top":
|
|
127
|
-
return {
|
|
124
|
+
return {
|
|
125
|
+
left: x - tooltipWidth / 2,
|
|
126
|
+
top: y - tooltipHeight
|
|
127
|
+
};
|
|
128
128
|
case "left":
|
|
129
|
-
return {
|
|
129
|
+
return {
|
|
130
|
+
left: x - tooltipWidth - estimatedCursorSize / 2,
|
|
131
|
+
top: y
|
|
132
|
+
};
|
|
130
133
|
case "right":
|
|
131
|
-
return {
|
|
134
|
+
return {
|
|
135
|
+
left: x + estimatedCursorSize / 2,
|
|
136
|
+
top: y
|
|
137
|
+
};
|
|
132
138
|
case "bottom":
|
|
133
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
left: x - tooltipWidth / 2,
|
|
141
|
+
top: y + tooltipHeight
|
|
142
|
+
};
|
|
134
143
|
default:
|
|
135
|
-
return {
|
|
144
|
+
return {
|
|
145
|
+
left: x || 0,
|
|
146
|
+
top: y || 0
|
|
147
|
+
};
|
|
136
148
|
}
|
|
137
|
-
}, [x, y]);
|
|
149
|
+
}, [x, y, ...positionDependencies]);
|
|
138
150
|
const handleOpen = () => {
|
|
139
151
|
window.clearTimeout(closeTimeoutRef.current);
|
|
140
152
|
if (openDelay !== 0) {
|
|
@@ -172,26 +184,22 @@ const FloatingTooltip = React.forwardRef((props, ref) => {
|
|
|
172
184
|
onFocusCapture: handleOpen,
|
|
173
185
|
onBlurCapture: handleClose,
|
|
174
186
|
ref: mergedRefs
|
|
175
|
-
}, others), /* @__PURE__ */ React__default.createElement(
|
|
176
|
-
referenceElement,
|
|
177
|
-
transitionDuration,
|
|
178
|
-
transition,
|
|
187
|
+
}, others), /* @__PURE__ */ React__default.createElement(Transition.Transition, {
|
|
179
188
|
mounted: visible,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
coordinates
|
|
189
|
+
duration: transitionDuration,
|
|
190
|
+
transition,
|
|
191
|
+
exitDuration: transitionDuration,
|
|
192
|
+
timingFunction: transitionTimingFunction
|
|
193
|
+
}, (transitionStyles) => /* @__PURE__ */ React__default.createElement("div", {
|
|
194
|
+
style: __spreadProps(__spreadValues({}, transitionStyles), { zIndex, position: "relative" })
|
|
187
195
|
}, /* @__PURE__ */ React__default.createElement(Box.Box, {
|
|
188
196
|
className: classes.body,
|
|
189
197
|
ref: mergedTooltipRefs,
|
|
190
|
-
sx: {
|
|
198
|
+
sx: __spreadValues({
|
|
191
199
|
whiteSpace: wrapLines ? "normal" : "nowrap",
|
|
192
200
|
width
|
|
193
|
-
}
|
|
194
|
-
}, label)), children);
|
|
201
|
+
}, coordinates)
|
|
202
|
+
}, label))), children);
|
|
195
203
|
});
|
|
196
204
|
FloatingTooltip.displayName = "@mantine/core/FloatingTooltip";
|
|
197
205
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingTooltip.js","sources":["../../../../src/components/Tooltip/FloatingTooltip/FloatingTooltip.tsx"],"sourcesContent":["import React, { useState, useRef, forwardRef, useEffect, useMemo } from 'react';\nimport {\n DefaultProps,\n MantineColor,\n ClassNames,\n getDefaultZIndex,\n MantineNumberSize,\n useMantineDefaultProps,\n} from '@mantine/styles';\nimport { useMergedRef, useMouse } from '@mantine/hooks';\nimport { Box } from '../../Box';\nimport { Popper, SharedPopperProps } from '../../Popper';\nimport useStyles from './FloatingTooltip.styles';\n\nexport type FloatingTooltipStylesNames = ClassNames<typeof useStyles>;\n\nexport interface FloatingTooltipProps\n extends DefaultProps<FloatingTooltipStylesNames>,\n SharedPopperProps,\n React.ComponentPropsWithoutRef<'div'> {\n /** Tooltip content */\n label: React.ReactNode;\n\n /** Any react node that should trigger tooltip */\n children: React.ReactNode;\n\n /** Open delay in ms, 0 to disable delay */\n openDelay?: number;\n\n /** Close delay in ms, 0 to disable delay */\n closeDelay?: number;\n\n /** Any color from theme.colors, defaults to gray in light color scheme and dark in dark colors scheme */\n color?: MantineColor;\n\n /** Radius from theme.radius, or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** True to disable tooltip */\n disabled?: boolean;\n\n /** Tooltip width in px or auto */\n width?: number | 'auto';\n\n /** Allow multiline tooltip content */\n wrapLines?: boolean;\n\n /** Get tooltip ref */\n tooltipRef?: React.ForwardedRef<HTMLDivElement>;\n\n /** Tooltip id to bind aria-describedby */\n tooltipId?: string;\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Whether to render the target element in a Portal */\n withinPortal?: boolean;\n}\n\nconst defaultProps: Partial<FloatingTooltipProps> = {\n openDelay: 0,\n closeDelay: 0,\n gutter: 0,\n color: 'gray',\n disabled: false,\n position: 'right',\n transition: 'pop-top-left',\n transitionDuration: 0,\n zIndex: getDefaultZIndex('popover'),\n width: 'auto',\n wrapLines: false,\n positionDependencies: [],\n withinPortal: true,\n};\n\nexport const FloatingTooltip = forwardRef<HTMLDivElement, FloatingTooltipProps>(\n (props: FloatingTooltipProps, ref) => {\n const {\n className,\n label,\n children,\n openDelay,\n closeDelay,\n gutter,\n color,\n radius,\n disabled,\n position,\n transition,\n transitionDuration,\n zIndex,\n transitionTimingFunction,\n width,\n wrapLines,\n positionDependencies,\n withinPortal,\n tooltipRef,\n tooltipId,\n classNames,\n styles,\n onMouseLeave,\n onMouseEnter,\n ...others\n } = useMantineDefaultProps('FloatingTooltip', defaultProps, props);\n\n const { classes, cx } = useStyles(\n { color, radius },\n { classNames, styles, name: 'FloatingTooltip' }\n );\n const openTimeoutRef = useRef<number>();\n const closeTimeoutRef = useRef<number>();\n const _tooltipRef = useRef<HTMLDivElement>();\n const mergedTooltipRefs = useMergedRef(_tooltipRef, tooltipRef);\n const [opened, setOpened] = useState(false);\n const { ref: mouseRef, x, y } = useMouse();\n const visible = opened && !disabled;\n const [referenceElement, setReferenceElement] = useState(null);\n const mergedRefs = useMergedRef(ref, setReferenceElement, mouseRef);\n const coordinates = useMemo(() => {\n // There's no way to get the exact size of the\n // cursor using JS, however most OS's use 32x32\n const estimatedCursorSize = 32;\n const tooltipWidth = _tooltipRef.current?.offsetWidth || 0;\n\n switch (position) {\n case 'top':\n return { x: x - tooltipWidth / 2, y: y - estimatedCursorSize };\n case 'left':\n return { x: x - estimatedCursorSize / 2 - tooltipWidth, y };\n case 'right':\n return { x: x + estimatedCursorSize / 2, y };\n case 'bottom':\n return { x: x - tooltipWidth / 2, y: y + estimatedCursorSize };\n default:\n return { x: x || 0, y: y || 0 };\n }\n }, [x, y]);\n\n const handleOpen = () => {\n window.clearTimeout(closeTimeoutRef.current);\n\n if (openDelay !== 0) {\n openTimeoutRef.current = window.setTimeout(() => {\n setOpened(true);\n }, openDelay);\n } else {\n setOpened(true);\n }\n };\n\n const handleClose = () => {\n window.clearTimeout(openTimeoutRef.current);\n\n if (closeDelay !== 0) {\n closeTimeoutRef.current = window.setTimeout(() => {\n setOpened(false);\n }, closeDelay);\n } else {\n setOpened(false);\n }\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(openTimeoutRef.current);\n window.clearTimeout(closeTimeoutRef.current);\n },\n []\n );\n\n return (\n <Box<'div'>\n className={cx(classes.root, className)}\n onMouseEnter={(event) => {\n handleOpen();\n typeof onMouseEnter === 'function' && onMouseEnter(event);\n }}\n onMouseLeave={(event) => {\n handleClose();\n typeof onMouseLeave === 'function' && onMouseLeave(event);\n }}\n onFocusCapture={handleOpen}\n onBlurCapture={handleClose}\n ref={mergedRefs}\n {...others}\n >\n <Popper\n referenceElement={referenceElement}\n transitionDuration={transitionDuration}\n transition={transition}\n mounted={visible}\n position=\"top\"\n placement=\"start\" // fixed because we are following the cursor\n gutter={gutter}\n zIndex={zIndex}\n forceUpdateDependencies={[color, radius, ...positionDependencies]}\n withinPortal={withinPortal}\n coordinates={coordinates}\n >\n <Box\n className={classes.body}\n ref={mergedTooltipRefs}\n sx={{\n whiteSpace: wrapLines ? 'normal' : 'nowrap',\n width,\n }}\n >\n {label}\n </Box>\n </Popper>\n {children}\n </Box>\n );\n }\n);\n\nFloatingTooltip.displayName = '@mantine/core/FloatingTooltip';\n"],"names":["getDefaultZIndex","forwardRef","useMantineDefaultProps","styles","useStyles","useRef","useMergedRef","useState","useMouse","useMemo","useEffect","React","Box","Popper"],"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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AAC,aAAa,CAACE,aAAM,EAAE;AAC1D,IAAI,gBAAgB;AACpB,IAAI,kBAAkB;AACtB,IAAI,UAAU;AACd,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,SAAS,EAAE,OAAO;AACtB,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,uBAAuB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC;AACrE,IAAI,YAAY;AAChB,IAAI,WAAW;AACf,GAAG,kBAAkBF,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE;AAC9C,IAAI,SAAS,EAAE,OAAO,CAAC,IAAI;AAC3B,IAAI,GAAG,EAAE,iBAAiB;AAC1B,IAAI,EAAE,EAAE;AACR,MAAM,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ;AACjD,MAAM,KAAK;AACX,KAAK;AACL,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,EAAE;AACH,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
|
|
1
|
+
{"version":3,"file":"FloatingTooltip.js","sources":["../../../../src/components/Tooltip/FloatingTooltip/FloatingTooltip.tsx"],"sourcesContent":["import React, { useState, useRef, forwardRef, useEffect, useMemo } from 'react';\nimport {\n DefaultProps,\n MantineColor,\n ClassNames,\n getDefaultZIndex,\n MantineNumberSize,\n useMantineDefaultProps,\n} from '@mantine/styles';\nimport { useMergedRef, useMouse } from '@mantine/hooks';\nimport { Box } from '../../Box';\nimport { MantineTransition, Transition } from '../../Transition';\nimport useStyles from './FloatingTooltip.styles';\n\nexport type FloatingTooltipStylesNames = ClassNames<typeof useStyles>;\n\nexport interface FloatingTooltipProps\n extends DefaultProps<FloatingTooltipStylesNames>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Tooltip content */\n label: React.ReactNode;\n\n /** Any react node that should trigger tooltip */\n children: React.ReactNode;\n\n /** Open delay in ms, 0 to disable delay */\n openDelay?: number;\n\n /** Close delay in ms, 0 to disable delay */\n closeDelay?: number;\n\n /** Any color from theme.colors, defaults to gray in light color scheme and dark in dark colors scheme */\n color?: MantineColor;\n\n /** Radius from theme.radius, or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** True to disable tooltip */\n disabled?: boolean;\n\n /** Tooltip width in px or auto */\n width?: number | 'auto';\n\n /** Allow multiline tooltip content */\n wrapLines?: boolean;\n\n /** Get tooltip ref */\n tooltipRef?: React.ForwardedRef<HTMLDivElement>;\n\n /** Tooltip id to bind aria-describedby */\n tooltipId?: string;\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Position of the tooltip relative to the cursor */\n position?: 'top' | 'left' | 'bottom' | 'right';\n\n /** Customize mount/unmount transition */\n transition?: MantineTransition;\n\n /** Mount transition duration in ms */\n transitionDuration?: number;\n\n /** Unmount transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Mount/unmount transition timing function, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n\n /** Tooltip z-index */\n zIndex?: number;\n}\n\nconst defaultProps: Partial<FloatingTooltipProps> = {\n openDelay: 0,\n closeDelay: 0,\n color: 'gray',\n disabled: false,\n position: 'right',\n transition: 'pop-top-left',\n transitionDuration: 0,\n zIndex: getDefaultZIndex('popover'),\n width: 'auto',\n wrapLines: false,\n positionDependencies: [],\n};\n\nexport const FloatingTooltip = forwardRef<HTMLDivElement, FloatingTooltipProps>(\n (props: FloatingTooltipProps, ref) => {\n const {\n className,\n label,\n children,\n openDelay,\n closeDelay,\n color,\n radius,\n disabled,\n position,\n transition,\n transitionDuration,\n zIndex,\n transitionTimingFunction,\n width,\n wrapLines,\n positionDependencies,\n tooltipRef,\n tooltipId,\n classNames,\n styles,\n onMouseLeave,\n onMouseEnter,\n ...others\n } = useMantineDefaultProps('FloatingTooltip', defaultProps, props);\n\n const { classes, cx } = useStyles(\n { color, radius },\n { classNames, styles, name: 'FloatingTooltip' }\n );\n const openTimeoutRef = useRef<number>();\n const closeTimeoutRef = useRef<number>();\n const _tooltipRef = useRef<HTMLDivElement>();\n const mergedTooltipRefs = useMergedRef(_tooltipRef, tooltipRef);\n const [opened, setOpened] = useState(false);\n const { ref: mouseRef, x, y } = useMouse();\n const visible = opened && !disabled;\n const mergedRefs = useMergedRef(ref, mouseRef);\n const coordinates = useMemo(() => {\n // There's no way to get the exact size of the\n // cursor using JS, however most OS's use 32x32\n const estimatedCursorSize = 32;\n const tooltipWidth =\n typeof width === 'number' ? width : _tooltipRef.current?.offsetWidth || 0;\n const tooltipHeight = _tooltipRef.current?.offsetHeight || 0;\n\n switch (position) {\n case 'top':\n return {\n left: x - tooltipWidth / 2,\n top: y - tooltipHeight,\n };\n case 'left':\n return {\n left: x - tooltipWidth - estimatedCursorSize / 2,\n top: y,\n };\n case 'right':\n return {\n left: x + estimatedCursorSize / 2,\n top: y,\n };\n case 'bottom':\n return {\n left: x - tooltipWidth / 2,\n top: y + tooltipHeight,\n };\n default:\n return {\n left: x || 0,\n top: y || 0,\n };\n }\n }, [x, y, ...positionDependencies]);\n\n const handleOpen = () => {\n window.clearTimeout(closeTimeoutRef.current);\n\n if (openDelay !== 0) {\n openTimeoutRef.current = window.setTimeout(() => {\n setOpened(true);\n }, openDelay);\n } else {\n setOpened(true);\n }\n };\n\n const handleClose = () => {\n window.clearTimeout(openTimeoutRef.current);\n\n if (closeDelay !== 0) {\n closeTimeoutRef.current = window.setTimeout(() => {\n setOpened(false);\n }, closeDelay);\n } else {\n setOpened(false);\n }\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(openTimeoutRef.current);\n window.clearTimeout(closeTimeoutRef.current);\n },\n []\n );\n\n return (\n <Box<'div'>\n className={cx(classes.root, className)}\n onMouseEnter={(event) => {\n handleOpen();\n typeof onMouseEnter === 'function' && onMouseEnter(event);\n }}\n onMouseLeave={(event) => {\n handleClose();\n typeof onMouseLeave === 'function' && onMouseLeave(event);\n }}\n onFocusCapture={handleOpen}\n onBlurCapture={handleClose}\n ref={mergedRefs}\n {...others}\n >\n <Transition\n mounted={visible}\n duration={transitionDuration}\n transition={transition}\n exitDuration={transitionDuration}\n timingFunction={transitionTimingFunction}\n >\n {(transitionStyles) => (\n <div style={{ ...transitionStyles, zIndex, position: 'relative' }}>\n <Box\n className={classes.body}\n ref={mergedTooltipRefs}\n sx={{\n whiteSpace: wrapLines ? 'normal' : 'nowrap',\n width,\n ...coordinates,\n }}\n >\n {label}\n </Box>\n </div>\n )}\n </Transition>\n {children}\n </Box>\n );\n }\n);\n\nFloatingTooltip.displayName = '@mantine/core/FloatingTooltip';\n"],"names":["getDefaultZIndex","forwardRef","useMantineDefaultProps","styles","useStyles","useRef","useMergedRef","useState","useMouse","useMemo","useEffect","React","Box","Transition"],"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,EAA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AI,YAAY,CAAC,KAAK,CAAC,CAAC;AAChE,KAAK;AACL,IAAI,cAAc,EAAE,UAAU;AAC9B,IAAI,aAAa,EAAE,WAAW;AAC9B,IAAI,GAAG,EAAE,UAAU;AACnB,GAAG,EAAE,MAAM,CAAC,kBAAkBD,cAAK,CAAC,aAAa,CAACE,qBAAU,EAAE;AAC9D,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,QAAQ,EAAE,kBAAkB;AAChC,IAAI,UAAU;AACd,IAAI,YAAY,EAAE,kBAAkB;AACpC,IAAI,cAAc,EAAE,wBAAwB;AAC5C,GAAG,EAAE,CAAC,gBAAgB,qBAAqBF,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACtE,IAAI,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAChG,GAAG,kBAAkBA,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE;AAC9C,IAAI,SAAS,EAAE,OAAO,CAAC,IAAI;AAC3B,IAAI,GAAG,EAAE,iBAAiB;AAC1B,IAAI,EAAE,EAAE,cAAc,CAAC;AACvB,MAAM,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ;AACjD,MAAM,KAAK;AACX,KAAK,EAAE,WAAW,CAAC;AACnB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzB,CAAC,EAAE;AACH,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
|
|
@@ -35,9 +35,10 @@ var useStyles = styles.createStyles((theme, { color, radius }) => ({
|
|
|
35
35
|
borderRadius: theme.fn.radius(radius),
|
|
36
36
|
padding: `${theme.spacing.xs / 2}px ${theme.spacing.xs}px`,
|
|
37
37
|
color: theme.colorScheme === "dark" ? theme.colors.dark[9] : theme.white,
|
|
38
|
-
position: "
|
|
38
|
+
position: "absolute",
|
|
39
39
|
overflow: "hidden",
|
|
40
|
-
textOverflow: "ellipsis"
|
|
40
|
+
textOverflow: "ellipsis",
|
|
41
|
+
pointerEvents: "none"
|
|
41
42
|
})
|
|
42
43
|
}));
|
|
43
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingTooltip.styles.js","sources":["../../../../src/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.ts"],"sourcesContent":["import { createStyles, MantineColor, MantineNumberSize } from '@mantine/styles';\n\nexport interface FloatingTooltipStylesParams {\n color: MantineColor;\n radius: MantineNumberSize;\n}\n\nexport default createStyles((theme, { color, radius }: FloatingTooltipStylesParams) => ({\n root: {\n position: 'relative',\n display: 'inline-block',\n },\n\n body: {\n ...theme.fn.fontStyles(),\n backgroundColor: theme.fn.themeColor(color, theme.colorScheme === 'dark' ? 3 : 9),\n lineHeight: theme.lineHeight,\n fontSize: theme.fontSizes.sm,\n borderRadius: theme.fn.radius(radius),\n padding: `${theme.spacing.xs / 2}px ${theme.spacing.xs}px`,\n color: theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.white,\n position: '
|
|
1
|
+
{"version":3,"file":"FloatingTooltip.styles.js","sources":["../../../../src/components/Tooltip/FloatingTooltip/FloatingTooltip.styles.ts"],"sourcesContent":["import { createStyles, MantineColor, MantineNumberSize } from '@mantine/styles';\n\nexport interface FloatingTooltipStylesParams {\n color: MantineColor;\n radius: MantineNumberSize;\n}\n\nexport default createStyles((theme, { color, radius }: FloatingTooltipStylesParams) => ({\n root: {\n position: 'relative',\n display: 'inline-block',\n },\n\n body: {\n ...theme.fn.fontStyles(),\n backgroundColor: theme.fn.themeColor(color, theme.colorScheme === 'dark' ? 3 : 9),\n lineHeight: theme.lineHeight,\n fontSize: theme.fontSizes.sm,\n borderRadius: theme.fn.radius(radius),\n padding: `${theme.spacing.xs / 2}px ${theme.spacing.xs}px`,\n color: theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.white,\n position: 'absolute',\n overflow: 'hidden',\n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
|
|
|
155
155
|
}, []);
|
|
156
156
|
return /* @__PURE__ */ React__default.createElement(Box.Box, __spreadValues({
|
|
157
157
|
className: cx(classes.root, className),
|
|
158
|
-
|
|
158
|
+
onPointerEnter: (event) => {
|
|
159
159
|
handleOpen();
|
|
160
160
|
typeof onMouseEnter === "function" && onMouseEnter(event);
|
|
161
161
|
},
|
|
162
|
-
|
|
162
|
+
onPointerLeave: (event) => {
|
|
163
163
|
handleClose();
|
|
164
164
|
typeof onMouseLeave === "function" && onMouseLeave(event);
|
|
165
165
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useState, useRef, forwardRef, useEffect } from 'react';\nimport {\n DefaultProps,\n MantineColor,\n ClassNames,\n getDefaultZIndex,\n MantineNumberSize,\n useMantineDefaultProps,\n} from '@mantine/styles';\nimport { useMergedRef } from '@mantine/hooks';\nimport { Box } from '../Box';\nimport { Popper, SharedPopperProps } from '../Popper';\nimport useStyles from './Tooltip.styles';\n\nexport type TooltipStylesNames = ClassNames<typeof useStyles>;\n\nexport interface TooltipProps\n extends DefaultProps<TooltipStylesNames>,\n SharedPopperProps,\n React.ComponentPropsWithoutRef<'div'> {\n /** Tooltip content */\n label: React.ReactNode;\n\n /** Any react node that should trigger tooltip */\n children: React.ReactNode;\n\n /** Tooltip opened state for controlled variant */\n opened?: boolean;\n\n /** Open delay in ms, 0 to disable delay */\n openDelay?: number;\n\n /** Close delay in ms, 0 to disable delay */\n closeDelay?: number;\n\n /** Any color from theme.colors, defaults to gray in light color scheme and dark in dark colors scheme */\n color?: MantineColor;\n\n /** Radius from theme.radius, or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** True to disable tooltip */\n disabled?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Tooltip width in px or auto */\n width?: number | 'auto';\n\n /** Allow multiline tooltip content */\n wrapLines?: boolean;\n\n /** Allow pointer events on tooltip, warning: this may break some animations */\n allowPointerEvents?: boolean;\n\n /** Get tooltip ref */\n tooltipRef?: React.ForwardedRef<HTMLDivElement>;\n\n /** Tooltip id to bind aria-describedby */\n tooltipId?: string;\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Whether to render the target element in a Portal */\n withinPortal?: boolean;\n}\n\nconst defaultProps: Partial<TooltipProps> = {\n openDelay: 0,\n closeDelay: 0,\n gutter: 5,\n color: 'gray',\n disabled: false,\n withArrow: false,\n arrowSize: 2,\n position: 'top',\n placement: 'center',\n transition: 'pop-top-left',\n transitionDuration: 100,\n zIndex: getDefaultZIndex('popover'),\n width: 'auto',\n wrapLines: false,\n allowPointerEvents: false,\n positionDependencies: [],\n withinPortal: true,\n};\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>((props: TooltipProps, ref) => {\n const {\n className,\n label,\n children,\n opened,\n openDelay,\n closeDelay,\n gutter,\n color,\n radius,\n disabled,\n withArrow,\n arrowSize,\n position,\n placement,\n transition,\n transitionDuration,\n zIndex,\n transitionTimingFunction,\n width,\n wrapLines,\n allowPointerEvents,\n positionDependencies,\n withinPortal,\n tooltipRef,\n tooltipId,\n classNames,\n styles,\n onMouseLeave,\n onMouseEnter,\n ...others\n } = useMantineDefaultProps('Tooltip', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { color, radius },\n { classNames, styles, name: 'Tooltip' }\n );\n const openTimeoutRef = useRef<number>();\n const closeTimeoutRef = useRef<number>();\n const [_opened, setOpened] = useState(false);\n const visible = (typeof opened === 'boolean' ? opened : _opened) && !disabled;\n const [referenceElement, setReferenceElement] = useState(null);\n const mergedRefs = useMergedRef(ref, setReferenceElement);\n\n const handleOpen = () => {\n window.clearTimeout(closeTimeoutRef.current);\n\n if (openDelay !== 0) {\n openTimeoutRef.current = window.setTimeout(() => {\n setOpened(true);\n }, openDelay);\n } else {\n setOpened(true);\n }\n };\n\n const handleClose = () => {\n window.clearTimeout(openTimeoutRef.current);\n\n if (closeDelay !== 0) {\n closeTimeoutRef.current = window.setTimeout(() => {\n setOpened(false);\n }, closeDelay);\n } else {\n setOpened(false);\n }\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(openTimeoutRef.current);\n window.clearTimeout(closeTimeoutRef.current);\n },\n []\n );\n\n return (\n <Box<'div'>\n className={cx(classes.root, className)}\n onMouseEnter={(event) => {\n handleOpen();\n typeof onMouseEnter === 'function' && onMouseEnter(event);\n }}\n onMouseLeave={(event) => {\n handleClose();\n typeof onMouseLeave === 'function' && onMouseLeave(event);\n }}\n onFocusCapture={handleOpen}\n onBlurCapture={handleClose}\n ref={mergedRefs}\n {...others}\n >\n <Popper\n referenceElement={referenceElement}\n transitionDuration={transitionDuration}\n transition={transition}\n mounted={visible}\n position={position}\n placement={placement}\n gutter={gutter}\n withArrow={withArrow}\n arrowSize={arrowSize}\n arrowDistance={theme.fn.radius(radius) > 10 ? 7 : 3}\n zIndex={zIndex}\n arrowClassName={classes.arrow}\n forceUpdateDependencies={[color, radius, ...positionDependencies]}\n withinPortal={withinPortal}\n >\n <Box\n className={classes.body}\n ref={tooltipRef}\n sx={{\n pointerEvents: allowPointerEvents ? 'all' : 'none',\n whiteSpace: wrapLines ? 'normal' : 'nowrap',\n width,\n }}\n >\n {label}\n </Box>\n </Popper>\n\n {children}\n </Box>\n );\n});\n\nTooltip.displayName = '@mantine/core/Tooltip';\n"],"names":["getDefaultZIndex","forwardRef","useMantineDefaultProps","styles","useStyles","useRef","useState","useMergedRef","useEffect","React","Box","Popper"],"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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O,CAAC,IAAI;AAC3B,IAAI,GAAG,EAAE,UAAU;AACnB,IAAI,EAAE,EAAE;AACR,MAAM,aAAa,EAAE,kBAAkB,GAAG,KAAK,GAAG,MAAM;AACxD,MAAM,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ;AACjD,MAAM,KAAK;AACX,KAAK;AACL,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,EAAE;AACH,OAAO,CAAC,WAAW,GAAG,uBAAuB;;;;"}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useState, useRef, forwardRef, useEffect } from 'react';\nimport {\n DefaultProps,\n MantineColor,\n ClassNames,\n getDefaultZIndex,\n MantineNumberSize,\n useMantineDefaultProps,\n} from '@mantine/styles';\nimport { useMergedRef } from '@mantine/hooks';\nimport { Box } from '../Box';\nimport { Popper, SharedPopperProps } from '../Popper';\nimport useStyles from './Tooltip.styles';\n\nexport type TooltipStylesNames = ClassNames<typeof useStyles>;\n\nexport interface TooltipProps\n extends DefaultProps<TooltipStylesNames>,\n SharedPopperProps,\n React.ComponentPropsWithoutRef<'div'> {\n /** Tooltip content */\n label: React.ReactNode;\n\n /** Any react node that should trigger tooltip */\n children: React.ReactNode;\n\n /** Tooltip opened state for controlled variant */\n opened?: boolean;\n\n /** Open delay in ms, 0 to disable delay */\n openDelay?: number;\n\n /** Close delay in ms, 0 to disable delay */\n closeDelay?: number;\n\n /** Any color from theme.colors, defaults to gray in light color scheme and dark in dark colors scheme */\n color?: MantineColor;\n\n /** Radius from theme.radius, or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** True to disable tooltip */\n disabled?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Tooltip width in px or auto */\n width?: number | 'auto';\n\n /** Allow multiline tooltip content */\n wrapLines?: boolean;\n\n /** Allow pointer events on tooltip, warning: this may break some animations */\n allowPointerEvents?: boolean;\n\n /** Get tooltip ref */\n tooltipRef?: React.ForwardedRef<HTMLDivElement>;\n\n /** Tooltip id to bind aria-describedby */\n tooltipId?: string;\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Whether to render the target element in a Portal */\n withinPortal?: boolean;\n}\n\nconst defaultProps: Partial<TooltipProps> = {\n openDelay: 0,\n closeDelay: 0,\n gutter: 5,\n color: 'gray',\n disabled: false,\n withArrow: false,\n arrowSize: 2,\n position: 'top',\n placement: 'center',\n transition: 'pop-top-left',\n transitionDuration: 100,\n zIndex: getDefaultZIndex('popover'),\n width: 'auto',\n wrapLines: false,\n allowPointerEvents: false,\n positionDependencies: [],\n withinPortal: true,\n};\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>((props: TooltipProps, ref) => {\n const {\n className,\n label,\n children,\n opened,\n openDelay,\n closeDelay,\n gutter,\n color,\n radius,\n disabled,\n withArrow,\n arrowSize,\n position,\n placement,\n transition,\n transitionDuration,\n zIndex,\n transitionTimingFunction,\n width,\n wrapLines,\n allowPointerEvents,\n positionDependencies,\n withinPortal,\n tooltipRef,\n tooltipId,\n classNames,\n styles,\n onMouseLeave,\n onMouseEnter,\n ...others\n } = useMantineDefaultProps('Tooltip', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { color, radius },\n { classNames, styles, name: 'Tooltip' }\n );\n const openTimeoutRef = useRef<number>();\n const closeTimeoutRef = useRef<number>();\n const [_opened, setOpened] = useState(false);\n const visible = (typeof opened === 'boolean' ? opened : _opened) && !disabled;\n const [referenceElement, setReferenceElement] = useState(null);\n const mergedRefs = useMergedRef(ref, setReferenceElement);\n\n const handleOpen = () => {\n window.clearTimeout(closeTimeoutRef.current);\n\n if (openDelay !== 0) {\n openTimeoutRef.current = window.setTimeout(() => {\n setOpened(true);\n }, openDelay);\n } else {\n setOpened(true);\n }\n };\n\n const handleClose = () => {\n window.clearTimeout(openTimeoutRef.current);\n\n if (closeDelay !== 0) {\n closeTimeoutRef.current = window.setTimeout(() => {\n setOpened(false);\n }, closeDelay);\n } else {\n setOpened(false);\n }\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(openTimeoutRef.current);\n window.clearTimeout(closeTimeoutRef.current);\n },\n []\n );\n\n return (\n <Box<'div'>\n className={cx(classes.root, className)}\n onPointerEnter={(event) => {\n handleOpen();\n typeof onMouseEnter === 'function' && onMouseEnter(event);\n }}\n onPointerLeave={(event) => {\n handleClose();\n typeof onMouseLeave === 'function' && onMouseLeave(event);\n }}\n onFocusCapture={handleOpen}\n onBlurCapture={handleClose}\n ref={mergedRefs}\n {...others}\n >\n <Popper\n referenceElement={referenceElement}\n transitionDuration={transitionDuration}\n transition={transition}\n mounted={visible}\n position={position}\n placement={placement}\n gutter={gutter}\n withArrow={withArrow}\n arrowSize={arrowSize}\n arrowDistance={theme.fn.radius(radius) > 10 ? 7 : 3}\n zIndex={zIndex}\n arrowClassName={classes.arrow}\n forceUpdateDependencies={[color, radius, ...positionDependencies]}\n withinPortal={withinPortal}\n >\n <Box\n className={classes.body}\n ref={tooltipRef}\n sx={{\n pointerEvents: allowPointerEvents ? 'all' : 'none',\n whiteSpace: wrapLines ? 'normal' : 'nowrap',\n width,\n }}\n >\n {label}\n </Box>\n </Popper>\n\n {children}\n </Box>\n );\n});\n\nTooltip.displayName = '@mantine/core/Tooltip';\n"],"names":["getDefaultZIndex","forwardRef","useMantineDefaultProps","styles","useStyles","useRef","useState","useMergedRef","useEffect","React","Box","Popper"],"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,KA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GAAG,EAAE,UAAU;AACnB,IAAI,EAAE,EAAE;AACR,MAAM,aAAa,EAAE,kBAAkB,GAAG,KAAK,GAAG,MAAM;AACxD,MAAM,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ;AACjD,MAAM,KAAK;AACX,KAAK;AACL,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,EAAE;AACH,OAAO,CAAC,WAAW,GAAG,uBAAuB;;;;"}
|
|
@@ -25,9 +25,9 @@ var useStyles = styles.createStyles((theme, { reversed, native, radius }) => ({
|
|
|
25
25
|
marginBottom: theme.spacing.sm - ITEM_PADDING
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
transferListItemHovered: {
|
|
28
|
+
transferListItemHovered: theme.fn.hover({
|
|
29
29
|
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.colors.gray[0]
|
|
30
|
-
},
|
|
30
|
+
}),
|
|
31
31
|
transferListItems: {
|
|
32
32
|
overflow: native ? "auto" : "hidden"
|
|
33
33
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderList.styles.js","sources":["../../../../src/components/TransferList/RenderList/RenderList.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize } from '@mantine/styles';\n\ninterface RenderListStyles {\n reversed: boolean;\n native: boolean;\n radius: MantineNumberSize;\n}\n\nconst ITEM_PADDING = 7;\n\nexport default createStyles((theme, { reversed, native, radius }: RenderListStyles) => ({\n transferList: {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n },\n\n transferListItem: {\n display: 'block',\n width: `calc(100% - ${ITEM_PADDING * 2}px)`,\n padding: ITEM_PADDING,\n marginLeft: theme.spacing.sm - ITEM_PADDING,\n marginRight: theme.spacing.sm - ITEM_PADDING,\n borderRadius: theme.fn.radius(radius),\n\n '&:first-of-type': {\n marginTop: theme.spacing.sm - ITEM_PADDING,\n },\n\n '&:last-of-type': {\n marginBottom: theme.spacing.sm - ITEM_PADDING,\n },\n },\n\n transferListItemHovered: {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],\n },\n\n transferListItems: {\n overflow: native ? 'auto' : 'hidden',\n },\n\n transferListHeader: {\n display: 'flex',\n flexDirection: reversed ? 'row-reverse' : 'row',\n },\n\n transferListBody: {\n flex: 1,\n borderRadius: theme.fn.radius(radius),\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.white,\n border: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4]\n }`,\n },\n\n transferListTitle: {\n marginBottom: 5,\n },\n\n transferListSearch: {\n borderTopWidth: 0,\n borderRightWidth: 0,\n borderLeftWidth: 0,\n borderTopLeftRadius: reversed ? 0 : `calc(${theme.fn.radius(radius)}px - 1px)`,\n borderTopRightRadius: reversed ? `calc(${theme.fn.radius(radius)}px - 1px)` : 0,\n display: 'block',\n borderBottomColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4],\n },\n\n transferListControl: {\n borderTop: 0,\n borderRightWidth: reversed ? undefined : 0,\n borderLeftWidth: reversed ? 0 : undefined,\n borderColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4],\n\n '&:last-of-type': {\n borderTopLeftRadius: reversed ? `calc(${theme.fn.radius(radius)}px - 1px)` : 0,\n borderTopRightRadius: reversed ? 0 : `calc(${theme.fn.radius(radius)}px - 1px)`,\n },\n\n '&:disabled': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : 'transparent',\n borderColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4],\n },\n },\n\n separator: {\n boxSizing: 'border-box',\n textAlign: 'left',\n width: '100%',\n padding: '7px 12px',\n },\n\n separatorLabel: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],\n },\n}));\n"],"names":["createStyles"],"mappings":";;;;;;AACA,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,gBAAeA,mBAAY,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;AACtE,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,aAAa,EAAE,QAAQ;AAC3B,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,KAAK,EAAE,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC;AAC/C,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AAC/C,IAAI,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AAChD,IAAI,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;AACzC,IAAI,iBAAiB,EAAE;AACvB,MAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AAChD,KAAK;AACL,IAAI,gBAAgB,EAAE;AACtB,MAAM,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AACnD,KAAK;AACL,GAAG;AACH,EAAE,uBAAuB,EAAE;
|
|
1
|
+
{"version":3,"file":"RenderList.styles.js","sources":["../../../../src/components/TransferList/RenderList/RenderList.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize } from '@mantine/styles';\n\ninterface RenderListStyles {\n reversed: boolean;\n native: boolean;\n radius: MantineNumberSize;\n}\n\nconst ITEM_PADDING = 7;\n\nexport default createStyles((theme, { reversed, native, radius }: RenderListStyles) => ({\n transferList: {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n },\n\n transferListItem: {\n display: 'block',\n width: `calc(100% - ${ITEM_PADDING * 2}px)`,\n padding: ITEM_PADDING,\n marginLeft: theme.spacing.sm - ITEM_PADDING,\n marginRight: theme.spacing.sm - ITEM_PADDING,\n borderRadius: theme.fn.radius(radius),\n\n '&:first-of-type': {\n marginTop: theme.spacing.sm - ITEM_PADDING,\n },\n\n '&:last-of-type': {\n marginBottom: theme.spacing.sm - ITEM_PADDING,\n },\n },\n\n transferListItemHovered: theme.fn.hover({\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],\n }),\n\n transferListItems: {\n overflow: native ? 'auto' : 'hidden',\n },\n\n transferListHeader: {\n display: 'flex',\n flexDirection: reversed ? 'row-reverse' : 'row',\n },\n\n transferListBody: {\n flex: 1,\n borderRadius: theme.fn.radius(radius),\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.white,\n border: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4]\n }`,\n },\n\n transferListTitle: {\n marginBottom: 5,\n },\n\n transferListSearch: {\n borderTopWidth: 0,\n borderRightWidth: 0,\n borderLeftWidth: 0,\n borderTopLeftRadius: reversed ? 0 : `calc(${theme.fn.radius(radius)}px - 1px)`,\n borderTopRightRadius: reversed ? `calc(${theme.fn.radius(radius)}px - 1px)` : 0,\n display: 'block',\n borderBottomColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4],\n },\n\n transferListControl: {\n borderTop: 0,\n borderRightWidth: reversed ? undefined : 0,\n borderLeftWidth: reversed ? 0 : undefined,\n borderColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4],\n\n '&:last-of-type': {\n borderTopLeftRadius: reversed ? `calc(${theme.fn.radius(radius)}px - 1px)` : 0,\n borderTopRightRadius: reversed ? 0 : `calc(${theme.fn.radius(radius)}px - 1px)`,\n },\n\n '&:disabled': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : 'transparent',\n borderColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4],\n },\n },\n\n separator: {\n boxSizing: 'border-box',\n textAlign: 'left',\n width: '100%',\n padding: '7px 12px',\n },\n\n separatorLabel: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],\n },\n}));\n"],"names":["createStyles"],"mappings":";;;;;;AACA,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,gBAAeA,mBAAY,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;AACtE,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,aAAa,EAAE,QAAQ;AAC3B,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,KAAK,EAAE,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC;AAC/C,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AAC/C,IAAI,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AAChD,IAAI,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;AACzC,IAAI,iBAAiB,EAAE;AACvB,MAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AAChD,KAAK;AACL,IAAI,gBAAgB,EAAE;AACtB,MAAM,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY;AACnD,KAAK;AACL,GAAG;AACH,EAAE,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AAC1C,IAAI,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,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;AACrB,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,cAAc,EAAE;AAClB,IAAI,KAAK,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACrF,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
|
package/cjs/index.js
CHANGED
|
@@ -70,6 +70,7 @@ var Group = require('./components/Group/Group.js');
|
|
|
70
70
|
var Highlight = require('./components/Highlight/Highlight.js');
|
|
71
71
|
var Image = require('./components/Image/Image.js');
|
|
72
72
|
var BackgroundImage = require('./components/Image/BackgroundImage/BackgroundImage.js');
|
|
73
|
+
var Indicator = require('./components/Indicator/Indicator.js');
|
|
73
74
|
var Input = require('./components/Input/Input.js');
|
|
74
75
|
var Input_styles = require('./components/Input/Input.styles.js');
|
|
75
76
|
var InputWrapper = require('./components/InputWrapper/InputWrapper.js');
|
|
@@ -210,6 +211,7 @@ exports.Group = Group.Group;
|
|
|
210
211
|
exports.Highlight = Highlight.Highlight;
|
|
211
212
|
exports.Image = Image.Image;
|
|
212
213
|
exports.BackgroundImage = BackgroundImage.BackgroundImage;
|
|
214
|
+
exports.Indicator = Indicator.Indicator;
|
|
213
215
|
exports.Input = Input.Input;
|
|
214
216
|
exports.INPUT_SIZES = Input_styles.sizes;
|
|
215
217
|
exports.InputWrapper = InputWrapper.InputWrapper;
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -56,7 +56,7 @@ var useStyles = createStyles((theme, {
|
|
|
56
56
|
padding: 0,
|
|
57
57
|
fontWeight: "normal"
|
|
58
58
|
},
|
|
59
|
-
control: __spreadProps(__spreadValues(__spreadValues({}, theme.fn.focusStyles()), theme.fn.fontStyles()), {
|
|
59
|
+
control: __spreadValues(__spreadProps(__spreadValues(__spreadValues({}, theme.fn.focusStyles()), theme.fn.fontStyles()), {
|
|
60
60
|
ref: getRef("control"),
|
|
61
61
|
width: "100%",
|
|
62
62
|
display: "flex",
|
|
@@ -66,11 +66,10 @@ var useStyles = createStyles((theme, {
|
|
|
66
66
|
paddingLeft: iconPosition === "right" ? theme.spacing.sm + 4 : null,
|
|
67
67
|
fontWeight: 500,
|
|
68
68
|
textAlign: "left",
|
|
69
|
-
color: theme.colorScheme === "dark" ? theme.colors.dark[0] : theme.black
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}),
|
|
69
|
+
color: theme.colorScheme === "dark" ? theme.colors.dark[0] : theme.black
|
|
70
|
+
}), theme.fn.hover({
|
|
71
|
+
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[0]
|
|
72
|
+
})),
|
|
74
73
|
content: __spreadProps(__spreadValues({}, theme.fn.fontStyles()), {
|
|
75
74
|
wordBreak: "break-word",
|
|
76
75
|
lineHeight: theme.lineHeight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.styles.js","sources":["../../../../src/components/Accordion/AccordionItem/AccordionItem.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/styles';\n\nexport type AccordionIconPosition = 'right' | 'left';\n\nexport interface AccordionStylesParams {\n transitionDuration: number;\n disableIconRotation: boolean;\n iconPosition: AccordionIconPosition;\n offsetIcon: boolean;\n iconSize: number;\n}\n\nexport default createStyles(\n (\n theme,\n {\n transitionDuration,\n disableIconRotation,\n iconPosition,\n offsetIcon,\n iconSize,\n }: AccordionStylesParams,\n getRef\n ) => ({\n icon: {\n ref: getRef('icon'),\n transition: `transform ${transitionDuration}ms ease`,\n marginRight: iconPosition === 'right' ? 0 : theme.spacing.sm,\n marginLeft: iconPosition === 'right' ? theme.spacing.lg : 0,\n width: iconSize,\n minWidth: iconSize,\n },\n\n label: {\n color: 'inherit',\n fontWeight: 500,\n flex: 1,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n\n item: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,\n borderBottom: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]\n }`,\n },\n\n itemOpened: {\n [`& > .${getRef('itemTitle')} > .${getRef('control')} .${getRef('icon')}`]: {\n transform: disableIconRotation ? 'none' : 'rotate(180deg)',\n },\n },\n\n itemTitle: {\n ref: getRef('itemTitle'),\n margin: 0,\n padding: 0,\n fontWeight: 'normal',\n },\n\n control: {\n ...theme.fn.focusStyles(),\n ...theme.fn.fontStyles(),\n ref: getRef('control'),\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n flexDirection: iconPosition === 'right' ? 'row-reverse' : 'row',\n padding: `${theme.spacing.md}px ${theme.spacing.md / 2}px`,\n paddingLeft: iconPosition === 'right' ? theme.spacing.sm + 4 : null,\n fontWeight: 500,\n textAlign: 'left',\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,\n\n
|
|
1
|
+
{"version":3,"file":"AccordionItem.styles.js","sources":["../../../../src/components/Accordion/AccordionItem/AccordionItem.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/styles';\n\nexport type AccordionIconPosition = 'right' | 'left';\n\nexport interface AccordionStylesParams {\n transitionDuration: number;\n disableIconRotation: boolean;\n iconPosition: AccordionIconPosition;\n offsetIcon: boolean;\n iconSize: number;\n}\n\nexport default createStyles(\n (\n theme,\n {\n transitionDuration,\n disableIconRotation,\n iconPosition,\n offsetIcon,\n iconSize,\n }: AccordionStylesParams,\n getRef\n ) => ({\n icon: {\n ref: getRef('icon'),\n transition: `transform ${transitionDuration}ms ease`,\n marginRight: iconPosition === 'right' ? 0 : theme.spacing.sm,\n marginLeft: iconPosition === 'right' ? theme.spacing.lg : 0,\n width: iconSize,\n minWidth: iconSize,\n },\n\n label: {\n color: 'inherit',\n fontWeight: 500,\n flex: 1,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n\n item: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,\n borderBottom: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]\n }`,\n },\n\n itemOpened: {\n [`& > .${getRef('itemTitle')} > .${getRef('control')} .${getRef('icon')}`]: {\n transform: disableIconRotation ? 'none' : 'rotate(180deg)',\n },\n },\n\n itemTitle: {\n ref: getRef('itemTitle'),\n margin: 0,\n padding: 0,\n fontWeight: 'normal',\n },\n\n control: {\n ...theme.fn.focusStyles(),\n ...theme.fn.fontStyles(),\n ref: getRef('control'),\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n flexDirection: iconPosition === 'right' ? 'row-reverse' : 'row',\n padding: `${theme.spacing.md}px ${theme.spacing.md / 2}px`,\n paddingLeft: iconPosition === 'right' ? theme.spacing.sm + 4 : null,\n fontWeight: 500,\n textAlign: 'left',\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,\n\n ...theme.fn.hover({\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[0],\n }),\n },\n\n content: {\n ...theme.fn.fontStyles(),\n wordBreak: 'break-word',\n lineHeight: theme.lineHeight,\n paddingLeft: iconPosition === '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AAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK;AAC5E,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AACrB,IAAI,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/F,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,EAAE;AACpE,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,UAAU,EAAE,KAAK,CAAC,UAAU;AAChC,IAAI,WAAW,EAAE,YAAY,KAAK,OAAO,GAAG,CAAC,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;AAChG,GAAG,CAAC;AACJ,EAAE,YAAY,EAAE;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;AAC7B,IAAI,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC;AACpC,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import { useMantineDefaultProps
|
|
2
|
+
import { useMantineDefaultProps } from '@mantine/styles';
|
|
3
3
|
import useStyles, { sizes } from './ActionIcon.styles.js';
|
|
4
4
|
import { Loader } from '../Loader/Loader.js';
|
|
5
5
|
import { Box } from '../Box/Box.js';
|
|
@@ -68,7 +68,7 @@ const ActionIcon = forwardRef((props, ref) => {
|
|
|
68
68
|
"classNames"
|
|
69
69
|
]);
|
|
70
70
|
const { classes, cx, theme } = useStyles({ size, radius, color }, { name: "ActionIcon", classNames, styles });
|
|
71
|
-
const colors =
|
|
71
|
+
const colors = theme.fn.variant({ color, variant: "light" });
|
|
72
72
|
const loader = /* @__PURE__ */ React.createElement(Loader, __spreadValues({
|
|
73
73
|
color: colors.color,
|
|
74
74
|
size: theme.fn.size({ size, sizes }) - 12
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionIcon.js","sources":["../../../src/components/ActionIcon/ActionIcon.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineNumberSize,\n
|
|
1
|
+
{"version":3,"file":"ActionIcon.js","sources":["../../../src/components/ActionIcon/ActionIcon.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineColor,\n PolymorphicComponentProps,\n PolymorphicRef,\n ClassNames,\n useMantineDefaultProps,\n} from '@mantine/styles';\nimport { Box } from '../Box';\nimport useStyles, { sizes, ActionIconVariant } from './ActionIcon.styles';\nimport { Loader, LoaderProps } from '../Loader';\n\nexport type ActionIconStylesNames = ClassNames<typeof useStyles>;\n\ninterface _ActionIconProps extends DefaultProps<ActionIconStylesNames> {\n /** Icon rendered inside button */\n children?: React.ReactNode;\n\n /** Controls appearance */\n variant?: ActionIconVariant;\n\n /** Button hover, active and icon colors from theme, defaults to gray */\n color?: MantineColor;\n\n /** Button border-radius from theme or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Predefined icon size or number to set width and height in px */\n size?: MantineNumberSize;\n\n /** Props spread to Loader component */\n loaderProps?: LoaderProps;\n\n /** Indicate loading state */\n loading?: boolean;\n}\n\nexport type ActionIconProps<C> = PolymorphicComponentProps<C, _ActionIconProps>;\n\ntype ActionIconComponent = (<C = 'button'>(props: ActionIconProps<C>) => React.ReactElement) & {\n displayName?: string;\n};\n\nconst defaultProps: Partial<ActionIconProps<any>> = {\n color: 'gray',\n size: 'md',\n variant: 'hover',\n disabled: false,\n loading: false,\n};\n\nexport const ActionIcon: ActionIconComponent = forwardRef(\n (props: ActionIconProps<'button'>, ref: PolymorphicRef<'button'>) => {\n const {\n className,\n color,\n children,\n radius,\n size,\n variant,\n disabled,\n loaderProps,\n loading,\n component,\n styles,\n classNames,\n ...others\n } = useMantineDefaultProps('ActionIcon', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { size, radius, color },\n { name: 'ActionIcon', classNames, styles }\n );\n const colors = theme.fn.variant({ color, variant: 'light' });\n\n const loader = (\n <Loader color={colors.color} size={theme.fn.size({ size, sizes }) - 12} {...loaderProps} />\n );\n\n return (\n <Box<any>\n component={component || 'button'}\n className={cx(classes[variant], classes.root, { [classes.loading]: loading }, className)}\n type=\"button\"\n ref={ref}\n disabled={disabled || loading}\n {...others}\n >\n {loading ? loader : children}\n </Box>\n );\n }\n) as any;\n\nActionIcon.displayName = '@mantine/core/ActionIcon';\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,Y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EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE;AAC7C,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;AACnB,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,cAAc,CAAC;AACjE,IAAI,SAAS,EAAE,SAAS,IAAI,QAAQ;AACpC,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,EAAE,SAAS,CAAC;AAC5F,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,GAAG;AACP,IAAI,QAAQ,EAAE,QAAQ,IAAI,OAAO;AACjC,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;AAC3C,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createStyles
|
|
1
|
+
import { createStyles } from '@mantine/styles';
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __defProps = Object.defineProperties;
|
|
@@ -28,24 +28,20 @@ const sizes = {
|
|
|
28
28
|
};
|
|
29
29
|
function getVariantStyles({ variant, theme, color }) {
|
|
30
30
|
if (variant === "hover" || variant === "transparent") {
|
|
31
|
-
return {
|
|
31
|
+
return __spreadValues({
|
|
32
32
|
border: "1px solid transparent",
|
|
33
33
|
color: theme.fn.themeColor(color, theme.colorScheme === "dark" ? 4 : 7),
|
|
34
|
-
backgroundColor: "transparent"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
34
|
+
backgroundColor: "transparent"
|
|
35
|
+
}, theme.fn.hover(variant === "transparent" ? {} : {
|
|
36
|
+
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[8] : theme.fn.themeColor(color, 0)
|
|
37
|
+
}));
|
|
39
38
|
}
|
|
40
|
-
const colors =
|
|
41
|
-
return {
|
|
39
|
+
const colors = theme.fn.variant({ color, variant });
|
|
40
|
+
return __spreadValues({
|
|
42
41
|
backgroundColor: colors.background,
|
|
43
42
|
color: colors.color,
|
|
44
|
-
border: `1px solid ${colors.border}
|
|
45
|
-
|
|
46
|
-
backgroundColor: colors.hover
|
|
47
|
-
}
|
|
48
|
-
};
|
|
43
|
+
border: `1px solid ${colors.border}`
|
|
44
|
+
}, theme.fn.hover({ backgroundColor: colors.hover }));
|
|
49
45
|
}
|
|
50
46
|
var useStyles = createStyles((theme, { color, size, radius }) => ({
|
|
51
47
|
root: __spreadProps(__spreadValues(__spreadValues({}, theme.fn.focusStyles()), theme.fn.fontStyles()), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionIcon.styles.js","sources":["../../../src/components/ActionIcon/ActionIcon.styles.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ActionIcon.styles.js","sources":["../../../src/components/ActionIcon/ActionIcon.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineColor, MantineTheme } from '@mantine/styles';\n\nexport type ActionIconVariant =\n | 'hover'\n | 'filled'\n | 'outline'\n | 'light'\n | 'default'\n | 'transparent';\n\nexport interface ActionIconStylesParams {\n color: MantineColor;\n size: MantineNumberSize;\n radius: MantineNumberSize;\n}\n\nexport const sizes = {\n xs: 18,\n sm: 22,\n md: 28,\n lg: 34,\n xl: 44,\n};\n\ninterface GetVariantStyles {\n variant: ActionIconVariant;\n theme: MantineTheme;\n color: MantineColor;\n}\n\nfunction getVariantStyles({ variant, theme, color }: GetVariantStyles) {\n if (variant === 'hover' || variant === 'transparent') {\n return {\n border: '1px solid transparent',\n color: theme.fn.themeColor(color, theme.colorScheme === 'dark' ? 4 : 7),\n backgroundColor: 'transparent',\n ...theme.fn.hover(\n variant === 'transparent'\n ? {}\n : {\n backgroundColor:\n theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.fn.themeColor(color, 0),\n }\n ),\n };\n }\n\n const colors = theme.fn.variant({ color, variant });\n\n return {\n backgroundColor: colors.background,\n color: colors.color,\n border: `1px solid ${colors.border}`,\n ...theme.fn.hover({ backgroundColor: colors.hover }),\n };\n}\n\nexport default createStyles((theme, { color, size, radius }: ActionIconStylesParams) => ({\n root: {\n ...theme.fn.focusStyles(),\n ...theme.fn.fontStyles(),\n position: 'relative',\n appearance: 'none',\n WebkitAppearance: 'none',\n WebkitTapHighlightColor: 'transparent',\n boxSizing: 'border-box',\n height: theme.fn.size({ size, sizes }),\n minHeight: theme.fn.size({ size, sizes }),\n width: theme.fn.size({ size, sizes }),\n minWidth: theme.fn.size({ size, sizes }),\n borderRadius: theme.fn.radius(radius),\n padding: 0,\n lineHeight: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n cursor: 'pointer',\n\n '&:disabled': {\n color: theme.colors.gray[theme.colorScheme === 'dark' ? 6 : 4],\n cursor: 'not-allowed',\n backgroundColor: theme.fn.themeColor('gray', theme.colorScheme === 'dark' ? 8 : 1),\n borderColor: theme.fn.themeColor('gray', theme.colorScheme === 'dark' ? 8 : 1),\n },\n\n '&:not(:disabled):active': {\n transform: 'translateY(1px)',\n },\n },\n\n outline: getVariantStyles({ theme, color, variant: 'outline' }),\n filled: getVariantStyles({ theme, color, variant: 'filled' }),\n default: getVariantStyles({ theme, color, variant: 'default' }),\n light: getVariantStyles({ theme, color, variant: 'light' }),\n hover: getVariantStyles({ theme, color, variant: 'hover' }),\n transparent: getVariantStyles({ theme, color, variant: 'transparent' }),\n\n loading: {\n '&::before': {\n content: '\"\"',\n position: 'absolute',\n top: -1,\n left: -1,\n right: -1,\n bottom: -1,\n backgroundColor:\n theme.colorScheme === 'dark'\n ? theme.fn.rgba(theme.colors.dark[7], 0.5)\n : 'rgba(255, 255, 255, .5)',\n borderRadius: theme.fn.radius(radius),\n cursor: 'not-allowed',\n },\n },\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