@mantine/core 9.3.1 → 9.3.2

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 (84) hide show
  1. package/cjs/components/Blockquote/Blockquote.module.cjs.map +1 -1
  2. package/cjs/components/Checkbox/Checkbox.cjs +2 -1
  3. package/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
  4. package/cjs/components/Combobox/Combobox.cjs +1 -0
  5. package/cjs/components/Combobox/Combobox.cjs.map +1 -1
  6. package/cjs/components/HoverCard/HoverCard.cjs +1 -0
  7. package/cjs/components/HoverCard/HoverCard.cjs.map +1 -1
  8. package/cjs/components/HoverCard/HoverCard.context.cjs.map +1 -1
  9. package/cjs/components/HoverCard/HoverCardTarget/HoverCardTarget.cjs +10 -2
  10. package/cjs/components/HoverCard/HoverCardTarget/HoverCardTarget.cjs.map +1 -1
  11. package/cjs/components/HoverCard/use-hover-card.cjs +24 -0
  12. package/cjs/components/HoverCard/use-hover-card.cjs.map +1 -1
  13. package/cjs/components/Pagination/Pagination.icons.cjs.map +1 -1
  14. package/cjs/components/PasswordInput/PasswordInput.cjs +3 -1
  15. package/cjs/components/PasswordInput/PasswordInput.cjs.map +1 -1
  16. package/cjs/components/Popover/Popover.cjs +2 -1
  17. package/cjs/components/Popover/Popover.cjs.map +1 -1
  18. package/cjs/components/Popover/Popover.context.cjs.map +1 -1
  19. package/cjs/components/Popover/PopoverDropdown/PopoverDropdown.cjs +1 -0
  20. package/cjs/components/Popover/PopoverDropdown/PopoverDropdown.cjs.map +1 -1
  21. package/cjs/components/Popover/use-popover.cjs +23 -11
  22. package/cjs/components/Popover/use-popover.cjs.map +1 -1
  23. package/cjs/components/Slider/Thumb/Thumb.cjs.map +1 -1
  24. package/cjs/components/Splitter/Splitter.cjs +5 -3
  25. package/cjs/components/Splitter/Splitter.cjs.map +1 -1
  26. package/cjs/components/Text/Text.module.cjs.map +1 -1
  27. package/cjs/components/Textarea/Autosize.cjs +14 -0
  28. package/cjs/components/Textarea/Autosize.cjs.map +1 -1
  29. package/cjs/components/Transition/Transition.cjs +17 -10
  30. package/cjs/components/Transition/Transition.cjs.map +1 -1
  31. package/cjs/core/Box/Box.cjs.map +1 -1
  32. package/cjs/core/styles-api/use-styles/use-styles.cjs.map +1 -1
  33. package/esm/components/Blockquote/Blockquote.module.mjs.map +1 -1
  34. package/esm/components/Checkbox/Checkbox.mjs +2 -1
  35. package/esm/components/Checkbox/Checkbox.mjs.map +1 -1
  36. package/esm/components/Combobox/Combobox.mjs +1 -0
  37. package/esm/components/Combobox/Combobox.mjs.map +1 -1
  38. package/esm/components/HoverCard/HoverCard.context.mjs.map +1 -1
  39. package/esm/components/HoverCard/HoverCard.mjs +1 -0
  40. package/esm/components/HoverCard/HoverCard.mjs.map +1 -1
  41. package/esm/components/HoverCard/HoverCardTarget/HoverCardTarget.mjs +10 -2
  42. package/esm/components/HoverCard/HoverCardTarget/HoverCardTarget.mjs.map +1 -1
  43. package/esm/components/HoverCard/use-hover-card.mjs +24 -0
  44. package/esm/components/HoverCard/use-hover-card.mjs.map +1 -1
  45. package/esm/components/Pagination/Pagination.icons.mjs.map +1 -1
  46. package/esm/components/PasswordInput/PasswordInput.mjs +3 -1
  47. package/esm/components/PasswordInput/PasswordInput.mjs.map +1 -1
  48. package/esm/components/Popover/Popover.context.mjs.map +1 -1
  49. package/esm/components/Popover/Popover.mjs +2 -1
  50. package/esm/components/Popover/Popover.mjs.map +1 -1
  51. package/esm/components/Popover/PopoverDropdown/PopoverDropdown.mjs +1 -0
  52. package/esm/components/Popover/PopoverDropdown/PopoverDropdown.mjs.map +1 -1
  53. package/esm/components/Popover/use-popover.mjs +23 -11
  54. package/esm/components/Popover/use-popover.mjs.map +1 -1
  55. package/esm/components/Slider/Thumb/Thumb.mjs.map +1 -1
  56. package/esm/components/Splitter/Splitter.mjs +5 -3
  57. package/esm/components/Splitter/Splitter.mjs.map +1 -1
  58. package/esm/components/Text/Text.module.mjs.map +1 -1
  59. package/esm/components/Textarea/Autosize.mjs +14 -0
  60. package/esm/components/Textarea/Autosize.mjs.map +1 -1
  61. package/esm/components/Transition/Transition.mjs +17 -10
  62. package/esm/components/Transition/Transition.mjs.map +1 -1
  63. package/esm/core/Box/Box.mjs.map +1 -1
  64. package/esm/core/styles-api/use-styles/use-styles.mjs.map +1 -1
  65. package/lib/components/HoverCard/HoverCard.context.d.ts +1 -0
  66. package/lib/components/HoverCard/use-hover-card.d.ts +1 -0
  67. package/lib/components/Input/use-input-props.d.ts +3 -3
  68. package/lib/components/MaskInput/use-mask-input-props.d.ts +2 -2
  69. package/lib/components/Pagination/Pagination.icons.d.ts +1 -1
  70. package/lib/components/Popover/Popover.context.d.ts +1 -0
  71. package/lib/components/Popover/Popover.d.ts +7 -0
  72. package/lib/components/Slider/Thumb/Thumb.d.ts +1 -1
  73. package/lib/components/Splitter/Splitter.d.ts +2 -0
  74. package/lib/components/Transition/Transition.d.ts +8 -1
  75. package/lib/core/Box/Box.d.ts +1 -1
  76. package/lib/core/styles-api/styles-api.types.d.ts +2 -2
  77. package/lib/core/styles-api/use-styles/use-styles.d.ts +1 -1
  78. package/package.json +2 -2
  79. package/styles/Blockquote.css +1 -1
  80. package/styles/Blockquote.layer.css +1 -1
  81. package/styles/Text.css +1 -1
  82. package/styles/Text.layer.css +1 -1
  83. package/styles.css +2 -2
  84. package/styles.layer.css +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverDropdown.cjs","names":["factory","useProps","usePopoverContext","useDirection","getArrowMergeDropdownStyles","OptionalPortal","Transition","FocusTrap","Box","closeOnEscape","rem","FloatingArrow","classes"],"sources":["../../../../src/components/Popover/PopoverDropdown/PopoverDropdown.tsx"],"sourcesContent":["import { useFocusReturn, useMergedRef } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n closeOnEscape,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n rem,\n useDirection,\n useProps,\n} from '../../../core';\nimport { FloatingArrow, getArrowMergeDropdownStyles } from '../../../utils/Floating';\nimport { FocusTrap } from '../../FocusTrap';\nimport { OptionalPortal } from '../../Portal';\nimport { Transition } from '../../Transition';\nimport type { PopoverStylesNames } from '../Popover';\nimport { usePopoverContext } from '../Popover.context';\nimport classes from '../Popover.module.css';\n\nexport interface PopoverDropdownProps\n extends BoxProps, CompoundStylesApiProps<PopoverDropdownFactory>, ElementProps<'div'> {}\n\nexport type PopoverDropdownFactory = Factory<{\n props: PopoverDropdownProps;\n ref: HTMLDivElement;\n stylesNames: PopoverStylesNames;\n compound: true;\n}>;\n\nexport const PopoverDropdown = factory<PopoverDropdownFactory>((_props) => {\n const props = useProps('PopoverDropdown', null, _props);\n const {\n className,\n style,\n vars,\n children,\n onKeyDownCapture,\n variant,\n classNames,\n styles,\n ref,\n ...others\n } = props;\n\n const ctx = usePopoverContext();\n const { dir } = useDirection();\n\n const mergeStyles =\n ctx.arrowPosition === 'merge' && ctx.withArrow\n ? getArrowMergeDropdownStyles({ position: ctx.placement, dir })\n : undefined;\n\n const returnFocus = useFocusReturn({\n opened: ctx.opened,\n shouldReturnFocus: ctx.returnFocus,\n });\n\n const accessibleProps = ctx.withRoles\n ? {\n 'aria-labelledby': ctx.getTargetId(),\n id: ctx.getDropdownId(),\n role: 'dialog',\n tabIndex: -1,\n }\n : {};\n\n const mergedRef = useMergedRef(ref, ctx.floating);\n\n if (ctx.disabled) {\n return null;\n }\n\n return (\n <OptionalPortal {...ctx.portalProps} withinPortal={ctx.withinPortal}>\n <Transition\n mounted={ctx.opened}\n {...ctx.transitionProps}\n transition={ctx.transitionProps?.transition || 'fade'}\n duration={ctx.transitionProps?.duration ?? 150}\n keepMounted={ctx.keepMounted}\n exitDuration={\n typeof ctx.transitionProps?.exitDuration === 'number'\n ? ctx.transitionProps.exitDuration\n : ctx.transitionProps?.duration\n }\n >\n {(transitionStyles) => (\n <FocusTrap active={ctx.trapFocus && ctx.opened} innerRef={mergedRef}>\n <Box\n {...accessibleProps}\n {...others}\n variant={variant}\n onKeyDownCapture={closeOnEscape(\n () => {\n ctx.onClose?.();\n ctx.onDismiss?.();\n },\n {\n active: ctx.closeOnEscape,\n onTrigger: returnFocus,\n onKeyDown: onKeyDownCapture,\n }\n )}\n data-position={ctx.placement}\n data-fixed={ctx.floatingStrategy === 'fixed' || undefined}\n {...ctx.getStyles('dropdown', {\n className,\n props,\n classNames,\n styles,\n style: [\n {\n ...transitionStyles,\n ...mergeStyles,\n zIndex: ctx.zIndex as React.CSSProperties['zIndex'],\n top: ctx.y ?? 0,\n left: ctx.x ?? 0,\n width: ctx.width === 'target' ? undefined : rem(ctx.width),\n ...(ctx.referenceHidden ? { display: 'none' } : null),\n },\n ctx.resolvedStyles?.dropdown,\n styles?.dropdown,\n style,\n ],\n })}\n >\n {children}\n\n <FloatingArrow\n ref={ctx.arrowRef}\n arrowX={ctx.arrowX}\n arrowY={ctx.arrowY}\n visible={ctx.withArrow}\n position={ctx.placement}\n arrowSize={ctx.arrowSize}\n arrowRadius={ctx.arrowRadius}\n arrowOffset={ctx.arrowOffset}\n arrowPosition={ctx.arrowPosition}\n {...ctx.getStyles('arrow', {\n props,\n classNames,\n styles,\n })}\n />\n </Box>\n </FocusTrap>\n )}\n </Transition>\n </OptionalPortal>\n );\n});\n\nPopoverDropdown.classes = classes;\nPopoverDropdown.displayName = '@mantine/core/PopoverDropdown';\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,MAAa,kBAAkBA,gBAAAA,SAAiC,WAAW;CACzE,MAAM,QAAQC,kBAAAA,SAAS,mBAAmB,MAAM,MAAM;CACtD,MAAM,EACJ,WACA,OACA,MACA,UACA,kBACA,SACA,YACA,QACA,KACA,GAAG,WACD;CAEJ,MAAM,MAAMC,wBAAAA,kBAAkB;CAC9B,MAAM,EAAE,QAAQC,0BAAAA,aAAa;CAE7B,MAAM,cACJ,IAAI,kBAAkB,WAAW,IAAI,YACjCC,kCAAAA,4BAA4B;EAAE,UAAU,IAAI;EAAW;CAAI,CAAC,IAC5D,KA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AAkB,EAAE,SAAS,OAAO,IAAI;OAClD;OACA,IAAI,gBAAgB;OACpB,QAAQ;OACR;MACF;KACF,CAAC;eApCH,CAsCG,UAED,iBAAA,GAAA,kBAAA,KAACC,sBAAAA,eAAD;MACE,KAAK,IAAI;MACT,QAAQ,IAAI;MACZ,QAAQ,IAAI;MACZ,SAAS,IAAI;MACb,UAAU,IAAI;MACd,WAAW,IAAI;MACf,aAAa,IAAI;MACjB,aAAa,IAAI;MACjB,eAAe,IAAI;MACnB,GAAI,IAAI,UAAU,SAAS;OACzB;OACA;OACA;MACF,CAAC;KACF,CAAA,CACE;;GACI,CAAA;EAEH,CAAA;CACE,CAAA;AAEpB,CAAC;AAED,gBAAgB,UAAUC,uBAAAA;AAC1B,gBAAgB,cAAc"}
1
+ {"version":3,"file":"PopoverDropdown.cjs","names":["factory","useProps","usePopoverContext","useDirection","getArrowMergeDropdownStyles","OptionalPortal","Transition","FocusTrap","Box","closeOnEscape","rem","FloatingArrow","classes"],"sources":["../../../../src/components/Popover/PopoverDropdown/PopoverDropdown.tsx"],"sourcesContent":["import { useFocusReturn, useMergedRef } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n closeOnEscape,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n rem,\n useDirection,\n useProps,\n} from '../../../core';\nimport { FloatingArrow, getArrowMergeDropdownStyles } from '../../../utils/Floating';\nimport { FocusTrap } from '../../FocusTrap';\nimport { OptionalPortal } from '../../Portal';\nimport { Transition } from '../../Transition';\nimport type { PopoverStylesNames } from '../Popover';\nimport { usePopoverContext } from '../Popover.context';\nimport classes from '../Popover.module.css';\n\nexport interface PopoverDropdownProps\n extends BoxProps, CompoundStylesApiProps<PopoverDropdownFactory>, ElementProps<'div'> {}\n\nexport type PopoverDropdownFactory = Factory<{\n props: PopoverDropdownProps;\n ref: HTMLDivElement;\n stylesNames: PopoverStylesNames;\n compound: true;\n}>;\n\nexport const PopoverDropdown = factory<PopoverDropdownFactory>((_props) => {\n const props = useProps('PopoverDropdown', null, _props);\n const {\n className,\n style,\n vars,\n children,\n onKeyDownCapture,\n variant,\n classNames,\n styles,\n ref,\n ...others\n } = props;\n\n const ctx = usePopoverContext();\n const { dir } = useDirection();\n\n const mergeStyles =\n ctx.arrowPosition === 'merge' && ctx.withArrow\n ? getArrowMergeDropdownStyles({ position: ctx.placement, dir })\n : undefined;\n\n const returnFocus = useFocusReturn({\n opened: ctx.opened,\n shouldReturnFocus: ctx.returnFocus,\n });\n\n const accessibleProps = ctx.withRoles\n ? {\n 'aria-labelledby': ctx.getTargetId(),\n id: ctx.getDropdownId(),\n role: 'dialog',\n tabIndex: -1,\n }\n : {};\n\n const mergedRef = useMergedRef(ref, ctx.floating);\n\n if (ctx.disabled) {\n return null;\n }\n\n return (\n <OptionalPortal {...ctx.portalProps} withinPortal={ctx.withinPortal}>\n <Transition\n mounted={ctx.opened}\n {...ctx.transitionProps}\n transition={ctx.transitionProps?.transition || 'fade'}\n duration={ctx.transitionProps?.duration ?? 150}\n keepMounted={ctx.keepMounted}\n keepMountedMode={ctx.keepMountedMode}\n exitDuration={\n typeof ctx.transitionProps?.exitDuration === 'number'\n ? ctx.transitionProps.exitDuration\n : ctx.transitionProps?.duration\n }\n >\n {(transitionStyles) => (\n <FocusTrap active={ctx.trapFocus && ctx.opened} innerRef={mergedRef}>\n <Box\n {...accessibleProps}\n {...others}\n variant={variant}\n onKeyDownCapture={closeOnEscape(\n () => {\n ctx.onClose?.();\n ctx.onDismiss?.();\n },\n {\n active: ctx.closeOnEscape,\n onTrigger: returnFocus,\n onKeyDown: onKeyDownCapture,\n }\n )}\n data-position={ctx.placement}\n data-fixed={ctx.floatingStrategy === 'fixed' || undefined}\n {...ctx.getStyles('dropdown', {\n className,\n props,\n classNames,\n styles,\n style: [\n {\n ...transitionStyles,\n ...mergeStyles,\n zIndex: ctx.zIndex as React.CSSProperties['zIndex'],\n top: ctx.y ?? 0,\n left: ctx.x ?? 0,\n width: ctx.width === 'target' ? undefined : rem(ctx.width),\n ...(ctx.referenceHidden ? { display: 'none' } : null),\n },\n ctx.resolvedStyles?.dropdown,\n styles?.dropdown,\n style,\n ],\n })}\n >\n {children}\n\n <FloatingArrow\n ref={ctx.arrowRef}\n arrowX={ctx.arrowX}\n arrowY={ctx.arrowY}\n visible={ctx.withArrow}\n position={ctx.placement}\n arrowSize={ctx.arrowSize}\n arrowRadius={ctx.arrowRadius}\n arrowOffset={ctx.arrowOffset}\n arrowPosition={ctx.arrowPosition}\n {...ctx.getStyles('arrow', {\n props,\n classNames,\n styles,\n })}\n />\n </Box>\n </FocusTrap>\n )}\n </Transition>\n </OptionalPortal>\n );\n});\n\nPopoverDropdown.classes = classes;\nPopoverDropdown.displayName = '@mantine/core/PopoverDropdown';\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,MAAa,kBAAkBA,gBAAAA,SAAiC,WAAW;CACzE,MAAM,QAAQC,kBAAAA,SAAS,mBAAmB,MAAM,MAAM;CACtD,MAAM,EACJ,WACA,OACA,MACA,UACA,kBACA,SACA,YACA,QACA,KACA,GAAG,WACD;CAEJ,MAAM,MAAMC,wBAAAA,kBAAkB;CAC9B,MAAM,EAAE,QAAQC,0BAAAA,aAAa;CAE7B,MAAM,cACJ,IAAI,kBAAkB,WAAW,IAAI,YACjCC,kCAAAA,4BAA4B;EAAE,UAAU,IAAI;EAAW;CAAI,CAAC,IAC5D,KAAA;CAEN,MAAM,eAAA,GAAA,eAAA,gBAA6B;EACjC,QAAQ,IAAI;EACZ,mBAAmB,IAAI;CACzB,CAAC;CAED,MAAM,kBAAkB,IAAI,YACxB;EACE,mBAAmB,IAAI,YAAY;EACnC,IAAI,IAAI,cAAc;EACtB,MAAM;EACN,UAAU;CACZ,IACA,CAAC;CAEL,MAAM,aAAA,GAAA,eAAA,cAAyB,KAAK,IAAI,QAAQ;CAEhD,IAAI,IAAI,UACN,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,KAACC,uBAAAA,gBAAD;EAAgB,GAAI,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;OACA;MACF,CAAC;KACF,CAAA,CACE;;GACI,CAAA;EAEH,CAAA;CACE,CAAA;AAEpB,CAAC;AAED,gBAAgB,UAAUC,uBAAAA;AAC1B,gBAAgB,cAAc"}
@@ -24,14 +24,18 @@ function getPopoverMiddlewares(options, getFloating, disableFlip, lockEnabled) {
24
24
  } : userFlip;
25
25
  middlewares.push((0, _floating_ui_react.flip)(flipOptions));
26
26
  }
27
- if (middlewaresOptions.shift) middlewares.push((0, _floating_ui_react.shift)(typeof middlewaresOptions.shift === "boolean" ? {
28
- limiter: (0, _floating_ui_react.limitShift)(),
29
- padding: 5
30
- } : {
31
- limiter: (0, _floating_ui_react.limitShift)(),
32
- padding: 5,
33
- ...middlewaresOptions.shift
34
- }));
27
+ if (middlewaresOptions.shift) {
28
+ const shiftOptions = typeof middlewaresOptions.shift === "boolean" ? {} : middlewaresOptions.shift;
29
+ middlewares.push((0, _floating_ui_react.shift)((state) => {
30
+ const isVerticalPlacement = state.placement.startsWith("top") || state.placement.startsWith("bottom");
31
+ return {
32
+ limiter: (0, _floating_ui_react.limitShift)(),
33
+ padding: 5,
34
+ ...options.width === "target" && isVerticalPlacement ? { mainAxis: false } : null,
35
+ ...shiftOptions
36
+ };
37
+ }));
38
+ }
35
39
  if (middlewaresOptions.inline) middlewares.push(typeof middlewaresOptions.inline === "boolean" ? (0, _floating_ui_react.inline)() : (0, _floating_ui_react.inline)(middlewaresOptions.inline));
36
40
  middlewares.push((0, _floating_ui_react.arrow)({
37
41
  element: options.arrowRef,
@@ -86,9 +90,17 @@ function usePopover(options) {
86
90
  whileElementsMounted: !options.keepMounted ? _floating_ui_react.autoUpdate : void 0
87
91
  });
88
92
  (0, react.useEffect)(() => {
89
- if (!floating.refs.reference.current || !floating.refs.floating.current) return;
90
- if (_opened) return (0, _floating_ui_react.autoUpdate)(floating.refs.reference.current, floating.refs.floating.current, floating.update);
91
- }, [_opened, floating.update]);
93
+ if (!options.keepMounted) return;
94
+ const referenceElement = floating.refs.reference.current;
95
+ const floatingElement = floating.refs.floating.current;
96
+ if (_opened && referenceElement && floatingElement) return (0, _floating_ui_react.autoUpdate)(referenceElement, floatingElement, floating.update);
97
+ }, [
98
+ options.keepMounted,
99
+ _opened,
100
+ floating.update,
101
+ floating.elements.reference,
102
+ floating.elements.floating
103
+ ]);
92
104
  const measuredAfterShowRef = (0, react.useRef)(false);
93
105
  (0, _mantine_hooks.useIsomorphicEffect)(() => {
94
106
  if (!_opened) {
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover.cjs","names":["autoUpdate"],"sources":["../../../src/components/Popover/use-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n arrow,\n autoUpdate,\n flip,\n hide,\n inline,\n limitShift,\n Middleware,\n offset,\n shift,\n size,\n useFloating,\n UseFloatingReturn,\n} from '@floating-ui/react';\nimport { useDidUpdate, useIsomorphicEffect, useUncontrolled } from '@mantine/hooks';\nimport { FloatingAxesOffsets, FloatingPosition, FloatingStrategy } from '../../utils/Floating';\nimport { PopoverMiddlewares, PopoverWidth } from './Popover.types';\n\ninterface UsePopoverOptions {\n offset: number | FloatingAxesOffsets;\n position: FloatingPosition;\n onPositionChange?: (position: FloatingPosition) => void;\n opened: boolean | undefined;\n defaultOpened: boolean | undefined;\n onChange?: (opened: boolean) => void;\n onClose?: () => void;\n onDismiss?: () => void;\n onOpen?: () => void;\n width: PopoverWidth;\n middlewares: PopoverMiddlewares | undefined;\n arrowRef: React.RefObject<HTMLDivElement | null>;\n arrowOffset: number;\n strategy?: FloatingStrategy;\n disabled: boolean | undefined;\n preventPositionChangeWhenVisible: boolean | undefined;\n keepMounted: boolean | undefined;\n}\n\nfunction getDefaultMiddlewares(middlewares: PopoverMiddlewares | undefined): PopoverMiddlewares {\n if (middlewares === undefined) {\n return { shift: true, flip: true };\n }\n\n const result = { ...middlewares };\n if (middlewares.shift === undefined) {\n result.shift = true;\n }\n\n if (middlewares.flip === undefined) {\n result.flip = true;\n }\n\n return result;\n}\n\nfunction getPopoverMiddlewares(\n options: UsePopoverOptions,\n getFloating: () => UseFloatingReturn<Element>,\n disableFlip: boolean,\n lockEnabled: boolean\n) {\n const middlewaresOptions = getDefaultMiddlewares(options.middlewares);\n const middlewares: Middleware[] = [offset(options.offset), hide()];\n\n if (middlewaresOptions.flip && !disableFlip) {\n const userFlip = typeof middlewaresOptions.flip === 'boolean' ? {} : middlewaresOptions.flip;\n const flipOptions = lockEnabled\n ? { fallbackStrategy: 'initialPlacement' as const, ...userFlip }\n : userFlip;\n middlewares.push(flip(flipOptions));\n }\n\n if (middlewaresOptions.shift) {\n middlewares.push(\n shift(\n typeof middlewaresOptions.shift === 'boolean'\n ? { limiter: limitShift(), padding: 5 }\n : { limiter: limitShift(), padding: 5, ...middlewaresOptions.shift }\n )\n );\n }\n\n if (middlewaresOptions.inline) {\n middlewares.push(\n typeof middlewaresOptions.inline === 'boolean' ? inline() : inline(middlewaresOptions.inline)\n );\n }\n\n middlewares.push(arrow({ element: options.arrowRef, padding: options.arrowOffset }));\n\n if (middlewaresOptions.size || options.width === 'target') {\n middlewares.push(\n size({\n ...(typeof middlewaresOptions.size === 'boolean' ? {} : middlewaresOptions.size),\n apply({ rects, availableWidth, availableHeight, ...rest }) {\n const floating = getFloating();\n const styles = floating.refs.floating.current?.style ?? {};\n\n if (middlewaresOptions.size) {\n // If custom apply function is given use that else set defaults\n if (typeof middlewaresOptions.size === 'object' && !!middlewaresOptions.size.apply) {\n middlewaresOptions.size.apply({ rects, availableWidth, availableHeight, ...rest });\n } else {\n Object.assign(styles, {\n maxWidth: `${availableWidth}px`,\n maxHeight: `${availableHeight}px`,\n });\n }\n }\n\n if (options.width === 'target') {\n Object.assign(styles, {\n width: `${rects.reference.width}px`,\n });\n }\n },\n })\n );\n }\n\n return middlewares;\n}\n\nexport function usePopover(options: UsePopoverOptions) {\n const [_opened, setOpened] = useUncontrolled({\n value: options.opened,\n defaultValue: options.defaultOpened,\n finalValue: false,\n onChange: options.onChange,\n });\n\n const previouslyOpened = useRef(_opened);\n\n const [lockedPlacement, setLockedPlacement] = useState<FloatingPosition | null>(null);\n const lockEnabled = options.preventPositionChangeWhenVisible !== false;\n\n const wasOpenedRef = useRef(_opened);\n if (_opened !== wasOpenedRef.current) {\n wasOpenedRef.current = _opened;\n if (_opened && lockedPlacement !== null) {\n setLockedPlacement(null);\n }\n }\n\n const resetLockedPlacement = useCallback(() => setLockedPlacement(null), []);\n\n const onClose = () => {\n if (_opened && !options.disabled) {\n setOpened(false);\n }\n };\n\n const onToggle = () => {\n if (!options.disabled) {\n setOpened(!_opened);\n }\n };\n\n const floating: UseFloatingReturn<Element> = useFloating({\n open: _opened,\n strategy: options.strategy,\n placement: lockEnabled ? (lockedPlacement ?? options.position) : options.position,\n middleware: getPopoverMiddlewares(\n options,\n () => floating,\n lockEnabled && lockedPlacement !== null,\n lockEnabled\n ),\n whileElementsMounted: !options.keepMounted ? autoUpdate : undefined,\n });\n\n useEffect(() => {\n if (!floating.refs.reference.current || !floating.refs.floating.current) {\n return;\n }\n\n if (_opened) {\n return autoUpdate(\n floating.refs.reference.current,\n floating.refs.floating.current,\n floating.update\n );\n }\n }, [_opened, floating.update]);\n\n const measuredAfterShowRef = useRef(false);\n\n useIsomorphicEffect(() => {\n if (!_opened) {\n measuredAfterShowRef.current = false;\n return;\n }\n\n if (!lockEnabled || lockedPlacement !== null) {\n return;\n }\n\n const flEl = floating.refs.floating.current as HTMLElement | null;\n if (!flEl || flEl.offsetHeight === 0 || flEl.offsetWidth === 0) {\n return;\n }\n\n if (!measuredAfterShowRef.current) {\n measuredAfterShowRef.current = true;\n floating.update();\n return;\n }\n\n if (floating.isPositioned) {\n setLockedPlacement(floating.placement);\n }\n }, [\n lockEnabled,\n _opened,\n floating.isPositioned,\n floating.placement,\n lockedPlacement,\n floating.update,\n ]);\n\n const previousPlacementRef = useRef(floating.placement);\n useIsomorphicEffect(() => {\n if (previousPlacementRef.current !== floating.placement) {\n previousPlacementRef.current = floating.placement;\n options.onPositionChange?.(floating.placement);\n }\n }, [floating.placement]);\n\n useDidUpdate(() => {\n if (_opened !== previouslyOpened.current) {\n if (!_opened) {\n options.onClose?.();\n } else {\n options.onOpen?.();\n }\n }\n\n previouslyOpened.current = _opened;\n }, [_opened, options.onClose, options.onOpen]);\n\n return {\n floating,\n controlled: typeof options.opened === 'boolean',\n opened: _opened,\n onClose,\n onToggle,\n resetLockedPlacement,\n };\n}\n"],"mappings":";;;;;AAuCA,SAAS,sBAAsB,aAAiE;CAC9F,IAAI,gBAAgB,KAAA,GAClB,OAAO;EAAE,OAAO;EAAM,MAAM;CAAK;CAGnC,MAAM,SAAS,EAAE,GAAG,YAAY;CAChC,IAAI,YAAY,UAAU,KAAA,GACxB,OAAO,QAAQ;CAGjB,IAAI,YAAY,SAAS,KAAA,GACvB,OAAO,OAAO;CAGhB,OAAO;AACT;AAEA,SAAS,sBACP,SACA,aACA,aACA,aACA;CACA,MAAM,qBAAqB,sBAAsB,QAAQ,WAAW;CACpE,MAAM,cAA4B,EAAA,GAAA,mBAAA,QAAQ,QAAQ,MAAM,IAAA,GAAA,mBAAA,MAAQ,CAAC;CAEjE,IAAI,mBAAmB,QAAQ,CAAC,aAAa;EAC3C,MAAM,WAAW,OAAO,mBAAmB,SAAS,YAAY,CAAC,IAAI,mBAAmB;EACxF,MAAM,cAAc,cAChB;GAAE,kBAAkB;GAA6B,GAAG;EAAS,IAC7D;EACJ,YAAY,MAAA,GAAA,mBAAA,MAAU,WAAW,CAAC;CACpC;CAEA,IAAI,mBAAmB,OACrB,YAAY,MAAA,GAAA,mBAAA,OAER,OAAO,mBAAmB,UAAU,YAChC;EAAE,UAAA,GAAA,mBAAA,YAAoB;EAAG,SAAS;CAAE,IACpC;EAAE,UAAA,GAAA,mBAAA,YAAoB;EAAG,SAAS;EAAG,GAAG,mBAAmB;CAAM,CACvE,CACF;CAGF,IAAI,mBAAmB,QACrB,YAAY,KACV,OAAO,mBAAmB,WAAW,aAAA,GAAA,mBAAA,QA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D,CAAA,GAAA,eAAA,2BAA0B;EACxB,IAAI,qBAAqB,YAAY,SAAS,WAAW;GACvD,qBAAqB,UAAU,SAAS;GACxC,QAAQ,mBAAmB,SAAS,SAAS;EAC/C;CACF,GAAG,CAAC,SAAS,SAAS,CAAC;CAEvB,CAAA,GAAA,eAAA,oBAAmB;EACjB,IAAI,YAAY,iBAAiB,SAC/B,IAAI,CAAC,SACH,QAAQ,UAAU;OAElB,QAAQ,SAAS;EAIrB,iBAAiB,UAAU;CAC7B,GAAG;EAAC;EAAS,QAAQ;EAAS,QAAQ;CAAM,CAAC;CAE7C,OAAO;EACL;EACA,YAAY,OAAO,QAAQ,WAAW;EACtC,QAAQ;EACR;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-popover.cjs","names":["autoUpdate"],"sources":["../../../src/components/Popover/use-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n arrow,\n autoUpdate,\n flip,\n hide,\n inline,\n limitShift,\n Middleware,\n offset,\n shift,\n size,\n useFloating,\n UseFloatingReturn,\n} from '@floating-ui/react';\nimport { useDidUpdate, useIsomorphicEffect, useUncontrolled } from '@mantine/hooks';\nimport { FloatingAxesOffsets, FloatingPosition, FloatingStrategy } from '../../utils/Floating';\nimport { PopoverMiddlewares, PopoverWidth } from './Popover.types';\n\ninterface UsePopoverOptions {\n offset: number | FloatingAxesOffsets;\n position: FloatingPosition;\n onPositionChange?: (position: FloatingPosition) => void;\n opened: boolean | undefined;\n defaultOpened: boolean | undefined;\n onChange?: (opened: boolean) => void;\n onClose?: () => void;\n onDismiss?: () => void;\n onOpen?: () => void;\n width: PopoverWidth;\n middlewares: PopoverMiddlewares | undefined;\n arrowRef: React.RefObject<HTMLDivElement | null>;\n arrowOffset: number;\n strategy?: FloatingStrategy;\n disabled: boolean | undefined;\n preventPositionChangeWhenVisible: boolean | undefined;\n keepMounted: boolean | undefined;\n}\n\nfunction getDefaultMiddlewares(middlewares: PopoverMiddlewares | undefined): PopoverMiddlewares {\n if (middlewares === undefined) {\n return { shift: true, flip: true };\n }\n\n const result = { ...middlewares };\n if (middlewares.shift === undefined) {\n result.shift = true;\n }\n\n if (middlewares.flip === undefined) {\n result.flip = true;\n }\n\n return result;\n}\n\nfunction getPopoverMiddlewares(\n options: UsePopoverOptions,\n getFloating: () => UseFloatingReturn<Element>,\n disableFlip: boolean,\n lockEnabled: boolean\n) {\n const middlewaresOptions = getDefaultMiddlewares(options.middlewares);\n const middlewares: Middleware[] = [offset(options.offset), hide()];\n\n if (middlewaresOptions.flip && !disableFlip) {\n const userFlip = typeof middlewaresOptions.flip === 'boolean' ? {} : middlewaresOptions.flip;\n const flipOptions = lockEnabled\n ? { fallbackStrategy: 'initialPlacement' as const, ...userFlip }\n : userFlip;\n middlewares.push(flip(flipOptions));\n }\n\n if (middlewaresOptions.shift) {\n const shiftOptions =\n typeof middlewaresOptions.shift === 'boolean' ? {} : middlewaresOptions.shift;\n middlewares.push(\n shift((state) => {\n const isVerticalPlacement =\n state.placement.startsWith('top') || state.placement.startsWith('bottom');\n return {\n limiter: limitShift(),\n padding: 5,\n ...(options.width === 'target' && isVerticalPlacement ? { mainAxis: false } : null),\n ...shiftOptions,\n };\n })\n );\n }\n\n if (middlewaresOptions.inline) {\n middlewares.push(\n typeof middlewaresOptions.inline === 'boolean' ? inline() : inline(middlewaresOptions.inline)\n );\n }\n\n middlewares.push(arrow({ element: options.arrowRef, padding: options.arrowOffset }));\n\n if (middlewaresOptions.size || options.width === 'target') {\n middlewares.push(\n size({\n ...(typeof middlewaresOptions.size === 'boolean' ? {} : middlewaresOptions.size),\n apply({ rects, availableWidth, availableHeight, ...rest }) {\n const floating = getFloating();\n const styles = floating.refs.floating.current?.style ?? {};\n\n if (middlewaresOptions.size) {\n // If custom apply function is given use that else set defaults\n if (typeof middlewaresOptions.size === 'object' && !!middlewaresOptions.size.apply) {\n middlewaresOptions.size.apply({ rects, availableWidth, availableHeight, ...rest });\n } else {\n Object.assign(styles, {\n maxWidth: `${availableWidth}px`,\n maxHeight: `${availableHeight}px`,\n });\n }\n }\n\n if (options.width === 'target') {\n Object.assign(styles, {\n width: `${rects.reference.width}px`,\n });\n }\n },\n })\n );\n }\n\n return middlewares;\n}\n\nexport function usePopover(options: UsePopoverOptions) {\n const [_opened, setOpened] = useUncontrolled({\n value: options.opened,\n defaultValue: options.defaultOpened,\n finalValue: false,\n onChange: options.onChange,\n });\n\n const previouslyOpened = useRef(_opened);\n\n const [lockedPlacement, setLockedPlacement] = useState<FloatingPosition | null>(null);\n const lockEnabled = options.preventPositionChangeWhenVisible !== false;\n\n const wasOpenedRef = useRef(_opened);\n if (_opened !== wasOpenedRef.current) {\n wasOpenedRef.current = _opened;\n if (_opened && lockedPlacement !== null) {\n setLockedPlacement(null);\n }\n }\n\n const resetLockedPlacement = useCallback(() => setLockedPlacement(null), []);\n\n const onClose = () => {\n if (_opened && !options.disabled) {\n setOpened(false);\n }\n };\n\n const onToggle = () => {\n if (!options.disabled) {\n setOpened(!_opened);\n }\n };\n\n const floating: UseFloatingReturn<Element> = useFloating({\n open: _opened,\n strategy: options.strategy,\n placement: lockEnabled ? (lockedPlacement ?? options.position) : options.position,\n middleware: getPopoverMiddlewares(\n options,\n () => floating,\n lockEnabled && lockedPlacement !== null,\n lockEnabled\n ),\n whileElementsMounted: !options.keepMounted ? autoUpdate : undefined,\n });\n\n useEffect(() => {\n if (!options.keepMounted) {\n return undefined;\n }\n\n const referenceElement = floating.refs.reference.current;\n const floatingElement = floating.refs.floating.current;\n\n if (_opened && referenceElement && floatingElement) {\n return autoUpdate(referenceElement, floatingElement, floating.update);\n }\n\n return undefined;\n }, [\n options.keepMounted,\n _opened,\n floating.update,\n floating.elements.reference,\n floating.elements.floating,\n ]);\n\n const measuredAfterShowRef = useRef(false);\n\n useIsomorphicEffect(() => {\n if (!_opened) {\n measuredAfterShowRef.current = false;\n return;\n }\n\n if (!lockEnabled || lockedPlacement !== null) {\n return;\n }\n\n const flEl = floating.refs.floating.current as HTMLElement | null;\n if (!flEl || flEl.offsetHeight === 0 || flEl.offsetWidth === 0) {\n return;\n }\n\n if (!measuredAfterShowRef.current) {\n measuredAfterShowRef.current = true;\n floating.update();\n return;\n }\n\n if (floating.isPositioned) {\n setLockedPlacement(floating.placement);\n }\n }, [\n lockEnabled,\n _opened,\n floating.isPositioned,\n floating.placement,\n lockedPlacement,\n floating.update,\n ]);\n\n const previousPlacementRef = useRef(floating.placement);\n useIsomorphicEffect(() => {\n if (previousPlacementRef.current !== floating.placement) {\n previousPlacementRef.current = floating.placement;\n options.onPositionChange?.(floating.placement);\n }\n }, [floating.placement]);\n\n useDidUpdate(() => {\n if (_opened !== previouslyOpened.current) {\n if (!_opened) {\n options.onClose?.();\n } else {\n options.onOpen?.();\n }\n }\n\n previouslyOpened.current = _opened;\n }, [_opened, options.onClose, options.onOpen]);\n\n return {\n floating,\n controlled: typeof options.opened === 'boolean',\n opened: _opened,\n onClose,\n onToggle,\n resetLockedPlacement,\n };\n}\n"],"mappings":";;;;;AAuCA,SAAS,sBAAsB,aAAiE;CAC9F,IAAI,gBAAgB,KAAA,GAClB,OAAO;EAAE,OAAO;EAAM,MAAM;CAAK;CAGnC,MAAM,SAAS,EAAE,GAAG,YAAY;CAChC,IAAI,YAAY,UAAU,KAAA,GACxB,OAAO,QAAQ;CAGjB,IAAI,YAAY,SAAS,KAAA,GACvB,OAAO,OAAO;CAGhB,OAAO;AACT;AAEA,SAAS,sBACP,SACA,aACA,aACA,aACA;CACA,MAAM,qBAAqB,sBAAsB,QAAQ,WAAW;CACpE,MAAM,cAA4B,EAAA,GAAA,mBAAA,QAAQ,QAAQ,MAAM,IAAA,GAAA,mBAAA,MAAQ,CAAC;CAEjE,IAAI,mBAAmB,QAAQ,CAAC,aAAa;EAC3C,MAAM,WAAW,OAAO,mBAAmB,SAAS,YAAY,CAAC,IAAI,mBAAmB;EACxF,MAAM,cAAc,cAChB;GAAE,kBAAkB;GAA6B,GAAG;EAAS,IAC7D;EACJ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S,SAAS;EAClB,SAAS,SAAS;CACpB,CAAC;CAED,MAAM,wBAAA,GAAA,MAAA,QAA8B,KAAK;CAEzC,CAAA,GAAA,eAAA,2BAA0B;EACxB,IAAI,CAAC,SAAS;GACZ,qBAAqB,UAAU;GAC/B;EACF;EAEA,IAAI,CAAC,eAAe,oBAAoB,MACtC;EAGF,MAAM,OAAO,SAAS,KAAK,SAAS;EACpC,IAAI,CAAC,QAAQ,KAAK,iBAAiB,KAAK,KAAK,gBAAgB,GAC3D;EAGF,IAAI,CAAC,qBAAqB,SAAS;GACjC,qBAAqB,UAAU;GAC/B,SAAS,OAAO;GAChB;EACF;EAEA,IAAI,SAAS,cACX,mBAAmB,SAAS,SAAS;CAEzC,GAAG;EACD;EACA;EACA,SAAS;EACT,SAAS;EACT;EACA,SAAS;CACX,CAAC;CAED,MAAM,wBAAA,GAAA,MAAA,QAA8B,SAAS,SAAS;CACtD,CAAA,GAAA,eAAA,2BAA0B;EACxB,IAAI,qBAAqB,YAAY,SAAS,WAAW;GACvD,qBAAqB,UAAU,SAAS;GACxC,QAAQ,mBAAmB,SAAS,SAAS;EAC/C;CACF,GAAG,CAAC,SAAS,SAAS,CAAC;CAEvB,CAAA,GAAA,eAAA,oBAAmB;EACjB,IAAI,YAAY,iBAAiB,SAC/B,IAAI,CAAC,SACH,QAAQ,UAAU;OAElB,QAAQ,SAAS;EAIrB,iBAAiB,UAAU;CAC7B,GAAG;EAAC;EAAS,QAAQ;EAAS,QAAQ;CAAM,CAAC;CAE7C,OAAO;EACL;EACA,YAAY,OAAO,QAAQ,WAAW;EACtC,QAAQ;EACR;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Thumb.cjs","names":["useSliderContext","Box","Transition"],"sources":["../../../../src/components/Slider/Thumb/Thumb.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Box } from '../../../core';\nimport { Transition, TransitionOverride } from '../../Transition';\nimport { useSliderContext } from '../Slider.context';\n\nexport interface ThumbProps extends Omit<React.ComponentProps<'div'>, 'value'> {\n max: number;\n min: number;\n value: number;\n position: number;\n dragging: boolean;\n label: React.ReactNode;\n thumbValueText?: string | ((value: number) => string);\n onKeyDownCapture?: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n onMouseDown?: (event: any) => void;\n labelTransitionProps: TransitionOverride | undefined;\n labelAlwaysOn: boolean | undefined;\n thumbLabel: string | undefined;\n showLabelOnHover: boolean | undefined;\n isHovered?: boolean;\n children?: React.ReactNode;\n disabled: boolean | undefined;\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function Thumb({\n max,\n min,\n value,\n position,\n label,\n dragging,\n onMouseDown,\n onKeyDownCapture,\n labelTransitionProps,\n labelAlwaysOn,\n thumbLabel,\n thumbValueText,\n onFocus,\n onBlur,\n showLabelOnHover,\n isHovered,\n children = null,\n disabled,\n orientation = 'horizontal',\n ref,\n}: ThumbProps) {\n const { getStyles } = useSliderContext();\n\n const [focused, setFocused] = useState(false);\n\n const isVisible = labelAlwaysOn || dragging || focused || (showLabelOnHover && isHovered);\n const valueText = typeof thumbValueText === 'function' ? thumbValueText(value) : thumbValueText;\n\n return (\n <Box<'div'>\n tabIndex={disabled ? -1 : 0}\n role=\"slider\"\n aria-label={thumbLabel}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-valuenow={value}\n aria-valuetext={valueText}\n aria-disabled={disabled}\n aria-orientation={orientation}\n ref={ref}\n __vars={{ '--slider-thumb-offset': `${position}%` }}\n {...getStyles('thumb', { focusable: true })}\n mod={{ dragging, disabled }}\n onFocus={(event) => {\n setFocused(true);\n typeof onFocus === 'function' && onFocus(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n typeof onBlur === 'function' && onBlur(event);\n }}\n onTouchStart={onMouseDown}\n onMouseDown={onMouseDown}\n onKeyDownCapture={onKeyDownCapture}\n onClick={(event) => event.stopPropagation()}\n >\n {children}\n <Transition\n mounted={label != null && !!isVisible}\n transition=\"fade\"\n duration={0}\n {...labelTransitionProps}\n >\n {(transitionStyles) => (\n <div {...getStyles('label', { style: transitionStyles })}>{label}</div>\n )}\n </Transition>\n </Box>\n );\n}\n\nThumb.displayName = '@mantine/core/SliderThumb';\n"],"mappings":";;;;;;;AA2BA,SAAgB,MAAM,EACpB,KACA,KACA,OACA,UACA,OACA,UACA,aACA,kBACA,sBACA,eACA,YACA,gBACA,SACA,QACA,kBACA,WACA,WAAW,MACX,UACA,cAAc,cACd,OACa;CACb,MAAM,EAAE,cAAcA,uBAAAA,iBAAiB;CAEvC,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,UAAuB,KAAK;CAE5C,MAAM,YAAY,iBAAiB,YAAY,WAAY,oBAAoB;CAC/E,MAAM,YAAY,OAAO,mBAAmB,aAAa,eAAe,KAAK,IAAI;CAEjF,OACE,iBAAA,GAAA,kBAAA,MAACC,YAAAA,KAAD;EACE,UAAU,WAAW,KAAK;EAC1B,MAAK;EACL,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,kBAAgB;EAChB,iBAAe;EACf,oBAAkB;EACb;EACL,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAAG;EAClD,GAAI,UAAU,SAAS,EAAE,WAAW,KAAK,CAAC;EAC1C,KAAK;GAAE;GAAU;EAAS;EAC1B,UAAU,UAAU;GAClB,WAAW,IAAI;GACf,OAAO,YAAY,cAAc,QAAQ,KAAK;EAChD;EACA,SAAS,UAAU;GACjB,WAAW,KAAK;GAChB,OAAO,WAAW,cAAc,OAAO,KAAK;EAC9C;EACA,cAAc;EACD;EACK;EAClB,UAAU,UAAU,MAAM,gBAAgB;YAzB5C,CA2BG,UACD,iBAAA,GAAA,kBAAA,KAACC,mBAAAA,YAAD;GACE,SAAS,SAAS,QAAQ,CAAC,CAAC;GAC5B,YAAW;GACX,UAAU;GACV,GAAI;cAEF,qBACA,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,GAAI,UAAU,SAAS,EAAE,OAAO,iBAAiB,CAAC;cAAI;GAAW,CAAA;EAE9D,CAAA,CACT;;AAET;AAEA,MAAM,cAAc"}
1
+ {"version":3,"file":"Thumb.cjs","names":["useSliderContext","Box","Transition"],"sources":["../../../../src/components/Slider/Thumb/Thumb.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Box } from '../../../core';\nimport { Transition, TransitionOverride } from '../../Transition';\nimport { useSliderContext } from '../Slider.context';\n\nexport interface ThumbProps extends Omit<React.ComponentProps<'div'>, 'value'> {\n max: number;\n min: number;\n value: number;\n position: number;\n dragging: boolean;\n label: React.ReactNode;\n thumbValueText?: string | ((value: number) => string);\n onKeyDownCapture?: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n onMouseDown?: (event: any) => void;\n labelTransitionProps: TransitionOverride | undefined;\n labelAlwaysOn: boolean | undefined;\n thumbLabel: string | undefined;\n showLabelOnHover: boolean | undefined;\n isHovered?: boolean;\n children?: React.ReactNode;\n disabled: boolean | undefined;\n orientation?: 'horizontal' | 'vertical';\n className?: string | undefined;\n style?: React.CSSProperties;\n}\n\nexport function Thumb({\n max,\n min,\n value,\n position,\n label,\n dragging,\n onMouseDown,\n onKeyDownCapture,\n labelTransitionProps,\n labelAlwaysOn,\n thumbLabel,\n thumbValueText,\n onFocus,\n onBlur,\n showLabelOnHover,\n isHovered,\n children = null,\n disabled,\n orientation = 'horizontal',\n ref,\n}: ThumbProps) {\n const { getStyles } = useSliderContext();\n\n const [focused, setFocused] = useState(false);\n\n const isVisible = labelAlwaysOn || dragging || focused || (showLabelOnHover && isHovered);\n const valueText = typeof thumbValueText === 'function' ? thumbValueText(value) : thumbValueText;\n\n return (\n <Box<'div'>\n tabIndex={disabled ? -1 : 0}\n role=\"slider\"\n aria-label={thumbLabel}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-valuenow={value}\n aria-valuetext={valueText}\n aria-disabled={disabled}\n aria-orientation={orientation}\n ref={ref}\n __vars={{ '--slider-thumb-offset': `${position}%` }}\n {...getStyles('thumb', { focusable: true })}\n mod={{ dragging, disabled }}\n onFocus={(event) => {\n setFocused(true);\n typeof onFocus === 'function' && onFocus(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n typeof onBlur === 'function' && onBlur(event);\n }}\n onTouchStart={onMouseDown}\n onMouseDown={onMouseDown}\n onKeyDownCapture={onKeyDownCapture}\n onClick={(event) => event.stopPropagation()}\n >\n {children}\n <Transition\n mounted={label != null && !!isVisible}\n transition=\"fade\"\n duration={0}\n {...labelTransitionProps}\n >\n {(transitionStyles) => (\n <div {...getStyles('label', { style: transitionStyles })}>{label}</div>\n )}\n </Transition>\n </Box>\n );\n}\n\nThumb.displayName = '@mantine/core/SliderThumb';\n"],"mappings":";;;;;;;AA2BA,SAAgB,MAAM,EACpB,KACA,KACA,OACA,UACA,OACA,UACA,aACA,kBACA,sBACA,eACA,YACA,gBACA,SACA,QACA,kBACA,WACA,WAAW,MACX,UACA,cAAc,cACd,OACa;CACb,MAAM,EAAE,cAAcA,uBAAAA,iBAAiB;CAEvC,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,UAAuB,KAAK;CAE5C,MAAM,YAAY,iBAAiB,YAAY,WAAY,oBAAoB;CAC/E,MAAM,YAAY,OAAO,mBAAmB,aAAa,eAAe,KAAK,IAAI;CAEjF,OACE,iBAAA,GAAA,kBAAA,MAACC,YAAAA,KAAD;EACE,UAAU,WAAW,KAAK;EAC1B,MAAK;EACL,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,kBAAgB;EAChB,iBAAe;EACf,oBAAkB;EACb;EACL,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAAG;EAClD,GAAI,UAAU,SAAS,EAAE,WAAW,KAAK,CAAC;EAC1C,KAAK;GAAE;GAAU;EAAS;EAC1B,UAAU,UAAU;GAClB,WAAW,IAAI;GACf,OAAO,YAAY,cAAc,QAAQ,KAAK;EAChD;EACA,SAAS,UAAU;GACjB,WAAW,KAAK;GAChB,OAAO,WAAW,cAAc,OAAO,KAAK;EAC9C;EACA,cAAc;EACD;EACK;EAClB,UAAU,UAAU,MAAM,gBAAgB;YAzB5C,CA2BG,UACD,iBAAA,GAAA,kBAAA,KAACC,mBAAAA,YAAD;GACE,SAAS,SAAS,QAAQ,CAAC,CAAC;GAC5B,YAAW;GACX,UAAU;GACV,GAAI;cAEF,qBACA,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,GAAI,UAAU,SAAS,EAAE,OAAO,iBAAiB,CAAC;cAAI;GAAW,CAAA;EAE9D,CAAA,CACT;;AAET;AAEA,MAAM,cAAc"}
@@ -18,7 +18,8 @@ let react_jsx_runtime = require("react/jsx-runtime");
18
18
  const defaultProps = {
19
19
  orientation: "horizontal",
20
20
  lineSize: 2,
21
- withHandle: true
21
+ withHandle: true,
22
+ resetOnDoubleClick: true
22
23
  };
23
24
  const varsResolver = require_create_vars_resolver.createVarsResolver((theme, { lineSize, handleColor }) => ({ root: {
24
25
  "--splitter-line-size": require_rem.rem(lineSize),
@@ -26,7 +27,7 @@ const varsResolver = require_create_vars_resolver.createVarsResolver((theme, { l
26
27
  } }));
27
28
  const Splitter = require_factory.factory((_props) => {
28
29
  const props = require_use_props.useProps("Splitter", defaultProps, _props);
29
- const { orientation, sizes: controlledSizes, onSizeChange, onResizeStart, onResizeEnd, onCollapseChange, redistribute, step, shiftStep, lineSize, handleColor, handleIcon, withHandle, splitterRef, children, className, classNames, style, styles, unstyled, vars, mod, attributes, ref, ...others } = props;
30
+ const { orientation, sizes: controlledSizes, onSizeChange, onResizeStart, onResizeEnd, onCollapseChange, redistribute, step, shiftStep, lineSize, handleColor, handleIcon, withHandle, resetOnDoubleClick, splitterRef, children, className, classNames, style, styles, unstyled, vars, mod, attributes, ref, ...others } = props;
30
31
  const { dir } = require_DirectionProvider.useDirection();
31
32
  const paneChildren = react.Children.toArray(children);
32
33
  const splitter = (0, _mantine_hooks.useSplitter)({
@@ -46,7 +47,8 @@ const Splitter = require_factory.factory((_props) => {
46
47
  redistribute,
47
48
  step,
48
49
  shiftStep,
49
- dir
50
+ dir,
51
+ resetOnDoubleClick
50
52
  });
51
53
  (0, react.useImperativeHandle)(splitterRef, () => splitter, [splitter]);
52
54
  const mergedRef = (0, _mantine_hooks.useMergedRef)(ref, splitter.ref);
@@ -1 +1 @@
1
- {"version":3,"file":"Splitter.cjs","names":["createVarsResolver","rem","getThemeColor","factory","useProps","useDirection","Children","useStyles","GripHorizontalIcon","GripVerticalIcon","Box","SplitterProvider","classes","SplitterPane"],"sources":["../../../src/components/Splitter/Splitter.tsx"],"sourcesContent":["import { Children, cloneElement, useImperativeHandle } from 'react';\nimport {\n useMergedRef,\n useSplitter,\n UseSplitterRedistributeFn,\n UseSplitterReturnValue,\n} from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n rem,\n StylesApiProps,\n useDirection,\n useProps,\n useStyles,\n} from '../../core';\nimport { GripHorizontalIcon, GripVerticalIcon } from './GripIcon';\nimport { SplitterProvider } from './Splitter.context';\nimport {\n SplitterPane,\n SplitterPaneProps,\n SplitterPaneStylesNames,\n} from './SplitterPane/SplitterPane';\nimport classes from './Splitter.module.css';\n\nexport type SplitterStylesNames = 'root' | 'handle' | 'thumb' | SplitterPaneStylesNames;\n\nexport type SplitterCssVariables = {\n root: '--splitter-line-size' | '--splitter-handle-color';\n};\n\nexport interface SplitterProps\n extends BoxProps, StylesApiProps<SplitterFactory>, ElementProps<'div'> {\n /** Layout direction @default 'horizontal' */\n orientation?: 'horizontal' | 'vertical';\n\n /** Controlled sizes (percentages summing to 100) */\n sizes?: number[];\n\n /** Called during resize with updated sizes */\n onSizeChange?: (sizes: number[]) => void;\n\n /** Called when drag starts */\n onResizeStart?: (handleIndex: number) => void;\n\n /** Called when drag ends */\n onResizeEnd?: (handleIndex: number, sizes: number[]) => void;\n\n /** Called when a panel collapses or expands */\n onCollapseChange?: (panelIndex: number, collapsed: boolean) => void;\n\n /** How to redistribute space when immediate neighbor is at its min/max */\n redistribute?: 'nearest' | 'equal' | UseSplitterRedistributeFn;\n\n /** Keyboard step size in percentage @default 1 */\n step?: number;\n\n /** Shift+arrow step size in percentage @default 10 */\n shiftStep?: number;\n\n /** CSS value for separator line thickness between panes @default 2 */\n lineSize?: number | string;\n\n /** Key of `theme.colors` or any valid CSS color for the separator line */\n handleColor?: MantineColor;\n\n /** Custom icon displayed in the handle thumb, by default uses grip icon based on orientation */\n handleIcon?: React.ReactNode;\n\n /** Determines whether the thumb with grip icon is displayed on the handle @default true */\n withHandle?: boolean;\n\n /** Ref to imperative splitter API (sizes, collapse, expand, etc.) */\n splitterRef?: React.RefObject<UseSplitterReturnValue | null>;\n\n /** Splitter panes */\n children?: React.ReactNode;\n}\n\nexport type SplitterFactory = Factory<{\n props: SplitterProps;\n ref: HTMLDivElement;\n stylesNames: SplitterStylesNames;\n vars: SplitterCssVariables;\n staticComponents: {\n Pane: typeof SplitterPane;\n };\n}>;\n\nconst defaultProps = {\n orientation: 'horizontal',\n lineSize: 2,\n withHandle: true,\n} satisfies Partial<SplitterProps>;\n\nconst varsResolver = createVarsResolver<SplitterFactory>((theme, { lineSize, handleColor }) => ({\n root: {\n '--splitter-line-size': rem(lineSize),\n '--splitter-handle-color': handleColor ? getThemeColor(handleColor, theme) : undefined,\n },\n}));\n\nexport const Splitter = factory<SplitterFactory>((_props) => {\n const props = useProps('Splitter', defaultProps, _props);\n const {\n orientation,\n sizes: controlledSizes,\n onSizeChange,\n onResizeStart,\n onResizeEnd,\n onCollapseChange,\n redistribute,\n step,\n shiftStep,\n lineSize,\n handleColor,\n handleIcon,\n withHandle,\n splitterRef,\n children,\n className,\n classNames,\n style,\n styles,\n unstyled,\n vars,\n mod,\n attributes,\n ref,\n ...others\n } = props;\n\n const { dir } = useDirection();\n\n const paneChildren = Children.toArray(children) as React.ReactElement<SplitterPaneProps>[];\n\n const panels = paneChildren.map((child) => ({\n defaultSize: child.props.defaultSize,\n min: child.props.min,\n max: child.props.max,\n collapsible: child.props.collapsible,\n collapseThreshold: child.props.collapseThreshold,\n }));\n\n const splitter = useSplitter({\n panels,\n orientation,\n sizes: controlledSizes,\n onSizeChange,\n onResizeStart,\n onResizeEnd,\n onCollapseChange,\n redistribute,\n step,\n shiftStep,\n dir,\n });\n\n useImperativeHandle(splitterRef, () => splitter, [splitter]);\n\n const mergedRef = useMergedRef(ref, splitter.ref);\n\n const getStyles = useStyles<SplitterFactory>({\n name: 'Splitter',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const defaultIcon = orientation === 'vertical' ? <GripHorizontalIcon /> : <GripVerticalIcon />;\n const thumbIcon = handleIcon !== undefined ? handleIcon : defaultIcon;\n\n const items: React.ReactNode[] = [];\n\n paneChildren.forEach((child, index) => {\n if (index > 0) {\n const handleProps = splitter.getHandleProps({ index: index - 1 });\n const isActive = splitter.activeHandle === index - 1;\n items.push(\n <Box {...getStyles('handle')} key={`handle-${index - 1}`} {...handleProps}>\n {withHandle && (\n <div\n {...getStyles('thumb')}\n data-orientation={orientation}\n data-active={isActive || undefined}\n >\n {thumbIcon}\n </div>\n )}\n </Box>\n );\n }\n\n items.push(\n cloneElement(child, {\n key: `pane-${index}`,\n __index: index,\n })\n );\n });\n\n return (\n <SplitterProvider\n value={{\n getStyles,\n sizes: splitter.sizes,\n collapsed: splitter.collapsed,\n orientation: orientation!,\n }}\n >\n <Box ref={mergedRef} {...getStyles('root')} mod={[{ orientation }, mod]} {...others}>\n {items}\n </Box>\n </SplitterProvider>\n );\n});\n\nSplitter.classes = classes;\nSplitter.varsResolver = varsResolver;\nSplitter.displayName = '@mantine/core/Splitter';\nSplitter.Pane = SplitterPane;\n"],"mappings":";;;;;;;;;;;;;;;;;AA+FA,MAAM,eAAe;CACnB,aAAa;CACb,UAAU;CACV,YAAY;AACd;AAEA,MAAM,eAAeA,6BAAAA,oBAAqC,OAAO,EAAE,UAAU,mBAAmB,EAC9F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AM,cAAc,SAAS,eAAe,EAAE,OAAO,QAAQ,EAAE,CAAC;GAChE,MAAM,WAAW,SAAS,iBAAiB,QAAQ;GACnD,MAAM,KACJ,iBAAA,GAAA,MAAA,eAACC,YAAAA,KAAD;IAAK,GAAI,UAAU,QAAQ;IAAG,KAAK,UAAU,QAAQ;IAAK,GAAI;GAUzD,GATF,cACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;IACE,GAAI,UAAU,OAAO;IACrB,oBAAkB;IAClB,eAAa,YAAY,KAAA;cAExB;GACE,CAAA,CAEJ,CACP;EACF;EAEA,MAAM,MAAA,GAAA,MAAA,cACS,OAAO;GAClB,KAAK,QAAQ;GACb,SAAS;EACX,CAAC,CACH;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,kBAAD;EACE,OAAO;GACL;GACA,OAAO,SAAS;GAChB,WAAW,SAAS;GACP;EACf;YAEA,iBAAA,GAAA,kBAAA,KAACD,YAAAA,KAAD;GAAK,KAAK;GAAW,GAAI,UAAU,MAAM;GAAG,KAAK,CAAC,EAAE,YAAY,GAAG,GAAG;GAAG,GAAI;aAC1E;EACE,CAAA;CACW,CAAA;AAEtB,CAAC;AAED,SAAS,UAAUE,wBAAAA;AACnB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,OAAOC,qBAAAA"}
1
+ {"version":3,"file":"Splitter.cjs","names":["createVarsResolver","rem","getThemeColor","factory","useProps","useDirection","Children","useStyles","GripHorizontalIcon","GripVerticalIcon","Box","SplitterProvider","classes","SplitterPane"],"sources":["../../../src/components/Splitter/Splitter.tsx"],"sourcesContent":["import { Children, cloneElement, useImperativeHandle } from 'react';\nimport {\n useMergedRef,\n useSplitter,\n UseSplitterRedistributeFn,\n UseSplitterReturnValue,\n} from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n rem,\n StylesApiProps,\n useDirection,\n useProps,\n useStyles,\n} from '../../core';\nimport { GripHorizontalIcon, GripVerticalIcon } from './GripIcon';\nimport { SplitterProvider } from './Splitter.context';\nimport {\n SplitterPane,\n SplitterPaneProps,\n SplitterPaneStylesNames,\n} from './SplitterPane/SplitterPane';\nimport classes from './Splitter.module.css';\n\nexport type SplitterStylesNames = 'root' | 'handle' | 'thumb' | SplitterPaneStylesNames;\n\nexport type SplitterCssVariables = {\n root: '--splitter-line-size' | '--splitter-handle-color';\n};\n\nexport interface SplitterProps\n extends BoxProps, StylesApiProps<SplitterFactory>, ElementProps<'div'> {\n /** Layout direction @default 'horizontal' */\n orientation?: 'horizontal' | 'vertical';\n\n /** Controlled sizes (percentages summing to 100) */\n sizes?: number[];\n\n /** Called during resize with updated sizes */\n onSizeChange?: (sizes: number[]) => void;\n\n /** Called when drag starts */\n onResizeStart?: (handleIndex: number) => void;\n\n /** Called when drag ends */\n onResizeEnd?: (handleIndex: number, sizes: number[]) => void;\n\n /** Called when a panel collapses or expands */\n onCollapseChange?: (panelIndex: number, collapsed: boolean) => void;\n\n /** How to redistribute space when immediate neighbor is at its min/max */\n redistribute?: 'nearest' | 'equal' | UseSplitterRedistributeFn;\n\n /** Keyboard step size in percentage @default 1 */\n step?: number;\n\n /** Shift+arrow step size in percentage @default 10 */\n shiftStep?: number;\n\n /** CSS value for separator line thickness between panes @default 2 */\n lineSize?: number | string;\n\n /** Key of `theme.colors` or any valid CSS color for the separator line */\n handleColor?: MantineColor;\n\n /** Custom icon displayed in the handle thumb, by default uses grip icon based on orientation */\n handleIcon?: React.ReactNode;\n\n /** Determines whether the thumb with grip icon is displayed on the handle @default true */\n withHandle?: boolean;\n\n /** Restore the two panes adjacent to a handle to their default ratio (preserving their combined size) when the handle is double-clicked @default true */\n resetOnDoubleClick?: boolean;\n\n /** Ref to imperative splitter API (sizes, collapse, expand, etc.) */\n splitterRef?: React.RefObject<UseSplitterReturnValue | null>;\n\n /** Splitter panes */\n children?: React.ReactNode;\n}\n\nexport type SplitterFactory = Factory<{\n props: SplitterProps;\n ref: HTMLDivElement;\n stylesNames: SplitterStylesNames;\n vars: SplitterCssVariables;\n staticComponents: {\n Pane: typeof SplitterPane;\n };\n}>;\n\nconst defaultProps = {\n orientation: 'horizontal',\n lineSize: 2,\n withHandle: true,\n resetOnDoubleClick: true,\n} satisfies Partial<SplitterProps>;\n\nconst varsResolver = createVarsResolver<SplitterFactory>((theme, { lineSize, handleColor }) => ({\n root: {\n '--splitter-line-size': rem(lineSize),\n '--splitter-handle-color': handleColor ? getThemeColor(handleColor, theme) : undefined,\n },\n}));\n\nexport const Splitter = factory<SplitterFactory>((_props) => {\n const props = useProps('Splitter', defaultProps, _props);\n const {\n orientation,\n sizes: controlledSizes,\n onSizeChange,\n onResizeStart,\n onResizeEnd,\n onCollapseChange,\n redistribute,\n step,\n shiftStep,\n lineSize,\n handleColor,\n handleIcon,\n withHandle,\n resetOnDoubleClick,\n splitterRef,\n children,\n className,\n classNames,\n style,\n styles,\n unstyled,\n vars,\n mod,\n attributes,\n ref,\n ...others\n } = props;\n\n const { dir } = useDirection();\n\n const paneChildren = Children.toArray(children) as React.ReactElement<SplitterPaneProps>[];\n\n const panels = paneChildren.map((child) => ({\n defaultSize: child.props.defaultSize,\n min: child.props.min,\n max: child.props.max,\n collapsible: child.props.collapsible,\n collapseThreshold: child.props.collapseThreshold,\n }));\n\n const splitter = useSplitter({\n panels,\n orientation,\n sizes: controlledSizes,\n onSizeChange,\n onResizeStart,\n onResizeEnd,\n onCollapseChange,\n redistribute,\n step,\n shiftStep,\n dir,\n resetOnDoubleClick,\n });\n\n useImperativeHandle(splitterRef, () => splitter, [splitter]);\n\n const mergedRef = useMergedRef(ref, splitter.ref);\n\n const getStyles = useStyles<SplitterFactory>({\n name: 'Splitter',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const defaultIcon = orientation === 'vertical' ? <GripHorizontalIcon /> : <GripVerticalIcon />;\n const thumbIcon = handleIcon !== undefined ? handleIcon : defaultIcon;\n\n const items: React.ReactNode[] = [];\n\n paneChildren.forEach((child, index) => {\n if (index > 0) {\n const handleProps = splitter.getHandleProps({ index: index - 1 });\n const isActive = splitter.activeHandle === index - 1;\n items.push(\n <Box {...getStyles('handle')} key={`handle-${index - 1}`} {...handleProps}>\n {withHandle && (\n <div\n {...getStyles('thumb')}\n data-orientation={orientation}\n data-active={isActive || undefined}\n >\n {thumbIcon}\n </div>\n )}\n </Box>\n );\n }\n\n items.push(\n cloneElement(child, {\n key: `pane-${index}`,\n __index: index,\n })\n );\n });\n\n return (\n <SplitterProvider\n value={{\n getStyles,\n sizes: splitter.sizes,\n collapsed: splitter.collapsed,\n orientation: orientation!,\n }}\n >\n <Box ref={mergedRef} {...getStyles('root')} mod={[{ orientation }, mod]} {...others}>\n {items}\n </Box>\n </SplitterProvider>\n );\n});\n\nSplitter.classes = classes;\nSplitter.varsResolver = varsResolver;\nSplitter.displayName = '@mantine/core/Splitter';\nSplitter.Pane = SplitterPane;\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,eAAe;CACnB,aAAa;CACb,UAAU;CACV,YAAY;CACZ,oBAAoB;AACtB;AAEA,MAAM,eAAeA,6BAAAA,oBAAqC,OAAO,EAAE,UAAU,mBAAmB,EAC9F,MAAM;CACJ,wBAAwBC,YAAAA,IAAI,QAAQ;CACpC,2BAA2B,cAAcC,wBAAAA,cAAc,aAAa,KAAK,IAAI,KAAA;AAC/E,EACF,EAAE;AAEF,MAAa,WAAWC,gBAAAA,SAA0B,WAAW;CAC3D,MAAM,QAAQC,kBAAAA,SAAS,YAAY,cAAc,MAAM;CACvD,MAAM,EACJ,aACA,OAAO,iBACP,cACA,eACA,aACA,kBACA,cACA,MACA,WACA,UACA,aACA,YACA,YACA,oBACA,aACA,UACA,WACA,YACA,OACA,QACA,UACA,MACA,KACA,YACA,KACA,GAAG,WACD;CAEJ,MAAM,EAAE,QAAQC,0BAAAA,aAAa;CAE7B,MAAM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GACb,SAAS;EACX,CAAC,CACH;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,kBAAD;EACE,OAAO;GACL;GACA,OAAO,SAAS;GAChB,WAAW,SAAS;GACP;EACf;YAEA,iBAAA,GAAA,kBAAA,KAACD,YAAAA,KAAD;GAAK,KAAK;GAAW,GAAI,UAAU,MAAM;GAAG,KAAK,CAAC,EAAE,YAAY,GAAG,GAAG;GAAG,GAAI;aAC1E;EACE,CAAA;CACW,CAAA;AAEtB,CAAC;AAED,SAAS,UAAUE,wBAAAA;AACnB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,OAAOC,qBAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Text.module.cjs","names":[],"sources":["../../../src/components/Text/Text.module.css"],"sourcesContent":[".root {\n -webkit-tap-highlight-color: transparent;\n text-decoration: none;\n font-size: var(--text-fz, var(--mantine-font-size-md));\n line-height: var(--text-lh, var(--mantine-line-height-md));\n font-weight: var(--mantine-font-weight-regular);\n text-wrap: var(--text-text-wrap, var(--mantine-text-wrap, wrap));\n margin: 0;\n padding: 0;\n\n &:where([data-truncate]) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &:where([data-truncate='start']) {\n direction: rtl;\n text-align: end;\n\n @mixin where-rtl {\n direction: ltr;\n text-align: start;\n }\n }\n\n &:where([data-variant='gradient']) {\n background-image: var(--text-gradient);\n background-clip: text;\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n\n &:where([data-line-clamp]) {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: var(--text-line-clamp);\n -webkit-box-orient: vertical;\n }\n\n &:where([data-inherit]) {\n line-height: inherit;\n font-weight: inherit;\n font-size: inherit;\n }\n\n &:where([data-inline]) {\n line-height: 1;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Text.module.cjs","names":[],"sources":["../../../src/components/Text/Text.module.css"],"sourcesContent":[".root {\n -webkit-tap-highlight-color: transparent;\n text-decoration: none;\n font-size: var(--text-fz, var(--mantine-font-size-md));\n line-height: var(--text-lh, var(--mantine-line-height-md));\n font-weight: var(--mantine-font-weight-regular);\n text-wrap: var(--text-text-wrap, var(--mantine-text-wrap));\n margin: 0;\n padding: 0;\n\n &:where([data-truncate]) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &:where([data-truncate='start']) {\n direction: rtl;\n text-align: end;\n\n @mixin where-rtl {\n direction: ltr;\n text-align: start;\n }\n }\n\n &:where([data-variant='gradient']) {\n background-image: var(--text-gradient);\n background-clip: text;\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n\n &:where([data-line-clamp]) {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: var(--text-line-clamp);\n -webkit-box-orient: vertical;\n }\n\n &:where([data-inherit]) {\n line-height: inherit;\n font-weight: inherit;\n font-size: inherit;\n }\n\n &:where([data-inline]) {\n line-height: 1;\n }\n}\n"],"mappings":""}
@@ -94,6 +94,7 @@ function TextareaAutosize({ maxRows, minRows, onChange, ref: userRef, ...props }
94
94
  const libRef = (0, react.useRef)(null);
95
95
  const ref = (0, _mantine_hooks.useMergedRef)(libRef, userRef);
96
96
  const heightRef = (0, react.useRef)(0);
97
+ const widthRef = (0, react.useRef)(0);
97
98
  const resizeTextarea = () => {
98
99
  const node = libRef.current;
99
100
  if (!node) return;
@@ -115,6 +116,19 @@ function TextareaAutosize({ maxRows, minRows, onChange, ref: userRef, ...props }
115
116
  window.addEventListener("resize", handleResize);
116
117
  return () => window.removeEventListener("resize", handleResize);
117
118
  }, []);
119
+ (0, react.useEffect)(() => {
120
+ const node = libRef.current;
121
+ if (!node || typeof ResizeObserver === "undefined") return;
122
+ widthRef.current = node.offsetWidth;
123
+ const observer = new ResizeObserver(() => {
124
+ if (libRef.current && libRef.current.offsetWidth !== widthRef.current) {
125
+ widthRef.current = libRef.current.offsetWidth;
126
+ resizeTextarea();
127
+ }
128
+ });
129
+ observer.observe(node);
130
+ return () => observer.disconnect();
131
+ }, []);
118
132
  (0, react.useEffect)(() => {
119
133
  const handleFontsLoaded = () => resizeTextarea();
120
134
  document.fonts.addEventListener("loadingdone", handleFontsLoaded);
@@ -1 +1 @@
1
- {"version":3,"file":"Autosize.cjs","names":[],"sources":["../../../src/components/Textarea/Autosize.tsx"],"sourcesContent":["import React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\n\ntype TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nexport interface TextareaAutosizeProps extends Omit<TextareaProps, 'style'> {\n ref?: React.Ref<HTMLTextAreaElement>;\n maxRows?: number;\n minRows?: number;\n style?: Omit<NonNullable<TextareaProps['style']>, 'maxHeight' | 'minHeight'> & {\n height?: number;\n };\n}\n\nconst SIZING_STYLE_KEYS = [\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderTopWidth',\n 'boxSizing',\n 'fontFamily',\n 'fontSize',\n 'fontStyle',\n 'fontWeight',\n 'letterSpacing',\n 'lineHeight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'tabSize',\n 'textIndent',\n 'textRendering',\n 'textTransform',\n 'width',\n 'wordBreak',\n 'wordSpacing',\n 'scrollbarGutter',\n] as const;\n\ntype SizingStyleKey = (typeof SIZING_STYLE_KEYS)[number];\n\ninterface SizingData {\n sizingStyle: Pick<CSSStyleDeclaration, Extract<SizingStyleKey, keyof CSSStyleDeclaration>>;\n paddingSize: number;\n borderSize: number;\n}\n\nconst HIDDEN_TEXTAREA_STYLE: Record<string, string> = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0',\n display: 'block',\n};\n\nfunction forceHiddenStyles(node: HTMLElement) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach((key) => {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n}\n\nfunction getSizingData(node: HTMLElement): SizingData | null {\n const style = window.getComputedStyle(node);\n\n if (style === null) {\n return null;\n }\n\n const sizingStyle = {} as SizingData['sizingStyle'];\n for (const key of SIZING_STYLE_KEYS) {\n (sizingStyle as any)[key] = style[key as keyof CSSStyleDeclaration];\n }\n\n if ((sizingStyle as any).boxSizing === '') {\n return null;\n }\n\n const paddingSize = parseFloat(sizingStyle.paddingBottom!) + parseFloat(sizingStyle.paddingTop!);\n\n const borderSize =\n parseFloat(sizingStyle.borderBottomWidth!) + parseFloat(sizingStyle.borderTopWidth!);\n\n return { sizingStyle, paddingSize, borderSize };\n}\n\nlet hiddenTextarea: HTMLTextAreaElement | null = null;\n\nfunction calculateNodeHeight(\n sizingData: SizingData,\n value: string,\n minRows = 1,\n maxRows = Infinity\n): [number, number] {\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement('textarea');\n hiddenTextarea.setAttribute('tabindex', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n hiddenTextarea.setAttribute('aria-label', 'autosize measurement');\n forceHiddenStyles(hiddenTextarea);\n }\n\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n }\n\n const { paddingSize, borderSize, sizingStyle } = sizingData;\n const { boxSizing } = sizingStyle;\n\n Object.keys(sizingStyle).forEach((key) => {\n (hiddenTextarea!.style as any)[key] = (sizingStyle as any)[key];\n });\n\n forceHiddenStyles(hiddenTextarea);\n\n hiddenTextarea.value = value;\n let height =\n boxSizing === 'border-box'\n ? hiddenTextarea.scrollHeight + borderSize\n : hiddenTextarea.scrollHeight - paddingSize;\n\n // Double set and calc due to Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1795904\n hiddenTextarea.value = value;\n height =\n boxSizing === 'border-box'\n ? hiddenTextarea.scrollHeight + borderSize\n : hiddenTextarea.scrollHeight - paddingSize;\n\n hiddenTextarea.value = 'x';\n const rowHeight = hiddenTextarea.scrollHeight - paddingSize;\n\n let minHeight = rowHeight * minRows;\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n height = Math.max(minHeight, height);\n\n let maxHeight = rowHeight * maxRows;\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n height = Math.min(maxHeight, height);\n\n return [height, rowHeight];\n}\n\nexport function TextareaAutosize({\n maxRows,\n minRows,\n onChange,\n ref: userRef,\n ...props\n}: TextareaAutosizeProps) {\n const isControlled = props.value !== undefined;\n const libRef = useRef<HTMLTextAreaElement | null>(null);\n const ref = useMergedRef(libRef, userRef);\n const heightRef = useRef(0);\n\n const resizeTextarea = () => {\n const node = libRef.current;\n\n if (!node) {\n return;\n }\n\n const nodeSizingData = getSizingData(node);\n\n if (!nodeSizingData) {\n return;\n }\n\n const [height] = calculateNodeHeight(\n nodeSizingData,\n node.value || node.placeholder || 'x',\n minRows,\n maxRows\n );\n\n if (heightRef.current !== height) {\n heightRef.current = height;\n node.style.setProperty('height', `${height}px`, 'important');\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) {\n resizeTextarea();\n }\n onChange?.(event);\n };\n\n useLayoutEffect(resizeTextarea);\n\n useEffect(() => {\n const handleResize = () => resizeTextarea();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n useEffect(() => {\n const handleFontsLoaded = () => resizeTextarea();\n document.fonts.addEventListener('loadingdone', handleFontsLoaded);\n return () => document.fonts.removeEventListener('loadingdone', handleFontsLoaded);\n }, []);\n\n useEffect(() => {\n const handleReset = (event: Event) => {\n if (libRef.current?.form === event.target && !isControlled) {\n const currentValue = libRef.current!.value;\n requestAnimationFrame(() => {\n if (libRef.current && currentValue !== libRef.current.value) {\n resizeTextarea();\n }\n });\n }\n };\n document.body.addEventListener('reset', handleReset);\n return () => document.body.removeEventListener('reset', handleReset);\n }, [isControlled]);\n\n return <textarea {...props} onChange={handleChange} ref={ref} />;\n}\n"],"mappings":";;;;;;;AAcA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAUA,MAAM,wBAAgD;CACpD,cAAc;CACd,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,UAAU;CACV,UAAU;CACV,WAAW;CACX,KAAK;CACL,OAAO;CACP,SAAS;AACX;AAEA,SAAS,kBAAkB,MAAmB;CAC5C,OAAO,KAAK,qBAAqB,EAAE,SAAS,QAAQ;EAClD,KAAK,MAAM,YAAY,KAAK,sBAAsB,MAAM,WAAW;CACrE,CAAC;AACH;AAEA,SAAS,cAAc,MAAsC;CAC3D,MAAM,QAAQ,OAAO,iBAAiB,IAAI;CAE1C,IAAI,UAAU,MACZ,OAAO;CAGT,MAAM,cAAc,CAAC;CACrB,KAAK,MAAM,OAAO,mBAChB,YAAqB,OAAO,MAAM;CAGpC,IAAK,YAAoB,cAAc,IACrC,OAAO;CAQT,OAAO;EAAE;EAAa,aALF,WAAW,YAAY,aAAc,IAAI,WAAW,YAAY,UAAW;EAK5D,YAFjC,WAAW,YAAY,iBAAkB,IAAI,WAAW,YAAY,cAAe;CAEvC;AAChD;AAEA,IAAI,iBAA6C;AAEjD,SAAS,oBACP,YACA,OACA,UAAU,GACV,UAAU,UACQ;CAClB,IAAI,CAAC,gBAAgB;EACnB,iBAAiB,SAAS,cAAc,UAAU;EAClD,eAAe,aAAa,YAAY,IAAI;EAC5C,eAAe,aAAa,eAAe,MAAM;EACjD,eAAe,aAAa,cAAc,sBAAsB;EAChE,kBAAkB,cAAc;CAClC;CAEA,IAAI,eAAe,eAAe,MAChC,SAAS,KAAK,YAAY,cAAc;CAG1C,MAAM,EAAE,aAAa,YAAY,gBAAgB;CACjD,MAAM,EAAE,cA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iBAAgB,cAAc;CAE9B,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,qBAAqB,eAAe;EAC1C,OAAO,iBAAiB,UAAU,YAAY;EAC9C,aAAa,OAAO,oBAAoB,UAAU,YAAY;CAChE,GAAG,CAAC,CAAC;CAEL,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,0BAA0B,eAAe;EAC/C,SAAS,MAAM,iBAAiB,eAAe,iBAAiB;EAChE,aAAa,SAAS,MAAM,oBAAoB,eAAe,iBAAiB;CAClF,GAAG,CAAC,CAAC;CAEL,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,eAAe,UAAiB;GACpC,IAAI,OAAO,SAAS,SAAS,MAAM,UAAU,CAAC,cAAc;IAC1D,MAAM,eAAe,OAAO,QAAS;IACrC,4BAA4B;KAC1B,IAAI,OAAO,WAAW,iBAAiB,OAAO,QAAQ,OACpD,eAAe;IAEnB,CAAC;GACH;EACF;EACA,SAAS,KAAK,iBAAiB,SAAS,WAAW;EACnD,aAAa,SAAS,KAAK,oBAAoB,SAAS,WAAW;CACrE,GAAG,CAAC,YAAY,CAAC;CAEjB,OAAO,iBAAA,GAAA,kBAAA,KAAC,YAAD;EAAU,GAAI;EAAO,UAAU;EAAmB;CAAM,CAAA;AACjE"}
1
+ {"version":3,"file":"Autosize.cjs","names":[],"sources":["../../../src/components/Textarea/Autosize.tsx"],"sourcesContent":["import React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\n\ntype TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nexport interface TextareaAutosizeProps extends Omit<TextareaProps, 'style'> {\n ref?: React.Ref<HTMLTextAreaElement>;\n maxRows?: number;\n minRows?: number;\n style?: Omit<NonNullable<TextareaProps['style']>, 'maxHeight' | 'minHeight'> & {\n height?: number;\n };\n}\n\nconst SIZING_STYLE_KEYS = [\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderTopWidth',\n 'boxSizing',\n 'fontFamily',\n 'fontSize',\n 'fontStyle',\n 'fontWeight',\n 'letterSpacing',\n 'lineHeight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'tabSize',\n 'textIndent',\n 'textRendering',\n 'textTransform',\n 'width',\n 'wordBreak',\n 'wordSpacing',\n 'scrollbarGutter',\n] as const;\n\ntype SizingStyleKey = (typeof SIZING_STYLE_KEYS)[number];\n\ninterface SizingData {\n sizingStyle: Pick<CSSStyleDeclaration, Extract<SizingStyleKey, keyof CSSStyleDeclaration>>;\n paddingSize: number;\n borderSize: number;\n}\n\nconst HIDDEN_TEXTAREA_STYLE: Record<string, string> = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0',\n display: 'block',\n};\n\nfunction forceHiddenStyles(node: HTMLElement) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach((key) => {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n}\n\nfunction getSizingData(node: HTMLElement): SizingData | null {\n const style = window.getComputedStyle(node);\n\n if (style === null) {\n return null;\n }\n\n const sizingStyle = {} as SizingData['sizingStyle'];\n for (const key of SIZING_STYLE_KEYS) {\n (sizingStyle as any)[key] = style[key as keyof CSSStyleDeclaration];\n }\n\n if ((sizingStyle as any).boxSizing === '') {\n return null;\n }\n\n const paddingSize = parseFloat(sizingStyle.paddingBottom!) + parseFloat(sizingStyle.paddingTop!);\n\n const borderSize =\n parseFloat(sizingStyle.borderBottomWidth!) + parseFloat(sizingStyle.borderTopWidth!);\n\n return { sizingStyle, paddingSize, borderSize };\n}\n\nlet hiddenTextarea: HTMLTextAreaElement | null = null;\n\nfunction calculateNodeHeight(\n sizingData: SizingData,\n value: string,\n minRows = 1,\n maxRows = Infinity\n): [number, number] {\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement('textarea');\n hiddenTextarea.setAttribute('tabindex', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n hiddenTextarea.setAttribute('aria-label', 'autosize measurement');\n forceHiddenStyles(hiddenTextarea);\n }\n\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n }\n\n const { paddingSize, borderSize, sizingStyle } = sizingData;\n const { boxSizing } = sizingStyle;\n\n Object.keys(sizingStyle).forEach((key) => {\n (hiddenTextarea!.style as any)[key] = (sizingStyle as any)[key];\n });\n\n forceHiddenStyles(hiddenTextarea);\n\n hiddenTextarea.value = value;\n let height =\n boxSizing === 'border-box'\n ? hiddenTextarea.scrollHeight + borderSize\n : hiddenTextarea.scrollHeight - paddingSize;\n\n // Double set and calc due to Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1795904\n hiddenTextarea.value = value;\n height =\n boxSizing === 'border-box'\n ? hiddenTextarea.scrollHeight + borderSize\n : hiddenTextarea.scrollHeight - paddingSize;\n\n hiddenTextarea.value = 'x';\n const rowHeight = hiddenTextarea.scrollHeight - paddingSize;\n\n let minHeight = rowHeight * minRows;\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n height = Math.max(minHeight, height);\n\n let maxHeight = rowHeight * maxRows;\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n height = Math.min(maxHeight, height);\n\n return [height, rowHeight];\n}\n\nexport function TextareaAutosize({\n maxRows,\n minRows,\n onChange,\n ref: userRef,\n ...props\n}: TextareaAutosizeProps) {\n const isControlled = props.value !== undefined;\n const libRef = useRef<HTMLTextAreaElement | null>(null);\n const ref = useMergedRef(libRef, userRef);\n const heightRef = useRef(0);\n const widthRef = useRef(0);\n\n const resizeTextarea = () => {\n const node = libRef.current;\n\n if (!node) {\n return;\n }\n\n const nodeSizingData = getSizingData(node);\n\n if (!nodeSizingData) {\n return;\n }\n\n const [height] = calculateNodeHeight(\n nodeSizingData,\n node.value || node.placeholder || 'x',\n minRows,\n maxRows\n );\n\n if (heightRef.current !== height) {\n heightRef.current = height;\n node.style.setProperty('height', `${height}px`, 'important');\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) {\n resizeTextarea();\n }\n onChange?.(event);\n };\n\n useLayoutEffect(resizeTextarea);\n\n useEffect(() => {\n const handleResize = () => resizeTextarea();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n useEffect(() => {\n const node = libRef.current;\n\n if (!node || typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n widthRef.current = node.offsetWidth;\n\n const observer = new ResizeObserver(() => {\n if (libRef.current && libRef.current.offsetWidth !== widthRef.current) {\n widthRef.current = libRef.current.offsetWidth;\n resizeTextarea();\n }\n });\n\n observer.observe(node);\n return () => observer.disconnect();\n }, []);\n\n useEffect(() => {\n const handleFontsLoaded = () => resizeTextarea();\n document.fonts.addEventListener('loadingdone', handleFontsLoaded);\n return () => document.fonts.removeEventListener('loadingdone', handleFontsLoaded);\n }, []);\n\n useEffect(() => {\n const handleReset = (event: Event) => {\n if (libRef.current?.form === event.target && !isControlled) {\n const currentValue = libRef.current!.value;\n requestAnimationFrame(() => {\n if (libRef.current && currentValue !== libRef.current.value) {\n resizeTextarea();\n }\n });\n }\n };\n document.body.addEventListener('reset', handleReset);\n return () => document.body.removeEventListener('reset', handleReset);\n }, [isControlled]);\n\n return <textarea {...props} onChange={handleChange} ref={ref} />;\n}\n"],"mappings":";;;;;;;AAcA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAUA,MAAM,wBAAgD;CACpD,cAAc;CACd,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,UAAU;CACV,UAAU;CACV,WAAW;CACX,KAAK;CACL,OAAO;CACP,SAAS;AACX;AAEA,SAAS,k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I,OAAO,WAAW,OAAO,QAAQ,gBAAgB,SAAS,SAAS;IACrE,SAAS,UAAU,OAAO,QAAQ;IAClC,eAAe;GACjB;EACF,CAAC;EAED,SAAS,QAAQ,IAAI;EACrB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CAEL,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,0BAA0B,eAAe;EAC/C,SAAS,MAAM,iBAAiB,eAAe,iBAAiB;EAChE,aAAa,SAAS,MAAM,oBAAoB,eAAe,iBAAiB;CAClF,GAAG,CAAC,CAAC;CAEL,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,eAAe,UAAiB;GACpC,IAAI,OAAO,SAAS,SAAS,MAAM,UAAU,CAAC,cAAc;IAC1D,MAAM,eAAe,OAAO,QAAS;IACrC,4BAA4B;KAC1B,IAAI,OAAO,WAAW,iBAAiB,OAAO,QAAQ,OACpD,eAAe;IAEnB,CAAC;GACH;EACF;EACA,SAAS,KAAK,iBAAiB,SAAS,WAAW;EACnD,aAAa,SAAS,KAAK,oBAAoB,SAAS,WAAW;CACrE,GAAG,CAAC,YAAY,CAAC;CAEjB,OAAO,iBAAA,GAAA,kBAAA,KAAC,YAAD;EAAU,GAAI;EAAO,UAAU;EAAmB;CAAM,CAAA;AACjE"}
@@ -5,7 +5,7 @@ const require_use_transition = require("./use-transition.cjs");
5
5
  let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  //#region packages/@mantine/core/src/components/Transition/Transition.tsx
8
- function Transition({ keepMounted, transition = "fade", duration = 250, exitDuration = duration, mounted, children, timingFunction = "ease", onExit, onEntered, onEnter, onExited, enterDelay, exitDelay }) {
8
+ function Transition({ keepMounted, keepMountedMode = "activity", transition = "fade", duration = 250, exitDuration = duration, mounted, children, timingFunction = "ease", onExit, onEntered, onEnter, onExited, enterDelay, exitDelay }) {
9
9
  const env = require_Mantine_context.useMantineEnv();
10
10
  const { transitionDuration, transitionStatus, transitionTimingFunction } = require_use_transition.useTransition({
11
11
  mounted,
@@ -21,22 +21,29 @@ function Transition({ keepMounted, transition = "fade", duration = 250, exitDura
21
21
  });
22
22
  if (env === "test") return mounted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({}) }) : keepMounted ? children({ display: "none" }) : null;
23
23
  if (transitionDuration === 0) {
24
- if (keepMounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
25
- mode: mounted ? "visible" : "hidden",
26
- children: children({})
27
- });
24
+ if (keepMounted) {
25
+ if (keepMountedMode === "display-none") return mounted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({}) }) : children({ display: "none" });
26
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
27
+ mode: mounted ? "visible" : "hidden",
28
+ children: children({})
29
+ });
30
+ }
28
31
  return mounted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({}) }) : null;
29
32
  }
30
33
  const isExited = transitionStatus === "exited";
31
- if (keepMounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
32
- mode: isExited ? "hidden" : "visible",
33
- children: children(isExited ? {} : require_get_transition_styles.getTransitionStyles({
34
+ if (keepMounted) {
35
+ const keepMountedChildren = children(isExited ? keepMountedMode === "display-none" ? { display: "none" } : {} : require_get_transition_styles.getTransitionStyles({
34
36
  transition,
35
37
  duration: transitionDuration,
36
38
  state: transitionStatus,
37
39
  timingFunction: transitionTimingFunction
38
- }))
39
- });
40
+ }));
41
+ if (keepMountedMode === "display-none") return keepMountedChildren;
42
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
43
+ mode: isExited ? "hidden" : "visible",
44
+ children: keepMountedChildren
45
+ });
46
+ }
40
47
  return isExited ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children(require_get_transition_styles.getTransitionStyles({
41
48
  transition,
42
49
  duration: transitionDuration,
@@ -1 +1 @@
1
- {"version":3,"file":"Transition.cjs","names":["useMantineEnv","useTransition","Activity","getTransitionStyles"],"sources":["../../../src/components/Transition/Transition.tsx"],"sourcesContent":["import { Activity } from 'react';\nimport { useMantineEnv } from '../../core';\nimport { getTransitionStyles } from './get-transition-styles/get-transition-styles';\nimport { MantineTransition } from './transitions';\nimport { useTransition } from './use-transition';\n\nexport interface TransitionProps {\n /** If set, the element is kept in the DOM when hidden. React 19 `Activity` is used to preserve state while the element is not visible. */\n keepMounted?: boolean;\n\n /** Transition name or object */\n transition?: MantineTransition;\n\n /** Transition duration in ms @default 250 */\n duration?: number;\n\n /** Exit transition duration in ms @default 250 */\n exitDuration?: number;\n\n /** Transition timing function @default theme.transitionTimingFunction */\n timingFunction?: string;\n\n /** Determines whether component should be mounted to the DOM */\n mounted: boolean;\n\n /** Render function with transition styles argument */\n children: (styles: React.CSSProperties) => React.JSX.Element;\n\n /** Called when exit transition ends */\n onExited?: () => void;\n\n /** Called when exit transition starts */\n onExit?: () => void;\n\n /** Called when enter transition starts */\n onEnter?: () => void;\n\n /** Called when enter transition ends */\n onEntered?: () => void;\n\n /** Delay in ms before enter transition starts */\n enterDelay?: number;\n\n /** Delay in ms before exit transition starts */\n exitDelay?: number;\n}\n\nexport type TransitionOverride = Partial<Omit<TransitionProps, 'mounted'>>;\n\nexport function Transition({\n keepMounted,\n transition = 'fade',\n duration = 250,\n exitDuration = duration,\n mounted,\n children,\n timingFunction = 'ease',\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n}: TransitionProps) {\n const env = useMantineEnv();\n const { transitionDuration, transitionStatus, transitionTimingFunction } = useTransition({\n mounted,\n exitDuration,\n duration,\n timingFunction,\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n });\n\n if (env === 'test') {\n return mounted ? <>{children({})}</> : keepMounted ? children({ display: 'none' }) : null;\n }\n\n if (transitionDuration === 0) {\n if (keepMounted) {\n return <Activity mode={mounted ? 'visible' : 'hidden'}>{children({})}</Activity>;\n }\n return mounted ? <>{children({})}</> : null;\n }\n\n const isExited = transitionStatus === 'exited';\n\n if (keepMounted) {\n return (\n <Activity mode={isExited ? 'hidden' : 'visible'}>\n {children(\n isExited\n ? {}\n : getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n )}\n </Activity>\n );\n }\n\n return isExited ? null : (\n <>\n {children(\n getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n )}\n </>\n );\n}\n\nTransition.displayName = '@mantine/core/Transition';\n\nexport namespace Transition {\n export type Props = TransitionProps;\n export type Override = TransitionOverride;\n}\n"],"mappings":";;;;;;;AAiDA,SAAgB,WAAW,EACzB,aACA,aAAa,QACb,WAAW,KACX,eAAe,UACf,SACA,UACA,iBAAiB,QACjB,QACA,WACA,SACA,UACA,YACA,aACkB;CAClB,MAAM,MAAMA,wBAAAA,cAAc;CAC1B,MAAM,EAAE,oBAAoB,kBAAkB,6BAA6BC,uBAAAA,cAAc;EACvF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,IAAI,QAAQ,QACV,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UAAG,SAAS,CAAC,CAAC,EAAI,CAAA,IAAI,cAAc,SAAS,EAAE,SAAS,OAAO,CAAC,IAAI;CAGvF,IAAI,uBAAuB,GAAG;EAC5B,IAAI,aACF,OAAO,iBAAA,GAAA,kBAAA,KAACC,MAAAA,UAAD;GAAU,MAAM,UAAU,YAAY;aAAW,SAAS,CAAC,CAAC;EAAY,CAAA;EAEjF,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UAAG,SAAS,CAAC,CAAC,EAAI,CAAA,IAAI;CACzC;CAEA,MAAM,WAAW,qBAAqB;CAEtC,IAAI,aACF,OACE,iBAAA,GAAA,kBAAA,KAACA,MAAAA,UAAD;EAAU,MAAM,WAAW,WAAW;YACnC,SACC,WACI,CAAC,IACDC,8BAAAA,oBAAoB;GAClB;GACA,UAAU;GACV,OAAO;GACP,gBAAgB;EAClB,CAAC,CACP;CACQ,CAAA;CAId,OAAO,WAAW,OAChB,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UACG,SACCA,8BAAAA,oBAAoB;EAClB;EACA,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB,CAAC,CACH,EACA,CAAA;AAEN;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"Transition.cjs","names":["useMantineEnv","useTransition","Activity","getTransitionStyles"],"sources":["../../../src/components/Transition/Transition.tsx"],"sourcesContent":["import { Activity } from 'react';\nimport { useMantineEnv } from '../../core';\nimport { getTransitionStyles } from './get-transition-styles/get-transition-styles';\nimport { MantineTransition } from './transitions';\nimport { useTransition } from './use-transition';\n\nexport interface TransitionProps {\n /** If set, the element is kept in the DOM when hidden. React 19 `Activity` is used to preserve state while the element is not visible. */\n keepMounted?: boolean;\n\n /**\n * Controls how the element is hidden when `keepMounted` is set:\n * `'activity'` – hidden with React 19 `Activity` component,\n * `'display-none'` – hidden with `display: none` styles\n * @default 'activity'\n */\n keepMountedMode?: 'activity' | 'display-none';\n\n /** Transition name or object */\n transition?: MantineTransition;\n\n /** Transition duration in ms @default 250 */\n duration?: number;\n\n /** Exit transition duration in ms @default 250 */\n exitDuration?: number;\n\n /** Transition timing function @default theme.transitionTimingFunction */\n timingFunction?: string;\n\n /** Determines whether component should be mounted to the DOM */\n mounted: boolean;\n\n /** Render function with transition styles argument */\n children: (styles: React.CSSProperties) => React.JSX.Element;\n\n /** Called when exit transition ends */\n onExited?: () => void;\n\n /** Called when exit transition starts */\n onExit?: () => void;\n\n /** Called when enter transition starts */\n onEnter?: () => void;\n\n /** Called when enter transition ends */\n onEntered?: () => void;\n\n /** Delay in ms before enter transition starts */\n enterDelay?: number;\n\n /** Delay in ms before exit transition starts */\n exitDelay?: number;\n}\n\nexport type TransitionOverride = Partial<Omit<TransitionProps, 'mounted'>>;\n\nexport function Transition({\n keepMounted,\n keepMountedMode = 'activity',\n transition = 'fade',\n duration = 250,\n exitDuration = duration,\n mounted,\n children,\n timingFunction = 'ease',\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n}: TransitionProps) {\n const env = useMantineEnv();\n const { transitionDuration, transitionStatus, transitionTimingFunction } = useTransition({\n mounted,\n exitDuration,\n duration,\n timingFunction,\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n });\n\n if (env === 'test') {\n return mounted ? <>{children({})}</> : keepMounted ? children({ display: 'none' }) : null;\n }\n\n if (transitionDuration === 0) {\n if (keepMounted) {\n if (keepMountedMode === 'display-none') {\n return mounted ? <>{children({})}</> : children({ display: 'none' });\n }\n\n return <Activity mode={mounted ? 'visible' : 'hidden'}>{children({})}</Activity>;\n }\n return mounted ? <>{children({})}</> : null;\n }\n\n const isExited = transitionStatus === 'exited';\n\n if (keepMounted) {\n const keepMountedChildren = children(\n isExited\n ? keepMountedMode === 'display-none'\n ? { display: 'none' }\n : {}\n : getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n );\n\n if (keepMountedMode === 'display-none') {\n return keepMountedChildren;\n }\n\n return <Activity mode={isExited ? 'hidden' : 'visible'}>{keepMountedChildren}</Activity>;\n }\n\n return isExited ? null : (\n <>\n {children(\n getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n )}\n </>\n );\n}\n\nTransition.displayName = '@mantine/core/Transition';\n\nexport namespace Transition {\n export type Props = TransitionProps;\n export type Override = TransitionOverride;\n}\n"],"mappings":";;;;;;;AAyDA,SAAgB,WAAW,EACzB,aACA,kBAAkB,YAClB,aAAa,QACb,WAAW,K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,SACCC,8BAAAA,oBAAoB;EAClB;EACA,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB,CAAC,CACH,EACA,CAAA;AAEN;AAEA,WAAW,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Box.cjs","names":["useMantineTheme","extractStyleProps","useMantineSxTransform","useRandomClassName","parseStyleProps","STYlE_PROPS_DATA","useMantineDeduplicateInlineStyles","hashStyleProps","getBoxStyle","isNumberLike","getBoxMod","InlineStyles","polymorphic"],"sources":["../../../src/core/Box/Box.tsx"],"sourcesContent":["import cx from 'clsx';\nimport { polymorphic } from '../factory';\nimport { hashStyleProps, InlineStyles } from '../InlineStyles';\nimport {\n MantineBreakpoint,\n useMantineDeduplicateInlineStyles,\n useMantineSxTransform,\n useMantineTheme,\n} from '../MantineProvider';\nimport { isNumberLike } from '../utils';\nimport type { CssVarsProp, MantineStyleProp } from './Box.types';\nimport { getBoxMod } from './get-box-mod/get-box-mod';\nimport { getBoxStyle } from './get-box-style/get-box-style';\nimport {\n extractStyleProps,\n MantineStyleProps,\n parseStyleProps,\n STYlE_PROPS_DATA,\n} from './style-props';\nimport { useRandomClassName } from './use-random-classname/use-random-classname';\n\nexport type Mod = Record<string, any> | string;\nexport type BoxMod = Mod | Mod[] | BoxMod[];\n\nexport interface BoxProps extends MantineStyleProps {\n /** Class added to the root element, if applicable */\n className?: string;\n\n /** Inline style added to root component element, can subscribe to theme defined on MantineProvider */\n style?: MantineStyleProp;\n\n /** CSS variables defined on root component element */\n __vars?: CssVarsProp;\n\n /** `size` property passed down the HTML element */\n __size?: string;\n\n /** Breakpoint above which the component is hidden with `display: none` */\n hiddenFrom?: MantineBreakpoint;\n\n /** Breakpoint below which the component is hidden with `display: none` */\n visibleFrom?: MantineBreakpoint;\n\n /** Determines whether component should be hidden in light color scheme with `display: none` */\n lightHidden?: boolean;\n\n /** Determines whether component should be hidden in dark color scheme with `display: none` */\n darkHidden?: boolean;\n\n /** Element modifiers transformed into `data-` attributes, for example, `{ 'data-size': 'xl' }`, falsy values are removed */\n mod?: BoxMod;\n}\n\nexport type ElementProps<\n ElementType extends React.ElementType,\n PropsToOmit extends string = never,\n> = Omit<React.ComponentProps<ElementType>, 'style' | PropsToOmit>;\n\nexport interface BoxComponentProps extends BoxProps {\n /** Variant passed from parent component, sets `data-variant` */\n variant?: string;\n\n /** Size passed from parent component, sets `data-size` if value is not number like */\n size?: string | number;\n}\n\nfunction _Box({\n component,\n style,\n __vars,\n className,\n variant,\n mod,\n size,\n hiddenFrom,\n visibleFrom,\n lightHidden,\n darkHidden,\n renderRoot,\n __size,\n ref,\n ...others\n}: BoxComponentProps & { component: any; className: string; renderRoot: any; ref: any }) {\n const theme = useMantineTheme();\n const Element = component || 'div';\n const { styleProps, rest } = extractStyleProps(others);\n const useSxTransform = useMantineSxTransform();\n const transformedSx = useSxTransform?.()?.(styleProps.sx);\n const randomClassName = useRandomClassName();\n const parsedStyleProps = parseStyleProps({\n styleProps,\n theme,\n data: STYlE_PROPS_DATA,\n });\n\n const deduplicateInlineStyles = useMantineDeduplicateInlineStyles();\n const responsiveClassName =\n deduplicateInlineStyles && parsedStyleProps.hasResponsiveStyles\n ? hashStyleProps(parsedStyleProps.styles, parsedStyleProps.media)\n : randomClassName;\n\n const props = {\n ref,\n style: getBoxStyle({\n theme,\n style,\n vars: __vars,\n styleProps: parsedStyleProps.inlineStyles,\n }),\n className: cx(className, transformedSx, {\n [responsiveClassName]: parsedStyleProps.hasResponsiveStyles,\n 'mantine-light-hidden': lightHidden,\n 'mantine-dark-hidden': darkHidden,\n [`mantine-hidden-from-${hiddenFrom}`]: hiddenFrom,\n [`mantine-visible-from-${visibleFrom}`]: visibleFrom,\n }),\n 'data-variant': variant,\n 'data-size': isNumberLike(size) ? undefined : size || undefined,\n size: __size,\n ...getBoxMod(mod),\n ...rest,\n };\n\n return (\n <>\n {parsedStyleProps.hasResponsiveStyles && (\n <InlineStyles\n selector={`.${responsiveClassName}`}\n styles={parsedStyleProps.styles}\n media={parsedStyleProps.media}\n deduplicate={deduplicateInlineStyles}\n />\n )}\n\n {typeof renderRoot === 'function' ? renderRoot(props) : <Element {...props} />}\n </>\n );\n}\n\n_Box.displayName = '@mantine/core/Box';\n\nexport const Box = polymorphic<'div', BoxComponentProps>(_Box);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA,SAAS,KAAK,EACZ,WACA,OACA,QACA,WACA,SACA,KACA,MACA,YACA,aACA,aACA,YACA,YACA,QACA,KACA,GAAG,UACoF;CACvF,MAAM,QAAQA,6BAAAA,gBAAgB;CAC9B,MAAM,UAAU,aAAa;CAC7B,MAAM,EAAE,YAAY,SAASC,4BAAAA,kBAAkB,MAAM;CAErD,MAAM,gBADiBC,wBAAAA,sBACY,IAAI,IAAI,WAAW,EAAE;CACxD,MAAM,kBAAkBC,6BAAAA,mBAAmB;CAC3C,MAAM,mBAAmBC,0BAAAA,gBAAgB;EACvC;EACA;EACA,MAAMC,yBAAAA;CACR,CAAC;CAED,MAAM,0BAA0BC,wBAAAA,kCAAkC;CAClE,MAAM,sBACJ,2BAA2B,iBAAiB,sBACxCC,oBAAAA,eAAe,iBAAiB,QAAQ,iBAAiB,KAAK,IAC9D;CAEN,MAAM,QAAQ;EACZ;EACA,OAAOC,sBAAAA,YAAY;GACjB;GACA;GACA,MAAM;GACN,YAAY,iBAAiB;EAC/B,CAAC;EACD,YAAA,GAAA,KAAA,SAAc,WAAW,eAAe;IACrC,sBAAsB,iBAAiB;GACxC,wBAAwB;GACxB,uBAAuB;IACtB,uBAAuB,eAAe;IACtC,wBAAwB,gBAAgB;EAC3C,CAAC;EACD,gBAAgB;EAChB,aAAaC,uBAAAA,aAAa,IAAI,IAAI,KAAA,IAAY,QAAQ,KAAA;EACtD,MAAM;EACN,GAAGC,oBAAAA,UAAU,GAAG;EAChB,GAAG;CACL;CAEA,OACE,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,uBAChB,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,cAAD;EACE,UAAU,IAAI;EACd,QAAQ,iBAAiB;EACzB,OAAO,iBAAiB;EACxB,aAAa;CACd,CAAA,GAGF,OAAO,eAAe,aAAa,WAAW,KAAK,IAAI,iBAAA,GAAA,kBAAA,KAAC,SAAD,EAAS,GAAI,MAAQ,CAAA,CAC7E,EAAA,CAAA;AAEN;AAEA,KAAK,cAAc;AAEnB,MAAa,MAAMC,qCAAAA,YAAsC,IAAI"}
1
+ {"version":3,"file":"Box.cjs","names":["useMantineTheme","extractStyleProps","useMantineSxTransform","useRandomClassName","parseStyleProps","STYlE_PROPS_DATA","useMantineDeduplicateInlineStyles","hashStyleProps","getBoxStyle","isNumberLike","getBoxMod","InlineStyles","polymorphic"],"sources":["../../../src/core/Box/Box.tsx"],"sourcesContent":["import cx from 'clsx';\nimport { polymorphic } from '../factory';\nimport { hashStyleProps, InlineStyles } from '../InlineStyles';\nimport {\n MantineBreakpoint,\n useMantineDeduplicateInlineStyles,\n useMantineSxTransform,\n useMantineTheme,\n} from '../MantineProvider';\nimport { isNumberLike } from '../utils';\nimport type { CssVarsProp, MantineStyleProp } from './Box.types';\nimport { getBoxMod } from './get-box-mod/get-box-mod';\nimport { getBoxStyle } from './get-box-style/get-box-style';\nimport {\n extractStyleProps,\n MantineStyleProps,\n parseStyleProps,\n STYlE_PROPS_DATA,\n} from './style-props';\nimport { useRandomClassName } from './use-random-classname/use-random-classname';\n\nexport type Mod = Record<string, any> | string;\nexport type BoxMod = Mod | Mod[] | BoxMod[];\n\nexport interface BoxProps extends MantineStyleProps {\n /** Class added to the root element, if applicable */\n className?: string | undefined;\n\n /** Inline style added to root component element, can subscribe to theme defined on MantineProvider */\n style?: MantineStyleProp;\n\n /** CSS variables defined on root component element */\n __vars?: CssVarsProp;\n\n /** `size` property passed down the HTML element */\n __size?: string;\n\n /** Breakpoint above which the component is hidden with `display: none` */\n hiddenFrom?: MantineBreakpoint;\n\n /** Breakpoint below which the component is hidden with `display: none` */\n visibleFrom?: MantineBreakpoint;\n\n /** Determines whether component should be hidden in light color scheme with `display: none` */\n lightHidden?: boolean;\n\n /** Determines whether component should be hidden in dark color scheme with `display: none` */\n darkHidden?: boolean;\n\n /** Element modifiers transformed into `data-` attributes, for example, `{ 'data-size': 'xl' }`, falsy values are removed */\n mod?: BoxMod;\n}\n\nexport type ElementProps<\n ElementType extends React.ElementType,\n PropsToOmit extends string = never,\n> = Omit<React.ComponentProps<ElementType>, 'style' | PropsToOmit>;\n\nexport interface BoxComponentProps extends BoxProps {\n /** Variant passed from parent component, sets `data-variant` */\n variant?: string;\n\n /** Size passed from parent component, sets `data-size` if value is not number like */\n size?: string | number;\n}\n\nfunction _Box({\n component,\n style,\n __vars,\n className,\n variant,\n mod,\n size,\n hiddenFrom,\n visibleFrom,\n lightHidden,\n darkHidden,\n renderRoot,\n __size,\n ref,\n ...others\n}: BoxComponentProps & { component: any; className: string; renderRoot: any; ref: any }) {\n const theme = useMantineTheme();\n const Element = component || 'div';\n const { styleProps, rest } = extractStyleProps(others);\n const useSxTransform = useMantineSxTransform();\n const transformedSx = useSxTransform?.()?.(styleProps.sx);\n const randomClassName = useRandomClassName();\n const parsedStyleProps = parseStyleProps({\n styleProps,\n theme,\n data: STYlE_PROPS_DATA,\n });\n\n const deduplicateInlineStyles = useMantineDeduplicateInlineStyles();\n const responsiveClassName =\n deduplicateInlineStyles && parsedStyleProps.hasResponsiveStyles\n ? hashStyleProps(parsedStyleProps.styles, parsedStyleProps.media)\n : randomClassName;\n\n const props = {\n ref,\n style: getBoxStyle({\n theme,\n style,\n vars: __vars,\n styleProps: parsedStyleProps.inlineStyles,\n }),\n className: cx(className, transformedSx, {\n [responsiveClassName]: parsedStyleProps.hasResponsiveStyles,\n 'mantine-light-hidden': lightHidden,\n 'mantine-dark-hidden': darkHidden,\n [`mantine-hidden-from-${hiddenFrom}`]: hiddenFrom,\n [`mantine-visible-from-${visibleFrom}`]: visibleFrom,\n }),\n 'data-variant': variant,\n 'data-size': isNumberLike(size) ? undefined : size || undefined,\n size: __size,\n ...getBoxMod(mod),\n ...rest,\n };\n\n return (\n <>\n {parsedStyleProps.hasResponsiveStyles && (\n <InlineStyles\n selector={`.${responsiveClassName}`}\n styles={parsedStyleProps.styles}\n media={parsedStyleProps.media}\n deduplicate={deduplicateInlineStyles}\n />\n )}\n\n {typeof renderRoot === 'function' ? renderRoot(props) : <Element {...props} />}\n </>\n );\n}\n\n_Box.displayName = '@mantine/core/Box';\n\nexport const Box = polymorphic<'div', BoxComponentProps>(_Box);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA,SAAS,KAAK,EACZ,WACA,OACA,QACA,WACA,SACA,KACA,MACA,YACA,aACA,aACA,YACA,YACA,QACA,KACA,GAAG,UACoF;CACvF,MAAM,QAAQA,6BAAAA,gBAAgB;CAC9B,MAAM,UAAU,aAAa;CAC7B,MAAM,EAAE,YAAY,SAASC,4BAAAA,kBAAkB,MAAM;CAErD,MAAM,gBADiBC,wBAAAA,sBACY,IAAI,IAAI,WAAW,EAAE;CACxD,MAAM,kBAAkBC,6BAAAA,mBAAmB;CAC3C,MAAM,mBAAmBC,0BAAAA,gBAAgB;EACvC;EACA;EACA,MAAMC,yBAAAA;CACR,CAAC;CAED,MAAM,0BAA0BC,wBAAAA,kCAAkC;CAClE,MAAM,sBACJ,2BAA2B,iBAAiB,sBACxCC,oBAAAA,eAAe,iBAAiB,QAAQ,iBAAiB,KAAK,IAC9D;CAEN,MAAM,QAAQ;EACZ;EACA,OAAOC,sBAAAA,YAAY;GACjB;GACA;GACA,MAAM;GACN,YAAY,iBAAiB;EAC/B,CAAC;EACD,YAAA,GAAA,KAAA,SAAc,WAAW,eAAe;IACrC,sBAAsB,iBAAiB;GACxC,wBAAwB;GACxB,uBAAuB;IACtB,uBAAuB,eAAe;IACtC,wBAAwB,gBAAgB;EAC3C,CAAC;EACD,gBAAgB;EAChB,aAAaC,uBAAAA,aAAa,IAAI,IAAI,KAAA,IAAY,QAAQ,KAAA;EACtD,MAAM;EACN,GAAGC,oBAAAA,UAAU,GAAG;EAChB,GAAG;CACL;CAEA,OACE,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,uBAChB,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,cAAD;EACE,UAAU,IAAI;EACd,QAAQ,iBAAiB;EACzB,OAAO,iBAAiB;EACxB,aAAa;CACd,CAAA,GAGF,OAAO,eAAe,aAAa,WAAW,KAAK,IAAI,iBAAA,GAAA,kBAAA,KAAC,SAAD,EAAS,GAAI,MAAQ,CAAA,CAC7E,EAAA,CAAA;AAEN;AAEA,KAAK,cAAc;AAEnB,MAAa,MAAMC,qCAAAA,YAAsC,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-styles.cjs","names":["useMantineTheme","useMantineClassNamesPrefix","useMantineWithStaticClasses","useMantineIsHeadless","useStylesTransform","resolveClassNames","resolveStyles","mergeVars","resolveStyle","getClassName","getStyle"],"sources":["../../../../src/core/styles-api/use-styles/use-styles.ts"],"sourcesContent":["import { CSSProperties } from 'react';\nimport type { MantineStyleProp } from '../../Box';\nimport { FactoryPayload } from '../../factory';\nimport {\n useMantineClassNamesPrefix,\n useMantineIsHeadless,\n useMantineTheme,\n useMantineWithStaticClasses,\n} from '../../MantineProvider';\nimport { PartialVarsResolver, VarsResolver } from '../create-vars-resolver/create-vars-resolver';\nimport {\n Attributes,\n ClassNames,\n ClassNamesArray,\n GetStylesApiOptions,\n Styles,\n} from '../styles-api.types';\nimport { getClassName } from './get-class-name/get-class-name';\nimport { resolveClassNames } from './get-class-name/resolve-class-names/resolve-class-names';\nimport { getStyle } from './get-style/get-style';\nimport { resolveStyle } from './get-style/resolve-style/resolve-style';\nimport { resolveStyles } from './get-style/resolve-styles/resolve-styles';\nimport { mergeVars } from './get-style/resolve-vars/merge-vars';\nimport { useStylesTransform } from './use-transformed-styles';\n\nexport interface UseStylesInput<Payload extends FactoryPayload> {\n name: string | (string | undefined)[];\n classes: Payload['stylesNames'] extends string ? Record<string, string> : never;\n props: Payload['props'];\n stylesCtx?: Payload['ctx'];\n className?: string;\n style?: MantineStyleProp;\n rootSelector?: Payload['stylesNames'];\n unstyled?: boolean;\n classNames?: ClassNames<Payload> | ClassNamesArray<Payload>;\n styles?: Styles<Payload>;\n vars?: PartialVarsResolver<Payload>;\n varsResolver?: VarsResolver<Payload>;\n attributes?: Attributes<Payload>;\n}\n\nexport type GetStylesApi<Payload extends FactoryPayload> = (\n selector: NonNullable<Payload['stylesNames']>,\n options?: GetStylesApiOptions\n) => {\n className: string;\n style: CSSProperties;\n};\n\nexport function useStyles<Payload extends FactoryPayload>({\n name,\n classes,\n props,\n stylesCtx,\n className,\n style,\n rootSelector = 'root' as NonNullable<Payload['stylesNames']>,\n unstyled,\n classNames,\n styles,\n vars,\n varsResolver,\n attributes,\n}: UseStylesInput<Payload>): GetStylesApi<Payload> {\n const theme = useMantineTheme();\n const classNamesPrefix = useMantineClassNamesPrefix();\n const withStaticClasses = useMantineWithStaticClasses();\n const headless = useMantineIsHeadless();\n const themeName = (Array.isArray(name) ? name : [name]).filter((n) => n) as string[];\n const { withStylesTransform, getTransformedStyles } = useStylesTransform({\n props,\n stylesCtx,\n themeName,\n theme,\n });\n\n const resolvedClassNames = resolveClassNames({ theme, classNames, props, stylesCtx });\n const resolvedThemeClassNames = themeName.map((n) =>\n resolveClassNames({ theme, classNames: theme.components[n]?.classNames, props, stylesCtx })\n );\n\n const resolvedComponentStyles = withStylesTransform\n ? {}\n : resolveStyles({ theme, styles, props, stylesCtx });\n\n const resolvedThemeStyles: Record<string, any> = {};\n\n if (!withStylesTransform) {\n for (const n of themeName) {\n const resolved = resolveStyles({\n theme,\n styles: theme.components[n]?.styles,\n props,\n stylesCtx,\n });\n\n for (const key of Object.keys(resolved)) {\n resolvedThemeStyles[key] = { ...resolvedThemeStyles[key], ...resolved[key] };\n }\n }\n }\n\n const resolvedVars = mergeVars([\n headless ? {} : varsResolver?.(theme, props, stylesCtx),\n ...themeName.map((n) => theme.components?.[n]?.vars?.(theme, props, stylesCtx)),\n vars?.(theme, props, stylesCtx),\n ]);\n\n const resolvedRootStyle = resolveStyle({ style, theme });\n\n return (selector, options) => ({\n ...attributes?.[selector],\n\n className: getClassName({\n theme,\n options,\n themeName,\n selector,\n classNamesPrefix,\n resolvedClassNames,\n resolvedThemeClassNames,\n classes,\n unstyled,\n className,\n rootSelector,\n props,\n stylesCtx,\n withStaticClasses,\n headless,\n transformedStyles: getTransformedStyles([options?.styles, styles]),\n }),\n\n style: getStyle({\n theme,\n selector,\n options,\n props,\n stylesCtx,\n rootSelector,\n withStylesTransform,\n resolvedStyles: resolvedComponentStyles,\n resolvedThemeStyles,\n resolvedVars,\n resolvedRootStyle,\n }),\n });\n}\n"],"mappings":";;;;;;;;;;;AAiDA,SAAgB,UAA0C,EACxD,MACA,SACA,OACA,WACA,WACA,OACA,eAAe,QACf,UACA,YACA,QACA,MACA,cACA,cACiD;CACjD,MAAM,QAAQA,6BAAAA,gBAAgB;CAC9B,MAAM,mBAAmBC,wBAAAA,2BAA2B;CACpD,MAAM,oBAAoBC,wBAAAA,4BAA4B;CACtD,MAAM,WAAWC,wBAAAA,qBAAqB;CACtC,MAAM,aAAa,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,QAAQ,MAAM,CAAC;CACvE,MAAM,EAAE,qBAAqB,yBAAyBC,+BAAAA,mBAAmB;EACvE;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,qBAAqBC,4BAAAA,kBAAkB;EAAE;EAAO;EAAY;EAAO;CAAU,CAAC;CACpF,MAAM,0BAA0B,UAAU,KAAK,MAC7CA,4BAAAA,kBAAkB;EAAE;EAAO,YAAY,MAAM,WAAW,IAAI;EAAY;EAAO;CAAU,CAAC,CAC5F;CAEA,MAAM,0BAA0B,sBAC5B,CAAC,IACDC,uBAAAA,cAAc;EAAE;EAAO;EAAQ;EAAO;CAAU,CAAC;CAErD,MAAM,sBAA2C,CAAC;CAElD,IAAI,CAAC,qBACH,KAAK,MAAM,KAAK,WAAW;EACzB,MAAM,WAAWA,uBAAAA,cAAc;GAC7B;GACA,QAAQ,MAAM,WAAW,IAAI;GAC7B;GACA;EACF,CAAC;EAED,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,oBAAoB,OAAO;GAAE,GAAG,oBAAoB;GAAM,GAAG,SAAS;EAAK;CAE/E;CAGF,MAAM,eAAeC,mBAAAA,UAAU;EAC7B,WAAW,CAAC,IAAI,eAAe,OAAO,OAAO,SAAS;EACtD,GAAG,UAAU,KAAK,MAAM,MAAM,aAAa,IAAI,OAAO,OAAO,OAAO,SAAS,CAAC;EAC9E,OAAO,OAAO,OAAO,SAAS;CAChC,CAAC;CAED,MAAM,oBAAoBC,sBAAAA,aAAa;EAAE;EAAO;CAAM,CAAC;CAEvD,QAAQ,UAAU,aAAa;EAC7B,GAAG,aAAa;EAEhB,WAAWC,uBAAAA,aAAa;GACtB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,mBAAmB,qBAAqB,CAAC,SAAS,QAAQ,MAAM,CAAC;EACnE,CAAC;EAED,OAAOC,kBAAAA,SAAS;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA,gBAAgB;GAChB;GACA;GACA;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"use-styles.cjs","names":["useMantineTheme","useMantineClassNamesPrefix","useMantineWithStaticClasses","useMantineIsHeadless","useStylesTransform","resolveClassNames","resolveStyles","mergeVars","resolveStyle","getClassName","getStyle"],"sources":["../../../../src/core/styles-api/use-styles/use-styles.ts"],"sourcesContent":["import { CSSProperties } from 'react';\nimport type { MantineStyleProp } from '../../Box';\nimport { FactoryPayload } from '../../factory';\nimport {\n useMantineClassNamesPrefix,\n useMantineIsHeadless,\n useMantineTheme,\n useMantineWithStaticClasses,\n} from '../../MantineProvider';\nimport { PartialVarsResolver, VarsResolver } from '../create-vars-resolver/create-vars-resolver';\nimport {\n Attributes,\n ClassNames,\n ClassNamesArray,\n GetStylesApiOptions,\n Styles,\n} from '../styles-api.types';\nimport { getClassName } from './get-class-name/get-class-name';\nimport { resolveClassNames } from './get-class-name/resolve-class-names/resolve-class-names';\nimport { getStyle } from './get-style/get-style';\nimport { resolveStyle } from './get-style/resolve-style/resolve-style';\nimport { resolveStyles } from './get-style/resolve-styles/resolve-styles';\nimport { mergeVars } from './get-style/resolve-vars/merge-vars';\nimport { useStylesTransform } from './use-transformed-styles';\n\nexport interface UseStylesInput<Payload extends FactoryPayload> {\n name: string | (string | undefined)[];\n classes: Payload['stylesNames'] extends string ? Record<string, string> : never;\n props: Payload['props'];\n stylesCtx?: Payload['ctx'];\n className?: string | undefined;\n style?: MantineStyleProp;\n rootSelector?: Payload['stylesNames'];\n unstyled?: boolean;\n classNames?: ClassNames<Payload> | ClassNamesArray<Payload>;\n styles?: Styles<Payload>;\n vars?: PartialVarsResolver<Payload>;\n varsResolver?: VarsResolver<Payload>;\n attributes?: Attributes<Payload>;\n}\n\nexport type GetStylesApi<Payload extends FactoryPayload> = (\n selector: NonNullable<Payload['stylesNames']>,\n options?: GetStylesApiOptions\n) => {\n className: string;\n style: CSSProperties;\n};\n\nexport function useStyles<Payload extends FactoryPayload>({\n name,\n classes,\n props,\n stylesCtx,\n className,\n style,\n rootSelector = 'root' as NonNullable<Payload['stylesNames']>,\n unstyled,\n classNames,\n styles,\n vars,\n varsResolver,\n attributes,\n}: UseStylesInput<Payload>): GetStylesApi<Payload> {\n const theme = useMantineTheme();\n const classNamesPrefix = useMantineClassNamesPrefix();\n const withStaticClasses = useMantineWithStaticClasses();\n const headless = useMantineIsHeadless();\n const themeName = (Array.isArray(name) ? name : [name]).filter((n) => n) as string[];\n const { withStylesTransform, getTransformedStyles } = useStylesTransform({\n props,\n stylesCtx,\n themeName,\n theme,\n });\n\n const resolvedClassNames = resolveClassNames({ theme, classNames, props, stylesCtx });\n const resolvedThemeClassNames = themeName.map((n) =>\n resolveClassNames({ theme, classNames: theme.components[n]?.classNames, props, stylesCtx })\n );\n\n const resolvedComponentStyles = withStylesTransform\n ? {}\n : resolveStyles({ theme, styles, props, stylesCtx });\n\n const resolvedThemeStyles: Record<string, any> = {};\n\n if (!withStylesTransform) {\n for (const n of themeName) {\n const resolved = resolveStyles({\n theme,\n styles: theme.components[n]?.styles,\n props,\n stylesCtx,\n });\n\n for (const key of Object.keys(resolved)) {\n resolvedThemeStyles[key] = { ...resolvedThemeStyles[key], ...resolved[key] };\n }\n }\n }\n\n const resolvedVars = mergeVars([\n headless ? {} : varsResolver?.(theme, props, stylesCtx),\n ...themeName.map((n) => theme.components?.[n]?.vars?.(theme, props, stylesCtx)),\n vars?.(theme, props, stylesCtx),\n ]);\n\n const resolvedRootStyle = resolveStyle({ style, theme });\n\n return (selector, options) => ({\n ...attributes?.[selector],\n\n className: getClassName({\n theme,\n options,\n themeName,\n selector,\n classNamesPrefix,\n resolvedClassNames,\n resolvedThemeClassNames,\n classes,\n unstyled,\n className,\n rootSelector,\n props,\n stylesCtx,\n withStaticClasses,\n headless,\n transformedStyles: getTransformedStyles([options?.styles, styles]),\n }),\n\n style: getStyle({\n theme,\n selector,\n options,\n props,\n stylesCtx,\n rootSelector,\n withStylesTransform,\n resolvedStyles: resolvedComponentStyles,\n resolvedThemeStyles,\n resolvedVars,\n resolvedRootStyle,\n }),\n });\n}\n"],"mappings":";;;;;;;;;;;AAiDA,SAAgB,UAA0C,EACxD,MACA,SACA,OACA,WACA,WACA,OACA,eAAe,QACf,UACA,YACA,QACA,MACA,cACA,cACiD;CACjD,MAAM,QAAQA,6BAAAA,gBAAgB;CAC9B,MAAM,mBAAmBC,wBAAAA,2BAA2B;CACpD,MAAM,oBAAoBC,wBAAAA,4BAA4B;CACtD,MAAM,WAAWC,wBAAAA,qBAAqB;CACtC,MAAM,aAAa,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,QAAQ,MAAM,CAAC;CACvE,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;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Blockquote.module.mjs","names":[],"sources":["../../../src/components/Blockquote/Blockquote.module.css"],"sourcesContent":[".root {\n --blockquote-border: 3px solid var(--bq-bd);\n\n position: relative;\n margin: 0;\n text-wrap: var(--bq-text-wrap, var(--mantine-text-wrap, wrap));\n border-inline-start: var(--blockquote-border);\n border-start-end-radius: var(--bq-radius);\n border-end-end-radius: var(--bq-radius);\n padding: var(--mantine-spacing-xl) rem(38px);\n\n @mixin where-light {\n background-color: var(--bq-bg-light);\n }\n\n @mixin where-dark {\n background-color: var(--bq-bg-dark);\n }\n}\n\n.icon {\n --blockquote-icon-offset: calc(var(--bq-icon-size) / -2);\n\n position: absolute;\n color: var(--bq-bd);\n background-color: var(--mantine-color-body);\n display: flex;\n align-items: center;\n justify-content: center;\n top: var(--blockquote-icon-offset);\n inset-inline-start: var(--blockquote-icon-offset);\n width: var(--bq-icon-size);\n height: var(--bq-icon-size);\n border-radius: var(--bq-icon-size);\n}\n\n.cite {\n display: block;\n margin-top: var(--mantine-spacing-md);\n opacity: 0.6;\n font-size: 85%;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Blockquote.module.mjs","names":[],"sources":["../../../src/components/Blockquote/Blockquote.module.css"],"sourcesContent":[".root {\n --blockquote-border: 3px solid var(--bq-bd);\n\n position: relative;\n margin: 0;\n text-wrap: var(--bq-text-wrap, var(--mantine-text-wrap));\n border-inline-start: var(--blockquote-border);\n border-start-end-radius: var(--bq-radius);\n border-end-end-radius: var(--bq-radius);\n padding: var(--mantine-spacing-xl) rem(38px);\n\n @mixin where-light {\n background-color: var(--bq-bg-light);\n }\n\n @mixin where-dark {\n background-color: var(--bq-bg-dark);\n }\n}\n\n.icon {\n --blockquote-icon-offset: calc(var(--bq-icon-size) / -2);\n\n position: absolute;\n color: var(--bq-bd);\n background-color: var(--mantine-color-body);\n display: flex;\n align-items: center;\n justify-content: center;\n top: var(--blockquote-icon-offset);\n inset-inline-start: var(--blockquote-icon-offset);\n width: var(--bq-icon-size);\n height: var(--bq-icon-size);\n border-radius: var(--bq-icon-size);\n}\n\n.cite {\n display: block;\n margin-top: var(--mantine-spacing-md);\n opacity: 0.6;\n font-size: 85%;\n}\n"],"mappings":""}
@@ -73,6 +73,7 @@ const Checkbox = factory((_props) => {
73
73
  const withContextProps = {
74
74
  checked: ctx?.value.includes(rest.value) ?? checked,
75
75
  onChange: (event) => {
76
+ if (readOnly) return;
76
77
  ctx?.onChange(event);
77
78
  onChange?.(event);
78
79
  }
@@ -130,7 +131,7 @@ const Checkbox = factory((_props) => {
130
131
  inert: rest.inert,
131
132
  type: "checkbox",
132
133
  onClick: (event) => {
133
- if (readOnly) event.preventDefault();
134
+ if (readOnly && withContextProps.checked === void 0) event.preventDefault();
134
135
  onClick?.(event);
135
136
  }
136
137
  }), /* @__PURE__ */ jsx(Icon, {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","names":["useId","classes"],"sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { use, useEffect, useRef } from 'react';\nimport { useId, useMergedRef } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getRadius,\n getSize,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n parseThemeColor,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { InlineInput, InlineInputClasses, InlineInputStylesNames } from '../../utils/InlineInput';\nimport {\n CheckboxCard,\n type CheckboxCardProps,\n type CheckboxCardStylesNames,\n type CheckboxCardCssVariables,\n type CheckboxCardFactory,\n} from './CheckboxCard/CheckboxCard';\nimport {\n CheckboxGroup,\n CheckboxGroupContext,\n type CheckboxGroupProps,\n type CheckboxGroupStylesNames,\n type CheckboxGroupFactory,\n} from './CheckboxGroup/CheckboxGroup';\nimport {\n CheckboxIndicator,\n type CheckboxIndicatorProps,\n type CheckboxIndicatorStylesNames,\n type CheckboxIndicatorCssVariables,\n type CheckboxIndicatorFactory,\n type CheckboxIndicatorVariant,\n} from './CheckboxIndicator/CheckboxIndicator';\nimport { CheckboxIcon } from './CheckIcon';\nimport classes from './Checkbox.module.css';\nexport type CheckboxVariant = 'filled' | 'outline';\nexport type CheckboxStylesNames = 'icon' | 'inner' | 'input' | InlineInputStylesNames;\nexport type CheckboxCssVariables = {\n root: '--checkbox-size' | '--checkbox-radius' | '--checkbox-color' | '--checkbox-icon-color';\n};\n\nexport type CheckboxIconComponent = React.FC<{\n indeterminate: boolean | undefined;\n className: string;\n}>;\n\nexport interface CheckboxProps\n extends BoxProps, StylesApiProps<CheckboxFactory>, ElementProps<'input', 'size' | 'children'> {\n /** Unique input id */\n id?: string;\n\n /** `label` associated with the checkbox */\n label?: React.ReactNode;\n\n /** Key of `theme.colors` or any valid CSS color to set input background color in checked state @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the component @default 'sm' */\n size?: MantineSize | (string & {});\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to the root element */\n wrapperProps?: React.ComponentProps<'div'> & DataAttributes;\n\n /** Position of the label relative to the input @default 'right' */\n labelPosition?: 'left' | 'right';\n\n /** Description below the label */\n description?: React.ReactNode;\n\n /** Error message below the label */\n error?: React.ReactNode;\n\n /** Indeterminate state of the checkbox. If set, `checked` prop is dismissed. */\n indeterminate?: boolean;\n\n /** Icon for checked or indeterminate state */\n icon?: CheckboxIconComponent;\n\n /** Root element ref */\n rootRef?: React.Ref<HTMLDivElement>;\n\n /** Key of `theme.colors` or any valid CSS color to set icon color. By default, depends on `theme.autoContrast`. */\n iconColor?: MantineColor;\n\n /** If set, adjusts icon color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** If set, applies error styles to the checkbox when `error` prop is set @default true */\n withErrorStyles?: boolean;\n}\n\nexport type CheckboxFactory = Factory<{\n props: CheckboxProps;\n ref: HTMLInputElement;\n stylesNames: CheckboxStylesNames;\n vars: CheckboxCssVariables;\n variant: CheckboxVariant;\n staticComponents: {\n Group: typeof CheckboxGroup;\n Indicator: typeof CheckboxIndicator;\n Card: typeof CheckboxCard;\n };\n}>;\n\nconst defaultProps = {\n labelPosition: 'right',\n icon: CheckboxIcon,\n withErrorStyles: true,\n variant: 'filled',\n radius: 'sm',\n} satisfies Partial<CheckboxProps>;\n\nconst varsResolver = createVarsResolver<CheckboxFactory>(\n (theme, { radius, color, size, iconColor, variant, autoContrast }) => {\n const parsedColor = parseThemeColor({ color: color || theme.primaryColor, theme });\n const outlineColor =\n parsedColor.isThemeColor && parsedColor.shade === undefined\n ? `var(--mantine-color-${parsedColor.color}-outline)`\n : parsedColor.color;\n\n return {\n root: {\n '--checkbox-size': getSize(size, 'checkbox-size'),\n '--checkbox-radius': radius === undefined ? undefined : getRadius(radius),\n '--checkbox-color': variant === 'outline' ? outlineColor : getThemeColor(color, theme),\n '--checkbox-icon-color': iconColor\n ? getThemeColor(iconColor, theme)\n : getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n },\n };\n }\n);\n\nexport const Checkbox = factory<CheckboxFactory>((_props) => {\n const props = useProps('Checkbox', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n color,\n label,\n id,\n size,\n radius,\n wrapperProps,\n checked,\n labelPosition,\n description,\n error,\n disabled,\n variant,\n indeterminate,\n icon: Icon,\n rootRef,\n iconColor,\n onChange,\n autoContrast,\n mod,\n attributes,\n readOnly,\n onClick,\n withErrorStyles,\n ref,\n ...others\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const ctx = use(CheckboxGroupContext);\n const _size = size || ctx?.size;\n\n const getStyles = useStyles<CheckboxFactory>({\n name: 'Checkbox',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { styleProps, rest } = extractStyleProps(others);\n const uuid = useId(id);\n const descriptionId = description ? `${uuid}-description` : undefined;\n const errorId = error && typeof error !== 'boolean' ? `${uuid}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, rest['aria-describedby']].filter(Boolean).join(' ') || undefined;\n\n const withContextProps = {\n checked: ctx?.value.includes(rest.value as string) ?? checked,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n ctx?.onChange(event);\n onChange?.(event);\n },\n };\n\n const isDisabledByGroup = ctx?.isDisabled?.(rest.value as string) ?? false;\n const finalDisabled = disabled || isDisabledByGroup;\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate || false;\n\n if (indeterminate) {\n inputRef.current.setAttribute('data-indeterminate', 'true');\n } else {\n inputRef.current.removeAttribute('data-indeterminate');\n }\n }\n }, [indeterminate]);\n\n return (\n <InlineInput\n {...getStyles('root')}\n __staticSelector=\"Checkbox\"\n __stylesApiProps={props}\n id={uuid}\n size={_size}\n labelPosition={labelPosition}\n label={label}\n description={description}\n error={error}\n disabled={finalDisabled}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n data-checked={withContextProps.checked || checked || undefined}\n variant={variant}\n ref={rootRef}\n mod={mod}\n attributes={attributes}\n inert={rest.inert}\n {...styleProps}\n {...wrapperProps}\n >\n <Box {...getStyles('inner')} mod={{ 'data-label-position': labelPosition }}>\n <Box\n component=\"input\"\n id={uuid}\n ref={useMergedRef(inputRef, ref)}\n mod={{ error: !!error, 'with-error-styles': withErrorStyles }}\n {...getStyles('input', { focusable: true, variant })}\n {...rest}\n {...withContextProps}\n aria-describedby={describedBy}\n disabled={finalDisabled}\n inert={rest.inert}\n type=\"checkbox\"\n onClick={(event) => {\n if (readOnly) {\n event.preventDefault();\n }\n\n onClick?.(event);\n }}\n />\n\n <Icon indeterminate={indeterminate} {...getStyles('icon')} />\n </Box>\n </InlineInput>\n );\n});\n\nCheckbox.classes = { ...classes, ...InlineInputClasses };\nCheckbox.varsResolver = varsResolver;\nCheckbox.displayName = '@mantine/core/Checkbox';\nCheckbox.Group = CheckboxGroup;\nCheckbox.Indicator = CheckboxIndicator;\nCheckbox.Card = CheckboxCard;\n\nexport namespace Checkbox {\n export type Props = CheckboxProps;\n export type StylesNames = CheckboxStylesNames;\n export type CssVariables = CheckboxCssVariables;\n export type Factory = CheckboxFactory;\n export type Variant = CheckboxVariant;\n export type IconComponent = CheckboxIconComponent;\n\n export namespace Group {\n export type Props = CheckboxGroupProps;\n export type StylesNames = CheckboxGroupStylesNames;\n export type Factory = CheckboxGroupFactory;\n }\n\n export namespace Indicator {\n export type Props = CheckboxIndicatorProps;\n export type StylesNames = CheckboxIndicatorStylesNames;\n export type CssVariables = CheckboxIndicatorCssVariables;\n export type Factory = CheckboxIndicatorFactory;\n export type Variant = CheckboxIndicatorVariant;\n }\n\n export namespace Card {\n export type Props = CheckboxCardProps;\n export type StylesNames = CheckboxCardStylesNames;\n export type CssVariables = CheckboxCardCssVariables;\n export type Factory = CheckboxCardFactory;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyHA,MAAM,eAAe;CACnB,eAAe;CACf,MAAM;CACN,iBAAiB;CACjB,SAAS;CACT,QAAQ;AACV;AAEA,MAAM,eAAe,oBAClB,OAAO,EAAE,QAAQ,OAAO,MAAM,WAAW,SAAS,mBAAmB;CACpE,MAAM,cAAc,gBAAgB;EAAE,OAAO,SAAS,MAAM;EAAc;CAAM,CAAC;CACjF,MAAM,eACJ,YAAY,gBAAgB,YAAY,UAAU,KAAA,IAC9C,uBAAuB,YAAY,MAAM,aACzC,YAAY;CAElB,OAAO,EACL,MAAM;EACJ,mBAAmB,QAAQ,MAAM,eAAe;EAChD,qBAAqB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM;EACxE,oBAAoB,YAAY,YAAY,eAAe,cAAc,OAAO,KAAK;EACrF,yBAAyB,YACrB,cAAc,WAAW,KAAK,IAC9B,qBAAqB,cAAc,KAAK,IACtC,iB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AI,UAAU,MAAM;EACpB,kBAAiB;EACjB,kBAAkB;EAClB,IAAI;EACJ,MAAM;EACS;EACR;EACM;EACN;EACP,UAAU;EACE;EACJ;EACE;EACV,gBAAc,iBAAiB,WAAW,WAAW,KAAA;EAC5C;EACT,KAAK;EACA;EACO;EACZ,OAAO,KAAK;EACZ,GAAI;EACJ,GAAI;YAEJ,qBAAC,KAAD;GAAK,GAAI,UAAU,OAAO;GAAG,KAAK,EAAE,uBAAuB,cAAc;aAAzE,CACE,oBAAC,KAAD;IACE,WAAU;IACV,IAAI;IACJ,KAAK,aAAa,UAAU,GAAG;IAC/B,KAAK;KAAE,OAAO,CAAC,CAAC;KAAO,qBAAqB;IAAgB;IAC5D,GAAI,UAAU,SAAS;KAAE,WAAW;KAAM;IAAQ,CAAC;IACnD,GAAI;IACJ,GAAI;IACJ,oBAAkB;IAClB,UAAU;IACV,OAAO,KAAK;IACZ,MAAK;IACL,UAAU,UAAU;KAClB,IAAI,UACF,MAAM,eAAe;KAGvB,UAAU,KAAK;IACjB;GACD,CAAA,GAED,oBAAC,MAAD;IAAqB;IAAe,GAAI,UAAU,MAAM;GAAI,CAAA,CACzD;;CACM,CAAA;AAEjB,CAAC;AAED,SAAS,UAAU;CAAE,GAAGC;CAAS,GAAG;AAAmB;AACvD,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,QAAQ;AACjB,SAAS,YAAY;AACrB,SAAS,OAAO"}
1
+ {"version":3,"file":"Checkbox.mjs","names":["useId","classes"],"sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { use, useEffect, useRef } from 'react';\nimport { useId, useMergedRef } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getRadius,\n getSize,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n parseThemeColor,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { InlineInput, InlineInputClasses, InlineInputStylesNames } from '../../utils/InlineInput';\nimport {\n CheckboxCard,\n type CheckboxCardProps,\n type CheckboxCardStylesNames,\n type CheckboxCardCssVariables,\n type CheckboxCardFactory,\n} from './CheckboxCard/CheckboxCard';\nimport {\n CheckboxGroup,\n CheckboxGroupContext,\n type CheckboxGroupProps,\n type CheckboxGroupStylesNames,\n type CheckboxGroupFactory,\n} from './CheckboxGroup/CheckboxGroup';\nimport {\n CheckboxIndicator,\n type CheckboxIndicatorProps,\n type CheckboxIndicatorStylesNames,\n type CheckboxIndicatorCssVariables,\n type CheckboxIndicatorFactory,\n type CheckboxIndicatorVariant,\n} from './CheckboxIndicator/CheckboxIndicator';\nimport { CheckboxIcon } from './CheckIcon';\nimport classes from './Checkbox.module.css';\nexport type CheckboxVariant = 'filled' | 'outline';\nexport type CheckboxStylesNames = 'icon' | 'inner' | 'input' | InlineInputStylesNames;\nexport type CheckboxCssVariables = {\n root: '--checkbox-size' | '--checkbox-radius' | '--checkbox-color' | '--checkbox-icon-color';\n};\n\nexport type CheckboxIconComponent = React.FC<{\n indeterminate: boolean | undefined;\n className: string;\n}>;\n\nexport interface CheckboxProps\n extends BoxProps, StylesApiProps<CheckboxFactory>, ElementProps<'input', 'size' | 'children'> {\n /** Unique input id */\n id?: string;\n\n /** `label` associated with the checkbox */\n label?: React.ReactNode;\n\n /** Key of `theme.colors` or any valid CSS color to set input background color in checked state @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the component @default 'sm' */\n size?: MantineSize | (string & {});\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to the root element */\n wrapperProps?: React.ComponentProps<'div'> & DataAttributes;\n\n /** Position of the label relative to the input @default 'right' */\n labelPosition?: 'left' | 'right';\n\n /** Description below the label */\n description?: React.ReactNode;\n\n /** Error message below the label */\n error?: React.ReactNode;\n\n /** Indeterminate state of the checkbox. If set, `checked` prop is dismissed. */\n indeterminate?: boolean;\n\n /** Icon for checked or indeterminate state */\n icon?: CheckboxIconComponent;\n\n /** Root element ref */\n rootRef?: React.Ref<HTMLDivElement>;\n\n /** Key of `theme.colors` or any valid CSS color to set icon color. By default, depends on `theme.autoContrast`. */\n iconColor?: MantineColor;\n\n /** If set, adjusts icon color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** If set, applies error styles to the checkbox when `error` prop is set @default true */\n withErrorStyles?: boolean;\n}\n\nexport type CheckboxFactory = Factory<{\n props: CheckboxProps;\n ref: HTMLInputElement;\n stylesNames: CheckboxStylesNames;\n vars: CheckboxCssVariables;\n variant: CheckboxVariant;\n staticComponents: {\n Group: typeof CheckboxGroup;\n Indicator: typeof CheckboxIndicator;\n Card: typeof CheckboxCard;\n };\n}>;\n\nconst defaultProps = {\n labelPosition: 'right',\n icon: CheckboxIcon,\n withErrorStyles: true,\n variant: 'filled',\n radius: 'sm',\n} satisfies Partial<CheckboxProps>;\n\nconst varsResolver = createVarsResolver<CheckboxFactory>(\n (theme, { radius, color, size, iconColor, variant, autoContrast }) => {\n const parsedColor = parseThemeColor({ color: color || theme.primaryColor, theme });\n const outlineColor =\n parsedColor.isThemeColor && parsedColor.shade === undefined\n ? `var(--mantine-color-${parsedColor.color}-outline)`\n : parsedColor.color;\n\n return {\n root: {\n '--checkbox-size': getSize(size, 'checkbox-size'),\n '--checkbox-radius': radius === undefined ? undefined : getRadius(radius),\n '--checkbox-color': variant === 'outline' ? outlineColor : getThemeColor(color, theme),\n '--checkbox-icon-color': iconColor\n ? getThemeColor(iconColor, theme)\n : getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n },\n };\n }\n);\n\nexport const Checkbox = factory<CheckboxFactory>((_props) => {\n const props = useProps('Checkbox', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n color,\n label,\n id,\n size,\n radius,\n wrapperProps,\n checked,\n labelPosition,\n description,\n error,\n disabled,\n variant,\n indeterminate,\n icon: Icon,\n rootRef,\n iconColor,\n onChange,\n autoContrast,\n mod,\n attributes,\n readOnly,\n onClick,\n withErrorStyles,\n ref,\n ...others\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const ctx = use(CheckboxGroupContext);\n const _size = size || ctx?.size;\n\n const getStyles = useStyles<CheckboxFactory>({\n name: 'Checkbox',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { styleProps, rest } = extractStyleProps(others);\n const uuid = useId(id);\n const descriptionId = description ? `${uuid}-description` : undefined;\n const errorId = error && typeof error !== 'boolean' ? `${uuid}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, rest['aria-describedby']].filter(Boolean).join(' ') || undefined;\n\n const withContextProps = {\n checked: ctx?.value.includes(rest.value as string) ?? checked,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n if (readOnly) {\n return;\n }\n\n ctx?.onChange(event);\n onChange?.(event);\n },\n };\n\n const isDisabledByGroup = ctx?.isDisabled?.(rest.value as string) ?? false;\n const finalDisabled = disabled || isDisabledByGroup;\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate || false;\n\n if (indeterminate) {\n inputRef.current.setAttribute('data-indeterminate', 'true');\n } else {\n inputRef.current.removeAttribute('data-indeterminate');\n }\n }\n }, [indeterminate]);\n\n return (\n <InlineInput\n {...getStyles('root')}\n __staticSelector=\"Checkbox\"\n __stylesApiProps={props}\n id={uuid}\n size={_size}\n labelPosition={labelPosition}\n label={label}\n description={description}\n error={error}\n disabled={finalDisabled}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n data-checked={withContextProps.checked || checked || undefined}\n variant={variant}\n ref={rootRef}\n mod={mod}\n attributes={attributes}\n inert={rest.inert}\n {...styleProps}\n {...wrapperProps}\n >\n <Box {...getStyles('inner')} mod={{ 'data-label-position': labelPosition }}>\n <Box\n component=\"input\"\n id={uuid}\n ref={useMergedRef(inputRef, ref)}\n mod={{ error: !!error, 'with-error-styles': withErrorStyles }}\n {...getStyles('input', { focusable: true, variant })}\n {...rest}\n {...withContextProps}\n aria-describedby={describedBy}\n disabled={finalDisabled}\n inert={rest.inert}\n type=\"checkbox\"\n onClick={(event) => {\n if (readOnly && withContextProps.checked === undefined) {\n event.preventDefault();\n }\n\n onClick?.(event);\n }}\n />\n\n <Icon indeterminate={indeterminate} {...getStyles('icon')} />\n </Box>\n </InlineInput>\n );\n});\n\nCheckbox.classes = { ...classes, ...InlineInputClasses };\nCheckbox.varsResolver = varsResolver;\nCheckbox.displayName = '@mantine/core/Checkbox';\nCheckbox.Group = CheckboxGroup;\nCheckbox.Indicator = CheckboxIndicator;\nCheckbox.Card = CheckboxCard;\n\nexport namespace Checkbox {\n export type Props = CheckboxProps;\n export type StylesNames = CheckboxStylesNames;\n export type CssVariables = CheckboxCssVariables;\n export type Factory = CheckboxFactory;\n export type Variant = CheckboxVariant;\n export type IconComponent = CheckboxIconComponent;\n\n export namespace Group {\n export type Props = CheckboxGroupProps;\n export type StylesNames = CheckboxGroupStylesNames;\n export type Factory = CheckboxGroupFactory;\n }\n\n export namespace Indicator {\n export type Props = CheckboxIndicatorProps;\n export type StylesNames = CheckboxIndicatorStylesNames;\n export type CssVariables = CheckboxIndicatorCssVariables;\n export type Factory = CheckboxIndicatorFactory;\n export type Variant = CheckboxIndicatorVariant;\n }\n\n export namespace Card {\n export type Props = CheckboxCardProps;\n export type StylesNames = CheckboxCardStylesNames;\n export type CssVariables = CheckboxCardCssVariables;\n export type Factory = CheckboxCardFactory;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyHA,MAAM,eAAe;CACnB,eAAe;CACf,MAAM;CACN,iBAAiB;CACjB,SAAS;CACT,QAAQ;AACV;AAEA,MAAM,eAAe,oBAClB,OAAO,EAAE,QAAQ,OAAO,MAAM,WAAW,SAAS,mBAAmB;CACpE,MAAM,cAAc,gBA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e;AACxB,SAAS,cAAc;AACvB,SAAS,QAAQ;AACjB,SAAS,YAAY;AACrB,SAAS,OAAO"}
@@ -26,6 +26,7 @@ import { jsx } from "react/jsx-runtime";
26
26
  //#region packages/@mantine/core/src/components/Combobox/Combobox.tsx
27
27
  const defaultProps = {
28
28
  keepMounted: true,
29
+ keepMountedMode: "display-none",
29
30
  withinPortal: true,
30
31
  resetSelectionOnOptionHover: false,
31
32
  width: "target",