@yamada-ui/react 2.3.0-dev-20261024165228 → 2.3.0-dev-20261025045056

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 (124) hide show
  1. package/dist/cjs/components/accordion/use-accordion.cjs +4 -5
  2. package/dist/cjs/components/accordion/use-accordion.cjs.map +1 -1
  3. package/dist/cjs/components/checkbox/use-checkbox-group.cjs +6 -6
  4. package/dist/cjs/components/checkbox/use-checkbox-group.cjs.map +1 -1
  5. package/dist/cjs/components/checkbox/use-checkbox.cjs +17 -18
  6. package/dist/cjs/components/checkbox/use-checkbox.cjs.map +1 -1
  7. package/dist/cjs/components/code/code.style.cjs +2 -1
  8. package/dist/cjs/components/code/code.style.cjs.map +1 -1
  9. package/dist/cjs/components/color-picker/use-color-picker.cjs +14 -16
  10. package/dist/cjs/components/color-picker/use-color-picker.cjs.map +1 -1
  11. package/dist/cjs/components/color-selector/use-color-selector.cjs +4 -5
  12. package/dist/cjs/components/color-selector/use-color-selector.cjs.map +1 -1
  13. package/dist/cjs/components/dropzone/use-dropzone.cjs +3 -4
  14. package/dist/cjs/components/dropzone/use-dropzone.cjs.map +1 -1
  15. package/dist/cjs/components/file-input/use-file-input.cjs +5 -5
  16. package/dist/cjs/components/file-input/use-file-input.cjs.map +1 -1
  17. package/dist/cjs/components/kbd/kbd.style.cjs +2 -1
  18. package/dist/cjs/components/kbd/kbd.style.cjs.map +1 -1
  19. package/dist/cjs/components/menu/use-menu.cjs +36 -49
  20. package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
  21. package/dist/cjs/components/modal/use-modal.cjs +5 -7
  22. package/dist/cjs/components/modal/use-modal.cjs.map +1 -1
  23. package/dist/cjs/components/native-popover/use-native-popover.cjs +8 -8
  24. package/dist/cjs/components/native-popover/use-native-popover.cjs.map +1 -1
  25. package/dist/cjs/components/pin-input/use-pin-input.cjs +10 -9
  26. package/dist/cjs/components/pin-input/use-pin-input.cjs.map +1 -1
  27. package/dist/cjs/components/radio/use-radio-group.cjs +12 -13
  28. package/dist/cjs/components/radio/use-radio-group.cjs.map +1 -1
  29. package/dist/cjs/components/radio/use-radio.cjs +15 -18
  30. package/dist/cjs/components/radio/use-radio.cjs.map +1 -1
  31. package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs +4 -6
  32. package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs.map +1 -1
  33. package/dist/cjs/components/select/use-select.cjs +5 -6
  34. package/dist/cjs/components/select/use-select.cjs.map +1 -1
  35. package/dist/cjs/components/sidebar/use-sidebar.cjs +13 -19
  36. package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
  37. package/dist/cjs/components/slider/use-slider.cjs +13 -18
  38. package/dist/cjs/components/slider/use-slider.cjs.map +1 -1
  39. package/dist/cjs/components/steps/use-steps.cjs +4 -6
  40. package/dist/cjs/components/steps/use-steps.cjs.map +1 -1
  41. package/dist/cjs/components/tabs/use-tabs.cjs +5 -5
  42. package/dist/cjs/components/tabs/use-tabs.cjs.map +1 -1
  43. package/dist/cjs/components/tooltip/use-tooltip.cjs +13 -14
  44. package/dist/cjs/components/tooltip/use-tooltip.cjs.map +1 -1
  45. package/dist/cjs/core/components/props.cjs +12 -1
  46. package/dist/cjs/core/components/props.cjs.map +1 -1
  47. package/dist/cjs/core/index.cjs +2 -0
  48. package/dist/cjs/core/system/index.cjs +2 -0
  49. package/dist/cjs/core/system/styled.cjs +23 -12
  50. package/dist/cjs/core/system/styled.cjs.map +1 -1
  51. package/dist/cjs/hooks/use-combobox/index.cjs +23 -28
  52. package/dist/cjs/hooks/use-combobox/index.cjs.map +1 -1
  53. package/dist/cjs/index.cjs +4 -0
  54. package/dist/esm/components/accordion/use-accordion.js +4 -5
  55. package/dist/esm/components/accordion/use-accordion.js.map +1 -1
  56. package/dist/esm/components/checkbox/use-checkbox-group.js +6 -6
  57. package/dist/esm/components/checkbox/use-checkbox-group.js.map +1 -1
  58. package/dist/esm/components/checkbox/use-checkbox.js +17 -18
  59. package/dist/esm/components/checkbox/use-checkbox.js.map +1 -1
  60. package/dist/esm/components/code/code.style.js +2 -1
  61. package/dist/esm/components/code/code.style.js.map +1 -1
  62. package/dist/esm/components/color-picker/use-color-picker.js +14 -16
  63. package/dist/esm/components/color-picker/use-color-picker.js.map +1 -1
  64. package/dist/esm/components/color-selector/use-color-selector.js +4 -5
  65. package/dist/esm/components/color-selector/use-color-selector.js.map +1 -1
  66. package/dist/esm/components/dropzone/use-dropzone.js +3 -4
  67. package/dist/esm/components/dropzone/use-dropzone.js.map +1 -1
  68. package/dist/esm/components/file-input/use-file-input.js +5 -5
  69. package/dist/esm/components/file-input/use-file-input.js.map +1 -1
  70. package/dist/esm/components/kbd/kbd.style.js +2 -1
  71. package/dist/esm/components/kbd/kbd.style.js.map +1 -1
  72. package/dist/esm/components/menu/use-menu.js +36 -49
  73. package/dist/esm/components/menu/use-menu.js.map +1 -1
  74. package/dist/esm/components/modal/use-modal.js +5 -7
  75. package/dist/esm/components/modal/use-modal.js.map +1 -1
  76. package/dist/esm/components/native-popover/use-native-popover.js +8 -8
  77. package/dist/esm/components/native-popover/use-native-popover.js.map +1 -1
  78. package/dist/esm/components/pin-input/use-pin-input.js +10 -9
  79. package/dist/esm/components/pin-input/use-pin-input.js.map +1 -1
  80. package/dist/esm/components/radio/use-radio-group.js +12 -13
  81. package/dist/esm/components/radio/use-radio-group.js.map +1 -1
  82. package/dist/esm/components/radio/use-radio.js +15 -18
  83. package/dist/esm/components/radio/use-radio.js.map +1 -1
  84. package/dist/esm/components/saturation-slider/use-saturation-slider.js +4 -6
  85. package/dist/esm/components/saturation-slider/use-saturation-slider.js.map +1 -1
  86. package/dist/esm/components/select/use-select.js +5 -6
  87. package/dist/esm/components/select/use-select.js.map +1 -1
  88. package/dist/esm/components/sidebar/use-sidebar.js +13 -19
  89. package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
  90. package/dist/esm/components/slider/use-slider.js +13 -18
  91. package/dist/esm/components/slider/use-slider.js.map +1 -1
  92. package/dist/esm/components/steps/use-steps.js +4 -6
  93. package/dist/esm/components/steps/use-steps.js.map +1 -1
  94. package/dist/esm/components/tabs/use-tabs.js +5 -5
  95. package/dist/esm/components/tabs/use-tabs.js.map +1 -1
  96. package/dist/esm/components/tooltip/use-tooltip.js +14 -15
  97. package/dist/esm/components/tooltip/use-tooltip.js.map +1 -1
  98. package/dist/esm/core/components/props.js +12 -1
  99. package/dist/esm/core/components/props.js.map +1 -1
  100. package/dist/esm/core/index.js +2 -2
  101. package/dist/esm/core/system/index.js +2 -2
  102. package/dist/esm/core/system/styled.js +22 -13
  103. package/dist/esm/core/system/styled.js.map +1 -1
  104. package/dist/esm/hooks/use-combobox/index.js +23 -28
  105. package/dist/esm/hooks/use-combobox/index.js.map +1 -1
  106. package/dist/esm/index.js +4 -2
  107. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  108. package/dist/types/components/menu/menu.style.d.ts +2 -2
  109. package/dist/types/components/menu/use-menu.d.ts +1 -1
  110. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  111. package/dist/types/components/steps/steps.style.d.ts +1 -1
  112. package/dist/types/components/steps/use-steps.d.ts +1 -1
  113. package/dist/types/components/tabs/use-tabs.d.ts +1 -1
  114. package/dist/types/components/timeline/timeline.d.ts +1 -1
  115. package/dist/types/components/timeline/timeline.style.d.ts +1 -1
  116. package/dist/types/components/tree/tree.style.d.ts +1 -1
  117. package/dist/types/core/components/index.d.ts +2 -2
  118. package/dist/types/core/components/props.d.ts +2 -1
  119. package/dist/types/core/index.d.ts +3 -3
  120. package/dist/types/core/system/index.d.ts +2 -2
  121. package/dist/types/core/system/styled.d.ts +1 -0
  122. package/dist/types/hooks/use-combobox/index.d.ts +1 -1
  123. package/dist/types/index.d.ts +4 -4
  124. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"use-dropzone.cjs","names":["fromEvent","useFieldProps","useId","useOriginalDropzone","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/dropzone/use-dropzone.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { Accept, DropzoneOptions } from \"react-dropzone\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { fromEvent } from \"file-selector\"\nimport { useCallback, useId } from \"react\"\nimport { useDropzone as useOriginalDropzone } from \"react-dropzone\"\nimport { mergeProps } from \"../../core\"\nimport {\n ariaAttr,\n assignRef,\n cx,\n dataAttr,\n isArray,\n mergeRefs,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseDropzoneProps\n extends Omit<HTMLProps, \"onDrop\" | \"onError\">, FieldProps {\n /**\n * Set accepted file types.\n */\n accept?: Accept | string[]\n /**\n * Set to true to focus the root element on render.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * Use this to provide a custom file aggregator.\n */\n getFilesFromEvent?: DropzoneOptions[\"getFilesFromEvent\"]\n /**\n * If `true`, display the dropzone loading icon.\n *\n * @default false\n */\n loading?: boolean\n /**\n * Maximum accepted number of files.\n * The default value is 0 which means there is no limitation to how many files are accepted.\n *\n * @default 0\n */\n maxFiles?: number\n /**\n * Maximum file size (in bytes).\n *\n * @default Infinity\n */\n maxSize?: number\n /**\n * Minimum file size (in bytes).\n *\n * @default 0\n */\n minSize?: number\n /**\n * Allow drag and drop (or selection from the file dialog) of multiple files.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If true, disables click to open the native file selection dialog.\n *\n * @default false\n */\n noClick?: boolean\n /**\n * If true, disables drag and drop.\n *\n * @default false\n */\n noDrag?: boolean\n /**\n * If true, stops drag event propagation to parents.\n *\n * @default false\n */\n noDragEventsBubbling?: boolean\n /**\n * If true, disables `space` and `enter` to open the native file selection dialog.\n * Note that it also stops tracking the focus state.\n *\n * @default false\n */\n noKeyboard?: boolean\n /**\n * Ref to a open function.\n */\n openRef?: RefObject<() => void>\n /**\n * If false, allow dropped items to take over the current browser window.\n *\n * @default true\n */\n preventDropOnDocument?: boolean\n /**\n * If true, use the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) to read files.\n *\n * @default false\n */\n useFsAccessApi?: boolean\n /**\n * Custom validation function.\n * It must return null if there's no errors.\n */\n validator?: DropzoneOptions[\"validator\"]\n /**\n * Callback for when the dragenter event occurs.\n */\n onDragEnter?: DropzoneOptions[\"onDragEnter\"]\n /**\n * Callback for when the dragleave event occurs.\n */\n onDragLeave?: DropzoneOptions[\"onDragLeave\"]\n /**\n * Callback for when the dragover event occurs.\n */\n onDragOver?: DropzoneOptions[\"onDragOver\"]\n /**\n * Callback for when the drop event occurs.\n * Note that this callback is invoked after the `getFilesFromEvent` callback is done.\n */\n onDrop?: DropzoneOptions[\"onDrop\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are accepted, this callback is not invoked.\n */\n onDropAccepted?: DropzoneOptions[\"onDropAccepted\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are rejected, this callback is not invoked.\n */\n onDropRejected?: DropzoneOptions[\"onDropRejected\"]\n /**\n * Callback for when there's some error from any of the promises.\n */\n onError?: DropzoneOptions[\"onError\"]\n /**\n * Callback for when closing the file dialog with no selection.\n */\n onFileDialogCancel?: DropzoneOptions[\"onFileDialogCancel\"]\n /**\n * Callback for when opening the file dialog.\n */\n onFileDialogOpen?: DropzoneOptions[\"onFileDialogOpen\"]\n}\n\nexport const useDropzone = (props: UseDropzoneProps = {}) => {\n const {\n props: {\n id,\n name,\n accept,\n autoFocus = false,\n disabled,\n getFilesFromEvent = fromEvent,\n loading,\n maxFiles = 0,\n maxSize = Infinity,\n minSize = 0,\n multiple = false,\n noClick = false,\n noDrag = false,\n noDragEventsBubbling = false,\n noKeyboard = false,\n openRef,\n preventDropOnDocument = true,\n readOnly,\n useFsAccessApi = false,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const labelledbyId = useId()\n const interactive = !(loading || readOnly || disabled)\n const {\n acceptedFiles,\n fileRejections,\n isDragAccept: dragAccept,\n isDragActive: dragActive,\n isDragReject: dragReject,\n isFocused: focused,\n open,\n getInputProps: getOriginalInputProps,\n getRootProps: getOriginalRootProps,\n } = useOriginalDropzone({\n accept: isArray(accept)\n ? accept.reduce((prev, current) => ({ ...prev, [current]: [] }), {})\n : accept,\n autoFocus,\n disabled: !interactive,\n getFilesFromEvent,\n maxFiles,\n maxSize,\n minSize,\n multiple,\n noClick,\n noDrag,\n noDragEventsBubbling,\n noKeyboard,\n preventDropOnDocument,\n useFsAccessApi,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n })\n const dragIdle = !dragAccept && !dragReject\n\n assignRef(openRef, open)\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const { ref: restRef, ...restProps } = rest\n const { ref: rootRef, ...rootProps } = getOriginalRootProps(\n mergeProps(\n {\n id: labelledbyId,\n ...dataProps,\n ...eventProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"data-accept\": dataAttr(dragAccept),\n \"data-idle\": dataAttr(dragIdle),\n \"data-loading\": dataAttr(loading),\n \"data-reject\": dataAttr(dragReject),\n },\n restProps,\n props,\n )(),\n ) as HTMLProps\n\n return {\n ...rootProps,\n ref: mergeRefs(restRef, ref, rootRef),\n }\n },\n [\n getOriginalRootProps,\n labelledbyId,\n dataProps,\n eventProps,\n interactive,\n dragAccept,\n dragIdle,\n loading,\n dragReject,\n rest,\n ],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n getOriginalInputProps({\n id,\n name,\n disabled,\n readOnly,\n ...ariaProps,\n ...dataProps,\n ...props,\n \"aria-labelledby\": cx(ariaLabelledby, labelledbyId),\n }),\n [\n getOriginalInputProps,\n id,\n name,\n disabled,\n readOnly,\n ariaProps,\n dataProps,\n labelledbyId,\n ],\n )\n\n return {\n acceptedFiles,\n dragAccept,\n dragActive,\n dragIdle,\n dragReject,\n fileRejections,\n focused,\n loading,\n open,\n getInputProps,\n getRootProps,\n }\n}\n\nexport type UseDropzoneReturn = ReturnType<typeof useDropzone>\n"],"mappings":";;;;;;;;;AA8JA,MAAa,eAAe,QAA0B,CAAC,MAAM;CAC3D,MAAM,EACJ,OAAO,EACL,IACA,MACA,QACA,YAAY,OACZ,UACA,oBAAoBA,cAAAA,WACpB,SACA,WAAW,GACX,UAAU,UACV,UAAU,GACV,WAAW,OACX,UAAU,OACV,SAAS,OACT,uBAAuB,OACvB,aAAa,OACb,SACA,wBAAwB,MACxB,UACA,iBAAiB,OACjB,WACA,aACA,aACA,YACA,QACA,gBACA,gBACA,SACA,oBACA,kBACA,GAAG,QAEL,WACA,WACA,eACEC,wBAAAA,cAAc,KAAK;CACvB,MAAM,gBAAA,GAAeC,MAAAA,MAAAA,CAAM;CAC3B,MAAM,cAAc,EAAE,WAAW,YAAY;CAC7C,MAAM,EACJ,eACA,gBACA,cAAc,YACd,cAAc,YACd,cAAc,YACd,WAAW,SACX,MACA,eAAe,uBACf,cAAc,0BAAA,GACZC,eAAAA,YAAAA,CAAoB;EACtB,SAAA,GAAA,oBAAA,cAAQ,QAAA,CAAQ,MAAM,IAClB,OAAO,QAAQ,MAAM,aAAa;GAAE,GAAG;IAAO,UAAU,CAAC;EAAE,IAAI,CAAC,CAAC,IACjE;EACJ;EACA,UAAU,CAAC;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,WAAW,CAAC,cAAc,CAAC;CAEjC,YAAA,UAAU,SAAS,IAAI;CAEvB,MAAM,gBAAA,GAA2BC,MAAAA,YAAAA,EAC9B,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM;EAC1B,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc;EACvC,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc,qBACrCC,cAAAA,WACE;GACE,IAAI;GACJ,GAAG;GACH,GAAG;GACH,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,gBAAA,GAAA,oBAAA,cAAe,SAAA,CAAS,UAAU;GAClC,cAAA,GAAA,oBAAA,cAAa,SAAA,CAAS,QAAQ;GAC9B,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;GAChC,gBAAA,GAAA,oBAAA,cAAe,SAAA,CAAS,UAAU;EACpC,GACA,WACA,KACF,CAAC,CAAC,CACJ;EAEA,OAAO;GACL,GAAG;GACH,KAAKC,YAAAA,UAAU,SAAS,KAAK,OAAO;EACtC;CACF,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CA0BA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,gBAAA,GAlCyCF,MAAAA,YAAAA,EACxC,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,MAClD,sBAAsB;GACpB;GACA;GACA;GACA;GACA,GAAG;GACH,GAAG;GACH,GAAG;GACH,oBAAA,GAAA,oBAAA,cAAmB,GAAA,CAAG,gBAAgB,YAAY;EACpD,CAAC,GACH;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAaY;EACZ;CACF;AACF"}
1
+ {"version":3,"file":"use-dropzone.cjs","names":["fromEvent","useFieldProps","useId","useOriginalDropzone","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/dropzone/use-dropzone.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { Accept, DropzoneOptions } from \"react-dropzone\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { fromEvent } from \"file-selector\"\nimport { useCallback, useId } from \"react\"\nimport { useDropzone as useOriginalDropzone } from \"react-dropzone\"\nimport { mergeProps } from \"../../core\"\nimport { ariaAttr, assignRef, dataAttr, isArray, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UseDropzoneProps\n extends Omit<HTMLProps, \"onDrop\" | \"onError\">, FieldProps {\n /**\n * Set accepted file types.\n */\n accept?: Accept | string[]\n /**\n * Set to true to focus the root element on render.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * Use this to provide a custom file aggregator.\n */\n getFilesFromEvent?: DropzoneOptions[\"getFilesFromEvent\"]\n /**\n * If `true`, display the dropzone loading icon.\n *\n * @default false\n */\n loading?: boolean\n /**\n * Maximum accepted number of files.\n * The default value is 0 which means there is no limitation to how many files are accepted.\n *\n * @default 0\n */\n maxFiles?: number\n /**\n * Maximum file size (in bytes).\n *\n * @default Infinity\n */\n maxSize?: number\n /**\n * Minimum file size (in bytes).\n *\n * @default 0\n */\n minSize?: number\n /**\n * Allow drag and drop (or selection from the file dialog) of multiple files.\n *\n * @default false\n */\n multiple?: boolean\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If true, disables click to open the native file selection dialog.\n *\n * @default false\n */\n noClick?: boolean\n /**\n * If true, disables drag and drop.\n *\n * @default false\n */\n noDrag?: boolean\n /**\n * If true, stops drag event propagation to parents.\n *\n * @default false\n */\n noDragEventsBubbling?: boolean\n /**\n * If true, disables `space` and `enter` to open the native file selection dialog.\n * Note that it also stops tracking the focus state.\n *\n * @default false\n */\n noKeyboard?: boolean\n /**\n * Ref to a open function.\n */\n openRef?: RefObject<() => void>\n /**\n * If false, allow dropped items to take over the current browser window.\n *\n * @default true\n */\n preventDropOnDocument?: boolean\n /**\n * If true, use the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) to read files.\n *\n * @default false\n */\n useFsAccessApi?: boolean\n /**\n * Custom validation function.\n * It must return null if there's no errors.\n */\n validator?: DropzoneOptions[\"validator\"]\n /**\n * Callback for when the dragenter event occurs.\n */\n onDragEnter?: DropzoneOptions[\"onDragEnter\"]\n /**\n * Callback for when the dragleave event occurs.\n */\n onDragLeave?: DropzoneOptions[\"onDragLeave\"]\n /**\n * Callback for when the dragover event occurs.\n */\n onDragOver?: DropzoneOptions[\"onDragOver\"]\n /**\n * Callback for when the drop event occurs.\n * Note that this callback is invoked after the `getFilesFromEvent` callback is done.\n */\n onDrop?: DropzoneOptions[\"onDrop\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are accepted, this callback is not invoked.\n */\n onDropAccepted?: DropzoneOptions[\"onDropAccepted\"]\n /**\n * Callback for when the drop event occurs.\n * Note that if no files are rejected, this callback is not invoked.\n */\n onDropRejected?: DropzoneOptions[\"onDropRejected\"]\n /**\n * Callback for when there's some error from any of the promises.\n */\n onError?: DropzoneOptions[\"onError\"]\n /**\n * Callback for when closing the file dialog with no selection.\n */\n onFileDialogCancel?: DropzoneOptions[\"onFileDialogCancel\"]\n /**\n * Callback for when opening the file dialog.\n */\n onFileDialogOpen?: DropzoneOptions[\"onFileDialogOpen\"]\n}\n\nexport const useDropzone = (props: UseDropzoneProps = {}) => {\n const {\n props: {\n id,\n name,\n accept,\n autoFocus = false,\n disabled,\n getFilesFromEvent = fromEvent,\n loading,\n maxFiles = 0,\n maxSize = Infinity,\n minSize = 0,\n multiple = false,\n noClick = false,\n noDrag = false,\n noDragEventsBubbling = false,\n noKeyboard = false,\n openRef,\n preventDropOnDocument = true,\n readOnly,\n useFsAccessApi = false,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const labelledbyId = useId()\n const interactive = !(loading || readOnly || disabled)\n const {\n acceptedFiles,\n fileRejections,\n isDragAccept: dragAccept,\n isDragActive: dragActive,\n isDragReject: dragReject,\n isFocused: focused,\n open,\n getInputProps: getOriginalInputProps,\n getRootProps: getOriginalRootProps,\n } = useOriginalDropzone({\n accept: isArray(accept)\n ? accept.reduce((prev, current) => ({ ...prev, [current]: [] }), {})\n : accept,\n autoFocus,\n disabled: !interactive,\n getFilesFromEvent,\n maxFiles,\n maxSize,\n minSize,\n multiple,\n noClick,\n noDrag,\n noDragEventsBubbling,\n noKeyboard,\n preventDropOnDocument,\n useFsAccessApi,\n validator,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onDropAccepted,\n onDropRejected,\n onError,\n onFileDialogCancel,\n onFileDialogOpen,\n })\n const dragIdle = !dragAccept && !dragReject\n\n assignRef(openRef, open)\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const { ref: restRef, ...restProps } = rest\n const { ref: rootRef, ...rootProps } = getOriginalRootProps(\n mergeProps(\n {\n id: labelledbyId,\n ...dataProps,\n ...eventProps,\n \"aria-disabled\": ariaAttr(!interactive),\n \"data-accept\": dataAttr(dragAccept),\n \"data-idle\": dataAttr(dragIdle),\n \"data-loading\": dataAttr(loading),\n \"data-reject\": dataAttr(dragReject),\n },\n restProps,\n props,\n )(),\n ) as HTMLProps\n\n return {\n ...rootProps,\n ref: mergeRefs(restRef, ref, rootRef),\n }\n },\n [\n getOriginalRootProps,\n labelledbyId,\n dataProps,\n eventProps,\n interactive,\n dragAccept,\n dragIdle,\n loading,\n dragReject,\n rest,\n ],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) =>\n getOriginalInputProps(\n mergeProps(\n {\n id,\n name,\n disabled,\n readOnly,\n ...ariaProps,\n ...dataProps,\n \"aria-labelledby\": labelledbyId,\n },\n props,\n )(),\n ),\n [\n getOriginalInputProps,\n id,\n name,\n disabled,\n readOnly,\n ariaProps,\n dataProps,\n labelledbyId,\n ],\n )\n\n return {\n acceptedFiles,\n dragAccept,\n dragActive,\n dragIdle,\n dragReject,\n fileRejections,\n focused,\n loading,\n open,\n getInputProps,\n getRootProps,\n }\n}\n\nexport type UseDropzoneReturn = ReturnType<typeof useDropzone>\n"],"mappings":";;;;;;;;;AAuJA,MAAa,eAAe,QAA0B,CAAC,MAAM;CAC3D,MAAM,EACJ,OAAO,EACL,IACA,MACA,QACA,YAAY,OACZ,UACA,oBAAoBA,cAAAA,WACpB,SACA,WAAW,GACX,UAAU,UACV,UAAU,GACV,WAAW,OACX,UAAU,OACV,SAAS,OACT,uBAAuB,OACvB,aAAa,OACb,SACA,wBAAwB,MACxB,UACA,iBAAiB,OACjB,WACA,aACA,aACA,YACA,QACA,gBACA,gBACA,SACA,oBACA,kBACA,GAAG,QAEL,WACA,WACA,eACEC,wBAAAA,cAAc,KAAK;CACvB,MAAM,gBAAA,GAAeC,MAAAA,MAAAA,CAAM;CAC3B,MAAM,cAAc,EAAE,WAAW,YAAY;CAC7C,MAAM,EACJ,eACA,gBACA,cAAc,YACd,cAAc,YACd,cAAc,YACd,WAAW,SACX,MACA,eAAe,uBACf,cAAc,0BAAA,GACZC,eAAAA,YAAAA,CAAoB;EACtB,SAAA,GAAA,oBAAA,cAAQ,QAAA,CAAQ,MAAM,IAClB,OAAO,QAAQ,MAAM,aAAa;GAAE,GAAG;IAAO,UAAU,CAAC;EAAE,IAAI,CAAC,CAAC,IACjE;EACJ;EACA,UAAU,CAAC;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,WAAW,CAAC,cAAc,CAAC;CAEjC,YAAA,UAAU,SAAS,IAAI;CAEvB,MAAM,gBAAA,GAA2BC,MAAAA,YAAAA,EAC9B,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM;EAC1B,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc;EACvC,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc,qBACrCC,cAAAA,WACE;GACE,IAAI;GACJ,GAAG;GACH,GAAG;GACH,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,gBAAA,GAAA,oBAAA,cAAe,SAAA,CAAS,UAAU;GAClC,cAAA,GAAA,oBAAA,cAAa,SAAA,CAAS,QAAQ;GAC9B,iBAAA,GAAA,oBAAA,cAAgB,SAAA,CAAS,OAAO;GAChC,gBAAA,GAAA,oBAAA,cAAe,SAAA,CAAS,UAAU;EACpC,GACA,WACA,KACF,CAAC,CAAC,CACJ;EAEA,OAAO;GACL,GAAG;GACH,KAAKC,YAAAA,UAAU,SAAS,KAAK,OAAO;EACtC;CACF,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CA8BA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,gBAAA,GAtCyCF,MAAAA,YAAAA,EACxC,QAAQ,CAAC,MACR,sBACEC,cAAAA,WACE;GACE;GACA;GACA;GACA;GACA,GAAG;GACH,GAAG;GACH,mBAAmB;EACrB,GACA,KACF,CAAC,CAAC,CACJ,GACF;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAaY;EACZ;CACF;AACF"}
@@ -2,6 +2,7 @@
2
2
  const require_dom = require("../../utils/dom.cjs");
3
3
  const require_ref = require("../../utils/ref.cjs");
4
4
  const require_utils_index = require("../../utils/index.cjs");
5
+ const require_props = require("../../core/components/props.cjs");
5
6
  const require_hooks_use_controllable_state_index = require("../../hooks/use-controllable-state/index.cjs");
6
7
  const require_use_field_props = require("../field/use-field-props.cjs");
7
8
  const require_hooks_use_clickable_index = require("../../hooks/use-clickable/index.cjs");
@@ -81,13 +82,12 @@ const useFileInput = (props) => {
81
82
  required,
82
83
  values,
83
84
  clickableProps,
84
- getFieldProps: (0, react.useCallback)(({ "aria-labelledby": ariaLabelledby, ...props } = {}) => ({
85
+ getFieldProps: (0, react.useCallback)((props = {}) => require_props.mergeProps({
85
86
  "data-placeholder": (0, require_utils_index.utils_exports.dataAttr)(!count),
86
87
  ...clickableProps,
87
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, clickableProps["aria-labelledby"]),
88
- tabIndex: interactive ? 0 : clickableProps.tabIndex,
89
- ...props
90
- }), [
88
+ "aria-labelledby": clickableProps["aria-labelledby"],
89
+ tabIndex: interactive ? 0 : clickableProps.tabIndex
90
+ }, props)(), [
91
91
  clickableProps,
92
92
  count,
93
93
  interactive
@@ -1 +1 @@
1
- {"version":3,"file":"use-file-input.cjs","names":["useFieldProps","useRef","useControllableState","useCallback","useClickable","visuallyHiddenAttributes","mergeRefs"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n cx,\n dataAttr,\n handlerAll,\n isNull,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport type UseFileInputProps<Y extends \"button\" | \"input\" = \"input\"> =\n FieldProps &\n Omit<HTMLProps<Y>, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\"> &\n Pick<HTMLProps<\"input\">, \"accept\" | \"multiple\" | \"ref\"> & {\n /**\n * The initial value of the file input.\n */\n defaultValue?: File[]\n /**\n * Ref to a reset function.\n */\n resetRef?: RefObject<(() => void) | null>\n /**\n * The value of the file input.\n */\n value?: File[]\n /**\n * Function to be called when a file change event occurs.\n */\n onChange?: (files: File[] | undefined) => void\n }\n\nexport const useFileInput = <Y extends \"button\" | \"input\" = \"input\">(\n props: UseFileInputProps<Y>,\n) => {\n const {\n context: { labelId } = {},\n props: {\n id,\n ref,\n form,\n name,\n \"aria-labelledby\": ariaLabelledby,\n accept,\n defaultValue,\n disabled,\n multiple,\n readOnly,\n required,\n resetRef,\n value,\n onChange: onChangeProp,\n onClick: onClickProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseFileInputProps<Y>>({\n ...props,\n notSupportReadOnly: true,\n })\n const interactive = !(readOnly || disabled)\n const inputRef = useRef<HTMLInputElement>(null)\n const [values, setValues] = useControllableState<File[] | undefined>({\n defaultValue,\n value,\n onChange: onChangeProp,\n })\n const count = values?.length ?? 0\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n inputRef.current?.click()\n }, [interactive])\n\n const onReset = useCallback(() => {\n if (inputRef.current) inputRef.current.value = \"\"\n\n setValues(undefined)\n }, [setValues])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const files = !isNull(ev.currentTarget.files)\n ? Array.from(ev.currentTarget.files)\n : undefined\n\n setValues(files?.length ? files : undefined)\n },\n [setValues],\n )\n\n const clickableProps = useClickable<HTMLElement, Dict>({\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n disabled: !interactive,\n focusable: readOnly && !disabled,\n focusOnClick: interactive,\n onClick: handlerAll(onClickProp, onClick),\n })\n\n assignRef(resetRef, onReset)\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n ...visuallyHiddenAttributes,\n ...ariaProps,\n ...dataProps,\n id,\n form,\n type: \"file\",\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n required,\n ...props,\n ref: mergeRefs(inputRef, props.ref, ref),\n onChange: handlerAll(props.onChange, onChange),\n }),\n [\n required,\n ariaProps,\n dataProps,\n id,\n form,\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n ref,\n onChange,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n \"data-placeholder\": dataAttr(!count),\n ...clickableProps,\n \"aria-labelledby\": cx(ariaLabelledby, clickableProps[\"aria-labelledby\"]),\n tabIndex: interactive ? 0 : clickableProps.tabIndex,\n ...props,\n }),\n [clickableProps, count, interactive],\n )\n\n return {\n disabled,\n interactive,\n readOnly,\n required,\n values,\n clickableProps,\n getFieldProps,\n getInputProps,\n }\n}\n\nexport type UseFileInputReturn = ReturnType<typeof useFileInput>\n"],"mappings":";;;;;;;;;AA0CA,MAAa,gBACX,UACG;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,IACA,KACA,MACA,MACA,mBAAmB,gBACnB,QACA,cACA,UACA,UACA,UACA,UACA,UACA,OACA,UAAU,cACV,SAAS,aACT,GAAG,QAEL,WACA,WACA,eACEA,wBAAAA,cAAiD;EACnD,GAAG;EACH,oBAAoB;CACtB,CAAC;CACD,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,YAAA,GAAWC,MAAAA,OAAAA,CAAyB,IAAI;CAC9C,MAAM,CAAC,QAAQ,aAAaC,2CAAAA,qBAAyC;EACnE;EACA;EACA,UAAU;CACZ,CAAC;CACD,MAAM,QAAQ,QAAQ,UAAU;CAEhC,MAAM,WAAA,GAAUC,MAAAA,YAAAA,OAAkB;EAChC,IAAI,CAAC,aAAa;EAElB,SAAS,SAAS,MAAM;CAC1B,GAAG,CAAC,WAAW,CAAC;CAEhB,MAAM,WAAA,GAAUA,MAAAA,YAAAA,OAAkB;EAChC,IAAI,SAAS,SAAS,SAAS,QAAQ,QAAQ;EAE/C,UAAU,KAAA,CAAS;CACrB,GAAG,CAAC,SAAS,CAAC;CAEd,MAAM,YAAA,GAAWA,MAAAA,YAAAA,EACd,OAAsC;EACrC,MAAM,QAAQ,EAAA,GAAA,oBAAA,cAAC,OAAA,CAAO,GAAG,cAAc,KAAK,IACxC,MAAM,KAAK,GAAG,cAAc,KAAK,IACjC,KAAA;EAEJ,UAAU,OAAO,SAAS,QAAQ,KAAA,CAAS;CAC7C,GACA,CAAC,SAAS,CACZ;CAEA,MAAM,iBAAiBC,kCAAAA,aAAgC;EACrD,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,oBAAA,GAAA,oBAAA,cAAmB,GAAA,CAAG,gBAAgB,OAAO;EAC7C,UAAU,CAAC;EACX,WAAW,YAAY,CAAC;EACxB,cAAc;EACd,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,aAAa,OAAO;CAC1C,CAAC;CAED,YAAA,UAAU,UAAU,OAAO;CAE3B,MAAM,iBAAA,GAAqCD,MAAAA,YAAAA,EACxC,QAAQ,CAAC,OAAO;EACf,GAAGE,YAAAA;EACH,GAAG;EACH,GAAG;EACH;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACH,KAAKC,YAAAA,UAAU,UAAU,MAAM,KAAK,GAAG;EACvC,WAAA,GAAA,oBAAA,cAAU,WAAA,CAAW,MAAM,UAAU,QAAQ;CAC/C,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAaA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,gBAAA,GAlBgCH,MAAAA,YAAAA,EAC/B,EAAE,mBAAmB,gBAAgB,GAAG,UAAU,CAAC,OAAO;GACzD,qBAAA,GAAA,oBAAA,cAAoB,SAAA,CAAS,CAAC,KAAK;GACnC,GAAG;GACH,oBAAA,GAAA,oBAAA,cAAmB,GAAA,CAAG,gBAAgB,eAAe,kBAAkB;GACvE,UAAU,cAAc,IAAI,eAAe;GAC3C,GAAG;EACL,IACA;GAAC;GAAgB;GAAO;EAAW,CAUvB;EACZ;CACF;AACF"}
1
+ {"version":3,"file":"use-file-input.cjs","names":["useFieldProps","useRef","useControllableState","useCallback","useClickable","visuallyHiddenAttributes","mergeRefs","mergeProps"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { type HTMLProps, mergeProps, type PropGetter } from \"../../core\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n cx,\n dataAttr,\n handlerAll,\n isNull,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport type UseFileInputProps<Y extends \"button\" | \"input\" = \"input\"> =\n FieldProps &\n Omit<HTMLProps<Y>, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\"> &\n Pick<HTMLProps<\"input\">, \"accept\" | \"multiple\" | \"ref\"> & {\n /**\n * The initial value of the file input.\n */\n defaultValue?: File[]\n /**\n * Ref to a reset function.\n */\n resetRef?: RefObject<(() => void) | null>\n /**\n * The value of the file input.\n */\n value?: File[]\n /**\n * Function to be called when a file change event occurs.\n */\n onChange?: (files: File[] | undefined) => void\n }\n\nexport const useFileInput = <Y extends \"button\" | \"input\" = \"input\">(\n props: UseFileInputProps<Y>,\n) => {\n const {\n context: { labelId } = {},\n props: {\n id,\n ref,\n form,\n name,\n \"aria-labelledby\": ariaLabelledby,\n accept,\n defaultValue,\n disabled,\n multiple,\n readOnly,\n required,\n resetRef,\n value,\n onChange: onChangeProp,\n onClick: onClickProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseFileInputProps<Y>>({\n ...props,\n notSupportReadOnly: true,\n })\n const interactive = !(readOnly || disabled)\n const inputRef = useRef<HTMLInputElement>(null)\n const [values, setValues] = useControllableState<File[] | undefined>({\n defaultValue,\n value,\n onChange: onChangeProp,\n })\n const count = values?.length ?? 0\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n inputRef.current?.click()\n }, [interactive])\n\n const onReset = useCallback(() => {\n if (inputRef.current) inputRef.current.value = \"\"\n\n setValues(undefined)\n }, [setValues])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const files = !isNull(ev.currentTarget.files)\n ? Array.from(ev.currentTarget.files)\n : undefined\n\n setValues(files?.length ? files : undefined)\n },\n [setValues],\n )\n\n const clickableProps = useClickable<HTMLElement, Dict>({\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n disabled: !interactive,\n focusable: readOnly && !disabled,\n focusOnClick: interactive,\n onClick: handlerAll(onClickProp, onClick),\n })\n\n assignRef(resetRef, onReset)\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n ...visuallyHiddenAttributes,\n ...ariaProps,\n ...dataProps,\n id,\n form,\n type: \"file\",\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n required,\n ...props,\n ref: mergeRefs(inputRef, props.ref, ref),\n onChange: handlerAll(props.onChange, onChange),\n }),\n [\n required,\n ariaProps,\n dataProps,\n id,\n form,\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n ref,\n onChange,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n \"data-placeholder\": dataAttr(!count),\n ...clickableProps,\n \"aria-labelledby\": clickableProps[\"aria-labelledby\"],\n tabIndex: interactive ? 0 : clickableProps.tabIndex,\n },\n props,\n )(),\n [clickableProps, count, interactive],\n )\n\n return {\n disabled,\n interactive,\n readOnly,\n required,\n values,\n clickableProps,\n getFieldProps,\n getInputProps,\n }\n}\n\nexport type UseFileInputReturn = ReturnType<typeof useFileInput>\n"],"mappings":";;;;;;;;;;AA0CA,MAAa,gBACX,UACG;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,IACA,KACA,MACA,MACA,mBAAmB,gBACnB,QACA,cACA,UACA,UACA,UACA,UACA,UACA,OACA,UAAU,cACV,SAAS,aACT,GAAG,QAEL,WACA,WACA,e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A,GAAG;EACH,KAAKC,YAAAA,UAAU,UAAU,MAAM,KAAK,GAAG;EACvC,WAAA,GAAA,oBAAA,cAAU,WAAA,CAAW,MAAM,UAAU,QAAQ;CAC/C,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAgBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,gBAAA,GArBgCH,MAAAA,YAAAA,EAC/B,QAAQ,CAAC,MACRI,cAAAA,WACE;GACE,qBAAA,GAAA,oBAAA,cAAoB,SAAA,CAAS,CAAC,KAAK;GACnC,GAAG;GACH,mBAAmB,eAAe;GAClC,UAAU,cAAc,IAAI,eAAe;EAC7C,GACA,KACF,CAAC,CAAC,GACJ;GAAC;GAAgB;GAAO;EAAW,CAUvB;EACZ;CACF;AACF"}
@@ -4,7 +4,8 @@ const kbdStyle = require("../../core/system/config.cjs").defineComponentStyle({
4
4
  textStyle: "mono",
5
5
  alignItems: "center",
6
6
  display: "inline-flex",
7
- rounded: "l1"
7
+ rounded: "l1",
8
+ verticalAlign: "middle"
8
9
  },
9
10
  variants: {
10
11
  outline: { layerStyle: "outline" },
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.style.cjs","names":["defineComponentStyle"],"sources":["../../../../src/components/kbd/kbd.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\n\nexport const kbdStyle = defineComponentStyle({\n base: {\n textStyle: \"mono\",\n alignItems: \"center\",\n display: \"inline-flex\",\n rounded: \"l1\",\n },\n\n variants: {\n outline: {\n layerStyle: \"outline\",\n },\n solid: {\n layerStyle: \"solid\",\n },\n subtle: {\n layerStyle: \"subtle\",\n },\n surface: {\n layerStyle: \"surface\",\n },\n },\n\n sizes: {\n sm: {\n fontSize: \"xs\",\n lineHeight: \"{sizes.4}\",\n minH: \"4\",\n px: \"1\",\n },\n md: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.5}\",\n minH: \"5\",\n px: \"1.5\",\n },\n lg: {\n fontSize: \"md\",\n lineHeight: \"{sizes.6}\",\n minH: \"6\",\n px: \"2\",\n },\n },\n\n defaultProps: {\n size: \"md\",\n variant: \"surface\",\n },\n})\n\nexport type KbdStyle = typeof kbdStyle\n"],"mappings":";AAEA,MAAa,iDAAWA,CAAAA,CAAAA,qBAAqB;CAC3C,MAAM;EACJ,WAAW;EACX,YAAY;EACZ,SAAS;EACT,SAAS;CACX;CAEA,UAAU;EACR,SAAS,EACP,YAAY,UACd;EACA,OAAO,EACL,YAAY,QACd;EACA,QAAQ,EACN,YAAY,SACd;EACA,SAAS,EACP,YAAY,UACd;CACF;CAEA,OAAO;EACL,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;CACF;CAEA,cAAc;EACZ,MAAM;EACN,SAAS;CACX;AACF,CAAC"}
1
+ {"version":3,"file":"kbd.style.cjs","names":["defineComponentStyle"],"sources":["../../../../src/components/kbd/kbd.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\n\nexport const kbdStyle = defineComponentStyle({\n base: {\n textStyle: \"mono\",\n alignItems: \"center\",\n display: \"inline-flex\",\n rounded: \"l1\",\n verticalAlign: \"middle\",\n },\n\n variants: {\n outline: {\n layerStyle: \"outline\",\n },\n solid: {\n layerStyle: \"solid\",\n },\n subtle: {\n layerStyle: \"subtle\",\n },\n surface: {\n layerStyle: \"surface\",\n },\n },\n\n sizes: {\n sm: {\n fontSize: \"xs\",\n lineHeight: \"{sizes.4}\",\n minH: \"4\",\n px: \"1\",\n },\n md: {\n fontSize: \"sm\",\n lineHeight: \"{sizes.5}\",\n minH: \"5\",\n px: \"1.5\",\n },\n lg: {\n fontSize: \"md\",\n lineHeight: \"{sizes.6}\",\n minH: \"6\",\n px: \"2\",\n },\n },\n\n defaultProps: {\n size: \"md\",\n variant: \"surface\",\n },\n})\n\nexport type KbdStyle = typeof kbdStyle\n"],"mappings":";AAEA,MAAa,iDAAWA,CAAAA,CAAAA,qBAAqB;CAC3C,MAAM;EACJ,WAAW;EACX,YAAY;EACZ,SAAS;EACT,SAAS;EACT,eAAe;CACjB;CAEA,UAAU;EACR,SAAS,EACP,YAAY,UACd;EACA,OAAO,EACL,YAAY,QACd;EACA,QAAQ,EACN,YAAY,SACd;EACA,SAAS,EACP,YAAY,UACd;CACF;CAEA,OAAO;EACL,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;EACA,IAAI;GACF,UAAU;GACV,YAAY;GACZ,MAAM;GACN,IAAI;EACN;CACF;CAEA,cAAc;EACZ,MAAM;EACN,SAAS;CACX;AACF,CAAC"}
@@ -153,13 +153,12 @@ const useMenu = ({ closeOnSelect, defaultOpen, disabled = false, open: openProp,
153
153
  open,
154
154
  triggerId
155
155
  ]);
156
- const getContentProps = (0, react.useCallback)(({ ref, "aria-labelledby": ariaLabelledby, ...props } = {}) => ({
156
+ const getContentProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
157
157
  id: contentId,
158
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, triggerId),
159
- role: "menu",
160
- ...props,
161
- ref: require_ref.mergeRefs(ref, contentRef)
162
- }), [contentId, triggerId]);
158
+ ref: contentRef,
159
+ "aria-labelledby": triggerId,
160
+ role: "menu"
161
+ }, props)(), [contentId, triggerId]);
163
162
  const getSeparatorProps = (0, react.useCallback)((props) => ({
164
163
  role: "separator",
165
164
  ...props
@@ -279,22 +278,18 @@ const useSubMenu = ({ descendants, disabled = false, open, subMenuDirection = "e
279
278
  return {
280
279
  mainCloseOnSelect,
281
280
  subMenu,
282
- getSubMenuProps: (0, react.useCallback)(({ id = uuid, ref, ...props } = {}) => {
283
- const getDisabled = (node) => disabled || dataDisabled(node) || ariaDisabled(node);
284
- const register = createRegister({
281
+ getSubMenuProps: (0, react.useCallback)(({ id = uuid, ...props } = {}) => require_props.mergeProps({
282
+ ref: require_ref.mergeRefs(triggerRef, createRegister({
285
283
  id,
286
- disabled: getDisabled
287
- });
288
- return {
289
- role: subMenu ? "menuitem" : "button",
290
- ...props,
291
- ref: require_ref.mergeRefs(ref, triggerRef, register),
292
- onClick: (0, require_utils_index.utils_exports.handlerAll)(onClick, props.onClick),
293
- onKeyDown: (0, require_utils_index.utils_exports.handlerAll)(onKeyDown, props.onKeyDown),
294
- onMouseEnter: (0, require_utils_index.utils_exports.handlerAll)(onMouseEnter, props.onMouseEnter),
295
- onMouseMove: (0, require_utils_index.utils_exports.handlerAll)(onMouseMove, props.onMouseMove)
296
- };
297
- }, [
284
+ disabled: (node) => disabled || dataDisabled(node) || ariaDisabled(node)
285
+ })),
286
+ role: subMenu ? "menuitem" : "button"
287
+ }, props, {
288
+ onClick,
289
+ onKeyDown,
290
+ onMouseEnter,
291
+ onMouseMove
292
+ })(), [
298
293
  uuid,
299
294
  subMenu,
300
295
  createRegister,
@@ -309,17 +304,13 @@ const useSubMenu = ({ descendants, disabled = false, open, subMenuDirection = "e
309
304
  onMainSelect
310
305
  };
311
306
  };
312
- const useMenuGroup = ({ "aria-labelledby": ariaLabelledbyProp, ...rest }) => {
307
+ const useMenuGroup = ({ ...rest }) => {
313
308
  const labelId = (0, react.useId)();
314
309
  return {
315
- getGroupProps: (0, react.useCallback)(({ "aria-labelledby": ariaLabelledby, ...props } = {}) => require_props.mergeProps({
316
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledbyProp, ariaLabelledby, labelId),
310
+ getGroupProps: (0, react.useCallback)((props = {}) => require_props.mergeProps({
311
+ "aria-labelledby": labelId,
317
312
  role: "group"
318
- }, rest, props)(), [
319
- ariaLabelledbyProp,
320
- labelId,
321
- rest
322
- ]),
313
+ }, rest, props)(), [labelId, rest]),
323
314
  getLabelProps: (0, react.useCallback)((props) => ({
324
315
  id: labelId,
325
316
  role: "presentation",
@@ -385,26 +376,22 @@ const useMenuItem = ({ id, "aria-disabled": ariaDisabled, "data-disabled": dataD
385
376
  ]);
386
377
  return {
387
378
  subMenuTrigger,
388
- getItemProps: (0, react.useCallback)(({ ref, ...props } = {}) => {
389
- const { onClick: restOnClick, onFocus: restOnFocus, onKeyDown: restOnKeyDown, onMouseMove: restOnMouseMove, ...restProps } = rest;
390
- const { onClick: propsOnClick, onFocus: propsOnFocus, onKeyDown: propsOnKeyDown, onMouseMove: propsOnMouseMove, ...itemProps } = props;
391
- return require_props.mergeProps({
392
- id,
393
- "aria-disabled": ariaDisabled ?? (0, require_utils_index.utils_exports.ariaAttr)(disabled),
394
- "data-disabled": dataDisabled ?? (0, require_utils_index.utils_exports.dataAttr)(disabled),
395
- role: "menuitem",
396
- tabIndex: -1
397
- }, restProps, itemProps, {
398
- ref: require_ref.mergeRefs(ref, itemRef, register),
399
- onClick: (0, require_utils_index.utils_exports.handlerAll)(propsOnClick, restOnClick, () => onSelect(value, closeOnSelect)),
400
- onFocus: (0, require_utils_index.utils_exports.handlerAll)(propsOnFocus, restOnFocus, onActive),
401
- onKeyDown: (0, require_utils_index.utils_exports.handlerAll)(propsOnKeyDown, restOnKeyDown, onKeyDown),
402
- onMouseMove: (0, require_utils_index.utils_exports.handlerAll)(propsOnMouseMove, restOnMouseMove, () => {
403
- onCloseSubMenu();
404
- onActive();
405
- })
406
- })();
407
- }, [
379
+ getItemProps: (0, react.useCallback)((props = {}) => require_props.mergeProps({
380
+ id,
381
+ ref: require_ref.mergeRefs(itemRef, register),
382
+ "aria-disabled": ariaDisabled ?? (0, require_utils_index.utils_exports.ariaAttr)(disabled),
383
+ "data-disabled": dataDisabled ?? (0, require_utils_index.utils_exports.dataAttr)(disabled),
384
+ role: "menuitem",
385
+ tabIndex: -1
386
+ }, rest, props, {
387
+ onClick: () => onSelect(value, closeOnSelect),
388
+ onFocus: onActive,
389
+ onKeyDown,
390
+ onMouseMove: () => {
391
+ onCloseSubMenu();
392
+ onActive();
393
+ }
394
+ })(), [
408
395
  id,
409
396
  ariaDisabled,
410
397
  disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"use-menu.cjs","names":["createDescendants","createContext","useId","useRef","useDisclosure","useCallback","mergeRefs","mergeProps","useControllableState"],"sources":["../../../../src/components/menu/use-menu.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent, MouseEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Descendant, Descendants } from \"../../hooks/use-descendants\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n cx,\n dataAttr,\n handlerAll,\n isArray,\n isString,\n isTruthyDataAttr,\n mergeRefs,\n noop,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\ntype SubMenuDirection = \"end\" | \"start\"\n\ninterface MenuDescendantProps {\n id: string\n}\ntype MenuDescendant = Descendant<HTMLDivElement, MenuDescendantProps>\n\nconst {\n DescendantsContext: MenuDescendantsContext,\n useDescendant: useMenuDescendant,\n useDescendantRegister: useMenuDescendantRegister,\n useDescendants: useMenuDescendants,\n} = createDescendants<HTMLDivElement, MenuDescendantProps>()\n\nexport { MenuDescendantsContext, useMenuDescendant, useMenuDescendants }\n\ninterface MenuContext extends Pick<\n UseMenuReturn,\n | \"onActiveDescendant\"\n | \"onClose\"\n | \"onCloseSubMenu\"\n | \"onOpen\"\n | \"onSelect\"\n | \"subMenu\"\n | \"subMenuDirection\"\n> {}\n\nconst [MenuContext, useMenuContext] = createContext<MenuContext>({\n name: \"MenuContext\",\n})\n\ninterface MenuGroupContext extends Pick<UseMenuGroupReturn, \"getLabelProps\"> {}\n\nconst [MenuGroupContext, useMenuGroupContext] = createContext<MenuGroupContext>(\n {\n name: \"MenuGroupContext\",\n },\n)\n\ninterface MainMenuContext {\n descendants: Descendants<HTMLDivElement, MenuDescendantProps>\n onActiveDescendant: (descendant?: MenuDescendant) => void\n onCloseRef: RefObject<() => void>\n onSelect: (value?: string, closeOnSelect?: boolean) => void\n closeOnSelect?: boolean\n}\n\nconst [MainMenuContext, useMainMenuContext] = createContext<MainMenuContext>({\n name: \"MainMenuContext\",\n strict: false,\n})\n\ninterface MenuOptionGroupContext {\n type: \"checkbox\" | \"radio\"\n value: string | string[]\n onChange?: (value: string) => void\n}\n\nconst [MenuOptionGroupContext, useMenuOptionGroupContext] =\n createContext<MenuOptionGroupContext>({\n name: \"MenuOptionGroupContext\",\n })\n\nexport {\n MainMenuContext,\n MenuContext,\n MenuGroupContext,\n MenuOptionGroupContext,\n useMainMenuContext,\n useMenuContext,\n useMenuGroupContext,\n useMenuOptionGroupContext,\n}\n\nexport interface UseMenuProps extends Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the menu item will be closed when selected.\n *\n * @default true\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the menu will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The direction of the sub menu.\n *\n * @default 'end'\n */\n subMenuDirection?: SubMenuDirection\n /**\n * Callback invoked when a menu item is selected.\n */\n onSelect?: (value?: string) => void\n}\n\nexport const useMenu = ({\n closeOnSelect,\n defaultOpen,\n disabled = false,\n open: openProp,\n subMenuDirection = \"end\",\n onClose: onCloseProp,\n onOpen: onOpenProp,\n onSelect: onSelectProp,\n}: UseMenuProps = {}) => {\n const triggerId = useId()\n const contentId = useId()\n const descendants = useMenuDescendants()\n const updateRef = useRef<() => void>(noop)\n const onCloseRef = useRef<() => void>(noop)\n const contentRef = useRef<HTMLDivElement>(null)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const onCloseSubMenu = useCallback(() => onCloseRef.current(), [])\n const onActiveDescendant = useCallback(\n (\n descendant?: MenuDescendant,\n options: FocusOptions = { preventScroll: true },\n ) => {\n if (!contentRef.current || !descendant || disabled) return\n\n contentRef.current.setAttribute(\"aria-activedescendant\", descendant.id)\n\n descendants.active(descendant, options)\n },\n [descendants, disabled],\n )\n const { mainCloseOnSelect, subMenu, getSubMenuProps, onMainSelect } =\n useSubMenu({\n descendants,\n disabled,\n open,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onOpen,\n })\n\n closeOnSelect ??= mainCloseOnSelect ?? true\n\n const onSelect = useCallback(\n (value?: string, closeOnSelectProp = closeOnSelect) => {\n if (disabled) return\n\n onSelectProp?.(value)\n onMainSelect?.(value, closeOnSelectProp)\n\n if (!closeOnSelectProp) return\n\n onClose()\n },\n [closeOnSelect, disabled, onClose, onMainSelect, onSelectProp],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n\n ev.preventDefault()\n\n if (!open) onOpen()\n else onClose()\n },\n [disabled, onClose, onOpen, open],\n )\n\n const onContextMenu = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n\n ev.preventDefault()\n onOpen()\n updateRef.current()\n },\n [disabled, onOpen],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return\n\n runKeyAction(ev, {\n ArrowDown: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n },\n ArrowUp: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledLastValue()\n\n onActiveDescendant(descendant)\n })\n },\n Enter: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n },\n Space: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n },\n })\n },\n [descendants, disabled, onActiveDescendant, onOpen],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}) => ({\n ...getSubMenuProps({\n id: triggerId,\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"menu\",\n \"data-trigger\": dataAttr(true),\n role: \"button\",\n tabIndex: disabled ? -1 : 0,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n }),\n [contentId, disabled, getSubMenuProps, onClick, onKeyDown, open, triggerId],\n )\n\n const getContextTriggerProps: PropGetter = useCallback(\n (props = {}) => ({\n id: triggerId,\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"menu\",\n \"data-trigger\": dataAttr(true),\n role: \"application\",\n ...props,\n onContextMenu: handlerAll(props.onContextMenu, onContextMenu),\n }),\n [contentId, disabled, onContextMenu, open, triggerId],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) => ({\n id: contentId,\n \"aria-labelledby\": cx(ariaLabelledby, triggerId),\n role: \"menu\",\n ...props,\n ref: mergeRefs(ref, contentRef),\n }),\n [contentId, triggerId],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({ role: \"separator\", ...props }),\n [],\n )\n\n return {\n closeOnSelect,\n descendants,\n open,\n subMenu,\n subMenuDirection,\n updateRef,\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n onActiveDescendant,\n onClose,\n onCloseRef,\n onCloseSubMenu,\n onOpen,\n onSelect,\n }\n}\n\nexport type UseMenuReturn = ReturnType<typeof useMenu>\n\nexport interface UseSubMenuProps extends Omit<\n Required<UseDisclosureProps>,\n \"defaultOpen\" | \"timing\"\n> {\n descendants: Descendants<HTMLDivElement, MenuDescendantProps>\n onActiveDescendant: (descendant?: MenuDescendant) => void\n disabled?: boolean\n subMenuDirection?: SubMenuDirection\n}\n\nexport const useSubMenu = ({\n descendants,\n disabled = false,\n open,\n subMenuDirection = \"end\",\n onActiveDescendant,\n onClose,\n onOpen,\n}: UseSubMenuProps) => {\n const uuid = useId()\n const {\n closeOnSelect: mainCloseOnSelect,\n descendants: mainDescendants,\n onActiveDescendant: onActiveMainDescendant,\n onCloseRef,\n onSelect: onMainSelect,\n } = useMainMenuContext() ?? {}\n const subMenu = !!mainDescendants && !!onActiveMainDescendant\n const createRegister = useMenuDescendantRegister(mainDescendants)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n const dataDisabled = useCallback((node?: HTMLDivElement | null) => {\n node ??= triggerRef.current\n\n if (!node) return false\n\n const dataDisabled = isTruthyDataAttr(node.getAttribute(\"data-disabled\"))\n\n return dataDisabled\n }, [])\n\n const ariaDisabled = useCallback((node?: HTMLDivElement | null) => {\n node ??= triggerRef.current\n\n if (!node) return false\n\n const ariaDisabled = isTruthyDataAttr(node.getAttribute(\"aria-disabled\"))\n\n return ariaDisabled\n }, [])\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!subMenu) return\n\n ev.defaultPrevented = disabled || dataDisabled() || ariaDisabled()\n },\n [ariaDisabled, dataDisabled, disabled, subMenu],\n )\n\n const onMouseEnter = useCallback(() => {\n if (!subMenu || disabled || dataDisabled() || ariaDisabled()) return\n\n onOpen()\n }, [ariaDisabled, dataDisabled, disabled, onOpen, subMenu])\n\n const onMouseMove = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!subMenu || disabled || dataDisabled() || ariaDisabled()) return\n\n const descendant = descendants.value(triggerRef.current)\n\n onActiveMainDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n [\n ariaDisabled,\n dataDisabled,\n descendants,\n disabled,\n onActiveMainDescendant,\n subMenu,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n if (!subMenu || disabled) return\n\n const currentDescendant = open ? descendants : mainDescendants\n const onActiveCurrentDescendant = open\n ? onActiveDescendant\n : onActiveMainDescendant\n\n runKeyAction(ev, {\n ArrowDown: () => {\n const descendant = currentDescendant.enabledNextValue(\n triggerRef.current,\n )\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n ArrowUp: () => {\n const descendant = currentDescendant.enabledPrevValue(\n triggerRef.current,\n )\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n End: () => {\n const descendant = currentDescendant.enabledLastValue()\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n Home: () => {\n const descendant = currentDescendant.enabledFirstValue()\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n [subMenuDirection === \"end\" ? \"ArrowRight\" : \"ArrowLeft\"]: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n\n ev.defaultPrevented = true\n },\n })\n },\n [\n subMenu,\n disabled,\n open,\n descendants,\n mainDescendants,\n onActiveDescendant,\n onActiveMainDescendant,\n subMenuDirection,\n onOpen,\n ],\n )\n\n assignRef(onCloseRef, onClose)\n\n const getSubMenuProps: PropGetter = useCallback(\n ({ id = uuid, ref, ...props } = {}) => {\n const getDisabled = (node: HTMLDivElement) =>\n disabled || dataDisabled(node) || ariaDisabled(node)\n const register = createRegister({ id, disabled: getDisabled })\n\n return {\n role: subMenu ? \"menuitem\" : \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, register),\n onClick: handlerAll(onClick, props.onClick),\n onKeyDown: handlerAll(onKeyDown, props.onKeyDown),\n onMouseEnter: handlerAll(onMouseEnter, props.onMouseEnter),\n onMouseMove: handlerAll(onMouseMove, props.onMouseMove),\n }\n },\n [\n uuid,\n subMenu,\n createRegister,\n onClick,\n onKeyDown,\n onMouseEnter,\n onMouseMove,\n disabled,\n dataDisabled,\n ariaDisabled,\n ],\n )\n\n return { mainCloseOnSelect, subMenu, getSubMenuProps, onMainSelect }\n}\n\nexport type UseSubMenuReturn = ReturnType<typeof useSubMenu>\n\nexport interface UseMenuGroupProps extends HTMLProps {}\n\nexport const useMenuGroup = ({\n \"aria-labelledby\": ariaLabelledbyProp,\n ...rest\n}: UseMenuGroupProps) => {\n const labelId = useId()\n\n const getGroupProps: PropGetter = useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby, labelId),\n role: \"group\",\n },\n rest,\n props,\n )(),\n [ariaLabelledbyProp, labelId, rest],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props) => ({ id: labelId, role: \"presentation\", ...props }),\n [labelId],\n )\n\n return { getGroupProps, getLabelProps }\n}\n\nexport type UseMenuGroupReturn = ReturnType<typeof useMenuGroup>\n\nexport interface UseMenuItemProps extends HTMLProps {\n /**\n * If `true`, the menu item will be closed when selected.\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the menu item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The value of the menu item.\n */\n value?: string\n}\n\nexport const useMenuItem = ({\n id,\n \"aria-disabled\": ariaDisabled,\n \"data-disabled\": dataDisabled,\n \"data-trigger\": dataTrigger,\n closeOnSelect,\n disabled = false,\n value,\n ...rest\n}: UseMenuItemProps) => {\n const trigger = isTruthyDataAttr(dataTrigger)\n const {\n subMenu,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onCloseSubMenu,\n onSelect,\n } = useMenuContext()\n const uuid = useId()\n const itemRef = useRef<HTMLDivElement>(null)\n const subMenuTrigger = subMenu && trigger\n\n id ??= uuid\n\n const { descendants, register } = useMenuDescendant({\n id,\n disabled: disabled || subMenuTrigger,\n })\n\n const onActive = useCallback(() => {\n if (disabled) return\n\n const descendant = descendants.value(itemRef.current)\n\n onActiveDescendant(descendant)\n }, [descendants, disabled, onActiveDescendant])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: () => {\n const descendant = descendants.enabledNextValue(itemRef.current)\n\n onActiveDescendant(descendant)\n },\n ArrowUp: () => {\n const descendant = descendants.enabledPrevValue(itemRef.current)\n\n onActiveDescendant(descendant)\n },\n End: () => {\n const descendant = descendants.enabledLastValue()\n\n onActiveDescendant(descendant)\n },\n Enter: () => onSelect(value, closeOnSelect),\n Home: () => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n },\n Space: () => onSelect(value, closeOnSelect),\n [subMenuDirection === \"end\" ? \"ArrowLeft\" : \"ArrowRight\"]: () => {\n if (!subMenu) return\n\n onClose()\n\n const descendant = descendants.firstValue()\n\n descendant?.node.focus()\n },\n })\n },\n [\n closeOnSelect,\n descendants,\n onActiveDescendant,\n onClose,\n onSelect,\n subMenu,\n subMenuDirection,\n value,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => {\n const {\n onClick: restOnClick,\n onFocus: restOnFocus,\n onKeyDown: restOnKeyDown,\n onMouseMove: restOnMouseMove,\n ...restProps\n } = rest\n const {\n onClick: propsOnClick,\n onFocus: propsOnFocus,\n onKeyDown: propsOnKeyDown,\n onMouseMove: propsOnMouseMove,\n ...itemProps\n } = props\n\n return mergeProps(\n {\n id,\n \"aria-disabled\": ariaDisabled ?? ariaAttr(disabled),\n \"data-disabled\": dataDisabled ?? dataAttr(disabled),\n role: \"menuitem\",\n tabIndex: -1,\n },\n restProps,\n itemProps,\n {\n ref: mergeRefs(ref, itemRef, register),\n onClick: handlerAll(propsOnClick, restOnClick, () =>\n onSelect(value, closeOnSelect),\n ),\n onFocus: handlerAll(propsOnFocus, restOnFocus, onActive),\n onKeyDown: handlerAll(propsOnKeyDown, restOnKeyDown, onKeyDown),\n onMouseMove: handlerAll(propsOnMouseMove, restOnMouseMove, () => {\n onCloseSubMenu()\n onActive()\n }),\n },\n )()\n },\n [\n id,\n ariaDisabled,\n disabled,\n dataDisabled,\n rest,\n register,\n onActive,\n onKeyDown,\n onSelect,\n value,\n closeOnSelect,\n onCloseSubMenu,\n ],\n )\n\n return {\n subMenuTrigger,\n getItemProps,\n }\n}\n\nexport type UseMenuItemReturn = ReturnType<typeof useMenuItem>\n\nexport type MenuOptionGroupType = \"checkbox\" | \"radio\"\nexport type MenuOptionGroupValue<Y extends MenuOptionGroupType> =\n Y extends \"checkbox\" ? string[] : string\n\nexport interface UseMenuOptionGroupProps<\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n> {\n /**\n * The initial value of the menu item group.\n */\n defaultValue?: M\n /**\n * The type of the menu option group.\n */\n type?: Y\n /**\n * The value of the menu item group.\n */\n value?: M\n /**\n * The callback fired when any children checkbox is checked or unchecked.\n */\n onChange?: (value: M) => void\n}\n\nexport const useMenuOptionGroup = <\n Y extends \"checkbox\" | \"radio\" = \"checkbox\",\n M extends (Y extends \"checkbox\" ? string[] : string) = Y extends \"checkbox\"\n ? string[]\n : string,\n>({\n type = \"checkbox\" as Y,\n defaultValue = (type === \"checkbox\" ? [] : \"\") as M,\n value: valueProp,\n onChange: onChangeProp,\n}: UseMenuOptionGroupProps<Y, M>) => {\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const radio = type === \"radio\"\n\n const onChange = useCallback(\n (selectedValue: string) => {\n setValue((prev) => {\n if (radio && isString(prev)) return selectedValue as M\n else if (!radio && isArray(prev))\n return (\n prev.includes(selectedValue)\n ? prev.filter((value) => value !== selectedValue)\n : prev.concat(selectedValue)\n ) as M\n else return prev\n })\n },\n [radio, setValue],\n )\n\n useUpdateEffect(() => {\n setValue(valueProp!)\n }, [valueProp])\n\n return {\n type,\n value,\n onChange,\n }\n}\n\nexport type UseMenuOptionGroupReturn = ReturnType<typeof useMenuOptionGroup>\n\nexport interface UseMenuOptionItemProps extends UseMenuItemProps {\n /**\n * The value of the menu option item.\n */\n value: string\n}\n\nexport const useMenuOptionItem = ({\n disabled,\n value,\n ...rest\n}: UseMenuOptionItemProps) => {\n const { type, value: selectedValue, onChange } = useMenuOptionGroupContext()\n const { getItemProps } = useMenuItem({ disabled, value, ...rest })\n const radio = type === \"radio\" && isString(selectedValue)\n const checkbox = type === \"checkbox\" && isArray(selectedValue)\n const selected = radio\n ? value === selectedValue\n : checkbox\n ? selectedValue.includes(value)\n : false\n\n const getIndicatorProps: PropGetter = useCallback(\n ({ style, ...props } = {}) => ({\n style: { opacity: selected ? 1 : 0, ...style },\n ...props,\n }),\n [selected],\n )\n\n const getOptionItemProps: PropGetter = useCallback(\n (props = {}) =>\n getItemProps({\n role: radio ? \"menuitemradio\" : \"menuitemcheckbox\",\n ...props,\n onClick: handlerAll(props.onClick, () =>\n !disabled ? onChange?.(value) : noop,\n ),\n }),\n [disabled, getItemProps, onChange, radio, value],\n )\n\n return {\n type,\n selected,\n getIndicatorProps,\n getOptionItemProps,\n }\n}\n\nexport type UseMenuOptionItemReturn = ReturnType<typeof useMenuOptionItem>\n"],"mappings":";;;;;;;;;;;;AAkCA,MAAM,EACJ,oBAAoB,wBACpB,eAAe,mBACf,uBAAuB,2BACvB,gBAAgB,uBACdA,oCAAAA,kBAAuD;AAe3D,MAAM,CAAC,aAAa,kBAAkBC,gBAAAA,cAA2B,EAC/D,MAAM,cACR,CAAC;AAID,MAAM,CAAC,kBAAkB,uBAAuBA,gBAAAA,cAC9C,EACE,MAAM,mBACR,CACF;AAUA,MAAM,CAAC,iBAAiB,sBAAsBA,gBAAAA,cAA+B;CAC3E,MAAM;CACN,QAAQ;AACV,CAAC;AAQD,MAAM,CAAC,wBAAwB,6BAC7BA,gBAAAA,cAAsC,EACpC,MAAM,yBACR,CAAC;AAsCH,MAAa,WAAW,EACtB,eACA,aACA,WAAW,OACX,MAAM,UACN,m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AA,CAAQ,aAAa;CAC7D,MAAM,WAAW,QACb,UAAU,gBACV,WACE,cAAc,SAAS,KAAK,IAC5B;CAsBN,OAAO;EACL;EACA;EACA,oBAAA,GAvBoCA,MAAAA,YAAAA,EACnC,EAAE,OAAO,GAAG,UAAU,CAAC,OAAO;GAC7B,OAAO;IAAE,SAAS,WAAW,IAAI;IAAG,GAAG;GAAM;GAC7C,GAAG;EACL,IACA,CAAC,QAAQ,CAkBO;EAChB,qBAAA,GAhBqCA,MAAAA,YAAAA,EACpC,QAAQ,CAAC,MACR,aAAa;GACX,MAAM,QAAQ,kBAAkB;GAChC,GAAG;GACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,eACxB,CAAC,WAAW,WAAW,KAAK,IAAA,oBAAA,cAAI,IAClC;EACF,CAAC,GACH;GAAC;GAAU;GAAc;GAAU;GAAO;EAAK,CAO9B;CACnB;AACF"}
1
+ {"version":3,"file":"use-menu.cjs","names":["createDescendants","createContext","useId","useRef","useDisclosure","useCallback","mergeProps","mergeRefs","useControllableState"],"sources":["../../../../src/components/menu/use-menu.ts"],"sourcesContent":["\"use client\"\n\nimport type { KeyboardEvent, MouseEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Descendant, Descendants } from \"../../hooks/use-descendants\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport {\n ariaAttr,\n assignRef,\n createContext,\n dataAttr,\n handlerAll,\n isArray,\n isString,\n isTruthyDataAttr,\n mergeRefs,\n noop,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\n\ntype SubMenuDirection = \"end\" | \"start\"\n\ninterface MenuDescendantProps {\n id: string\n}\ntype MenuDescendant = Descendant<HTMLDivElement, MenuDescendantProps>\n\nconst {\n DescendantsContext: MenuDescendantsContext,\n useDescendant: useMenuDescendant,\n useDescendantRegister: useMenuDescendantRegister,\n useDescendants: useMenuDescendants,\n} = createDescendants<HTMLDivElement, MenuDescendantProps>()\n\nexport { MenuDescendantsContext, useMenuDescendant, useMenuDescendants }\n\ninterface MenuContext extends Pick<\n UseMenuReturn,\n | \"onActiveDescendant\"\n | \"onClose\"\n | \"onCloseSubMenu\"\n | \"onOpen\"\n | \"onSelect\"\n | \"subMenu\"\n | \"subMenuDirection\"\n> {}\n\nconst [MenuContext, useMenuContext] = createContext<MenuContext>({\n name: \"MenuContext\",\n})\n\ninterface MenuGroupContext extends Pick<UseMenuGroupReturn, \"getLabelProps\"> {}\n\nconst [MenuGroupContext, useMenuGroupContext] = createContext<MenuGroupContext>(\n {\n name: \"MenuGroupContext\",\n },\n)\n\ninterface MainMenuContext {\n descendants: Descendants<HTMLDivElement, MenuDescendantProps>\n onActiveDescendant: (descendant?: MenuDescendant) => void\n onCloseRef: RefObject<() => void>\n onSelect: (value?: string, closeOnSelect?: boolean) => void\n closeOnSelect?: boolean\n}\n\nconst [MainMenuContext, useMainMenuContext] = createContext<MainMenuContext>({\n name: \"MainMenuContext\",\n strict: false,\n})\n\ninterface MenuOptionGroupContext {\n type: \"checkbox\" | \"radio\"\n value: string | string[]\n onChange?: (value: string) => void\n}\n\nconst [MenuOptionGroupContext, useMenuOptionGroupContext] =\n createContext<MenuOptionGroupContext>({\n name: \"MenuOptionGroupContext\",\n })\n\nexport {\n MainMenuContext,\n MenuContext,\n MenuGroupContext,\n MenuOptionGroupContext,\n useMainMenuContext,\n useMenuContext,\n useMenuGroupContext,\n useMenuOptionGroupContext,\n}\n\nexport interface UseMenuProps extends Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the menu item will be closed when selected.\n *\n * @default true\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the menu will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The direction of the sub menu.\n *\n * @default 'end'\n */\n subMenuDirection?: SubMenuDirection\n /**\n * Callback invoked when a menu item is selected.\n */\n onSelect?: (value?: string) => void\n}\n\nexport const useMenu = ({\n closeOnSelect,\n defaultOpen,\n disabled = false,\n open: openProp,\n subMenuDirection = \"end\",\n onClose: onCloseProp,\n onOpen: onOpenProp,\n onSelect: onSelectProp,\n}: UseMenuProps = {}) => {\n const triggerId = useId()\n const contentId = useId()\n const descendants = useMenuDescendants()\n const updateRef = useRef<() => void>(noop)\n const onCloseRef = useRef<() => void>(noop)\n const contentRef = useRef<HTMLDivElement>(null)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const onCloseSubMenu = useCallback(() => onCloseRef.current(), [])\n const onActiveDescendant = useCallback(\n (\n descendant?: MenuDescendant,\n options: FocusOptions = { preventScroll: true },\n ) => {\n if (!contentRef.current || !descendant || disabled) return\n\n contentRef.current.setAttribute(\"aria-activedescendant\", descendant.id)\n\n descendants.active(descendant, options)\n },\n [descendants, disabled],\n )\n const { mainCloseOnSelect, subMenu, getSubMenuProps, onMainSelect } =\n useSubMenu({\n descendants,\n disabled,\n open,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onOpen,\n })\n\n closeOnSelect ??= mainCloseOnSelect ?? true\n\n const onSelect = useCallback(\n (value?: string, closeOnSelectProp = closeOnSelect) => {\n if (disabled) return\n\n onSelectProp?.(value)\n onMainSelect?.(value, closeOnSelectProp)\n\n if (!closeOnSelectProp) return\n\n onClose()\n },\n [closeOnSelect, disabled, onClose, onMainSelect, onSelectProp],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n\n ev.preventDefault()\n\n if (!open) onOpen()\n else onClose()\n },\n [disabled, onClose, onOpen, open],\n )\n\n const onContextMenu = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n\n ev.preventDefault()\n onOpen()\n updateRef.current()\n },\n [disabled, onOpen],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return\n\n runKeyAction(ev, {\n ArrowDown: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n },\n ArrowUp: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledLastValue()\n\n onActiveDescendant(descendant)\n })\n },\n Enter: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n },\n Space: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n },\n })\n },\n [descendants, disabled, onActiveDescendant, onOpen],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}) => ({\n ...getSubMenuProps({\n id: triggerId,\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"menu\",\n \"data-trigger\": dataAttr(true),\n role: \"button\",\n tabIndex: disabled ? -1 : 0,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n }),\n [contentId, disabled, getSubMenuProps, onClick, onKeyDown, open, triggerId],\n )\n\n const getContextTriggerProps: PropGetter = useCallback(\n (props = {}) => ({\n id: triggerId,\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"menu\",\n \"data-trigger\": dataAttr(true),\n role: \"application\",\n ...props,\n onContextMenu: handlerAll(props.onContextMenu, onContextMenu),\n }),\n [contentId, disabled, onContextMenu, open, triggerId],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id: contentId,\n ref: contentRef,\n \"aria-labelledby\": triggerId,\n role: \"menu\",\n },\n props,\n )(),\n [contentId, triggerId],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({ role: \"separator\", ...props }),\n [],\n )\n\n return {\n closeOnSelect,\n descendants,\n open,\n subMenu,\n subMenuDirection,\n updateRef,\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n onActiveDescendant,\n onClose,\n onCloseRef,\n onCloseSubMenu,\n onOpen,\n onSelect,\n }\n}\n\nexport type UseMenuReturn = ReturnType<typeof useMenu>\n\nexport interface UseSubMenuProps extends Omit<\n Required<UseDisclosureProps>,\n \"defaultOpen\" | \"timing\"\n> {\n descendants: Descendants<HTMLDivElement, MenuDescendantProps>\n onActiveDescendant: (descendant?: MenuDescendant) => void\n disabled?: boolean\n subMenuDirection?: SubMenuDirection\n}\n\nexport const useSubMenu = ({\n descendants,\n disabled = false,\n open,\n subMenuDirection = \"end\",\n onActiveDescendant,\n onClose,\n onOpen,\n}: UseSubMenuProps) => {\n const uuid = useId()\n const {\n closeOnSelect: mainCloseOnSelect,\n descendants: mainDescendants,\n onActiveDescendant: onActiveMainDescendant,\n onCloseRef,\n onSelect: onMainSelect,\n } = useMainMenuContext() ?? {}\n const subMenu = !!mainDescendants && !!onActiveMainDescendant\n const createRegister = useMenuDescendantRegister(mainDescendants)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n const dataDisabled = useCallback((node?: HTMLDivElement | null) => {\n node ??= triggerRef.current\n\n if (!node) return false\n\n const dataDisabled = isTruthyDataAttr(node.getAttribute(\"data-disabled\"))\n\n return dataDisabled\n }, [])\n\n const ariaDisabled = useCallback((node?: HTMLDivElement | null) => {\n node ??= triggerRef.current\n\n if (!node) return false\n\n const ariaDisabled = isTruthyDataAttr(node.getAttribute(\"aria-disabled\"))\n\n return ariaDisabled\n }, [])\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!subMenu) return\n\n ev.defaultPrevented = disabled || dataDisabled() || ariaDisabled()\n },\n [ariaDisabled, dataDisabled, disabled, subMenu],\n )\n\n const onMouseEnter = useCallback(() => {\n if (!subMenu || disabled || dataDisabled() || ariaDisabled()) return\n\n onOpen()\n }, [ariaDisabled, dataDisabled, disabled, onOpen, subMenu])\n\n const onMouseMove = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!subMenu || disabled || dataDisabled() || ariaDisabled()) return\n\n const descendant = descendants.value(triggerRef.current)\n\n onActiveMainDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n [\n ariaDisabled,\n dataDisabled,\n descendants,\n disabled,\n onActiveMainDescendant,\n subMenu,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n if (!subMenu || disabled) return\n\n const currentDescendant = open ? descendants : mainDescendants\n const onActiveCurrentDescendant = open\n ? onActiveDescendant\n : onActiveMainDescendant\n\n runKeyAction(ev, {\n ArrowDown: () => {\n const descendant = currentDescendant.enabledNextValue(\n triggerRef.current,\n )\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n ArrowUp: () => {\n const descendant = currentDescendant.enabledPrevValue(\n triggerRef.current,\n )\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n End: () => {\n const descendant = currentDescendant.enabledLastValue()\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n Home: () => {\n const descendant = currentDescendant.enabledFirstValue()\n\n onActiveCurrentDescendant(descendant)\n\n ev.defaultPrevented = true\n },\n [subMenuDirection === \"end\" ? \"ArrowRight\" : \"ArrowLeft\"]: () => {\n onOpen()\n\n setTimeout(() => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n })\n\n ev.defaultPrevented = true\n },\n })\n },\n [\n subMenu,\n disabled,\n open,\n descendants,\n mainDescendants,\n onActiveDescendant,\n onActiveMainDescendant,\n subMenuDirection,\n onOpen,\n ],\n )\n\n assignRef(onCloseRef, onClose)\n\n const getSubMenuProps: PropGetter = useCallback(\n ({ id = uuid, ...props } = {}) =>\n mergeProps(\n {\n ref: mergeRefs(\n triggerRef,\n createRegister({\n id,\n disabled: (node) =>\n disabled || dataDisabled(node) || ariaDisabled(node),\n }),\n ),\n role: subMenu ? \"menuitem\" : \"button\",\n },\n props,\n { onClick, onKeyDown, onMouseEnter, onMouseMove },\n )(),\n [\n uuid,\n subMenu,\n createRegister,\n onClick,\n onKeyDown,\n onMouseEnter,\n onMouseMove,\n disabled,\n dataDisabled,\n ariaDisabled,\n ],\n )\n\n return { mainCloseOnSelect, subMenu, getSubMenuProps, onMainSelect }\n}\n\nexport type UseSubMenuReturn = ReturnType<typeof useSubMenu>\n\nexport interface UseMenuGroupProps extends HTMLProps {}\n\nexport const useMenuGroup = ({ ...rest }: UseMenuGroupProps) => {\n const labelId = useId()\n\n const getGroupProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n \"aria-labelledby\": labelId,\n role: \"group\",\n },\n rest,\n props,\n )(),\n [labelId, rest],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props) => ({ id: labelId, role: \"presentation\", ...props }),\n [labelId],\n )\n\n return { getGroupProps, getLabelProps }\n}\n\nexport type UseMenuGroupReturn = ReturnType<typeof useMenuGroup>\n\nexport interface UseMenuItemProps extends HTMLProps {\n /**\n * If `true`, the menu item will be closed when selected.\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the menu item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The value of the menu item.\n */\n value?: string\n}\n\nexport const useMenuItem = ({\n id,\n \"aria-disabled\": ariaDisabled,\n \"data-disabled\": dataDisabled,\n \"data-trigger\": dataTrigger,\n closeOnSelect,\n disabled = false,\n value,\n ...rest\n}: UseMenuItemProps) => {\n const trigger = isTruthyDataAttr(dataTrigger)\n const {\n subMenu,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onCloseSubMenu,\n onSelect,\n } = useMenuContext()\n const uuid = useId()\n const itemRef = useRef<HTMLDivElement>(null)\n const subMenuTrigger = subMenu && trigger\n\n id ??= uuid\n\n const { descendants, register } = useMenuDescendant({\n id,\n disabled: disabled || subMenuTrigger,\n })\n\n const onActive = useCallback(() => {\n if (disabled) return\n\n const descendant = descendants.value(itemRef.current)\n\n onActiveDescendant(descendant)\n }, [descendants, disabled, onActiveDescendant])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLDivElement>) => {\n runKeyAction(ev, {\n ArrowDown: () => {\n const descendant = descendants.enabledNextValue(itemRef.current)\n\n onActiveDescendant(descendant)\n },\n ArrowUp: () => {\n const descendant = descendants.enabledPrevValue(itemRef.current)\n\n onActiveDescendant(descendant)\n },\n End: () => {\n const descendant = descendants.enabledLastValue()\n\n onActiveDescendant(descendant)\n },\n Enter: () => onSelect(value, closeOnSelect),\n Home: () => {\n const descendant = descendants.enabledFirstValue()\n\n onActiveDescendant(descendant)\n },\n Space: () => onSelect(value, closeOnSelect),\n [subMenuDirection === \"end\" ? \"ArrowLeft\" : \"ArrowRight\"]: () => {\n if (!subMenu) return\n\n onClose()\n\n const descendant = descendants.firstValue()\n\n descendant?.node.focus()\n },\n })\n },\n [\n closeOnSelect,\n descendants,\n onActiveDescendant,\n onClose,\n onSelect,\n subMenu,\n subMenuDirection,\n value,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id,\n ref: mergeRefs(itemRef, register),\n \"aria-disabled\": ariaDisabled ?? ariaAttr(disabled),\n \"data-disabled\": dataDisabled ?? dataAttr(disabled),\n role: \"menuitem\",\n tabIndex: -1,\n },\n rest,\n props,\n {\n onClick: () => onSelect(value, closeOnSelect),\n onFocus: onActive,\n onKeyDown: onKeyDown,\n onMouseMove: () => {\n onCloseSubMenu()\n onActive()\n },\n },\n )(),\n [\n id,\n ariaDisabled,\n disabled,\n dataDisabled,\n rest,\n register,\n onActive,\n onKeyDown,\n onSelect,\n value,\n closeOnSelect,\n onCloseSubMenu,\n ],\n )\n\n return {\n subMenuTrigger,\n getItemProps,\n }\n}\n\nexport type UseMenuItemReturn = ReturnType<typeof useMenuItem>\n\nexport type MenuOptionGroupType = \"checkbox\" | \"radio\"\nexport type MenuOptionGroupValue<Y extends MenuOptionGroupType> =\n Y extends \"checkbox\" ? string[] : string\n\nexport interface UseMenuOptionGroupProps<\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n> {\n /**\n * The initial value of the menu item group.\n */\n defaultValue?: M\n /**\n * The type of the menu option group.\n */\n type?: Y\n /**\n * The value of the menu item group.\n */\n value?: M\n /**\n * The callback fired when any children checkbox is checked or unchecked.\n */\n onChange?: (value: M) => void\n}\n\nexport const useMenuOptionGroup = <\n Y extends \"checkbox\" | \"radio\" = \"checkbox\",\n M extends (Y extends \"checkbox\" ? string[] : string) = Y extends \"checkbox\"\n ? string[]\n : string,\n>({\n type = \"checkbox\" as Y,\n defaultValue = (type === \"checkbox\" ? [] : \"\") as M,\n value: valueProp,\n onChange: onChangeProp,\n}: UseMenuOptionGroupProps<Y, M>) => {\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const radio = type === \"radio\"\n\n const onChange = useCallback(\n (selectedValue: string) => {\n setValue((prev) => {\n if (radio && isString(prev)) return selectedValue as M\n else if (!radio && isArray(prev))\n return (\n prev.includes(selectedValue)\n ? prev.filter((value) => value !== selectedValue)\n : prev.concat(selectedValue)\n ) as M\n else return prev\n })\n },\n [radio, setValue],\n )\n\n useUpdateEffect(() => {\n setValue(valueProp!)\n }, [valueProp])\n\n return {\n type,\n value,\n onChange,\n }\n}\n\nexport type UseMenuOptionGroupReturn = ReturnType<typeof useMenuOptionGroup>\n\nexport interface UseMenuOptionItemProps extends UseMenuItemProps {\n /**\n * The value of the menu option item.\n */\n value: string\n}\n\nexport const useMenuOptionItem = ({\n disabled,\n value,\n ...rest\n}: UseMenuOptionItemProps) => {\n const { type, value: selectedValue, onChange } = useMenuOptionGroupContext()\n const { getItemProps } = useMenuItem({ disabled, value, ...rest })\n const radio = type === \"radio\" && isString(selectedValue)\n const checkbox = type === \"checkbox\" && isArray(selectedValue)\n const selected = radio\n ? value === selectedValue\n : checkbox\n ? selectedValue.includes(value)\n : false\n\n const getIndicatorProps: PropGetter = useCallback(\n ({ style, ...props } = {}) => ({\n style: { opacity: selected ? 1 : 0, ...style },\n ...props,\n }),\n [selected],\n )\n\n const getOptionItemProps: PropGetter = useCallback(\n (props = {}) =>\n getItemProps({\n role: radio ? \"menuitemradio\" : \"menuitemcheckbox\",\n ...props,\n onClick: handlerAll(props.onClick, () =>\n !disabled ? onChange?.(value) : noop,\n ),\n }),\n [disabled, getItemProps, onChange, radio, value],\n )\n\n return {\n type,\n selected,\n getIndicatorProps,\n getOptionItemProps,\n }\n}\n\nexport type UseMenuOptionItemReturn = ReturnType<typeof useMenuOptionItem>\n"],"mappings":";;;;;;;;;;;;AAiCA,MAAM,EACJ,oBAAoB,wBACpB,eAAe,mBACf,uBAAuB,2BACvB,gBAAgB,uBACdA,oCAAAA,kBAAuD;AAe3D,MAAM,CAAC,aAAa,kBAAkBC,gBAAAA,cAA2B,EAC/D,MAAM,cACR,CAAC;AAID,MAAM,CAAC,kBAAkB,uBAAuBA,gBAAAA,cAC9C,EACE,MAAM,mBACR,CACF;AAUA,MAAM,CAAC,iBAAiB,sBAAsBA,gBAAAA,cAA+B;CAC3E,MAAM;CACN,QAAQ;AACV,CAAC;AAQD,MAAM,CAAC,wBAAwB,6BAC7BA,gBAAAA,cAAsC,EACpC,MAAM,yBACR,CAAC;AAsCH,MAAa,WAAW,EACtB,eACA,aACA,WAAW,OACX,MAAM,UACN,mBAAmB,OACnB,SAAS,aACT,QAAQ,YACR,UAAU,iBACM,CAAC,MAAM;CACvB,MAAM,aAAA,GAAYC,MAAAA,MAAAA,CAAM;CACxB,MAAM,aAAA,GAAYA,MAAAA,MAAAA,CAAM;CACxB,MAAM,cAAc,mBAAmB;CACvC,MAAM,a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MAAM,EAAE,iBAAiB,YAAY;EAAE;EAAU;EAAO,GAAG;CAAK,CAAC;CACjE,MAAM,QAAQ,SAAS,YAAA,GAAA,oBAAA,cAAW,SAAA,CAAS,aAAa;CACxD,MAAM,WAAW,SAAS,eAAA,GAAA,oBAAA,cAAc,QAAA,CAAQ,aAAa;CAC7D,MAAM,WAAW,QACb,UAAU,gBACV,WACE,cAAc,SAAS,KAAK,IAC5B;CAsBN,OAAO;EACL;EACA;EACA,oBAAA,GAvBoCA,MAAAA,YAAAA,EACnC,EAAE,OAAO,GAAG,UAAU,CAAC,OAAO;GAC7B,OAAO;IAAE,SAAS,WAAW,IAAI;IAAG,GAAG;GAAM;GAC7C,GAAG;EACL,IACA,CAAC,QAAQ,CAkBO;EAChB,qBAAA,GAhBqCA,MAAAA,YAAAA,EACpC,QAAQ,CAAC,MACR,aAAa;GACX,MAAM,QAAQ,kBAAkB;GAChC,GAAG;GACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,eACxB,CAAC,WAAW,WAAW,KAAK,IAAA,oBAAA,cAAI,IAClC;EACF,CAAC,GACH;GAAC;GAAU;GAAc;GAAU;GAAO;EAAK,CAO9B;CACnB;AACF"}
@@ -58,15 +58,13 @@ const useModal = ({ closeOnEsc = true, closeOnOverlay = true, defaultOpen, open:
58
58
  ...props,
59
59
  onClick: (0, require_utils_index.utils_exports.handlerAll)(props.onClick, onClose)
60
60
  }), [onClose, t]);
61
- const getContentProps = (0, react.useCallback)(({ "aria-describedby": ariaDescribedby, "aria-labelledby": ariaLabelledby, ...props } = {}) => ({
61
+ const getContentProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
62
62
  id: contentId,
63
- "aria-describedby": (0, require_utils_index.utils_exports.cx)(ariaDescribedby, bodyId),
64
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, titleId),
63
+ "aria-describedby": bodyId,
64
+ "aria-labelledby": titleId,
65
65
  "aria-modal": "true",
66
- role: "dialog",
67
- ...props,
68
- onKeyDown: (0, require_utils_index.utils_exports.handlerAll)(props.onKeyDown, onKeyDown)
69
- }), [
66
+ role: "dialog"
67
+ }, props, { onKeyDown })(), [
70
68
  bodyId,
71
69
  contentId,
72
70
  onKeyDown,
@@ -1 +1 @@
1
- {"version":3,"file":"use-modal.cjs","names":["useDisclosure","useIds","useI18n","useCallback","mergeProps"],"sources":["../../../../src/components/modal/use-modal.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { cx, handlerAll, useIds } from \"../../utils\"\n\nexport interface UseModalProps\n extends HTMLProps, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the modal will close when the `Esc` key is pressed.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the modal will close when the overlay is clicked.\n *\n * @default true\n */\n closeOnOverlay?: boolean\n /**\n * Callback invoked when the escape key is pressed and focus is within modal.\n */\n onEsc?: () => void\n}\n\nexport const useModal = ({\n closeOnEsc = true,\n closeOnOverlay = true,\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onEsc,\n onOpen: onOpenProp,\n ...rest\n}: UseModalProps = {}) => {\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const [contentId, titleId, bodyId] = useIds()\n const { t } = useI18n(\"modal\")\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.key !== \"Escape\") return\n\n if (closeOnEsc) {\n ev.stopPropagation()\n onClose()\n }\n\n onEsc?.()\n },\n [closeOnEsc, onClose, onEsc],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props) => mergeProps(rest, props ?? {})(),\n [rest],\n )\n\n const getOverlayProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-hidden\": \"true\",\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n ev.stopPropagation()\n\n if (closeOnOverlay) onClose()\n }),\n }),\n [closeOnOverlay, onClose],\n )\n\n const getOpenTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n \"aria-label\": t(\"Open modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onOpen),\n }),\n [contentId, onOpen, open, t],\n )\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getCloseButtonProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getContentProps: PropGetter<\"section\"> = useCallback(\n ({\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n } = {}) => ({\n id: contentId,\n \"aria-describedby\": cx(ariaDescribedby, bodyId),\n \"aria-labelledby\": cx(ariaLabelledby, titleId),\n \"aria-modal\": \"true\",\n role: \"dialog\",\n ...props,\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [bodyId, contentId, onKeyDown, titleId],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n const getTitleProps: PropGetter<\"h2\"> = useCallback(\n (props) => ({\n id: titleId,\n ...props,\n }),\n [titleId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({\n id: bodyId,\n ...props,\n }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n return {\n open,\n getBodyProps,\n getCloseButtonProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getOpenTriggerProps,\n getOverlayProps,\n getRootProps,\n getTitleProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UseModalReturn = ReturnType<typeof useModal>\n"],"mappings":";;;;;;;AA6BA,MAAa,YAAY,EACvB,aAAa,MACb,iBAAiB,MACjB,aACA,MAAM,UACN,SAAS,aACT,OACA,QAAQ,YACR,GAAG,SACc,CAAC,MAAM;CACxB,MAAM,EAAE,MAAM,SAAS,WAAWA,uBAAAA,cAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;CACV,CAAC;CACD,MAAM,CAAC,WAAW,SAAS,UAAUC,YAAAA,OAAO;CAC5C,MAAM,EAAE,MAAMC,sBAAAA,QAAQ,OAAO;CAE7B,MAAM,aAAA,GAAYC,MAAAA,YAAAA,EACf,OAAsB;EACrB,IAAI,GAAG,QAAQ,UAAU;EAEzB,IAAI,YAAY;GACd,GAAG,gBAAgB;GACnB,QAAQ;EACV;EAEA,QAAQ;CACV,GACA;EAAC;EAAY;EAAS;CAAK,CAC7B;CAEA,MAAM,gBAAA,GAA2BA,MAAAA,YAAAA,EAC9B,UAAUC,cAAAA,WAAW,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,IAAI,CACP;CAEA,MAAM,mBAAA,GAA8BD,MAAAA,YAAAA,EACjC,QAAQ,CAAC,OAAO;EACf,eAAe;EACf,GAAG;EACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,UAAU,OAAO;GACzC,GAAG,gBAAgB;GAEnB,IAAI,gBAAgB,QAAQ;EAC9B,CAAC;CACH,IACA,CAAC,gBAAgB,OAAO,CAC1B;CAEA,MAAM,uBAAA,GAA4CA,MAAAA,YAAAA,EAC/C,QAAQ,CAAC,OAAO;EACf,iBAAiB,OAAO,YAAY,KAAA;EACpC,iBAAiB;EACjB,iBAAiB;E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YI;EACX;EACA;EACA;EACA,iBAAA,GAb2CA,MAAAA,YAAAA,EAC1C,WAAW,EACV,GAAG,MACL,IACA,CAAC,CASY;EACb;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-modal.cjs","names":["useDisclosure","useIds","useI18n","useCallback","mergeProps"],"sources":["../../../../src/components/modal/use-modal.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { handlerAll, useIds } from \"../../utils\"\n\nexport interface UseModalProps\n extends HTMLProps, Omit<UseDisclosureProps, \"timing\"> {\n /**\n * If `true`, the modal will close when the `Esc` key is pressed.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the modal will close when the overlay is clicked.\n *\n * @default true\n */\n closeOnOverlay?: boolean\n /**\n * Callback invoked when the escape key is pressed and focus is within modal.\n */\n onEsc?: () => void\n}\n\nexport const useModal = ({\n closeOnEsc = true,\n closeOnOverlay = true,\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onEsc,\n onOpen: onOpenProp,\n ...rest\n}: UseModalProps = {}) => {\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const [contentId, titleId, bodyId] = useIds()\n const { t } = useI18n(\"modal\")\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.key !== \"Escape\") return\n\n if (closeOnEsc) {\n ev.stopPropagation()\n onClose()\n }\n\n onEsc?.()\n },\n [closeOnEsc, onClose, onEsc],\n )\n\n const getRootProps: PropGetter = useCallback(\n (props) => mergeProps(rest, props ?? {})(),\n [rest],\n )\n\n const getOverlayProps: PropGetter = useCallback(\n (props = {}) => ({\n \"aria-hidden\": \"true\",\n ...props,\n onClick: handlerAll(props.onClick, (ev) => {\n ev.stopPropagation()\n\n if (closeOnOverlay) onClose()\n }),\n }),\n [closeOnOverlay, onClose],\n )\n\n const getOpenTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n \"aria-label\": t(\"Open modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onOpen),\n }),\n [contentId, onOpen, open, t],\n )\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getCloseButtonProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n \"aria-label\": t(\"Close modal\"),\n ...props,\n onClick: handlerAll(props.onClick, onClose),\n }),\n [onClose, t],\n )\n\n const getContentProps: PropGetter<\"section\"> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n id: contentId,\n \"aria-describedby\": bodyId,\n \"aria-labelledby\": titleId,\n \"aria-modal\": \"true\",\n role: \"dialog\",\n },\n props,\n { onKeyDown },\n )(),\n [bodyId, contentId, onKeyDown, titleId],\n )\n\n const getHeaderProps: PropGetter<\"header\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n const getTitleProps: PropGetter<\"h2\"> = useCallback(\n (props) => ({\n id: titleId,\n ...props,\n }),\n [titleId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({\n id: bodyId,\n ...props,\n }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter<\"footer\"> = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n return {\n open,\n getBodyProps,\n getCloseButtonProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getOpenTriggerProps,\n getOverlayProps,\n getRootProps,\n get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AAM;CAAC,CAC7B;CAEA,MAAM,wBAAA,GAA6CA,MAAAA,YAAAA,EAChD,QAAQ,CAAC,OAAO;EACf,cAAc,EAAE,aAAa;EAC7B,GAAG;EACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,SAAS,OAAO;CAC5C,IACA,CAAC,SAAS,CAAC,CACb;CAEA,MAAM,uBAAA,GAA4CA,MAAAA,YAAAA,EAC/C,QAAQ,CAAC,OAAO;EACf,cAAc,EAAE,aAAa;EAC7B,GAAG;EACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,SAAS,OAAO;CAC5C,IACA,CAAC,SAAS,CAAC,CACb;CAEA,MAAM,mBAAA,GAAyCA,MAAAA,YAAAA,EAC5C,QAAQ,CAAC,MACRC,cAAAA,WACE;EACE,IAAI;EACJ,oBAAoB;EACpB,mBAAmB;EACnB,cAAc;EACd,MAAM;CACR,GACA,OACA,EAAE,UAAU,CACd,CAAC,CAAC,GACJ;EAAC;EAAQ;EAAW;EAAW;CAAO,CACxC;CAEA,MAAM,kBAAA,GAAuCD,MAAAA,YAAAA,EAC1C,WAAW,EACV,GAAG,MACL,IACA,CAAC,CACH;CAEA,MAAM,iBAAA,GAAkCA,MAAAA,YAAAA,EACrC,WAAW;EACV,IAAI;EACJ,GAAG;CACL,IACA,CAAC,OAAO,CACV;CAiBA,OAAO;EACL;EACA,eAAA,GAjB+BA,MAAAA,YAAAA,EAC9B,WAAW;GACV,IAAI;GACJ,GAAG;EACL,IACA,CAAC,MAAM,CAYI;EACX;EACA;EACA;EACA,iBAAA,GAb2CA,MAAAA,YAAAA,EAC1C,WAAW,EACV,GAAG,MACL,IACA,CAAC,CASY;EACb;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -2,6 +2,7 @@
2
2
  const require_ref = require("../../utils/ref.cjs");
3
3
  const require_utils_index = require("../../utils/index.cjs");
4
4
  const require_environment_provider = require("../../core/system/environment-provider.cjs");
5
+ const require_props = require("../../core/components/props.cjs");
5
6
  const require_hooks_use_popper_index = require("../../hooks/use-popper/index.cjs");
6
7
  let react = require("react");
7
8
  //#region src/components/native-popover/use-native-popover.tsx
@@ -62,20 +63,19 @@ const useNativePopover = ({ autoUpdate, disabled = false, elements, flip, gutter
62
63
  ref: require_ref.mergeRefs(ref, anchorRef, refs.setReference)
63
64
  }), [refs.setReference]);
64
65
  const getPositionerProps = (0, react.useCallback)((props) => getPopperProps(props), [getPopperProps]);
65
- const getContentProps = (0, react.useCallback)(({ ref, "aria-describedby": ariaDescribedby, "aria-labelledby": ariaLabelledby, ...props } = {}) => {
66
+ const getContentProps = (0, react.useCallback)((props = {}) => {
66
67
  const hasHeader = !!getDocument()?.getElementById(headerId);
67
68
  const hasBody = !!getDocument()?.getElementById(bodyId);
68
- return {
69
+ return require_props.mergeProps({
69
70
  id: contentId,
70
- "aria-describedby": (0, require_utils_index.utils_exports.cx)(ariaDescribedby, hasBody ? bodyId : void 0),
71
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, hasHeader ? headerId : void 0),
71
+ ref: contentRef,
72
+ "aria-describedby": hasBody ? bodyId : void 0,
73
+ "aria-labelledby": hasHeader ? headerId : void 0,
72
74
  "data-popup": (0, require_utils_index.utils_exports.dataAttr)(true),
73
75
  popover: popover === true ? "" : popover,
74
76
  role: "dialog",
75
- tabIndex: -1,
76
- ...props,
77
- ref: require_ref.mergeRefs(ref, contentRef)
78
- };
77
+ tabIndex: -1
78
+ }, props)();
79
79
  }, [
80
80
  getDocument,
81
81
  headerId,
@@ -1 +1 @@
1
- {"version":3,"file":"use-native-popover.cjs","names":["useEnvironment","useId","useRef","usePopper","useCallback","mergeRefs"],"sources":["../../../../src/components/native-popover/use-native-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent, RefObject } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport { usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n} from \"../../utils\"\n\nexport interface UseNativePopoverProps extends UsePopperProps<\"button\"> {\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: UsePopperProps[\"placement\"]\n /**\n * The mode of the popover.\n *\n * @default 'auto'\n */\n popover?: \"\" | \"auto\" | \"hint\" | \"manual\" | true\n /**\n * The target element ID for the popover trigger.\n * If not provided, a generated ID will be used.\n */\n popoverTarget?: string\n /**\n * The action for the popover target.\n *\n * @default 'toggle'\n */\n popoverTargetAction?: \"hide\" | \"show\" | \"toggle\"\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const useNativePopover = ({\n autoUpdate,\n disabled = false,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n placement = \"end\",\n platform,\n popover = \"auto\",\n popoverTarget,\n popoverTargetAction = \"toggle\",\n preventOverflow,\n strategy,\n transform,\n updateRef,\n whileElementsMounted,\n}: UseNativePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const generatedContentId = useId()\n const contentId = popoverTarget ?? generatedContentId\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLButtonElement>) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [disabled],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => {\n return {\n type: \"button\",\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-haspopup\": \"dialog\",\n popoverTarget: contentId,\n popoverTargetAction,\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onClick: handlerAll(props.onClick, onClick),\n }\n },\n [contentId, disabled, onClick, popoverTargetAction, refs],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({\n ref,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n } = {}) => {\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n return {\n id: contentId,\n \"aria-describedby\": cx(ariaDescribedby, hasBody ? bodyId : undefined),\n \"aria-labelledby\": cx(ariaLabelledby, hasHeader ? headerId : undefined),\n \"data-popup\": dataAttr(true),\n popover: popover === true ? \"\" : popover,\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n }\n },\n [getDocument, headerId, bodyId, contentId, popover],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n popoverTarget: contentId,\n popoverTargetAction: \"hide\",\n ...props,\n }\n },\n [contentId],\n )\n\n return {\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }\n}\n\nexport type UseNativePopoverReturn = ReturnType<typeof useNativePopover>\n"],"mappings":";;;;;;;AAqDA,MAAa,oBAAoB,EAC/B,YACA,WAAW,OACX,UACA,MACA,QACA,YACA,YACA,QACA,YAAY,OACZ,UACA,UAAU,QACV,eACA,sBAAsB,UACtB,iBACA,UACA,WACA,WACA,yBACyB,CAAC,MAAM;CAChC,MAAM,EAAE,gBAAgBA,6BAAAA,eAAe;CACvC,MAAM,YAAA,GAAWC,MAAAA,MAAAA,CAAM;CACvB,MAAM,UAAA,GAASA,MAAAA,MAAAA,CAAM;CACrB,MAAM,sBAAA,GAAqBA,MAAAA,MAAAA,CAAM;CACjC,MAAM,YAAY,iBAAiB;CACnC,MAAM,aAAA,GAAYC,MAAAA,OAAAA,CAAoB,IAAI;CAC1C,MAAM,cAAA,GAAaA,MAAAA,OAAAA,CAA0B,IAAI;CACjD,MAAM,cAAA,GAAaA,MAAAA,OAAAA,CAAuB,IAAI;CAC9C,MAAM,EAAE,MAAM,QAAQ,mBAAmBC,+BAAAA,UAAoB;EAC3D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,YAAA,UAAU,WAAW,MAAM;CAE3B,MAAM,WAAA,GAAUC,MAAAA,YAAAA,EACb,OAAsC;EACrC,IAAI,CAAC,UAAU;EAEf,GAAG,eAAe;EAClB,GAAG,gBAAgB;CACrB,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,mBAAA,GAAwCA,MAAAA,YAAAA,EAC3C,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM;EAC1B,OAAO;GACL,MAAM;GACN,iBAAiB;GACjB,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,QAAQ;GAClC,iBAAiB;GACjB,eAAe;GACf;GACA,MAAM;GACN,GAAG;GACH,KAAKC,YAAAA,UAAU,KAAK,a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,YAAAA,EAC9B,WAAW;EAAE,IAAI;EAAQ,GAAG;CAAM,IACnC,CAAC,MAAM,CACT;CAEA,MAAM,kBAAA,GAA6BA,MAAAA,YAAAA,EAAa,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,CAAC;CAa5E,OAAO;EACL;EACA;EACA,uBAAA,GAdiDA,MAAAA,YAAAA,EAChD,QAAQ,CAAC,MAAM;GACd,OAAO;IACL,eAAe;IACf,qBAAqB;IACrB,GAAG;GACL;EACF,GACA,CAAC,SAAS,CAMS;EACnB;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-native-popover.cjs","names":["useEnvironment","useId","useRef","usePopper","useCallback","mergeRefs","mergeProps"],"sources":["../../../../src/components/native-popover/use-native-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent, RefObject } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n dataAttr,\n handlerAll,\n mergeRefs,\n} from \"../../utils\"\n\nexport interface UseNativePopoverProps extends UsePopperProps<\"button\"> {\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: UsePopperProps[\"placement\"]\n /**\n * The mode of the popover.\n *\n * @default 'auto'\n */\n popover?: \"\" | \"auto\" | \"hint\" | \"manual\" | true\n /**\n * The target element ID for the popover trigger.\n * If not provided, a generated ID will be used.\n */\n popoverTarget?: string\n /**\n * The action for the popover target.\n *\n * @default 'toggle'\n */\n popoverTargetAction?: \"hide\" | \"show\" | \"toggle\"\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const useNativePopover = ({\n autoUpdate,\n disabled = false,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n placement = \"end\",\n platform,\n popover = \"auto\",\n popoverTarget,\n popoverTargetAction = \"toggle\",\n preventOverflow,\n strategy,\n transform,\n updateRef,\n whileElementsMounted,\n}: UseNativePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const generatedContentId = useId()\n const contentId = popoverTarget ?? generatedContentId\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLButtonElement>) => {\n if (!disabled) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [disabled],\n )\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => {\n return {\n type: \"button\",\n \"aria-controls\": contentId,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-haspopup\": \"dialog\",\n popoverTarget: contentId,\n popoverTargetAction,\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onClick: handlerAll(props.onClick, onClick),\n }\n },\n [contentId, disabled, onClick, popoverTargetAction, refs],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) => {\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n return mergeProps(\n {\n id: contentId,\n ref: contentRef,\n \"aria-describedby\": hasBody ? bodyId : undefined,\n \"aria-labelledby\": hasHeader ? headerId : undefined,\n \"data-popup\": dataAttr(true),\n popover: popover === true ? \"\" : popover,\n role: \"dialog\",\n tabIndex: -1,\n },\n props,\n )()\n },\n [getDocument, headerId, bodyId, contentId, popover],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n popoverTarget: contentId,\n popoverTargetAction: \"hide\",\n ...props,\n }\n },\n [contentId],\n )\n\n return {\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }\n}\n\nexport type UseNativePopoverReturn = ReturnType<typeof useNativePopover>\n"],"mappings":";;;;;;;;AAoDA,MAAa,oBAAoB,EAC/B,YACA,WAAW,OACX,UACA,MACA,QACA,YACA,YACA,QACA,YAAY,OACZ,UACA,UAAU,QACV,eACA,sBAAsB,UACtB,iBACA,UACA,WACA,WACA,yBACyB,CAAC,MAAM;CAChC,MAAM,EAAE,gBAAgBA,6BAAAA,eAAe;CACvC,MAAM,YAAA,GAAWC,MAAAA,MAAAA,CAAM;CACvB,MAAM,UAAA,GAASA,MAAAA,MAAAA,CAAM;CACrB,MAAM,sBAAA,GAAqBA,MAAAA,MAAAA,CAAM;CACjC,MAAM,YAAY,iBAAiB;CACnC,MAAM,aAAA,GAAYC,MAAAA,OAAAA,CAAoB,IAAI;CAC1C,MAAM,cAAA,GAAaA,MAAAA,OAAAA,CAA0B,IAAI;CACjD,MAAM,cAAA,GAAaA,MAAAA,OAAAA,CAAuB,IAAI;CAC9C,MAAM,EAAE,MAAM,QAAQ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,KAAK;GACL,oBAAoB,UAAU,SAAS,KAAA;GACvC,mBAAmB,YAAY,WAAW,KAAA;GAC1C,eAAA,GAAA,oBAAA,cAAc,SAAA,CAAS,IAAI;GAC3B,SAAS,YAAY,OAAO,KAAK;GACjC,MAAM;GACN,UAAU;EACZ,GACA,KACF,CAAC,CAAC;CACJ,GACA;EAAC;EAAa;EAAU;EAAQ;EAAW;CAAO,CACpD;CAEA,MAAM,kBAAA,GAA6BF,MAAAA,YAAAA,EAChC,WAAW;EAAE,IAAI;EAAU,GAAG;CAAM,IACrC,CAAC,QAAQ,CACX;CAEA,MAAM,gBAAA,GAA2BA,MAAAA,YAAAA,EAC9B,WAAW;EAAE,IAAI;EAAQ,GAAG;CAAM,IACnC,CAAC,MAAM,CACT;CAEA,MAAM,kBAAA,GAA6BA,MAAAA,YAAAA,EAAa,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,CAAC;CAa5E,OAAO;EACL;EACA;EACA,uBAAA,GAdiDA,MAAAA,YAAAA,EAChD,QAAQ,CAAC,MAAM;GACd,OAAO;IACL,eAAe;IACf,qBAAqB;IACrB,GAAG;GACL;EACF,GACA,CAAC,SAAS,CAMS;EACnB;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -133,24 +133,25 @@ const usePinInput = (props = {}) => {
133
133
  return {
134
134
  descendants,
135
135
  items,
136
- getInputProps: (0, react.useCallback)(({ "aria-labelledby": ariaLabelledby, index, ...props }) => ({
136
+ getInputProps: (0, react.useCallback)(({ index, ...props }) => require_props.mergeProps({
137
137
  ...ariaProps,
138
138
  ...dataProps,
139
+ ...eventProps,
139
140
  type: mask ? "password" : type === "number" ? "tel" : "text",
140
- "aria-labelledby": (0, require_utils_index.utils_exports.cx)(ariaLabelledby, labelId),
141
+ "aria-labelledby": labelId,
141
142
  autoComplete: otp ? "one-time-code" : "off",
142
143
  disabled,
143
144
  inputMode: type === "number" ? "numeric" : "text",
144
145
  placeholder: focusedIndex === index && !readOnly && !props.readOnly ? "" : placeholder,
145
146
  readOnly,
146
- value: values[index] || "",
147
- ...(0, require_utils_index.utils_exports.filterUndefined)(props),
147
+ value: values[index] || ""
148
+ }, (0, require_utils_index.utils_exports.filterUndefined)(props), {
148
149
  id: `${id}${index ? `-${index}` : ""}`,
149
- onBlur: (0, require_utils_index.utils_exports.handlerAll)(eventProps.onBlur, props.onBlur, onBlur),
150
- onChange: (0, require_utils_index.utils_exports.handlerAll)(props.onChange, onChange(index)),
151
- onFocus: (0, require_utils_index.utils_exports.handlerAll)(eventProps.onFocus, props.onFocus, onFocus(index)),
152
- onKeyDown: (0, require_utils_index.utils_exports.handlerAll)(props.onKeyDown, onKeyDown(index))
153
- }), [
150
+ onBlur,
151
+ onChange: onChange(index),
152
+ onFocus: onFocus(index),
153
+ onKeyDown: onKeyDown(index)
154
+ })(), [
154
155
  ariaProps,
155
156
  dataProps,
156
157
  eventProps,