@mantine/core 3.6.0 → 3.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/cjs/components/ActionIcon/ActionIcon.js +2 -5
  2. package/cjs/components/ActionIcon/ActionIcon.js.map +1 -1
  3. package/cjs/components/AppShell/Navbar/Navbar.js.map +1 -1
  4. package/cjs/components/Input/Input.js +1 -1
  5. package/cjs/components/Input/Input.js.map +1 -1
  6. package/cjs/components/Menu/Menu.js +8 -3
  7. package/cjs/components/Menu/Menu.js.map +1 -1
  8. package/cjs/components/MultiSelect/MultiSelect.js +3 -6
  9. package/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
  10. package/cjs/components/NumberInput/NumberInput.js.map +1 -1
  11. package/cjs/components/Popover/Popover.js +8 -3
  12. package/cjs/components/Popover/Popover.js.map +1 -1
  13. package/cjs/components/Progress/Progress.styles.js +2 -1
  14. package/cjs/components/Progress/Progress.styles.js.map +1 -1
  15. package/cjs/components/SegmentedControl/SegmentedControl.js +26 -7
  16. package/cjs/components/SegmentedControl/SegmentedControl.js.map +1 -1
  17. package/cjs/components/SegmentedControl/SegmentedControl.styles.js +19 -8
  18. package/cjs/components/SegmentedControl/SegmentedControl.styles.js.map +1 -1
  19. package/cjs/components/Select/Select.js +7 -9
  20. package/cjs/components/Select/Select.js.map +1 -1
  21. package/cjs/components/Slider/RangeSlider/RangeSlider.js +16 -4
  22. package/cjs/components/Slider/RangeSlider/RangeSlider.js.map +1 -1
  23. package/cjs/components/Slider/Slider/Slider.js +14 -4
  24. package/cjs/components/Slider/Slider/Slider.js.map +1 -1
  25. package/cjs/components/Tabs/Tabs.js +2 -1
  26. package/cjs/components/Tabs/Tabs.js.map +1 -1
  27. package/cjs/components/Text/Text.js.map +1 -1
  28. package/cjs/components/Text/Text.styles.js +1 -1
  29. package/cjs/components/Text/Text.styles.js.map +1 -1
  30. package/cjs/components/TransferList/RenderList/RenderList.styles.js +0 -2
  31. package/cjs/components/TransferList/RenderList/RenderList.styles.js.map +1 -1
  32. package/esm/components/ActionIcon/ActionIcon.js +2 -5
  33. package/esm/components/ActionIcon/ActionIcon.js.map +1 -1
  34. package/esm/components/AppShell/Navbar/Navbar.js.map +1 -1
  35. package/esm/components/Input/Input.js +1 -1
  36. package/esm/components/Input/Input.js.map +1 -1
  37. package/esm/components/Menu/Menu.js +8 -3
  38. package/esm/components/Menu/Menu.js.map +1 -1
  39. package/esm/components/MultiSelect/MultiSelect.js +3 -6
  40. package/esm/components/MultiSelect/MultiSelect.js.map +1 -1
  41. package/esm/components/NumberInput/NumberInput.js.map +1 -1
  42. package/esm/components/Popover/Popover.js +8 -3
  43. package/esm/components/Popover/Popover.js.map +1 -1
  44. package/esm/components/Progress/Progress.styles.js +2 -1
  45. package/esm/components/Progress/Progress.styles.js.map +1 -1
  46. package/esm/components/SegmentedControl/SegmentedControl.js +26 -7
  47. package/esm/components/SegmentedControl/SegmentedControl.js.map +1 -1
  48. package/esm/components/SegmentedControl/SegmentedControl.styles.js +19 -8
  49. package/esm/components/SegmentedControl/SegmentedControl.styles.js.map +1 -1
  50. package/esm/components/Select/Select.js +7 -9
  51. package/esm/components/Select/Select.js.map +1 -1
  52. package/esm/components/Slider/RangeSlider/RangeSlider.js +16 -4
  53. package/esm/components/Slider/RangeSlider/RangeSlider.js.map +1 -1
  54. package/esm/components/Slider/Slider/Slider.js +14 -4
  55. package/esm/components/Slider/Slider/Slider.js.map +1 -1
  56. package/esm/components/Tabs/Tabs.js +2 -1
  57. package/esm/components/Tabs/Tabs.js.map +1 -1
  58. package/esm/components/Text/Text.js.map +1 -1
  59. package/esm/components/Text/Text.styles.js +1 -1
  60. package/esm/components/Text/Text.styles.js.map +1 -1
  61. package/esm/components/TransferList/RenderList/RenderList.styles.js +0 -2
  62. package/esm/components/TransferList/RenderList/RenderList.styles.js.map +1 -1
  63. package/lib/components/AppShell/Navbar/Navbar.d.ts +1 -1
  64. package/lib/components/AppShell/Navbar/Navbar.d.ts.map +1 -1
  65. package/lib/components/Input/Input.d.ts +1 -1
  66. package/lib/components/Input/Input.d.ts.map +1 -1
  67. package/lib/components/Menu/Menu.d.ts +2 -0
  68. package/lib/components/Menu/Menu.d.ts.map +1 -1
  69. package/lib/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  70. package/lib/components/NumberInput/NumberInput.d.ts +1 -1
  71. package/lib/components/NumberInput/NumberInput.d.ts.map +1 -1
  72. package/lib/components/Popover/Popover.d.ts +3 -1
  73. package/lib/components/Popover/Popover.d.ts.map +1 -1
  74. package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
  75. package/lib/components/SegmentedControl/SegmentedControl.d.ts +4 -0
  76. package/lib/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  77. package/lib/components/SegmentedControl/SegmentedControl.styles.d.ts +3 -2
  78. package/lib/components/SegmentedControl/SegmentedControl.styles.d.ts.map +1 -1
  79. package/lib/components/Select/Select.d.ts.map +1 -1
  80. package/lib/components/Slider/RangeSlider/RangeSlider.d.ts.map +1 -1
  81. package/lib/components/Slider/Slider/Slider.d.ts +1 -1
  82. package/lib/components/Slider/Slider/Slider.d.ts.map +1 -1
  83. package/lib/components/Text/Text.d.ts +1 -1
  84. package/lib/components/Text/Text.d.ts.map +1 -1
  85. package/lib/components/Text/Text.styles.d.ts +1 -1
  86. package/lib/components/Text/Text.styles.d.ts.map +1 -1
  87. package/lib/components/TransferList/RenderList/RenderList.styles.d.ts.map +1 -1
  88. package/package.json +3 -3
@@ -73,7 +73,8 @@ function Popover(_a) {
73
73
  id,
74
74
  classNames,
75
75
  styles: styles$1,
76
- width
76
+ width,
77
+ clickOutsideEvents = ["click", "touchstart"]
77
78
  } = _b, others = __objRest(_b, [
78
79
  "className",
79
80
  "children",
@@ -104,7 +105,8 @@ function Popover(_a) {
104
105
  "id",
105
106
  "classNames",
106
107
  "styles",
107
- "width"
108
+ "width",
109
+ "clickOutsideEvents"
108
110
  ]);
109
111
  const { classes, cx } = Popover_styles['default'](null, { classNames, styles: styles$1, name: "Popover" });
110
112
  const handleClose = () => typeof onClose === "function" && onClose();
@@ -112,7 +114,10 @@ function Popover(_a) {
112
114
  const [rootElement, setRootElement] = React.useState(null);
113
115
  const [dropdownElement, setDropdownElement] = React.useState(null);
114
116
  const focusTrapRef = hooks.useFocusTrap(!noFocusTrap && opened);
115
- hooks.useClickOutside(() => !noClickOutside && handleClose(), null, [rootElement, dropdownElement]);
117
+ hooks.useClickOutside(() => !noClickOutside && handleClose(), clickOutsideEvents, [
118
+ rootElement,
119
+ dropdownElement
120
+ ]);
116
121
  const returnFocus = hooks.useFocusReturn({
117
122
  opened: opened || noFocusTrap,
118
123
  transitionDuration,
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n useClickOutside,\n useFocusTrap,\n useMergedRef,\n useFocusReturn,\n useUuid,\n} from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineShadow,\n ClassNames,\n getDefaultZIndex,\n} from '@mantine/styles';\nimport { Box } from '../Box';\nimport { Popper, SharedPopperProps } from '../Popper';\nimport { PopoverBody, PopoverBodyStylesNames } from './PopoverBody/PopoverBody';\nimport useStyles from './Popover.styles';\n\nexport type PopoverStylesNames = ClassNames<typeof useStyles> | PopoverBodyStylesNames;\n\nexport interface PopoverProps\n extends DefaultProps<PopoverStylesNames>,\n SharedPopperProps,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** Disable closing by click outside */\n noClickOutside?: boolean;\n\n /** Disable focus trap (may impact close on escape feature) */\n noFocusTrap?: boolean;\n\n /** Disables close on escape */\n noEscape?: boolean;\n\n /** Adds close button */\n withCloseButton?: boolean;\n\n /** True to disable popover */\n disabled?: boolean;\n\n /** True to display popover */\n opened: boolean;\n\n /** Called when popover closes */\n onClose?(): void;\n\n /** Element which is used to position popover */\n target: React.ReactNode;\n\n /** Content inside popover */\n children: React.ReactNode;\n\n /** Optional popover title */\n title?: React.ReactNode;\n\n /** Popover body padding, value from theme.spacing or number to set padding in px */\n spacing?: MantineNumberSize;\n\n /** Popover body radius, value from theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Popover shadow, value from theme.shadows or string to set box-shadow to any value */\n shadow?: MantineShadow;\n\n /** aria-label for close button */\n closeButtonLabel?: string;\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Whether to render the popover in a Portal */\n withinPortal?: boolean;\n\n /** Popover body width */\n width?: number | string;\n}\n\nexport function Popover({\n className,\n children,\n target,\n title,\n onClose,\n opened,\n zIndex = getDefaultZIndex('popover'),\n arrowSize = 4,\n withArrow = false,\n transition = 'fade',\n transitionDuration = 200,\n transitionTimingFunction,\n gutter = 10,\n position = 'left',\n placement = 'center',\n disabled = false,\n noClickOutside = false,\n noFocusTrap = false,\n noEscape = false,\n withCloseButton = false,\n radius = 'sm',\n spacing = 'md',\n shadow = 'sm',\n closeButtonLabel,\n positionDependencies = [],\n withinPortal = true,\n id,\n classNames,\n styles,\n width,\n ...others\n}: PopoverProps) {\n const { classes, cx } = useStyles(null, { classNames, styles, name: 'Popover' });\n const handleClose = () => typeof onClose === 'function' && onClose();\n const [referenceElement, setReferenceElement] = useState(null);\n const [rootElement, setRootElement] = useState<HTMLDivElement>(null);\n const [dropdownElement, setDropdownElement] = useState<HTMLDivElement>(null);\n const focusTrapRef = useFocusTrap(!noFocusTrap && opened);\n\n useClickOutside(() => !noClickOutside && handleClose(), null, [rootElement, dropdownElement]);\n\n const returnFocus = useFocusReturn({\n opened: opened || noFocusTrap,\n transitionDuration,\n shouldReturnFocus: false,\n });\n\n const handleKeydown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!noEscape && event.nativeEvent.code === 'Escape') {\n handleClose();\n window.setTimeout(returnFocus, 0);\n }\n };\n\n const uuid = useUuid(id);\n const titleId = `${uuid}-title`;\n const bodyId = `${uuid}-body`;\n\n return (\n <Box className={cx(classes.root, className)} id={id} ref={setRootElement} {...others}>\n <Popper\n referenceElement={referenceElement}\n transitionDuration={transitionDuration}\n transition={transition}\n mounted={opened && !disabled}\n position={position}\n placement={placement}\n gutter={gutter}\n withArrow={withArrow}\n arrowSize={arrowSize}\n zIndex={zIndex}\n arrowClassName={classes.arrow}\n forceUpdateDependencies={[radius, shadow, spacing, ...positionDependencies]}\n withinPortal={withinPortal}\n >\n <PopoverBody\n shadow={shadow}\n radius={radius}\n spacing={spacing}\n withCloseButton={withCloseButton}\n title={title}\n titleId={titleId}\n bodyId={bodyId}\n closeButtonLabel={closeButtonLabel}\n onClose={handleClose}\n ref={useMergedRef(focusTrapRef, setDropdownElement)}\n onKeyDownCapture={handleKeydown}\n classNames={classNames}\n styles={styles}\n width={width}\n >\n {children}\n </PopoverBody>\n </Popper>\n\n <div className={classes.target} ref={setReferenceElement}>\n {target}\n </div>\n </Box>\n );\n}\n\nPopover.displayName = '@mantine/core/Popover';\n"],"names":["getDefaultZIndex","styles","useStyles","useState","useFocusTrap","useClickOutside","useFocusReturn","useUuid","React","Box","Popper","PopoverBody","useMergedRef"],"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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IAAI,MAAM;AACV,IAAI,gBAAgB;AACpB,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,GAAG,EAAEC,kBAAY,CAAC,YAAY,EAAE,kBAAkB,CAAC;AACvD,IAAI,gBAAgB,EAAE,aAAa;AACnC,IAAI,UAAU;AACd,YAAIX,QAAM;AACV,IAAI,KAAK;AACT,GAAG,EAAE,QAAQ,CAAC,CAAC,kBAAkBO,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5D,IAAI,SAAS,EAAE,OAAO,CAAC,MAAM;AAC7B,IAAI,GAAG,EAAE,mBAAmB;AAC5B,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AACd,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,uBAAuB;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n useClickOutside,\n useFocusTrap,\n useMergedRef,\n useFocusReturn,\n useUuid,\n} from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineShadow,\n ClassNames,\n getDefaultZIndex,\n} from '@mantine/styles';\nimport { Box } from '../Box';\nimport { Popper, SharedPopperProps } from '../Popper';\nimport { PopoverBody, PopoverBodyStylesNames } from './PopoverBody/PopoverBody';\nimport useStyles from './Popover.styles';\n\nexport type PopoverStylesNames = ClassNames<typeof useStyles> | PopoverBodyStylesNames;\n\nexport interface PopoverProps\n extends DefaultProps<PopoverStylesNames>,\n SharedPopperProps,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** Disable closing by click outside */\n noClickOutside?: boolean;\n\n /** Disable focus trap (may impact close on escape feature) */\n noFocusTrap?: boolean;\n\n /** Disables close on escape */\n noEscape?: boolean;\n\n /** Adds close button */\n withCloseButton?: boolean;\n\n /** True to disable popover */\n disabled?: boolean;\n\n /** True to display popover */\n opened: boolean;\n\n /** Called when popover closes */\n onClose?(): void;\n\n /** Element which is used to position popover */\n target: React.ReactNode;\n\n /** Content inside popover */\n children: React.ReactNode;\n\n /** Optional popover title */\n title?: React.ReactNode;\n\n /** Popover body padding, value from theme.spacing or number to set padding in px */\n spacing?: MantineNumberSize;\n\n /** Popover body radius, value from theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Popover shadow, value from theme.shadows or string to set box-shadow to any value */\n shadow?: MantineShadow;\n\n /** aria-label for close button */\n closeButtonLabel?: string;\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Whether to render the popover in a Portal */\n withinPortal?: boolean;\n\n /** Popover body width */\n width?: number | string;\n\n /** Events that should trigger outside clicks */\n clickOutsideEvents?: string[];\n}\n\nexport function Popover({\n className,\n children,\n target,\n title,\n onClose,\n opened,\n zIndex = getDefaultZIndex('popover'),\n arrowSize = 4,\n withArrow = false,\n transition = 'fade',\n transitionDuration = 200,\n transitionTimingFunction,\n gutter = 10,\n position = 'left',\n placement = 'center',\n disabled = false,\n noClickOutside = false,\n noFocusTrap = false,\n noEscape = false,\n withCloseButton = false,\n radius = 'sm',\n spacing = 'md',\n shadow = 'sm',\n closeButtonLabel,\n positionDependencies = [],\n withinPortal = true,\n id,\n classNames,\n styles,\n width,\n clickOutsideEvents = ['click', 'touchstart'],\n ...others\n}: PopoverProps) {\n const { classes, cx } = useStyles(null, { classNames, styles, name: 'Popover' });\n const handleClose = () => typeof onClose === 'function' && onClose();\n const [referenceElement, setReferenceElement] = useState(null);\n const [rootElement, setRootElement] = useState<HTMLDivElement>(null);\n const [dropdownElement, setDropdownElement] = useState<HTMLDivElement>(null);\n const focusTrapRef = useFocusTrap(!noFocusTrap && opened);\n\n useClickOutside(() => !noClickOutside && handleClose(), clickOutsideEvents, [\n rootElement,\n dropdownElement,\n ]);\n\n const returnFocus = useFocusReturn({\n opened: opened || noFocusTrap,\n transitionDuration,\n shouldReturnFocus: false,\n });\n\n const handleKeydown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!noEscape && event.nativeEvent.code === 'Escape') {\n handleClose();\n window.setTimeout(returnFocus, 0);\n }\n };\n\n const uuid = useUuid(id);\n const titleId = `${uuid}-title`;\n const bodyId = `${uuid}-body`;\n\n return (\n <Box className={cx(classes.root, className)} id={id} ref={setRootElement} {...others}>\n <Popper\n referenceElement={referenceElement}\n transitionDuration={transitionDuration}\n transition={transition}\n mounted={opened && !disabled}\n position={position}\n placement={placement}\n gutter={gutter}\n withArrow={withArrow}\n arrowSize={arrowSize}\n zIndex={zIndex}\n arrowClassName={classes.arrow}\n forceUpdateDependencies={[radius, shadow, spacing, ...positionDependencies]}\n withinPortal={withinPortal}\n >\n <PopoverBody\n shadow={shadow}\n radius={radius}\n spacing={spacing}\n withCloseButton={withCloseButton}\n title={title}\n titleId={titleId}\n bodyId={bodyId}\n closeButtonLabel={closeButtonLabel}\n onClose={handleClose}\n ref={useMergedRef(focusTrapRef, setDropdownElement)}\n onKeyDownCapture={handleKeydown}\n classNames={classNames}\n styles={styles}\n width={width}\n >\n {children}\n </PopoverBody>\n </Popper>\n\n <div className={classes.target} ref={setReferenceElement}>\n {target}\n </div>\n </Box>\n );\n}\n\nPopover.displayName = '@mantine/core/Popover';\n"],"names":["getDefaultZIndex","styles","useStyles","useState","useFocusTrap","useClickOutside","useFocusReturn","useUuid","React","Box","Popper","PopoverBody","useMergedRef"],"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,EAA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,oBAAoB,CAAC;AAC/E,IAAI,YAAY;AAChB,GAAG,kBAAkBF,cAAK,CAAC,aAAa,CAACG,uBAAW,EAAE;AACtD,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,OAAO;AACX,IAAI,eAAe;AACnB,IAAI,KAAK;AACT,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,gBAAgB;AACpB,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,GAAG,EAAEC,kBAAY,CAAC,YAAY,EAAE,kBAAkB,CAAC;AACvD,IAAI,gBAAgB,EAAE,aAAa;AACnC,IAAI,UAAU;AACd,YAAIX,QAAM;AACV,IAAI,KAAK;AACT,GAAG,EAAE,QAAQ,CAAC,CAAC,kBAAkBO,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5D,IAAI,SAAS,EAAE,OAAO,CAAC,MAAM;AAC7B,IAAI,GAAG,EAAE,mBAAmB;AAC5B,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AACd,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,uBAAuB;;;;"}
@@ -54,7 +54,8 @@ var useStyles = styles.createStyles((theme, { color, radius, size, striped, anim
54
54
  fontSize: theme.fn.size({ size, sizes }) * 0.65,
55
55
  fontWeight: 700,
56
56
  userSelect: "none",
57
- overflow: "hidden"
57
+ overflow: "hidden",
58
+ whiteSpace: "nowrap"
58
59
  }
59
60
  }));
60
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.styles.js","sources":["../../../src/components/Progress/Progress.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineColor, keyframes } from '@mantine/styles';\n\nexport const sizes = {\n xs: 3,\n sm: 5,\n md: 8,\n lg: 12,\n xl: 16,\n};\n\ninterface ProgressStyles {\n color: MantineColor;\n radius: MantineNumberSize;\n size: MantineNumberSize;\n striped: boolean;\n animate: boolean;\n}\n\nconst stripesAnimation = keyframes({\n from: { backgroundPosition: '0 0' },\n to: { backgroundPosition: '40px 0' },\n});\n\nexport default createStyles((theme, { color, radius, size, striped, animate }: ProgressStyles) => ({\n root: {\n position: 'relative',\n height: theme.fn.size({ size, sizes }),\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[2],\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n overflow: 'hidden',\n },\n\n bar: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: theme.fn.themeColor(color || theme.primaryColor, 6, false),\n transition: 'width 100ms linear',\n animation: animate ? `${stripesAnimation} 1000ms linear infinite` : 'none',\n backgroundSize: '20px 20px',\n backgroundImage: striped\n ? 'linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)'\n : 'none',\n\n '&:last-of-type': {\n borderTopRightRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n borderBottomRightRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n },\n\n '&:first-of-type': {\n borderTopLeftRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n borderBottomLeftRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n },\n\n '@media (prefers-reduced-motion)': {\n transitionDuration: '0ms',\n },\n },\n\n label: {\n color: theme.white,\n fontSize: theme.fn.size({ size, sizes }) * 0.65,\n fontWeight: 700,\n userSelect: 'none',\n overflow: 'hidden',\n },\n}));\n"],"names":["keyframes","createStyles"],"mappings":";;;;;;AACY,MAAC,KAAK,GAAG;AACrB,EAAE,EAAE,EAAE,CAAC;AACP,EAAE,EAAE,EAAE,CAAC;AACP,EAAE,EAAE,EAAE,CAAC;AACP,EAAE,EAAE,EAAE,EAAE;AACR,EAAE,EAAE,EAAE,EAAE;AACR,EAAE;AACF,MAAM,gBAAgB,GAAGA,gBAAS,CAAC;AACnC,EAAE,IAAI,EAA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AAC9E,IAAI,cAAc,EAAE,WAAW;AAC/B,IAAI,eAAe,EAAE,OAAO,GAAG,qLAAqL,GAAG,MAAM;AAC7N,IAAI,gBAAgB,EAAE;AACtB,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAChF,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AACnF,KAAK;AACL,IAAI,iBAAiB,EAAE;AACvB,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC/E,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAClF,KAAK;AACL,IAAI,iCAAiC,EAAE;AACvC,MAAM,kBAAkB,EAAE,KAAK;AAC/B,KAAK;AACL,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,KAAK,EAAE,KAAK,CAAC,KAAK;AACtB,IAAI,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;AACnD,IAAI,UAAU,EAAE,GAAG;AACnB,IAAI,UAAU,EAAE,MAAM;AACtB,IAAI,QAAQ,EAAE,QAAQ;AACtB,GAAG;AACH,CAAC,CAAC,CAAC;;;;;"}
1
+ {"version":3,"file":"Progress.styles.js","sources":["../../../src/components/Progress/Progress.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineColor, keyframes } from '@mantine/styles';\n\nexport const sizes = {\n xs: 3,\n sm: 5,\n md: 8,\n lg: 12,\n xl: 16,\n};\n\ninterface ProgressStyles {\n color: MantineColor;\n radius: MantineNumberSize;\n size: MantineNumberSize;\n striped: boolean;\n animate: boolean;\n}\n\nconst stripesAnimation = keyframes({\n from: { backgroundPosition: '0 0' },\n to: { backgroundPosition: '40px 0' },\n});\n\nexport default createStyles((theme, { color, radius, size, striped, animate }: ProgressStyles) => ({\n root: {\n position: 'relative',\n height: theme.fn.size({ size, sizes }),\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[2],\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n overflow: 'hidden',\n },\n\n bar: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: theme.fn.themeColor(color || theme.primaryColor, 6, false),\n transition: 'width 100ms linear',\n animation: animate ? `${stripesAnimation} 1000ms linear infinite` : 'none',\n backgroundSize: '20px 20px',\n backgroundImage: striped\n ? 'linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)'\n : 'none',\n\n '&:last-of-type': {\n borderTopRightRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n borderBottomRightRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n },\n\n '&:first-of-type': {\n borderTopLeftRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n borderBottomLeftRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n },\n\n '@media (prefers-reduced-motion)': {\n transitionDuration: '0ms',\n },\n },\n\n label: {\n color: theme.white,\n fontSize: theme.fn.size({ size, sizes }) * 0.65,\n fontWeight: 700,\n userSelect: 'none',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n },\n}));\n"],"names":["keyframes","createStyles"],"mappings":";;;;;;AACY,MAAC,KAAK,GA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AAE,MAAM;AACtB,IAAI,QAAQ,EAAE,QAAQ;AACtB,IAAI,UAAU,EAAE,QAAQ;AACxB,GAAG;AACH,CAAC,CAAC,CAAC;;;;;"}
@@ -42,6 +42,7 @@ var __objRest = (source, exclude) => {
42
42
  const SegmentedControl = React.forwardRef((_a, ref) => {
43
43
  var _b = _a, {
44
44
  className,
45
+ disabled = false,
45
46
  data: _data,
46
47
  name,
47
48
  value,
@@ -54,9 +55,11 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
54
55
  transitionTimingFunction,
55
56
  classNames,
56
57
  styles,
57
- defaultValue
58
+ defaultValue,
59
+ orientation
58
60
  } = _b, others = __objRest(_b, [
59
61
  "className",
62
+ "disabled",
60
63
  "data",
61
64
  "name",
62
65
  "value",
@@ -69,7 +72,8 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
69
72
  "transitionTimingFunction",
70
73
  "classNames",
71
74
  "styles",
72
- "defaultValue"
75
+ "defaultValue",
76
+ "orientation"
73
77
  ]);
74
78
  const reduceMotion = hooks.useReducedMotion();
75
79
  const data = _data.map((item) => typeof item === "string" ? { label: item, value: item } : item);
@@ -88,9 +92,14 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
88
92
  radius,
89
93
  shouldAnimate: reduceMotion || !shouldAnimate,
90
94
  transitionDuration,
91
- transitionTimingFunction
95
+ transitionTimingFunction,
96
+ orientation
92
97
  }, { classNames, styles, name: "SegmentedControl" });
93
- const [activePosition, setActivePosition] = React.useState({ width: 0, translate: 0 });
98
+ const [activePosition, setActivePosition] = React.useState({
99
+ width: 0,
100
+ height: 0,
101
+ translate: [0, 0]
102
+ });
94
103
  const uuid = hooks.useUuid(name);
95
104
  const refs = React.useRef({});
96
105
  const [observerRef, containerRect] = hooks.useResizeObserver();
@@ -100,11 +109,16 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
100
109
  const elementRect = element.getBoundingClientRect();
101
110
  const scaledValue = element.offsetWidth / elementRect.width;
102
111
  const width = elementRect.width * scaledValue || 0;
112
+ const height = elementRect.height * scaledValue || 0;
103
113
  const offsetRight = containerRect.width - element.parentElement.offsetLeft + SegmentedControl_styles.WRAPPER_PADDING - width;
104
114
  const offsetLeft = element.parentElement.offsetLeft - SegmentedControl_styles.WRAPPER_PADDING;
105
115
  setActivePosition({
106
116
  width,
107
- translate: theme.dir === "rtl" ? offsetRight : offsetLeft
117
+ height,
118
+ translate: [
119
+ theme.dir === "rtl" ? offsetRight : offsetLeft,
120
+ element.parentElement.offsetTop - SegmentedControl_styles.WRAPPER_PADDING
121
+ ]
108
122
  });
109
123
  }
110
124
  }, [_value, containerRect]);
@@ -116,6 +130,7 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
116
130
  key: item.value
117
131
  }, /* @__PURE__ */ React__default.createElement("input", {
118
132
  className: classes.input,
133
+ disabled,
119
134
  type: "radio",
120
135
  name: uuid,
121
136
  value: item.value,
@@ -123,7 +138,10 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
123
138
  checked: _value === item.value,
124
139
  onChange: () => handleValueChange(item.value)
125
140
  }), /* @__PURE__ */ React__default.createElement("label", {
126
- className: cx(classes.label, { [classes.labelActive]: _value === item.value }),
141
+ className: cx(classes.label, {
142
+ [classes.labelActive]: _value === item.value,
143
+ [classes.disabled]: disabled
144
+ }),
127
145
  htmlFor: `${uuid}-${item.value}`,
128
146
  ref: (node) => {
129
147
  refs.current[item.value] = node;
@@ -137,7 +155,8 @@ const SegmentedControl = React.forwardRef((_a, ref) => {
137
155
  className: classes.active,
138
156
  sx: {
139
157
  width: activePosition.width,
140
- transform: `translateX(${activePosition.translate}px)`
158
+ height: activePosition.height,
159
+ transform: `translate(${activePosition.translate[0]}px, ${activePosition.translate[1]}px )`
141
160
  }
142
161
  }), controls);
143
162
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.js","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, forwardRef } from 'react';\nimport {\n useReducedMotion,\n useResizeObserver,\n useUncontrolled,\n useUuid,\n useMergedRef,\n} from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineSize,\n MantineColor,\n ClassNames,\n} from '@mantine/styles';\nimport { Box } from '../Box';\nimport useStyles, { WRAPPER_PADDING } from './SegmentedControl.styles';\n\nexport interface SegmentedControlItem {\n value: string;\n label: React.ReactNode;\n}\n\nexport type SegmentedControlStylesNames = ClassNames<typeof useStyles>;\n\nexport interface SegmentedControlProps\n extends DefaultProps<SegmentedControlStylesNames>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'value' | 'onChange'> {\n /** Data based on which controls are rendered */\n data: string[] | SegmentedControlItem[];\n\n /** Current selected value */\n value?: string;\n\n /** Called when value changes */\n onChange?(value: string): void;\n\n /** Name of the radio group, default to random id */\n name?: string;\n\n /** True if component should have 100% width */\n fullWidth?: boolean;\n\n /** Active control color from theme.colors, defaults to white in light color scheme and theme.colors.dark[9] in dark */\n color?: MantineColor;\n\n /** Controls font-size, paddings and height */\n size?: MantineSize;\n\n /** Border-radius from theme or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Transition duration in ms, set to 0 to turn off transitions */\n transitionDuration?: number;\n\n /** Transition timing function for all transitions, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n\n /** Default value for uncontrolled component */\n defaultValue?: string;\n}\n\nexport const SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n data: _data,\n name,\n value,\n onChange,\n color,\n fullWidth,\n radius = 'sm',\n size = 'sm',\n transitionDuration = 200,\n transitionTimingFunction,\n classNames,\n styles,\n defaultValue,\n ...others\n },\n ref\n ) => {\n const reduceMotion = useReducedMotion();\n const data = _data.map((item: any) =>\n typeof item === 'string' ? { label: item, value: item } : item\n );\n\n const [shouldAnimate, setShouldAnimate] = useState(false);\n const [_value, handleValueChange] = useUncontrolled({\n value,\n defaultValue,\n finalValue: Array.isArray(data) ? data[0].value : null,\n onChange,\n rule: (val) => !!val,\n });\n\n const { classes, cx, theme } = useStyles(\n {\n size,\n fullWidth,\n color,\n radius,\n shouldAnimate: reduceMotion || !shouldAnimate,\n transitionDuration,\n transitionTimingFunction,\n },\n { classNames, styles, name: 'SegmentedControl' }\n );\n\n const [activePosition, setActivePosition] = useState({ width: 0, translate: 0 });\n const uuid = useUuid(name);\n const refs = useRef<Record<string, HTMLLabelElement>>({});\n const [observerRef, containerRect] = useResizeObserver();\n\n useEffect(() => {\n if (_value in refs.current && observerRef.current) {\n const element = refs.current[_value];\n const elementRect = element.getBoundingClientRect();\n const scaledValue = element.offsetWidth / elementRect.width;\n const width = elementRect.width * scaledValue || 0;\n\n const offsetRight =\n containerRect.width - element.parentElement.offsetLeft + WRAPPER_PADDING - width;\n const offsetLeft = element.parentElement.offsetLeft - WRAPPER_PADDING;\n\n setActivePosition({\n width,\n translate: theme.dir === 'rtl' ? offsetRight : offsetLeft,\n });\n }\n }, [_value, containerRect]);\n\n useEffect(() => {\n setShouldAnimate(true);\n }, []);\n\n const controls = data.map((item) => (\n <div\n className={cx(classes.control, { [classes.controlActive]: _value === item.value })}\n key={item.value}\n >\n <input\n className={classes.input}\n type=\"radio\"\n name={uuid}\n value={item.value}\n id={`${uuid}-${item.value}`}\n checked={_value === item.value}\n onChange={() => handleValueChange(item.value)}\n />\n\n <label\n className={cx(classes.label, { [classes.labelActive]: _value === item.value })}\n htmlFor={`${uuid}-${item.value}`}\n ref={(node) => {\n refs.current[item.value] = node;\n }}\n >\n {item.label}\n </label>\n </div>\n ));\n\n return (\n <Box className={cx(classes.root, className)} ref={useMergedRef(observerRef, ref)} {...others}>\n {!!_value && (\n <Box\n component=\"span\"\n className={classes.active}\n sx={{\n width: activePosition.width,\n transform: `translateX(${activePosition.translate}px)`,\n }}\n />\n )}\n\n {controls}\n </Box>\n );\n }\n);\n\nSegmentedControl.displayName = '@mantine/core/SegmentedControl';\n"],"names":["forwardRef","useReducedMotion","useState","useUncontrolled","useStyles","useUuid","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AAC,IAAI,EAAE,SAAS,CAAC;AAC1C,IAAI,GAAG,EAAEC,kBAAY,CAAC,WAAW,EAAE,GAAG,CAAC;AACvC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,oBAAoBF,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE;AACnE,IAAI,SAAS,EAAE,MAAM;AACrB,IAAI,SAAS,EAAE,OAAO,CAAC,MAAM;AAC7B,IAAI,EAAE,EAAE;AACR,MAAM,KAAK,EAAE,cAAc,CAAC,KAAK;AACjC,MAAM,SAAS,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC;AAC5D,KAAK;AACL,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;AAChB,CAAC,EAAE;AACH,gBAAgB,CAAC,WAAW,GAAG,gCAAgC;;;;"}
1
+ {"version":3,"file":"SegmentedControl.js","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, forwardRef } from 'react';\nimport {\n useReducedMotion,\n useResizeObserver,\n useUncontrolled,\n useUuid,\n useMergedRef,\n} from '@mantine/hooks';\nimport {\n DefaultProps,\n MantineNumberSize,\n MantineSize,\n MantineColor,\n ClassNames,\n} from '@mantine/styles';\nimport { Box } from '../Box';\nimport useStyles, { WRAPPER_PADDING } from './SegmentedControl.styles';\n\nexport interface SegmentedControlItem {\n value: string;\n label: React.ReactNode;\n}\n\nexport type SegmentedControlStylesNames = ClassNames<typeof useStyles>;\n\nexport interface SegmentedControlProps\n extends DefaultProps<SegmentedControlStylesNames>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'value' | 'onChange'> {\n /** Data based on which controls are rendered */\n data: string[] | SegmentedControlItem[];\n\n /** Current selected value */\n value?: string;\n\n /** Disabled input state */\n disabled?: boolean;\n\n /** Called when value changes */\n onChange?(value: string): void;\n\n /** Name of the radio group, default to random id */\n name?: string;\n\n /** True if component should have 100% width */\n fullWidth?: boolean;\n\n /** Active control color from theme.colors, defaults to white in light color scheme and theme.colors.dark[9] in dark */\n color?: MantineColor;\n\n /** Controls font-size, paddings and height */\n size?: MantineSize;\n\n /** Border-radius from theme or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Transition duration in ms, set to 0 to turn off transitions */\n transitionDuration?: number;\n\n /** Transition timing function for all transitions, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n\n /** Default value for uncontrolled component */\n defaultValue?: string;\n\n /** Display Vertically */\n orientation?: 'vertical' | 'horizontal';\n}\n\nexport const SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n disabled = false,\n data: _data,\n name,\n value,\n onChange,\n color,\n fullWidth,\n radius = 'sm',\n size = 'sm',\n transitionDuration = 200,\n transitionTimingFunction,\n classNames,\n styles,\n defaultValue,\n orientation,\n ...others\n },\n ref\n ) => {\n const reduceMotion = useReducedMotion();\n const data = _data.map((item: any) =>\n typeof item === 'string' ? { label: item, value: item } : item\n );\n\n const [shouldAnimate, setShouldAnimate] = useState(false);\n const [_value, handleValueChange] = useUncontrolled({\n value,\n defaultValue,\n finalValue: Array.isArray(data) ? data[0].value : null,\n onChange,\n rule: (val) => !!val,\n });\n\n const { classes, cx, theme } = useStyles(\n {\n size,\n fullWidth,\n color,\n radius,\n shouldAnimate: reduceMotion || !shouldAnimate,\n transitionDuration,\n transitionTimingFunction,\n orientation,\n },\n { classNames, styles, name: 'SegmentedControl' }\n );\n\n const [activePosition, setActivePosition] = useState({\n width: 0,\n height: 0,\n translate: [0, 0],\n });\n const uuid = useUuid(name);\n const refs = useRef<Record<string, HTMLLabelElement>>({});\n const [observerRef, containerRect] = useResizeObserver();\n\n useEffect(() => {\n if (_value in refs.current && observerRef.current) {\n const element = refs.current[_value];\n const elementRect = element.getBoundingClientRect();\n const scaledValue = element.offsetWidth / elementRect.width;\n const width = elementRect.width * scaledValue || 0;\n const height = elementRect.height * scaledValue || 0;\n\n const offsetRight =\n containerRect.width - element.parentElement.offsetLeft + WRAPPER_PADDING - width;\n const offsetLeft = element.parentElement.offsetLeft - WRAPPER_PADDING;\n\n setActivePosition({\n width,\n height,\n translate: [\n theme.dir === 'rtl' ? offsetRight : offsetLeft,\n element.parentElement.offsetTop - WRAPPER_PADDING,\n ],\n });\n }\n }, [_value, containerRect]);\n\n useEffect(() => {\n setShouldAnimate(true);\n }, []);\n\n const controls = data.map((item) => (\n <div\n className={cx(classes.control, { [classes.controlActive]: _value === item.value })}\n key={item.value}\n >\n <input\n className={classes.input}\n disabled={disabled}\n type=\"radio\"\n name={uuid}\n value={item.value}\n id={`${uuid}-${item.value}`}\n checked={_value === item.value}\n onChange={() => handleValueChange(item.value)}\n />\n\n <label\n className={cx(classes.label, {\n [classes.labelActive]: _value === item.value,\n [classes.disabled]: disabled,\n })}\n htmlFor={`${uuid}-${item.value}`}\n ref={(node) => {\n refs.current[item.value] = node;\n }}\n >\n {item.label}\n </label>\n </div>\n ));\n\n return (\n <Box className={cx(classes.root, className)} ref={useMergedRef(observerRef, ref)} {...others}>\n {!!_value && (\n <Box\n component=\"span\"\n className={classes.active}\n sx={{\n width: activePosition.width,\n height: activePosition.height,\n transform: `translate(${activePosition.translate[0]}px, ${activePosition.translate[1]}px )`,\n }}\n />\n )}\n\n {controls}\n </Box>\n );\n }\n);\n\nSegmentedControl.displayName = '@mantine/core/SegmentedControl';\n"],"names":["forwardRef","useReducedMotion","useState","useUncontrolled","useStyles","useUuid","useRef","useResizeObserver","useEffect","WRAPPER_PADDING","React","Box","useMergedRef"],"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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,uBAAuBA,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE,cAAc,CAAC;AACjE,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,IAAI,GAAG,EAAEC,kBAAY,CAAC,WAAW,EAAE,GAAG,CAAC;AACvC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,oBAAoBF,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE;AACnE,IAAI,SAAS,EAAE,MAAM;AACrB,IAAI,SAAS,EAAE,OAAO,CAAC,MAAM;AAC7B,IAAI,EAAE,EAAE;AACR,MAAM,KAAK,EAAE,cAAc,CAAC,KAAK;AACjC,MAAM,MAAM,EAAE,cAAc,CAAC,MAAM;AACnC,MAAM,SAAS,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjG,KAAK;AACL,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;AAChB,CAAC,EAAE;AACH,gBAAgB,CAAC,WAAW,GAAG,gCAAgC;;;;"}
@@ -38,13 +38,15 @@ var useStyles = styles.createStyles((theme, {
38
38
  shouldAnimate,
39
39
  transitionDuration,
40
40
  transitionTimingFunction,
41
- size
41
+ size,
42
+ orientation
42
43
  }, getRef) => {
43
44
  const label = getRef("label");
44
45
  const control = getRef("control");
46
+ const vertical = orientation === "vertical";
45
47
  return {
46
48
  label: __spreadProps(__spreadValues(__spreadValues({
47
- ref: getRef("label")
49
+ ref: label
48
50
  }, theme.fn.focusStyles()), theme.fn.fontStyles()), {
49
51
  WebkitTapHighlightColor: "transparent",
50
52
  borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),
@@ -65,14 +67,16 @@ var useStyles = styles.createStyles((theme, {
65
67
  }
66
68
  }),
67
69
  control: {
68
- ref: getRef("control"),
70
+ ref: control,
69
71
  position: "relative",
70
72
  boxSizing: "border-box",
71
73
  flex: 1,
72
74
  zIndex: 2,
73
75
  transition: `border-left-color ${shouldAnimate ? 0 : transitionDuration}ms ${transitionTimingFunction || theme.transitionTimingFunction}`,
74
76
  "&:not(:first-of-type)": {
75
- borderLeft: `1px solid ${theme.colorScheme === "dark" ? theme.colors.dark[4] : theme.colors.gray[3]}`
77
+ borderStyle: "solid",
78
+ borderWidth: orientation === "vertical" ? "1px 0 0 0" : "0 0 0 1px",
79
+ borderColor: theme.colorScheme === "dark" ? theme.colors.dark[4] : theme.colors.gray[3]
76
80
  }
77
81
  },
78
82
  input: {
@@ -97,7 +101,9 @@ var useStyles = styles.createStyles((theme, {
97
101
  },
98
102
  root: {
99
103
  position: "relative",
100
- display: fullWidth ? "flex" : "inline-flex",
104
+ display: fullWidth || vertical ? "flex" : "inline-flex",
105
+ width: vertical && !fullWidth ? "max-content" : "inherit",
106
+ flexDirection: vertical ? "column" : "row",
101
107
  backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[8] : theme.colors.gray[1],
102
108
  borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),
103
109
  overflow: "hidden",
@@ -105,8 +111,10 @@ var useStyles = styles.createStyles((theme, {
105
111
  },
106
112
  controlActive: {
107
113
  borderLeftColor: "transparent !important",
114
+ borderTopColor: "transparent !important",
108
115
  [`& + .${control}`]: {
109
- borderLeftColor: "transparent !important"
116
+ borderLeftColor: "transparent !important",
117
+ borderTopColor: "transparent !important"
110
118
  }
111
119
  },
112
120
  labelActive: {
@@ -114,12 +122,15 @@ var useStyles = styles.createStyles((theme, {
114
122
  color: color in theme.colors || theme.colorScheme === "dark" ? theme.white : theme.black
115
123
  }
116
124
  },
125
+ disabled: {
126
+ "&, &:hover": {
127
+ color: theme.colorScheme === "dark" ? theme.colors.dark[3] : theme.colors.gray[5]
128
+ }
129
+ },
117
130
  active: {
118
131
  boxSizing: "border-box",
119
132
  borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),
120
133
  position: "absolute",
121
- top: 4,
122
- bottom: 4,
123
134
  zIndex: 1,
124
135
  boxShadow: color || theme.colorScheme === "dark" ? "none" : theme.shadows.xs,
125
136
  transition: `transform ${shouldAnimate ? 0 : transitionDuration}ms ${theme.transitionTimingFunction}, width ${shouldAnimate ? 0 : transitionDuration / 2}ms ${transitionTimingFunction || theme.transitionTimingFunction}`,
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.styles.js","sources":["../../../src/components/SegmentedControl/SegmentedControl.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineSize, MantineColor } from '@mantine/styles';\n\nexport const WRAPPER_PADDING = 4;\n\ninterface SegmentedControlStyles {\n fullWidth: boolean;\n color: MantineColor;\n radius: MantineNumberSize;\n shouldAnimate: boolean;\n transitionDuration: number;\n transitionTimingFunction: string;\n size: MantineSize;\n}\n\nconst sizes = {\n xs: '3px 6px',\n sm: '5px 10px',\n md: '7px 14px',\n lg: '9px 16px',\n xl: '12px 20px',\n};\n\nexport default createStyles(\n (\n theme,\n {\n fullWidth,\n color,\n radius,\n shouldAnimate,\n transitionDuration,\n transitionTimingFunction,\n size,\n }: SegmentedControlStyles,\n getRef\n ) => {\n const label = getRef('label');\n const control = getRef('control');\n\n return {\n label: {\n ref: getRef('label'),\n ...theme.fn.focusStyles(),\n ...theme.fn.fontStyles(),\n WebkitTapHighlightColor: 'transparent',\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n fontWeight: 500,\n fontSize: size in theme.fontSizes ? theme.fontSizes[size] : theme.fontSizes.sm,\n cursor: 'pointer',\n display: 'block',\n textAlign: 'center',\n padding: sizes[size in sizes ? size : 'sm'],\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n userSelect: 'none',\n color: theme.colorScheme === 'dark' ? theme.colors.dark[1] : theme.colors.gray[7],\n transition: `color ${shouldAnimate ? 0 : transitionDuration}ms ${\n transitionTimingFunction || theme.transitionTimingFunction\n }`,\n\n '&:hover': {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,\n },\n },\n\n control: {\n ref: getRef('control'),\n position: 'relative',\n boxSizing: 'border-box',\n flex: 1,\n zIndex: 2,\n transition: `border-left-color ${shouldAnimate ? 0 : transitionDuration}ms ${\n transitionTimingFunction || theme.transitionTimingFunction\n }`,\n\n '&:not(:first-of-type)': {\n borderLeft: `1px solid ${\n theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]\n }`,\n },\n },\n\n input: {\n height: 0,\n width: 0,\n position: 'absolute',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n opacity: 0,\n\n // input is hidden by default, these styles add focus to label when user navigates with keyboard\n '&:focus': {\n outline: 'none',\n\n [`& + .${label}`]: {\n outline: 'none',\n boxShadow: `0 0 0 2px ${\n theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.white\n }, 0 0 0 4px ${theme.colors[theme.primaryColor][5]}`,\n },\n\n '&:focus:not(:focus-visible)': {\n [`& + .${label}`]: {\n boxShadow: 'none',\n },\n },\n },\n },\n\n root: {\n position: 'relative',\n display: fullWidth ? 'flex' : 'inline-flex',\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[1],\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n overflow: 'hidden',\n padding: WRAPPER_PADDING,\n },\n\n controlActive: {\n borderLeftColor: 'transparent !important',\n\n [`& + .${control}`]: {\n borderLeftColor: 'transparent !important',\n },\n },\n\n labelActive: {\n '&, &:hover': {\n color: color in theme.colors || theme.colorScheme === 'dark' ? theme.white : theme.black,\n },\n },\n\n active: {\n boxSizing: 'border-box',\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n position: 'absolute',\n top: 4,\n bottom: 4,\n zIndex: 1,\n boxShadow: color || theme.colorScheme === 'dark' ? 'none' : theme.shadows.xs,\n transition: `transform ${shouldAnimate ? 0 : transitionDuration}ms ${\n theme.transitionTimingFunction\n }, width ${shouldAnimate ? 0 : transitionDuration / 2}ms ${\n transitionTimingFunction || theme.transitionTimingFunction\n }`,\n backgroundColor:\n color in theme.colors\n ? theme.fn.themeColor(color, 6)\n : theme.colorScheme === 'dark'\n ? theme.colors.dark[5]\n : theme.white,\n },\n };\n }\n);\n"],"names":["createStyles"],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,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,EA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AAwB,CAAC,QAAQ,EAAE,aAAa,GAAG,CAAC,GAAG,kBAAkB,GAAG,CAAC,CAAC,GAAG,EAAE,wBAAwB,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAChO,MAAM,eAAe,EAAE,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK;AAChJ,KAAK;AACL,GAAG,CAAC;AACJ,CAAC,CAAC;;;;;"}
1
+ {"version":3,"file":"SegmentedControl.styles.js","sources":["../../../src/components/SegmentedControl/SegmentedControl.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize, MantineSize, MantineColor } from '@mantine/styles';\n\nexport const WRAPPER_PADDING = 4;\n\ninterface SegmentedControlStyles {\n fullWidth: boolean;\n color: MantineColor;\n radius: MantineNumberSize;\n shouldAnimate: boolean;\n transitionDuration: number;\n transitionTimingFunction: string;\n size: MantineSize;\n orientation: 'vertical' | 'horizontal';\n}\n\nconst sizes = {\n xs: '3px 6px',\n sm: '5px 10px',\n md: '7px 14px',\n lg: '9px 16px',\n xl: '12px 20px',\n};\n\nexport default createStyles(\n (\n theme,\n {\n fullWidth,\n color,\n radius,\n shouldAnimate,\n transitionDuration,\n transitionTimingFunction,\n size,\n orientation,\n }: SegmentedControlStyles,\n getRef\n ) => {\n const label = getRef('label');\n const control = getRef('control');\n const vertical = orientation === 'vertical';\n\n return {\n label: {\n ref: label,\n ...theme.fn.focusStyles(),\n ...theme.fn.fontStyles(),\n WebkitTapHighlightColor: 'transparent',\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n fontWeight: 500,\n fontSize: size in theme.fontSizes ? theme.fontSizes[size] : theme.fontSizes.sm,\n cursor: 'pointer',\n display: 'block',\n textAlign: 'center',\n padding: sizes[size in sizes ? size : 'sm'],\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n userSelect: 'none',\n color: theme.colorScheme === 'dark' ? theme.colors.dark[1] : theme.colors.gray[7],\n transition: `color ${shouldAnimate ? 0 : transitionDuration}ms ${\n transitionTimingFunction || theme.transitionTimingFunction\n }`,\n\n '&:hover': {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,\n },\n },\n\n control: {\n ref: control,\n position: 'relative',\n boxSizing: 'border-box',\n flex: 1,\n zIndex: 2,\n transition: `border-left-color ${shouldAnimate ? 0 : transitionDuration}ms ${\n transitionTimingFunction || theme.transitionTimingFunction\n }`,\n\n '&:not(:first-of-type)': {\n borderStyle: 'solid',\n borderWidth: orientation === 'vertical' ? '1px 0 0 0' : '0 0 0 1px',\n borderColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3],\n },\n },\n\n input: {\n height: 0,\n width: 0,\n position: 'absolute',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n opacity: 0,\n\n // input is hidden by default, these styles add focus to label when user navigates with keyboard\n '&:focus': {\n outline: 'none',\n\n [`& + .${label}`]: {\n outline: 'none',\n boxShadow: `0 0 0 2px ${\n theme.colorScheme === 'dark' ? theme.colors.dark[9] : theme.white\n }, 0 0 0 4px ${theme.colors[theme.primaryColor][5]}`,\n },\n\n '&:focus:not(:focus-visible)': {\n [`& + .${label}`]: {\n boxShadow: 'none',\n },\n },\n },\n },\n\n root: {\n position: 'relative',\n display: fullWidth || vertical ? 'flex' : 'inline-flex',\n width: vertical && !fullWidth ? 'max-content' : 'inherit',\n flexDirection: vertical ? 'column' : 'row',\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[1],\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n overflow: 'hidden',\n padding: WRAPPER_PADDING,\n },\n\n controlActive: {\n borderLeftColor: 'transparent !important',\n borderTopColor: 'transparent !important',\n\n [`& + .${control}`]: {\n borderLeftColor: 'transparent !important',\n borderTopColor: 'transparent !important',\n },\n },\n\n labelActive: {\n '&, &:hover': {\n color: color in theme.colors || theme.colorScheme === 'dark' ? theme.white : theme.black,\n },\n },\n\n disabled: {\n '&, &:hover': {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],\n },\n },\n\n active: {\n boxSizing: 'border-box',\n borderRadius: theme.fn.size({ size: radius, sizes: theme.radius }),\n position: 'absolute',\n zIndex: 1,\n boxShadow: color || theme.colorScheme === 'dark' ? 'none' : theme.shadows.xs,\n transition: `transform ${shouldAnimate ? 0 : transitionDuration}ms ${\n theme.transitionTimingFunction\n }, width ${shouldAnimate ? 0 : transitionDuration / 2}ms ${\n transitionTimingFunction || theme.transitionTimingFunction\n }`,\n backgroundColor:\n color in theme.colors\n ? theme.fn.themeColor(color, 6)\n : theme.colorScheme === 'dark'\n ? theme.colors.dark[5]\n : theme.white,\n },\n };\n }\n);\n"],"names":["createStyles"],"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,KAA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AC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK;AAChJ,KAAK;AACL,GAAG,CAAC;AACJ,CAAC,CAAC;;;;;"}
@@ -357,6 +357,7 @@ const Select = React.forwardRef((_a, ref) => {
357
357
  typeof onFocus === "function" && onFocus(event);
358
358
  if (searchable) {
359
359
  setDropdownOpened(true);
360
+ scrollSelectedItemIntoView();
360
361
  }
361
362
  };
362
363
  const handleInputChange = (event) => {
@@ -368,12 +369,12 @@ const Select = React.forwardRef((_a, ref) => {
368
369
  setDropdownOpened(true);
369
370
  };
370
371
  const handleInputClick = () => {
372
+ let dropdownOpen = true;
371
373
  if (!searchable) {
372
- setDropdownOpened(!dropdownOpened);
373
- } else {
374
- setDropdownOpened(true);
374
+ dropdownOpen = !dropdownOpened;
375
375
  }
376
- if (_value && !dropdownOpened) {
376
+ setDropdownOpened(dropdownOpen);
377
+ if (_value && dropdownOpen) {
377
378
  setHovered(selectedItemIndex);
378
379
  scrollSelectedItemIntoView();
379
380
  }
@@ -421,6 +422,7 @@ const Select = React.forwardRef((_a, ref) => {
421
422
  disabled,
422
423
  "data-mantine-stop-propagation": shouldShowDropdown,
423
424
  autoComplete: "off",
425
+ name,
424
426
  classNames: __spreadProps(__spreadValues({}, classNames), {
425
427
  input: cx({ [classes.input]: !searchable }, classNames == null ? void 0 : classNames.input)
426
428
  })
@@ -470,11 +472,7 @@ const Select = React.forwardRef((_a, ref) => {
470
472
  nothingFound,
471
473
  creatable: isCreatable && !!createLabel,
472
474
  createLabel
473
- }))), name && /* @__PURE__ */ React__default.createElement("input", {
474
- type: "hidden",
475
- name,
476
- value: _value || ""
477
- }));
475
+ }))));
478
476
  });
479
477
  Select.displayName = "@mantine/core/Select";
480
478