@mantine/core 9.5.1-alpha.1 → 9.5.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 (108) hide show
  1. package/cjs/components/Cascader/Cascader.cjs +9 -3
  2. package/cjs/components/Cascader/Cascader.cjs.map +1 -1
  3. package/cjs/components/Cascader/CascaderColumns.cjs +34 -3
  4. package/cjs/components/Cascader/CascaderColumns.cjs.map +1 -1
  5. package/cjs/components/Cascader/use-cascader-safe-area.cjs +76 -0
  6. package/cjs/components/Cascader/use-cascader-safe-area.cjs.map +1 -0
  7. package/cjs/components/Checkbox/CheckboxCard/CheckboxCard.cjs +8 -4
  8. package/cjs/components/Checkbox/CheckboxCard/CheckboxCard.cjs.map +1 -1
  9. package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs +3 -2
  10. package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs.map +1 -1
  11. package/cjs/components/ColorInput/ColorInput.cjs +4 -2
  12. package/cjs/components/ColorInput/ColorInput.cjs.map +1 -1
  13. package/cjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
  14. package/cjs/components/Combobox/get-options-lockup/get-option-by-label.cjs +17 -0
  15. package/cjs/components/Combobox/get-options-lockup/get-option-by-label.cjs.map +1 -0
  16. package/cjs/components/Combobox/is-external-input-change/is-external-input-change.cjs +17 -0
  17. package/cjs/components/Combobox/is-external-input-change/is-external-input-change.cjs.map +1 -0
  18. package/cjs/components/ComboboxPopover/ComboboxPopover.cjs.map +1 -1
  19. package/cjs/components/FloatingIndicator/use-floating-indicator.cjs +6 -4
  20. package/cjs/components/FloatingIndicator/use-floating-indicator.cjs.map +1 -1
  21. package/cjs/components/MultiSelect/MultiSelect.cjs +9 -0
  22. package/cjs/components/MultiSelect/MultiSelect.cjs.map +1 -1
  23. package/cjs/components/Notification/Notification.cjs.map +1 -1
  24. package/cjs/components/PasswordInput/PasswordInput.cjs +4 -3
  25. package/cjs/components/PasswordInput/PasswordInput.cjs.map +1 -1
  26. package/cjs/components/RollingNumber/RollingNumber.cjs +7 -3
  27. package/cjs/components/RollingNumber/RollingNumber.cjs.map +1 -1
  28. package/cjs/components/RollingNumber/RollingNumber.module.cjs +1 -0
  29. package/cjs/components/RollingNumber/RollingNumber.module.cjs.map +1 -1
  30. package/cjs/components/Select/Select.cjs +12 -0
  31. package/cjs/components/Select/Select.cjs.map +1 -1
  32. package/cjs/components/TagsInput/TagsInput.cjs +5 -1
  33. package/cjs/components/TagsInput/TagsInput.cjs.map +1 -1
  34. package/cjs/components/Tooltip/Tooltip.cjs +11 -3
  35. package/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  36. package/cjs/components/Tooltip/Tooltip.module.cjs.map +1 -1
  37. package/cjs/components/Tooltip/TooltipFloating/TooltipFloating.cjs +2 -2
  38. package/cjs/components/Tooltip/TooltipFloating/TooltipFloating.cjs.map +1 -1
  39. package/cjs/components/Tooltip/TooltipFloating/use-floating-tooltip.cjs +1 -0
  40. package/cjs/components/Tooltip/TooltipFloating/use-floating-tooltip.cjs.map +1 -1
  41. package/cjs/components/Tooltip/use-tooltip.cjs +2 -1
  42. package/cjs/components/Tooltip/use-tooltip.cjs.map +1 -1
  43. package/cjs/components/TreeSelect/TreeSelect.cjs +3 -0
  44. package/cjs/components/TreeSelect/TreeSelect.cjs.map +1 -1
  45. package/esm/components/Cascader/Cascader.mjs +9 -3
  46. package/esm/components/Cascader/Cascader.mjs.map +1 -1
  47. package/esm/components/Cascader/CascaderColumns.mjs +35 -4
  48. package/esm/components/Cascader/CascaderColumns.mjs.map +1 -1
  49. package/esm/components/Cascader/use-cascader-safe-area.mjs +76 -0
  50. package/esm/components/Cascader/use-cascader-safe-area.mjs.map +1 -0
  51. package/esm/components/Checkbox/CheckboxCard/CheckboxCard.mjs +8 -4
  52. package/esm/components/Checkbox/CheckboxCard/CheckboxCard.mjs.map +1 -1
  53. package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs +3 -2
  54. package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs.map +1 -1
  55. package/esm/components/ColorInput/ColorInput.mjs +4 -2
  56. package/esm/components/ColorInput/ColorInput.mjs.map +1 -1
  57. package/esm/components/ColorPicker/ColorPicker.mjs.map +1 -1
  58. package/esm/components/Combobox/get-options-lockup/get-option-by-label.mjs +17 -0
  59. package/esm/components/Combobox/get-options-lockup/get-option-by-label.mjs.map +1 -0
  60. package/esm/components/Combobox/is-external-input-change/is-external-input-change.mjs +17 -0
  61. package/esm/components/Combobox/is-external-input-change/is-external-input-change.mjs.map +1 -0
  62. package/esm/components/ComboboxPopover/ComboboxPopover.mjs.map +1 -1
  63. package/esm/components/FloatingIndicator/use-floating-indicator.mjs +6 -4
  64. package/esm/components/FloatingIndicator/use-floating-indicator.mjs.map +1 -1
  65. package/esm/components/MultiSelect/MultiSelect.mjs +9 -0
  66. package/esm/components/MultiSelect/MultiSelect.mjs.map +1 -1
  67. package/esm/components/Notification/Notification.mjs.map +1 -1
  68. package/esm/components/PasswordInput/PasswordInput.mjs +4 -3
  69. package/esm/components/PasswordInput/PasswordInput.mjs.map +1 -1
  70. package/esm/components/RollingNumber/RollingNumber.mjs +8 -4
  71. package/esm/components/RollingNumber/RollingNumber.mjs.map +1 -1
  72. package/esm/components/RollingNumber/RollingNumber.module.mjs +1 -0
  73. package/esm/components/RollingNumber/RollingNumber.module.mjs.map +1 -1
  74. package/esm/components/Select/Select.mjs +12 -0
  75. package/esm/components/Select/Select.mjs.map +1 -1
  76. package/esm/components/TagsInput/TagsInput.mjs +5 -1
  77. package/esm/components/TagsInput/TagsInput.mjs.map +1 -1
  78. package/esm/components/Tooltip/Tooltip.mjs +11 -3
  79. package/esm/components/Tooltip/Tooltip.mjs.map +1 -1
  80. package/esm/components/Tooltip/Tooltip.module.mjs.map +1 -1
  81. package/esm/components/Tooltip/TooltipFloating/TooltipFloating.mjs +2 -2
  82. package/esm/components/Tooltip/TooltipFloating/TooltipFloating.mjs.map +1 -1
  83. package/esm/components/Tooltip/TooltipFloating/use-floating-tooltip.mjs +1 -0
  84. package/esm/components/Tooltip/TooltipFloating/use-floating-tooltip.mjs.map +1 -1
  85. package/esm/components/Tooltip/use-tooltip.mjs +3 -2
  86. package/esm/components/Tooltip/use-tooltip.mjs.map +1 -1
  87. package/esm/components/TreeSelect/TreeSelect.mjs +3 -0
  88. package/esm/components/TreeSelect/TreeSelect.mjs.map +1 -1
  89. package/lib/components/Cascader/Cascader.d.ts +4 -0
  90. package/lib/components/Cascader/CascaderColumns.d.ts +3 -2
  91. package/lib/components/Cascader/use-cascader-safe-area.d.ts +20 -0
  92. package/lib/components/Checkbox/CheckboxCard/CheckboxCard.d.ts +3 -0
  93. package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
  94. package/lib/components/Combobox/get-options-lockup/get-option-by-label.d.ts +8 -0
  95. package/lib/components/Combobox/is-external-input-change/is-external-input-change.d.ts +7 -0
  96. package/lib/components/ComboboxPopover/ComboboxPopover.d.ts +1 -1
  97. package/lib/components/Notification/Notification.d.ts +2 -1
  98. package/lib/components/PasswordInput/PasswordInput.d.ts +2 -0
  99. package/lib/components/RollingNumber/RollingNumber.d.ts +1 -1
  100. package/lib/components/Tooltip/Tooltip.d.ts +2 -0
  101. package/lib/components/Tooltip/use-tooltip.d.ts +1 -0
  102. package/package.json +2 -2
  103. package/styles/RollingNumber.css +21 -0
  104. package/styles/RollingNumber.layer.css +21 -0
  105. package/styles/Tooltip.css +4 -0
  106. package/styles/Tooltip.layer.css +4 -0
  107. package/styles.css +25 -0
  108. package/styles.layer.css +25 -0
@@ -1 +1 @@
1
- {"version":3,"file":"use-floating-indicator.mjs","names":[],"sources":["../../../src/components/FloatingIndicator/use-floating-indicator.ts"],"sourcesContent":["import { useEffect, useRef, useState, type RefObject } from 'react';\nimport { useMutationObserverTarget, useTimeout } from '@mantine/hooks';\nimport { getEnv } from '../../core';\nimport { toInt } from '../ScrollArea/utils';\n\nfunction isParent(\n parentElement: HTMLElement | EventTarget | null,\n childElement: HTMLElement | null\n) {\n if (!childElement || !parentElement) {\n return false;\n }\n\n let parent = childElement.parentNode;\n while (parent != null) {\n if (parent === parentElement) {\n return true;\n }\n parent = parent.parentNode;\n }\n return false;\n}\n\ninterface UseFloatingIndicatorInput {\n target: HTMLElement | null | undefined;\n parent: HTMLElement | null | undefined;\n ref: RefObject<HTMLElement | null>;\n displayAfterTransitionEnd?: boolean;\n onTransitionStart?: () => void;\n onTransitionEnd?: () => void;\n}\n\nexport function useFloatingIndicator({\n target,\n parent,\n ref,\n displayAfterTransitionEnd,\n onTransitionStart,\n onTransitionEnd,\n}: UseFloatingIndicatorInput) {\n const transitionTimeout = useRef<number>(-1);\n const previousTarget = useRef<HTMLElement | null | undefined>(target);\n const [initialized, setInitialized] = useState(false);\n\n const [hidden, setHidden] = useState(\n typeof displayAfterTransitionEnd === 'boolean' ? displayAfterTransitionEnd : false\n );\n\n const updatePosition = () => {\n if (!target || !parent || !ref.current) {\n return;\n }\n\n const targetRect = target.getBoundingClientRect();\n const parentRect = parent.getBoundingClientRect();\n\n const targetComputedStyle = window.getComputedStyle(target);\n const parentComputedStyle = window.getComputedStyle(parent);\n\n const borderTopWidth =\n toInt(targetComputedStyle.borderTopWidth) + toInt(parentComputedStyle.borderTopWidth);\n const borderLeftWidth =\n toInt(targetComputedStyle.borderLeftWidth) + toInt(parentComputedStyle.borderLeftWidth);\n\n const position = {\n top: targetRect.top - parentRect.top - borderTopWidth,\n left: targetRect.left - parentRect.left - borderLeftWidth,\n width: targetRect.width,\n height: targetRect.height,\n };\n\n ref.current.style.transform = `translateY(${position.top}px) translateX(${position.left}px)`;\n ref.current.style.width = `${position.width}px`;\n ref.current.style.height = `${position.height}px`;\n };\n\n const updatePositionWithoutAnimation = () => {\n window.clearTimeout(transitionTimeout.current);\n if (ref.current) {\n ref.current.style.transitionDuration = '0ms';\n }\n updatePosition();\n transitionTimeout.current = window.setTimeout(() => {\n if (ref.current) {\n ref.current.style.transitionDuration = '';\n }\n }, 30);\n };\n\n const targetResizeObserver = useRef<ResizeObserver>(null);\n const parentResizeObserver = useRef<ResizeObserver>(null);\n\n useEffect(() => {\n if (initialized && previousTarget.current !== target && onTransitionStart) {\n onTransitionStart();\n }\n\n previousTarget.current = target;\n updatePosition();\n\n if (target) {\n targetResizeObserver.current = new ResizeObserver(updatePositionWithoutAnimation);\n targetResizeObserver.current.observe(target);\n\n if (parent) {\n parentResizeObserver.current = new ResizeObserver(updatePositionWithoutAnimation);\n parentResizeObserver.current.observe(parent);\n }\n\n return () => {\n targetResizeObserver.current?.disconnect();\n parentResizeObserver.current?.disconnect();\n };\n }\n\n return undefined;\n }, [parent, target]);\n\n useEffect(() => {\n if (parent) {\n const handleTransitionEnd = (event: TransitionEvent) => {\n if (isParent(event.target, parent)) {\n updatePositionWithoutAnimation();\n setHidden(false);\n }\n };\n\n parent.addEventListener('transitionend', handleTransitionEnd);\n return () => {\n parent.removeEventListener('transitionend', handleTransitionEnd);\n };\n }\n\n return undefined;\n }, [parent]);\n\n useEffect(() => {\n if (ref.current && onTransitionEnd) {\n const handleIndicatorTransitionEnd = (event: TransitionEvent) => {\n if (event.propertyName === 'transform') {\n onTransitionEnd();\n }\n };\n\n ref.current.addEventListener('transitionend', handleIndicatorTransitionEnd);\n return () => {\n ref.current?.removeEventListener('transitionend', handleIndicatorTransitionEnd);\n };\n }\n\n return undefined;\n }, [onTransitionEnd]);\n\n useTimeout(\n () => {\n // Prevents warning about state update without act\n if (getEnv() !== 'test') {\n setInitialized(true);\n }\n },\n 20,\n { autoInvoke: true }\n );\n\n useMutationObserverTarget(\n (mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'dir') {\n updatePositionWithoutAnimation();\n }\n });\n },\n { attributes: true, attributeFilter: ['dir'] },\n () => document.documentElement\n );\n\n return { initialized, hidden };\n}\n"],"mappings":";;;;;;AAKA,SAAS,SACP,eACA,cACA;CACA,IAAI,CAAC,gB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,gBAAgB,SAAS,kBAAkB,OAC/D,+BAA+B;EAEnC,CAAC;CACH,GACA;EAAE,YAAY;EAAM,iBAAiB,CAAC,KAAK;CAAE,SACvC,SAAS,eACjB;CAEA,OAAO;EAAE;EAAa;CAAO;AAC/B"}
1
+ {"version":3,"file":"use-floating-indicator.mjs","names":[],"sources":["../../../src/components/FloatingIndicator/use-floating-indicator.ts"],"sourcesContent":["import { useEffect, useRef, useState, type RefObject } from 'react';\nimport { useMutationObserverTarget, useTimeout } from '@mantine/hooks';\nimport { getEnv } from '../../core';\nimport { toInt } from '../ScrollArea/utils';\n\nfunction isParent(\n parentElement: HTMLElement | EventTarget | null,\n childElement: HTMLElement | null\n) {\n if (!childElement || !parentElement) {\n return false;\n }\n\n let parent = childElement.parentNode;\n while (parent != null) {\n if (parent === parentElement) {\n return true;\n }\n parent = parent.parentNode;\n }\n return false;\n}\n\ninterface UseFloatingIndicatorInput {\n target: HTMLElement | null | undefined;\n parent: HTMLElement | null | undefined;\n ref: RefObject<HTMLElement | null>;\n displayAfterTransitionEnd?: boolean;\n onTransitionStart?: () => void;\n onTransitionEnd?: () => void;\n}\n\nexport function useFloatingIndicator({\n target,\n parent,\n ref,\n displayAfterTransitionEnd,\n onTransitionStart,\n onTransitionEnd,\n}: UseFloatingIndicatorInput) {\n const transitionTimeout = useRef<number>(-1);\n const previousTarget = useRef<HTMLElement | null | undefined>(target);\n const [initialized, setInitialized] = useState(false);\n\n const [hidden, setHidden] = useState(\n typeof displayAfterTransitionEnd === 'boolean' ? displayAfterTransitionEnd : false\n );\n\n const updatePosition = () => {\n if (!target || !parent || !ref.current) {\n return;\n }\n\n const targetRect = target.getBoundingClientRect();\n const parentRect = parent.getBoundingClientRect();\n\n const scaleX = parent.offsetWidth === 0 ? 1 : parentRect.width / parent.offsetWidth;\n const scaleY = parent.offsetHeight === 0 ? 1 : parentRect.height / parent.offsetHeight;\n\n const targetComputedStyle = window.getComputedStyle(target);\n const parentComputedStyle = window.getComputedStyle(parent);\n\n const borderTopWidth =\n toInt(targetComputedStyle.borderTopWidth) + toInt(parentComputedStyle.borderTopWidth);\n const borderLeftWidth =\n toInt(targetComputedStyle.borderLeftWidth) + toInt(parentComputedStyle.borderLeftWidth);\n\n const position = {\n top: (targetRect.top - parentRect.top) / scaleY - borderTopWidth,\n left: (targetRect.left - parentRect.left) / scaleX - borderLeftWidth,\n width: targetRect.width / scaleX,\n height: targetRect.height / scaleY,\n };\n\n ref.current.style.transform = `translateY(${position.top}px) translateX(${position.left}px)`;\n ref.current.style.width = `${position.width}px`;\n ref.current.style.height = `${position.height}px`;\n };\n\n const updatePositionWithoutAnimation = () => {\n window.clearTimeout(transitionTimeout.current);\n if (ref.current) {\n ref.current.style.transitionDuration = '0ms';\n }\n updatePosition();\n transitionTimeout.current = window.setTimeout(() => {\n if (ref.current) {\n ref.current.style.transitionDuration = '';\n }\n }, 30);\n };\n\n const targetResizeObserver = useRef<ResizeObserver>(null);\n const parentResizeObserver = useRef<ResizeObserver>(null);\n\n useEffect(() => {\n if (initialized && previousTarget.current !== target && onTransitionStart) {\n onTransitionStart();\n }\n\n previousTarget.current = target;\n updatePosition();\n\n if (target) {\n targetResizeObserver.current = new ResizeObserver(updatePositionWithoutAnimation);\n targetResizeObserver.current.observe(target);\n\n if (parent) {\n parentResizeObserver.current = new ResizeObserver(updatePositionWithoutAnimation);\n parentResizeObserver.current.observe(parent);\n }\n\n return () => {\n targetResizeObserver.current?.disconnect();\n parentResizeObserver.current?.disconnect();\n };\n }\n\n return undefined;\n }, [parent, target]);\n\n useEffect(() => {\n if (parent) {\n const handleTransitionEnd = (event: TransitionEvent) => {\n if (isParent(event.target, parent)) {\n updatePositionWithoutAnimation();\n setHidden(false);\n }\n };\n\n parent.addEventListener('transitionend', handleTransitionEnd);\n return () => {\n parent.removeEventListener('transitionend', handleTransitionEnd);\n };\n }\n\n return undefined;\n }, [parent]);\n\n useEffect(() => {\n if (ref.current && onTransitionEnd) {\n const handleIndicatorTransitionEnd = (event: TransitionEvent) => {\n if (event.propertyName === 'transform') {\n onTransitionEnd();\n }\n };\n\n ref.current.addEventListener('transitionend', handleIndicatorTransitionEnd);\n return () => {\n ref.current?.removeEventListener('transitionend', handleIndicatorTransitionEnd);\n };\n }\n\n return undefined;\n }, [onTransitionEnd]);\n\n useTimeout(\n () => {\n // Prevents warning about state update without act\n if (getEnv() !== 'test') {\n setInitialized(true);\n }\n },\n 20,\n { autoInvoke: true }\n );\n\n useMutationObserverTarget(\n (mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'dir') {\n updatePositionWithoutAnimation();\n }\n });\n },\n { attributes: true, attributeFilter: ['dir'] },\n () => document.documentElement\n );\n\n return { initialized, hidden };\n}\n"],"mappings":";;;;;;AAKA,SAAS,SACP,eACA,cACA;CACA,IAAI,CAAC,gBAAgB,CAAC,eACpB,OAAO;CAGT,IAAI,SAAS,aAAa;CAC1B,OAAO,UAAU,MAAM;EACrB,IAAI,WAAW,eACb,OAAO;EAET,SAAS,OAAO;CAClB;CACA,OAAO;AACT;AAWA,SAAgB,qBAAqB,EACnC,QACA,QACA,KACA,2BACA,mBACA,mBAC4B;CAC5B,MAAM,oBAAoB,OAAe,EAAE;CAC3C,MAAM,iBAAiB,OAAuC,MAAM;CACpE,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CAEpD,MAAM,CAAC,QAAQ,aAAa,SAC1B,OAAO,8BAA8B,YAAY,4BAA4B,KAC/E;CAEA,MAAM,uBAAuB;EAC3B,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,SAC7B;EAGF,MAAM,aAAa,OAAO,sBAAsB;EAChD,MAAM,aAAa,OAAO,sBAAsB;EAEhD,MAAM,SAAS,OAAO,gBAAgB,IAAI,IAAI,WAAW,QAAQ,OAAO;EACxE,MAAM,SAAS,OAAO,iBAAiB,IAAI,IAAI,WAAW,SAAS,OAAO;EAE1E,MAAM,sBAAsB,OAAO,iBAAiB,MAAM;EAC1D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I,QAAQ;GACV,MAAM,uBAAuB,UAA2B;IACtD,IAAI,SAAS,MAAM,QAAQ,MAAM,GAAG;KAClC,+BAA+B;KAC/B,UAAU,KAAK;IACjB;GACF;GAEA,OAAO,iBAAiB,iBAAiB,mBAAmB;GAC5D,aAAa;IACX,OAAO,oBAAoB,iBAAiB,mBAAmB;GACjE;EACF;CAGF,GAAG,CAAC,MAAM,CAAC;CAEX,gBAAgB;EACd,IAAI,IAAI,WAAW,iBAAiB;GAClC,MAAM,gCAAgC,UAA2B;IAC/D,IAAI,MAAM,iBAAiB,aACzB,gBAAgB;GAEpB;GAEA,IAAI,QAAQ,iBAAiB,iBAAiB,4BAA4B;GAC1E,aAAa;IACX,IAAI,SAAS,oBAAoB,iBAAiB,4BAA4B;GAChF;EACF;CAGF,GAAG,CAAC,eAAe,CAAC;CAEpB,iBACQ;EAEJ,IAAI,OAAO,MAAM,QACf,eAAe,IAAI;CAEvB,GACA,IACA,EAAE,YAAY,KAAK,CACrB;CAEA,2BACG,cAAc;EACb,UAAU,SAAS,aAAa;GAC9B,IAAI,SAAS,SAAS,gBAAgB,SAAS,kBAAkB,OAC/D,+BAA+B;EAEnC,CAAC;CACH,GACA;EAAE,YAAY;EAAM,iBAAiB,CAAC,KAAK;CAAE,SACvC,SAAS,eACjB;CAEA,OAAO;EAAE;EAAa;CAAO;AAC/B"}
@@ -11,6 +11,8 @@ import { useCombobox } from "../Combobox/use-combobox/use-combobox.mjs";
11
11
  import { Combobox } from "../Combobox/Combobox.mjs";
12
12
  import { OptionsDropdown } from "../Combobox/OptionsDropdown/OptionsDropdown.mjs";
13
13
  import { usePillsReorder } from "../Combobox/use-pills-reorder/use-pills-reorder.mjs";
14
+ import { isExternalInputChange } from "../Combobox/is-external-input-change/is-external-input-change.mjs";
15
+ import { getOptionByLabel } from "../Combobox/get-options-lockup/get-option-by-label.mjs";
14
16
  import { Pill } from "../Pill/Pill.mjs";
15
17
  import { PillsInput } from "../PillsInput/PillsInput.mjs";
16
18
  import { filterPickedValues } from "./filter-picked-values.mjs";
@@ -260,6 +262,13 @@ const MultiSelect = genericFactory((_props) => {
260
262
  onKeyDown: handleInputKeydown,
261
263
  value: _searchValue,
262
264
  onChange: (event) => {
265
+ if (isExternalInputChange(event)) {
266
+ if (!readOnly) {
267
+ const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);
268
+ if (externalOption && !_value.includes(externalOption.value) && _value.length < maxValues) setValue([..._value, externalOption.value]);
269
+ }
270
+ return;
271
+ }
263
272
  handleSearchChange(event.currentTarget.value);
264
273
  searchable && combobox.openDropdown();
265
274
  selectFirstOptionOnChange && combobox.selectFirstOption();
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.mjs","names":["useId"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxRenderPillInput,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n usePillsReorder,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollAreaProps } from '../ScrollArea';\nimport { filterPickedValues } from './filter-picked-values';\n\nconst clearSectionOffset: Record<string, number> = {\n xs: 41,\n sm: 50,\n md: 60,\n lg: 72,\n xl: 89,\n};\n\nexport type MultiSelectStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport interface MultiSelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<MultiSelectFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Controlled component value */\n value?: Value[];\n\n /** Uncontrolled component default value */\n defaultValue?: Value[];\n\n /** Called when value changes */\n onChange?: (value: Value[]) => void;\n\n /** Called with `value` of the removed item */\n onRemove?: (value: Value) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Called when user attempts to select more values than allowed */\n onMaxValues?: () => void;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Maximum number of values, no limit if not set */\n maxValues?: number;\n\n /** Allows searching through options by user input @default false */\n searchable?: boolean;\n\n /** Message displayed when no options match the search query (when searchable is enabled) or when the data array is empty. If not set, the dropdown will be hidden instead. */\n nothingFoundMessage?: React.ReactNode;\n\n /** If set, the check icon is displayed near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** If set, unchecked labels are aligned with checked ones @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the checkmark icon shown next to selected options in the dropdown @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** When enabled, selected options are hidden from the dropdown list @default false */\n hidePickedOptions?: boolean;\n\n /** When enabled, displays a clear button to remove all selected values (hidden when component is empty, disabled, or read-only) @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Divider used to separate values in the hidden input `value` attribute @default ',' */\n hiddenInputValuesDivider?: string;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem<Value>>) => React.ReactNode;\n\n /** A function to render content of the pill */\n renderPill?: (props: ComboboxRenderPillInput<Value>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron */\n chevronColor?: MantineColor;\n\n /** Clear search value when item is selected @default true */\n clearSearchOnChange?: boolean;\n\n /** Controls whether dropdown opens when the input receives focus @default true */\n openOnFocus?: boolean;\n\n /** If set, selected values can be reordered by dragging pills. Disabled when `disabled` or `readOnly` is set. @default false */\n withPillsReorder?: boolean;\n}\n\nexport type MultiSelectFactory = Factory<{\n props: MultiSelectProps;\n ref: HTMLInputElement;\n stylesNames: MultiSelectStylesNames;\n signature: <Value extends Primitive = string>(\n props: MultiSelectProps<Value>\n ) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n maxValues: Infinity,\n withCheckIcon: true,\n checkIconPosition: 'left',\n hiddenInputValuesDivider: ',',\n clearSearchOnChange: true,\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<MultiSelectProps>;\n\nexport const MultiSelect = genericFactory<MultiSelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'MultiSelect'], defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n value,\n defaultValue,\n onChange,\n onKeyDown,\n variant,\n data,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n readOnly,\n disabled,\n onFocus,\n onBlur,\n radius,\n rightSection,\n rightSectionWidth,\n rightSectionPointerEvents,\n rightSectionProps,\n leftSection,\n leftSectionWidth,\n leftSectionPointerEvents,\n leftSectionProps,\n inputContainer,\n inputWrapperOrder,\n withAsterisk,\n labelProps,\n descriptionProps,\n errorProps,\n successProps,\n wrapperProps,\n description,\n label,\n error,\n success,\n maxValues,\n searchable,\n nothingFoundMessage,\n withCheckIcon,\n withAlignedLabels,\n checkIconPosition,\n hidePickedOptions,\n withErrorStyles,\n withSuccessStyles,\n name,\n form,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n placeholder,\n hiddenInputValuesDivider,\n required,\n mod,\n renderOption,\n renderPill,\n onRemove,\n onClear,\n onMaxValues,\n scrollAreaProps,\n chevronColor,\n attributes,\n clearSearchOnChange,\n openOnFocus,\n loading,\n loadingPosition,\n withPillsReorder,\n ...others\n } = props;\n\n const _id = useId(id);\n const parsedData = getParsedComboboxData(data);\n const optionsLockup = getOptionsLockup(parsedData);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n },\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: [],\n onChange,\n });\n\n const { getPillProps, getListProps, handleInputKeyDown } = usePillsReorder({\n value: _value,\n onChange: setValue,\n enabled: withPillsReorder && !disabled && !readOnly,\n });\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: '',\n onChange: onSearchChange,\n });\n\n const handleSearchChange = (value: string) => {\n setSearchValue(value);\n combobox.resetSelectedOption();\n };\n\n const getStyles = useStyles<MultiSelectFactory>({\n name: 'MultiSelect',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MultiSelectFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (event.key === ' ' && !searchable) {\n event.preventDefault();\n combobox.toggleDropdown();\n }\n\n if (event.key === 'Backspace' && _searchValue.length === 0 && _value.length > 0) {\n onRemove?.(_value[_value.length - 1]);\n setValue(_value.slice(0, _value.length - 1));\n }\n\n handleInputKeyDown(event);\n };\n\n const values = _value.map((item, index) => {\n const optionData = optionsLockup[`${item}`] || retainedSelectedOptions.current[`${item}`];\n const reorderProps = getPillProps(index);\n\n if (renderPill) {\n return (\n <Fragment key={`${item}-${index}`}>\n {renderPill({\n option: optionData,\n value: item,\n onRemove: () => {\n setValue(_value.filter((i) => item !== i));\n onRemove?.(item);\n },\n disabled,\n reorderProps,\n })}\n </Fragment>\n );\n }\n\n return (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly && !optionsLockup[`${item}`]?.disabled}\n onRemove={() => {\n setValue(_value.filter((i) => item !== i));\n onRemove?.(item);\n }}\n unstyled={unstyled}\n disabled={disabled}\n {...getStyles('pill')}\n {...reorderProps}\n >\n {optionData?.label || item}\n </Pill>\n );\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, _searchValue]);\n\n useEffect(() => {\n _value.forEach((val) => {\n if (`${val}` in optionsLockup) {\n retainedSelectedOptions.current[`${val}`] = optionsLockup[`${val}`];\n }\n });\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n onClear?.();\n setValue([]);\n handleSearchChange('');\n }}\n />\n );\n\n const filteredData = filterPickedValues({ data: parsedData, value: _value });\n const _clearable = clearable && _value.length > 0 && !disabled && !readOnly;\n const pillsListStyle = _clearable\n ? { paddingInlineEnd: clearSectionOffset[size] ?? clearSectionOffset.sm }\n : undefined;\n\n return (\n <>\n <Combobox\n store={combobox}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n readOnly={readOnly}\n __staticSelector=\"MultiSelect\"\n attributes={attributes}\n floatingHeight={floatingHeight}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n if (clearSearchOnChange) {\n handleSearchChange('');\n }\n combobox.updateSelectedOptionIndex('selected');\n\n if (_value.includes(optionsLockup[`${val}`].value as any)) {\n setValue(_value.filter((v) => v !== optionsLockup[`${val}`].value));\n onRemove?.(optionsLockup[`${val}`].value as any);\n } else if (_value.length < maxValues) {\n setValue([..._value, optionsLockup[`${val}`].value] as any);\n } else {\n onMaxValues?.();\n }\n }}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"MultiSelect\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n className={className}\n style={style}\n variant={variant}\n disabled={disabled}\n radius={radius}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n rightSectionWidth={rightSectionWidth}\n rightSectionProps={rightSectionProps}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n loading={loading}\n loadingPosition={loadingPosition}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n successProps={successProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n error={error}\n success={success}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\n __stylesApiProps={{\n ...props,\n rightSectionPointerEvents: rightSectionPointerEvents || 'none',\n multiline: true,\n }}\n pointer={!searchable}\n onClick={() => (searchable ? combobox.openDropdown() : combobox.toggleDropdown())}\n data-expanded={combobox.dropdownOpened || undefined}\n id={_id}\n required={required}\n mod={mod}\n attributes={attributes}\n >\n <Pill.Group\n attributes={attributes}\n disabled={disabled}\n unstyled={unstyled}\n {...getStyles('pillsList', { style: pillsListStyle })}\n {...getListProps()}\n >\n {values}\n <Combobox.EventsTarget autoComplete={autoComplete} withExpandedAttribute>\n <PillsInput.Field\n {...rest}\n id={_id}\n placeholder={placeholder}\n type={!searchable && !placeholder ? 'hidden' : 'visible'}\n {...getStyles('inputField')}\n unstyled={unstyled}\n onFocus={(event) => {\n onFocus?.(event);\n openOnFocus && searchable && combobox.openDropdown();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n combobox.closeDropdown();\n handleSearchChange('');\n }}\n onKeyDown={handleInputKeydown}\n value={_searchValue}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n searchable && combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n disabled={disabled}\n readOnly={readOnly || !searchable}\n pointer={!searchable}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n\n <OptionsDropdown\n data={hidePickedOptions ? filteredData : parsedData}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={searchable}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={label ? `${_id}-label` : undefined}\n aria-label={label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n name={name}\n valuesDivider={hiddenInputValuesDivider}\n value={_value}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nMultiSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nMultiSelect.displayName = '@mantine/core/MultiSelect';\n\nexport namespace MultiSelect {\n export type Props<Value extends Primitive = string> = MultiSelectProps<Value>;\n export type StylesNames = MultiSelectStylesNames;\n export type Factory = MultiSelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,qBAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AA8GA,MAAM,eAAe;CACnB,WAAW;CACX,eAAe;CACf,mBAAmB;CACnB,0BAA0B;CAC1B,qBAAqB;CACrB,aAAa;CACb,MAAM;AACR;AAEA,MAAa,cAAc,gBAAoC,WAAW;CACxE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAa,GAAG,cAAc,MAAM;CACrF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,gBACA,aACA,oBACA,gBACA,UACA,UACA,SACA,QACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,WACA,YACA,qBACA,eACA,mBACA,mBACA,mBACA,iBACA,mBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,aACA,0BACA,UACA,KACA,cACA,YACA,UACA,SACA,aACA,iBACA,cACA,YACA,qBACA,aACA,SACA,iBACA,kBACA,GAAG,WACD;CAEJ,MAAM,MAAMA,QAAM,EAAE;CACpB,MAAM,aAAa,sBAAsB,IAAI;CAC7C,MAAM,gBAAgB,iBAAiB,UAAU;CACjD,MAAM,0BAA0B,OAAgD,CAAC,CAAC;CAElF,MAAM,WAAW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Ac,WAAW;MAC/C,GAAI,UAAU,YAAY;MAChB;MACV,UAAU,UAAU;OAClB,UAAU,KAAK;OACf,eAAe,cAAc,SAAS,aAAa;MACrD;MACA,SAAS,UAAU;OACjB,SAAS,KAAK;OACd,SAAS,cAAc;OACvB,mBAAmB,EAAE;MACvB;MACA,WAAW;MACX,OAAO;MACP,WAAW,UAAU;OACnB,mBAAmB,MAAM,cAAc,KAAK;OAC5C,cAAc,SAAS,aAAa;OACpC,6BAA6B,SAAS,kBAAkB;MAC1D;MACU;MACV,UAAU,YAAY,CAAC;MACvB,SAAS,CAAC;KACX,CAAA;IACoB,CAAA,CACb;;EACF,CAAA,EACW,CAAA,GAEzB,oBAAC,iBAAD;GACE,MAAM,oBAAoB,eAAe;GACzC,QAAQ,YAAY;GACZ;GACR,QAAQ;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe;GACf,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,QAAQ,GAAG,IAAI,UAAU,KAAA;GAClC,cAAY,QAAQ,KAAA,IAAY,OAAO;GACzB;GACG;EAClB,CAAA,CACO;KACV,oBAAC,SAAS,aAAV;EACQ;EACN,eAAe;EACf,OAAO;EACD;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,YAAY,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AAClE,YAAY,cAAc"}
1
+ {"version":3,"file":"MultiSelect.mjs","names":["useId"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxRenderPillInput,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n usePillsReorder,\n} from '../Combobox';\nimport { getOptionByLabel } from '../Combobox/get-options-lockup/get-option-by-label';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollAreaProps } from '../ScrollArea';\nimport { filterPickedValues } from './filter-picked-values';\n\nconst clearSectionOffset: Record<string, number> = {\n xs: 41,\n sm: 50,\n md: 60,\n lg: 72,\n xl: 89,\n};\n\nexport type MultiSelectStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport interface MultiSelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<MultiSelectFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Controlled component value */\n value?: Value[];\n\n /** Uncontrolled component default value */\n defaultValue?: Value[];\n\n /** Called when value changes */\n onChange?: (value: Value[]) => void;\n\n /** Called with `value` of the removed item */\n onRemove?: (value: Value) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Called when user attempts to select more values than allowed */\n onMaxValues?: () => void;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Maximum number of values, no limit if not set */\n maxValues?: number;\n\n /** Allows searching through options by user input @default false */\n searchable?: boolean;\n\n /** Message displayed when no options match the search query (when searchable is enabled) or when the data array is empty. If not set, the dropdown will be hidden instead. */\n nothingFoundMessage?: React.ReactNode;\n\n /** If set, the check icon is displayed near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** If set, unchecked labels are aligned with checked ones @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the checkmark icon shown next to selected options in the dropdown @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** When enabled, selected options are hidden from the dropdown list @default false */\n hidePickedOptions?: boolean;\n\n /** When enabled, displays a clear button to remove all selected values (hidden when component is empty, disabled, or read-only) @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Divider used to separate values in the hidden input `value` attribute @default ',' */\n hiddenInputValuesDivider?: string;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem<Value>>) => React.ReactNode;\n\n /** A function to render content of the pill */\n renderPill?: (props: ComboboxRenderPillInput<Value>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron */\n chevronColor?: MantineColor;\n\n /** Clear search value when item is selected @default true */\n clearSearchOnChange?: boolean;\n\n /** Controls whether dropdown opens when the input receives focus @default true */\n openOnFocus?: boolean;\n\n /** If set, selected values can be reordered by dragging pills. Disabled when `disabled` or `readOnly` is set. @default false */\n withPillsReorder?: boolean;\n}\n\nexport type MultiSelectFactory = Factory<{\n props: MultiSelectProps;\n ref: HTMLInputElement;\n stylesNames: MultiSelectStylesNames;\n signature: <Value extends Primitive = string>(\n props: MultiSelectProps<Value>\n ) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n maxValues: Infinity,\n withCheckIcon: true,\n checkIconPosition: 'left',\n hiddenInputValuesDivider: ',',\n clearSearchOnChange: true,\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<MultiSelectProps>;\n\nexport const MultiSelect = genericFactory<MultiSelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'MultiSelect'], defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n value,\n defaultValue,\n onChange,\n onKeyDown,\n variant,\n data,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n readOnly,\n disabled,\n onFocus,\n onBlur,\n radius,\n rightSection,\n rightSectionWidth,\n rightSectionPointerEvents,\n rightSectionProps,\n leftSection,\n leftSectionWidth,\n leftSectionPointerEvents,\n leftSectionProps,\n inputContainer,\n inputWrapperOrder,\n withAsterisk,\n labelProps,\n descriptionProps,\n errorProps,\n successProps,\n wrapperProps,\n description,\n label,\n error,\n success,\n maxValues,\n searchable,\n nothingFoundMessage,\n withCheckIcon,\n withAlignedLabels,\n checkIconPosition,\n hidePickedOptions,\n withErrorStyles,\n withSuccessStyles,\n name,\n form,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n placeholder,\n hiddenInputValuesDivider,\n required,\n mod,\n renderOption,\n renderPill,\n onRemove,\n onClear,\n onMaxValues,\n scrollAreaProps,\n chevronColor,\n attributes,\n clearSearchOnChange,\n openOnFocus,\n loading,\n loadingPosition,\n withPillsReorder,\n ...others\n } = props;\n\n const _id = useId(id);\n const parsedData = getParsedComboboxData(data);\n const optionsLockup = getOptionsLockup(parsedData);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n },\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: [],\n onChange,\n });\n\n const { getPillProps, getListProps, handleInputKeyDown } = usePillsReorder({\n value: _value,\n onChange: setValue,\n enabled: withPillsReorder && !disabled && !readOnly,\n });\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: '',\n onChange: onSearchChange,\n });\n\n const handleSearchChange = (value: string) => {\n setSearchValue(value);\n combobox.resetSelectedOption();\n };\n\n const getStyles = useStyles<MultiSelectFactory>({\n name: 'MultiSelect',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MultiSelectFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (event.key === ' ' && !searchable) {\n event.preventDefault();\n combobox.toggleDropdown();\n }\n\n if (event.key === 'Backspace' && _searchValue.length === 0 && _value.length > 0) {\n onRemove?.(_value[_value.length - 1]);\n setValue(_value.slice(0, _value.length - 1));\n }\n\n handleInputKeyDown(event);\n };\n\n const values = _value.map((item, index) => {\n const optionData = optionsLockup[`${item}`] || retainedSelectedOptions.current[`${item}`];\n const reorderProps = getPillProps(index);\n\n if (renderPill) {\n return (\n <Fragment key={`${item}-${index}`}>\n {renderPill({\n option: optionData,\n value: item,\n onRemove: () => {\n setValue(_value.filter((i) => item !== i));\n onRemove?.(item);\n },\n disabled,\n reorderProps,\n })}\n </Fragment>\n );\n }\n\n return (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly && !optionsLockup[`${item}`]?.disabled}\n onRemove={() => {\n setValue(_value.filter((i) => item !== i));\n onRemove?.(item);\n }}\n unstyled={unstyled}\n disabled={disabled}\n {...getStyles('pill')}\n {...reorderProps}\n >\n {optionData?.label || item}\n </Pill>\n );\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, _searchValue]);\n\n useEffect(() => {\n _value.forEach((val) => {\n if (`${val}` in optionsLockup) {\n retainedSelectedOptions.current[`${val}`] = optionsLockup[`${val}`];\n }\n });\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n onClear?.();\n setValue([]);\n handleSearchChange('');\n }}\n />\n );\n\n const filteredData = filterPickedValues({ data: parsedData, value: _value });\n const _clearable = clearable && _value.length > 0 && !disabled && !readOnly;\n const pillsListStyle = _clearable\n ? { paddingInlineEnd: clearSectionOffset[size] ?? clearSectionOffset.sm }\n : undefined;\n\n return (\n <>\n <Combobox\n store={combobox}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n readOnly={readOnly}\n __staticSelector=\"MultiSelect\"\n attributes={attributes}\n floatingHeight={floatingHeight}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n if (clearSearchOnChange) {\n handleSearchChange('');\n }\n combobox.updateSelectedOptionIndex('selected');\n\n if (_value.includes(optionsLockup[`${val}`].value as any)) {\n setValue(_value.filter((v) => v !== optionsLockup[`${val}`].value));\n onRemove?.(optionsLockup[`${val}`].value as any);\n } else if (_value.length < maxValues) {\n setValue([..._value, optionsLockup[`${val}`].value] as any);\n } else {\n onMaxValues?.();\n }\n }}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"MultiSelect\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n className={className}\n style={style}\n variant={variant}\n disabled={disabled}\n radius={radius}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n rightSectionWidth={rightSectionWidth}\n rightSectionProps={rightSectionProps}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n loading={loading}\n loadingPosition={loadingPosition}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n successProps={successProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n error={error}\n success={success}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\n __stylesApiProps={{\n ...props,\n rightSectionPointerEvents: rightSectionPointerEvents || 'none',\n multiline: true,\n }}\n pointer={!searchable}\n onClick={() => (searchable ? combobox.openDropdown() : combobox.toggleDropdown())}\n data-expanded={combobox.dropdownOpened || undefined}\n id={_id}\n required={required}\n mod={mod}\n attributes={attributes}\n >\n <Pill.Group\n attributes={attributes}\n disabled={disabled}\n unstyled={unstyled}\n {...getStyles('pillsList', { style: pillsListStyle })}\n {...getListProps()}\n >\n {values}\n <Combobox.EventsTarget autoComplete={autoComplete} withExpandedAttribute>\n <PillsInput.Field\n {...rest}\n id={_id}\n placeholder={placeholder}\n type={!searchable && !placeholder ? 'hidden' : 'visible'}\n {...getStyles('inputField')}\n unstyled={unstyled}\n onFocus={(event) => {\n onFocus?.(event);\n openOnFocus && searchable && combobox.openDropdown();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n combobox.closeDropdown();\n handleSearchChange('');\n }}\n onKeyDown={handleInputKeydown}\n value={_searchValue}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n if (!readOnly) {\n const externalOption = getOptionByLabel(\n optionsLockup,\n event.currentTarget.value\n );\n\n if (\n externalOption &&\n !_value.includes(externalOption.value as any) &&\n _value.length < maxValues\n ) {\n setValue([..._value, externalOption.value] as any);\n }\n }\n\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n searchable && combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n disabled={disabled}\n readOnly={readOnly || !searchable}\n pointer={!searchable}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n\n <OptionsDropdown\n data={hidePickedOptions ? filteredData : parsedData}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={searchable}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={label ? `${_id}-label` : undefined}\n aria-label={label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n name={name}\n valuesDivider={hiddenInputValuesDivider}\n value={_value}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nMultiSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nMultiSelect.displayName = '@mantine/core/MultiSelect';\n\nexport namespace MultiSelect {\n export type Props<Value extends Primitive = string> = MultiSelectProps<Value>;\n export type StylesNames = MultiSelectStylesNames;\n export type Factory = MultiSelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,qBAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AA8GA,MAAM,eAAe;CACnB,WAAW;CACX,eAAe;CACf,mBAAmB;CACnB,0BAA0B;CAC1B,qBAAqB;CACrB,aAAa;CACb,MAAM;AACR;AAEA,MAAa,cAAc,gBAAoC,WAAW;CACxE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAa,GAAG,cAAc,MAAM;CACrF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,gBACA,aACA,oBACA,gBACA,UACA,UACA,SACA,QACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,WACA,YACA,qBACA,eACA,mBACA,mBACA,mBACA,iBACA,mBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,aACA,0BACA,UACA,KACA,cACA,YACA,UACA,SACA,aACA,iBACA,cACA,YACA,qBACA,aACA,SACA,iBACA,kBACA,GAAG,WACD;CAEJ,MAAM,MAAMA,QAAM,EAAE;CACpB,MAAM,aAAa,sBAAsB,IAAI;CAC7C,MAAM,gBAAgB,iBAAiB,UAAU;CACjD,MAAM,0BAA0B,OAAgD,CAAC,CAAC;CAElF,MAAM,WAAW,YAAY;EAC3B,QAAQ;EACR,eAAe;EACf,sBAAsB;GACpB,iBAAiB;GACjB,IAAI,iCACF,SAAS,kBAAkB;EAE/B;EACA,uBAAuB;GACrB,kBAAkB;GAClB,SAAS,oBAAoB;EAC/B;CACF,CAAC;CAED,MAAM,EACJ,YACA,MAAM,EAAE,MAAM,cAAc,GAAG,WAC7B,kBAAkB,MAAM;CAE5B,MAAM,CAAC,QAAQ,YAAY,gBAAgB;EACzC;EACA;EACA,YAAY,CAAC;EACb;CACF,CAAC;CAED,MAAM,EAAE,cAAc,cAAc,uBAAuB,gBAAgB;EACzE,OAAO;EACP,UAAU;EACV,SAAS,oBAAoB,CAAC,YAAY,CAAC;CAC7C,CAAC;CAED,MAAM,CAAC,cAAc,kBAAkB,gBAAgB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,MAAM,cAAc,KAAK;OAC5C,cAAc,SAAS,aAAa;OACpC,6BAA6B,SAAS,kBAAkB;MAC1D;MACU;MACV,UAAU,YAAY,CAAC;MACvB,SAAS,CAAC;KACX,CAAA;IACoB,CAAA,CACb;;EACF,CAAA,EACW,CAAA,GAEzB,oBAAC,iBAAD;GACE,MAAM,oBAAoB,eAAe;GACzC,QAAQ,YAAY;GACZ;GACR,QAAQ;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe;GACf,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,QAAQ,GAAG,IAAI,UAAU,KAAA;GAClC,cAAY,QAAQ,KAAA,IAAY,OAAO;GACzB;GACG;EAClB,CAAA,CACO;KACV,oBAAC,SAAS,aAAV;EACQ;EACN,eAAe;EACf,OAAO;EACD;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,YAAY,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AAClE,YAAY,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.mjs","names":["classes"],"sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { CloseButton } from '../CloseButton';\nimport { Loader, LoaderProps } from '../Loader';\nimport classes from './Notification.module.css';\n\nexport type NotificationStylesNames =\n | 'root'\n | 'icon'\n | 'loader'\n | 'body'\n | 'title'\n | 'description'\n | 'closeButton';\nexport type NotificationCssVariables = {\n root: '--notification-radius' | '--notification-color';\n};\n\nexport interface NotificationProps\n extends BoxProps, StylesApiProps<NotificationFactory>, ElementProps<'div', 'title'> {\n /** Called when the close button is clicked */\n onClose?: () => void;\n\n /** Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color. When `icon` is provided, sets the icon background color. When no icon is provided, sets the colored accent line on the left. @default theme.primaryColor */\n color?: MantineColor;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Notification icon, replaces color line */\n icon?: React.ReactNode;\n\n /** Notification title, displayed above the message body */\n title?: React.ReactNode;\n\n /** Notification description, displayed below the title. When no title is provided, this serves as the main message. */\n children?: React.ReactNode;\n\n /** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */\n loading?: boolean;\n\n /** Adds border to the root element */\n withBorder?: boolean;\n\n /** If set, the close button is visible @default true */\n withCloseButton?: boolean;\n\n /** Props passed down to the close button */\n closeButtonProps?: ElementProps<'button'> & DataAttributes;\n\n /** Props passed down to the `Loader` component */\n loaderProps?: LoaderProps;\n}\n\nexport type NotificationFactory = Factory<{\n props: NotificationProps;\n ref: HTMLDivElement;\n stylesNames: NotificationStylesNames;\n vars: NotificationCssVariables;\n}>;\n\nconst defaultProps = {\n withCloseButton: true,\n} satisfies Partial<NotificationProps>;\n\nconst varsResolver = createVarsResolver<NotificationFactory>((theme, { radius, color }) => ({\n root: {\n '--notification-radius': radius === undefined ? undefined : getRadius(radius),\n '--notification-color': color ? getThemeColor(color, theme) : undefined,\n },\n}));\n\nexport const Notification = factory<NotificationFactory>((_props) => {\n const props = useProps('Notification', defaultProps, _props);\n const {\n className,\n color,\n radius,\n loading,\n withCloseButton,\n withBorder,\n title,\n icon,\n children,\n onClose,\n closeButtonProps,\n classNames,\n style,\n styles,\n unstyled,\n vars,\n mod,\n loaderProps,\n role,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<NotificationFactory>({\n name: 'Notification',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'data-with-icon': !!icon || loading, 'data-with-border': withBorder }, mod]}\n role={role || 'alert'}\n {...others}\n >\n {icon && !loading && <div {...getStyles('icon')}>{icon}</div>}\n {loading && <Loader size={28} color={color} {...getStyles('loader')} {...loaderProps} />}\n\n <div {...getStyles('body')}>\n {title && <div {...getStyles('title')}>{title}</div>}\n\n <Box {...getStyles('description')} mod={{ 'data-with-title': !!title }}>\n {children}\n </Box>\n </div>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n color=\"gray\"\n {...closeButtonProps}\n unstyled={unstyled}\n onClick={(event) => {\n closeButtonProps?.onClick?.(event);\n onClose?.();\n }}\n {...getStyles('closeButton')}\n />\n )}\n </Box>\n );\n});\n\nNotification.classes = classes;\nNotification.varsResolver = varsResolver;\nNotification.displayName = '@mantine/core/Notification';\n\nexport namespace Notification {\n export type Props = NotificationProps;\n export type StylesNames = NotificationStylesNames;\n export type Factory = NotificationFactory;\n export type CssVariables = NotificationCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;AA2EA,MAAM,eAAe,EACnB,iBAAiB,KACnB;AAEA,MAAM,eAAe,oBAAyC,OAAO,EAAE,QAAQ,aAAa,EAC1F,MAAM;CACJ,yBAAyB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM;CAC5E,wBAAwB,QAAQ,cAAc,OAAO,KAAK,IAAI,KAAA;AAChE,EACF,EAAE;AAEF,MAAa,eAAe,SAA8B,WAAW;CACnE,MAAM,QAAQ,SAAS,gBAAgB,cAAc,MAAM;CAC3D,MAAM,EACJ,WACA,OACA,QACA,SACA,iBACA,YACA,OACA,MACA,UACA,SACA,kBACA,YACA,OACA,QACA,UACA,MACA,KACA,aACA,MACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAA+B;EAC/C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,qBAAC,KAAD;EACE,GAAI,UAAU,MAAM;EACpB,KAAK,CAAC;GAAE,kBAAkB,CAAC,CAAC,QAAQ;GAAS,oBAAoB;EAAW,GAAG,GAAG;EAClF,MAAM,QAAQ;EACd,GAAI;YAJN;GAMG,QAAQ,CAAC,WAAW,oBAAC,OAAD;IAAK,GAAI,UAAU,MAAM;cAAI;GAAU,CAAA;GAC3D,WAAW,oBAAC,QAAD;IAAQ,MAAM;IAAW;IAAO,GAAI,UAAU,QAAQ;IAAG,GAAI;GAAc,CAAA;GAEvF,qBAAC,OAAD;IAAK,GAAI,UAAU,MAAM;cAAzB,CACG,SAAS,oBAAC,OAAD;KAAK,GAAI,UAAU,OAAO;eAAI;IAAW,CAAA,GAEnD,oBAAC,KAAD;KAAK,GAAI,UAAU,aAAa;KAAG,KAAK,EAAE,mBAAmB,CAAC,CAAC,MAAM;KAClE;IACE,CAAA,CACF;;GAEJ,mBACC,oBAAC,aAAD;IACE,UAAU;IACV,OAAM;IACN,GAAI;IACM;IACV,UAAU,UAAU;KAClB,kBAAkB,UAAU,KAAK;KACjC,UAAU;IACZ;IACA,GAAI,UAAU,aAAa;GAC5B,CAAA;EAEA;;AAET,CAAC;AAED,aAAa,UAAUA;AACvB,aAAa,eAAe;AAC5B,aAAa,cAAc"}
1
+ {"version":3,"file":"Notification.mjs","names":["classes"],"sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { __CloseButtonProps, CloseButton } from '../CloseButton';\nimport { Loader, LoaderProps } from '../Loader';\nimport classes from './Notification.module.css';\n\nexport type NotificationStylesNames =\n | 'root'\n | 'icon'\n | 'loader'\n | 'body'\n | 'title'\n | 'description'\n | 'closeButton';\nexport type NotificationCssVariables = {\n root: '--notification-radius' | '--notification-color';\n};\n\nexport interface NotificationProps\n extends BoxProps, StylesApiProps<NotificationFactory>, ElementProps<'div', 'title'> {\n /** Called when the close button is clicked */\n onClose?: () => void;\n\n /** Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color. When `icon` is provided, sets the icon background color. When no icon is provided, sets the colored accent line on the left. @default theme.primaryColor */\n color?: MantineColor;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Notification icon, replaces color line */\n icon?: React.ReactNode;\n\n /** Notification title, displayed above the message body */\n title?: React.ReactNode;\n\n /** Notification description, displayed below the title. When no title is provided, this serves as the main message. */\n children?: React.ReactNode;\n\n /** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */\n loading?: boolean;\n\n /** Adds border to the root element */\n withBorder?: boolean;\n\n /** If set, the close button is visible @default true */\n withCloseButton?: boolean;\n\n /** Props passed down to the close button */\n closeButtonProps?: __CloseButtonProps & ElementProps<'button'> & DataAttributes;\n\n /** Props passed down to the `Loader` component */\n loaderProps?: LoaderProps;\n}\n\nexport type NotificationFactory = Factory<{\n props: NotificationProps;\n ref: HTMLDivElement;\n stylesNames: NotificationStylesNames;\n vars: NotificationCssVariables;\n}>;\n\nconst defaultProps = {\n withCloseButton: true,\n} satisfies Partial<NotificationProps>;\n\nconst varsResolver = createVarsResolver<NotificationFactory>((theme, { radius, color }) => ({\n root: {\n '--notification-radius': radius === undefined ? undefined : getRadius(radius),\n '--notification-color': color ? getThemeColor(color, theme) : undefined,\n },\n}));\n\nexport const Notification = factory<NotificationFactory>((_props) => {\n const props = useProps('Notification', defaultProps, _props);\n const {\n className,\n color,\n radius,\n loading,\n withCloseButton,\n withBorder,\n title,\n icon,\n children,\n onClose,\n closeButtonProps,\n classNames,\n style,\n styles,\n unstyled,\n vars,\n mod,\n loaderProps,\n role,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<NotificationFactory>({\n name: 'Notification',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'data-with-icon': !!icon || loading, 'data-with-border': withBorder }, mod]}\n role={role || 'alert'}\n {...others}\n >\n {icon && !loading && <div {...getStyles('icon')}>{icon}</div>}\n {loading && <Loader size={28} color={color} {...getStyles('loader')} {...loaderProps} />}\n\n <div {...getStyles('body')}>\n {title && <div {...getStyles('title')}>{title}</div>}\n\n <Box {...getStyles('description')} mod={{ 'data-with-title': !!title }}>\n {children}\n </Box>\n </div>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n color=\"gray\"\n {...closeButtonProps}\n unstyled={unstyled}\n onClick={(event) => {\n closeButtonProps?.onClick?.(event);\n onClose?.();\n }}\n {...getStyles('closeButton')}\n />\n )}\n </Box>\n );\n});\n\nNotification.classes = classes;\nNotification.varsResolver = varsResolver;\nNotification.displayName = '@mantine/core/Notification';\n\nexport namespace Notification {\n export type Props = NotificationProps;\n export type StylesNames = NotificationStylesNames;\n export type Factory = NotificationFactory;\n export type CssVariables = NotificationCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;AA2EA,MAAM,eAAe,EACnB,iBAAiB,KACnB;AAEA,MAAM,eAAe,oBAAyC,OAAO,EAAE,QAAQ,aAAa,EAC1F,MAAM;CACJ,yBAAyB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM;CAC5E,wBAAwB,QAAQ,cAAc,OAAO,KAAK,IAAI,KAAA;AAChE,EACF,EAAE;AAEF,MAAa,eAAe,SAA8B,WAAW;CACnE,MAAM,QAAQ,SAAS,gBAAgB,cAAc,MAAM;CAC3D,MAAM,EACJ,WACA,OACA,QACA,SACA,iBACA,YACA,OACA,MACA,UACA,SACA,kBACA,YACA,OACA,QACA,UACA,MACA,KACA,aACA,MACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAA+B;EAC/C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,qBAAC,KAAD;EACE,GAAI,UAAU,MAAM;EACpB,KAAK,CAAC;GAAE,kBAAkB,CAAC,CAAC,QAAQ;GAAS,oBAAoB;EAAW,GAAG,GAAG;EAClF,MAAM,QAAQ;EACd,GAAI;YAJN;GAMG,QAAQ,CAAC,WAAW,oBAAC,OAAD;IAAK,GAAI,UAAU,MAAM;cAAI;GAAU,CAAA;GAC3D,WAAW,oBAAC,QAAD;IAAQ,MAAM;IAAW;IAAO,GAAI,UAAU,QAAQ;IAAG,GAAI;GAAc,CAAA;GAEvF,qBAAC,OAAD;IAAK,GAAI,UAAU,MAAM;cAAzB,CACG,SAAS,oBAAC,OAAD;KAAK,GAAI,UAAU,OAAO;eAAI;IAAW,CAAA,GAEnD,oBAAC,KAAD;KAAK,GAAI,UAAU,aAAa;KAAG,KAAK,EAAE,mBAAmB,CAAC,CAAC,MAAM;KAClE;IACE,CAAA,CACF;;GAEJ,mBACC,oBAAC,aAAD;IACE,UAAU;IACV,OAAM;IACN,GAAI;IACM;IACV,UAAU,UAAU;KAClB,kBAAkB,UAAU,KAAK;KACjC,UAAU;IACZ;IACA,GAAI,UAAU,aAAa;GAC5B,CAAA;EAEA;;AAET,CAAC;AAED,aAAa,UAAUA;AACvB,aAAa,eAAe;AAC5B,aAAa,cAAc"}
@@ -17,6 +17,7 @@ import { jsx } from "react/jsx-runtime";
17
17
  //#region packages/@mantine/core/src/components/PasswordInput/PasswordInput.tsx
18
18
  const defaultProps = {
19
19
  visibilityToggleIcon: PasswordToggleIcon,
20
+ visibilityToggleFocusable: false,
20
21
  size: "sm"
21
22
  };
22
23
  const varsResolver = createVarsResolver((_, { size }) => ({ root: {
@@ -29,7 +30,7 @@ const PasswordInput = factory((_props) => {
29
30
  "InputWrapper",
30
31
  "PasswordInput"
31
32
  ], defaultProps, _props);
32
- const { classNames, className, style, styles, unstyled, vars, required, error, success, leftSection, disabled, id, variant, inputContainer, description, label, size, errorProps, successProps, descriptionProps, labelProps, withAsterisk, inputWrapperOrder, wrapperProps, radius, rightSection, rightSectionWidth, rightSectionPointerEvents, leftSectionWidth, visible, defaultVisible, onVisibilityChange, visibilityToggleIcon: VisibilityToggleIcon, visibilityToggleButtonProps, rightSectionProps, leftSectionProps, leftSectionPointerEvents, withErrorStyles, withSuccessStyles, mod, attributes, dir, ...others } = props;
33
+ const { classNames, className, style, styles, unstyled, vars, required, error, success, leftSection, disabled, id, variant, inputContainer, description, label, size, errorProps, successProps, descriptionProps, labelProps, withAsterisk, inputWrapperOrder, wrapperProps, radius, rightSection, rightSectionWidth, rightSectionPointerEvents, leftSectionWidth, visible, defaultVisible, onVisibilityChange, visibilityToggleIcon: VisibilityToggleIcon, visibilityToggleButtonProps, visibilityToggleFocusable, rightSectionProps, leftSectionProps, leftSectionPointerEvents, withErrorStyles, withSuccessStyles, mod, attributes, dir, ...others } = props;
33
34
  const uuid = useId(id);
34
35
  const [_visible, setVisibility] = useUncontrolled({
35
36
  value: visible,
@@ -68,7 +69,7 @@ const PasswordInput = factory((_props) => {
68
69
  disabled,
69
70
  radius,
70
71
  "aria-pressed": _visible,
71
- tabIndex: -1,
72
+ tabIndex: visibilityToggleFocusable ? 0 : -1,
72
73
  "aria-label": "Toggle password visibility",
73
74
  ...visibilityToggleButtonProps,
74
75
  variant: visibilityToggleButtonProps?.variant ?? "subtle",
@@ -86,7 +87,7 @@ const PasswordInput = factory((_props) => {
86
87
  },
87
88
  onKeyDown: (event) => {
88
89
  visibilityToggleButtonProps?.onKeyDown?.(event);
89
- if (event.key === " ") {
90
+ if (event.key === " " || event.key === "Enter") {
90
91
  event.preventDefault();
91
92
  toggleVisibility();
92
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordInput.mjs","names":["classes"],"sources":["../../../src/components/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import cx from 'clsx';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n createVarsResolver,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n getSize,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport { ActionIcon } from '../ActionIcon';\nimport { __BaseInputProps, __InputStylesNames, Input, InputVariant } from '../Input';\nimport { InputBase } from '../InputBase';\nimport { PasswordToggleIcon } from './PasswordToggleIcon';\nimport classes from './PasswordInput.module.css';\n\nexport type PasswordInputStylesNames =\n | 'root'\n | 'visibilityToggle'\n | 'innerInput'\n | __InputStylesNames;\nexport type PasswordInputCssVariables = {\n root: '--psi-icon-size' | '--psi-button-size';\n};\n\nexport interface PasswordInputProps\n extends\n BoxProps,\n Omit<__BaseInputProps, 'pointer'>,\n StylesApiProps<PasswordInputFactory>,\n ElementProps<'input', 'size'> {\n /** A component to replace the visibility toggle icon */\n visibilityToggleIcon?: React.FC<{ reveal: boolean }>;\n\n /** Props passed down to the visibility toggle button */\n visibilityToggleButtonProps?: Record<string, any>;\n\n /** If set, the input value is visible */\n visible?: boolean;\n\n /** If set, the input value is visible by default */\n defaultVisible?: boolean;\n\n /** Called when visibility changes */\n onVisibilityChange?: (visible: boolean) => void;\n}\n\nexport type PasswordInputFactory = Factory<{\n props: PasswordInputProps;\n ref: HTMLInputElement;\n stylesNames: PasswordInputStylesNames;\n vars: PasswordInputCssVariables;\n variant: InputVariant;\n}>;\n\nconst defaultProps = {\n visibilityToggleIcon: PasswordToggleIcon,\n size: 'sm',\n} satisfies Partial<PasswordInputProps>;\n\nconst varsResolver = createVarsResolver<PasswordInputFactory>((_, { size }) => ({\n root: {\n '--psi-icon-size': getSize(size, 'psi-icon-size'),\n '--psi-button-size': getSize(size, 'psi-button-size'),\n },\n}));\n\nexport const PasswordInput = factory<PasswordInputFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'PasswordInput'], defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n required,\n error,\n success,\n leftSection,\n disabled,\n id,\n variant,\n inputContainer,\n description,\n label,\n size,\n errorProps,\n successProps,\n descriptionProps,\n labelProps,\n withAsterisk,\n inputWrapperOrder,\n wrapperProps,\n radius,\n rightSection,\n rightSectionWidth,\n rightSectionPointerEvents,\n leftSectionWidth,\n visible,\n defaultVisible,\n onVisibilityChange,\n visibilityToggleIcon: VisibilityToggleIcon,\n visibilityToggleButtonProps,\n rightSectionProps,\n leftSectionProps,\n leftSectionPointerEvents,\n withErrorStyles,\n withSuccessStyles,\n mod,\n attributes,\n dir,\n ...others\n } = props;\n\n const uuid = useId(id);\n\n const [_visible, setVisibility] = useUncontrolled({\n value: visible,\n defaultValue: defaultVisible,\n finalValue: false,\n onChange: onVisibilityChange,\n });\n\n const toggleVisibility = () => setVisibility(!_visible);\n\n const getStyles = useStyles<PasswordInputFactory>({\n name: 'PasswordInput',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<PasswordInputFactory>({\n classNames,\n styles,\n props,\n });\n\n const { styleProps, rest } = extractStyleProps(others);\n const errorId = errorProps?.id || `${uuid}-error`;\n const successId = successProps?.id || `${uuid}-success`;\n const descriptionId = descriptionProps?.id || `${uuid}-description`;\n const hasError = !!error && typeof error !== 'boolean';\n const hasSuccess = !!success && typeof success !== 'boolean';\n const hasDescription = !!description;\n const _describedBy = `${hasError ? errorId : ''} ${hasSuccess && !hasError ? successId : ''} ${hasDescription ? descriptionId : ''}`;\n const describedBy = _describedBy.trim().length > 0 ? _describedBy.trim() : undefined;\n\n const visibilityToggleButton = (\n <ActionIcon<'button'>\n {...getStyles('visibilityToggle')}\n disabled={disabled}\n radius={radius}\n aria-pressed={_visible}\n tabIndex={-1}\n aria-label=\"Toggle password visibility\"\n {...visibilityToggleButtonProps}\n variant={visibilityToggleButtonProps?.variant ?? 'subtle'}\n color=\"gray\"\n unstyled={unstyled}\n onTouchEnd={(event) => {\n event.preventDefault();\n visibilityToggleButtonProps?.onTouchEnd?.(event);\n toggleVisibility();\n }}\n onMouseDown={(event) => {\n event.preventDefault();\n visibilityToggleButtonProps?.onMouseDown?.(event);\n toggleVisibility();\n }}\n onKeyDown={(event) => {\n visibilityToggleButtonProps?.onKeyDown?.(event);\n if (event.key === ' ') {\n event.preventDefault();\n toggleVisibility();\n }\n }}\n >\n <VisibilityToggleIcon reveal={_visible} />\n </ActionIcon>\n );\n\n return (\n <Input.Wrapper\n required={required}\n id={uuid}\n label={label}\n error={error}\n success={success}\n description={description}\n size={size}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n __staticSelector=\"PasswordInput\"\n __stylesApiProps={props}\n unstyled={unstyled}\n withAsterisk={withAsterisk}\n inputWrapperOrder={inputWrapperOrder}\n inputContainer={inputContainer}\n variant={variant}\n labelProps={{ ...labelProps, htmlFor: uuid }}\n descriptionProps={{ ...descriptionProps, id: descriptionId }}\n errorProps={{ ...errorProps, id: errorId }}\n successProps={{ ...successProps, id: successId }}\n mod={mod}\n attributes={attributes}\n {...getStyles('root')}\n {...styleProps}\n {...wrapperProps}\n >\n <Input\n component=\"div\"\n dir={dir}\n error={error}\n success={success}\n leftSection={leftSection}\n size={size}\n classNames={{ ...resolvedClassNames, input: cx(classes.input, resolvedClassNames?.input) }}\n styles={resolvedStyles}\n radius={radius}\n disabled={disabled}\n __staticSelector=\"PasswordInput\"\n __stylesApiProps={props}\n rightSectionWidth={rightSectionWidth}\n rightSection={rightSection ?? visibilityToggleButton}\n variant={variant}\n unstyled={unstyled}\n leftSectionWidth={leftSectionWidth}\n rightSectionPointerEvents={rightSectionPointerEvents || 'all'}\n rightSectionProps={rightSectionProps}\n leftSectionProps={leftSectionProps}\n leftSectionPointerEvents={leftSectionPointerEvents}\n withAria={false}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\n attributes={attributes}\n >\n <input\n required={required}\n data-invalid={!!error || undefined}\n data-with-left-section={!!leftSection || undefined}\n {...getStyles('innerInput')}\n disabled={disabled}\n id={uuid}\n dir={dir}\n {...rest}\n aria-describedby={describedBy}\n autoComplete={rest.autoComplete || 'off'}\n type={_visible ? 'text' : 'password'}\n />\n </Input>\n </Input.Wrapper>\n );\n});\n\nPasswordInput.classes = { ...InputBase.classes, ...classes };\nPasswordInput.varsResolver = varsResolver;\nPasswordInput.displayName = '@mantine/core/PasswordInput';\n\nexport namespace PasswordInput {\n export type Props = PasswordInputProps;\n export type StylesNames = PasswordInputStylesNames;\n export type CssVariables = PasswordInputCssVariables;\n export type Factory = PasswordInputFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4DA,MAAM,eAAe;CACnB,sBAAsB;CACtB,MAAM;AACR;AAEA,MAAM,eAAe,oBAA0C,GAAG,EAAE,YAAY,EAC9E,MAAM;CACJ,mBAAmB,QAAQ,MAAM,eAAe;CAChD,qBAAqB,QAAQ,MAAM,iBAAiB;AACtD,EACF,EAAE;AAEF,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAe,GAAG,cAAc,MAAM;CACvF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,OACA,SACA,aACA,UACA,IACA,SACA,gBACA,aACA,OACA,MACA,YACA,cACA,kBACA,YACA,cACA,mBACA,cACA,QACA,cACA,mBACA,2BACA,kBACA,SACA,gBACA,oBACA,sBAAsB,sBACtB,6BACA,mBACA,kBACA,0BACA,iBACA,mBACA,KACA,YACA,KACA,GAAG,WACD;CAEJ,MAAM,OAAO,MAAM,EAAE;CAErB,MAAM,CAAC,UAAU,iBAAiB,gBAAgB;EAChD,OAAO;EACP,cAAc;EACd,YAAY;EACZ,UAAU;CACZ,CAAC;CAED,MAAM,yBAAyB,cAAc,CAAC,QAAQ;CAEtD,MAAM,YAAY,UAAgC;EAChD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,oBAAoB,mBAAmB,qBAA2C;EACxF;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,YAAY,SAAS,kBAAkB,MAAM;CACrD,MAAM,UAAU,YAAY,MAAM,GAAG,KAAK;CAC1C,MAAM,YAAY,cAAc,M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AAD;GACE,WAAU;GACL;GACE;GACE;GACI;GACP;GACN,YAAY;IAAE,GAAG;IAAoB,OAAO,GAAGA,6BAAQ,OAAO,oBAAoB,KAAK;GAAE;GACzF,QAAQ;GACA;GACE;GACV,kBAAiB;GACjB,kBAAkB;GACC;GACnB,cAAc,gBAAgB;GACrB;GACC;GACQ;GAClB,2BAA2B,6BAA6B;GACrC;GACD;GACQ;GAC1B,UAAU;GACO;GACE;GACP;aAEZ,oBAAC,SAAD;IACY;IACV,gBAAc,CAAC,CAAC,SAAS,KAAA;IACzB,0BAAwB,CAAC,CAAC,eAAe,KAAA;IACzC,GAAI,UAAU,YAAY;IAChB;IACV,IAAI;IACC;IACL,GAAI;IACJ,oBAAkB;IAClB,cAAc,KAAK,gBAAgB;IACnC,MAAM,WAAW,SAAS;GAC3B,CAAA;EACI,CAAA;CACM,CAAA;AAEnB,CAAC;AAED,cAAc,UAAU;CAAE,GAAG,UAAU;CAAS,GAAGA;AAAQ;AAC3D,cAAc,eAAe;AAC7B,cAAc,cAAc"}
1
+ {"version":3,"file":"PasswordInput.mjs","names":["classes"],"sources":["../../../src/components/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import cx from 'clsx';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n createVarsResolver,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n getSize,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport { ActionIcon } from '../ActionIcon';\nimport { __BaseInputProps, __InputStylesNames, Input, InputVariant } from '../Input';\nimport { InputBase } from '../InputBase';\nimport { PasswordToggleIcon } from './PasswordToggleIcon';\nimport classes from './PasswordInput.module.css';\n\nexport type PasswordInputStylesNames =\n | 'root'\n | 'visibilityToggle'\n | 'innerInput'\n | __InputStylesNames;\nexport type PasswordInputCssVariables = {\n root: '--psi-icon-size' | '--psi-button-size';\n};\n\nexport interface PasswordInputProps\n extends\n BoxProps,\n Omit<__BaseInputProps, 'pointer'>,\n StylesApiProps<PasswordInputFactory>,\n ElementProps<'input', 'size'> {\n /** A component to replace the visibility toggle icon */\n visibilityToggleIcon?: React.FC<{ reveal: boolean }>;\n\n /** Props passed down to the visibility toggle button */\n visibilityToggleButtonProps?: Record<string, any>;\n\n /** If set, the visibility toggle button is focusable with keyboard @default `false` */\n visibilityToggleFocusable?: boolean;\n\n /** If set, the input value is visible */\n visible?: boolean;\n\n /** If set, the input value is visible by default */\n defaultVisible?: boolean;\n\n /** Called when visibility changes */\n onVisibilityChange?: (visible: boolean) => void;\n}\n\nexport type PasswordInputFactory = Factory<{\n props: PasswordInputProps;\n ref: HTMLInputElement;\n stylesNames: PasswordInputStylesNames;\n vars: PasswordInputCssVariables;\n variant: InputVariant;\n}>;\n\nconst defaultProps = {\n visibilityToggleIcon: PasswordToggleIcon,\n visibilityToggleFocusable: false,\n size: 'sm',\n} satisfies Partial<PasswordInputProps>;\n\nconst varsResolver = createVarsResolver<PasswordInputFactory>((_, { size }) => ({\n root: {\n '--psi-icon-size': getSize(size, 'psi-icon-size'),\n '--psi-button-size': getSize(size, 'psi-button-size'),\n },\n}));\n\nexport const PasswordInput = factory<PasswordInputFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'PasswordInput'], defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n required,\n error,\n success,\n leftSection,\n disabled,\n id,\n variant,\n inputContainer,\n description,\n label,\n size,\n errorProps,\n successProps,\n descriptionProps,\n labelProps,\n withAsterisk,\n inputWrapperOrder,\n wrapperProps,\n radius,\n rightSection,\n rightSectionWidth,\n rightSectionPointerEvents,\n leftSectionWidth,\n visible,\n defaultVisible,\n onVisibilityChange,\n visibilityToggleIcon: VisibilityToggleIcon,\n visibilityToggleButtonProps,\n visibilityToggleFocusable,\n rightSectionProps,\n leftSectionProps,\n leftSectionPointerEvents,\n withErrorStyles,\n withSuccessStyles,\n mod,\n attributes,\n dir,\n ...others\n } = props;\n\n const uuid = useId(id);\n\n const [_visible, setVisibility] = useUncontrolled({\n value: visible,\n defaultValue: defaultVisible,\n finalValue: false,\n onChange: onVisibilityChange,\n });\n\n const toggleVisibility = () => setVisibility(!_visible);\n\n const getStyles = useStyles<PasswordInputFactory>({\n name: 'PasswordInput',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<PasswordInputFactory>({\n classNames,\n styles,\n props,\n });\n\n const { styleProps, rest } = extractStyleProps(others);\n const errorId = errorProps?.id || `${uuid}-error`;\n const successId = successProps?.id || `${uuid}-success`;\n const descriptionId = descriptionProps?.id || `${uuid}-description`;\n const hasError = !!error && typeof error !== 'boolean';\n const hasSuccess = !!success && typeof success !== 'boolean';\n const hasDescription = !!description;\n const _describedBy = `${hasError ? errorId : ''} ${hasSuccess && !hasError ? successId : ''} ${hasDescription ? descriptionId : ''}`;\n const describedBy = _describedBy.trim().length > 0 ? _describedBy.trim() : undefined;\n\n const visibilityToggleButton = (\n <ActionIcon<'button'>\n {...getStyles('visibilityToggle')}\n disabled={disabled}\n radius={radius}\n aria-pressed={_visible}\n tabIndex={visibilityToggleFocusable ? 0 : -1}\n aria-label=\"Toggle password visibility\"\n {...visibilityToggleButtonProps}\n variant={visibilityToggleButtonProps?.variant ?? 'subtle'}\n color=\"gray\"\n unstyled={unstyled}\n onTouchEnd={(event) => {\n event.preventDefault();\n visibilityToggleButtonProps?.onTouchEnd?.(event);\n toggleVisibility();\n }}\n onMouseDown={(event) => {\n event.preventDefault();\n visibilityToggleButtonProps?.onMouseDown?.(event);\n toggleVisibility();\n }}\n onKeyDown={(event) => {\n visibilityToggleButtonProps?.onKeyDown?.(event);\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n toggleVisibility();\n }\n }}\n >\n <VisibilityToggleIcon reveal={_visible} />\n </ActionIcon>\n );\n\n return (\n <Input.Wrapper\n required={required}\n id={uuid}\n label={label}\n error={error}\n success={success}\n description={description}\n size={size}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n __staticSelector=\"PasswordInput\"\n __stylesApiProps={props}\n unstyled={unstyled}\n withAsterisk={withAsterisk}\n inputWrapperOrder={inputWrapperOrder}\n inputContainer={inputContainer}\n variant={variant}\n labelProps={{ ...labelProps, htmlFor: uuid }}\n descriptionProps={{ ...descriptionProps, id: descriptionId }}\n errorProps={{ ...errorProps, id: errorId }}\n successProps={{ ...successProps, id: successId }}\n mod={mod}\n attributes={attributes}\n {...getStyles('root')}\n {...styleProps}\n {...wrapperProps}\n >\n <Input\n component=\"div\"\n dir={dir}\n error={error}\n success={success}\n leftSection={leftSection}\n size={size}\n classNames={{ ...resolvedClassNames, input: cx(classes.input, resolvedClassNames?.input) }}\n styles={resolvedStyles}\n radius={radius}\n disabled={disabled}\n __staticSelector=\"PasswordInput\"\n __stylesApiProps={props}\n rightSectionWidth={rightSectionWidth}\n rightSection={rightSection ?? visibilityToggleButton}\n variant={variant}\n unstyled={unstyled}\n leftSectionWidth={leftSectionWidth}\n rightSectionPointerEvents={rightSectionPointerEvents || 'all'}\n rightSectionProps={rightSectionProps}\n leftSectionProps={leftSectionProps}\n leftSectionPointerEvents={leftSectionPointerEvents}\n withAria={false}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\n attributes={attributes}\n >\n <input\n required={required}\n data-invalid={!!error || undefined}\n data-with-left-section={!!leftSection || undefined}\n {...getStyles('innerInput')}\n disabled={disabled}\n id={uuid}\n dir={dir}\n {...rest}\n aria-describedby={describedBy}\n autoComplete={rest.autoComplete || 'off'}\n type={_visible ? 'text' : 'password'}\n />\n </Input>\n </Input.Wrapper>\n );\n});\n\nPasswordInput.classes = { ...InputBase.classes, ...classes };\nPasswordInput.varsResolver = varsResolver;\nPasswordInput.displayName = '@mantine/core/PasswordInput';\n\nexport namespace PasswordInput {\n export type Props = PasswordInputProps;\n export type StylesNames = PasswordInputStylesNames;\n export type CssVariables = PasswordInputCssVariables;\n export type Factory = PasswordInputFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA+DA,MAAM,eAAe;CACnB,sBAAsB;CACtB,2BAA2B;CAC3B,MAAM;AACR;AAEA,MAAM,eAAe,oBAA0C,GAAG,EAAE,YAAY,EAC9E,MAAM;CACJ,mBAAmB,QAAQ,MAAM,eAAe;CAChD,qBAAqB,QAAQ,MAAM,iBAAiB;AACtD,EACF,EAAE;AAEF,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAe,GAAG,cAAc,MAAM;CACvF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,OACA,SACA,aACA,UACA,IACA,SACA,gBACA,aACA,OACA,MACA,YACA,cACA,kBACA,YACA,cACA,mBACA,cACA,QACA,cACA,mBACA,2BACA,kBACA,SACA,gBACA,oBACA,sBAAsB,sBACtB,6BACA,2BACA,mBACA,kBACA,0BACA,iBACA,mBACA,KACA,YACA,KACA,GAAG,WACD;CAEJ,MAAM,OAAO,MAAM,EAAE;CAErB,MAAM,CAAC,UAAU,iBAAiB,gBAAgB;EAChD,OAAO;EACP,cAAc;EACd,YAAY;EACZ,UAAU;CACZ,CAAC;CAED,MAAM,yBAAyB,cAAc,CAAC,QAAQ;CAEtD,MAAM,YAAY,UAAgC;EAChD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,oBAAoB,mBAAmB,qBAA2C;EACxF;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,YAAY,SAAS,kBAAkB,MAAM;CACrD,MAAM,UAAU,YAAY,MAAM,GAAG,KAAK;CAC1C,MAAM,YAAY,cAAc,MAAM,GAAG,KAAK;CAC9C,MAAM,gBAAgB,kBAAkB,MAAM,GAAG,KAAK;CACtD,MAAM,WAAW,CAAC,CAAC,SAAS,OAAO,UAAU;CAG7C,MAAM,eAAe,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O,oBAAoB,KAAK;GAAE;GACzF,QAAQ;GACA;GACE;GACV,kBAAiB;GACjB,kBAAkB;GACC;GACnB,cAAc,gBAAgB;GACrB;GACC;GACQ;GAClB,2BAA2B,6BAA6B;GACrC;GACD;GACQ;GAC1B,UAAU;GACO;GACE;GACP;aAEZ,oBAAC,SAAD;IACY;IACV,gBAAc,CAAC,CAAC,SAAS,KAAA;IACzB,0BAAwB,CAAC,CAAC,eAAe,KAAA;IACzC,GAAI,UAAU,YAAY;IAChB;IACV,IAAI;IACC;IACL,GAAI;IACJ,oBAAkB;IAClB,cAAc,KAAK,gBAAgB;IACnC,MAAM,WAAW,SAAS;GAC3B,CAAA;EACI,CAAA;CACM,CAAA;AAEnB,CAAC;AAED,cAAc,UAAU;CAAE,GAAG,UAAU;CAAS,GAAGA;AAAQ;AAC3D,cAAc,eAAe;AAC7B,cAAc,cAAc"}
@@ -10,7 +10,7 @@ import { DigitColumn } from "./DigitColumn.mjs";
10
10
  import { getRenderSlots } from "./get-render-slots.mjs";
11
11
  import RollingNumber_module_default from "./RollingNumber.module.mjs";
12
12
  import { useEffect, useRef } from "react";
13
- import { jsx } from "react/jsx-runtime";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
14
  //#region packages/@mantine/core/src/components/RollingNumber/RollingNumber.tsx
15
15
  const defaultProps = {
16
16
  animationDuration: 600,
@@ -69,13 +69,17 @@ const RollingNumber = factory((_props) => {
69
69
  decimalScale,
70
70
  fixedDecimalScale
71
71
  });
72
- return /* @__PURE__ */ jsx(Box, {
72
+ return /* @__PURE__ */ jsxs(Box, {
73
73
  ...getStyles("root"),
74
74
  mod: [{ "tabular-numbers": tabularNumbers }, mod],
75
75
  role: withLiveRegion ? "status" : "img",
76
76
  "aria-label": accessibleValue,
77
77
  ...others,
78
- children: slots.map((slot) => {
78
+ children: [/* @__PURE__ */ jsx("span", {
79
+ ...getStyles("copyValue"),
80
+ "aria-hidden": "true",
81
+ children: accessibleValue
82
+ }), slots.map((slot) => {
79
83
  if (slot.type === "digit") return /* @__PURE__ */ jsx(DigitColumn, {
80
84
  digit: slot.digit,
81
85
  previousDigit: slot.previousDigit,
@@ -89,7 +93,7 @@ const RollingNumber = factory((_props) => {
89
93
  "aria-hidden": "true",
90
94
  children: slot.char
91
95
  }, slot.key);
92
- })
96
+ })]
93
97
  });
94
98
  });
95
99
  RollingNumber.classes = RollingNumber_module_default;
@@ -1 +1 @@
1
- {"version":3,"file":"RollingNumber.mjs","names":["classes"],"sources":["../../../src/components/RollingNumber/RollingNumber.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { buildValue } from './build-value';\nimport { DigitColumn } from './DigitColumn';\nimport { getDigitParts } from './get-digit-parts';\nimport { getRenderSlots } from './get-render-slots';\nimport classes from './RollingNumber.module.css';\n\nexport type RollingNumberStylesNames = 'root' | 'digit' | 'digitColumn' | 'char';\nexport type RollingNumberCssVariables = {\n root: '--rn-duration' | '--rn-timing-function';\n};\n\nexport interface RollingNumberProps\n extends BoxProps, StylesApiProps<RollingNumberFactory>, ElementProps<'div'> {\n /** Number value to display */\n value: number;\n\n /** Prefix added before the value */\n prefix?: string;\n\n /** Suffix added after the value */\n suffix?: string;\n\n /** Character used as a decimal separator @default '.' */\n decimalSeparator?: string;\n\n /** Character used to separate thousands, set to `true` for `,` @default false */\n thousandSeparator?: string | boolean;\n\n /** Number of decimal places to display */\n decimalScale?: number;\n\n /** If set, trailing zeros are added to match `decimalScale` @default false */\n fixedDecimalScale?: boolean;\n\n /** Animation duration in milliseconds @default 600 */\n animationDuration?: number;\n\n /** CSS timing function for animation @default 'ease' */\n timingFunction?: string;\n\n /** If set, use tabular (monospace) numbers @default true */\n tabularNumbers?: boolean;\n\n /** If set, the root element acts as an `aria-live=\"polite\"` region (`role=\"status\"`) and screen readers announce every value change. When `false`, the root uses `role=\"img\"` so the current value is still accessible but updates are not announced. @default false */\n withLiveRegion?: boolean;\n}\n\nexport type RollingNumberFactory = Factory<{\n props: RollingNumberProps;\n ref: HTMLDivElement;\n stylesNames: RollingNumberStylesNames;\n vars: RollingNumberCssVariables;\n}>;\n\nconst defaultProps = {\n animationDuration: 600,\n timingFunction: 'ease',\n decimalSeparator: '.',\n tabularNumbers: true,\n} satisfies Partial<RollingNumberProps>;\n\nconst varsResolver = createVarsResolver<RollingNumberFactory>(\n (_, { animationDuration, timingFunction }) => ({\n root: {\n '--rn-duration': `${animationDuration}ms`,\n '--rn-timing-function': timingFunction,\n },\n })\n);\n\nexport const RollingNumber = factory<RollingNumberFactory>((_props) => {\n const props = useProps('RollingNumber', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n animationDuration,\n timingFunction,\n tabularNumbers,\n withLiveRegion,\n mod,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RollingNumberFactory>({\n name: 'RollingNumber',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const previousValueRef = useRef(value);\n const previousValue = previousValueRef.current;\n\n useEffect(() => {\n previousValueRef.current = value;\n });\n\n const valueDirection: 'up' | 'down' = value >= previousValue ? 'up' : 'down';\n\n const current = getDigitParts({ value, decimalScale, fixedDecimalScale });\n const prev = getDigitParts({ value: previousValue, decimalScale, fixedDecimalScale });\n\n const slots = getRenderSlots({\n current,\n previous: prev,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n });\n\n const accessibleValue = buildValue({\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'tabular-numbers': tabularNumbers }, mod]}\n role={withLiveRegion ? 'status' : 'img'}\n aria-label={accessibleValue}\n {...others}\n >\n {slots.map((slot) => {\n if (slot.type === 'digit') {\n return (\n <DigitColumn\n key={slot.key}\n digit={slot.digit}\n previousDigit={slot.previousDigit}\n getStyles={getStyles}\n empty={slot.empty}\n valueDirection={valueDirection}\n />\n );\n }\n\n return (\n <span\n key={slot.key}\n {...getStyles('char')}\n data-empty={slot.empty || undefined}\n aria-hidden=\"true\"\n >\n {slot.char}\n </span>\n );\n })}\n </Box>\n );\n});\n\nRollingNumber.classes = classes;\nRollingNumber.varsResolver = varsResolver;\nRollingNumber.displayName = '@mantine/core/RollingNumber';\n"],"mappings":";;;;;;;;;;;;;;AAkEA,MAAM,eAAe;CACnB,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB,gBAAgB;AAClB;AAEA,MAAM,eAAe,oBAClB,GAAG,EAAE,mBAAmB,sBAAsB,EAC7C,MAAM;CACJ,iBAAiB,GAAG,kBAAkB;CACtC,wBAAwB;AAC1B,EACF,EACF;AAEA,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,MAAM;CAC5D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,OACA,QACA,QACA,kBACA,mBACA,cACA,mBACA,mBACA,gBACA,gBACA,gBACA,KACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAgC;EAChD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,mBAAmB,OAAO,KAAK;CACrC,MAAM,gBAAgB,iBAAiB;CAEvC,gBAAgB;EACd,iBAAiB,UAAU;CAC7B,CAAC;CAED,MAAM,iBAAgC,SAAS,gBAAgB,OAAO;CAKtE,MAAM,QAAQ,eAAe;EAC3B,SAJc,cAAc;GAAE;GAAO;GAAc;EAAkB,CAI/D;EACN,UAJW,cAAc;GAAE,OAAO;GAAe;GAAc;EAAkB,CAIpE;EACb;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,kBAAkB,WAAW;EACjC;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,KAAD;EACE,GAAI,UAAU,MAAM;EACpB,KAAK,CAAC,EAAE,mBAAmB,eAAe,GAAG,GAAG;EAChD,MAAM,iBAAiB,WAAW;EAClC,cAAY;EACZ,GAAI;YAEH,MAAM,KAAK,SAAS;GACnB,IAAI,KAAK,SAAS,SAChB,OACE,oBAAC,aAAD;IAEE,OAAO,KAAK;IACZ,eAAe,KAAK;IACT;IACX,OAAO,KAAK;IACI;GACjB,GANM,KAAK,GAMX;GAIL,OACE,oBAAC,QAAD;IAEE,GAAI,UAAU,MAAM;IACpB,cAAY,KAAK,SAAS,KAAA;IAC1B,eAAY;cAEX,KAAK;GACF,GANC,KAAK,GAMN;EAEV,CAAC;CACE,CAAA;AAET,CAAC;AAED,cAAc,UAAUA;AACxB,cAAc,eAAe;AAC7B,cAAc,cAAc"}
1
+ {"version":3,"file":"RollingNumber.mjs","names":["classes"],"sources":["../../../src/components/RollingNumber/RollingNumber.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { buildValue } from './build-value';\nimport { DigitColumn } from './DigitColumn';\nimport { getDigitParts } from './get-digit-parts';\nimport { getRenderSlots } from './get-render-slots';\nimport classes from './RollingNumber.module.css';\n\nexport type RollingNumberStylesNames = 'root' | 'copyValue' | 'digit' | 'digitColumn' | 'char';\nexport type RollingNumberCssVariables = {\n root: '--rn-duration' | '--rn-timing-function';\n};\n\nexport interface RollingNumberProps\n extends BoxProps, StylesApiProps<RollingNumberFactory>, ElementProps<'div'> {\n /** Number value to display */\n value: number;\n\n /** Prefix added before the value */\n prefix?: string;\n\n /** Suffix added after the value */\n suffix?: string;\n\n /** Character used as a decimal separator @default '.' */\n decimalSeparator?: string;\n\n /** Character used to separate thousands, set to `true` for `,` @default false */\n thousandSeparator?: string | boolean;\n\n /** Number of decimal places to display */\n decimalScale?: number;\n\n /** If set, trailing zeros are added to match `decimalScale` @default false */\n fixedDecimalScale?: boolean;\n\n /** Animation duration in milliseconds @default 600 */\n animationDuration?: number;\n\n /** CSS timing function for animation @default 'ease' */\n timingFunction?: string;\n\n /** If set, use tabular (monospace) numbers @default true */\n tabularNumbers?: boolean;\n\n /** If set, the root element acts as an `aria-live=\"polite\"` region (`role=\"status\"`) and screen readers announce every value change. When `false`, the root uses `role=\"img\"` so the current value is still accessible but updates are not announced. @default false */\n withLiveRegion?: boolean;\n}\n\nexport type RollingNumberFactory = Factory<{\n props: RollingNumberProps;\n ref: HTMLDivElement;\n stylesNames: RollingNumberStylesNames;\n vars: RollingNumberCssVariables;\n}>;\n\nconst defaultProps = {\n animationDuration: 600,\n timingFunction: 'ease',\n decimalSeparator: '.',\n tabularNumbers: true,\n} satisfies Partial<RollingNumberProps>;\n\nconst varsResolver = createVarsResolver<RollingNumberFactory>(\n (_, { animationDuration, timingFunction }) => ({\n root: {\n '--rn-duration': `${animationDuration}ms`,\n '--rn-timing-function': timingFunction,\n },\n })\n);\n\nexport const RollingNumber = factory<RollingNumberFactory>((_props) => {\n const props = useProps('RollingNumber', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n animationDuration,\n timingFunction,\n tabularNumbers,\n withLiveRegion,\n mod,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RollingNumberFactory>({\n name: 'RollingNumber',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const previousValueRef = useRef(value);\n const previousValue = previousValueRef.current;\n\n useEffect(() => {\n previousValueRef.current = value;\n });\n\n const valueDirection: 'up' | 'down' = value >= previousValue ? 'up' : 'down';\n\n const current = getDigitParts({ value, decimalScale, fixedDecimalScale });\n const prev = getDigitParts({ value: previousValue, decimalScale, fixedDecimalScale });\n\n const slots = getRenderSlots({\n current,\n previous: prev,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n });\n\n const accessibleValue = buildValue({\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'tabular-numbers': tabularNumbers }, mod]}\n role={withLiveRegion ? 'status' : 'img'}\n aria-label={accessibleValue}\n {...others}\n >\n <span {...getStyles('copyValue')} aria-hidden=\"true\">\n {accessibleValue}\n </span>\n {slots.map((slot) => {\n if (slot.type === 'digit') {\n return (\n <DigitColumn\n key={slot.key}\n digit={slot.digit}\n previousDigit={slot.previousDigit}\n getStyles={getStyles}\n empty={slot.empty}\n valueDirection={valueDirection}\n />\n );\n }\n\n return (\n <span\n key={slot.key}\n {...getStyles('char')}\n data-empty={slot.empty || undefined}\n aria-hidden=\"true\"\n >\n {slot.char}\n </span>\n );\n })}\n </Box>\n );\n});\n\nRollingNumber.classes = classes;\nRollingNumber.varsResolver = varsResolver;\nRollingNumber.displayName = '@mantine/core/RollingNumber';\n"],"mappings":";;;;;;;;;;;;;;AAkEA,MAAM,eAAe;CACnB,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB,gBAAgB;AAClB;AAEA,MAAM,eAAe,oBAClB,GAAG,EAAE,mBAAmB,sBAAsB,EAC7C,MAAM;CACJ,iBAAiB,GAAG,kBAAkB;CACtC,wBAAwB;AAC1B,EACF,EACF;AAEA,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,MAAM;CAC5D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,OACA,QACA,QACA,kBACA,mBACA,cACA,mBACA,mBACA,gBACA,gBACA,gBACA,KACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAgC;EAChD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,mBAAmB,OAAO,KAAK;CACrC,MAAM,gBAAgB,iBAAiB;CAEvC,gBAAgB;EACd,iBAAiB,UAAU;CAC7B,CAAC;CAED,MAAM,iBAAgC,SAAS,gBAAgB,OAAO;CAKtE,MAAM,QAAQ,eAAe;EAC3B,SAJc,cAAc;GAAE;GAAO;GAAc;EAAkB,CAI/D;EACN,UAJW,cAAc;GAAE,OAAO;GAAe;GAAc;EAAkB,CAIpE;EACb;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,kBAAkB,WAAW;EACjC;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,qBAAC,KAAD;EACE,GAAI,UAAU,MAAM;EACpB,KAAK,CAAC,EAAE,mBAAmB,eAAe,GAAG,GAAG;EAChD,MAAM,iBAAiB,WAAW;EAClC,cAAY;EACZ,GAAI;YALN,CAOE,oBAAC,QAAD;GAAM,GAAI,UAAU,WAAW;GAAG,eAAY;aAC3C;EACG,CAAA,GACL,MAAM,KAAK,SAAS;GACnB,IAAI,KAAK,SAAS,SAChB,OACE,oBAAC,aAAD;IAEE,OAAO,KAAK;IACZ,eAAe,KAAK;IACT;IACX,OAAO,KAAK;IACI;GACjB,GANM,KAAK,GAMX;GAIL,OACE,oBAAC,QAAD;IAEE,GAAI,UAAU,MAAM;IACpB,cAAY,KAAK,SAAS,KAAA;IAC1B,eAAY;cAEX,KAAK;GACF,GANC,KAAK,GAMN;EAEV,CAAC,CACE;;AAET,CAAC;AAED,cAAc,UAAUA;AACxB,cAAc,eAAe;AAC7B,cAAc,cAAc"}
@@ -2,6 +2,7 @@
2
2
  //#region packages/@mantine/core/src/components/RollingNumber/RollingNumber.module.css
3
3
  var RollingNumber_module_default = {
4
4
  "root": "m_47dd3981",
5
+ "copyValue": "m_ccf525bd",
5
6
  "digit": "m_b301d46e",
6
7
  "digitColumn": "m_8ae40964",
7
8
  "mantine-rolling-number-roll": "m_18d73873",
@@ -1 +1 @@
1
- {"version":3,"file":"RollingNumber.module.mjs","names":[],"sources":["../../../src/components/RollingNumber/RollingNumber.module.css"],"sourcesContent":[".root {\n display: inline-flex;\n align-items: baseline;\n overflow: hidden;\n\n &[data-tabular-numbers] {\n font-variant-numeric: tabular-nums;\n }\n}\n\n.digit {\n display: inline-block;\n width: 1ch;\n height: 1em;\n overflow: hidden;\n line-height: 1;\n transition:\n width var(--rn-duration) var(--rn-timing-function),\n opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n.digitColumn {\n display: flex;\n flex-direction: column;\n animation: mantine-rolling-number-roll var(--rn-duration) var(--rn-timing-function);\n\n & > span {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 1em;\n }\n}\n\n.char {\n display: inline-block;\n overflow: hidden;\n white-space: pre;\n transition: opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n@keyframes mantine-rolling-number-roll {\n from {\n transform: var(--rn-roll-from);\n }\n\n to {\n transform: var(--rn-roll-to);\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"RollingNumber.module.mjs","names":[],"sources":["../../../src/components/RollingNumber/RollingNumber.module.css"],"sourcesContent":[".root {\n position: relative;\n display: inline-flex;\n align-items: baseline;\n overflow: hidden;\n\n &[data-tabular-numbers] {\n font-variant-numeric: tabular-nums;\n }\n}\n\n.copyValue {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n white-space: pre;\n color: transparent;\n forced-color-adjust: none;\n}\n\n.digit {\n position: relative;\n z-index: 2;\n display: inline-block;\n width: 1ch;\n height: 1em;\n overflow: hidden;\n line-height: 1;\n pointer-events: none;\n user-select: none;\n -webkit-user-select: none;\n transition:\n width var(--rn-duration) var(--rn-timing-function),\n opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n.digitColumn {\n display: flex;\n flex-direction: column;\n animation: mantine-rolling-number-roll var(--rn-duration) var(--rn-timing-function);\n\n & > span {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 1em;\n }\n}\n\n.char {\n position: relative;\n z-index: 2;\n display: inline-block;\n overflow: hidden;\n white-space: pre;\n pointer-events: none;\n user-select: none;\n -webkit-user-select: none;\n transition: opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n@keyframes mantine-rolling-number-roll {\n from {\n transform: var(--rn-roll-from);\n }\n\n to {\n transform: var(--rn-roll-to);\n }\n}\n"],"mappings":""}
@@ -8,6 +8,8 @@ import { getOptionsLockup } from "../Combobox/get-options-lockup/get-options-loc
8
8
  import { useCombobox } from "../Combobox/use-combobox/use-combobox.mjs";
9
9
  import { Combobox } from "../Combobox/Combobox.mjs";
10
10
  import { OptionsDropdown } from "../Combobox/OptionsDropdown/OptionsDropdown.mjs";
11
+ import { isExternalInputChange } from "../Combobox/is-external-input-change/is-external-input-change.mjs";
12
+ import { getOptionByLabel } from "../Combobox/get-options-lockup/get-option-by-label.mjs";
11
13
  import { useEffect, useMemo, useRef } from "react";
12
14
  import { useId as useId$1, usePrevious, useUncontrolled } from "@mantine/hooks";
13
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -134,6 +136,16 @@ const Select = genericFactory((_props) => {
134
136
  readOnly: readOnly || !searchable,
135
137
  value: search,
136
138
  onChange: (event) => {
139
+ if (isExternalInputChange(event)) {
140
+ if (!readOnly) {
141
+ const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);
142
+ if (externalOption && `${externalOption.value}` !== `${_value}`) {
143
+ setValue(externalOption.value, externalOption);
144
+ !controlled && handleSearchChange(externalOption.label);
145
+ }
146
+ }
147
+ return;
148
+ }
137
149
  handleSearchChange(event.currentTarget.value);
138
150
  combobox.openDropdown();
139
151
  selectFirstOptionOnChange && combobox.selectFirstOption();
@@ -1 +1 @@
1
- {"version":3,"file":"Select.mjs","names":["useId"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Allows deselecting the selected option by clicking it @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem<Value>>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Select'], defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && _value != null && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n floatingHeight={floatingHeight}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\n >\n <InputBase\n id={_id}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n\nexport namespace Select {\n export type Props<Value extends Primitive = string> = SelectProps<Value>;\n export type StylesNames = SelectStylesNames;\n export type Factory = SelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;AACf;AAEA,MAAa,SAAS,gBAA+B,WAAW;CAC9D,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAQ,GAAG,cAAc,MAAM;CAChF,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,gBACA,MACA,YACA,cACA,mBACA,eACA,mBACA,qBACA,MACA,MACA,aACA,oBACA,gBACA,eACA,OACA,2BACA,IACA,WACA,kBACA,kBACA,kBACA,cACA,SACA,cACA,iBACA,uBACA,gBACA,aACA,cACA,kBACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,aAAa,cAAc,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;CACpE,MAAM,0BAA0B,OAAgD,CAAC,CAAC;CAClF,MAAM,gBAAgB,cAAc,iBAAiB,UAAU,GAAG,CAAC,UAAU,CAAC;CAC9E,MAAM,MAAMA,QAAM,EAAE;CAEpB,MAAM,CAAC,QAAQ,UAAU,cAAc,gBAAgB;EACrD;EACA;EACA,YAAY;EACZ;CACF,CAAC;CAED,MAAM,iBACJ,UAAU,OACN,GAAG,YAAY,gBACb,cAAc,GAAG,YACjB,wBAAwB,QAAQ,GAAG,YACrC,KAAA;CACN,MAAM,yBAAyB,YAAY,cAAc;CAEzD,MAAM,CAAC,QAAQ,WAAW,oBAAoB,gBAAgB;EAC5D,OAAO;EACP,cAAc;EACd,YAAY,iBAAiB,eAAe,QAAQ;EACpD,UAAU;CACZ,CAAC;CAED,MAAM,WAAW,YAAY;EAC3B,QAAQ;EAC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ACb,CAAA;EACc,CAAA,GACjB,oBAAC,iBAAD;GACE,MAAM;GACN,QAAQ,YAAY;GACZ;GACA;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe,CAAC,CAAC,cAAc,gBAAgB,UAAU;GACzD,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,OAAO,QAAQ,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;EAClB,CAAA,CACO;KACV,oBAAC,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,OAAO,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AAC7D,OAAO,cAAc"}
1
+ {"version":3,"file":"Select.mjs","names":["useId"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { getOptionByLabel } from '../Combobox/get-options-lockup/get-option-by-label';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Allows deselecting the selected option by clicking it @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem<Value>>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Select'], defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && _value != null && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n floatingHeight={floatingHeight}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\n >\n <InputBase\n id={_id}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n if (!readOnly) {\n const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);\n\n if (externalOption && `${externalOption.value}` !== `${_value}`) {\n setValue(externalOption.value as any, externalOption);\n !controlled && handleSearchChange(externalOption.label);\n }\n }\n\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n\nexport namespace Select {\n export type Props<Value extends Primitive = string> = SelectProps<Value>;\n export type StylesNames = SelectStylesNames;\n export type Factory = SelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyHA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;AACf;AAEA,MAAa,SAAS,gBAA+B,WAAW;CAC9D,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAQ,GAAG,cAAc,MAAM;CAChF,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,gBACA,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,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;EAClB,CAAA,CACO;KACV,oBAAC,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,OAAO,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AAC7D,OAAO,cAAc"}
@@ -11,6 +11,7 @@ import { useCombobox } from "../Combobox/use-combobox/use-combobox.mjs";
11
11
  import { Combobox } from "../Combobox/Combobox.mjs";
12
12
  import { OptionsDropdown } from "../Combobox/OptionsDropdown/OptionsDropdown.mjs";
13
13
  import { usePillsReorder } from "../Combobox/use-pills-reorder/use-pills-reorder.mjs";
14
+ import { isExternalInputChange } from "../Combobox/is-external-input-change/is-external-input-change.mjs";
14
15
  import { Pill } from "../Pill/Pill.mjs";
15
16
  import { PillsInput } from "../PillsInput/PillsInput.mjs";
16
17
  import { filterPickedTags } from "./filter-picked-tags.mjs";
@@ -285,7 +286,10 @@ const TagsInput = factory((_props) => {
285
286
  },
286
287
  onPaste: handlePaste,
287
288
  value: _searchValue,
288
- onChange: (event) => handleSearchChange(event.currentTarget.value),
289
+ onChange: (event) => {
290
+ if (isExternalInputChange(event)) return;
291
+ handleSearchChange(event.currentTarget.value);
292
+ },
289
293
  required: required && _value.length === 0,
290
294
  disabled,
291
295
  readOnly,