@mantine/core 5.4.2 → 5.5.1
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/ActionIcon/ActionIcon.js +1 -1
- package/cjs/ActionIcon/ActionIcon.js.map +1 -1
- package/cjs/AppShell/AppShell.styles.js +2 -2
- package/cjs/AppShell/AppShell.styles.js.map +1 -1
- package/cjs/AppShell/HorizontalSection/HorizontalSection.js +1 -1
- package/cjs/AppShell/HorizontalSection/HorizontalSection.js.map +1 -1
- package/cjs/AppShell/HorizontalSection/HorizontalSection.styles.js +2 -2
- package/cjs/AppShell/HorizontalSection/HorizontalSection.styles.js.map +1 -1
- package/cjs/Button/Button.js +1 -1
- package/cjs/Button/Button.js.map +1 -1
- package/cjs/Checkbox/Checkbox.js +37 -12
- package/cjs/Checkbox/Checkbox.js.map +1 -1
- package/cjs/Checkbox/Checkbox.styles.js +34 -11
- package/cjs/Checkbox/Checkbox.styles.js.map +1 -1
- package/cjs/Grid/Col/Col.styles.js +1 -1
- package/cjs/Grid/Col/Col.styles.js.map +1 -1
- package/cjs/Input/InputWrapper/InputWrapper.js +7 -4
- package/cjs/Input/InputWrapper/InputWrapper.js.map +1 -1
- package/cjs/List/List.js.map +1 -1
- package/cjs/List/ListItem/ListItem.styles.js +4 -1
- package/cjs/List/ListItem/ListItem.styles.js.map +1 -1
- package/cjs/MediaQuery/MediaQuery.styles.js +4 -4
- package/cjs/MediaQuery/MediaQuery.styles.js.map +1 -1
- package/cjs/MultiSelect/MultiSelect.js +8 -9
- package/cjs/MultiSelect/MultiSelect.js.map +1 -1
- package/cjs/NumberInput/NumberInput.js +16 -2
- package/cjs/NumberInput/NumberInput.js.map +1 -1
- package/cjs/Popover/Popover.context.js.map +1 -1
- package/cjs/Popover/Popover.js +18 -7
- package/cjs/Popover/Popover.js.map +1 -1
- package/cjs/Popover/PopoverDropdown/PopoverDropdown.js +3 -0
- package/cjs/Popover/PopoverDropdown/PopoverDropdown.js.map +1 -1
- package/cjs/Popover/use-popover.js +3 -0
- package/cjs/Popover/use-popover.js.map +1 -1
- package/cjs/Radio/Radio.js +25 -9
- package/cjs/Radio/Radio.js.map +1 -1
- package/cjs/Radio/Radio.styles.js +24 -11
- package/cjs/Radio/Radio.styles.js.map +1 -1
- package/cjs/ScrollArea/ScrollArea.js.map +1 -1
- package/cjs/SegmentedControl/SegmentedControl.js +2 -1
- package/cjs/SegmentedControl/SegmentedControl.js.map +1 -1
- package/cjs/Select/Select.js +3 -7
- package/cjs/Select/Select.js.map +1 -1
- package/cjs/Select/SelectItems/SelectItems.js +0 -1
- package/cjs/Select/SelectItems/SelectItems.js.map +1 -1
- package/cjs/Select/SelectItems/SelectItems.styles.js +5 -2
- package/cjs/Select/SelectItems/SelectItems.styles.js.map +1 -1
- package/cjs/Select/SelectPopover/SelectPopover.styles.js +2 -1
- package/cjs/Select/SelectPopover/SelectPopover.styles.js.map +1 -1
- package/cjs/SimpleGrid/SimpleGrid.styles.js +1 -1
- package/cjs/SimpleGrid/SimpleGrid.styles.js.map +1 -1
- package/cjs/Slider/RangeSlider/RangeSlider.js +5 -2
- package/cjs/Slider/RangeSlider/RangeSlider.js.map +1 -1
- package/cjs/Slider/Slider/Slider.js +5 -2
- package/cjs/Slider/Slider/Slider.js.map +1 -1
- package/cjs/Slider/Track/Track.js +5 -3
- package/cjs/Slider/Track/Track.js.map +1 -1
- package/cjs/Slider/Track/Track.styles.js +3 -3
- package/cjs/Slider/Track/Track.styles.js.map +1 -1
- package/cjs/Stepper/Stepper.styles.js +2 -2
- package/cjs/Stepper/Stepper.styles.js.map +1 -1
- package/cjs/Switch/Switch.js +27 -12
- package/cjs/Switch/Switch.js.map +1 -1
- package/cjs/Switch/Switch.styles.js +20 -9
- package/cjs/Switch/Switch.styles.js.map +1 -1
- package/cjs/Tabs/Tabs.js.map +1 -1
- package/cjs/Tooltip/Tooltip.js +7 -3
- package/cjs/Tooltip/Tooltip.js.map +1 -1
- package/cjs/Tooltip/use-tooltip.js +2 -3
- package/cjs/Tooltip/use-tooltip.js.map +1 -1
- package/esm/ActionIcon/ActionIcon.js +1 -1
- package/esm/ActionIcon/ActionIcon.js.map +1 -1
- package/esm/AppShell/AppShell.styles.js +2 -2
- package/esm/AppShell/AppShell.styles.js.map +1 -1
- package/esm/AppShell/HorizontalSection/HorizontalSection.js +1 -1
- package/esm/AppShell/HorizontalSection/HorizontalSection.js.map +1 -1
- package/esm/AppShell/HorizontalSection/HorizontalSection.styles.js +2 -2
- package/esm/AppShell/HorizontalSection/HorizontalSection.styles.js.map +1 -1
- package/esm/Button/Button.js +1 -1
- package/esm/Button/Button.js.map +1 -1
- package/esm/Checkbox/Checkbox.js +37 -12
- package/esm/Checkbox/Checkbox.js.map +1 -1
- package/esm/Checkbox/Checkbox.styles.js +34 -11
- package/esm/Checkbox/Checkbox.styles.js.map +1 -1
- package/esm/Grid/Col/Col.styles.js +1 -1
- package/esm/Grid/Col/Col.styles.js.map +1 -1
- package/esm/Input/InputWrapper/InputWrapper.js +7 -4
- package/esm/Input/InputWrapper/InputWrapper.js.map +1 -1
- package/esm/List/List.js.map +1 -1
- package/esm/List/ListItem/ListItem.styles.js +4 -1
- package/esm/List/ListItem/ListItem.styles.js.map +1 -1
- package/esm/MediaQuery/MediaQuery.styles.js +4 -4
- package/esm/MediaQuery/MediaQuery.styles.js.map +1 -1
- package/esm/MultiSelect/MultiSelect.js +8 -9
- package/esm/MultiSelect/MultiSelect.js.map +1 -1
- package/esm/NumberInput/NumberInput.js +16 -2
- package/esm/NumberInput/NumberInput.js.map +1 -1
- package/esm/Popover/Popover.context.js.map +1 -1
- package/esm/Popover/Popover.js +19 -8
- package/esm/Popover/Popover.js.map +1 -1
- package/esm/Popover/PopoverDropdown/PopoverDropdown.js +3 -0
- package/esm/Popover/PopoverDropdown/PopoverDropdown.js.map +1 -1
- package/esm/Popover/use-popover.js +4 -1
- package/esm/Popover/use-popover.js.map +1 -1
- package/esm/Radio/Radio.js +25 -9
- package/esm/Radio/Radio.js.map +1 -1
- package/esm/Radio/Radio.styles.js +24 -11
- package/esm/Radio/Radio.styles.js.map +1 -1
- package/esm/ScrollArea/ScrollArea.js.map +1 -1
- package/esm/SegmentedControl/SegmentedControl.js +2 -1
- package/esm/SegmentedControl/SegmentedControl.js.map +1 -1
- package/esm/Select/Select.js +3 -7
- package/esm/Select/Select.js.map +1 -1
- package/esm/Select/SelectItems/SelectItems.js +0 -1
- package/esm/Select/SelectItems/SelectItems.js.map +1 -1
- package/esm/Select/SelectItems/SelectItems.styles.js +5 -2
- package/esm/Select/SelectItems/SelectItems.styles.js.map +1 -1
- package/esm/Select/SelectPopover/SelectPopover.styles.js +2 -1
- package/esm/Select/SelectPopover/SelectPopover.styles.js.map +1 -1
- package/esm/SimpleGrid/SimpleGrid.styles.js +1 -1
- package/esm/SimpleGrid/SimpleGrid.styles.js.map +1 -1
- package/esm/Slider/RangeSlider/RangeSlider.js +5 -2
- package/esm/Slider/RangeSlider/RangeSlider.js.map +1 -1
- package/esm/Slider/Slider/Slider.js +5 -2
- package/esm/Slider/Slider/Slider.js.map +1 -1
- package/esm/Slider/Track/Track.js +5 -3
- package/esm/Slider/Track/Track.js.map +1 -1
- package/esm/Slider/Track/Track.styles.js +3 -3
- package/esm/Slider/Track/Track.styles.js.map +1 -1
- package/esm/Stepper/Stepper.styles.js +2 -2
- package/esm/Stepper/Stepper.styles.js.map +1 -1
- package/esm/Switch/Switch.js +27 -12
- package/esm/Switch/Switch.js.map +1 -1
- package/esm/Switch/Switch.styles.js +20 -9
- package/esm/Switch/Switch.styles.js.map +1 -1
- package/esm/Tabs/Tabs.js.map +1 -1
- package/esm/Tooltip/Tooltip.js +7 -3
- package/esm/Tooltip/Tooltip.js.map +1 -1
- package/esm/Tooltip/use-tooltip.js +3 -4
- package/esm/Tooltip/use-tooltip.js.map +1 -1
- package/lib/AppShell/HorizontalSection/HorizontalSection.styles.d.ts.map +1 -1
- package/lib/Checkbox/Checkbox.d.ts +6 -0
- package/lib/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/Checkbox/Checkbox.styles.d.ts +5 -2
- package/lib/Checkbox/Checkbox.styles.d.ts.map +1 -1
- package/lib/Input/InputWrapper/InputWrapper.d.ts.map +1 -1
- package/lib/List/List.d.ts +1 -1
- package/lib/List/List.d.ts.map +1 -1
- package/lib/List/ListItem/ListItem.styles.d.ts.map +1 -1
- package/lib/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/lib/NumberInput/NumberInput.d.ts +2 -0
- package/lib/NumberInput/NumberInput.d.ts.map +1 -1
- package/lib/Popover/Popover.context.d.ts +1 -0
- package/lib/Popover/Popover.context.d.ts.map +1 -1
- package/lib/Popover/Popover.d.ts +2 -0
- package/lib/Popover/Popover.d.ts.map +1 -1
- package/lib/Popover/Popover.types.d.ts +1 -0
- package/lib/Popover/Popover.types.d.ts.map +1 -1
- package/lib/Popover/PopoverDropdown/PopoverDropdown.d.ts.map +1 -1
- package/lib/Popover/use-popover.d.ts.map +1 -1
- package/lib/Radio/Radio.d.ts +6 -0
- package/lib/Radio/Radio.d.ts.map +1 -1
- package/lib/Radio/Radio.styles.d.ts +4 -2
- package/lib/Radio/Radio.styles.d.ts.map +1 -1
- package/lib/ScrollArea/ScrollArea.d.ts +2 -2
- package/lib/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/lib/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/Select/Select.d.ts.map +1 -1
- package/lib/Select/SelectItems/SelectItems.styles.d.ts.map +1 -1
- package/lib/Select/SelectPopover/SelectPopover.styles.d.ts.map +1 -1
- package/lib/Select/SelectScrollArea/SelectScrollArea.d.ts +1 -1
- package/lib/Select/SelectScrollArea/SelectScrollArea.d.ts.map +1 -1
- package/lib/Slider/RangeSlider/RangeSlider.d.ts +2 -0
- package/lib/Slider/RangeSlider/RangeSlider.d.ts.map +1 -1
- package/lib/Slider/Slider/Slider.d.ts +2 -0
- package/lib/Slider/Slider/Slider.d.ts.map +1 -1
- package/lib/Slider/Track/Track.d.ts +2 -1
- package/lib/Slider/Track/Track.d.ts.map +1 -1
- package/lib/Slider/Track/Track.styles.d.ts +1 -0
- package/lib/Slider/Track/Track.styles.d.ts.map +1 -1
- package/lib/Switch/Switch.d.ts +7 -1
- package/lib/Switch/Switch.d.ts.map +1 -1
- package/lib/Switch/Switch.styles.d.ts +4 -2
- package/lib/Switch/Switch.styles.d.ts.map +1 -1
- package/lib/Tabs/Tabs.d.ts +1 -1
- package/lib/Tabs/Tabs.d.ts.map +1 -1
- package/lib/Tooltip/Tooltip.d.ts +2 -0
- package/lib/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/Tooltip/use-tooltip.d.ts +1 -0
- package/lib/Tooltip/use-tooltip.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useRef } from 'react';\nimport { isElement, ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { useMergedRef } from '@mantine/hooks';\nimport { getDefaultZIndex, useComponentDefaultProps } from '@mantine/styles';\nimport { TooltipGroup } from './TooltipGroup/TooltipGroup';\nimport { TooltipFloating } from './TooltipFloating/TooltipFloating';\nimport { useTooltip } from './use-tooltip';\nimport { FloatingArrow, getFloatingPosition, FloatingPosition } from '../Floating';\nimport { MantineTransition, Transition } from '../Transition';\nimport { OptionalPortal } from '../Portal';\nimport { Box } from '../Box';\nimport { TOOLTIP_ERRORS } from './Tooltip.errors';\nimport { TooltipBaseProps } from './Tooltip.types';\nimport useStyles from './Tooltip.styles';\n\nexport interface TooltipProps extends TooltipBaseProps {\n /** Called when tooltip position changes */\n onPositionChange?(position: FloatingPosition): void;\n\n /** Open delay in ms */\n openDelay?: number;\n\n /** Close delay in ms */\n closeDelay?: number;\n\n /** Controls opened state */\n opened?: boolean;\n\n /** Space between target element and tooltip in px */\n offset?: number;\n\n /** Determines whether component should have an arrow */\n withArrow?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Arrow offset in px */\n arrowOffset?: number;\n\n /** One of premade transitions ot transition object */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Determines which events will be used to show tooltip */\n events?: { hover: boolean; focus: boolean; touch: boolean };\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n}\n\nconst defaultProps: Partial<TooltipProps> = {\n position: 'top',\n refProp: 'ref',\n withinPortal: false,\n arrowSize: 4,\n arrowOffset: 5,\n offset: 5,\n transition: 'fade',\n transitionDuration: 100,\n width: 'auto',\n events: { hover: true, focus: false, touch: false },\n zIndex: getDefaultZIndex('popover'),\n positionDependencies: [],\n};\n\nconst _Tooltip = forwardRef<HTMLElement, TooltipProps>((props, ref) => {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n const {\n children,\n position,\n refProp,\n label,\n openDelay,\n closeDelay,\n onPositionChange,\n opened,\n withinPortal,\n radius,\n color,\n classNames,\n styles,\n unstyled,\n style,\n className,\n withArrow,\n arrowSize,\n arrowOffset,\n offset,\n transition,\n transitionDuration,\n multiline,\n width,\n events,\n zIndex,\n disabled,\n positionDependencies,\n onClick,\n onMouseEnter,\n onMouseLeave,\n ...others\n } = useComponentDefaultProps('Tooltip', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { radius, color, width, multiline },\n { name: 'Tooltip', classNames, styles, unstyled }\n );\n\n const tooltip = useTooltip({\n position: getFloatingPosition(theme.dir, position),\n closeDelay,\n openDelay,\n onPositionChange,\n opened,\n events,\n arrowRef,\n offset: offset + (withArrow ? arrowSize / 2 : 0),\n positionDependencies: [...positionDependencies, children],\n });\n\n if (!isElement(children)) {\n throw new Error(TOOLTIP_ERRORS.children);\n }\n\n const targetRef = useMergedRef(tooltip.reference, (children as any).ref, ref);\n\n return (\n <>\n <OptionalPortal withinPortal={withinPortal}>\n <Transition\n mounted={!disabled && tooltip.opened}\n transition={transition}\n duration={tooltip.isGroupPhase ? 10 : transitionDuration}\n >\n {(transitionStyles) => (\n <Box\n {...others}\n {...tooltip.getFloatingProps({\n ref: tooltip.floating,\n className: classes.tooltip,\n style: {\n ...style,\n ...transitionStyles,\n zIndex,\n top: tooltip.y ?? '',\n left: tooltip.x ?? '',\n },\n })}\n >\n {label}\n\n <FloatingArrow\n ref={arrowRef}\n arrowX={tooltip.arrowX}\n arrowY={tooltip.arrowY}\n visible={withArrow}\n withBorder={false}\n position={tooltip.placement}\n arrowSize={arrowSize}\n arrowOffset={arrowOffset}\n className={classes.arrow}\n />\n </Box>\n )}\n </Transition>\n </OptionalPortal>\n\n {cloneElement(\n children,\n tooltip.getReferenceProps({\n onClick,\n onMouseEnter,\n onMouseLeave,\n [refProp]: targetRef,\n className: cx(className, children.props.className),\n ...children.props,\n })\n )}\n </>\n );\n}) as any;\n\n_Tooltip.Group = TooltipGroup;\n_Tooltip.Floating = TooltipFloating;\n\n_Tooltip.displayName = '@mantine/core/Tooltip';\n\nexport const Tooltip: ForwardRefWithStaticComponents<\n TooltipProps,\n { Group: typeof TooltipGroup; Floating: typeof TooltipFloating }\n> = _Tooltip;\n"],"names":["getDefaultZIndex","forwardRef","useRef","useComponentDefaultProps","styles","useStyles","useTooltip","getFloatingPosition","isElement","TOOLTIP_ERRORS","useMergedRef","React","OptionalPortal","Transition","Box","FloatingArrow","cloneElement","TooltipGroup","TooltipFloating"],"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,oBAAo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AAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC;AACH,QAAQ,CAAC,KAAK,GAAGC,yBAAY,CAAC;AAC9B,QAAQ,CAAC,QAAQ,GAAGC,+BAAe,CAAC;AACpC,QAAQ,CAAC,WAAW,GAAG,uBAAuB,CAAC;AACnC,MAAC,OAAO,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useRef } from 'react';\nimport { isElement, ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { useMergedRef } from '@mantine/hooks';\nimport { getDefaultZIndex, useComponentDefaultProps } from '@mantine/styles';\nimport { TooltipGroup } from './TooltipGroup/TooltipGroup';\nimport { TooltipFloating } from './TooltipFloating/TooltipFloating';\nimport { useTooltip } from './use-tooltip';\nimport { FloatingArrow, getFloatingPosition, FloatingPosition } from '../Floating';\nimport { MantineTransition, Transition } from '../Transition';\nimport { OptionalPortal } from '../Portal';\nimport { Box } from '../Box';\nimport { TOOLTIP_ERRORS } from './Tooltip.errors';\nimport { TooltipBaseProps } from './Tooltip.types';\nimport useStyles from './Tooltip.styles';\n\nexport interface TooltipProps extends TooltipBaseProps {\n /** Called when tooltip position changes */\n onPositionChange?(position: FloatingPosition): void;\n\n /** Open delay in ms */\n openDelay?: number;\n\n /** Close delay in ms */\n closeDelay?: number;\n\n /** Controls opened state */\n opened?: boolean;\n\n /** Space between target element and tooltip in px */\n offset?: number;\n\n /** Determines whether component should have an arrow */\n withArrow?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Arrow offset in px */\n arrowOffset?: number;\n\n /** One of premade transitions ot transition object */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Determines which events will be used to show tooltip */\n events?: { hover: boolean; focus: boolean; touch: boolean };\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Set if tooltip is attached to an inline element */\n inline?: boolean;\n}\n\nconst defaultProps: Partial<TooltipProps> = {\n position: 'top',\n refProp: 'ref',\n withinPortal: false,\n inline: false,\n arrowSize: 4,\n arrowOffset: 5,\n offset: 5,\n transition: 'fade',\n transitionDuration: 100,\n width: 'auto',\n events: { hover: true, focus: false, touch: false },\n zIndex: getDefaultZIndex('popover'),\n positionDependencies: [],\n};\n\nconst _Tooltip = forwardRef<HTMLElement, TooltipProps>((props, ref) => {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n const {\n children,\n position,\n refProp,\n label,\n openDelay,\n closeDelay,\n onPositionChange,\n opened,\n withinPortal,\n radius,\n color,\n classNames,\n styles,\n unstyled,\n style,\n className,\n withArrow,\n arrowSize,\n arrowOffset,\n offset,\n transition,\n transitionDuration,\n multiline,\n width,\n events,\n zIndex,\n disabled,\n positionDependencies,\n onClick,\n onMouseEnter,\n onMouseLeave,\n inline,\n ...others\n } = useComponentDefaultProps('Tooltip', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { radius, color, width, multiline },\n { name: 'Tooltip', classNames, styles, unstyled }\n );\n\n const tooltip = useTooltip({\n position: getFloatingPosition(theme.dir, position),\n closeDelay,\n openDelay,\n onPositionChange,\n opened,\n events,\n arrowRef,\n offset: offset + (withArrow ? arrowSize / 2 : 0),\n positionDependencies: [...positionDependencies, children],\n inline,\n });\n\n if (!isElement(children)) {\n throw new Error(TOOLTIP_ERRORS.children);\n }\n\n const targetRef = useMergedRef(tooltip.reference, (children as any).ref, ref);\n\n return (\n <>\n <OptionalPortal withinPortal={withinPortal}>\n <Transition\n mounted={!disabled && tooltip.opened}\n transition={transition}\n duration={tooltip.isGroupPhase ? 10 : transitionDuration}\n >\n {(transitionStyles) => (\n <Box\n {...others}\n {...tooltip.getFloatingProps({\n ref: tooltip.floating,\n className: classes.tooltip,\n style: {\n ...style,\n ...transitionStyles,\n zIndex,\n top: tooltip.y ?? '',\n left: tooltip.x ?? '',\n },\n })}\n >\n {label}\n\n <FloatingArrow\n ref={arrowRef}\n arrowX={tooltip.arrowX}\n arrowY={tooltip.arrowY}\n visible={withArrow}\n withBorder={false}\n position={tooltip.placement}\n arrowSize={arrowSize}\n arrowOffset={arrowOffset}\n className={classes.arrow}\n />\n </Box>\n )}\n </Transition>\n </OptionalPortal>\n\n {cloneElement(\n children,\n tooltip.getReferenceProps({\n onClick,\n onMouseEnter,\n onMouseLeave,\n [refProp]: targetRef,\n className: cx(className, children.props.className),\n ...children.props,\n })\n )}\n </>\n );\n}) as any;\n\n_Tooltip.Group = TooltipGroup;\n_Tooltip.Floating = TooltipFloating;\n\n_Tooltip.displayName = '@mantine/core/Tooltip';\n\nexport const Tooltip: ForwardRefWithStaticComponents<\n TooltipProps,\n { Group: typeof TooltipGroup; Floating: typeof TooltipFloating }\n> = _Tooltip;\n"],"names":["getDefaultZIndex","forwardRef","useRef","useComponentDefaultProps","styles","useStyles","useTooltip","getFloatingPosition","isElement","TOOLTIP_ERRORS","useMergedRef","React","OptionalPortal","Transition","Box","FloatingArrow","cloneElement","TooltipGroup","TooltipFloating"],"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,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,GAAGC,yBAAY,CAAC;AAC9B,QAAQ,CAAC,QAAQ,GAAGC,+BAAe,CAAC;AACpC,QAAQ,CAAC,WAAW,GAAG,uBAAuB,CAAC;AACnC,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -39,9 +39,8 @@ function useTooltip(settings) {
|
|
|
39
39
|
reactDomInteractions.offset(settings.offset),
|
|
40
40
|
reactDomInteractions.shift({ padding: 8 }),
|
|
41
41
|
reactDomInteractions.flip(),
|
|
42
|
-
reactDomInteractions.arrow({
|
|
43
|
-
|
|
44
|
-
})
|
|
42
|
+
reactDomInteractions.arrow({ element: settings.arrowRef }),
|
|
43
|
+
...settings.inline ? [reactDomInteractions.inline()] : []
|
|
45
44
|
]
|
|
46
45
|
});
|
|
47
46
|
const { getReferenceProps, getFloatingProps } = reactDomInteractions.useInteractions([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tooltip.js","sources":["../../src/Tooltip/use-tooltip.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport {\n useFloating,\n flip,\n arrow,\n offset,\n shift,\n useInteractions,\n useHover,\n useFocus,\n useRole,\n useDismiss,\n useDelayGroupContext,\n useDelayGroup,\n} from '@floating-ui/react-dom-interactions';\nimport { useId, useDidUpdate } from '@mantine/hooks';\nimport { useTooltipGroupContext } from './TooltipGroup/TooltipGroup.context';\nimport { FloatingPosition, useFloatingAutoUpdate } from '../Floating';\n\ninterface UseTooltip {\n position: FloatingPosition;\n closeDelay: number;\n openDelay: number;\n onPositionChange?(position: FloatingPosition): void;\n opened?: boolean;\n offset: number;\n arrowRef?: React.RefObject<HTMLDivElement>;\n events: { hover: boolean; focus: boolean; touch: boolean };\n positionDependencies: any[];\n}\n\nexport function useTooltip(settings: UseTooltip) {\n const [uncontrolledOpened, setUncontrolledOpened] = useState(false);\n const controlled = typeof settings.opened === 'boolean';\n const opened = controlled ? settings.opened : uncontrolledOpened;\n const withinGroup = useTooltipGroupContext();\n const uid = useId();\n\n const { delay: groupDelay, currentId, setCurrentId } = useDelayGroupContext();\n\n const onChange = useCallback(\n (_opened: boolean) => {\n setUncontrolledOpened(_opened);\n\n if (_opened) {\n setCurrentId(uid);\n }\n },\n [setCurrentId, uid]\n );\n\n const {\n x,\n y,\n reference,\n floating,\n context,\n refs,\n update,\n placement,\n middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },\n } = useFloating({\n placement: settings.position,\n open: opened,\n onOpenChange: onChange,\n middleware: [\n offset(settings.offset),\n shift({ padding: 8 }),\n flip(),\n arrow({
|
|
1
|
+
{"version":3,"file":"use-tooltip.js","sources":["../../src/Tooltip/use-tooltip.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport {\n useFloating,\n flip,\n arrow,\n offset,\n shift,\n useInteractions,\n useHover,\n useFocus,\n useRole,\n useDismiss,\n useDelayGroupContext,\n useDelayGroup,\n inline,\n} from '@floating-ui/react-dom-interactions';\nimport { useId, useDidUpdate } from '@mantine/hooks';\nimport { useTooltipGroupContext } from './TooltipGroup/TooltipGroup.context';\nimport { FloatingPosition, useFloatingAutoUpdate } from '../Floating';\n\ninterface UseTooltip {\n position: FloatingPosition;\n closeDelay: number;\n openDelay: number;\n onPositionChange?(position: FloatingPosition): void;\n opened?: boolean;\n offset: number;\n arrowRef?: React.RefObject<HTMLDivElement>;\n events: { hover: boolean; focus: boolean; touch: boolean };\n positionDependencies: any[];\n inline: boolean;\n}\n\nexport function useTooltip(settings: UseTooltip) {\n const [uncontrolledOpened, setUncontrolledOpened] = useState(false);\n const controlled = typeof settings.opened === 'boolean';\n const opened = controlled ? settings.opened : uncontrolledOpened;\n const withinGroup = useTooltipGroupContext();\n const uid = useId();\n\n const { delay: groupDelay, currentId, setCurrentId } = useDelayGroupContext();\n\n const onChange = useCallback(\n (_opened: boolean) => {\n setUncontrolledOpened(_opened);\n\n if (_opened) {\n setCurrentId(uid);\n }\n },\n [setCurrentId, uid]\n );\n\n const {\n x,\n y,\n reference,\n floating,\n context,\n refs,\n update,\n placement,\n middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },\n } = useFloating({\n placement: settings.position,\n open: opened,\n onOpenChange: onChange,\n middleware: [\n offset(settings.offset),\n shift({ padding: 8 }),\n flip(),\n arrow({ element: settings.arrowRef }),\n ...(settings.inline ? [inline()] : []),\n ],\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(context, {\n enabled: settings.events.hover,\n delay: withinGroup ? groupDelay : { open: settings.openDelay, close: settings.closeDelay },\n mouseOnly: !settings.events.touch,\n }),\n useFocus(context, { enabled: settings.events.focus, keyboardOnly: true }),\n useRole(context, { role: 'tooltip' }),\n // cannot be used with controlled tooltip, page jumps\n useDismiss(context, { enabled: typeof settings.opened === undefined }),\n useDelayGroup(context, { id: uid }),\n ]);\n\n useFloatingAutoUpdate({\n opened,\n positionDependencies: settings.positionDependencies,\n floating: { refs, update },\n });\n\n useDidUpdate(() => {\n settings.onPositionChange?.(placement);\n }, [placement]);\n\n const isGroupPhase = opened && currentId && currentId !== uid;\n\n return {\n x,\n y,\n arrowX,\n arrowY,\n reference,\n floating,\n getFloatingProps,\n getReferenceProps,\n isGroupPhase,\n opened,\n placement,\n };\n}\n"],"names":["useState","useTooltipGroupContext","useId","useDelayGroupContext","useCallback","useFloating","offset","shift","flip","arrow","inline","useInteractions","useHover","useFocus","useRole","useDismiss","useDelayGroup","useFloatingAutoUpdate","useDidUpdate"],"mappings":";;;;;;;;;;AAmBO,SAAS,UAAU,CAAC,QAAQ,EAAE;AACrC,EAAE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;AACtE,EAAE,MAAM,UAAU,GAAG,OAAO,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1D,EAAE,MAAM,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,GAAG,kBAAkB,CAAC;AACnE,EAAE,MAAM,WAAW,GAAGC,2CAAsB,EAAE,CAAC;AAC/C,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AE,OAAO;AACT,IAAI,CAAC;AACL,IAAI,CAAC;AACL,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,gBAAgB;AACpB,IAAI,iBAAiB;AACrB,IAAI,YAAY;AAChB,IAAI,MAAM;AACV,IAAI,SAAS;AACb,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -74,7 +74,7 @@ const _ActionIcon = forwardRef((props, ref) => {
|
|
|
74
74
|
return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadValues({
|
|
75
75
|
className: cx(classes.root, className),
|
|
76
76
|
ref,
|
|
77
|
-
disabled
|
|
77
|
+
disabled,
|
|
78
78
|
"data-disabled": disabled || void 0,
|
|
79
79
|
"data-loading": loading || void 0,
|
|
80
80
|
unstyled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionIcon.js","sources":["../../src/ActionIcon/ActionIcon.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineColor,\n Selectors,\n useComponentDefaultProps,\n MantineGradient,\n} from '@mantine/styles';\nimport { createPolymorphicComponent } from '@mantine/utils';\nimport { UnstyledButton } from '../UnstyledButton';\nimport useStyles, { sizes, ActionIconVariant, ActionIconStylesParams } from './ActionIcon.styles';\nimport { Loader, LoaderProps } from '../Loader';\n\nexport type ActionIconStylesNames = Selectors<typeof useStyles>;\n\nexport interface ActionIconProps\n extends DefaultProps<ActionIconStylesNames, ActionIconStylesParams> {\n /** Icon */\n children?: React.ReactNode;\n\n /** Controls appearance */\n variant?: ActionIconVariant;\n\n /** Key of theme.colors */\n color?: MantineColor;\n\n /** Controls gradient settings in gradient variant only */\n gradient?: MantineGradient;\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 /** Indicates loading state */\n loading?: boolean;\n\n /** Indicates disabled state */\n disabled?: boolean;\n}\n\nconst defaultProps: Partial<ActionIconProps> = {\n color: 'gray',\n size: 'md',\n variant: 'subtle',\n loading: false,\n};\n\nexport const _ActionIcon = forwardRef<HTMLButtonElement, ActionIconProps>((props, ref) => {\n const {\n className,\n color,\n children,\n radius,\n size,\n variant,\n gradient,\n disabled,\n loaderProps,\n loading,\n unstyled,\n ...others\n } = useComponentDefaultProps('ActionIcon', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { size, radius, color, variant, gradient },\n { name: 'ActionIcon', unstyled }\n );\n\n const colors = theme.fn.variant({ color, variant });\n\n const loader = (\n <Loader color={colors.color} size={theme.fn.size({ size, sizes }) - 12} {...loaderProps} />\n );\n\n return (\n <UnstyledButton\n className={cx(classes.root, className)}\n ref={ref}\n disabled={disabled
|
|
1
|
+
{"version":3,"file":"ActionIcon.js","sources":["../../src/ActionIcon/ActionIcon.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineColor,\n Selectors,\n useComponentDefaultProps,\n MantineGradient,\n} from '@mantine/styles';\nimport { createPolymorphicComponent } from '@mantine/utils';\nimport { UnstyledButton } from '../UnstyledButton';\nimport useStyles, { sizes, ActionIconVariant, ActionIconStylesParams } from './ActionIcon.styles';\nimport { Loader, LoaderProps } from '../Loader';\n\nexport type ActionIconStylesNames = Selectors<typeof useStyles>;\n\nexport interface ActionIconProps\n extends DefaultProps<ActionIconStylesNames, ActionIconStylesParams> {\n /** Icon */\n children?: React.ReactNode;\n\n /** Controls appearance */\n variant?: ActionIconVariant;\n\n /** Key of theme.colors */\n color?: MantineColor;\n\n /** Controls gradient settings in gradient variant only */\n gradient?: MantineGradient;\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 /** Indicates loading state */\n loading?: boolean;\n\n /** Indicates disabled state */\n disabled?: boolean;\n}\n\nconst defaultProps: Partial<ActionIconProps> = {\n color: 'gray',\n size: 'md',\n variant: 'subtle',\n loading: false,\n};\n\nexport const _ActionIcon = forwardRef<HTMLButtonElement, ActionIconProps>((props, ref) => {\n const {\n className,\n color,\n children,\n radius,\n size,\n variant,\n gradient,\n disabled,\n loaderProps,\n loading,\n unstyled,\n ...others\n } = useComponentDefaultProps('ActionIcon', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { size, radius, color, variant, gradient },\n { name: 'ActionIcon', unstyled }\n );\n\n const colors = theme.fn.variant({ color, variant });\n\n const loader = (\n <Loader color={colors.color} size={theme.fn.size({ size, sizes }) - 12} {...loaderProps} />\n );\n\n return (\n <UnstyledButton\n className={cx(classes.root, className)}\n ref={ref}\n disabled={disabled}\n data-disabled={disabled || undefined}\n data-loading={loading || undefined}\n unstyled={unstyled}\n {...others}\n >\n {loading ? loader : children}\n </UnstyledButton>\n );\n});\n\n_ActionIcon.displayName = '@mantine/core/ActionIcon';\n\nexport const ActionIcon = createPolymorphicComponent<'button', ActionIconProps>(_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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,CAAC;AAC5E,IAAI,KAAK,EAAE,MAAM,CAAC,KAAK;AACvB,IAAI,IAAI,EAAE,KAAK,CAAC,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,cAAc,EAAE,cAAc,CAAC;AAC5E,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,IAAI,GAAG;AACP,IAAI,QAAQ;AACZ,IAAI,eAAe,EAAE,QAAQ,IAAI,KAAK,CAAC;AACvC,IAAI,cAAc,EAAE,OAAO,IAAI,KAAK,CAAC;AACrC,IAAI,QAAQ;AACZ,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;AAC3C,CAAC,EAAE;AACH,WAAW,CAAC,WAAW,GAAG,0BAA0B,CAAC;AACzC,MAAC,UAAU,GAAG,0BAA0B,CAAC,WAAW;;;;"}
|
|
@@ -29,10 +29,10 @@ function getPositionStyles(props, theme) {
|
|
|
29
29
|
paddingBottom: `calc(var(--mantine-footer-height, 0px) + ${padding}px)`,
|
|
30
30
|
paddingLeft: `calc(var(--mantine-navbar-width, 0px) + ${padding}px)`,
|
|
31
31
|
paddingRight: `calc(var(--mantine-aside-width, 0px) + ${padding}px)`,
|
|
32
|
-
[`@media (max-width: ${navbarOffset}px)`]: {
|
|
32
|
+
[`@media (max-width: ${navbarOffset - 1}px)`]: {
|
|
33
33
|
paddingLeft: padding
|
|
34
34
|
},
|
|
35
|
-
[`@media (max-width: ${asideOffset}px)`]: {
|
|
35
|
+
[`@media (max-width: ${asideOffset - 1}px)`]: {
|
|
36
36
|
paddingRight: padding
|
|
37
37
|
}
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.styles.js","sources":["../../src/AppShell/AppShell.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineTheme, CSSObject } from '@mantine/styles';\n\nexport interface AppShellStylesParams {\n padding: MantineNumberSize;\n fixed: boolean;\n navbarOffsetBreakpoint: MantineNumberSize;\n asideOffsetBreakpoint: MantineNumberSize;\n}\n\nfunction getPositionStyles(props: AppShellStylesParams, theme: MantineTheme): CSSObject {\n const padding = theme.fn.size({ size: props.padding, sizes: theme.spacing });\n\n const navbarOffset = props.navbarOffsetBreakpoint\n ? theme.fn.size({ size: props.navbarOffsetBreakpoint, sizes: theme.breakpoints })\n : null;\n\n const asideOffset = props.asideOffsetBreakpoint\n ? theme.fn.size({ size: props.asideOffsetBreakpoint, sizes: theme.breakpoints })\n : null;\n\n if (!props.fixed) {\n return { padding };\n }\n\n return {\n minHeight: '100vh',\n paddingTop: `calc(var(--mantine-header-height, 0px) + ${padding}px)`,\n paddingBottom: `calc(var(--mantine-footer-height, 0px) + ${padding}px)`,\n paddingLeft: `calc(var(--mantine-navbar-width, 0px) + ${padding}px)`,\n paddingRight: `calc(var(--mantine-aside-width, 0px) + ${padding}px)`,\n\n [`@media (max-width: ${navbarOffset}px)`]: {\n paddingLeft: padding,\n },\n\n [`@media (max-width: ${asideOffset}px)`]: {\n paddingRight: padding,\n },\n };\n}\n\nexport default createStyles((theme, props: AppShellStylesParams) => ({\n root: {\n boxSizing: 'border-box',\n },\n\n body: {\n display: 'flex',\n boxSizing: 'border-box',\n },\n\n main: {\n flex: 1,\n width: '100vw',\n boxSizing: 'border-box',\n ...getPositionStyles(props, theme),\n },\n}));\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,CA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AW,EAAE,CAAC,GAAG,IAAI,CAAC;AAC7I,EAAE,MAAM,WAAW,GAAG,KAAK,CAAC,qBAAqB,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,qBAAqB,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC;AAC1I,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;AACpB,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;AACvB,GAAG;AACH,EAAE,OAAO;AACT,IAAI,SAAS,EAAE,OAAO;AACtB,IAAI,UAAU,EAAE,CAAC,yCAAyC,EAAE,OAAO,CAAC,GAAG,CAAC;AACxE,IAAI,aAAa,EAAE,CAAC,yCAAyC,EAAE,OAAO,CAAC,GAAG,CAAC;AAC3E,IAAI,WAAW,EAAE,CAAC,wCAAwC,EAAE,OAAO,CAAC,GAAG,CAAC;AACxE,IAAI,YAAY,EAAE,CAAC,uCAAuC,EAAE,OAAO,CAAC,GAAG,CAAC;AACxE,IAAI,CAAC,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"AppShell.styles.js","sources":["../../src/AppShell/AppShell.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineTheme, CSSObject } from '@mantine/styles';\n\nexport interface AppShellStylesParams {\n padding: MantineNumberSize;\n fixed: boolean;\n navbarOffsetBreakpoint: MantineNumberSize;\n asideOffsetBreakpoint: MantineNumberSize;\n}\n\nfunction getPositionStyles(props: AppShellStylesParams, theme: MantineTheme): CSSObject {\n const padding = theme.fn.size({ size: props.padding, sizes: theme.spacing });\n\n const navbarOffset = props.navbarOffsetBreakpoint\n ? theme.fn.size({ size: props.navbarOffsetBreakpoint, sizes: theme.breakpoints })\n : null;\n\n const asideOffset = props.asideOffsetBreakpoint\n ? theme.fn.size({ size: props.asideOffsetBreakpoint, sizes: theme.breakpoints })\n : null;\n\n if (!props.fixed) {\n return { padding };\n }\n\n return {\n minHeight: '100vh',\n paddingTop: `calc(var(--mantine-header-height, 0px) + ${padding}px)`,\n paddingBottom: `calc(var(--mantine-footer-height, 0px) + ${padding}px)`,\n paddingLeft: `calc(var(--mantine-navbar-width, 0px) + ${padding}px)`,\n paddingRight: `calc(var(--mantine-aside-width, 0px) + ${padding}px)`,\n\n [`@media (max-width: ${navbarOffset - 1}px)`]: {\n paddingLeft: padding,\n },\n\n [`@media (max-width: ${asideOffset - 1}px)`]: {\n paddingRight: padding,\n },\n };\n}\n\nexport default createStyles((theme, props: AppShellStylesParams) => ({\n root: {\n boxSizing: 'border-box',\n },\n\n body: {\n display: 'flex',\n boxSizing: 'border-box',\n },\n\n main: {\n flex: 1,\n width: '100vw',\n boxSizing: 'border-box',\n ...getPositionStyles(props, theme),\n },\n}));\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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aAAa,EAAE,CAAC,yCAAyC,EAAE,OAAO,CAAC,GAAG,CAAC;AAC3E,IAAI,WAAW,EAAE,CAAC,wCAAwC,EAAE,OAAO,CAAC,GAAG,CAAC;AACxE,IAAI,YAAY,EAAE,CAAC,uCAAuC,EAAE,OAAO,CAAC,GAAG,CAAC;AACxE,IAAI,CAAC,CAAC,mBAAmB,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG;AACnD,MAAM,WAAW,EAAE,OAAO;AAC1B,KAAK;AACL,IAAI,CAAC,CAAC,mBAAmB,EAAE,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG;AAClD,MAAM,YAAY,EAAE,OAAO;AAC3B,KAAK;AACL,GAAG,CAAC;AACJ,CAAC;AACD,gBAAe,YAAY,CAAC,CAAC,KAAK,EAAE,KAAK,MAAM;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,SAAS,EAAE,YAAY;AAC3B,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,SAAS,EAAE,YAAY;AAC3B,GAAG;AACH,EAAE,IAAI,EAAE,cAAc,CAAC;AACvB,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,SAAS,EAAE,YAAY;AAC3B,GAAG,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;;;;"}
|
|
@@ -79,7 +79,7 @@ const HorizontalSection = forwardRef((_a, ref) => {
|
|
|
79
79
|
withBorder
|
|
80
80
|
}, { classNames, styles, name: __staticSelector, unstyled });
|
|
81
81
|
const breakpoints = getSortedBreakpoints(width, theme).reduce((acc, [breakpoint, breakpointSize]) => {
|
|
82
|
-
acc[`@media (min-width: ${breakpoint
|
|
82
|
+
acc[`@media (min-width: ${breakpoint}px)`] = {
|
|
83
83
|
[`--mantine-${section}-width`]: `${breakpointSize}px`
|
|
84
84
|
};
|
|
85
85
|
return acc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalSection.js","sources":["../../../src/AppShell/HorizontalSection/HorizontalSection.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, MantineNumberSize, getDefaultZIndex, Global } from '@mantine/styles';\nimport { Box } from '../../Box';\nimport { useAppShellContext } from '../AppShell.context';\nimport { getSortedBreakpoints } from './get-sorted-breakpoints/get-sorted-breakpoints';\nimport useStyles, {\n HorizontalSectionPosition,\n HorizontalSectionWidth,\n} from './HorizontalSection.styles';\n\nexport interface HorizontalSectionSharedProps extends DefaultProps {\n /** Component width with breakpoints */\n width?: HorizontalSectionWidth;\n\n /** Component height */\n height?: string | number;\n\n /** HorizontalSection content */\n children: React.ReactNode;\n\n /** Border */\n withBorder?: boolean;\n\n /** Set position to fixed */\n fixed?: boolean;\n\n /** Position for fixed variant */\n position?: HorizontalSectionPosition;\n\n /** Breakpoint at which component will be hidden if hidden prop is true */\n hiddenBreakpoint?: MantineNumberSize;\n\n /** Set to true to hide component at hiddenBreakpoint */\n hidden?: boolean;\n\n /** z-index */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport interface HorizontalSectionProps\n extends HorizontalSectionSharedProps,\n Omit<React.ComponentPropsWithRef<'nav'>, 'children'> {\n section: 'navbar' | 'aside';\n __staticSelector: string;\n}\n\nexport const HorizontalSection = forwardRef<HTMLElement, HorizontalSectionProps>(\n (\n {\n width,\n height,\n fixed = false,\n position,\n zIndex = getDefaultZIndex('app'),\n hiddenBreakpoint = 'md',\n hidden = false,\n withBorder = true,\n className,\n classNames,\n styles,\n children,\n section,\n __staticSelector,\n unstyled,\n ...others\n }: HorizontalSectionProps,\n ref\n ) => {\n const ctx = useAppShellContext();\n\n const { classes, cx, theme } = useStyles(\n {\n width,\n height,\n fixed: ctx.fixed || fixed,\n position,\n hiddenBreakpoint,\n zIndex: ctx.zIndex || zIndex,\n section,\n withBorder,\n },\n { classNames, styles, name: __staticSelector, unstyled }\n );\n\n const breakpoints = getSortedBreakpoints(width, theme).reduce(\n (acc, [breakpoint, breakpointSize]) => {\n acc[`@media (min-width: ${breakpoint
|
|
1
|
+
{"version":3,"file":"HorizontalSection.js","sources":["../../../src/AppShell/HorizontalSection/HorizontalSection.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, MantineNumberSize, getDefaultZIndex, Global } from '@mantine/styles';\nimport { Box } from '../../Box';\nimport { useAppShellContext } from '../AppShell.context';\nimport { getSortedBreakpoints } from './get-sorted-breakpoints/get-sorted-breakpoints';\nimport useStyles, {\n HorizontalSectionPosition,\n HorizontalSectionWidth,\n} from './HorizontalSection.styles';\n\nexport interface HorizontalSectionSharedProps extends DefaultProps {\n /** Component width with breakpoints */\n width?: HorizontalSectionWidth;\n\n /** Component height */\n height?: string | number;\n\n /** HorizontalSection content */\n children: React.ReactNode;\n\n /** Border */\n withBorder?: boolean;\n\n /** Set position to fixed */\n fixed?: boolean;\n\n /** Position for fixed variant */\n position?: HorizontalSectionPosition;\n\n /** Breakpoint at which component will be hidden if hidden prop is true */\n hiddenBreakpoint?: MantineNumberSize;\n\n /** Set to true to hide component at hiddenBreakpoint */\n hidden?: boolean;\n\n /** z-index */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport interface HorizontalSectionProps\n extends HorizontalSectionSharedProps,\n Omit<React.ComponentPropsWithRef<'nav'>, 'children'> {\n section: 'navbar' | 'aside';\n __staticSelector: string;\n}\n\nexport const HorizontalSection = forwardRef<HTMLElement, HorizontalSectionProps>(\n (\n {\n width,\n height,\n fixed = false,\n position,\n zIndex = getDefaultZIndex('app'),\n hiddenBreakpoint = 'md',\n hidden = false,\n withBorder = true,\n className,\n classNames,\n styles,\n children,\n section,\n __staticSelector,\n unstyled,\n ...others\n }: HorizontalSectionProps,\n ref\n ) => {\n const ctx = useAppShellContext();\n\n const { classes, cx, theme } = useStyles(\n {\n width,\n height,\n fixed: ctx.fixed || fixed,\n position,\n hiddenBreakpoint,\n zIndex: ctx.zIndex || zIndex,\n section,\n withBorder,\n },\n { classNames, styles, name: __staticSelector, unstyled }\n );\n\n const breakpoints = getSortedBreakpoints(width, theme).reduce(\n (acc, [breakpoint, breakpointSize]) => {\n acc[`@media (min-width: ${breakpoint}px)`] = {\n [`--mantine-${section}-width`]: `${breakpointSize}px`,\n };\n\n return acc;\n },\n {}\n );\n\n return (\n <Box\n component={section === 'navbar' ? 'nav' : 'aside'}\n ref={ref}\n data-hidden={hidden || undefined}\n className={cx(classes.root, className)}\n {...others}\n >\n {children}\n\n <Global\n styles={() => ({\n ':root': {\n [`--mantine-${section}-width`]: width?.base ? `${width.base}px` : '0px',\n ...breakpoints,\n },\n })}\n />\n </Box>\n );\n }\n);\n\nHorizontalSection.displayName = '@mantine/core/HorizontalSection';\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,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UAAU,EAAE,cAAc,CAAC,KAAK;AACvG,IAAI,GAAG,CAAC,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG;AACjD,MAAM,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC;AAC3D,KAAK,CAAC;AACN,IAAI,OAAO,GAAG,CAAC;AACf,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,cAAc,CAAC;AACjE,IAAI,SAAS,EAAE,OAAO,KAAK,QAAQ,GAAG,KAAK,GAAG,OAAO;AACrD,IAAI,GAAG;AACP,IAAI,aAAa,EAAE,MAAM,IAAI,KAAK,CAAC;AACnC,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,GAAG,EAAE,MAAM,CAAC,EAAE,QAAQ,kBAAkB,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE;AACpE,IAAI,MAAM,EAAE,OAAO;AACnB,MAAM,OAAO,EAAE,cAAc,CAAC;AAC9B,QAAQ,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK;AACzG,OAAO,EAAE,WAAW,CAAC;AACrB,KAAK,CAAC;AACN,GAAG,CAAC,CAAC,CAAC;AACN,CAAC,EAAE;AACH,iBAAiB,CAAC,WAAW,GAAG,iCAAiC;;;;"}
|
|
@@ -31,7 +31,7 @@ var useStyles = createStyles((theme, {
|
|
|
31
31
|
withBorder
|
|
32
32
|
}) => {
|
|
33
33
|
const breakpoints = typeof width === "object" && width !== null ? getSortedBreakpoints(width, theme).reduce((acc, [breakpoint, breakpointSize]) => {
|
|
34
|
-
acc[`@media (min-width: ${breakpoint
|
|
34
|
+
acc[`@media (min-width: ${breakpoint}px)`] = {
|
|
35
35
|
width: breakpointSize,
|
|
36
36
|
minWidth: breakpointSize
|
|
37
37
|
};
|
|
@@ -57,7 +57,7 @@ var useStyles = createStyles((theme, {
|
|
|
57
57
|
[`@media (max-width: ${theme.fn.size({
|
|
58
58
|
size: hiddenBreakpoint,
|
|
59
59
|
sizes: theme.breakpoints
|
|
60
|
-
})}px)`]: {
|
|
60
|
+
}) - 1}px)`]: {
|
|
61
61
|
display: "none"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalSection.styles.js","sources":["../../../src/AppShell/HorizontalSection/HorizontalSection.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize } from '@mantine/styles';\nimport { getSortedBreakpoints } from './get-sorted-breakpoints/get-sorted-breakpoints';\n\nexport type HorizontalSectionWidth = Partial<Record<string, string | number>>;\n\nexport interface HorizontalSectionPosition {\n top?: number;\n left?: number;\n bottom?: number;\n right?: number;\n}\n\ninterface HorizontalSectionStyles {\n width: Partial<Record<string, string | number>>;\n height: string | number;\n position: HorizontalSectionPosition;\n hiddenBreakpoint: MantineNumberSize;\n fixed: boolean;\n zIndex: React.CSSProperties['zIndex'];\n section: 'navbar' | 'aside';\n withBorder: boolean;\n}\n\nexport default createStyles(\n (\n theme,\n {\n height,\n width,\n fixed,\n position,\n hiddenBreakpoint,\n zIndex,\n section,\n withBorder,\n }: HorizontalSectionStyles\n ) => {\n const breakpoints =\n typeof width === 'object' && width !== null\n ? getSortedBreakpoints(width, theme).reduce((acc, [breakpoint, breakpointSize]) => {\n acc[`@media (min-width: ${breakpoint
|
|
1
|
+
{"version":3,"file":"HorizontalSection.styles.js","sources":["../../../src/AppShell/HorizontalSection/HorizontalSection.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize } from '@mantine/styles';\nimport { getSortedBreakpoints } from './get-sorted-breakpoints/get-sorted-breakpoints';\n\nexport type HorizontalSectionWidth = Partial<Record<string, string | number>>;\n\nexport interface HorizontalSectionPosition {\n top?: number;\n left?: number;\n bottom?: number;\n right?: number;\n}\n\ninterface HorizontalSectionStyles {\n width: Partial<Record<string, string | number>>;\n height: string | number;\n position: HorizontalSectionPosition;\n hiddenBreakpoint: MantineNumberSize;\n fixed: boolean;\n zIndex: React.CSSProperties['zIndex'];\n section: 'navbar' | 'aside';\n withBorder: boolean;\n}\n\nexport default createStyles(\n (\n theme,\n {\n height,\n width,\n fixed,\n position,\n hiddenBreakpoint,\n zIndex,\n section,\n withBorder,\n }: HorizontalSectionStyles\n ) => {\n const breakpoints =\n typeof width === 'object' && width !== null\n ? getSortedBreakpoints(width, theme).reduce((acc, [breakpoint, breakpointSize]) => {\n acc[`@media (min-width: ${breakpoint}px)`] = {\n width: breakpointSize,\n minWidth: breakpointSize,\n };\n\n return acc;\n }, {})\n : null;\n\n const borderStyles = withBorder\n ? {\n [section === 'navbar' ? 'borderRight' : 'borderLeft']: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[2]\n }`,\n }\n : {};\n\n return {\n root: {\n ...theme.fn.fontStyles(),\n ...position,\n top: position?.top || 'var(--mantine-header-height)',\n bottom: 0,\n zIndex,\n height:\n height ||\n 'calc(100vh - var(--mantine-header-height, 0px) - var(--mantine-footer-height, 0px))',\n width: width?.base || '100%',\n position: fixed ? 'fixed' : 'static',\n boxSizing: 'border-box',\n display: 'flex',\n flexDirection: 'column',\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.white,\n ...borderStyles,\n ...breakpoints,\n\n '&[data-hidden]': {\n [`@media (max-width: ${\n theme.fn.size({\n size: hiddenBreakpoint,\n sizes: theme.breakpoints,\n }) - 1\n }px)`]: {\n display: 'none',\n },\n },\n },\n };\n }\n);\n"],"names":[],"mappings":";;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC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QAAQ,CAAC,GAAG,KAAK,8BAA8B;AACvF,MAAM,MAAM,EAAE,CAAC;AACf,MAAM,MAAM;AACZ,MAAM,MAAM,EAAE,MAAM,IAAI,qFAAqF;AAC7G,MAAM,KAAK,EAAE,CAAC,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,MAAM;AAC5D,MAAM,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ;AAC1C,MAAM,SAAS,EAAE,YAAY;AAC7B,MAAM,OAAO,EAAE,MAAM;AACrB,MAAM,aAAa,EAAE,QAAQ;AAC7B,MAAM,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK;AACxF,KAAK,CAAC,EAAE,YAAY,CAAC,EAAE,WAAW,CAAC,EAAE;AACrC,MAAM,gBAAgB,EAAE;AACxB,QAAQ,CAAC,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC;AAC7C,UAAU,IAAI,EAAE,gBAAgB;AAChC,UAAU,KAAK,EAAE,KAAK,CAAC,WAAW;AAClC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG;AACtB,UAAU,OAAO,EAAE,MAAM;AACzB,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG,CAAC;AACJ,CAAC,CAAC;;;;"}
|
package/esm/Button/Button.js
CHANGED
|
@@ -103,7 +103,7 @@ const _Button = forwardRef((props, ref) => {
|
|
|
103
103
|
return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadValues({
|
|
104
104
|
className: cx(classes.root, className),
|
|
105
105
|
type,
|
|
106
|
-
disabled
|
|
106
|
+
disabled,
|
|
107
107
|
"data-button": true,
|
|
108
108
|
"data-disabled": disabled || void 0,
|
|
109
109
|
"data-loading": loading || void 0,
|
package/esm/Button/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineSize,\n MantineNumberSize,\n MantineGradient,\n MantineColor,\n Selectors,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { createPolymorphicComponent } from '@mantine/utils';\nimport { UnstyledButton } from '../UnstyledButton';\nimport { Loader, LoaderProps } from '../Loader';\nimport { ButtonGroup } from './ButtonGroup/ButtonGroup';\nimport useStyles, { sizes, ButtonVariant, ButtonStylesParams } from './Button.styles';\n\nexport type ButtonStylesNames = Selectors<typeof useStyles>;\n\nexport interface ButtonProps extends DefaultProps<ButtonStylesNames, ButtonStylesParams> {\n /** Predefined button size */\n size?: MantineSize;\n\n /** Button type attribute */\n type?: 'submit' | 'button' | 'reset';\n\n /** Button color from theme */\n color?: MantineColor;\n\n /** Adds icon before button label */\n leftIcon?: React.ReactNode;\n\n /** Adds icon after button label */\n rightIcon?: React.ReactNode;\n\n /** Sets button width to 100% of parent element */\n fullWidth?: boolean;\n\n /** Button border-radius from theme or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Controls button appearance */\n variant?: ButtonVariant;\n\n /** Controls gradient settings in gradient variant only */\n gradient?: MantineGradient;\n\n /** Set text-transform to uppercase */\n uppercase?: boolean;\n\n /** Reduces vertical and horizontal spacing */\n compact?: boolean;\n\n /** Indicate loading state */\n loading?: boolean;\n\n /** Props spread to Loader component */\n loaderProps?: LoaderProps;\n\n /** Loader position relative to button label */\n loaderPosition?: 'left' | 'right';\n\n /** Button label */\n children?: React.ReactNode;\n\n /** Disabled state */\n disabled?: boolean;\n}\n\nconst defaultProps: Partial<ButtonProps> = {\n size: 'sm',\n type: 'button',\n variant: 'filled',\n loaderPosition: 'left',\n};\n\nexport const _Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n className,\n size,\n color,\n type,\n disabled,\n children,\n leftIcon,\n rightIcon,\n fullWidth,\n variant,\n radius,\n uppercase,\n compact,\n loading,\n loaderPosition,\n loaderProps,\n gradient,\n classNames,\n styles,\n unstyled,\n ...others\n } = useComponentDefaultProps('Button', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n {\n radius,\n color,\n size,\n fullWidth,\n compact,\n gradient,\n variant,\n withLeftIcon: !!leftIcon,\n withRightIcon: !!rightIcon,\n },\n { name: 'Button', unstyled, classNames, styles }\n );\n\n const colors = theme.fn.variant({ color, variant });\n\n const loader = (\n <Loader\n color={colors.color}\n size={theme.fn.size({ size, sizes }).height / 2}\n {...loaderProps}\n />\n );\n\n return (\n <UnstyledButton\n className={cx(classes.root, className)}\n type={type}\n disabled={disabled
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineSize,\n MantineNumberSize,\n MantineGradient,\n MantineColor,\n Selectors,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { createPolymorphicComponent } from '@mantine/utils';\nimport { UnstyledButton } from '../UnstyledButton';\nimport { Loader, LoaderProps } from '../Loader';\nimport { ButtonGroup } from './ButtonGroup/ButtonGroup';\nimport useStyles, { sizes, ButtonVariant, ButtonStylesParams } from './Button.styles';\n\nexport type ButtonStylesNames = Selectors<typeof useStyles>;\n\nexport interface ButtonProps extends DefaultProps<ButtonStylesNames, ButtonStylesParams> {\n /** Predefined button size */\n size?: MantineSize;\n\n /** Button type attribute */\n type?: 'submit' | 'button' | 'reset';\n\n /** Button color from theme */\n color?: MantineColor;\n\n /** Adds icon before button label */\n leftIcon?: React.ReactNode;\n\n /** Adds icon after button label */\n rightIcon?: React.ReactNode;\n\n /** Sets button width to 100% of parent element */\n fullWidth?: boolean;\n\n /** Button border-radius from theme or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Controls button appearance */\n variant?: ButtonVariant;\n\n /** Controls gradient settings in gradient variant only */\n gradient?: MantineGradient;\n\n /** Set text-transform to uppercase */\n uppercase?: boolean;\n\n /** Reduces vertical and horizontal spacing */\n compact?: boolean;\n\n /** Indicate loading state */\n loading?: boolean;\n\n /** Props spread to Loader component */\n loaderProps?: LoaderProps;\n\n /** Loader position relative to button label */\n loaderPosition?: 'left' | 'right';\n\n /** Button label */\n children?: React.ReactNode;\n\n /** Disabled state */\n disabled?: boolean;\n}\n\nconst defaultProps: Partial<ButtonProps> = {\n size: 'sm',\n type: 'button',\n variant: 'filled',\n loaderPosition: 'left',\n};\n\nexport const _Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n className,\n size,\n color,\n type,\n disabled,\n children,\n leftIcon,\n rightIcon,\n fullWidth,\n variant,\n radius,\n uppercase,\n compact,\n loading,\n loaderPosition,\n loaderProps,\n gradient,\n classNames,\n styles,\n unstyled,\n ...others\n } = useComponentDefaultProps('Button', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n {\n radius,\n color,\n size,\n fullWidth,\n compact,\n gradient,\n variant,\n withLeftIcon: !!leftIcon,\n withRightIcon: !!rightIcon,\n },\n { name: 'Button', unstyled, classNames, styles }\n );\n\n const colors = theme.fn.variant({ color, variant });\n\n const loader = (\n <Loader\n color={colors.color}\n size={theme.fn.size({ size, sizes }).height / 2}\n {...loaderProps}\n />\n );\n\n return (\n <UnstyledButton\n className={cx(classes.root, className)}\n type={type}\n disabled={disabled}\n data-button\n data-disabled={disabled || undefined}\n data-loading={loading || undefined}\n ref={ref}\n unstyled={unstyled}\n {...others}\n >\n <div className={classes.inner}>\n {(leftIcon || (loading && loaderPosition === 'left')) && (\n <span className={cx(classes.icon, classes.leftIcon)}>\n {loading && loaderPosition === 'left' ? loader : leftIcon}\n </span>\n )}\n\n <span\n className={classes.label}\n style={{ textTransform: uppercase ? 'uppercase' : undefined }}\n >\n {children}\n </span>\n\n {(rightIcon || (loading && loaderPosition === 'right')) && (\n <span className={cx(classes.icon, classes.rightIcon)}>\n {loading && loaderPosition === 'right' ? loader : rightIcon}\n </span>\n )}\n </div>\n </UnstyledButton>\n );\n}) as any;\n\n_Button.displayName = '@mantine/core/Button';\n_Button.Group = ButtonGroup;\n\nexport const Button = createPolymorphicComponent<\n 'button',\n ButtonProps,\n { Group: typeof ButtonGroup }\n>(_Button);\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,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,KAAK;A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E,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;AAClD,GAAG,EAAE,OAAO,IAAI,cAAc,KAAK,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC,EAAE;AACH,OAAO,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAC7C,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC;AAChB,MAAC,MAAM,GAAG,0BAA0B,CAAC,OAAO;;;;"}
|
package/esm/Checkbox/Checkbox.js
CHANGED
|
@@ -6,6 +6,7 @@ import { CheckboxGroup } from './CheckboxGroup/CheckboxGroup.js';
|
|
|
6
6
|
import { useCheckboxGroupContext } from './CheckboxGroup.context.js';
|
|
7
7
|
import useStyles from './Checkbox.styles.js';
|
|
8
8
|
import { Box } from '../Box/Box.js';
|
|
9
|
+
import { Input } from '../Input/Input.js';
|
|
9
10
|
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -38,7 +39,8 @@ var __objRest = (source, exclude) => {
|
|
|
38
39
|
const defaultProps = {
|
|
39
40
|
size: "sm",
|
|
40
41
|
transitionDuration: 100,
|
|
41
|
-
icon: CheckboxIcon
|
|
42
|
+
icon: CheckboxIcon,
|
|
43
|
+
labelPosition: "right"
|
|
42
44
|
};
|
|
43
45
|
const Checkbox = forwardRef((props, ref) => {
|
|
44
46
|
const _a = useComponentDefaultProps("Checkbox", defaultProps, props), {
|
|
@@ -59,7 +61,10 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
59
61
|
styles,
|
|
60
62
|
transitionDuration,
|
|
61
63
|
icon: Icon,
|
|
62
|
-
unstyled
|
|
64
|
+
unstyled,
|
|
65
|
+
labelPosition,
|
|
66
|
+
description,
|
|
67
|
+
error
|
|
63
68
|
} = _a, others = __objRest(_a, [
|
|
64
69
|
"className",
|
|
65
70
|
"style",
|
|
@@ -78,37 +83,57 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
78
83
|
"styles",
|
|
79
84
|
"transitionDuration",
|
|
80
85
|
"icon",
|
|
81
|
-
"unstyled"
|
|
86
|
+
"unstyled",
|
|
87
|
+
"labelPosition",
|
|
88
|
+
"description",
|
|
89
|
+
"error"
|
|
82
90
|
]);
|
|
83
91
|
const ctx = useCheckboxGroupContext();
|
|
84
92
|
const uuid = useId(id);
|
|
85
93
|
const { systemStyles, rest } = extractSystemStyles(others);
|
|
86
|
-
const { classes, cx } = useStyles({
|
|
94
|
+
const { classes, cx } = useStyles({
|
|
95
|
+
size: (ctx == null ? void 0 : ctx.size) || size,
|
|
96
|
+
radius,
|
|
97
|
+
color,
|
|
98
|
+
transitionDuration,
|
|
99
|
+
labelPosition,
|
|
100
|
+
error: !!error,
|
|
101
|
+
indeterminate
|
|
102
|
+
}, { name: "Checkbox", classNames, styles, unstyled });
|
|
87
103
|
const contextProps = ctx ? {
|
|
88
104
|
checked: ctx.value.includes(rest.value),
|
|
89
105
|
onChange: ctx.onChange
|
|
90
106
|
} : {};
|
|
91
107
|
return /* @__PURE__ */ React.createElement(Box, __spreadValues(__spreadValues({
|
|
92
108
|
className: cx(classes.root, className),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, systemStyles), wrapperProps), /* @__PURE__ */ React.createElement(
|
|
109
|
+
sx,
|
|
110
|
+
style
|
|
111
|
+
}, systemStyles), wrapperProps), /* @__PURE__ */ React.createElement(Box, {
|
|
112
|
+
className: cx(classes.body)
|
|
113
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
96
114
|
className: classes.inner
|
|
97
115
|
}, /* @__PURE__ */ React.createElement("input", __spreadValues(__spreadValues({
|
|
98
116
|
id: uuid,
|
|
99
117
|
ref,
|
|
100
118
|
type: "checkbox",
|
|
101
119
|
className: classes.input,
|
|
102
|
-
checked
|
|
120
|
+
checked,
|
|
103
121
|
disabled
|
|
104
122
|
}, rest), contextProps)), /* @__PURE__ */ React.createElement(Icon, {
|
|
105
123
|
indeterminate,
|
|
106
124
|
className: classes.icon
|
|
107
|
-
})),
|
|
108
|
-
|
|
125
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
126
|
+
className: classes.labelWrapper
|
|
127
|
+
}, label && /* @__PURE__ */ React.createElement("label", {
|
|
109
128
|
className: classes.label,
|
|
110
|
-
|
|
111
|
-
|
|
129
|
+
"data-disabled": disabled || void 0,
|
|
130
|
+
htmlFor: uuid,
|
|
131
|
+
"data-testid": "label"
|
|
132
|
+
}, label), description && /* @__PURE__ */ React.createElement(Input.Description, {
|
|
133
|
+
className: classes.description
|
|
134
|
+
}, description), error && error !== "boolean" && /* @__PURE__ */ React.createElement(Input.Error, {
|
|
135
|
+
className: classes.error
|
|
136
|
+
}, error))));
|
|
112
137
|
});
|
|
113
138
|
Checkbox.displayName = "@mantine/core/Checkbox";
|
|
114
139
|
Checkbox.Group = CheckboxGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineSize,\n MantineColor,\n Selectors,\n extractSystemStyles,\n MantineNumberSize,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { useId } from '@mantine/hooks';\nimport { Box } from '../Box';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { CheckboxGroup } from './CheckboxGroup/CheckboxGroup';\nimport { useCheckboxGroupContext } from './CheckboxGroup.context';\nimport useStyles, { CheckboxStylesParams } from './Checkbox.styles';\n\nexport type CheckboxStylesNames = Selectors<typeof useStyles>;\n\nexport interface CheckboxProps\n extends DefaultProps<CheckboxStylesNames, CheckboxStylesParams>,\n Omit<React.ComponentPropsWithRef<'input'>, 'type' | 'size'> {\n /** Key of theme.colors */\n color?: MantineColor;\n\n /** Key of theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Predefined label font-size and checkbox width and height in px */\n size?: MantineSize;\n\n /** Checkbox label */\n label?: React.ReactNode;\n\n /** Indeterminate state of checkbox, overwrites checked */\n indeterminate?: boolean;\n\n /** Props spread to wrapper element */\n wrapperProps?: Record<string, any>;\n\n /** id to connect label with input */\n id?: string;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Icon rendered when checkbox has checked or indeterminate state */\n icon?: React.FC<{ indeterminate: boolean; className: string }>;\n}\n\nconst defaultProps: Partial<CheckboxProps> = {\n size: 'sm',\n transitionDuration: 100,\n icon: CheckboxIcon,\n};\n\ntype CheckboxComponent = ForwardRefWithStaticComponents<\n CheckboxProps,\n { Group: typeof CheckboxGroup }\n>;\n\nexport const Checkbox: CheckboxComponent = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n className,\n style,\n sx,\n checked,\n disabled,\n color,\n label,\n indeterminate,\n id,\n size,\n radius,\n wrapperProps,\n children,\n classNames,\n styles,\n transitionDuration,\n icon: Icon,\n unstyled,\n ...others\n } = useComponentDefaultProps('Checkbox', defaultProps, props);\n\n const ctx = useCheckboxGroupContext();\n const uuid = useId(id);\n const { systemStyles, rest } = extractSystemStyles(others);\n const { classes, cx } = useStyles(\n {
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n DefaultProps,\n MantineSize,\n MantineColor,\n Selectors,\n extractSystemStyles,\n MantineNumberSize,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { useId } from '@mantine/hooks';\nimport { Box } from '../Box';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { CheckboxGroup } from './CheckboxGroup/CheckboxGroup';\nimport { useCheckboxGroupContext } from './CheckboxGroup.context';\nimport useStyles, { CheckboxStylesParams } from './Checkbox.styles';\nimport { Input } from '../Input';\n\nexport type CheckboxStylesNames = Selectors<typeof useStyles>;\n\nexport interface CheckboxProps\n extends DefaultProps<CheckboxStylesNames, CheckboxStylesParams>,\n Omit<React.ComponentPropsWithRef<'input'>, 'type' | 'size'> {\n /** Key of theme.colors */\n color?: MantineColor;\n\n /** Key of theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Predefined label font-size and checkbox width and height in px */\n size?: MantineSize;\n\n /** Checkbox label */\n label?: React.ReactNode;\n\n /** Indeterminate state of checkbox, overwrites checked */\n indeterminate?: boolean;\n\n /** Props spread to wrapper element */\n wrapperProps?: Record<string, any>;\n\n /** id to connect label with input */\n id?: string;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Icon rendered when checkbox has checked or indeterminate state */\n icon?: React.FC<{ indeterminate: boolean; className: string }>;\n\n /** Position of label */\n labelPosition?: 'left' | 'right';\n\n /** description, displayed after label */\n description?: React.ReactNode;\n\n /** Displays error message after input */\n error?: React.ReactNode;\n}\n\nconst defaultProps: Partial<CheckboxProps> = {\n size: 'sm',\n transitionDuration: 100,\n icon: CheckboxIcon,\n labelPosition: 'right',\n};\n\ntype CheckboxComponent = ForwardRefWithStaticComponents<\n CheckboxProps,\n { Group: typeof CheckboxGroup }\n>;\n\nexport const Checkbox: CheckboxComponent = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n className,\n style,\n sx,\n checked,\n disabled,\n color,\n label,\n indeterminate,\n id,\n size,\n radius,\n wrapperProps,\n children,\n classNames,\n styles,\n transitionDuration,\n icon: Icon,\n unstyled,\n labelPosition,\n description,\n error,\n ...others\n } = useComponentDefaultProps('Checkbox', defaultProps, props);\n\n const ctx = useCheckboxGroupContext();\n const uuid = useId(id);\n const { systemStyles, rest } = extractSystemStyles(others);\n const { classes, cx } = useStyles(\n {\n size: ctx?.size || size,\n radius,\n color,\n transitionDuration,\n labelPosition,\n error: !!error,\n indeterminate,\n },\n { name: 'Checkbox', classNames, styles, unstyled }\n );\n\n const contextProps = ctx\n ? {\n checked: ctx.value.includes(rest.value as string),\n onChange: ctx.onChange,\n }\n : {};\n\n return (\n <Box\n className={cx(classes.root, className)}\n sx={sx}\n style={style}\n {...systemStyles}\n {...wrapperProps}\n >\n <Box className={cx(classes.body)}>\n <div className={classes.inner}>\n <input\n id={uuid}\n ref={ref}\n type=\"checkbox\"\n className={classes.input}\n checked={checked}\n disabled={disabled}\n {...rest}\n {...contextProps}\n />\n\n <Icon indeterminate={indeterminate} className={classes.icon} />\n </div>\n\n <div className={classes.labelWrapper}>\n {label && (\n <label\n className={classes.label}\n data-disabled={disabled || undefined}\n htmlFor={uuid}\n data-testid=\"label\"\n >\n {label}\n </label>\n )}\n\n {description && (\n <Input.Description className={classes.description}>{description}</Input.Description>\n )}\n\n {error && error !== 'boolean' && (\n <Input.Error className={classes.error}>{error}</Input.Error>\n )}\n </div>\n </Box>\n </Box>\n );\n }\n) as any;\n\nCheckbox.displayName = '@mantine/core/Checkbox';\nCheckbox.Group = CheckboxGroup;\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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{
|
|
37
|
+
size,
|
|
38
|
+
radius,
|
|
39
|
+
color,
|
|
40
|
+
transitionDuration,
|
|
41
|
+
labelPosition,
|
|
42
|
+
error,
|
|
43
|
+
indeterminate
|
|
44
|
+
}, getRef) => {
|
|
37
45
|
const _size = theme.fn.size({ size, sizes });
|
|
38
46
|
const colors = theme.fn.variant({ variant: "filled", color });
|
|
47
|
+
const errorColor = theme.fn.variant({ variant: "filled", color: "red" }).background;
|
|
39
48
|
return {
|
|
49
|
+
description: {
|
|
50
|
+
marginTop: `calc(${theme.spacing.xs}px / 2)`,
|
|
51
|
+
[labelPosition === "left" ? "paddingRight" : "paddingLeft"]: theme.spacing.sm
|
|
52
|
+
},
|
|
53
|
+
error: {
|
|
54
|
+
marginTop: `calc(${theme.spacing.xs}px / 2)`,
|
|
55
|
+
[labelPosition === "left" ? "paddingRight" : "paddingLeft"]: theme.spacing.sm
|
|
56
|
+
},
|
|
57
|
+
label: {
|
|
58
|
+
[labelPosition === "left" ? "paddingRight" : "paddingLeft"]: theme.spacing.sm
|
|
59
|
+
},
|
|
40
60
|
icon: {
|
|
41
61
|
ref: getRef("icon"),
|
|
42
|
-
color: theme.white,
|
|
43
|
-
transform: "translateY(5px) scale(0.5)",
|
|
44
|
-
opacity: 0,
|
|
62
|
+
color: indeterminate ? "inherit" : theme.white,
|
|
63
|
+
transform: indeterminate ? "none" : "translateY(5px) scale(0.5)",
|
|
64
|
+
opacity: indeterminate ? 1 : 0,
|
|
45
65
|
transitionProperty: "opacity, transform",
|
|
46
66
|
transitionTimingFunction: "ease",
|
|
47
67
|
transitionDuration: `${transitionDuration}ms`,
|
|
@@ -58,30 +78,32 @@ var useStyles = createStyles((theme, { size, radius, color, transitionDuration }
|
|
|
58
78
|
transitionDuration: theme.respectReducedMotion ? "0ms" : void 0
|
|
59
79
|
}
|
|
60
80
|
},
|
|
61
|
-
root: {
|
|
81
|
+
root: {},
|
|
82
|
+
body: {
|
|
62
83
|
display: "flex",
|
|
63
|
-
|
|
84
|
+
marginBlock: "5px"
|
|
64
85
|
},
|
|
65
86
|
inner: {
|
|
66
87
|
position: "relative",
|
|
67
88
|
width: _size,
|
|
68
|
-
height: _size
|
|
89
|
+
height: _size,
|
|
90
|
+
order: labelPosition === "left" ? 2 : 1
|
|
69
91
|
},
|
|
70
|
-
|
|
92
|
+
labelWrapper: __spreadProps(__spreadValues({}, theme.fn.fontStyles()), {
|
|
71
93
|
WebkitTapHighlightColor: "transparent",
|
|
72
|
-
paddingLeft: theme.spacing.sm,
|
|
73
94
|
fontSize: theme.fn.size({ size, sizes: theme.fontSizes }),
|
|
74
95
|
lineHeight: `${_size}px`,
|
|
75
96
|
color: theme.colorScheme === "dark" ? theme.colors.dark[0] : theme.black,
|
|
76
97
|
cursor: theme.cursorType,
|
|
77
|
-
"
|
|
98
|
+
order: labelPosition === "left" ? 1 : 2,
|
|
99
|
+
"& label[data-disabled]": {
|
|
78
100
|
color: theme.colorScheme === "dark" ? theme.colors.dark[3] : theme.colors.gray[5]
|
|
79
101
|
}
|
|
80
102
|
}),
|
|
81
103
|
input: __spreadProps(__spreadValues({}, theme.fn.focusStyles()), {
|
|
82
104
|
appearance: "none",
|
|
83
105
|
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.white,
|
|
84
|
-
border: `1px solid ${theme.colorScheme === "dark" ? theme.colors.dark[4] : theme.colors.gray[4]}`,
|
|
106
|
+
border: `1px solid ${error ? errorColor : theme.colorScheme === "dark" ? theme.colors.dark[4] : theme.colors.gray[4]}`,
|
|
85
107
|
width: _size,
|
|
86
108
|
height: _size,
|
|
87
109
|
borderRadius: theme.fn.radius(radius),
|
|
@@ -95,6 +117,7 @@ var useStyles = createStyles((theme, { size, radius, color, transitionDuration }
|
|
|
95
117
|
borderColor: colors.background,
|
|
96
118
|
[`& + .${getRef("icon")}`]: {
|
|
97
119
|
opacity: 1,
|
|
120
|
+
color: theme.white,
|
|
98
121
|
transform: "translateY(0) scale(1)"
|
|
99
122
|
}
|
|
100
123
|
},
|