@mantine/core 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/cjs/NativeSelect/NativeSelect.js +2 -2
  2. package/cjs/NativeSelect/NativeSelect.js.map +1 -1
  3. package/cjs/Popover/Popover.js +12 -9
  4. package/cjs/Popover/Popover.js.map +1 -1
  5. package/cjs/Popover/PopoverDropdown/PopoverDropdown.js +2 -2
  6. package/cjs/Popover/PopoverDropdown/PopoverDropdown.js.map +1 -1
  7. package/cjs/Rating/Rating.js +16 -10
  8. package/cjs/Rating/Rating.js.map +1 -1
  9. package/cjs/Rating/RatingItem/RatingItem.js +4 -3
  10. package/cjs/Rating/RatingItem/RatingItem.js.map +1 -1
  11. package/cjs/Slider/utils/get-change-value/get-change-value.js +5 -5
  12. package/cjs/Slider/utils/get-change-value/get-change-value.js.map +1 -1
  13. package/cjs/Tooltip/Tooltip.js +3 -0
  14. package/cjs/Tooltip/Tooltip.js.map +1 -1
  15. package/cjs/TransferList/RenderList/RenderList.js +16 -6
  16. package/cjs/TransferList/RenderList/RenderList.js.map +1 -1
  17. package/cjs/TransferList/TransferList.js +32 -4
  18. package/cjs/TransferList/TransferList.js.map +1 -1
  19. package/esm/NativeSelect/NativeSelect.js +2 -2
  20. package/esm/NativeSelect/NativeSelect.js.map +1 -1
  21. package/esm/Popover/Popover.js +13 -10
  22. package/esm/Popover/Popover.js.map +1 -1
  23. package/esm/Popover/PopoverDropdown/PopoverDropdown.js +2 -2
  24. package/esm/Popover/PopoverDropdown/PopoverDropdown.js.map +1 -1
  25. package/esm/Rating/Rating.js +16 -10
  26. package/esm/Rating/Rating.js.map +1 -1
  27. package/esm/Rating/RatingItem/RatingItem.js +5 -4
  28. package/esm/Rating/RatingItem/RatingItem.js.map +1 -1
  29. package/esm/Slider/utils/get-change-value/get-change-value.js +5 -5
  30. package/esm/Slider/utils/get-change-value/get-change-value.js.map +1 -1
  31. package/esm/Tooltip/Tooltip.js +3 -0
  32. package/esm/Tooltip/Tooltip.js.map +1 -1
  33. package/esm/TransferList/RenderList/RenderList.js +16 -6
  34. package/esm/TransferList/RenderList/RenderList.js.map +1 -1
  35. package/esm/TransferList/TransferList.js +32 -4
  36. package/esm/TransferList/TransferList.js.map +1 -1
  37. package/lib/NativeSelect/NativeSelect.d.ts.map +1 -1
  38. package/lib/Popover/Popover.d.ts.map +1 -1
  39. package/lib/Rating/Rating.d.ts.map +1 -1
  40. package/lib/Rating/RatingItem/RatingItem.d.ts +2 -1
  41. package/lib/Rating/RatingItem/RatingItem.d.ts.map +1 -1
  42. package/lib/Tooltip/Tooltip.d.ts.map +1 -1
  43. package/lib/TransferList/RenderList/RenderList.d.ts +10 -1
  44. package/lib/TransferList/RenderList/RenderList.d.ts.map +1 -1
  45. package/lib/TransferList/TransferList.d.ts +17 -3
  46. package/lib/TransferList/TransferList.d.ts.map +1 -1
  47. package/package.json +4 -4
@@ -44,7 +44,8 @@ var __objRest = (source, exclude) => {
44
44
  return target;
45
45
  };
46
46
  const defaultProps = {
47
- size: "sm"
47
+ size: "sm",
48
+ defaultValue: ""
48
49
  };
49
50
  const NativeSelect = React.forwardRef((props, ref) => {
50
51
  const _a = useInputProps.useInputProps("NativeSelect", defaultProps, props), {
@@ -81,7 +82,6 @@ const NativeSelect = React.forwardRef((props, ref) => {
81
82
  options.unshift(/* @__PURE__ */ React__default.createElement("option", {
82
83
  key: "placeholder",
83
84
  value: "",
84
- selected: true,
85
85
  disabled: true,
86
86
  hidden: true
87
87
  }, placeholder));
@@ -1 +1 @@
1
- {"version":3,"file":"NativeSelect.js","sources":["../../src/NativeSelect/NativeSelect.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, MantineSize, useMantineTheme } from '@mantine/styles';\nimport {\n InputWrapperBaseProps,\n InputWrapperStylesNames,\n Input,\n InputSharedProps,\n InputStylesNames,\n useInputProps,\n} from '../Input';\nimport { getSelectRightSectionProps } from '../Select/SelectRightSection/get-select-right-section-props';\nimport { SelectItem } from '../Select/types';\n\nexport type NativeSelectStylesNames = InputStylesNames | InputWrapperStylesNames;\n\nexport interface NativeSelectProps\n extends DefaultProps<NativeSelectStylesNames>,\n InputWrapperBaseProps,\n InputSharedProps,\n Omit<React.ComponentPropsWithoutRef<'select'>, 'size'> {\n /** id is used to bind input and label, if not passed unique id will be generated for each input */\n id?: string;\n\n /** Adds hidden option to select and sets it as selected if value is not present */\n placeholder?: string;\n\n /** Data used to render options */\n data: (string | SelectItem)[];\n\n /** Props passed to root element (InputWrapper component) */\n wrapperProps?: Record<string, any>;\n\n /** Input size */\n size?: MantineSize;\n}\n\nconst defaultProps: Partial<NativeSelectProps> = {\n size: 'sm',\n};\n\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>((props, ref) => {\n const {\n inputProps,\n wrapperProps,\n data,\n placeholder,\n onChange,\n value,\n classNames,\n styles,\n rightSection,\n rightSectionWidth,\n ...others\n } = useInputProps('NativeSelect', defaultProps, props);\n const theme = useMantineTheme();\n\n const formattedData = data.map((item) =>\n typeof item === 'string' ? { label: item, value: item } : item\n );\n\n const options = formattedData.map((item) => (\n <option key={item.value} value={item.value} disabled={item.disabled}>\n {item.label}\n </option>\n ));\n\n if (placeholder) {\n options.unshift(\n <option key=\"placeholder\" value=\"\" selected disabled hidden>\n {placeholder}\n </option>\n );\n }\n\n return (\n <Input.Wrapper {...wrapperProps} __staticSelector=\"NativeSelect\">\n <Input<'select'>\n {...inputProps}\n {...others}\n onChange={onChange}\n component=\"select\"\n ref={ref}\n value={value === null ? '' : value}\n __staticSelector=\"NativeSelect\"\n pointer={theme.cursorType === 'pointer'}\n {...getSelectRightSectionProps({\n theme,\n rightSection,\n rightSectionWidth,\n styles,\n shouldClear: false,\n size: inputProps.size,\n error: wrapperProps.error,\n readOnly: false,\n })}\n >\n {options}\n </Input>\n </Input.Wrapper>\n );\n});\n\nNativeSelect.displayName = '@mantine/core/NativeSelect';\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AAE,EAAE,YAAY,CAAC,EAAE;AAC5G,IAAI,gBAAgB,EAAE,cAAc;AACpC,GAAG,CAAC,kBAAkBD,cAAK,CAAC,aAAa,CAACC,WAAK,EAAE,cAAc,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE;AACtI,IAAI,QAAQ;AACZ,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,GAAG;AACP,IAAI,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK;AACtC,IAAI,gBAAgB,EAAE,cAAc;AACpC,IAAI,OAAO,EAAE,KAAK,CAAC,UAAU,KAAK,SAAS;AAC3C,GAAG,CAAC,EAAEC,qDAA0B,CAAC;AACjC,IAAI,KAAK;AACT,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,YAAIJ,QAAM;AACV,IAAI,WAAW,EAAE,KAAK;AACtB,IAAI,IAAI,EAAE,UAAU,CAAC,IAAI;AACzB,IAAI,KAAK,EAAE,YAAY,CAAC,KAAK;AAC7B,IAAI,QAAQ,EAAE,KAAK;AACnB,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AACjB,CAAC,EAAE;AACH,YAAY,CAAC,WAAW,GAAG,4BAA4B;;;;"}
1
+ {"version":3,"file":"NativeSelect.js","sources":["../../src/NativeSelect/NativeSelect.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, MantineSize, useMantineTheme } from '@mantine/styles';\nimport {\n InputWrapperBaseProps,\n InputWrapperStylesNames,\n Input,\n InputSharedProps,\n InputStylesNames,\n useInputProps,\n} from '../Input';\nimport { getSelectRightSectionProps } from '../Select/SelectRightSection/get-select-right-section-props';\nimport { SelectItem } from '../Select/types';\n\nexport type NativeSelectStylesNames = InputStylesNames | InputWrapperStylesNames;\n\nexport interface NativeSelectProps\n extends DefaultProps<NativeSelectStylesNames>,\n InputWrapperBaseProps,\n InputSharedProps,\n Omit<React.ComponentPropsWithoutRef<'select'>, 'size'> {\n /** id is used to bind input and label, if not passed unique id will be generated for each input */\n id?: string;\n\n /** Adds hidden option to select and sets it as selected if value is not present */\n placeholder?: string;\n\n /** Data used to render options */\n data: (string | SelectItem)[];\n\n /** Props passed to root element (InputWrapper component) */\n wrapperProps?: Record<string, any>;\n\n /** Input size */\n size?: MantineSize;\n}\n\nconst defaultProps: Partial<NativeSelectProps> = {\n size: 'sm',\n defaultValue: '',\n};\n\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>((props, ref) => {\n const {\n inputProps,\n wrapperProps,\n data,\n placeholder,\n onChange,\n value,\n classNames,\n styles,\n rightSection,\n rightSectionWidth,\n ...others\n } = useInputProps('NativeSelect', defaultProps, props);\n const theme = useMantineTheme();\n\n const formattedData = data.map((item) =>\n typeof item === 'string' ? { label: item, value: item } : item\n );\n\n const options = formattedData.map((item) => (\n <option key={item.value} value={item.value} disabled={item.disabled}>\n {item.label}\n </option>\n ));\n\n if (placeholder) {\n options.unshift(\n <option key=\"placeholder\" value=\"\" disabled hidden>\n {placeholder}\n </option>\n );\n }\n\n return (\n <Input.Wrapper {...wrapperProps} __staticSelector=\"NativeSelect\">\n <Input<'select'>\n {...inputProps}\n {...others}\n onChange={onChange}\n component=\"select\"\n ref={ref}\n value={value === null ? '' : value}\n __staticSelector=\"NativeSelect\"\n pointer={theme.cursorType === 'pointer'}\n {...getSelectRightSectionProps({\n theme,\n rightSection,\n rightSectionWidth,\n styles,\n shouldClear: false,\n size: inputProps.size,\n error: wrapperProps.error,\n readOnly: false,\n })}\n >\n {options}\n </Input>\n </Input.Wrapper>\n );\n});\n\nNativeSelect.displayName = '@mantine/core/NativeSelect';\n"],"names":["forwardRef","useInputProps","styles","useMantineTheme","React","Input","getSelectRightSectionProps"],"mappings":";;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,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C,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE;AACtI,IAAI,QAAQ;AACZ,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,GAAG;AACP,IAAI,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK;AACtC,IAAI,gBAAgB,EAAE,cAAc;AACpC,IAAI,OAAO,EAAE,KAAK,CAAC,UAAU,KAAK,SAAS;AAC3C,GAAG,CAAC,EAAEC,qDAA0B,CAAC;AACjC,IAAI,KAAK;AACT,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,YAAIJ,QAAM;AACV,IAAI,WAAW,EAAE,KAAK;AACtB,IAAI,IAAI,EAAE,UAAU,CAAC,IAAI;AACzB,IAAI,KAAK,EAAE,YAAY,CAAC,KAAK;AAC7B,IAAI,QAAQ,EAAE,KAAK;AACnB,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AACjB,CAAC,EAAE;AACH,YAAY,CAAC,WAAW,GAAG,4BAA4B;;;;"}
@@ -47,7 +47,8 @@ const defaultProps = {
47
47
  returnFocus: false,
48
48
  clickOutsideEvents: ["mousedown", "touchstart"],
49
49
  zIndex: styles.getDefaultZIndex("popover"),
50
- __staticSelector: "Popover"
50
+ __staticSelector: "Popover",
51
+ width: "max-content"
51
52
  };
52
53
  function Popover(props) {
53
54
  var _b, _c, _d, _e, _f, _g;
@@ -145,6 +146,14 @@ function Popover(props) {
145
146
  targetNode,
146
147
  dropdownNode
147
148
  ]);
149
+ const reference = React.useCallback((node) => {
150
+ setTargetNode(node);
151
+ popover.floating.reference(node);
152
+ }, [popover.floating.reference]);
153
+ const floating = React.useCallback((node) => {
154
+ setDropdownNode(node);
155
+ popover.floating.floating(node);
156
+ }, [popover.floating.floating]);
148
157
  return /* @__PURE__ */ React__default.createElement(styles.StylesApiProvider, {
149
158
  classNames,
150
159
  styles: styles$1,
@@ -155,14 +164,8 @@ function Popover(props) {
155
164
  returnFocus,
156
165
  disabled,
157
166
  controlled: popover.controlled,
158
- reference: (node) => {
159
- setTargetNode(node);
160
- popover.floating.reference(node);
161
- },
162
- floating: (node) => {
163
- setDropdownNode(node);
164
- popover.floating.floating(node);
165
- },
167
+ reference,
168
+ floating,
166
169
  x: popover.floating.x,
167
170
  y: popover.floating.y,
168
171
  arrowX: (_d = (_c = (_b = popover.floating) == null ? void 0 : _b.middlewareData) == null ? void 0 : _c.arrow) == null ? void 0 : _d.x,
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../src/Popover/Popover.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\n\nimport React, { useRef, useState } from 'react';\nimport { useId, useClickOutside } from '@mantine/hooks';\nimport {\n useMantineTheme,\n ClassNames,\n Styles,\n StylesApiProvider,\n MantineNumberSize,\n MantineShadow,\n getDefaultZIndex,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { MantineTransition } from '../Transition';\nimport { getFloatingPosition, FloatingPosition } from '../Floating';\nimport { usePopover } from './use-popover';\nimport { PopoverContextProvider } from './Popover.context';\nimport {\n PopoverWidth,\n PopoverMiddlewares,\n PopoverStylesNames,\n PopoverStylesParams,\n} from './Popover.types';\nimport { PopoverTarget } from './PopoverTarget/PopoverTarget';\nimport { PopoverDropdown } from './PopoverDropdown/PopoverDropdown';\n\nexport interface PopoverBaseProps {\n /** Dropdown position relative to target */\n position?: FloatingPosition;\n\n /** Space between target element and dropdown in px */\n offset?: number;\n\n /** Called when dropdown position changes */\n onPositionChange?(position: FloatingPosition): void;\n\n /** useEffect dependencies to force update dropdown position */\n positionDependencies?: any[];\n\n /** Called when dropdown closes */\n onClose?(): void;\n\n /** Called when dropdown opens */\n onOpen?(): void;\n\n /** One of premade transitions ot transition object */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Exit transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Dropdown width, or 'target' to make dropdown width the same as target element */\n width?: PopoverWidth;\n\n /** Floating ui middlewares to configure position handling */\n middlewares?: PopoverMiddlewares;\n\n /** Determines whether component should have an arrow */\n withArrow?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Arrow offset in px */\n arrowOffset?: number;\n\n /** Determines whether dropdown should be rendered within Portal, defaults to false */\n withinPortal?: boolean;\n\n /** Dropdown z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Radius from theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Key of theme.shadow or any other valid css box-shadow value */\n shadow?: MantineShadow;\n\n /** If set, popover dropdown will not render */\n disabled?: boolean;\n\n /** Determines whether focus should be automatically returned to control when dropdown closes, false by default */\n returnFocus?: boolean;\n}\n\nexport interface PopoverProps extends PopoverBaseProps {\n /** Popover.Target and Popover.Dropdown components */\n children: React.ReactNode;\n\n /** Initial opened state for uncontrolled component */\n defaultOpened?: boolean;\n\n /** Controls dropdown opened state */\n opened?: boolean;\n\n /** Called with current state when dropdown opens or closes */\n onChange?(opened: boolean): void;\n\n /** Determines whether dropdown should be closed on outside clicks, default to true */\n closeOnClickOutside?: boolean;\n\n /** Events that trigger outside clicks */\n clickOutsideEvents?: string[];\n\n /** Determines whether focus should be trapped within dropdown, default to false */\n trapFocus?: boolean;\n\n /** Determines whether dropdown should be closed when Escape key is pressed, defaults to true */\n closeOnEscape?: boolean;\n\n /** id base to create accessibility connections */\n id?: string;\n\n /** Determines whether dropdown and target element should have accessible roles, defaults to true */\n withRoles?: boolean;\n\n unstyled?: boolean;\n classNames?: ClassNames<PopoverStylesNames>;\n styles?: Styles<PopoverStylesNames, PopoverStylesParams>;\n __staticSelector?: string;\n}\n\nconst defaultProps: Partial<PopoverProps> = {\n position: 'bottom',\n offset: 8,\n positionDependencies: [],\n transition: 'fade',\n transitionDuration: 150,\n middlewares: { flip: true, shift: true, inline: false },\n arrowSize: 7,\n arrowOffset: 5,\n closeOnClickOutside: true,\n withinPortal: false,\n closeOnEscape: true,\n trapFocus: false,\n withRoles: true,\n returnFocus: false,\n clickOutsideEvents: ['mousedown', 'touchstart'],\n zIndex: getDefaultZIndex('popover'),\n __staticSelector: 'Popover',\n};\n\nexport function Popover(props: PopoverProps) {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n const {\n children,\n position,\n offset,\n onPositionChange,\n positionDependencies,\n opened,\n transition,\n transitionDuration,\n width,\n middlewares,\n withArrow,\n arrowSize,\n arrowOffset,\n unstyled,\n classNames,\n styles,\n closeOnClickOutside,\n withinPortal,\n closeOnEscape,\n clickOutsideEvents,\n trapFocus,\n onClose,\n onOpen,\n onChange,\n zIndex,\n radius,\n shadow,\n id,\n defaultOpened,\n exitTransitionDuration,\n __staticSelector,\n withRoles,\n disabled,\n returnFocus,\n ...others\n } = useComponentDefaultProps('Popover', defaultProps, props);\n\n const [targetNode, setTargetNode] = useState<HTMLElement>(null);\n const [dropdownNode, setDropdownNode] = useState<HTMLElement>(null);\n\n const uid = useId(id);\n const theme = useMantineTheme();\n const popover = usePopover({\n middlewares,\n width,\n position: getFloatingPosition(theme.dir, position),\n offset: offset + (withArrow ? arrowSize / 2 : 0),\n arrowRef,\n onPositionChange,\n positionDependencies,\n opened,\n defaultOpened,\n onChange,\n onOpen,\n onClose,\n });\n\n useClickOutside(() => closeOnClickOutside && popover.onClose(), clickOutsideEvents, [\n targetNode,\n dropdownNode,\n ]);\n\n return (\n <StylesApiProvider\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n staticSelector={__staticSelector}\n >\n <PopoverContextProvider\n value={{\n returnFocus,\n disabled,\n controlled: popover.controlled,\n reference: (node) => {\n setTargetNode(node as HTMLElement);\n popover.floating.reference(node);\n },\n floating: (node) => {\n setDropdownNode(node);\n popover.floating.floating(node);\n },\n x: popover.floating.x,\n y: popover.floating.y,\n arrowX: popover.floating?.middlewareData?.arrow?.x,\n arrowY: popover.floating?.middlewareData?.arrow?.y,\n opened: popover.opened,\n arrowRef,\n transition,\n transitionDuration,\n exitTransitionDuration,\n width,\n withArrow,\n arrowSize,\n arrowOffset,\n placement: popover.floating.placement,\n trapFocus,\n withinPortal,\n zIndex,\n radius,\n shadow,\n closeOnEscape,\n onClose: popover.onClose,\n onToggle: popover.onToggle,\n getTargetId: () => `${uid}-target`,\n getDropdownId: () => `${uid}-dropdown`,\n withRoles,\n targetProps: others,\n }}\n >\n {children}\n </PopoverContextProvider>\n </StylesApiProvider>\n );\n}\n\nPopover.Target = PopoverTarget;\nPopover.Dropdown = PopoverDropdown;\nPopover.displayName = '@mantine/core/Popover';\n"],"names":["getDefaultZIndex","useRef","useComponentDefaultProps","styles","useState","useId","useMantineTheme","usePopover","getFloatingPosition","useClickOutside","React","StylesApiProvider","PopoverContextProvider","PopoverTarget","PopoverDropdown"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK;AACrC,EAAE,IAAI,MAAM,GAAG,EAAE,CAAC;AAClB,EAAE,KAAK,IAAI,IAAI,IAAI,MAAM;AACzB,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AACpE,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,EAAE,IAAI,MAAM,IAAI,IAAI,IAAI,mBAAmB;AAC3C,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;AAClD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAA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O,EAAE,OAAO,CAAC,OAAO;AAC9B,MAAM,QAAQ,EAAE,OAAO,CAAC,QAAQ;AAChC,MAAM,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;AACxC,MAAM,aAAa,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC;AAC5C,MAAM,SAAS;AACf,MAAM,WAAW,EAAE,MAAM;AACzB,KAAK;AACL,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChB,CAAC;AACD,OAAO,CAAC,MAAM,GAAGC,2BAAa,CAAC;AAC/B,OAAO,CAAC,QAAQ,GAAGC,+BAAe,CAAC;AACnC,OAAO,CAAC,WAAW,GAAG,uBAAuB;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../src/Popover/Popover.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\n\nimport React, { useRef, useState, useCallback } from 'react';\nimport { useId, useClickOutside } from '@mantine/hooks';\nimport {\n useMantineTheme,\n ClassNames,\n Styles,\n StylesApiProvider,\n MantineNumberSize,\n MantineShadow,\n getDefaultZIndex,\n useComponentDefaultProps,\n} from '@mantine/styles';\nimport { MantineTransition } from '../Transition';\nimport { getFloatingPosition, FloatingPosition } from '../Floating';\nimport { usePopover } from './use-popover';\nimport { PopoverContextProvider } from './Popover.context';\nimport {\n PopoverWidth,\n PopoverMiddlewares,\n PopoverStylesNames,\n PopoverStylesParams,\n} from './Popover.types';\nimport { PopoverTarget } from './PopoverTarget/PopoverTarget';\nimport { PopoverDropdown } from './PopoverDropdown/PopoverDropdown';\n\nexport interface PopoverBaseProps {\n /** Dropdown position relative to target */\n position?: FloatingPosition;\n\n /** Space between target element and dropdown in px */\n offset?: number;\n\n /** Called when dropdown position changes */\n onPositionChange?(position: FloatingPosition): void;\n\n /** useEffect dependencies to force update dropdown position */\n positionDependencies?: any[];\n\n /** Called when dropdown closes */\n onClose?(): void;\n\n /** Called when dropdown opens */\n onOpen?(): void;\n\n /** One of premade transitions ot transition object */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Exit transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Dropdown width, or 'target' to make dropdown width the same as target element */\n width?: PopoverWidth;\n\n /** Floating ui middlewares to configure position handling */\n middlewares?: PopoverMiddlewares;\n\n /** Determines whether component should have an arrow */\n withArrow?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Arrow offset in px */\n arrowOffset?: number;\n\n /** Determines whether dropdown should be rendered within Portal, defaults to false */\n withinPortal?: boolean;\n\n /** Dropdown z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Radius from theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Key of theme.shadow or any other valid css box-shadow value */\n shadow?: MantineShadow;\n\n /** If set, popover dropdown will not render */\n disabled?: boolean;\n\n /** Determines whether focus should be automatically returned to control when dropdown closes, false by default */\n returnFocus?: boolean;\n}\n\nexport interface PopoverProps extends PopoverBaseProps {\n /** Popover.Target and Popover.Dropdown components */\n children: React.ReactNode;\n\n /** Initial opened state for uncontrolled component */\n defaultOpened?: boolean;\n\n /** Controls dropdown opened state */\n opened?: boolean;\n\n /** Called with current state when dropdown opens or closes */\n onChange?(opened: boolean): void;\n\n /** Determines whether dropdown should be closed on outside clicks, default to true */\n closeOnClickOutside?: boolean;\n\n /** Events that trigger outside clicks */\n clickOutsideEvents?: string[];\n\n /** Determines whether focus should be trapped within dropdown, default to false */\n trapFocus?: boolean;\n\n /** Determines whether dropdown should be closed when Escape key is pressed, defaults to true */\n closeOnEscape?: boolean;\n\n /** id base to create accessibility connections */\n id?: string;\n\n /** Determines whether dropdown and target element should have accessible roles, defaults to true */\n withRoles?: boolean;\n\n unstyled?: boolean;\n classNames?: ClassNames<PopoverStylesNames>;\n styles?: Styles<PopoverStylesNames, PopoverStylesParams>;\n __staticSelector?: string;\n}\n\nconst defaultProps: Partial<PopoverProps> = {\n position: 'bottom',\n offset: 8,\n positionDependencies: [],\n transition: 'fade',\n transitionDuration: 150,\n middlewares: { flip: true, shift: true, inline: false },\n arrowSize: 7,\n arrowOffset: 5,\n closeOnClickOutside: true,\n withinPortal: false,\n closeOnEscape: true,\n trapFocus: false,\n withRoles: true,\n returnFocus: false,\n clickOutsideEvents: ['mousedown', 'touchstart'],\n zIndex: getDefaultZIndex('popover'),\n __staticSelector: 'Popover',\n width: 'max-content',\n};\n\nexport function Popover(props: PopoverProps) {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n const {\n children,\n position,\n offset,\n onPositionChange,\n positionDependencies,\n opened,\n transition,\n transitionDuration,\n width,\n middlewares,\n withArrow,\n arrowSize,\n arrowOffset,\n unstyled,\n classNames,\n styles,\n closeOnClickOutside,\n withinPortal,\n closeOnEscape,\n clickOutsideEvents,\n trapFocus,\n onClose,\n onOpen,\n onChange,\n zIndex,\n radius,\n shadow,\n id,\n defaultOpened,\n exitTransitionDuration,\n __staticSelector,\n withRoles,\n disabled,\n returnFocus,\n ...others\n } = useComponentDefaultProps('Popover', defaultProps, props);\n\n const [targetNode, setTargetNode] = useState<HTMLElement>(null);\n const [dropdownNode, setDropdownNode] = useState<HTMLElement>(null);\n\n const uid = useId(id);\n const theme = useMantineTheme();\n const popover = usePopover({\n middlewares,\n width,\n position: getFloatingPosition(theme.dir, position),\n offset: offset + (withArrow ? arrowSize / 2 : 0),\n arrowRef,\n onPositionChange,\n positionDependencies,\n opened,\n defaultOpened,\n onChange,\n onOpen,\n onClose,\n });\n\n useClickOutside(() => closeOnClickOutside && popover.onClose(), clickOutsideEvents, [\n targetNode,\n dropdownNode,\n ]);\n\n const reference = useCallback(\n (node: HTMLElement) => {\n setTargetNode(node);\n popover.floating.reference(node);\n },\n [popover.floating.reference]\n );\n\n const floating = useCallback(\n (node: HTMLElement) => {\n setDropdownNode(node);\n popover.floating.floating(node);\n },\n [popover.floating.floating]\n );\n\n return (\n <StylesApiProvider\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n staticSelector={__staticSelector}\n >\n <PopoverContextProvider\n value={{\n returnFocus,\n disabled,\n controlled: popover.controlled,\n reference,\n floating,\n x: popover.floating.x,\n y: popover.floating.y,\n arrowX: popover.floating?.middlewareData?.arrow?.x,\n arrowY: popover.floating?.middlewareData?.arrow?.y,\n opened: popover.opened,\n arrowRef,\n transition,\n transitionDuration,\n exitTransitionDuration,\n width,\n withArrow,\n arrowSize,\n arrowOffset,\n placement: popover.floating.placement,\n trapFocus,\n withinPortal,\n zIndex,\n radius,\n shadow,\n closeOnEscape,\n onClose: popover.onClose,\n onToggle: popover.onToggle,\n getTargetId: () => `${uid}-target`,\n getDropdownId: () => `${uid}-dropdown`,\n withRoles,\n targetProps: others,\n }}\n >\n {children}\n </PopoverContextProvider>\n </StylesApiProvider>\n );\n}\n\nPopover.Target = PopoverTarget;\nPopover.Dropdown = PopoverDropdown;\nPopover.displayName = '@mantine/core/Popover';\n"],"names":["getDefaultZIndex","useRef","useComponentDefaultProps","styles","useState","useId","useMantineTheme","usePopover","getFloatingPosition","useClickOutside","useCallback","React","StylesApiProvider","PopoverContextProvider","PopoverTarget","PopoverDropdown"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK;AACrC,EAAE,IAAI,MAAM,GAAG,EAAE,CAAC;AAClB,EAAE,KAAK,IAAI,IAAI,IAAI,MAAM;AACzB,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AACpE,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,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AI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;AAC5I,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM;AAC5B,MAAM,QAAQ;AACd,MAAM,UAAU;AAChB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,WAAW;AACjB,MAAM,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,SAAS;AAC3C,MAAM,SAAS;AACf,MAAM,YAAY;AAClB,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,MAAM,aAAa;AACnB,MAAM,OAAO,EAAE,OAAO,CAAC,OAAO;AAC9B,MAAM,QAAQ,EAAE,OAAO,CAAC,QAAQ;AAChC,MAAM,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;AACxC,MAAM,aAAa,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC;AAC5C,MAAM,SAAS;AACf,MAAM,WAAW,EAAE,MAAM;AACzB,KAAK;AACL,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChB,CAAC;AACD,OAAO,CAAC,MAAM,GAAGC,2BAAa,CAAC;AAC/B,OAAO,CAAC,QAAQ,GAAGC,+BAAe,CAAC;AACnC,OAAO,CAAC,WAAW,GAAG,uBAAuB;;;;"}
@@ -92,8 +92,8 @@ function PopoverDropdown(_a) {
92
92
  ref: ctx.floating,
93
93
  style: __spreadProps(__spreadValues(__spreadValues({}, style), transitionStyles), {
94
94
  zIndex: ctx.zIndex,
95
- top: (_a2 = ctx.y) != null ? _a2 : "",
96
- left: (_b2 = ctx.x) != null ? _b2 : "",
95
+ top: (_a2 = ctx.y) != null ? _a2 : 0,
96
+ left: (_b2 = ctx.x) != null ? _b2 : 0,
97
97
  width: ctx.width === "target" ? void 0 : ctx.width
98
98
  }),
99
99
  className: cx(classes.dropdown, className),
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverDropdown.js","sources":["../../../src/Popover/PopoverDropdown/PopoverDropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DefaultProps, useContextStylesApi } from '@mantine/styles';\nimport { closeOnEscape } from '@mantine/utils';\nimport { useFocusReturn } from '@mantine/hooks';\nimport { FloatingArrow } from '../../Floating';\nimport { Box } from '../../Box';\nimport { Transition } from '../../Transition';\nimport { FocusTrap } from '../../FocusTrap';\nimport { OptionalPortal } from '../../Portal';\nimport { usePopoverContext } from '../Popover.context';\nimport useStyles from './PopoverDropdown.styles';\n\nexport interface PopoverDropdownProps extends DefaultProps, React.ComponentPropsWithoutRef<'div'> {\n /** Dropdown content */\n children?: React.ReactNode;\n}\n\nexport function PopoverDropdown({\n style,\n className,\n children,\n onKeyDownCapture,\n ...others\n}: PopoverDropdownProps) {\n const { classNames, styles, unstyled, staticSelector } = useContextStylesApi();\n const ctx = usePopoverContext();\n const { classes, cx } = useStyles(\n { radius: ctx.radius, shadow: ctx.shadow },\n { name: staticSelector, classNames, styles, unstyled }\n );\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 }\n : {};\n\n if (ctx.disabled) {\n return null;\n }\n\n return (\n <OptionalPortal withinPortal={ctx.withinPortal}>\n <Transition\n mounted={ctx.opened}\n transition={ctx.transition}\n duration={ctx.transitionDuration}\n exitDuration={\n typeof ctx.exitTransitionDuration === 'number'\n ? ctx.exitTransitionDuration\n : ctx.transitionDuration\n }\n >\n {(transitionStyles) => (\n <FocusTrap active={ctx.trapFocus}>\n <Box\n {...accessibleProps}\n tabIndex={-1}\n ref={ctx.floating}\n style={{\n ...style,\n ...transitionStyles,\n zIndex: ctx.zIndex,\n top: ctx.y ?? '',\n left: ctx.x ?? '',\n width: ctx.width === 'target' ? undefined : ctx.width,\n }}\n className={cx(classes.dropdown, className)}\n onKeyDownCapture={closeOnEscape(ctx.onClose, {\n active: ctx.closeOnEscape,\n onTrigger: returnFocus,\n onKeyDown: onKeyDownCapture,\n })}\n data-position={ctx.placement}\n {...others}\n >\n {children}\n\n <FloatingArrow\n ref={ctx.arrowRef}\n arrowX={ctx.arrowX}\n arrowY={ctx.arrowY}\n visible={ctx.withArrow}\n withBorder\n position={ctx.placement}\n arrowSize={ctx.arrowSize}\n arrowOffset={ctx.arrowOffset}\n className={classes.arrow}\n />\n </Box>\n </FocusTrap>\n )}\n </Transition>\n </OptionalPortal>\n );\n}\n\nPopoverDropdown.displayName = '@mantine/core/PopoverDropdown';\n"],"names":["styles","useContextStylesApi","usePopoverContext","useStyles","useFocusReturn","React","OptionalPortal","Transition","FocusTrap","Box","closeOnEscape","FloatingArrow"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,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GAAG,CAAC,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK;AAC1D,OAAO,CAAC;AACR,MAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC;AAChD,MAAM,gBAAgB,EAAEC,mBAAa,CAAC,GAAG,CAAC,OAAO,EAAE;AACnD,QAAQ,MAAM,EAAE,GAAG,CAAC,aAAa;AACjC,QAAQ,SAAS,EAAE,WAAW;AAC9B,QAAQ,SAAS,EAAE,gBAAgB;AACnC,OAAO,CAAC;AACR,MAAM,eAAe,EAAE,GAAG,CAAC,SAAS;AACpC,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,kBAAkBL,cAAK,CAAC,aAAa,CAACM,2BAAa,EAAE;AAC9E,MAAM,GAAG,EAAE,GAAG,CAAC,QAAQ;AACvB,MAAM,MAAM,EAAE,GAAG,CAAC,MAAM;AACxB,MAAM,MAAM,EAAE,GAAG,CAAC,MAAM;AACxB,MAAM,OAAO,EAAE,GAAG,CAAC,SAAS;AAC5B,MAAM,UAAU,EAAE,IAAI;AACtB,MAAM,QAAQ,EAAE,GAAG,CAAC,SAAS;AAC7B,MAAM,SAAS,EAAE,GAAG,CAAC,SAAS;AAC9B,MAAM,WAAW,EAAE,GAAG,CAAC,WAAW;AAClC,MAAM,SAAS,EAAE,OAAO,CAAC,KAAK;AAC9B,KAAK,CAAC,CAAC,CAAC,CAAC;AACT,GAAG,CAAC,CAAC,CAAC;AACN,CAAC;AACD,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
1
+ {"version":3,"file":"PopoverDropdown.js","sources":["../../../src/Popover/PopoverDropdown/PopoverDropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DefaultProps, useContextStylesApi } from '@mantine/styles';\nimport { closeOnEscape } from '@mantine/utils';\nimport { useFocusReturn } from '@mantine/hooks';\nimport { FloatingArrow } from '../../Floating';\nimport { Box } from '../../Box';\nimport { Transition } from '../../Transition';\nimport { FocusTrap } from '../../FocusTrap';\nimport { OptionalPortal } from '../../Portal';\nimport { usePopoverContext } from '../Popover.context';\nimport useStyles from './PopoverDropdown.styles';\n\nexport interface PopoverDropdownProps extends DefaultProps, React.ComponentPropsWithoutRef<'div'> {\n /** Dropdown content */\n children?: React.ReactNode;\n}\n\nexport function PopoverDropdown({\n style,\n className,\n children,\n onKeyDownCapture,\n ...others\n}: PopoverDropdownProps) {\n const { classNames, styles, unstyled, staticSelector } = useContextStylesApi();\n const ctx = usePopoverContext();\n const { classes, cx } = useStyles(\n { radius: ctx.radius, shadow: ctx.shadow },\n { name: staticSelector, classNames, styles, unstyled }\n );\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 }\n : {};\n\n if (ctx.disabled) {\n return null;\n }\n\n return (\n <OptionalPortal withinPortal={ctx.withinPortal}>\n <Transition\n mounted={ctx.opened}\n transition={ctx.transition}\n duration={ctx.transitionDuration}\n exitDuration={\n typeof ctx.exitTransitionDuration === 'number'\n ? ctx.exitTransitionDuration\n : ctx.transitionDuration\n }\n >\n {(transitionStyles) => (\n <FocusTrap active={ctx.trapFocus}>\n <Box\n {...accessibleProps}\n tabIndex={-1}\n ref={ctx.floating}\n style={{\n ...style,\n ...transitionStyles,\n zIndex: ctx.zIndex,\n top: ctx.y ?? 0,\n left: ctx.x ?? 0,\n width: ctx.width === 'target' ? undefined : ctx.width,\n }}\n className={cx(classes.dropdown, className)}\n onKeyDownCapture={closeOnEscape(ctx.onClose, {\n active: ctx.closeOnEscape,\n onTrigger: returnFocus,\n onKeyDown: onKeyDownCapture,\n })}\n data-position={ctx.placement}\n {...others}\n >\n {children}\n\n <FloatingArrow\n ref={ctx.arrowRef}\n arrowX={ctx.arrowX}\n arrowY={ctx.arrowY}\n visible={ctx.withArrow}\n withBorder\n position={ctx.placement}\n arrowSize={ctx.arrowSize}\n arrowOffset={ctx.arrowOffset}\n className={classes.arrow}\n />\n </Box>\n </FocusTrap>\n )}\n </Transition>\n </OptionalPortal>\n );\n}\n\nPopoverDropdown.displayName = '@mantine/core/PopoverDropdown';\n"],"names":["styles","useContextStylesApi","usePopoverContext","useStyles","useFocusReturn","React","OptionalPortal","Transition","FocusTrap","Box","closeOnEscape","FloatingArrow"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAA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S,EAAE,WAAW;AAC9B,QAAQ,SAAS,EAAE,gBAAgB;AACnC,OAAO,CAAC;AACR,MAAM,eAAe,EAAE,GAAG,CAAC,SAAS;AACpC,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,kBAAkBL,cAAK,CAAC,aAAa,CAACM,2BAAa,EAAE;AAC9E,MAAM,GAAG,EAAE,GAAG,CAAC,QAAQ;AACvB,MAAM,MAAM,EAAE,GAAG,CAAC,MAAM;AACxB,MAAM,MAAM,EAAE,GAAG,CAAC,MAAM;AACxB,MAAM,OAAO,EAAE,GAAG,CAAC,SAAS;AAC5B,MAAM,UAAU,EAAE,IAAI;AACtB,MAAM,QAAQ,EAAE,GAAG,CAAC,SAAS;AAC7B,MAAM,SAAS,EAAE,GAAG,CAAC,SAAS;AAC9B,MAAM,WAAW,EAAE,GAAG,CAAC,WAAW;AAClC,MAAM,SAAS,EAAE,OAAO,CAAC,KAAK;AAC9B,KAAK,CAAC,CAAC,CAAC,CAAC;AACT,GAAG,CAAC,CAAC,CAAC;AACN,CAAC;AACD,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
@@ -76,7 +76,8 @@ const Rating = React.forwardRef((props, ref) => {
76
76
  onMouseMove,
77
77
  onMouseLeave,
78
78
  highlightSelectedOnly,
79
- color
79
+ color,
80
+ id
80
81
  } = _a, others = __objRest(_a, [
81
82
  "defaultValue",
82
83
  "value",
@@ -98,10 +99,12 @@ const Rating = React.forwardRef((props, ref) => {
98
99
  "onMouseMove",
99
100
  "onMouseLeave",
100
101
  "highlightSelectedOnly",
101
- "color"
102
+ "color",
103
+ "id"
102
104
  ]);
103
105
  const { classes, cx, theme } = Rating_styles['default'](null, { name: "Rating", classNames, styles: styles$1, unstyled });
104
106
  const _name = hooks.useId(name);
107
+ const _id = hooks.useId(id);
105
108
  const rootRef = React.useRef(null);
106
109
  const [_value, setValue] = hooks.useUncontrolled({
107
110
  value,
@@ -111,7 +114,9 @@ const Rating = React.forwardRef((props, ref) => {
111
114
  });
112
115
  const [hovered, setHovered] = React.useState(-1);
113
116
  const [isOutside, setOutside] = React.useState(true);
114
- const decimalUnit = 1 / fractions;
117
+ const _fractions = Math.floor(fractions);
118
+ const _count = Math.floor(count);
119
+ const decimalUnit = 1 / _fractions;
115
120
  const stableValueRounded = roundValueTo(_value, decimalUnit);
116
121
  const finalValue = hovered !== -1 ? hovered : stableValueRounded;
117
122
  const handleMouseEnter = (event) => {
@@ -124,10 +129,10 @@ const Rating = React.forwardRef((props, ref) => {
124
129
  return;
125
130
  }
126
131
  const { left, right, width } = rootRef.current.getBoundingClientRect();
127
- const symbolWidth = width / count;
132
+ const symbolWidth = width / _count;
128
133
  const hoverPosition = theme.dir === "rtl" ? right - event.clientX : event.clientX - left;
129
134
  const hoverValue = hoverPosition / symbolWidth;
130
- const rounded = hooks.clamp(roundValueTo(hoverValue + decimalUnit / 2, decimalUnit), decimalUnit, count);
135
+ const rounded = hooks.clamp(roundValueTo(hoverValue + decimalUnit / 2, decimalUnit), decimalUnit, _count);
131
136
  setHovered(rounded);
132
137
  rounded !== hovered && (onHover == null ? void 0 : onHover(rounded));
133
138
  };
@@ -145,16 +150,16 @@ const Rating = React.forwardRef((props, ref) => {
145
150
  const resultedValue = parseFloat(event.target.value);
146
151
  setValue(resultedValue);
147
152
  };
148
- const items = Array(count).fill(0).map((_, integerIndex) => {
149
- const integerValue = integerIndex + 1;
150
- const fractionItems = Array.from(new Array(integerIndex === 0 ? fractions + 1 : fractions));
153
+ const items = Array(_count).fill(0).map((_, index) => {
154
+ const integerValue = index + 1;
155
+ const fractionItems = Array.from(new Array(index === 0 ? _fractions + 1 : _fractions));
151
156
  const isGroupActive = !readOnly && Math.ceil(hovered) === integerValue;
152
157
  return /* @__PURE__ */ React__default.createElement("div", {
153
158
  key: integerValue,
154
159
  "data-active": isGroupActive,
155
160
  className: classes.symbolGroup
156
161
  }, fractionItems.map((__, fractionIndex) => {
157
- const fractionValue = decimalUnit * (integerIndex === 0 ? fractionIndex : fractionIndex + 1);
162
+ const fractionValue = decimalUnit * (index === 0 ? fractionIndex : fractionIndex + 1);
158
163
  const symbolValue = roundValueTo(integerValue - 1 + fractionValue, decimalUnit);
159
164
  return /* @__PURE__ */ React__default.createElement(RatingItem.RatingItem, {
160
165
  key: `${integerValue}-${symbolValue}`,
@@ -174,7 +179,8 @@ const Rating = React.forwardRef((props, ref) => {
174
179
  classNames,
175
180
  styles: styles$1,
176
181
  unstyled,
177
- color
182
+ color,
183
+ id: `${_id}-${index}-${fractionIndex}`
178
184
  });
179
185
  }));
180
186
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Rating.js","sources":["../../src/Rating/Rating.tsx"],"sourcesContent":["import React, { forwardRef, useState, useRef } from 'react';\nimport {\n DefaultProps,\n MantineSize,\n useComponentDefaultProps,\n Selectors,\n MantineColor,\n} from '@mantine/styles';\nimport { useUncontrolled, clamp, useMergedRef, useId } from '@mantine/hooks';\nimport { Box } from '../Box';\nimport { RatingItem, RatingItemStylesNames } from './RatingItem/RatingItem';\nimport useStyles from './Rating.styles';\n\nfunction roundValueTo(value: number, to: number) {\n const rounded = Math.round(value / to) * to;\n const precision = `${to}`.split('.')[1]?.length || 0;\n return Number(rounded.toFixed(precision));\n}\n\nexport type RatingStylesNames = Selectors<typeof useStyles> | RatingItemStylesNames;\n\nexport interface RatingProps\n extends DefaultProps<RatingStylesNames>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> {\n /** Default value for uncontrolled component */\n defaultValue?: number;\n\n /** Value for controlled component */\n value?: number;\n\n /** Called when value changes */\n onChange?(value: number): void;\n\n /** The icon that is displayed when symbol is empty */\n emptySymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** This icon that is displayed when symbol is full */\n fullSymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** Number of fractions each item can be divided into, 1 by default */\n fractions?: number;\n\n /** Controls component size */\n size?: MantineSize;\n\n /** Number of controls that should be rendered */\n count?: number;\n\n /** Called when item is hovered */\n onHover?(value: number): void;\n\n /** Function should return labelText for the symbols */\n getSymbolLabel?: (value: number) => string;\n\n /** Name of rating, should be unique within the page */\n name?: string;\n\n /** If true, you won't be able to interact */\n readOnly?: boolean;\n\n /** If true, only the selected symbol will change to full symbol */\n highlightSelectedOnly?: boolean;\n\n /** Key of theme.colors or any CSS color value, yellow by default */\n color?: MantineColor;\n}\n\nconst defaultProps: Partial<RatingProps> = {\n size: 'sm',\n getSymbolLabel: (value) => `${value}`,\n count: 5,\n fractions: 1,\n color: 'yellow',\n};\n\nexport const Rating = forwardRef<HTMLInputElement, RatingProps>((props, ref) => {\n const {\n defaultValue,\n value,\n emptySymbol,\n fullSymbol,\n size,\n count,\n fractions,\n onChange,\n onHover,\n getSymbolLabel,\n name,\n readOnly,\n className,\n classNames,\n styles,\n unstyled,\n onMouseEnter,\n onMouseMove,\n onMouseLeave,\n highlightSelectedOnly,\n color,\n ...others\n } = useComponentDefaultProps('Rating', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(null, { name: 'Rating', classNames, styles, unstyled });\n\n const _name = useId(name);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: 0,\n onChange,\n });\n\n const [hovered, setHovered] = useState(-1);\n const [isOutside, setOutside] = useState(true);\n\n const decimalUnit = 1 / fractions;\n const stableValueRounded = roundValueTo(_value, decimalUnit);\n const finalValue = hovered !== -1 ? hovered : stableValueRounded;\n\n const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event);\n !readOnly && setOutside(false);\n };\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event);\n\n if (readOnly) {\n return;\n }\n\n const { left, right, width } = rootRef.current.getBoundingClientRect();\n const symbolWidth = width / count;\n\n const hoverPosition = theme.dir === 'rtl' ? right - event.clientX : event.clientX - left;\n const hoverValue = hoverPosition / symbolWidth;\n\n const rounded = clamp(\n roundValueTo(hoverValue + decimalUnit / 2, decimalUnit),\n decimalUnit,\n count\n );\n\n setHovered(rounded);\n rounded !== hovered && onHover?.(rounded);\n };\n\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseLeave?.(event);\n\n if (readOnly) {\n return;\n }\n\n setHovered(-1);\n setOutside(true);\n hovered !== -1 && onHover?.(-1);\n };\n\n const handleItemBlur = () => isOutside && setHovered(-1);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const resultedValue = parseFloat(event.target.value);\n setValue(resultedValue);\n };\n\n const items = Array(count)\n .fill(0)\n .map((_, integerIndex) => {\n const integerValue = integerIndex + 1;\n const fractionItems = Array.from(new Array(integerIndex === 0 ? fractions + 1 : fractions));\n const isGroupActive = !readOnly && Math.ceil(hovered) === integerValue;\n\n return (\n <div key={integerValue} data-active={isGroupActive} className={classes.symbolGroup}>\n {fractionItems.map((__, fractionIndex) => {\n const fractionValue =\n decimalUnit * (integerIndex === 0 ? fractionIndex : fractionIndex + 1);\n const symbolValue = roundValueTo(integerValue - 1 + fractionValue, decimalUnit);\n\n return (\n <RatingItem\n key={`${integerValue}-${symbolValue}`}\n size={size}\n getSymbolLabel={getSymbolLabel}\n emptyIcon={emptySymbol}\n fullIcon={fullSymbol}\n full={\n highlightSelectedOnly ? symbolValue === finalValue : symbolValue <= finalValue\n }\n active={symbolValue === finalValue}\n checked={symbolValue === stableValueRounded}\n readOnly={readOnly}\n fractionValue={fractionValue}\n value={symbolValue}\n name={_name}\n onChange={handleChange}\n onBlur={handleItemBlur}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n color={color}\n />\n );\n })}\n </div>\n );\n });\n\n return (\n <Box\n ref={useMergedRef(rootRef, ref)}\n className={cx(classes.root, className)}\n onMouseMove={handleMouseMove}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...others}\n >\n {items}\n </Box>\n );\n});\n\nRating.displayName = '@mantine/core/Rating';\n"],"names":["forwardRef","use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AAW,KAAK,UAAU,GAAG,WAAW,IAAI,UAAU;AAC5F,QAAQ,MAAM,EAAE,WAAW,KAAK,UAAU;AAC1C,QAAQ,OAAO,EAAE,WAAW,KAAK,kBAAkB;AACnD,QAAQ,QAAQ;AAChB,QAAQ,aAAa;AACrB,QAAQ,KAAK,EAAE,WAAW;AAC1B,QAAQ,IAAI,EAAE,KAAK;AACnB,QAAQ,QAAQ,EAAE,YAAY;AAC9B,QAAQ,MAAM,EAAE,cAAc;AAC9B,QAAQ,UAAU;AAClB,gBAAQR,QAAM;AACd,QAAQ,QAAQ;AAChB,QAAQ,KAAK;AACb,OAAO,CAAC,CAAC;AACT,KAAK,CAAC,CAAC,CAAC;AACR,GAAG,CAAC,CAAC;AACL,EAAE,uBAAuBO,cAAK,CAAC,aAAa,CAACE,OAAG,EAAE,cAAc,CAAC;AACjE,IAAI,GAAG,EAAEC,kBAAY,CAAC,OAAO,EAAE,GAAG,CAAC;AACnC,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,IAAI,WAAW,EAAE,eAAe;AAChC,IAAI,YAAY,EAAE,gBAAgB;AAClC,IAAI,YAAY,EAAE,gBAAgB;AAClC,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AACrB,CAAC,EAAE;AACH,MAAM,CAAC,WAAW,GAAG,sBAAsB;;;;"}
1
+ {"version":3,"file":"Rating.js","sources":["../../src/Rating/Rating.tsx"],"sourcesContent":["import React, { forwardRef, useState, useRef } from 'react';\nimport {\n DefaultProps,\n MantineSize,\n useComponentDefaultProps,\n Selectors,\n MantineColor,\n} from '@mantine/styles';\nimport { useUncontrolled, clamp, useMergedRef, useId } from '@mantine/hooks';\nimport { Box } from '../Box';\nimport { RatingItem, RatingItemStylesNames } from './RatingItem/RatingItem';\nimport useStyles from './Rating.styles';\n\nfunction roundValueTo(value: number, to: number) {\n const rounded = Math.round(value / to) * to;\n const precision = `${to}`.split('.')[1]?.length || 0;\n return Number(rounded.toFixed(precision));\n}\n\nexport type RatingStylesNames = Selectors<typeof useStyles> | RatingItemStylesNames;\n\nexport interface RatingProps\n extends DefaultProps<RatingStylesNames>,\n Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> {\n /** Default value for uncontrolled component */\n defaultValue?: number;\n\n /** Value for controlled component */\n value?: number;\n\n /** Called when value changes */\n onChange?(value: number): void;\n\n /** The icon that is displayed when symbol is empty */\n emptySymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** This icon that is displayed when symbol is full */\n fullSymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** Number of fractions each item can be divided into, 1 by default */\n fractions?: number;\n\n /** Controls component size */\n size?: MantineSize;\n\n /** Number of controls that should be rendered */\n count?: number;\n\n /** Called when item is hovered */\n onHover?(value: number): void;\n\n /** Function should return labelText for the symbols */\n getSymbolLabel?: (value: number) => string;\n\n /** Name of rating, should be unique within the page */\n name?: string;\n\n /** If true, you won't be able to interact */\n readOnly?: boolean;\n\n /** If true, only the selected symbol will change to full symbol */\n highlightSelectedOnly?: boolean;\n\n /** Key of theme.colors or any CSS color value, yellow by default */\n color?: MantineColor;\n}\n\nconst defaultProps: Partial<RatingProps> = {\n size: 'sm',\n getSymbolLabel: (value) => `${value}`,\n count: 5,\n fractions: 1,\n color: 'yellow',\n};\n\nexport const Rating = forwardRef<HTMLInputElement, RatingProps>((props, ref) => {\n const {\n defaultValue,\n value,\n emptySymbol,\n fullSymbol,\n size,\n count,\n fractions,\n onChange,\n onHover,\n getSymbolLabel,\n name,\n readOnly,\n className,\n classNames,\n styles,\n unstyled,\n onMouseEnter,\n onMouseMove,\n onMouseLeave,\n highlightSelectedOnly,\n color,\n id,\n ...others\n } = useComponentDefaultProps('Rating', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(null, { name: 'Rating', classNames, styles, unstyled });\n\n const _name = useId(name);\n const _id = useId(id);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: 0,\n onChange,\n });\n\n const [hovered, setHovered] = useState(-1);\n const [isOutside, setOutside] = useState(true);\n\n const _fractions = Math.floor(fractions);\n const _count = Math.floor(count);\n\n const decimalUnit = 1 / _fractions;\n const stableValueRounded = roundValueTo(_value, decimalUnit);\n const finalValue = hovered !== -1 ? hovered : stableValueRounded;\n\n const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event);\n !readOnly && setOutside(false);\n };\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event);\n\n if (readOnly) {\n return;\n }\n\n const { left, right, width } = rootRef.current.getBoundingClientRect();\n const symbolWidth = width / _count;\n\n const hoverPosition = theme.dir === 'rtl' ? right - event.clientX : event.clientX - left;\n const hoverValue = hoverPosition / symbolWidth;\n\n const rounded = clamp(\n roundValueTo(hoverValue + decimalUnit / 2, decimalUnit),\n decimalUnit,\n _count\n );\n\n setHovered(rounded);\n rounded !== hovered && onHover?.(rounded);\n };\n\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseLeave?.(event);\n\n if (readOnly) {\n return;\n }\n\n setHovered(-1);\n setOutside(true);\n hovered !== -1 && onHover?.(-1);\n };\n\n const handleItemBlur = () => isOutside && setHovered(-1);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const resultedValue = parseFloat(event.target.value);\n setValue(resultedValue);\n };\n\n const items = Array(_count)\n .fill(0)\n .map((_, index) => {\n const integerValue = index + 1;\n const fractionItems = Array.from(new Array(index === 0 ? _fractions + 1 : _fractions));\n const isGroupActive = !readOnly && Math.ceil(hovered) === integerValue;\n\n return (\n <div key={integerValue} data-active={isGroupActive} className={classes.symbolGroup}>\n {fractionItems.map((__, fractionIndex) => {\n const fractionValue = decimalUnit * (index === 0 ? fractionIndex : fractionIndex + 1);\n const symbolValue = roundValueTo(integerValue - 1 + fractionValue, decimalUnit);\n\n return (\n <RatingItem\n key={`${integerValue}-${symbolValue}`}\n size={size}\n getSymbolLabel={getSymbolLabel}\n emptyIcon={emptySymbol}\n fullIcon={fullSymbol}\n full={\n highlightSelectedOnly ? symbolValue === finalValue : symbolValue <= finalValue\n }\n active={symbolValue === finalValue}\n checked={symbolValue === stableValueRounded}\n readOnly={readOnly}\n fractionValue={fractionValue}\n value={symbolValue}\n name={_name}\n onChange={handleChange}\n onBlur={handleItemBlur}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n color={color}\n id={`${_id}-${index}-${fractionIndex}`}\n />\n );\n })}\n </div>\n );\n });\n\n return (\n <Box\n ref={useMergedRef(rootRef, ref)}\n className={cx(classes.root, className)}\n onMouseMove={handleMouseMove}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...others}\n >\n {items}\n </Box>\n );\n});\n\nRating.displayName = '@mantine/core/Rating';\n"],"names":["forwardRef","useComponentDefaultProps","styles","useStyles","useId","useRef","useUncontrolled","useState","clamp","React","RatingItem","Box","useMergedRef"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAA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,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;AAC9C,OAAO,CAAC,CAAC;AACT,KAAK,CAAC,CAAC,CAAC;AACR,GAAG,CAAC,CAAC;AACL,EAAE,uBAAuBO,cAAK,CAAC,aAAa,CAACE,OAAG,EAAE,cAAc,CAAC;AACjE,IAAI,GAAG,EAAEC,kBAAY,CAAC,OAAO,EAAE,GAAG,CAAC;AACnC,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,IAAI,WAAW,EAAE,eAAe;AAChC,IAAI,YAAY,EAAE,gBAAgB;AAClC,IAAI,YAAY,EAAE,gBAAgB;AAClC,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AACrB,CAAC,EAAE;AACH,MAAM,CAAC,WAAW,GAAG,sBAAsB;;;;"}
@@ -53,7 +53,8 @@ function RatingItem(_a) {
53
53
  classNames,
54
54
  styles,
55
55
  unstyled,
56
- color
56
+ color,
57
+ id
57
58
  } = _b, others = __objRest(_b, [
58
59
  "size",
59
60
  "getSymbolLabel",
@@ -67,9 +68,9 @@ function RatingItem(_a) {
67
68
  "classNames",
68
69
  "styles",
69
70
  "unstyled",
70
- "color"
71
+ "color",
72
+ "id"
71
73
  ]);
72
- const id = React.useId();
73
74
  const { classes } = RatingItem_styles['default'](null, { name: "Rating", classNames, styles, unstyled });
74
75
  const _fullIcon = typeof fullIcon === "function" ? fullIcon(value) : fullIcon;
75
76
  const _emptyIcon = typeof emptyIcon === "function" ? emptyIcon(value) : emptyIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"RatingItem.js","sources":["../../../src/Rating/RatingItem/RatingItem.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport { MantineSize, Selectors, DefaultProps, MantineColor } from '@mantine/styles';\nimport { Box } from '../../Box';\nimport { StarSymbol } from '../StarSymbol/StarSymbol';\nimport useStyles from './RatingItem.styles';\n\nexport type RatingItemStylesNames = Selectors<typeof useStyles>;\n\nexport interface RatingItemProps\n extends DefaultProps<RatingItemStylesNames>,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'value' | 'size'> {\n size: MantineSize;\n getSymbolLabel: (value: number) => string;\n emptyIcon?: React.ReactNode | ((value: number) => React.ReactNode);\n fullIcon?: React.ReactNode | ((value: number) => React.ReactNode);\n color: MantineColor;\n full: boolean;\n active: boolean;\n fractionValue: number;\n value: number;\n}\n\nexport function RatingItem({\n size,\n getSymbolLabel,\n emptyIcon,\n fullIcon,\n full,\n active,\n value,\n readOnly,\n fractionValue,\n classNames,\n styles,\n unstyled,\n color,\n ...others\n}: RatingItemProps) {\n const id = useId();\n const { classes } = useStyles(null, { name: 'Rating', classNames, styles, unstyled });\n const _fullIcon = typeof fullIcon === 'function' ? fullIcon(value) : fullIcon;\n const _emptyIcon = typeof emptyIcon === 'function' ? emptyIcon(value) : emptyIcon;\n\n return (\n <>\n {!readOnly && (\n <input\n className={classes.input}\n id={id}\n type=\"radio\"\n data-active={active}\n aria-label={getSymbolLabel(value)}\n value={value}\n {...others}\n />\n )}\n\n <Box\n component={readOnly ? 'div' : 'label'}\n className={classes.label}\n data-read-only={readOnly || undefined}\n htmlFor={id}\n sx={fractionValue === 1 ? undefined : { zIndex: active ? 2 : 0 }}\n >\n <Box\n className={classes.symbolBody}\n sx={\n fractionValue === 1\n ? undefined\n : { clipPath: `inset(0 ${active ? 100 - fractionValue * 100 : 100}% 0 0)` }\n }\n >\n {full\n ? _fullIcon || <StarSymbol color={color} size={size} type=\"full\" />\n : _emptyIcon || <StarSymbol color={color} size={size} type=\"empty\" />}\n </Box>\n </Box>\n </>\n );\n}\n\nRatingItem.displayName = '@mantine/core/RatingItem';\n"],"names":["useId","useStyles","React","Box","StarSymbol"],"mappings":";;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;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CAAC,MAAM,CAAC,EAAE;AAChH,GAAG,EAAE,IAAI,GAAG,SAAS,oBAAoBD,cAAK,CAAC,aAAa,CAACE,qBAAU,EAAE;AACzE,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG,CAAC,GAAG,UAAU,oBAAoBF,cAAK,CAAC,aAAa,CAACE,qBAAU,EAAE;AACrE,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
1
+ {"version":3,"file":"RatingItem.js","sources":["../../../src/Rating/RatingItem/RatingItem.tsx"],"sourcesContent":["import React from 'react';\nimport { MantineSize, Selectors, DefaultProps, MantineColor } from '@mantine/styles';\nimport { Box } from '../../Box';\nimport { StarSymbol } from '../StarSymbol/StarSymbol';\nimport useStyles from './RatingItem.styles';\n\nexport type RatingItemStylesNames = Selectors<typeof useStyles>;\n\nexport interface RatingItemProps\n extends DefaultProps<RatingItemStylesNames>,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'value' | 'size'> {\n size: MantineSize;\n getSymbolLabel: (value: number) => string;\n emptyIcon?: React.ReactNode | ((value: number) => React.ReactNode);\n fullIcon?: React.ReactNode | ((value: number) => React.ReactNode);\n color: MantineColor;\n full: boolean;\n active: boolean;\n fractionValue: number;\n value: number;\n id: string;\n}\n\nexport function RatingItem({\n size,\n getSymbolLabel,\n emptyIcon,\n fullIcon,\n full,\n active,\n value,\n readOnly,\n fractionValue,\n classNames,\n styles,\n unstyled,\n color,\n id,\n ...others\n}: RatingItemProps) {\n const { classes } = useStyles(null, { name: 'Rating', classNames, styles, unstyled });\n const _fullIcon = typeof fullIcon === 'function' ? fullIcon(value) : fullIcon;\n const _emptyIcon = typeof emptyIcon === 'function' ? emptyIcon(value) : emptyIcon;\n\n return (\n <>\n {!readOnly && (\n <input\n className={classes.input}\n id={id}\n type=\"radio\"\n data-active={active}\n aria-label={getSymbolLabel(value)}\n value={value}\n {...others}\n />\n )}\n\n <Box\n component={readOnly ? 'div' : 'label'}\n className={classes.label}\n data-read-only={readOnly || undefined}\n htmlFor={id}\n sx={fractionValue === 1 ? undefined : { zIndex: active ? 2 : 0 }}\n >\n <Box\n className={classes.symbolBody}\n sx={\n fractionValue === 1\n ? undefined\n : { clipPath: `inset(0 ${active ? 100 - fractionValue * 100 : 100}% 0 0)` }\n }\n >\n {full\n ? _fullIcon || <StarSymbol color={color} size={size} type=\"full\" />\n : _emptyIcon || <StarSymbol color={color} size={size} type=\"empty\" />}\n </Box>\n </Box>\n </>\n );\n}\n\nRatingItem.displayName = '@mantine/core/RatingItem';\n"],"names":["useStyles","React","Box","StarSymbol"],"mappings":";;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAA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,kBAAkBA,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE;AACxD,IAAI,SAAS,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO;AACzC,IAAI,SAAS,EAAE,OAAO,CAAC,KAAK;AAC5B,IAAI,gBAAgB,EAAE,QAAQ,IAAI,KAAK,CAAC;AACxC,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,EAAE,EAAE,aAAa,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE;AACjE,GAAG,kBAAkBD,cAAK,CAAC,aAAa,CAACC,OAAG,EAAE;AAC9C,IAAI,SAAS,EAAE,OAAO,CAAC,UAAU;AACjC,IAAI,EAAE,EAAE,aAAa,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,GAAG,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE;AAChH,GAAG,EAAE,IAAI,GAAG,SAAS,oBAAoBD,cAAK,CAAC,aAAa,CAACE,qBAAU,EAAE;AACzE,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG,CAAC,GAAG,UAAU,oBAAoBF,cAAK,CAAC,aAAa,CAACE,qBAAU,EAAE;AACrE,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
@@ -12,11 +12,11 @@ function getChangeValue({
12
12
  }) {
13
13
  const left = !containerWidth ? value : Math.min(Math.max(value, 0), containerWidth) / containerWidth;
14
14
  const dx = left * (max - min);
15
- const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min;
16
- if (precision !== void 0) {
17
- return Number(nextValue.toFixed(precision));
18
- }
19
- return nextValue;
15
+ const minIsNegative = min <= 0;
16
+ const nextValue = dx !== 0 ? Math.round(dx / step) * step + (minIsNegative ? min : 0) : Math.min(min, 0);
17
+ const nextValueWithPrecision = precision ? Number(nextValue.toFixed(precision)) : nextValue;
18
+ const finalValue = Math.min(nextValueWithPrecision, max);
19
+ return finalValue <= min ? min : finalValue;
20
20
  }
21
21
 
22
22
  exports.getChangeValue = getChangeValue;
@@ -1 +1 @@
1
- {"version":3,"file":"get-change-value.js","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"sourcesContent":["interface GetChangeValue {\n value: number;\n containerWidth?: number;\n min: number;\n max: number;\n step: number;\n precision?: number;\n}\n\nexport function getChangeValue({\n value,\n containerWidth,\n min,\n max,\n step,\n precision,\n}: GetChangeValue) {\n const left = !containerWidth\n ? value\n : Math.min(Math.max(value, 0), containerWidth) / containerWidth;\n const dx = left * (max - min);\n const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min;\n\n if (precision !== undefined) {\n return Number(nextValue.toFixed(precision));\n }\n\n return nextValue;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,cAAc,CAAC;AAC/B,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,GAAG;AACL,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,SAAS;AACX,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;AACvG,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAChC,EAAE,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC;AACxE,EAAE,IAAI,SAAS,KAAK,KAAK,CAAC,EAAE;AAC5B,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AAChD,GAAG;AACH,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}
1
+ {"version":3,"file":"get-change-value.js","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"sourcesContent":["interface GetChangeValue {\n value: number;\n containerWidth?: number;\n min: number;\n max: number;\n step: number;\n precision?: number;\n}\n\nexport function getChangeValue({\n value,\n containerWidth,\n min,\n max,\n step,\n precision,\n}: GetChangeValue) {\n const left = !containerWidth\n ? value\n : Math.min(Math.max(value, 0), containerWidth) / containerWidth;\n const dx = left * (max - min);\n const minIsNegative = min <= 0;\n const nextValue =\n dx !== 0 ? Math.round(dx / step) * step + (minIsNegative ? min : 0) : Math.min(min, 0);\n const nextValueWithPrecision = precision ? Number(nextValue.toFixed(precision)) : nextValue;\n const finalValue = Math.min(nextValueWithPrecision, max);\n\n return finalValue <= min ? min : finalValue;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,cAAc,CAAC;AAC/B,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,GAAG;AACL,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,SAAS;AACX,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;AACvG,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAChC,EAAE,MAAM,aAAa,GAAG,GAAG,IAAI,CAAC,CAAC;AACjC,EAAE,MAAM,SAAS,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,aAAa,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3G,EAAE,MAAM,sBAAsB,GAAG,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;AAC9F,EAAE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;AAC3D,EAAE,OAAO,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;AAC9C;;;;"}
@@ -184,6 +184,9 @@ const _Tooltip = React.forwardRef((props, ref) => {
184
184
  onClick,
185
185
  onMouseEnter,
186
186
  onMouseLeave,
187
+ onMouseMove: props.onMouseMove,
188
+ onPointerDown: props.onPointerDown,
189
+ onPointerEnter: props.onPointerEnter,
187
190
  [refProp]: targetRef,
188
191
  className: cx(className, children.props.className)
189
192
  }, children.props))));
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useRef } from 'react';\nimport { isElement, ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { useMergedRef } from '@mantine/hooks';\nimport { getDefaultZIndex, useComponentDefaultProps } from '@mantine/styles';\nimport { TooltipGroup } from './TooltipGroup/TooltipGroup';\nimport { TooltipFloating } from './TooltipFloating/TooltipFloating';\nimport { useTooltip } from './use-tooltip';\nimport { FloatingArrow, getFloatingPosition, FloatingPosition } from '../Floating';\nimport { MantineTransition, Transition } from '../Transition';\nimport { OptionalPortal } from '../Portal';\nimport { Box } from '../Box';\nimport { TOOLTIP_ERRORS } from './Tooltip.errors';\nimport { TooltipBaseProps } from './Tooltip.types';\nimport useStyles from './Tooltip.styles';\n\nexport interface TooltipProps extends TooltipBaseProps {\n /** Called when tooltip position changes */\n onPositionChange?(position: FloatingPosition): void;\n\n /** Open delay in ms */\n openDelay?: number;\n\n /** Close delay in ms */\n closeDelay?: number;\n\n /** Controls opened state */\n opened?: boolean;\n\n /** Space between target element and tooltip in px */\n offset?: number;\n\n /** Determines whether component should have an arrow */\n withArrow?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Arrow offset in px */\n arrowOffset?: number;\n\n /** One of premade transitions ot transition object */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Determines which events will be used to show tooltip */\n events?: { hover: boolean; focus: boolean; touch: boolean };\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Set if tooltip is attached to an inline element */\n inline?: boolean;\n}\n\nconst defaultProps: Partial<TooltipProps> = {\n position: 'top',\n refProp: 'ref',\n withinPortal: false,\n inline: false,\n arrowSize: 4,\n arrowOffset: 5,\n offset: 5,\n transition: 'fade',\n transitionDuration: 100,\n width: 'auto',\n events: { hover: true, focus: false, touch: false },\n zIndex: getDefaultZIndex('popover'),\n positionDependencies: [],\n};\n\nconst _Tooltip = forwardRef<HTMLElement, TooltipProps>((props, ref) => {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n const {\n children,\n position,\n refProp,\n label,\n openDelay,\n closeDelay,\n onPositionChange,\n opened,\n withinPortal,\n radius,\n color,\n classNames,\n styles,\n unstyled,\n style,\n className,\n withArrow,\n arrowSize,\n arrowOffset,\n offset,\n transition,\n transitionDuration,\n multiline,\n width,\n events,\n zIndex,\n disabled,\n positionDependencies,\n onClick,\n onMouseEnter,\n onMouseLeave,\n inline,\n ...others\n } = useComponentDefaultProps('Tooltip', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { radius, color, width, multiline },\n { name: 'Tooltip', classNames, styles, unstyled }\n );\n\n const tooltip = useTooltip({\n position: getFloatingPosition(theme.dir, position),\n closeDelay,\n openDelay,\n onPositionChange,\n opened,\n events,\n arrowRef,\n offset: offset + (withArrow ? arrowSize / 2 : 0),\n positionDependencies: [...positionDependencies, children],\n inline,\n });\n\n if (!isElement(children)) {\n throw new Error(TOOLTIP_ERRORS.children);\n }\n\n const targetRef = useMergedRef(tooltip.reference, (children as any).ref, ref);\n\n return (\n <>\n <OptionalPortal withinPortal={withinPortal}>\n <Transition\n mounted={!disabled && tooltip.opened}\n transition={transition}\n duration={tooltip.isGroupPhase ? 10 : transitionDuration}\n >\n {(transitionStyles) => (\n <Box\n {...others}\n {...tooltip.getFloatingProps({\n ref: tooltip.floating,\n className: classes.tooltip,\n style: {\n ...style,\n ...transitionStyles,\n zIndex,\n top: tooltip.y ?? 0,\n left: tooltip.x ?? 0,\n },\n })}\n >\n {label}\n\n <FloatingArrow\n ref={arrowRef}\n arrowX={tooltip.arrowX}\n arrowY={tooltip.arrowY}\n visible={withArrow}\n withBorder={false}\n position={tooltip.placement}\n arrowSize={arrowSize}\n arrowOffset={arrowOffset}\n className={classes.arrow}\n />\n </Box>\n )}\n </Transition>\n </OptionalPortal>\n\n {cloneElement(\n children,\n tooltip.getReferenceProps({\n onClick,\n onMouseEnter,\n onMouseLeave,\n [refProp]: targetRef,\n className: cx(className, children.props.className),\n ...children.props,\n })\n )}\n </>\n );\n}) as any;\n\n_Tooltip.Group = TooltipGroup;\n_Tooltip.Floating = TooltipFloating;\n\n_Tooltip.displayName = '@mantine/core/Tooltip';\n\nexport const Tooltip: ForwardRefWithStaticComponents<\n TooltipProps,\n { Group: typeof TooltipGroup; Floating: typeof TooltipFloating }\n> = _Tooltip;\n"],"names":["getDefaultZIndex","forwardRef","useRef","useComponentDefaultProps","styles","useStyles","useTooltip","getFloatingPosition","isElement","TOOLTIP_ERRORS","useMergedRef","React","OptionalPortal","Transition","Box","FloatingArrow","cloneElement","TooltipGroup","TooltipFloating"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yB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C,CAAC,EAAEC,kBAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC;AACvE,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,CAAC,OAAO,GAAG,SAAS;AACxB,IAAI,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;AACtD,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC;AACH,QAAQ,CAAC,KAAK,GAAGC,yBAAY,CAAC;AAC9B,QAAQ,CAAC,QAAQ,GAAGC,+BAAe,CAAC;AACpC,QAAQ,CAAC,WAAW,GAAG,uBAAuB,CAAC;AACnC,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useRef } from 'react';\nimport { isElement, ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { useMergedRef } from '@mantine/hooks';\nimport { getDefaultZIndex, useComponentDefaultProps } from '@mantine/styles';\nimport { TooltipGroup } from './TooltipGroup/TooltipGroup';\nimport { TooltipFloating } from './TooltipFloating/TooltipFloating';\nimport { useTooltip } from './use-tooltip';\nimport { FloatingArrow, getFloatingPosition, FloatingPosition } from '../Floating';\nimport { MantineTransition, Transition } from '../Transition';\nimport { OptionalPortal } from '../Portal';\nimport { Box } from '../Box';\nimport { TOOLTIP_ERRORS } from './Tooltip.errors';\nimport { TooltipBaseProps } from './Tooltip.types';\nimport useStyles from './Tooltip.styles';\n\nexport interface TooltipProps extends TooltipBaseProps {\n /** Called when tooltip position changes */\n onPositionChange?(position: FloatingPosition): void;\n\n /** Open delay in ms */\n openDelay?: number;\n\n /** Close delay in ms */\n closeDelay?: number;\n\n /** Controls opened state */\n opened?: boolean;\n\n /** Space between target element and tooltip in px */\n offset?: number;\n\n /** Determines whether component should have an arrow */\n withArrow?: boolean;\n\n /** Arrow size in px */\n arrowSize?: number;\n\n /** Arrow offset in px */\n arrowOffset?: number;\n\n /** One of premade transitions ot transition object */\n transition?: MantineTransition;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Determines which events will be used to show tooltip */\n events?: { hover: boolean; focus: boolean; touch: boolean };\n\n /** useEffect dependencies to force update tooltip position */\n positionDependencies?: any[];\n\n /** Set if tooltip is attached to an inline element */\n inline?: boolean;\n}\n\nconst defaultProps: Partial<TooltipProps> = {\n position: 'top',\n refProp: 'ref',\n withinPortal: false,\n inline: false,\n arrowSize: 4,\n arrowOffset: 5,\n offset: 5,\n transition: 'fade',\n transitionDuration: 100,\n width: 'auto',\n events: { hover: true, focus: false, touch: false },\n zIndex: getDefaultZIndex('popover'),\n positionDependencies: [],\n};\n\nconst _Tooltip = forwardRef<HTMLElement, TooltipProps>((props, ref) => {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n const {\n children,\n position,\n refProp,\n label,\n openDelay,\n closeDelay,\n onPositionChange,\n opened,\n withinPortal,\n radius,\n color,\n classNames,\n styles,\n unstyled,\n style,\n className,\n withArrow,\n arrowSize,\n arrowOffset,\n offset,\n transition,\n transitionDuration,\n multiline,\n width,\n events,\n zIndex,\n disabled,\n positionDependencies,\n onClick,\n onMouseEnter,\n onMouseLeave,\n inline,\n ...others\n } = useComponentDefaultProps('Tooltip', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { radius, color, width, multiline },\n { name: 'Tooltip', classNames, styles, unstyled }\n );\n\n const tooltip = useTooltip({\n position: getFloatingPosition(theme.dir, position),\n closeDelay,\n openDelay,\n onPositionChange,\n opened,\n events,\n arrowRef,\n offset: offset + (withArrow ? arrowSize / 2 : 0),\n positionDependencies: [...positionDependencies, children],\n inline,\n });\n\n if (!isElement(children)) {\n throw new Error(TOOLTIP_ERRORS.children);\n }\n\n const targetRef = useMergedRef(tooltip.reference, (children as any).ref, ref);\n\n return (\n <>\n <OptionalPortal withinPortal={withinPortal}>\n <Transition\n mounted={!disabled && tooltip.opened}\n transition={transition}\n duration={tooltip.isGroupPhase ? 10 : transitionDuration}\n >\n {(transitionStyles) => (\n <Box\n {...others}\n {...tooltip.getFloatingProps({\n ref: tooltip.floating,\n className: classes.tooltip,\n style: {\n ...style,\n ...transitionStyles,\n zIndex,\n top: tooltip.y ?? 0,\n left: tooltip.x ?? 0,\n },\n })}\n >\n {label}\n\n <FloatingArrow\n ref={arrowRef}\n arrowX={tooltip.arrowX}\n arrowY={tooltip.arrowY}\n visible={withArrow}\n withBorder={false}\n position={tooltip.placement}\n arrowSize={arrowSize}\n arrowOffset={arrowOffset}\n className={classes.arrow}\n />\n </Box>\n )}\n </Transition>\n </OptionalPortal>\n\n {cloneElement(\n children,\n tooltip.getReferenceProps({\n onClick,\n onMouseEnter,\n onMouseLeave,\n onMouseMove: props.onMouseMove,\n onPointerDown: props.onPointerDown,\n onPointerEnter: props.onPointerEnter,\n [refProp]: targetRef,\n className: cx(className, children.props.className),\n ...children.props,\n })\n )}\n </>\n );\n}) as any;\n\n_Tooltip.Group = TooltipGroup;\n_Tooltip.Floating = TooltipFloating;\n\n_Tooltip.displayName = '@mantine/core/Tooltip';\n\nexport const Tooltip: ForwardRefWithStaticComponents<\n TooltipProps,\n { Group: typeof TooltipGroup; Floating: typeof TooltipFloating }\n> = _Tooltip;\n"],"names":["getDefaultZIndex","forwardRef","useRef","useComponentDefaultProps","styles","useStyles","useTooltip","getFloatingPosition","isElement","TOOLTIP_ERRORS","useMergedRef","React","OptionalPortal","Transition","Box","FloatingArrow","cloneElement","TooltipGroup","TooltipFloating"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM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AAO,CAAC,iBAAiB,CAAC,cAAc,CAAC;AACvE,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,WAAW,EAAE,KAAK,CAAC,WAAW;AAClC,IAAI,aAAa,EAAE,KAAK,CAAC,aAAa;AACtC,IAAI,cAAc,EAAE,KAAK,CAAC,cAAc;AACxC,IAAI,CAAC,OAAO,GAAG,SAAS;AACxB,IAAI,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;AACtD,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC;AACH,QAAQ,CAAC,KAAK,GAAGC,yBAAY,CAAC;AAC9B,QAAQ,CAAC,QAAQ,GAAGC,+BAAe,CAAC;AACpC,QAAQ,CAAC,WAAW,GAAG,uBAAuB,CAAC;AACnC,MAAC,OAAO,GAAG;;;;"}
@@ -6,9 +6,9 @@ var React = require('react');
6
6
  var hooks = require('@mantine/hooks');
7
7
  var utils = require('@mantine/utils');
8
8
  var SelectScrollArea = require('../../Select/SelectScrollArea/SelectScrollArea.js');
9
- var Divider = require('../../Divider/Divider.js');
10
9
  var RenderList_styles = require('./RenderList.styles.js');
11
10
  var UnstyledButton = require('../../UnstyledButton/UnstyledButton.js');
11
+ var Divider = require('../../Divider/Divider.js');
12
12
  var Text = require('../../Text/Text.js');
13
13
  var TextInput = require('../../TextInput/TextInput.js');
14
14
  var ActionIcon = require('../../ActionIcon/ActionIcon.js');
@@ -40,9 +40,14 @@ function RenderList({
40
40
  selection,
41
41
  itemComponent: ItemComponent,
42
42
  listComponent,
43
+ transferIcon: TransferIcon,
44
+ transferAllIcon: TransferAllIcon,
43
45
  searchPlaceholder,
46
+ query,
47
+ onSearch,
44
48
  filter,
45
49
  nothingFound,
50
+ placeholder,
46
51
  title,
47
52
  showTransferAll,
48
53
  reversed,
@@ -58,7 +63,6 @@ function RenderList({
58
63
  const { classes, cx, theme } = RenderList_styles['default']({ reversed, native: listComponent !== SelectScrollArea.SelectScrollArea, radius }, { name: "TransferList", classNames, styles, unstyled });
59
64
  const unGroupedItems = [];
60
65
  const groupedItems = [];
61
- const [query, setQuery] = React.useState("");
62
66
  const [hovered, setHovered] = React.useState(-1);
63
67
  const filteredData = data.filter((item) => filter(query, item)).slice(0, limit);
64
68
  const ListComponent = listComponent || "div";
@@ -152,6 +156,8 @@ function RenderList({
152
156
  }
153
157
  }
154
158
  };
159
+ const transferIcon = reversed ? /* @__PURE__ */ React__default.createElement(Icons.Prev, null) : /* @__PURE__ */ React__default.createElement(Icons.Next, null);
160
+ const transferAllIcon = reversed ? /* @__PURE__ */ React__default.createElement(Icons.First, null) : /* @__PURE__ */ React__default.createElement(Icons.Last, null);
155
161
  return /* @__PURE__ */ React__default.createElement("div", {
156
162
  className: cx(classes.transferList, className)
157
163
  }, title && /* @__PURE__ */ React__default.createElement(Text.Text, {
@@ -166,7 +172,7 @@ function RenderList({
166
172
  unstyled,
167
173
  value: query,
168
174
  onChange: (event) => {
169
- setQuery(event.currentTarget.value);
175
+ onSearch(event.currentTarget.value);
170
176
  setHovered(0);
171
177
  },
172
178
  onFocus: () => setHovered(0),
@@ -184,7 +190,9 @@ function RenderList({
184
190
  disabled: selection.length === 0,
185
191
  onClick: onMove,
186
192
  unstyled
187
- }, reversed ? /* @__PURE__ */ React__default.createElement(Icons.Prev, null) : /* @__PURE__ */ React__default.createElement(Icons.Next, null)), showTransferAll && /* @__PURE__ */ React__default.createElement(ActionIcon.ActionIcon, {
193
+ }, TransferIcon ? /* @__PURE__ */ React__default.createElement(TransferIcon, {
194
+ reversed
195
+ }) : transferIcon), showTransferAll && /* @__PURE__ */ React__default.createElement(ActionIcon.ActionIcon, {
188
196
  variant: "default",
189
197
  size: 36,
190
198
  radius: 0,
@@ -192,7 +200,9 @@ function RenderList({
192
200
  disabled: data.length === 0,
193
201
  onClick: onMoveAll,
194
202
  unstyled
195
- }, reversed ? /* @__PURE__ */ React__default.createElement(Icons.First, null) : /* @__PURE__ */ React__default.createElement(Icons.Last, null))), /* @__PURE__ */ React__default.createElement(ListComponent, {
203
+ }, TransferAllIcon ? /* @__PURE__ */ React__default.createElement(TransferAllIcon, {
204
+ reversed
205
+ }) : transferAllIcon)), /* @__PURE__ */ React__default.createElement(ListComponent, {
196
206
  ref: scrollableRef,
197
207
  onMouseLeave: () => setHovered(-1),
198
208
  className: classes.transferListItems,
@@ -203,7 +213,7 @@ function RenderList({
203
213
  size: "sm",
204
214
  align: "center",
205
215
  mt: "sm"
206
- }, nothingFound))));
216
+ }, !query && placeholder ? placeholder : nothingFound))));
207
217
  }
208
218
  RenderList.displayName = "@mantine/core/RenderList";
209
219