@ryuzaki13/react-foundation-ui 2.0.1 → 2.2.0
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.
- package/COLOR_TOKENS_MIGRATION.md +224 -0
- package/README.md +14 -18
- package/dist/advanced-search/index.js +8 -8
- package/dist/badge/index.js +1 -1
- package/dist/barcode-scanner/index.js +2 -2
- package/dist/base-table/index.js +1 -1
- package/dist/button/index.js +1 -1
- package/dist/check-box/index.js +1 -1
- package/dist/chunks/{CalendarView-Bhaov_XE.js → CalendarView-Dm55k0bN.js} +2 -2
- package/dist/chunks/CalendarView-Dm55k0bN.js.map +1 -0
- package/dist/chunks/ImageViewerRuntime-HGBWp9NM.js.map +1 -1
- package/dist/chunks/{TextEditorLexicalClient-CSXZQOYo.js → TextEditorLexicalClient-D46Zed55.js} +6 -6
- package/dist/chunks/TextEditorLexicalClient-D46Zed55.js.map +1 -0
- package/dist/chunks/{badge-DUI2ET6q.js → badge-6mXO9BWP.js} +2 -2
- package/dist/chunks/badge-6mXO9BWP.js.map +1 -0
- package/dist/chunks/{base-table-BqW1n7tv.js → base-table-BWvKfI2W.js} +2 -2
- package/dist/chunks/{base-table-BqW1n7tv.js.map → base-table-BWvKfI2W.js.map} +1 -1
- package/dist/chunks/{button-BaUlN-nt.js → button-DF21yxVp.js} +3 -3
- package/dist/chunks/{button-BaUlN-nt.js.map → button-DF21yxVp.js.map} +1 -1
- package/dist/chunks/{check-box-CC8CDnSR.js → check-box-CZyhzmR0.js} +3 -3
- package/dist/chunks/{check-box-CC8CDnSR.js.map → check-box-CZyhzmR0.js.map} +1 -1
- package/dist/chunks/{context-menu-Dj6MXgv6.js → context-menu-DgvXGCuI.js} +3 -3
- package/dist/chunks/context-menu-DgvXGCuI.js.map +1 -0
- package/dist/chunks/{date-input-DkLfO3Ng.js → date-input-BwLOiGXp.js} +5 -5
- package/dist/chunks/{date-input-DkLfO3Ng.js.map → date-input-BwLOiGXp.js.map} +1 -1
- package/dist/chunks/{input-D1jOxm0t.js → input-DSPKgiCK.js} +2 -2
- package/dist/chunks/input-DSPKgiCK.js.map +1 -0
- package/dist/chunks/{input-files-CDGpJaUm.js → input-files-tIS17-zX.js} +3 -3
- package/dist/chunks/input-files-tIS17-zX.js.map +1 -0
- package/dist/chunks/{input-search-Ci1ubGox.js → input-search-Cat4c7SM.js} +2 -2
- package/dist/chunks/{input-search-Ci1ubGox.js.map → input-search-Cat4c7SM.js.map} +1 -1
- package/dist/chunks/misc-DeGboAt-.js.map +1 -1
- package/dist/chunks/{modal-CbAwLHlM.js → modal-dplfAaER.js} +2 -2
- package/dist/chunks/{modal-CbAwLHlM.js.map → modal-dplfAaER.js.map} +1 -1
- package/dist/chunks/{multi-select-V7SLAduU.js → multi-select-BZ9N6Dal.js} +4 -4
- package/dist/chunks/{multi-select-V7SLAduU.js.map → multi-select-BZ9N6Dal.js.map} +1 -1
- package/dist/chunks/{picker-DZ4-1BvK.js → picker-lvm82d0A.js} +3 -3
- package/dist/chunks/picker-lvm82d0A.js.map +1 -0
- package/dist/chunks/popover-Bne-Ljbs.js.map +1 -1
- package/dist/chunks/{radio-group-DhpP7JSJ.js → radio-group-CRk_1ODZ.js} +2 -2
- package/dist/chunks/radio-group-CRk_1ODZ.js.map +1 -0
- package/dist/chunks/{select-B7cWlJxL.js → select-aTGupQan.js} +4 -4
- package/dist/chunks/{select-B7cWlJxL.js.map → select-aTGupQan.js.map} +1 -1
- package/dist/chunks/{table-DMLFUBlb.js → table-DxoSOvQK.js} +2 -2
- package/dist/chunks/table-DxoSOvQK.js.map +1 -0
- package/dist/chunks/{ui.module-BsDio9A3.js → ui.module-oRwY3Zli.js} +2 -1
- package/dist/chunks/ui.module-oRwY3Zli.js.map +1 -0
- package/dist/chunks/{uiClasses-BVwFzzsr.js → uiClasses-CQj47jkF.js} +11 -2
- package/dist/chunks/uiClasses-CQj47jkF.js.map +1 -0
- package/dist/chunks/wheel-picker-FS58cRsQ.js.map +1 -1
- package/dist/context-menu/index.js +1 -1
- package/dist/date-input/index.js +2 -2
- package/dist/date-time-input/index.js +3 -3
- package/dist/disclosure/index.js +2 -2
- package/dist/disclosure/index.js.map +1 -1
- package/dist/drop-zone/index.js +1 -1
- package/dist/drop-zone/index.js.map +1 -1
- package/dist/errors/index.js +4 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/expandable-action-panel/index.js +1 -1
- package/dist/image/index.js +5 -5
- package/dist/image/index.js.map +1 -1
- package/dist/input/index.js +1 -1
- package/dist/input-date-time/index.js +2 -2
- package/dist/input-file/index.js +2 -2
- package/dist/input-files/index.js +1 -1
- package/dist/input-image/index.js +2 -2
- package/dist/input-search/index.js +1 -1
- package/dist/layout-picker/index.js +1 -1
- package/dist/layout-picker/index.js.map +1 -1
- package/dist/listbox/index.js +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/multi-select/index.js +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/index.js.map +1 -1
- package/dist/option/index.js +1 -1
- package/dist/picker/index.js +1 -1
- package/dist/preset-range-date-input/index.js +1 -1
- package/dist/preset-select/index.js +1 -1
- package/dist/radio-button/index.js +2 -2
- package/dist/radio-group/index.js +1 -1
- package/dist/select/index.js +1 -1
- package/dist/simple-table/index.js +1 -1
- package/dist/slider/index.js +3 -3
- package/dist/slider/index.js.map +1 -1
- package/dist/state-select/index.js +1 -1
- package/dist/status-indicator/StatusIndicator.d.ts +14 -0
- package/dist/status-indicator/StatusIndicator.d.ts.map +1 -0
- package/dist/status-indicator/index.d.ts +2 -0
- package/dist/status-indicator/index.d.ts.map +1 -0
- package/dist/status-indicator/index.js +40 -0
- package/dist/status-indicator/index.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table-sorting/index.js +1 -1
- package/dist/tabs/index.js +2 -2
- package/dist/tabs/index.js.map +1 -1
- package/dist/tag-input/index.js +2 -2
- package/dist/tag-input/index.js.map +1 -1
- package/dist/text-editor/index.js +1 -1
- package/dist/textarea/index.js +2 -2
- package/dist/toggle/index.js +1 -1
- package/dist/toggle/index.js.map +1 -1
- package/dist/tree-select/index.js +3 -3
- package/dist/tree-select/index.js.map +1 -1
- package/dist/tree-table/index.js +1 -1
- package/dist/tree-table/index.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/uiClasses.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/styles/_border.scss +2 -2
- package/src/styles/_color.scss +8 -8
- package/src/styles/_components.scss +2 -2
- package/src/styles/_normalize.scss +4 -4
- package/src/styles/config/_index.scss +95 -182
- package/src/styles/mixins/_controls.scss +43 -26
- package/src/styles/mixins/_mixin.scss +0 -187
- package/src/styles/mixins/controls.test.ts +28 -6
- package/src/styles/themes/_interactive-surface.scss +12 -12
- package/src/styles/themes/_theme.scss +21 -157
- package/src/styles/themes/theme.test.ts +66 -48
- package/storybook-static/assets/{Badge-DTV2OL5k.js → Badge-S6BbyfeX.js} +8 -2
- package/storybook-static/assets/{Badge.stories-D4zH_nK5.js → Badge.stories-mio0RhpX.js} +7 -1
- package/storybook-static/assets/{BadgeList-CD5894x5.css → BadgeList-DbjeNuw0.css} +1 -1
- package/storybook-static/assets/{BadgeList-CnmQ4zmg.js → BadgeList-rtyargPY.js} +2 -2
- package/storybook-static/assets/{BarcodeScannerDialog.stories-Cm7ouwg8.js → BarcodeScannerDialog.stories-DRdXaVuW.js} +1 -1
- package/storybook-static/assets/{Button-6JuiM3Sj.js → Button-CNH5M6QU.js} +12 -2
- package/storybook-static/assets/{Button-HheQm8vu.js → Button-EVzvXVPh.js} +4 -2
- package/storybook-static/assets/Button.stories-VUvnWRnm.js +106 -0
- package/storybook-static/assets/{CalendarView-CEfB4HLd.js → CalendarView-CfSvCqCr.js} +1 -1
- package/storybook-static/assets/CalendarView-dgpVDRJR.css +1 -0
- package/storybook-static/assets/{CheckBox-CWGCGHUS.js → CheckBox-Bynxp5UW.js} +1 -1
- package/storybook-static/assets/{CheckBox-CzvA4ttT.js → CheckBox-C3n5T66c.js} +2 -2
- package/storybook-static/assets/{CheckBox.stories-D2lA5F8B.js → CheckBox.stories-BoF97wxK.js} +1 -1
- package/storybook-static/assets/{Color-6AOWCN3U-RvvVvZ9f.js → Color-6AOWCN3U-D-Jlgqzt.js} +1 -1
- package/storybook-static/assets/{ContextMenu-BJnj7lO4.js → ContextMenu-Dg65Ha7g.js} +1 -1
- package/storybook-static/assets/{ContextMenu-DCpglNe4.js → ContextMenu-DwwW3EyB.js} +1 -1
- package/storybook-static/assets/ContextMenu-yhWq2uJ3.css +1 -0
- package/storybook-static/assets/{ContextMenu.stories-CZabvzR6.js → ContextMenu.stories-D-jRdIZD.js} +1 -1
- package/storybook-static/assets/{CustomOptionButton-B9bzr3ba.js → CustomOptionButton-vfj1vLJM.js} +1 -1
- package/storybook-static/assets/{DateInput-DoMGeEvO.js → DateInput-BpuC_NWD.js} +1 -1
- package/storybook-static/assets/{DateInput-Cud2arem.js → DateInput-DJdh5B2X.js} +1 -1
- package/storybook-static/assets/{DateInput.stories-DFd5wyMy.js → DateInput.stories-C9hB_vFy.js} +1 -1
- package/storybook-static/assets/{DateRangePresetSelect-DfGcFHV8.js → DateRangePresetSelect-CDgQfOdZ.js} +1 -1
- package/storybook-static/assets/{DateRangePresetSelect-C8jA3mur.js → DateRangePresetSelect-DYPoeqC2.js} +1 -1
- package/storybook-static/assets/{DateRangePresetSelect.stories-DtR83uwx.js → DateRangePresetSelect.stories-Bx40H_O0.js} +1 -1
- package/storybook-static/assets/{Detail-CMcVxOrr.js → Detail-DWFfdNJH.js} +1 -1
- package/storybook-static/assets/{Detail.stories-DGT8An8z.js → Detail.stories-C9y_rsbc.js} +1 -1
- package/storybook-static/assets/{Dialog-DBh-yDZW.js → Dialog-D8GPZi6H.js} +1 -1
- package/storybook-static/assets/{Dialog-BPzpu7Iw.js → Dialog-XbR8HVsJ.js} +1 -1
- package/storybook-static/assets/{Dialog.stories-DU3SgOkL.js → Dialog.stories-CoU_PusF.js} +1 -1
- package/storybook-static/assets/{Disclosure-BGsPaAxH.js → Disclosure-DrGfFwQt.js} +1 -1
- package/storybook-static/assets/{Disclosure.stories-DpwyYh7T.js → Disclosure.stories-CsR1_XK7.js} +1 -1
- package/storybook-static/assets/DisclosureGroup-D_ldcGgp.css +1 -0
- package/storybook-static/assets/{DisclosureGroup-CJI8B2x_.js → DisclosureGroup-DvB5K7gZ.js} +1 -1
- package/storybook-static/assets/{DocsRenderer-JROSPFPF-Cf85Uxwt.js → DocsRenderer-JROSPFPF-B7AkTp2I.js} +1 -1
- package/storybook-static/assets/{DropZone-C7HIN5ml.css → DropZone-C4gPTIz0.css} +1 -1
- package/storybook-static/assets/{DropZone-C7qTrvkq.js → DropZone-DZi2WVu9.js} +1 -1
- package/storybook-static/assets/{DropZone-cYl1w3wQ.js → DropZone-DesGY4BW.js} +1 -1
- package/storybook-static/assets/{DropZone.stories-o02bE6DI.js → DropZone.stories-KVDb6pHQ.js} +1 -1
- package/storybook-static/assets/{DropdownMenu-DqqPU9RU.js → DropdownMenu-CRoQARS5.js} +1 -1
- package/storybook-static/assets/{ExpandableActionPanel-B_pjHQ5m.js → ExpandableActionPanel-CWKJIcbQ.js} +1 -1
- package/storybook-static/assets/{ExpandableActionPanel.stories-C7dJ5dht.js → ExpandableActionPanel.stories-D-MYdCJ4.js} +1 -1
- package/storybook-static/assets/{Flex-CIHkkwFK.js → Flex-CMPSlVVy.js} +1 -1
- package/storybook-static/assets/{Flex.stories-DteEPY0y.js → Flex.stories-DQH0Q5EF.js} +1 -1
- package/storybook-static/assets/{FloatingPopover-yB9tTk9G.js → FloatingPopover-CBWu6Gxj.js} +1 -1
- package/storybook-static/assets/FloatingPopover-Di16BZj-.css +1 -0
- package/storybook-static/assets/{FormattedTableCell-QVYQepjk.js → FormattedTableCell-CIp2ULPe.js} +1 -1
- package/storybook-static/assets/FormattedTableCell-CTIL_ueu.css +1 -0
- package/storybook-static/assets/{Grid-BUVtGaZY.js → Grid-BlQE5E_9.js} +1 -1
- package/storybook-static/assets/{Grid.stories-CWGqCVB2.js → Grid.stories-CwUCPClP.js} +1 -1
- package/storybook-static/assets/{ImageCropper.stories-D8l7iHQA.js → ImageCropper.stories-DjaRavSL.js} +1 -1
- package/storybook-static/assets/{ImageRenderer-BcPmp9P9.js → ImageRenderer-JGxgpvv2.js} +1 -1
- package/storybook-static/assets/{ImageRenderer.stories-CcLUz8Ml.js → ImageRenderer.stories-DwH6FgEc.js} +1 -1
- package/storybook-static/assets/{ImageView.stories-BwvjVmuF.js → ImageView.stories-DgYPiNil.js} +1 -1
- package/storybook-static/assets/{ImageViewer.stories-BjT782dr.js → ImageViewer.stories-_y7d3coa.js} +2 -2
- package/storybook-static/assets/{ImageViewerRuntime-DnQ-rQ_M.js → ImageViewerRuntime-CA6JhQ31.js} +1 -1
- package/storybook-static/assets/ImageViewerRuntime-MxAd4mC-.css +1 -0
- package/storybook-static/assets/{Input-DebpyMJg.js → Input-95LKm7aK.js} +1 -1
- package/storybook-static/assets/{Input-CmEkIaR0.js → Input-CET6HfZH.js} +1 -1
- package/storybook-static/assets/{Input-CYgnggvb.css → Input-CIA3PkB4.css} +1 -1
- package/storybook-static/assets/{Input.stories-y2LCVkT2.js → Input.stories-BDTI2nIV.js} +1 -1
- package/storybook-static/assets/{InputDateTime-B5oKuCea.js → InputDateTime-DsRJZVCO.js} +1 -1
- package/storybook-static/assets/{InputDateTime.stories-Cwi0acf9.js → InputDateTime.stories-Dah3F9Fq.js} +1 -1
- package/storybook-static/assets/{InputFile-B2dVbDrE.js → InputFile-CF3DRyTX.js} +1 -1
- package/storybook-static/assets/{InputFile-DbRU7crz.js → InputFile-_65sKWXa.js} +1 -1
- package/storybook-static/assets/{InputFile.stories-DrXG5hWA.js → InputFile.stories-B1PFNFPf.js} +1 -1
- package/storybook-static/assets/{InputFiles-DEBKMzlt.js → InputFiles-CUYGDig8.js} +1 -1
- package/storybook-static/assets/{InputFiles-CsgKJXOD.js → InputFiles-RV6K6GmT.js} +1 -1
- package/storybook-static/assets/{InputFiles.stories-EZDcefG0.js → InputFiles.stories-ZCzYnboY.js} +1 -1
- package/storybook-static/assets/{InputFilesList-ByK52qUe.css → InputFilesList-BbwB0oHE.css} +1 -1
- package/storybook-static/assets/{InputFilesList-GjMJ14Ln.js → InputFilesList-Co__UO8B.js} +1 -1
- package/storybook-static/assets/{InputImage-qjJ7xrKX.js → InputImage-900lIdui.js} +1 -1
- package/storybook-static/assets/{InputImage-CFFK9MbG.js → InputImage-De56Jwx9.js} +1 -1
- package/storybook-static/assets/{InputImage.stories-B32AtBda.js → InputImage.stories-B_R_kcCD.js} +1 -1
- package/storybook-static/assets/{InteractiveComponents-DustBT4l.js → InteractiveComponents-DGTx8enm.js} +1 -1
- package/storybook-static/assets/{InteractiveComponents.stories-J-7t7y-v.js → InteractiveComponents.stories-CDZsFUga.js} +1 -1
- package/storybook-static/assets/{LayoutPicker-DwNtjoeb.js → LayoutPicker-BMO8qfbL.js} +1 -1
- package/storybook-static/assets/{LayoutPicker-DlzXd6kS.js → LayoutPicker-CllhDO8J.js} +1 -1
- package/storybook-static/assets/{LayoutPicker-BY4-fUQa.css → LayoutPicker-DaPDA0_s.css} +1 -1
- package/storybook-static/assets/{LayoutPicker.stories-2bG0TvXm.js → LayoutPicker.stories-F7K4tSxT.js} +1 -1
- package/storybook-static/assets/{Listbox-BAhrUu_I.js → Listbox-0kjmvCe-.js} +1 -1
- package/storybook-static/assets/{Listbox-C9qCMY31.js → Listbox-D_2t3NpM.js} +1 -1
- package/storybook-static/assets/{Listbox.stories-BfakOrPT.js → Listbox.stories-Cp1Eq7Bz.js} +1 -1
- package/storybook-static/assets/{Modal-wGyoEzau.js → Modal-vdSwQ6xw.js} +1 -1
- package/storybook-static/assets/{Modal-D5znEvBs.js → Modal-zf0JQ124.js} +1 -1
- package/storybook-static/assets/{Modal.stories-DotZ88Ut.js → Modal.stories-Cz47rY2B.js} +1 -1
- package/storybook-static/assets/{ModalManagerProvider-DXPaYU4j.js → ModalManagerProvider-C_zd0fqC.js} +1 -1
- package/storybook-static/assets/{MultiSelect-BxKmL7sF.js → MultiSelect-Bl3q6kCP.js} +1 -1
- package/storybook-static/assets/{MultiSelect-DN1NhXH9.js → MultiSelect-DE13Ak4N.js} +1 -1
- package/storybook-static/assets/{MultiSelect.stories-Cdrx9hhT.js → MultiSelect.stories-DG6LGTC9.js} +1 -1
- package/storybook-static/assets/{NoData-mAjM6Vuy.js → NoData-B4AGZs5Q.js} +1 -1
- package/storybook-static/assets/NotificationsHost-BIyd1XQ0.css +1 -0
- package/storybook-static/assets/{NotificationsHost-gBWuk9v-.js → NotificationsHost-CFD2_BpZ.js} +1 -1
- package/storybook-static/assets/{NotificationsHost.stories-DONKtSKb.js → NotificationsHost.stories-CiSu7Vly.js} +1 -1
- package/storybook-static/assets/{ODataMultiSelect-Daq3ksSA.js → ODataMultiSelect-PcZYhXlN.js} +1 -1
- package/storybook-static/assets/{ODataMultiSelect.stories-De0WwTKp.js → ODataMultiSelect.stories-xodpVftn.js} +1 -1
- package/storybook-static/assets/{ODataSelect-BUO-vyqK.js → ODataSelect-BuuZhINP.js} +1 -1
- package/storybook-static/assets/{ODataSelect.stories-CJ2RCZGP.js → ODataSelect.stories-nr7GqOTz.js} +1 -1
- package/storybook-static/assets/{ODataTreeMultiSelect-Ctyo-uib.js → ODataTreeMultiSelect-BRNITq-6.js} +1 -1
- package/storybook-static/assets/{ODataTreeMultiSelect.stories-BX4wjGkG.js → ODataTreeMultiSelect.stories-Baxtdxte.js} +1 -1
- package/storybook-static/assets/{ODataTreeSelect-BZzwG_Ve.js → ODataTreeSelect-BKcyKJr8.js} +1 -1
- package/storybook-static/assets/{ODataTreeSelect.stories-B0jQNyMj.js → ODataTreeSelect.stories-n6LATF6z.js} +1 -1
- package/storybook-static/assets/{OneStepScroller-BL3gxJh1.js → OneStepScroller-DXykOSPw.js} +1 -1
- package/storybook-static/assets/{Option-JgQ-duDq.js → Option-Cr3vYgCL.js} +1 -1
- package/storybook-static/assets/Option-DD2t6DLq.css +1 -0
- package/storybook-static/assets/{OptionButton-CATaxLh0.js → OptionButton-v-MO3VgJ.js} +1 -1
- package/storybook-static/assets/{PeriodSelect-BIsC_Ew6.js → PeriodSelect-BQ9_EM63.js} +1 -1
- package/storybook-static/assets/{PeriodSelect-4LpRQDP5.js → PeriodSelect-DQXZWIBX.js} +1 -1
- package/storybook-static/assets/{PeriodSelect.stories-D5fKpF2P.js → PeriodSelect.stories-S2ndHVEQ.js} +1 -1
- package/storybook-static/assets/{PickerField-BkqWIWZw.js → PickerField-BeAXSQmp.js} +1 -1
- package/storybook-static/assets/{PickerTriggerActions-BVrXKKJ9.js → PickerTriggerActions-D6BjZkrN.js} +1 -1
- package/storybook-static/assets/{Popover-BTrxASXR.js → Popover-BAp50b4b.js} +1 -1
- package/storybook-static/assets/{Popover-DZlEnjse.js → Popover-CTCfa72M.js} +1 -1
- package/storybook-static/assets/{Popover.stories-BdyB4Q7K.js → Popover.stories-CZIBppwE.js} +1 -1
- package/storybook-static/assets/{PresetRangeDateInput-DUES355B.js → PresetRangeDateInput-BLAAcq8Y.js} +1 -1
- package/storybook-static/assets/{PresetRangeDateInput-Cp66aUGT.js → PresetRangeDateInput-EIlQEGr0.js} +1 -1
- package/storybook-static/assets/{PresetRangeDateInput.stories-D4jLrF6o.js → PresetRangeDateInput.stories-CShR-Eub.js} +1 -1
- package/storybook-static/assets/{PresetSelect-CmRrk7FZ.js → PresetSelect-BcD8EsSb.js} +1 -1
- package/storybook-static/assets/{README-CU_f1CMq.js → README-5i5ZfRuh.js} +1 -1
- package/storybook-static/assets/{README-B7BK3gkk.js → README-6iRo8dKK.js} +1 -1
- package/storybook-static/assets/{README-BCNsNQNj.js → README-6vpPfmdC.js} +1 -1
- package/storybook-static/assets/{README-DNUrBjgg.js → README-B2J2ATaW.js} +1 -1
- package/storybook-static/assets/{README-BUknkyU6.js → README-B8qFKwiq.js} +1 -1
- package/storybook-static/assets/{README-BmKEL3jy.js → README-BBS739kV.js} +1 -1
- package/storybook-static/assets/{README-B00ewV67.js → README-BDMWo0qS.js} +1 -1
- package/storybook-static/assets/{README-DgudM-2t.js → README-BIpHKVKI.js} +1 -1
- package/storybook-static/assets/{README-CmK6hELS.js → README-BQHgBs-J.js} +1 -1
- package/storybook-static/assets/{README-D7jyja4l.js → README-BUlc8wGR.js} +1 -1
- package/storybook-static/assets/{README-CHw6-PVx.js → README-BW1oyMu_.js} +1 -1
- package/storybook-static/assets/{README-C28SDMRx.js → README-BdBeQtXQ.js} +1 -1
- package/storybook-static/assets/{README-LqD1V5ru.js → README-BkX7iDLJ.js} +1 -1
- package/storybook-static/assets/{README-D-TgbUSA.js → README-BnTk0DyO.js} +1 -1
- package/storybook-static/assets/{README-CnRKlFuJ.js → README-Bwv6SU5o.js} +1 -1
- package/storybook-static/assets/{README-Ds6OSOC0.js → README-CLiuh-fF.js} +1 -1
- package/storybook-static/assets/{README-BGA2Ek3H.js → README-CLv4OeWw.js} +1 -1
- package/storybook-static/assets/{README-BrJaVHU_.js → README-CMBk39py.js} +1 -1
- package/storybook-static/assets/{README-DPuLgYuK.js → README-CQUlYRLa.js} +1 -1
- package/storybook-static/assets/{README-BhRGrTHx.js → README-CVX-4uJ_.js} +1 -1
- package/storybook-static/assets/{README-Bq8FLza7.js → README-CWeupyTO.js} +1 -1
- package/storybook-static/assets/{README-E5QziGK8.js → README-CZJvbdGv.js} +1 -1
- package/storybook-static/assets/{README-B4CJVRtX.js → README-CaECsCl2.js} +1 -1
- package/storybook-static/assets/{README-52AHLz83.js → README-Cntj7my4.js} +1 -1
- package/storybook-static/assets/{README-D6pLFtqL.js → README-CuGPdc3G.js} +1 -1
- package/storybook-static/assets/{README-D8YPmvQw.js → README-D7pP2Sxx.js} +1 -1
- package/storybook-static/assets/{README-Cs-dnvtW.js → README-D9Og-Y7l.js} +1 -1
- package/storybook-static/assets/{README-Duppk6f6.js → README-DDtdZa9N.js} +1 -1
- package/storybook-static/assets/{README-B20cH-BV.js → README-DLQvRDdd.js} +1 -1
- package/storybook-static/assets/{README-BfGp1q9n.js → README-DQpji8GH.js} +1 -1
- package/storybook-static/assets/{README-Bh_zrJ_j.js → README-DUfqdm0p.js} +1 -1
- package/storybook-static/assets/{README-55mkSTZb.js → README-Dd3MCsf2.js} +1 -1
- package/storybook-static/assets/{README-CPYFZwZE.js → README-DehKWpx2.js} +1 -1
- package/storybook-static/assets/{README-lgRhlVsq.js → README-DgFtCu8B.js} +1 -1
- package/storybook-static/assets/{README-C8Xo5jEX.js → README-DhZbllv1.js} +1 -1
- package/storybook-static/assets/{README-DvZ8ZhlH.js → README-Dj9EXnja.js} +1 -1
- package/storybook-static/assets/{README-CzKPWsNs.js → README-DkCWpyid.js} +1 -1
- package/storybook-static/assets/{README-C_SQjJtW.js → README-Dn2AIjeS.js} +1 -1
- package/storybook-static/assets/{README-DG5knhc9.js → README-DoZCaKAx.js} +1 -1
- package/storybook-static/assets/{README-DK-Bw1l1.js → README-DsLoV4ax.js} +1 -1
- package/storybook-static/assets/{README-BlWMNqE5.js → README-DwvyizD7.js} +1 -1
- package/storybook-static/assets/{README--fYBobJK.js → README-DwyqrR4I.js} +1 -1
- package/storybook-static/assets/{README-DyLt9P77.js → README-N-Gy0UYM.js} +1 -1
- package/storybook-static/assets/{README-DzVNZdfo.js → README-Wd5wEw-J.js} +1 -1
- package/storybook-static/assets/{README-CoD7FHU_.js → README-Y4OGhQbo.js} +1 -1
- package/storybook-static/assets/{README-EIhMMZ0t.js → README-ZZiicHm9.js} +1 -1
- package/storybook-static/assets/{README-BsUvf6lk.js → README-bAu0Uk5O.js} +1 -1
- package/storybook-static/assets/{README-B9foBRQ-.js → README-cuvbXAuG.js} +1 -1
- package/storybook-static/assets/{README-DsfBjN9N.js → README-jHuA2mq2.js} +1 -1
- package/storybook-static/assets/{README-C_WyDQDz.js → README-pvA4fK1E.js} +1 -1
- package/storybook-static/assets/{README-4AGJG--w.js → README-sEbspuLw.js} +1 -1
- package/storybook-static/assets/{README-DK-US_zR.js → README-v3TOC_aE.js} +1 -1
- package/storybook-static/assets/{README-BoGNjKgW.js → README-wizqrRgs.js} +1 -1
- package/storybook-static/assets/{RadioButton-CmcExRQs.js → RadioButton-BUPEsqwH.js} +1 -1
- package/storybook-static/assets/{RadioButton-BLHXpf6L.js → RadioButton-Ca0kZdMV.js} +1 -1
- package/storybook-static/assets/{RadioButton.stories-P1SEMdJ1.js → RadioButton.stories-aBnizEak.js} +1 -1
- package/storybook-static/assets/{RadioGroup-DkCSA8me.js → RadioGroup-34jH28Sk.js} +1 -1
- package/storybook-static/assets/{RadioGroup-BU95Hbl0.css → RadioGroup-DHnDIEgi.css} +1 -1
- package/storybook-static/assets/{RadioGroup-BBv2Na1n.js → RadioGroup-dq6CbxB6.js} +1 -1
- package/storybook-static/assets/{RadioGroup.stories-5-uFHs1b.js → RadioGroup.stories--lDrmS8V.js} +1 -1
- package/storybook-static/assets/{Scrollable-XhGz9dwJ.js → Scrollable-BJRiyp9q.js} +1 -1
- package/storybook-static/assets/{Select-BEMtNq5M.js → Select-CwNDJSmq.js} +1 -1
- package/storybook-static/assets/{Select-CyA-PHrU.js → Select-DmwCwS8a.js} +1 -1
- package/storybook-static/assets/{Select.stories-B_GbDG58.js → Select.stories-BXj7A2gM.js} +1 -1
- package/storybook-static/assets/{SerializableSelect-CJ74e_Vc.js → SerializableSelect-IAtBSK9P.js} +1 -1
- package/storybook-static/assets/{SerializableSelect.stories-PUXPFPFx.js → SerializableSelect.stories-D8F5WGtk.js} +1 -1
- package/storybook-static/assets/{SingleDateTimeInput-wqb75Yrz.js → SingleDateTimeInput-CbyyGlmi.js} +1 -1
- package/storybook-static/assets/{SingleDateTimeInput-BlpQ8t9f.js → SingleDateTimeInput-oN2P3eYx.js} +1 -1
- package/storybook-static/assets/{SingleDateTimeInput.stories-CdogRh5M.js → SingleDateTimeInput.stories-BU_wyTmo.js} +1 -1
- package/storybook-static/assets/{Slider-CZa1f0vP.js → Slider-CDJhhSWj.js} +1 -1
- package/storybook-static/assets/{Slider-r8Be9wJ4.js → Slider-ClZTrtRk.js} +1 -1
- package/storybook-static/assets/Slider-DxdPx1Pb.css +1 -0
- package/storybook-static/assets/{Slider.stories-BUwg0h15.js → Slider.stories-PfQf9es7.js} +1 -1
- package/storybook-static/assets/{SliderInput-BWFbcA5R.js → SliderInput-BxFUjetO.js} +1 -1
- package/storybook-static/assets/{SliderInput-BaZBNhhF.js → SliderInput-C7TRql6-.js} +1 -1
- package/storybook-static/assets/{SliderInput.stories-Cbxo0ku_.js → SliderInput.stories-yX8DU5pZ.js} +1 -1
- package/storybook-static/assets/{Sortable-JfLmQUdm.js → Sortable-D8cVwatT.js} +1 -1
- package/storybook-static/assets/{Sortable.stories-Cz9xM3Tw.js → Sortable.stories-BI6_E5k7.js} +1 -1
- package/storybook-static/assets/{Splitter-BkQcPRYJ.js → Splitter-B958Wj4G.js} +1 -1
- package/storybook-static/assets/{Splitter.stories-zQf1fK4D.js → Splitter.stories-Dl2YOk9H.js} +1 -1
- package/storybook-static/assets/{StateSelect-DxH1oWnK.js → StateSelect-Cs9-kDRC.js} +1 -1
- package/storybook-static/assets/{StateSelect-TLRMUmko.js → StateSelect-DbV1mGhQ.js} +1 -1
- package/storybook-static/assets/{StateSelect.stories-CReLNG_6.js → StateSelect.stories-D6atguQ6.js} +1 -1
- package/storybook-static/assets/StatusIndicator--Y-QdjQI.js +37 -0
- package/storybook-static/assets/StatusIndicator-CpCGmnO7.css +1 -0
- package/storybook-static/assets/StatusIndicator.stories-DxkpP6C1.js +31 -0
- package/storybook-static/assets/{StringToggle.stories-BYqTdRbD.js → StringToggle.stories-C3mdK5Wx.js} +1 -1
- package/storybook-static/assets/{Switch-ChsLVAse.js → Switch-BTFpnXV9.js} +1 -1
- package/storybook-static/assets/{Switch-DE9rqHmp.js → Switch-OPzpWcJw.js} +1 -1
- package/storybook-static/assets/{Switch.stories-BaVgLi3_.js → Switch.stories-C0rVHcRq.js} +1 -1
- package/storybook-static/assets/{Table-qoMvYV1q.js → Table-bWKgagHH.js} +1 -1
- package/storybook-static/assets/Table-j_3ID7Xq.css +1 -0
- package/storybook-static/assets/{Table.stories-BdLScKfS.js → Table.stories-DOuV4G3p.js} +1 -1
- package/storybook-static/assets/{Tabs-CuALrdgt.js → Tabs-ae4daDEA.js} +1 -1
- package/storybook-static/assets/{Tabs.stories-BrLtxZ_a.js → Tabs.stories-Br4RCZKR.js} +1 -1
- package/storybook-static/assets/{TabsBox-D-bkJX9j.css → TabsBox-B3REnb6D.css} +1 -1
- package/storybook-static/assets/{TabsBox-DzfWhIHb.js → TabsBox-X_7yoTw3.js} +1 -1
- package/storybook-static/assets/{TagInput-Tyn5Jgus.js → TagInput-B2w5W05Z.js} +1 -1
- package/storybook-static/assets/{TagInput-ChmW4s9O.css → TagInput-RJbbcfoR.css} +1 -1
- package/storybook-static/assets/{TagInput.stories-Bbs3olyB.js → TagInput.stories-Db9DaNpW.js} +1 -1
- package/storybook-static/assets/{Text-B4GUKigV.js → Text-BT0cn3Bk.js} +1 -1
- package/storybook-static/assets/{Textarea-CNu-scX8.js → Textarea-B9MNOgmF.js} +1 -1
- package/storybook-static/assets/{Textarea-D3iwzB-S.js → Textarea-C_6iOQ3k.js} +1 -1
- package/storybook-static/assets/{Textarea.stories-CE2gt74x.js → Textarea.stories-Ctjb3d47.js} +1 -1
- package/storybook-static/assets/{TimePanel-BESMLCVl.js → TimePanel-C5AucKln.js} +1 -1
- package/storybook-static/assets/{TimePanel-Bh98qsCo.css → TimePanel-D9_hb7w4.css} +1 -1
- package/storybook-static/assets/{TimePanel.stories-BYhTpaoS.js → TimePanel.stories-CiQAJcB_.js} +1 -1
- package/storybook-static/assets/Toggle-ClE8Zovo.css +1 -0
- package/storybook-static/assets/{Toggle-0-SlfDXC.js → Toggle-DxA-Q1KZ.js} +1 -1
- package/storybook-static/assets/{Toggle-BexBc-UO.js → Toggle-q8hxq-LP.js} +1 -1
- package/storybook-static/assets/{Toggle.stories-CG4rBYOZ.js → Toggle.stories-C6Jf_KTc.js} +1 -1
- package/storybook-static/assets/{TreeMultiSelect-Cne9qXjN.js → TreeMultiSelect-BKF7COzn.js} +1 -1
- package/storybook-static/assets/{TreeMultiSelect-QId1DJUn.js → TreeMultiSelect-BfduPrgB.js} +1 -1
- package/storybook-static/assets/{TreeMultiSelect.stories-D6ElJY8Y.js → TreeMultiSelect.stories-C-uztFex.js} +1 -1
- package/storybook-static/assets/{TreePickerBase-B6DED6Hz.css → TreePickerBase-CmFF9pWE.css} +1 -1
- package/storybook-static/assets/{TreePickerBase-Dq3HMrua.js → TreePickerBase-SVDNn9QY.js} +1 -1
- package/storybook-static/assets/{TreeSelect-q4gdFfBH.js → TreeSelect-Bu9HRTvX.js} +1 -1
- package/storybook-static/assets/{TreeSelect-BJKtAh4x.js → TreeSelect-ClJGLBA8.js} +1 -1
- package/storybook-static/assets/{TreeSelect.stories-DfCxZuVy.js → TreeSelect.stories-C0TeLbpZ.js} +1 -1
- package/storybook-static/assets/{TreeTable-5fAWCnhQ.js → TreeTable-BXia_Imm.js} +1 -1
- package/storybook-static/assets/TreeTable-BvB3kj4h.css +1 -0
- package/storybook-static/assets/{TreeTable.stories-B1fSfYHg.js → TreeTable.stories-Cwo8yjNI.js} +1 -1
- package/storybook-static/assets/{blocks-B_u8Yt1Z.js → blocks-BmNU_R5E.js} +3 -3
- package/storybook-static/assets/{check-r01NGn4c.js → check-HCQdrq3c.js} +1 -1
- package/storybook-static/assets/{chevron-down-DxMviYn3.js → chevron-down-DHrZ_6vS.js} +1 -1
- package/storybook-static/assets/{chevron-left-mKnQH53V.js → chevron-left-CaIBhYcr.js} +1 -1
- package/storybook-static/assets/{chevron-right-CeJNqWTb.js → chevron-right-BpmEWiwv.js} +1 -1
- package/storybook-static/assets/{chunk-W22LQPXL-DorleiwX.js → chunk-W22LQPXL-DSMfJqhe.js} +1 -1
- package/storybook-static/assets/{circle-alert-H7OZyDmF.js → circle-alert-DuupFIr9.js} +1 -1
- package/storybook-static/assets/{circle-check-my8Ev6ar.js → circle-check-LYBfAR-E.js} +1 -1
- package/storybook-static/assets/{components-CDMhSXUo.js → components-CBnjb8pL.js} +3 -3
- package/storybook-static/assets/{contextMenu-fMt3iyZv.js → contextMenu-BZ-iSJtD.js} +1 -1
- package/storybook-static/assets/{download-BCwj5k1S.js → download-CsLGqkEl.js} +1 -1
- package/storybook-static/assets/{floating-ui.react-Cy32mouo.js → floating-ui.react-VNDOEKPt.js} +1 -1
- package/storybook-static/assets/{foundationApi-BtZYXGDY.js → foundationApi-BMy7_pDS.js} +1 -1
- package/storybook-static/assets/{foundationLib-CHOUG7NK.js → foundationLib-o95OqhXl.js} +1 -1
- package/storybook-static/assets/{hooks-CEvNG7IN.js → hooks-DMFMD13m.js} +1 -1
- package/storybook-static/assets/iframe-BT_jngkf.css +1 -0
- package/storybook-static/assets/{iframe-DWvPB8Sk.js → iframe-BaXmcmyl.js} +4 -4
- package/storybook-static/assets/iframe-D5qmKm51.js +1 -0
- package/storybook-static/assets/{info-CA6M6l6h.js → info-ZuWgcD4m.js} +1 -1
- package/storybook-static/assets/{odata-CHl7sWAn.js → odata-Brls3R5b.js} +1 -1
- package/storybook-static/assets/{odataStoryFixtures-BvjpoqqT.js → odataStoryFixtures-BmQo4rAJ.js} +2 -2
- package/storybook-static/assets/{react-B37E__uI.js → react-BnjGKE7V.js} +1 -1
- package/storybook-static/assets/{refresh-cw-Bt4yd-lG.js → refresh-cw-vj55o5c3.js} +1 -1
- package/storybook-static/assets/{settings-2-B7Uyk4j8.js → settings-2-PPom9XND.js} +1 -1
- package/storybook-static/assets/{sortable-B8UMQCaH.js → sortable-CztGPJOI.js} +1 -1
- package/storybook-static/assets/{syntaxhighlighter-QEQV7K2Y-QGUDFNNj.js → syntaxhighlighter-QEQV7K2Y-uXmnHQP7.js} +1 -1
- package/storybook-static/assets/{trash-2-Bhjh1o0B.js → trash-2-DEnKoJjZ.js} +1 -1
- package/storybook-static/assets/{triangle-alert-D1c-iB00.js → triangle-alert-D-oyPLJL.js} +1 -1
- package/storybook-static/assets/ui-DSS1yTEO.css +1 -0
- package/storybook-static/assets/ui.module-SH8ehXul.js +1 -0
- package/storybook-static/assets/uiClasses-e9OQfdw2.js +1 -0
- package/storybook-static/assets/{useODataSelectBase-CYnvX8wM.js → useODataSelectBase-DxsvigTC.js} +1 -1
- package/storybook-static/assets/{useODataTreeData-C2risfo7.js → useODataTreeData-Dzxb75-h.js} +1 -1
- package/storybook-static/assets/{usePickerQuery-CjSFlUmn.js → usePickerQuery-SCKPS_0f.js} +1 -1
- package/storybook-static/assets/{usePickerTriggerController-Bqo5fhOa.js → usePickerTriggerController-DMA4hla_.js} +1 -1
- package/storybook-static/assets/{x-B3GmOByS.js → x-C5QCK6Ts.js} +1 -1
- package/storybook-static/iframe.html +3 -3
- package/storybook-static/index.json +1 -1
- package/storybook-static/project.json +1 -1
- package/dist/chunks/CalendarView-Bhaov_XE.js.map +0 -1
- package/dist/chunks/TextEditorLexicalClient-CSXZQOYo.js.map +0 -1
- package/dist/chunks/badge-DUI2ET6q.js.map +0 -1
- package/dist/chunks/context-menu-Dj6MXgv6.js.map +0 -1
- package/dist/chunks/input-D1jOxm0t.js.map +0 -1
- package/dist/chunks/input-files-CDGpJaUm.js.map +0 -1
- package/dist/chunks/picker-DZ4-1BvK.js.map +0 -1
- package/dist/chunks/radio-group-DhpP7JSJ.js.map +0 -1
- package/dist/chunks/table-DMLFUBlb.js.map +0 -1
- package/dist/chunks/ui.module-BsDio9A3.js.map +0 -1
- package/dist/chunks/uiClasses-BVwFzzsr.js.map +0 -1
- package/storybook-static/assets/Button.stories-B3Q5B_2w.js +0 -93
- package/storybook-static/assets/CalendarView-DKvrkS40.css +0 -1
- package/storybook-static/assets/ContextMenu-CFPrlO2u.css +0 -1
- package/storybook-static/assets/DisclosureGroup-CVFMwx22.css +0 -1
- package/storybook-static/assets/FloatingPopover-jwILx9b0.css +0 -1
- package/storybook-static/assets/FormattedTableCell-AZc2IHfK.css +0 -1
- package/storybook-static/assets/ImageViewerRuntime-CRmlrtpL.css +0 -1
- package/storybook-static/assets/NotificationsHost-D5Pvn4eu.css +0 -1
- package/storybook-static/assets/Option-DXh7BISz.css +0 -1
- package/storybook-static/assets/Slider-CK-W2ZTO.css +0 -1
- package/storybook-static/assets/Table-BGvRn9y0.css +0 -1
- package/storybook-static/assets/Toggle-fKG2dFY0.css +0 -1
- package/storybook-static/assets/TreeTable--ZoksUiw.css +0 -1
- package/storybook-static/assets/iframe-CDVsimPQ.js +0 -1
- package/storybook-static/assets/iframe-IhWQT6NX.css +0 -1
- package/storybook-static/assets/ui-C3BskXT9.css +0 -1
- package/storybook-static/assets/ui.module-31LPbZGK.js +0 -1
- package/storybook-static/assets/uiClasses-Bz6cvlDQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-CbAwLHlM.js","names":[],"sources":["../../src/modal/Modal.module.scss","../../src/modal/modalMotion.ts","../../src/modal/useModalManager.ts","../../src/modal/Modal.tsx","../../src/modal/ModalManagerProvider.tsx"],"sourcesContent":["@use \"@/styles/mixins\" as *;\n\n.modal {\n\t--modal-border-radius: 0;\n\n\tdisplay: grid;\n\tgrid-auto-rows: auto 1fr;\n\tgrid-area: 1 / 1;\n\tz-index: var(--z-modal);\n\n\tborder: var(--border);\n\tborder-radius: var(--modal-border-radius);\n\tbackground-color: var(--surface-1);\n\tbox-shadow: var(--shadow-lg);\n\n\t&:not(:last-child) {\n\t\tpointer-events: none;\n\t\tfilter: grayscale(0.5) opacity(0.75);\n\t\t// opacity: 0.5;\n\t}\n\n\twidth: 100%;\n\theight: 100%;\n\tmax-width: none;\n\tmax-height: none;\n}\n\n.header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tbackground-color: var(--surface-2);\n\tborder-top-left-radius: var(--modal-border-radius);\n\tborder-top-right-radius: var(--modal-border-radius);\n}\n\n.headerText {\n\tmargin: 0;\n\tpadding-inline: var(--space-md);\n\tfont-size: var(--font-size-md);\n\tfont-variation-settings: \"wght\" 600;\n}\n\n.headerButton {\n\tmargin-block: var(--space-xs);\n\tmargin-inline: var(--space-sm);\n\tflex: 0;\n}\n\n.body {\n\toverflow: hidden;\n\tborder-bottom-left-radius: var(--modal-border-radius);\n\tborder-bottom-right-radius: var(--modal-border-radius);\n}\n\n@include mobile-above {\n\t.modal {\n\t\theight: var(--modal-height, fit-content);\n\t\tmax-height: calc(100dvh - var(--space-lg));\n\t\t--modal-border-radius: var(--radius-md);\n\n\t\t&.sm {\n\t\t\tmax-width: min(30em, 93dvw);\n\t\t}\n\n\t\t&.md {\n\t\t\tmax-width: min(50em, 93dvw);\n\t\t}\n\n\t\t&.lg {\n\t\t\tmax-width: min(70em, 93dvw);\n\t\t}\n\n\t\t&.xl {\n\t\t\tmax-width: min(80em, 93dvw);\n\t\t}\n\n\t\t&.xxl {\n\t\t\twidth: 95dvw;\n\t\t\theight: 92dvh;\n\t\t\tmax-width: none;\n\t\t\tmax-height: none;\n\t\t}\n\n\t\t&.inside {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tmax-width: none;\n\t\t\tmax-height: none;\n\n\t\t\t--modal-border-radius: 0;\n\t\t}\n\t}\n}\n","import { type Transition, type Variants } from \"motion/react\";\n\n/**\n * Варианты задают единый спокойный переход для появления и удаления modal-панели.\n * Конфигурация приватна для primitive: потребители управляют только состоянием `isOpen`.\n */\nexport const modalMotionVariants = {\n\thidden: {\n\t\topacity: 0,\n\t\tscale: 0.96,\n\t\ty: 12\n\t},\n\tvisible: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\ty: 0\n\t}\n} satisfies Variants;\n\n/** Переход сохраняет отзывчивое открытие и дает exit-анимации завершиться до удаления portal content. */\nexport const modalMotionTransition = {\n\tduration: 0.18,\n\tease: [0.22, 1, 0.36, 1]\n} satisfies Transition;\n\n/** При системном reduced-motion остается только мгновенная смена видимости без пространственного движения. */\nexport const reducedModalMotionTransition = {\n\tduration: 0\n} satisfies Transition;\n","import { createContext, useContext } from \"react\";\n\nexport const ModalManagerContext = createContext<{\n\tmodals: string[];\n\topenModal: (id: string) => void;\n\tcloseModal: (id: string) => void;\n\tisTopModal: (id: string) => boolean;\n}>({\n\tmodals: [],\n\topenModal: () => {},\n\tcloseModal: () => {},\n\tisTopModal: () => false\n});\n\nexport const useModalManager = () => useContext(ModalManagerContext);\n","import React, { Children, useEffect, useId, useRef } from \"react\";\n\nimport { getOrCreatePortalRoot, useEscapeDismiss, useOverlayFocus } from \"@ryuzaki13/react-foundation-lib/dom\";\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\nimport { X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { Button } from \"../button\";\nimport { FlexContainer } from \"../flex\";\nimport { GridContainer } from \"../grid\";\nimport { Scrollable } from \"../misc\";\n\nimport styles from \"./Modal.module.scss\";\nimport { modalMotionTransition, modalMotionVariants, reducedModalMotionTransition } from \"./modalMotion\";\nimport { ModalSize } from \"./types\";\nimport { useModalManager } from \"./useModalManager\";\n\n// Подкомпоненты\nexport interface ModalCompositionProps {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n}\n\nexport const ModalToolbar: React.FC<ModalCompositionProps> = ({ children, className }) => {\n\treturn <div className={cn(\"surface2 paddingMd borderBottom\", className)}>{children}</div>;\n};\nModalToolbar.displayName = \"Modal.Toolbar\";\n\nexport const ModalContent: React.FC<ModalCompositionProps & { scrollable?: boolean }> = ({ children, className, scrollable }) => {\n\treturn (\n\t\t<div className={cn(\"paddingMd h100 overflowHidden\", className)}>\n\t\t\t{scrollable ? <Scrollable className=\"h100\">{children}</Scrollable> : children}\n\t\t</div>\n\t);\n};\nModalContent.displayName = \"Modal.Content\";\n\nexport const ModalFooter: React.FC<ModalCompositionProps> = ({ children, className }) => {\n\treturn (\n\t\t<div className={cn(\"surface2 borderTop paddingMd\", className)}>\n\t\t\t<FlexContainer gap=\"sm\" align=\"center\" justify=\"end\">\n\t\t\t\t{children}\n\t\t\t</FlexContainer>\n\t\t</div>\n\t);\n};\nModalFooter.displayName = \"Modal.Footer\";\n\ntype ToolbarElement = React.ReactElement<ModalCompositionProps, typeof ModalToolbar>;\ntype ContentElement = React.ReactElement<ModalCompositionProps, typeof ModalContent>;\ntype FooterElement = React.ReactElement<ModalCompositionProps, typeof ModalFooter>;\n\ntype ModalChildren =\n\t[ToolbarElement, ContentElement, FooterElement] | [ToolbarElement, ContentElement] | [ContentElement, FooterElement] | ContentElement;\n\ntype ModalStyle = React.CSSProperties & {\n\t\"--modal-height\"?: string;\n};\n\nexport interface ModalProps {\n\t/** Открыто ли модальное окно */\n\tisOpen?: boolean;\n\t/** Заголовок */\n\ttitle?: string;\n\t/** Размер модального окна */\n\tsize?: keyof typeof ModalSize;\n\t/** Явная высота модального окна выше мобильного breakpoint */\n\theight?: string;\n\t/** Обработчик закрытия */\n\tonClose: () => void;\n\tchildren: ModalChildren;\n}\n\nexport const Modal: React.FC<ModalProps> = ({ isOpen, title, size = \"sm\", height, onClose, children }) => {\n\tconst modalId = useId();\n\tconst titleId = useId();\n\n\tconst { modals, openModal, closeModal, isTopModal } = useModalManager();\n\tconst shouldReduceMotion = useReducedMotion();\n\tconst restoreFocusTargetRef = useRef<HTMLElement | null>(null);\n\tconst restoreFocusAnimationFrameRef = useRef(0);\n\tconst modalStyle: ModalStyle = { \"--modal-height\": height };\n\n\t/**\n\t * Если provider менеджера не подключен, считаем одиночную модалку активной,\n\t * иначе логика Escape/focus trap никогда не включится.\n\t */\n\tconst isActive = isOpen && (modals.length === 0 || isTopModal(modalId));\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\trestoreFocusTargetRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n\t\t}\n\t}, [isOpen]);\n\n\tconst modalRef = useOverlayFocus<HTMLDivElement>({ active: isOpen || false, trapFocus: true, restoreFocus: false });\n\n\tuseEscapeDismiss({\n\t\tactive: isActive || false,\n\t\tonDismiss: onClose,\n\t\tcontainerRef: modalRef\n\t});\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\topenModal(modalId);\n\t\t}\n\t}, [isOpen, modalId, openModal]);\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame(restoreFocusAnimationFrameRef.current);\n\t\t\tcloseModal(modalId);\n\t\t};\n\t}, [closeModal, modalId]);\n\n\tfunction handleExitComplete() {\n\t\tcloseModal(modalId);\n\t\tconst restoreFocusTarget = restoreFocusTargetRef.current;\n\n\t\t/**\n\t\t * Менеджер снимает inert в passive effect после обновления стека.\n\t\t * Следующий animation frame гарантирует, что trigger снова доступен для фокуса.\n\t\t */\n\t\trestoreFocusAnimationFrameRef.current = window.requestAnimationFrame(() => {\n\t\t\tif (restoreFocusTarget?.isConnected) {\n\t\t\t\trestoreFocusTarget.focus();\n\t\t\t}\n\t\t\trestoreFocusTargetRef.current = null;\n\t\t});\n\t}\n\n\tconst modalRoot = getOrCreatePortalRoot(\"modal-root\");\n\n\tif (!modalRoot) {\n\t\treturn null;\n\t}\n\n\tlet toolbar: React.ReactNode = null;\n\tlet content: React.ReactNode = null;\n\tlet footer: React.ReactNode = null;\n\n\tconst childArray = Children.toArray(children) as (ToolbarElement | ContentElement | FooterElement)[];\n\n\tfor (const child of childArray) {\n\t\tconst typeName = child.type.displayName;\n\n\t\tswitch (typeName) {\n\t\t\tcase ModalToolbar.displayName:\n\t\t\t\tif (toolbar) throw new Error(\"Modal: duplicate <Toolbar> found\");\n\t\t\t\ttoolbar = child; //.props.children;\n\t\t\t\tbreak;\n\t\t\tcase ModalFooter.displayName:\n\t\t\t\tif (footer) throw new Error(\"Modal: duplicate <Footer> found\");\n\t\t\t\tfooter = child; //props.children;\n\t\t\t\tbreak;\n\t\t\tcase ModalContent.displayName:\n\t\t\t\tif (content) throw new Error(\"Modal: duplicate <Content> found\");\n\t\t\t\tcontent = child; //.props.children;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn createPortal(\n\t\t<AnimatePresence onExitComplete={handleExitComplete}>\n\t\t\t{isOpen ? (\n\t\t\t\t<motion.div\n\t\t\t\t\tref={modalRef}\n\t\t\t\t\tclassName={cn(styles.modal, styles[size])}\n\t\t\t\t\tstyle={modalStyle}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\taria-labelledby={titleId}\n\t\t\t\t\taria-describedby={`${titleId}-content`}\n\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\tvariants={modalMotionVariants}\n\t\t\t\t\ttransition={shouldReduceMotion ? reducedModalMotionTransition : modalMotionTransition}>\n\t\t\t\t\t<div className={cn(styles.header, toolbar ? \"\" : \"borderBottom\")}>\n\t\t\t\t\t\t<h3 className={styles.headerText} id={titleId}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={<X />}\n\t\t\t\t\t\t\tclassName={styles.headerButton}\n\t\t\t\t\t\t\tvariant={\"ghost\"}\n\t\t\t\t\t\t\taria-label={\"Закрыть модальное окно\"}\n\t\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<GridContainer\n\t\t\t\t\t\tid={`${titleId}-content`}\n\t\t\t\t\t\ttemplateRows={`${toolbar ? \"auto\" : \"\"} 1fr ${footer ? \"auto\" : \"\"}`.trim()}\n\t\t\t\t\t\t// gap=\"md\"\n\t\t\t\t\t\tclassName={styles.body}>\n\t\t\t\t\t\t{toolbar}\n\t\t\t\t\t\t{content}\n\t\t\t\t\t\t{footer}\n\t\t\t\t\t</GridContainer>\n\t\t\t\t</motion.div>\n\t\t\t) : null}\n\t\t</AnimatePresence>,\n\t\tmodalRoot\n\t);\n};\n","// ModalManagerContext.tsx\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { ModalManagerContext } from \"./useModalManager\";\n\nexport interface ModalManagerProviderProps {\n\tchildren: React.ReactNode;\n\t/** Компенсирует исчезновение скроллбара правым padding у body. */\n\tcompensateScrollbar?: boolean;\n}\n\n/**\n * Провайдер для централизованного управления стеком модальных окон. Дает вложенным компонентам доступ к открытию и закрытию модалок через контекст.\n */\nexport function ModalManagerProvider({ children, compensateScrollbar = false }: ModalManagerProviderProps) {\n\tconst [modals, setModals] = useState<string[]>([]);\n\tconst prevModalsLength = useRef(0);\n\tconst scrollbarWidth = useRef(0);\n\tconst bodyPaddingRight = useRef(\"\");\n\tconst isScrollbarCompensated = useRef(false);\n\n\tconst openModal = useCallback((id: string) => {\n\t\tsetModals((prev) => [...prev, id]);\n\t}, []);\n\n\tconst closeModal = useCallback((id: string) => {\n\t\tsetModals((prev) => prev.filter((mid) => mid !== id));\n\t}, []);\n\n\tconst isTopModal = useCallback(\n\t\t(id: string) => {\n\t\t\treturn modals[modals.length - 1] === id;\n\t\t},\n\t\t[modals]\n\t);\n\n\tuseEffect(() => {\n\t\tconst wasEmpty = prevModalsLength.current === 0;\n\n\t\tif (wasEmpty && modals.length > 0) {\n\t\t\t// первая модалка открыта — ставим стили\n\t\t\tconst scrollY = window.scrollY;\n\t\t\tconst appRoot = document.querySelector(\"#app-root\");\n\t\t\tscrollbarWidth.current = Math.max(0, window.innerWidth - document.documentElement.clientWidth);\n\t\t\tbodyPaddingRight.current = document.body.style.paddingRight;\n\n\t\t\tdocument.body.style.position = \"fixed\";\n\t\t\tdocument.body.style.top = `-${scrollY}px`;\n\t\t\tdocument.body.style.width = \"100%\";\n\n\t\t\tif (compensateScrollbar) {\n\t\t\t\tdocument.body.style.paddingRight = `${scrollbarWidth.current}px`;\n\t\t\t\tisScrollbarCompensated.current = true;\n\t\t\t}\n\n\t\t\tappRoot?.setAttribute(\"inert\", \"true\");\n\n\t\t\tprevModalsLength.current = modals.length;\n\t\t\treturn;\n\t\t}\n\n\t\tif (!wasEmpty && modals.length > 0 && compensateScrollbar !== isScrollbarCompensated.current) {\n\t\t\tdocument.body.style.paddingRight = compensateScrollbar ? `${scrollbarWidth.current}px` : bodyPaddingRight.current;\n\t\t\tisScrollbarCompensated.current = compensateScrollbar;\n\t\t}\n\n\t\tif (!wasEmpty && modals.length === 0) {\n\t\t\t// последняя модалка закрыта — снимаем стили\n\t\t\tconst appRoot = document.querySelector(\"#app-root\");\n\t\t\tconst scrollY = parseInt(document.body.style.top || \"0\") * -1;\n\n\t\t\tdocument.body.style.position = \"\";\n\t\t\tdocument.body.style.top = \"\";\n\t\t\tdocument.body.style.width = \"\";\n\n\t\t\tif (isScrollbarCompensated.current) {\n\t\t\t\tdocument.body.style.paddingRight = bodyPaddingRight.current;\n\t\t\t\tisScrollbarCompensated.current = false;\n\t\t\t}\n\n\t\t\tappRoot?.removeAttribute(\"inert\");\n\n\t\t\twindow.scrollTo({ top: scrollY, left: 0, behavior: \"instant\" });\n\t\t}\n\n\t\tprevModalsLength.current = modals.length;\n\t}, [compensateScrollbar, modals.length]);\n\n\treturn <ModalManagerContext.Provider value={{ modals, openModal, closeModal, isTopModal }}>{children}</ModalManagerContext.Provider>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GCMa,IAAsB;CAClC,QAAQ;EACP,SAAS;EACT,OAAO;EACP,GAAG;CACJ;CACA,SAAS;EACR,SAAS;EACT,OAAO;EACP,GAAG;CACJ;AACD,GAGa,IAAwB;CACpC,UAAU;CACV,MAAM;EAAC;EAAM;EAAG;EAAM;CAAC;AACxB,GAGa,IAA+B,EAC3C,UAAU,EACX,GC1Ba,IAAsB,EAKhC;CACF,QAAQ,CAAC;CACT,iBAAiB,CAAC;CAClB,kBAAkB,CAAC;CACnB,kBAAkB;AACnB,CAAC,GAEY,UAAwB,EAAW,CAAmB,GCUtD,KAAiD,EAAE,aAAU,mBAClE,kBAAC,OAAD;CAAK,WAAW,EAAG,mCAA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AAG,EAAe,QAAQ,MAAM,EAAiB,SAC1G,EAAuB,UAAU,IAG9B,CAAC,KAAY,EAAO,WAAW,GAAG;GAErC,IAAM,IAAU,SAAS,cAAc,WAAW,GAC5C,IAAU,SAAS,SAAS,KAAK,MAAM,OAAO,GAAG,IAAI;GAa3D,AAXA,SAAS,KAAK,MAAM,WAAW,IAC/B,SAAS,KAAK,MAAM,MAAM,IAC1B,SAAS,KAAK,MAAM,QAAQ,IAE5B,AAEC,EAAuB,aADvB,SAAS,KAAK,MAAM,eAAe,EAAiB,SACnB,KAGlC,GAAS,gBAAgB,OAAO,GAEhC,OAAO,SAAS;IAAE,KAAK;IAAS,MAAM;IAAG,UAAU;GAAU,CAAC;EAC/D;EAEA,EAAiB,UAAU,EAAO;CACnC,GAAG,CAAC,GAAqB,EAAO,MAAM,CAAC,GAEhC,kBAAC,EAAoB,UAArB;EAA8B,OAAO;GAAE;GAAQ;GAAW;GAAY;EAAW;EAAI;CAAuC,CAAA;AACpI"}
|
|
1
|
+
{"version":3,"file":"modal-dplfAaER.js","names":[],"sources":["../../src/modal/Modal.module.scss","../../src/modal/modalMotion.ts","../../src/modal/useModalManager.ts","../../src/modal/Modal.tsx","../../src/modal/ModalManagerProvider.tsx"],"sourcesContent":["@use \"@/styles/mixins\" as *;\n\n.modal {\n\t--modal-border-radius: 0;\n\n\tdisplay: grid;\n\tgrid-auto-rows: auto 1fr;\n\tgrid-area: 1 / 1;\n\tz-index: var(--z-modal);\n\n\tborder: var(--border);\n\tborder-radius: var(--modal-border-radius);\n\tbackground-color: var(--surface-1);\n\tbox-shadow: var(--shadow-lg);\n\n\t&:not(:last-child) {\n\t\tpointer-events: none;\n\t\tfilter: grayscale(0.5) opacity(0.75);\n\t\t// opacity: 0.5;\n\t}\n\n\twidth: 100%;\n\theight: 100%;\n\tmax-width: none;\n\tmax-height: none;\n}\n\n.header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tbackground-color: var(--surface-2);\n\tborder-top-left-radius: var(--modal-border-radius);\n\tborder-top-right-radius: var(--modal-border-radius);\n}\n\n.headerText {\n\tmargin: 0;\n\tpadding-inline: var(--space-md);\n\tfont-size: var(--font-size-md);\n\tfont-variation-settings: \"wght\" 600;\n}\n\n.headerButton {\n\tmargin-block: var(--space-xs);\n\tmargin-inline: var(--space-sm);\n\tflex: 0;\n}\n\n.body {\n\toverflow: hidden;\n\tborder-bottom-left-radius: var(--modal-border-radius);\n\tborder-bottom-right-radius: var(--modal-border-radius);\n}\n\n@include mobile-above {\n\t.modal {\n\t\theight: var(--modal-height, fit-content);\n\t\tmax-height: calc(100dvh - var(--space-lg));\n\t\t--modal-border-radius: var(--radius-md);\n\n\t\t&.sm {\n\t\t\tmax-width: min(30em, 93dvw);\n\t\t}\n\n\t\t&.md {\n\t\t\tmax-width: min(50em, 93dvw);\n\t\t}\n\n\t\t&.lg {\n\t\t\tmax-width: min(70em, 93dvw);\n\t\t}\n\n\t\t&.xl {\n\t\t\tmax-width: min(80em, 93dvw);\n\t\t}\n\n\t\t&.xxl {\n\t\t\twidth: 95dvw;\n\t\t\theight: 92dvh;\n\t\t\tmax-width: none;\n\t\t\tmax-height: none;\n\t\t}\n\n\t\t&.inside {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tmax-width: none;\n\t\t\tmax-height: none;\n\n\t\t\t--modal-border-radius: 0;\n\t\t}\n\t}\n}\n","import { type Transition, type Variants } from \"motion/react\";\n\n/**\n * Варианты задают единый спокойный переход для появления и удаления modal-панели.\n * Конфигурация приватна для primitive: потребители управляют только состоянием `isOpen`.\n */\nexport const modalMotionVariants = {\n\thidden: {\n\t\topacity: 0,\n\t\tscale: 0.96,\n\t\ty: 12\n\t},\n\tvisible: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\ty: 0\n\t}\n} satisfies Variants;\n\n/** Переход сохраняет отзывчивое открытие и дает exit-анимации завершиться до удаления portal content. */\nexport const modalMotionTransition = {\n\tduration: 0.18,\n\tease: [0.22, 1, 0.36, 1]\n} satisfies Transition;\n\n/** При системном reduced-motion остается только мгновенная смена видимости без пространственного движения. */\nexport const reducedModalMotionTransition = {\n\tduration: 0\n} satisfies Transition;\n","import { createContext, useContext } from \"react\";\n\nexport const ModalManagerContext = createContext<{\n\tmodals: string[];\n\topenModal: (id: string) => void;\n\tcloseModal: (id: string) => void;\n\tisTopModal: (id: string) => boolean;\n}>({\n\tmodals: [],\n\topenModal: () => {},\n\tcloseModal: () => {},\n\tisTopModal: () => false\n});\n\nexport const useModalManager = () => useContext(ModalManagerContext);\n","import React, { Children, useEffect, useId, useRef } from \"react\";\n\nimport { getOrCreatePortalRoot, useEscapeDismiss, useOverlayFocus } from \"@ryuzaki13/react-foundation-lib/dom\";\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\nimport { X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { Button } from \"../button\";\nimport { FlexContainer } from \"../flex\";\nimport { GridContainer } from \"../grid\";\nimport { Scrollable } from \"../misc\";\n\nimport styles from \"./Modal.module.scss\";\nimport { modalMotionTransition, modalMotionVariants, reducedModalMotionTransition } from \"./modalMotion\";\nimport { ModalSize } from \"./types\";\nimport { useModalManager } from \"./useModalManager\";\n\n// Подкомпоненты\nexport interface ModalCompositionProps {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n}\n\nexport const ModalToolbar: React.FC<ModalCompositionProps> = ({ children, className }) => {\n\treturn <div className={cn(\"surface2 paddingMd borderBottom\", className)}>{children}</div>;\n};\nModalToolbar.displayName = \"Modal.Toolbar\";\n\nexport const ModalContent: React.FC<ModalCompositionProps & { scrollable?: boolean }> = ({ children, className, scrollable }) => {\n\treturn (\n\t\t<div className={cn(\"paddingMd h100 overflowHidden\", className)}>\n\t\t\t{scrollable ? <Scrollable className=\"h100\">{children}</Scrollable> : children}\n\t\t</div>\n\t);\n};\nModalContent.displayName = \"Modal.Content\";\n\nexport const ModalFooter: React.FC<ModalCompositionProps> = ({ children, className }) => {\n\treturn (\n\t\t<div className={cn(\"surface2 borderTop paddingMd\", className)}>\n\t\t\t<FlexContainer gap=\"sm\" align=\"center\" justify=\"end\">\n\t\t\t\t{children}\n\t\t\t</FlexContainer>\n\t\t</div>\n\t);\n};\nModalFooter.displayName = \"Modal.Footer\";\n\ntype ToolbarElement = React.ReactElement<ModalCompositionProps, typeof ModalToolbar>;\ntype ContentElement = React.ReactElement<ModalCompositionProps, typeof ModalContent>;\ntype FooterElement = React.ReactElement<ModalCompositionProps, typeof ModalFooter>;\n\ntype ModalChildren =\n\t[ToolbarElement, ContentElement, FooterElement] | [ToolbarElement, ContentElement] | [ContentElement, FooterElement] | ContentElement;\n\ntype ModalStyle = React.CSSProperties & {\n\t\"--modal-height\"?: string;\n};\n\nexport interface ModalProps {\n\t/** Открыто ли модальное окно */\n\tisOpen?: boolean;\n\t/** Заголовок */\n\ttitle?: string;\n\t/** Размер модального окна */\n\tsize?: keyof typeof ModalSize;\n\t/** Явная высота модального окна выше мобильного breakpoint */\n\theight?: string;\n\t/** Обработчик закрытия */\n\tonClose: () => void;\n\tchildren: ModalChildren;\n}\n\nexport const Modal: React.FC<ModalProps> = ({ isOpen, title, size = \"sm\", height, onClose, children }) => {\n\tconst modalId = useId();\n\tconst titleId = useId();\n\n\tconst { modals, openModal, closeModal, isTopModal } = useModalManager();\n\tconst shouldReduceMotion = useReducedMotion();\n\tconst restoreFocusTargetRef = useRef<HTMLElement | null>(null);\n\tconst restoreFocusAnimationFrameRef = useRef(0);\n\tconst modalStyle: ModalStyle = { \"--modal-height\": height };\n\n\t/**\n\t * Если provider менеджера не подключен, считаем одиночную модалку активной,\n\t * иначе логика Escape/focus trap никогда не включится.\n\t */\n\tconst isActive = isOpen && (modals.length === 0 || isTopModal(modalId));\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\trestoreFocusTargetRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n\t\t}\n\t}, [isOpen]);\n\n\tconst modalRef = useOverlayFocus<HTMLDivElement>({ active: isOpen || false, trapFocus: true, restoreFocus: false });\n\n\tuseEscapeDismiss({\n\t\tactive: isActive || false,\n\t\tonDismiss: onClose,\n\t\tcontainerRef: modalRef\n\t});\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\topenModal(modalId);\n\t\t}\n\t}, [isOpen, modalId, openModal]);\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame(restoreFocusAnimationFrameRef.current);\n\t\t\tcloseModal(modalId);\n\t\t};\n\t}, [closeModal, modalId]);\n\n\tfunction handleExitComplete() {\n\t\tcloseModal(modalId);\n\t\tconst restoreFocusTarget = restoreFocusTargetRef.current;\n\n\t\t/**\n\t\t * Менеджер снимает inert в passive effect после обновления стека.\n\t\t * Следующий animation frame гарантирует, что trigger снова доступен для фокуса.\n\t\t */\n\t\trestoreFocusAnimationFrameRef.current = window.requestAnimationFrame(() => {\n\t\t\tif (restoreFocusTarget?.isConnected) {\n\t\t\t\trestoreFocusTarget.focus();\n\t\t\t}\n\t\t\trestoreFocusTargetRef.current = null;\n\t\t});\n\t}\n\n\tconst modalRoot = getOrCreatePortalRoot(\"modal-root\");\n\n\tif (!modalRoot) {\n\t\treturn null;\n\t}\n\n\tlet toolbar: React.ReactNode = null;\n\tlet content: React.ReactNode = null;\n\tlet footer: React.ReactNode = null;\n\n\tconst childArray = Children.toArray(children) as (ToolbarElement | ContentElement | FooterElement)[];\n\n\tfor (const child of childArray) {\n\t\tconst typeName = child.type.displayName;\n\n\t\tswitch (typeName) {\n\t\t\tcase ModalToolbar.displayName:\n\t\t\t\tif (toolbar) throw new Error(\"Modal: duplicate <Toolbar> found\");\n\t\t\t\ttoolbar = child; //.props.children;\n\t\t\t\tbreak;\n\t\t\tcase ModalFooter.displayName:\n\t\t\t\tif (footer) throw new Error(\"Modal: duplicate <Footer> found\");\n\t\t\t\tfooter = child; //props.children;\n\t\t\t\tbreak;\n\t\t\tcase ModalContent.displayName:\n\t\t\t\tif (content) throw new Error(\"Modal: duplicate <Content> found\");\n\t\t\t\tcontent = child; //.props.children;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn createPortal(\n\t\t<AnimatePresence onExitComplete={handleExitComplete}>\n\t\t\t{isOpen ? (\n\t\t\t\t<motion.div\n\t\t\t\t\tref={modalRef}\n\t\t\t\t\tclassName={cn(styles.modal, styles[size])}\n\t\t\t\t\tstyle={modalStyle}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\taria-labelledby={titleId}\n\t\t\t\t\taria-describedby={`${titleId}-content`}\n\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\tvariants={modalMotionVariants}\n\t\t\t\t\ttransition={shouldReduceMotion ? reducedModalMotionTransition : modalMotionTransition}>\n\t\t\t\t\t<div className={cn(styles.header, toolbar ? \"\" : \"borderBottom\")}>\n\t\t\t\t\t\t<h3 className={styles.headerText} id={titleId}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={<X />}\n\t\t\t\t\t\t\tclassName={styles.headerButton}\n\t\t\t\t\t\t\tvariant={\"ghost\"}\n\t\t\t\t\t\t\taria-label={\"Закрыть модальное окно\"}\n\t\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<GridContainer\n\t\t\t\t\t\tid={`${titleId}-content`}\n\t\t\t\t\t\ttemplateRows={`${toolbar ? \"auto\" : \"\"} 1fr ${footer ? \"auto\" : \"\"}`.trim()}\n\t\t\t\t\t\t// gap=\"md\"\n\t\t\t\t\t\tclassName={styles.body}>\n\t\t\t\t\t\t{toolbar}\n\t\t\t\t\t\t{content}\n\t\t\t\t\t\t{footer}\n\t\t\t\t\t</GridContainer>\n\t\t\t\t</motion.div>\n\t\t\t) : null}\n\t\t</AnimatePresence>,\n\t\tmodalRoot\n\t);\n};\n","// ModalManagerContext.tsx\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { ModalManagerContext } from \"./useModalManager\";\n\nexport interface ModalManagerProviderProps {\n\tchildren: React.ReactNode;\n\t/** Компенсирует исчезновение скроллбара правым padding у body. */\n\tcompensateScrollbar?: boolean;\n}\n\n/**\n * Провайдер для централизованного управления стеком модальных окон. Дает вложенным компонентам доступ к открытию и закрытию модалок через контекст.\n */\nexport function ModalManagerProvider({ children, compensateScrollbar = false }: ModalManagerProviderProps) {\n\tconst [modals, setModals] = useState<string[]>([]);\n\tconst prevModalsLength = useRef(0);\n\tconst scrollbarWidth = useRef(0);\n\tconst bodyPaddingRight = useRef(\"\");\n\tconst isScrollbarCompensated = useRef(false);\n\n\tconst openModal = useCallback((id: string) => {\n\t\tsetModals((prev) => [...prev, id]);\n\t}, []);\n\n\tconst closeModal = useCallback((id: string) => {\n\t\tsetModals((prev) => prev.filter((mid) => mid !== id));\n\t}, []);\n\n\tconst isTopModal = useCallback(\n\t\t(id: string) => {\n\t\t\treturn modals[modals.length - 1] === id;\n\t\t},\n\t\t[modals]\n\t);\n\n\tuseEffect(() => {\n\t\tconst wasEmpty = prevModalsLength.current === 0;\n\n\t\tif (wasEmpty && modals.length > 0) {\n\t\t\t// первая модалка открыта — ставим стили\n\t\t\tconst scrollY = window.scrollY;\n\t\t\tconst appRoot = document.querySelector(\"#app-root\");\n\t\t\tscrollbarWidth.current = Math.max(0, window.innerWidth - document.documentElement.clientWidth);\n\t\t\tbodyPaddingRight.current = document.body.style.paddingRight;\n\n\t\t\tdocument.body.style.position = \"fixed\";\n\t\t\tdocument.body.style.top = `-${scrollY}px`;\n\t\t\tdocument.body.style.width = \"100%\";\n\n\t\t\tif (compensateScrollbar) {\n\t\t\t\tdocument.body.style.paddingRight = `${scrollbarWidth.current}px`;\n\t\t\t\tisScrollbarCompensated.current = true;\n\t\t\t}\n\n\t\t\tappRoot?.setAttribute(\"inert\", \"true\");\n\n\t\t\tprevModalsLength.current = modals.length;\n\t\t\treturn;\n\t\t}\n\n\t\tif (!wasEmpty && modals.length > 0 && compensateScrollbar !== isScrollbarCompensated.current) {\n\t\t\tdocument.body.style.paddingRight = compensateScrollbar ? `${scrollbarWidth.current}px` : bodyPaddingRight.current;\n\t\t\tisScrollbarCompensated.current = compensateScrollbar;\n\t\t}\n\n\t\tif (!wasEmpty && modals.length === 0) {\n\t\t\t// последняя модалка закрыта — снимаем стили\n\t\t\tconst appRoot = document.querySelector(\"#app-root\");\n\t\t\tconst scrollY = parseInt(document.body.style.top || \"0\") * -1;\n\n\t\t\tdocument.body.style.position = \"\";\n\t\t\tdocument.body.style.top = \"\";\n\t\t\tdocument.body.style.width = \"\";\n\n\t\t\tif (isScrollbarCompensated.current) {\n\t\t\t\tdocument.body.style.paddingRight = bodyPaddingRight.current;\n\t\t\t\tisScrollbarCompensated.current = false;\n\t\t\t}\n\n\t\t\tappRoot?.removeAttribute(\"inert\");\n\n\t\t\twindow.scrollTo({ top: scrollY, left: 0, behavior: \"instant\" });\n\t\t}\n\n\t\tprevModalsLength.current = modals.length;\n\t}, [compensateScrollbar, modals.length]);\n\n\treturn <ModalManagerContext.Provider value={{ modals, openModal, closeModal, isTopModal }}>{children}</ModalManagerContext.Provider>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GCMa,IAAsB;CAClC,QAAQ;EACP,SAAS;EACT,OAAO;EACP,GAAG;CACJ;CACA,SAAS;EACR,SAAS;EACT,OAAO;EACP,GAAG;CACJ;AACD,GAGa,IAAwB;CACpC,UAAU;CACV,MAAM;EAAC;EAAM;EAAG;EAAM;CAAC;AACxB,GAGa,IAA+B,EAC3C,UAAU,EACX,GC1Ba,IAAsB,EAKhC;CACF,QAAQ,CAAC;CACT,iBAAiB,CAAC;CAClB,kBAAkB,CAAC;CACnB,kBAAkB;AACnB,CAAC,GAE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AOA,IALI,CAAC,KAAY,EAAO,SAAS,KAAK,MAAwB,EAAuB,YACpF,SAAS,KAAK,MAAM,eAAe,IAAsB,GAAG,EAAe,QAAQ,MAAM,EAAiB,SAC1G,EAAuB,UAAU,IAG9B,CAAC,KAAY,EAAO,WAAW,GAAG;GAErC,IAAM,IAAU,SAAS,cAAc,WAAW,GAC5C,IAAU,SAAS,SAAS,KAAK,MAAM,OAAO,GAAG,IAAI;GAa3D,AAXA,SAAS,KAAK,MAAM,WAAW,IAC/B,SAAS,KAAK,MAAM,MAAM,IAC1B,SAAS,KAAK,MAAM,QAAQ,IAE5B,AAEC,EAAuB,aADvB,SAAS,KAAK,MAAM,eAAe,EAAiB,SACnB,KAGlC,GAAS,gBAAgB,OAAO,GAEhC,OAAO,SAAS;IAAE,KAAK;IAAS,MAAM;IAAG,UAAU;GAAU,CAAC;EAC/D;EAEA,EAAiB,UAAU,EAAO;CACnC,GAAG,CAAC,GAAqB,EAAO,MAAM,CAAC,GAEhC,kBAAC,EAAoB,UAArB;EAA8B,OAAO;GAAE;GAAQ;GAAW;GAAY;EAAW;EAAI;CAAuC,CAAA;AACpI"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./ui.module-
|
|
1
|
+
import { t as e } from "./ui.module-oRwY3Zli.js";
|
|
2
2
|
import { Text as t } from "../text/index.js";
|
|
3
|
-
import { t as n } from "./check-box-
|
|
3
|
+
import { t as n } from "./check-box-CZyhzmR0.js";
|
|
4
4
|
import { Option as r, OptionButton as i } from "../option/index.js";
|
|
5
|
-
import { a, f as o, i as s, n as c, r as l, s as u, t as d, u as f, v as p } from "./picker-
|
|
5
|
+
import { a, f as o, i as s, n as c, r as l, s as u, t as d, u as f, v as p } from "./picker-lvm82d0A.js";
|
|
6
6
|
import { t as ee } from "./separator-B72Aq-6a.js";
|
|
7
7
|
import { i as te, n as m, t as h } from "./defaultRenderers-u_Vep6Pj.js";
|
|
8
8
|
import { t as g } from "./odata-dependent-C_DCbKY2.js";
|
|
@@ -463,4 +463,4 @@ function N({ label: e, description: t, disabled: n, placeholder: r, size: i, opt
|
|
|
463
463
|
//#endregion
|
|
464
464
|
export { E as a, O as i, A as n, k as r, N as t };
|
|
465
465
|
|
|
466
|
-
//# sourceMappingURL=multi-select-
|
|
466
|
+
//# sourceMappingURL=multi-select-BZ9N6Dal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select-V7SLAduU.js","names":[],"sources":["../../src/multi-select/ui/MultiSelect.module.scss","../../src/multi-select/ui/MultiSelectOptionSkeleton.tsx","../../src/multi-select/ui/MultiSelect.tsx","../../src/multi-select/model/useODataMultiSelect.ts","../../src/multi-select/ui/ODataMultiSelect.tsx","../../src/multi-select/ui/ODataDependentSegmentMultiSelect.tsx","../../src/multi-select/ui/ODataDependentMultiSelect.tsx","../../src/multi-select/ui/SerializableMultiSelect.tsx"],"sourcesContent":["@use \"@/styles/mixins\" as *;\n\n.multiSelect {\n\t// Общий контейнер\n\tpadding: 0;\n}\n\n.optionCheckBox {\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\n\t--check-box-control-size: auto;\n\tpadding-left: var(--space-sm);\n}\n","import { Text } from \"../../text\";\nimport uiStyles from \"../../ui.module.scss\";\n\ninterface MultiSelectOptionSkeletonProps {\n\ttext: string;\n\tisError?: boolean;\n}\n\n/**\n * Скелетон строки опции для `MultiSelect`. Используется во время загрузки или при отображении ошибок получения списка.\n */\nexport function MultiSelectOptionSkeleton({ text, isError }: MultiSelectOptionSkeletonProps) {\n\treturn (\n\t\t<div className={uiStyles.uiPopupOption}>\n\t\t\t<span className={uiStyles.uiPopupOptionIcon}></span>\n\t\t\t<Text color={isError ? \"error\" : \"primary\"}>{text}</Text>\n\t\t</div>\n\t);\n}\n","import React, { forwardRef, type PropsWithChildren, useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { CheckBox } from \"../../check-box\";\nimport { Option, OptionButton } from \"../../option\";\nimport {\n\tPickerField,\n\tPickerPopup,\n\tPickerStatus,\n\tPickerTrigger,\n\tusePickerDefaultFilter,\n\tusePickerFloatingListbox,\n\tusePickerQuery,\n\tusePickerSelectionLifecycle,\n\tusePickerTriggerController\n} from \"../../picker\";\nimport { Separator } from \"../../separator\";\nimport { type UiBaseProps } from \"../../types\";\n\nimport { createDefaultMultiSelectItemRenderer, createDefaultMultiSelectTokenRenderer, resolveMultiSelectTextKey } from \"./defaultRenderers\";\nimport styles from \"./MultiSelect.module.scss\";\nimport { MultiSelectOptionSkeleton } from \"./MultiSelectOptionSkeleton\";\n\nimport type { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata-service\";\n\ninterface MultiSelectOptionsProps extends PropsWithChildren {\n\tisNoData?: boolean;\n\t// isLoading?: boolean;\n\terror?: string;\n}\n\nfunction MultiSelectOptionsWrapper({ isNoData, error, children }: MultiSelectOptionsProps) {\n\tif (isNoData) return <PickerStatus emptyState={<MultiSelectOptionSkeleton text=\"Нет данных\" />} />;\n\t// if (isLoading) return <PickerStatus loadingState={<MultiSelectOptionSkeleton text=\"Загрузка...\" />} />;\n\tif (error) return <PickerStatus errorState={<MultiSelectOptionSkeleton isError text=\"Ошибка загрузки\" />} />;\n\n\treturn <>{children}</>;\n}\n\nexport interface MultiSelectItemState {\n\tselected: boolean;\n\tactive: boolean;\n\tdisabled: boolean;\n\tquery: string;\n\thighlightQuery: string;\n}\n\n/**\n * Структурированное содержимое опции множественного выбора. `MultiSelect` владеет\n * интерактивной оболочкой и checkbox-слотом, а renderer отвечает только за данные\n * текстовой части, поэтому единая композиция `OptionButton` сохраняется и для\n * произвольного ReactNode.\n */\nexport interface MultiSelectOptionContent {\n\ttext: string;\n\tcode: string | undefined;\n}\n\nexport interface MultiSelectRenderContext {\n\tselectedItems: CollectionItem[];\n\tcommittedSelectedItems: CollectionItem[];\n\tavailableItems: CollectionItem[];\n\tquery: string;\n\topen: boolean;\n\tclearSelection: () => void;\n\tselectAll: () => void;\n\tdeselectAll: () => void;\n}\n\nexport interface MultiSelectOptionDisableContext {\n\tselectedItems: CollectionItem[];\n\tcommittedSelectedItems: CollectionItem[];\n\tselectedKeys: ReadonlySet<string>;\n\topen: boolean;\n}\n\ntype MultiSelectOptionalRenderer<TContext> = ((context: TContext) => React.ReactNode) | null | false;\n\ninterface MultiSelectRenderers {\n\trenderToken?: MultiSelectOptionalRenderer<MultiSelectRenderContext>;\n\trenderToolbar?: MultiSelectOptionalRenderer<MultiSelectRenderContext>;\n\trenderItem?: (item: CollectionItem, state: MultiSelectItemState) => MultiSelectOptionContent;\n}\n\nexport interface MultiSelectProps<TOption extends Record<string, string> = CollectionItem>\n\textends MultiSelectRenderers, UiBaseProps<TOption[]> {\n\tcodeKey: string;\n\ttextKey?: string;\n\thideCode?: boolean;\n\tquery?: string;\n\tdefaultQuery?: string;\n\thighlightQuery?: string;\n\tonQuery?: (value: string) => void;\n\tdefaultFilter?: boolean;\n\titems: TOption[];\n\tgetOptionDisabled?: (item: TOption, context: MultiSelectOptionDisableContext) => boolean;\n\tonOpen?: () => void;\n\tonClose?: (value: TOption[]) => void;\n\terror?: string;\n\tisLoading?: boolean;\n}\n\nconst fallback: CollectionItem[] = [];\n\nfunction getItemKey(item: CollectionItem, codeKey: string) {\n\treturn item[codeKey];\n}\n\nfunction getItemSearchParts(item: CollectionItem, codeKey: string, textKey: string) {\n\treturn Array.from(new Set([item[textKey], item[codeKey], ...Object.values(item)]));\n}\n\nfunction areSelectionsEqual(left: CollectionItem[], right: CollectionItem[], codeKey: string) {\n\tif (left.length !== right.length) {\n\t\treturn false;\n\t}\n\n\tconst rightKeys = new Set(right.map((item) => getItemKey(item, codeKey)));\n\n\treturn left.every((item) => rightKeys.has(getItemKey(item, codeKey)));\n}\n\ninterface MultiSelectOptionEntry {\n\titem: CollectionItem;\n\tindex: number;\n}\n\ninterface MultiSelectOptionGroupProps {\n\tentries: MultiSelectOptionEntry[];\n\tlistId: string;\n\tactiveIndex: number;\n\tselectedKeys: Set<string>;\n\tcodeKey: string;\n\tquery: string;\n\thighlightQuery: string;\n\tgetOptionDisabled?: (item: CollectionItem) => boolean;\n\tgetOptionId: (listId: string, index: number) => string;\n\tsetOptionRef: (index: number, node: HTMLElement | null) => void;\n\ttoggleOption: (item: CollectionItem) => void;\n\tselectOnlyOption: (item: CollectionItem) => void;\n\trenderItem: (item: CollectionItem, state: MultiSelectItemState) => MultiSelectOptionContent;\n}\n\nfunction MultiSelectOptionGroup({\n\tentries,\n\tlistId,\n\tactiveIndex,\n\tselectedKeys,\n\tcodeKey,\n\tquery,\n\thighlightQuery,\n\tgetOptionDisabled,\n\tgetOptionId,\n\tsetOptionRef,\n\ttoggleOption,\n\tselectOnlyOption,\n\trenderItem\n}: MultiSelectOptionGroupProps) {\n\treturn entries.map(({ item, index }) => {\n\t\tconst active = index === activeIndex;\n\t\tconst itemKey = getItemKey(item, codeKey);\n\t\tconst selected = selectedKeys.has(itemKey);\n\t\tconst optionDisabled = getOptionDisabled?.(item) ?? false;\n\t\tconst content = renderItem(item, { selected, active, disabled: optionDisabled, query, highlightQuery });\n\n\t\treturn (\n\t\t\t<Option\n\t\t\t\tkey={`${itemKey}-${index}`}\n\t\t\t\tid={getOptionId(listId, index)}\n\t\t\t\tref={(node) => setOptionRef(index, node)}\n\t\t\t\trole=\"option\"\n\t\t\t\taria-selected={selected}\n\t\t\t\taria-disabled={optionDisabled || undefined}\n\t\t\t\tselected={selected}\n\t\t\t\tactive={active}\n\t\t\t\tdisabled={optionDisabled}>\n\t\t\t\t<div\n\t\t\t\t\tclassName={styles.optionCheckBox}\n\t\t\t\t\tonMouseDown={(event) => event.stopPropagation()}\n\t\t\t\t\tonClick={(event) => event.stopPropagation()}>\n\t\t\t\t\t<CheckBox\n\t\t\t\t\t\tvalue={selected}\n\t\t\t\t\t\tdisabled={optionDisabled}\n\t\t\t\t\t\taria-label={`Выбрать ${highlightQuery ?? itemKey}`}\n\t\t\t\t\t\tonChange={() => toggleOption(item)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<OptionButton\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tdisabled={optionDisabled}\n\t\t\t\t\ttext={content.text}\n\t\t\t\t\tcode={content.code}\n\t\t\t\t\tsearchText={highlightQuery}\n\t\t\t\t\tonMouseDown={(event) => event.preventDefault()}\n\t\t\t\t\tonClick={() => selectOnlyOption(item)}\n\t\t\t\t/>\n\t\t\t</Option>\n\t\t);\n\t});\n}\n\n/**\n * Поле множественного выбора с внутренним черновиком значений и подтверждением выбора при закрытии списка.\n * Подходит как для самостоятельного использования, так и как базовый слой для OData-оберток.\n */\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(\n\t(\n\t\t{\n\t\t\tcodeKey,\n\t\t\ttextKey,\n\t\t\thideCode,\n\t\t\titems,\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\tplaceholder,\n\t\t\tsize,\n\t\t\tquery,\n\t\t\tdefaultQuery,\n\t\t\thighlightQuery,\n\t\t\tonQuery,\n\t\t\tdefaultFilter = true,\n\t\t\tonOpen,\n\t\t\tonClose,\n\t\t\tgetOptionDisabled,\n\t\t\tdisabled,\n\t\t\terror,\n\t\t\tisLoading,\n\t\t\trenderToken,\n\t\t\trenderToolbar,\n\t\t\trenderItem\n\t\t},\n\t\tref\n\t) => {\n\t\tconst inputRef = useRef<HTMLInputElement | null>(null);\n\t\tconst [open, setOpen] = useState(false);\n\t\tconst triggerMode = \"search-multi\";\n\t\tconst committedSelectedItems = value ?? fallback;\n\t\tconst committedSelectedKeys = useMemo(\n\t\t\t() => new Set(committedSelectedItems.map((item) => getItemKey(item, codeKey))),\n\t\t\t[codeKey, committedSelectedItems]\n\t\t);\n\t\tconst availableItems = useMemo(\n\t\t\t() => items.filter((item) => !committedSelectedKeys.has(getItemKey(item, codeKey))),\n\t\t\t[codeKey, committedSelectedKeys, items]\n\t\t);\n\t\tconst resolvedTextKey = useMemo(\n\t\t\t() => resolveMultiSelectTextKey([...committedSelectedItems, ...items], codeKey, textKey),\n\t\t\t[codeKey, committedSelectedItems, items, textKey]\n\t\t);\n\t\tconst {\n\t\t\tquery: currentQuery,\n\t\t\tsetQuery,\n\t\t\tresetQueryOnClose\n\t\t} = usePickerQuery({\n\t\t\tquery,\n\t\t\tdefaultQuery,\n\t\t\tonQuery,\n\t\t\ttriggerMode\n\t\t});\n\t\tconst handleOpenChange = (nextOpen: boolean) => {\n\t\t\tif (open && !nextOpen && resetQueryOnClose) {\n\t\t\t\tsetQuery(\"\");\n\t\t\t}\n\n\t\t\tsetOpen(nextOpen);\n\t\t};\n\t\tconst filteredCommittedSelectedItems = usePickerDefaultFilter({\n\t\t\toptions: committedSelectedItems,\n\t\t\tquery: currentQuery,\n\t\t\tenabled: defaultFilter,\n\t\t\tgetSearchText: (item) => getItemSearchParts(item, codeKey, resolvedTextKey)\n\t\t});\n\t\tconst filteredAvailableItems = usePickerDefaultFilter({\n\t\t\toptions: availableItems,\n\t\t\tquery: currentQuery,\n\t\t\tenabled: defaultFilter,\n\t\t\tgetSearchText: (item) => getItemSearchParts(item, codeKey, resolvedTextKey)\n\t\t});\n\t\tconst visibleOptions = useMemo(\n\t\t\t() => [...filteredCommittedSelectedItems, ...filteredAvailableItems],\n\t\t\t[filteredAvailableItems, filteredCommittedSelectedItems]\n\t\t);\n\t\tconst selectedIndex = filteredCommittedSelectedItems.length > 0 ? 0 : -1;\n\t\tconst {\n\t\t\tdraftValue: draftSelectedItems,\n\t\t\tsetDraftValue: setDraftSelectedItems,\n\t\t\tprepareOpen\n\t\t} = usePickerSelectionLifecycle({\n\t\t\tvalue: committedSelectedItems,\n\t\t\topen,\n\t\t\tonCommit: onChange,\n\t\t\tonOpen,\n\t\t\tonClose,\n\t\t\tisEqual: (left, right) => areSelectionsEqual(left, right, codeKey)\n\t\t});\n\t\tconst selectedKeys = useMemo(\n\t\t\t() => new Set(draftSelectedItems.map((item) => getItemKey(item, codeKey))),\n\t\t\t[codeKey, draftSelectedItems]\n\t\t);\n\t\tconst optionDisableContext = useMemo<MultiSelectOptionDisableContext>(\n\t\t\t() => ({\n\t\t\t\tselectedItems: draftSelectedItems,\n\t\t\t\tcommittedSelectedItems,\n\t\t\t\tselectedKeys,\n\t\t\t\topen\n\t\t\t}),\n\t\t\t[committedSelectedItems, draftSelectedItems, open, selectedKeys]\n\t\t);\n\t\tconst isOptionDisabled = useCallback(\n\t\t\t(item: CollectionItem) => getOptionDisabled?.(item, optionDisableContext) ?? false,\n\t\t\t[getOptionDisabled, optionDisableContext]\n\t\t);\n\t\tconst {\n\t\t\tactiveIndex,\n\t\t\tcontext,\n\t\t\tfloatingStyles,\n\t\t\tgetFloatingProps,\n\t\t\tsetReference,\n\t\t\tsetFloating,\n\t\t\tsetOptionRef,\n\t\t\tclose,\n\t\t\topenList,\n\t\t\ttoggleOpen,\n\t\t\tselectActiveOption,\n\t\t\thandleReferenceKeyDown,\n\t\t\thandleFloatingKeyDown,\n\t\t\tgetOptionId,\n\t\t\tgetActiveOptionId\n\t\t} = usePickerFloatingListbox({\n\t\t\toptions: visibleOptions,\n\t\t\tselectedIndex,\n\t\t\topen,\n\t\t\tonOpenChange: handleOpenChange,\n\t\t\tonSelect: undefined,\n\t\t\tdisabled,\n\t\t\tgetOptionDisabled: isOptionDisabled,\n\t\t\tcloseOnSelect: false,\n\t\t\tallowOpenWithoutOptions: true,\n\t\t\ttriggerMode\n\t\t});\n\n\t\tconst currentHighlightQuery = highlightQuery ?? currentQuery;\n\t\tconst toggleDraftSelection = (item: CollectionItem) => {\n\t\t\tconst itemKey = getItemKey(item, codeKey);\n\n\t\t\tsetDraftSelectedItems((currentItems) => {\n\t\t\t\tconst isSelected = currentItems.some((selectedItem) => getItemKey(selectedItem, codeKey) === itemKey);\n\n\t\t\t\tif (isSelected) {\n\t\t\t\t\treturn currentItems.filter((selectedItem) => getItemKey(selectedItem, codeKey) !== itemKey);\n\t\t\t\t}\n\n\t\t\t\tif (isOptionDisabled(item)) {\n\t\t\t\t\treturn currentItems;\n\t\t\t\t}\n\n\t\t\t\treturn [...currentItems, item];\n\t\t\t});\n\t\t};\n\n\t\tconst setInputNode = (node: HTMLInputElement | null) => {\n\t\t\tinputRef.current = node;\n\n\t\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(node);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (ref) {\n\t\t\t\tref.current = node;\n\t\t\t}\n\t\t};\n\n\t\tconst clearSelection = () => {\n\t\t\tsetDraftSelectedItems([]);\n\n\t\t\tif (!open) {\n\t\t\t\tonChange([]);\n\t\t\t}\n\t\t};\n\n\t\tconst selectAll = () => {\n\t\t\tsetDraftSelectedItems((currentItems) => {\n\t\t\t\tconst nextItems = [...currentItems];\n\t\t\t\tconst selectedKeys = new Set(currentItems.map((item) => getItemKey(item, codeKey)));\n\n\t\t\t\tfor (const item of visibleOptions) {\n\t\t\t\t\tconst itemKey = getItemKey(item, codeKey);\n\n\t\t\t\t\tif (!selectedKeys.has(itemKey) && !isOptionDisabled(item)) {\n\t\t\t\t\t\tselectedKeys.add(itemKey);\n\t\t\t\t\t\tnextItems.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn nextItems;\n\t\t\t});\n\t\t};\n\n\t\tconst deselectAll = () => {\n\t\t\tsetDraftSelectedItems([]);\n\t\t};\n\n\t\tconst selectOnlyOption = (item: CollectionItem) => {\n\t\t\tif (isOptionDisabled(item)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetDraftSelectedItems([item]);\n\t\t\tclose();\n\t\t};\n\n\t\tconst currentSelectedItems = open ? draftSelectedItems : committedSelectedItems;\n\t\tconst hasSelectedItems = currentSelectedItems.length > 0;\n\t\tconst renderContext: MultiSelectRenderContext = {\n\t\t\tselectedItems: currentSelectedItems,\n\t\t\tcommittedSelectedItems,\n\t\t\tavailableItems: filteredAvailableItems,\n\t\t\tquery: currentQuery,\n\t\t\topen,\n\t\t\tclearSelection,\n\t\t\tselectAll,\n\t\t\tdeselectAll\n\t\t};\n\t\tconst tokenRenderer =\n\t\t\trenderToken === undefined ? createDefaultMultiSelectTokenRenderer({ codeKey, textKey: resolvedTextKey }) : renderToken;\n\t\tconst itemRenderer =\n\t\t\trenderItem ??\n\t\t\tcreateDefaultMultiSelectItemRenderer({\n\t\t\t\tcodeKey,\n\t\t\t\ttextKey: resolvedTextKey,\n\t\t\t\thideCode\n\t\t\t});\n\t\tconst tokenNode = typeof tokenRenderer === \"function\" ? tokenRenderer(renderContext) : null;\n\t\tconst toolbarNode = typeof renderToolbar === \"function\" ? renderToolbar(renderContext) : renderToolbar;\n\t\tconst selectedEntries = filteredCommittedSelectedItems.map((item, index) => ({ item, index }));\n\t\tconst itemEntries = filteredAvailableItems.map((item, index) => ({ item, index: index + selectedEntries.length }));\n\t\tconst isNoData = !isLoading && !error && visibleOptions.length === 0;\n\t\tconst triggerController = usePickerTriggerController({\n\t\t\tmode: triggerMode,\n\t\t\topen,\n\t\t\tcurrentQuery,\n\t\t\thasDisplayValue: false,\n\t\t\tinputRef,\n\t\t\tsetQuery,\n\t\t\topenList,\n\t\t\tclose,\n\t\t\ttoggleOpen,\n\t\t\tonBeforeOpen: () => {\n\t\t\t\tif (!open) {\n\t\t\t\t\tprepareOpen();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn (\n\t\t\t<PickerField label={label} description={description} disabled={disabled} size={size} className={styles.multiSelect}>\n\t\t\t\t{({ controlId, labelId, describedBy }) => {\n\t\t\t\t\tconst listId = `${controlId}-listbox`;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PickerTrigger\n\t\t\t\t\t\t\t\tref={setInputNode}\n\t\t\t\t\t\t\t\trootRef={setReference}\n\t\t\t\t\t\t\t\tid={controlId}\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\topen={open}\n\t\t\t\t\t\t\t\toptionCount={items.length}\n\t\t\t\t\t\t\t\tlabel={label}\n\t\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\t\tplaceholderFallback=\"Выберите значения\"\n\t\t\t\t\t\t\t\tvalue={currentQuery}\n\t\t\t\t\t\t\t\tselectedValue={tokenNode}\n\t\t\t\t\t\t\t\thasSelection={hasSelectedItems}\n\t\t\t\t\t\t\t\tshowSelectedValue={hasSelectedItems && currentQuery.length === 0}\n\t\t\t\t\t\t\t\tclearable\n\t\t\t\t\t\t\t\tonClear={clearSelection}\n\t\t\t\t\t\t\t\tclearAriaLabel=\"Очистить все\"\n\t\t\t\t\t\t\t\tonToggleMouseDown={triggerController.handleToggleMouseDown}\n\t\t\t\t\t\t\t\tonToggleClick={triggerController.handleToggleClick}\n\t\t\t\t\t\t\t\taria-labelledby={labelId}\n\t\t\t\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t\t\taria-expanded={open}\n\t\t\t\t\t\t\t\taria-controls={open ? listId : undefined}\n\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\taria-activedescendant={open ? getActiveOptionId(listId) : undefined}\n\t\t\t\t\t\t\t\trootClassName=\"flex alignItemsCenter\"\n\t\t\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\t\t\ttriggerController.handleTriggerInputChange(event.target.value);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonClick={triggerController.handleTriggerClick}\n\t\t\t\t\t\t\t\tonFocus={(event) => {\n\t\t\t\t\t\t\t\t\ttriggerController.handleTriggerFocus(event.currentTarget);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\t\t\t\t\thandleReferenceKeyDown(event);\n\n\t\t\t\t\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\ttriggerController.handleTriggerKeyDown({\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tonActivateWhenOpen: () => {\n\t\t\t\t\t\t\t\t\t\t\tif (activeIndex >= 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst activeItem = visibleOptions[activeIndex];\n\t\t\t\t\t\t\t\t\t\t\t\tif (activeItem) {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttoggleDraftSelection(activeItem);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tselectActiveOption();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tenableClosedArrowDownOpen: true,\n\t\t\t\t\t\t\t\t\t\tsuppressClosedArrowUp: true\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<PickerPopup\n\t\t\t\t\t\t\t\topen={open}\n\t\t\t\t\t\t\t\tcontext={context}\n\t\t\t\t\t\t\t\tfloatingStyles={floatingStyles}\n\t\t\t\t\t\t\t\tlistId={listId}\n\t\t\t\t\t\t\t\tlabelId={labelId}\n\t\t\t\t\t\t\t\tdescriptionId={describedBy}\n\t\t\t\t\t\t\t\tactiveOptionId={open ? getActiveOptionId(listId) : undefined}\n\t\t\t\t\t\t\t\tsetFloating={setFloating}\n\t\t\t\t\t\t\t\tgetFloatingProps={getFloatingProps}\n\t\t\t\t\t\t\t\tonKeyDown={handleFloatingKeyDown}\n\t\t\t\t\t\t\t\tinitialFocus={-1}\n\t\t\t\t\t\t\t\treturnFocus={false}\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\ttoolbar={toolbarNode}\n\t\t\t\t\t\t\t\tselectionActions={\n\t\t\t\t\t\t\t\t\trenderToolbar === undefined ? { onSelectAll: selectAll, onDeselectAll: deselectAll } : undefined\n\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t<MultiSelectOptionsWrapper isNoData={isNoData} error={error}>\n\t\t\t\t\t\t\t\t\t<div className=\"scrollable overscroll h100\">\n\t\t\t\t\t\t\t\t\t\t<MultiSelectOptionGroup\n\t\t\t\t\t\t\t\t\t\t\tentries={selectedEntries}\n\t\t\t\t\t\t\t\t\t\t\tlistId={listId}\n\t\t\t\t\t\t\t\t\t\t\tactiveIndex={activeIndex}\n\t\t\t\t\t\t\t\t\t\t\tselectedKeys={selectedKeys}\n\t\t\t\t\t\t\t\t\t\t\tcodeKey={codeKey}\n\t\t\t\t\t\t\t\t\t\t\tquery={currentQuery}\n\t\t\t\t\t\t\t\t\t\t\thighlightQuery={currentHighlightQuery}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionDisabled={isOptionDisabled}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionId={getOptionId}\n\t\t\t\t\t\t\t\t\t\t\tsetOptionRef={setOptionRef}\n\t\t\t\t\t\t\t\t\t\t\ttoggleOption={toggleDraftSelection}\n\t\t\t\t\t\t\t\t\t\t\tselectOnlyOption={selectOnlyOption}\n\t\t\t\t\t\t\t\t\t\t\trenderItem={itemRenderer}\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t{selectedEntries.length > 0 && availableItems.length > 0 && <Separator className=\"marginBlockSm\" />}\n\n\t\t\t\t\t\t\t\t\t\t<MultiSelectOptionGroup\n\t\t\t\t\t\t\t\t\t\t\tentries={itemEntries}\n\t\t\t\t\t\t\t\t\t\t\tlistId={listId}\n\t\t\t\t\t\t\t\t\t\t\tactiveIndex={activeIndex}\n\t\t\t\t\t\t\t\t\t\t\tselectedKeys={selectedKeys}\n\t\t\t\t\t\t\t\t\t\t\tcodeKey={codeKey}\n\t\t\t\t\t\t\t\t\t\t\tquery={currentQuery}\n\t\t\t\t\t\t\t\t\t\t\thighlightQuery={currentHighlightQuery}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionDisabled={isOptionDisabled}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionId={getOptionId}\n\t\t\t\t\t\t\t\t\t\t\tsetOptionRef={setOptionRef}\n\t\t\t\t\t\t\t\t\t\t\ttoggleOption={toggleDraftSelection}\n\t\t\t\t\t\t\t\t\t\t\tselectOnlyOption={selectOnlyOption}\n\t\t\t\t\t\t\t\t\t\t\trenderItem={itemRenderer}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</MultiSelectOptionsWrapper>\n\t\t\t\t\t\t\t</PickerPopup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t}}\n\t\t\t</PickerField>\n\t\t);\n\t}\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n","import { ODataCollectionModel, ODataSelectBaseProps } from \"@ryuzaki13/react-foundation-api/odata\";\nimport { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata-service\";\n\nimport { mapSelectedItemsToValues, useODataSelectBase } from \"../../select/model/useODataSelectBase\";\n\ninterface UseODataMultiSelectOptions extends Omit<ODataSelectBaseProps, \"model\"> {\n\tmodel: Required<ODataCollectionModel>;\n\tonChange: (keys: string[]) => void;\n}\n\nexport function useODataMultiSelect({ odata, segment, model, value, dependencies, onChange }: UseODataMultiSelectOptions) {\n\tconst odataModel = useODataSelectBase({\n\t\todata,\n\t\tsegment,\n\t\tmodel,\n\t\tvalue,\n\t\tdependencies\n\t});\n\n\tconst handleChange = (items: CollectionItem[]) => {\n\t\tonChange(mapSelectedItemsToValues(items, odataModel.selectionKey));\n\t};\n\n\treturn {\n\t\t...odataModel,\n\t\thandleChange\n\t};\n}\n","import React from \"react\";\n\nimport { ODataSelectBaseProps, useODataCollectionModel } from \"@ryuzaki13/react-foundation-api/odata\";\n\nimport { UiBaseProps } from \"../../types\";\nimport { useODataMultiSelect } from \"../model/useODataMultiSelect\";\n\nimport { MultiSelect } from \"./MultiSelect\";\n\ntype ODataMultiSelectProps = ODataSelectBaseProps & Omit<UiBaseProps<string[]>, \"placeholder\"> & {};\n\nexport const ODataMultiSelect: React.FC<ODataMultiSelectProps> = ({\n\todata,\n\tsegment,\n\tmodel: initialModel,\n\tlabel,\n\tdescription,\n\tdisabled,\n\tvalue,\n\tdependencies,\n\tonChange,\n\tsize\n}) => {\n\tconst model = useODataCollectionModel(initialModel);\n\tconst odataModel = useODataMultiSelect({\n\t\todata,\n\t\tsegment,\n\t\tmodel,\n\t\tvalue,\n\t\tdependencies,\n\t\tonChange\n\t});\n\n\treturn (\n\t\t<MultiSelect\n\t\t\tlabel={label}\n\t\t\tdescription={description}\n\t\t\tsize={size}\n\t\t\tcodeKey={odataModel.codeKey}\n\t\t\ttextKey={odataModel.textKey}\n\t\t\thideCode={segment.hideCode ?? odata.hideCode}\n\t\t\titems={odataModel.filteredItems}\n\t\t\tvalue={odataModel.selectedItems}\n\t\t\tonChange={odataModel.handleChange}\n\t\t\tonQuery={odataModel.setQuery}\n\t\t\tquery={odataModel.query}\n\t\t\tdefaultFilter={false}\n\t\t\thighlightQuery={odataModel.debouncedQuery}\n\t\t\tisLoading={odataModel.isLoading}\n\t\t\tdisabled={disabled}\n\t\t\tplaceholder={odataModel.placeholder}\n\t\t\terror={odataModel.isError ? \"Ошибка загрузки\" : undefined}\n\t\t/>\n\t);\n};\n","import { useCallback } from \"react\";\n\nimport { useODataDependentSelection } from \"../../odata-dependent\";\n\nimport { ODataMultiSelect } from \"./ODataMultiSelect\";\n\nimport type { ODataDependentSegmentControlProps } from \"../../odata-dependent\";\n\nexport type ODataDependentSegmentMultiSelectProps = ODataDependentSegmentControlProps;\n\nexport function ODataDependentSegmentMultiSelect(props: ODataDependentSegmentMultiSelectProps) {\n\tconst { item, disabled, label, description, size, width = 15 } = props;\n\tconst selection = useODataDependentSelection(props);\n\tconst { updateSegment } = selection;\n\tconst widthStyle = `calc(${width}em + var(--width-add))`;\n\n\tconst handleSelectionChange = useCallback(\n\t\t(keys: string[]) => {\n\t\t\tupdateSegment(item.id, keys);\n\t\t},\n\t\t[item.id, updateSegment]\n\t);\n\n\treturn (\n\t\t<div style={{ maxWidth: widthStyle, minWidth: widthStyle }}>\n\t\t\t<ODataMultiSelect\n\t\t\t\todata={item.odata}\n\t\t\t\tsegment={item.segment}\n\t\t\t\tmodel={item.model}\n\t\t\t\tdependencies={selection.values}\n\t\t\t\tvalue={selection.values[item.id]}\n\t\t\t\tonChange={handleSelectionChange}\n\t\t\t\tdisabled={disabled || selection.isSegmentDisabled(item.id)}\n\t\t\t\tlabel={label}\n\t\t\t\tdescription={description}\n\t\t\t\tsize={size}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n","import { flattenODataDependentServices, type ODataDependentBaseProps } from \"@ryuzaki13/react-foundation-api/odata\";\n\nimport { useODataDependentSelection } from \"../../odata-dependent\";\n\nimport { ODataDependentSegmentMultiSelect } from \"./ODataDependentSegmentMultiSelect\";\n\nimport type { UseODataDependentSelectionOptions } from \"../../odata-dependent\";\n\nexport type ODataDependentMultiSelectProps = Omit<ODataDependentBaseProps, \"dependencies\" | \"value\"> &\n\tUseODataDependentSelectionOptions & {\n\t\t/**\n\t\t * Ширина одного элемента в `em` единицах.\n\t\t *\n\t\t * @default 15\n\t\t */\n\t\twidth?: number;\n\t};\n\nexport function ODataDependentMultiSelect(props: ODataDependentMultiSelectProps) {\n\tconst { width = 15, odata, segments, model, values, defaultValues, onChange, selectionMode, segmentOrder } = props;\n\tconst selection = useODataDependentSelection({ values, defaultValues, onChange });\n\tconst segmentSelectionProps =\n\t\tselectionMode === \"sequential\" ? { selectionMode: \"sequential\" as const, segmentOrder } : { selectionMode, segmentOrder };\n\tconst items = flattenODataDependentServices([\n\t\t{\n\t\t\todata,\n\t\t\tsegments,\n\t\t\tmodel\n\t\t}\n\t]);\n\n\treturn items.map((item) => (\n\t\t<ODataDependentSegmentMultiSelect\n\t\t\tkey={item.id}\n\t\t\titem={item}\n\t\t\tvalues={selection.values}\n\t\t\tonChange={selection.updateValues}\n\t\t\t{...segmentSelectionProps}\n\t\t\twidth={width}\n\t\t/>\n\t));\n}\n","import { MultiSelect } from \"./MultiSelect\";\n\nimport type { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata-service\";\nimport type { UiBaseProps } from \"../../types\";\n\ntype SerializableOptionRecord = Record<string, unknown>;\n\ntype SerializableOptionKeyField<TOption extends SerializableOptionRecord> = {\n\t[K in keyof TOption]: Extract<TOption[K], string> extends never ? never : K;\n}[keyof TOption];\n\nexport interface SerializableMultiSelectProps<\n\tTOption extends SerializableOptionRecord,\n\tTOptionKey extends SerializableOptionKeyField<TOption>,\n\tTOptionLabel extends keyof TOption\n> extends UiBaseProps<Extract<TOption[TOptionKey], string>[]> {\n\toptions: readonly TOption[];\n\toptionKey: TOptionKey;\n\toptionLabel: TOptionLabel;\n\trenderCode?: true;\n}\n\nfunction getSerializableOptionKey<TOption extends SerializableOptionRecord, TOptionKey extends SerializableOptionKeyField<TOption>>(\n\toption: TOption,\n\toptionKey: TOptionKey\n): Extract<TOption[TOptionKey], string> {\n\treturn option[optionKey] as Extract<TOption[TOptionKey], string>;\n}\n\nfunction getSerializableOptionLabel<\n\tTOption extends SerializableOptionRecord,\n\tTOptionKey extends SerializableOptionKeyField<TOption>,\n\tTOptionLabel extends keyof TOption\n>(option: TOption, optionLabel: TOptionLabel, optionKey: TOptionKey): string {\n\tconst label = option[optionLabel];\n\n\tif (typeof label === \"string\") {\n\t\treturn label;\n\t}\n\n\tconst key = getSerializableOptionKey(option, optionKey);\n\treturn typeof key === \"string\" ? key : String(key);\n}\n\nexport function SerializableMultiSelect<\n\tTOption extends SerializableOptionRecord,\n\tTOptionKey extends SerializableOptionKeyField<TOption>,\n\tTOptionLabel extends keyof TOption\n>({\n\tlabel,\n\tdescription,\n\tdisabled,\n\tplaceholder,\n\tsize,\n\toptions,\n\tvalue,\n\tonChange,\n\toptionKey,\n\toptionLabel,\n\trenderCode\n}: SerializableMultiSelectProps<TOption, TOptionKey, TOptionLabel>) {\n\t// Как будто можно не мемоизировать, нет смысла\n\tconst items = options.map<CollectionItem>((option) => ({\n\t\tkey: String(getSerializableOptionKey(option, optionKey)),\n\t\ttext: getSerializableOptionLabel(option, optionLabel, optionKey)\n\t}));\n\tconst selectedKeys = new Set((value ?? []).map((item) => String(item)));\n\tconst selectedItems = items.filter((item) => selectedKeys.has(item.key));\n\n\treturn (\n\t\t<MultiSelect\n\t\t\tlabel={label}\n\t\t\tdescription={description}\n\t\t\tdisabled={disabled}\n\t\t\tplaceholder={placeholder}\n\t\t\tsize={size}\n\t\t\titems={items}\n\t\t\tcodeKey=\"key\"\n\t\t\ttextKey=\"text\"\n\t\t\thideCode={renderCode ? undefined : true}\n\t\t\tvalue={selectedItems}\n\t\t\tonChange={(nextItems) => onChange(nextItems.map((item) => item.key) as Extract<TOption[TOptionKey], string>[])}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;ACWA,SAAgB,EAA0B,EAAE,SAAM,cAA2C;CAC5F,OACC,kBAAC,OAAD;EAAK,WAAW,EAAS;EAAzB,UAAA,CACC,kBAAC,QAAD,EAAM,WAAW,EAAS,kBAAyB,CAAA,GACnD,kBAAC,GAAD;GAAM,OAAO,IAAU,UAAU;GAAY,UAAA;EAAW,CAAA,CACpD;;AAEP;;;ACYA,SAAS,GAA0B,EAAE,aAAU,UAAO,eAAqC;CAK1F,OAJI,IAAiB,kBAAC,GAAD,EAAc,YAAY,kBAAC,GAAD,EAA2B,MAAK,aAAc,CAAA,EAAI,CAAA,IAE7F,IAAc,kBAAC,GAAD,EAAc,YAAY,kBAAC,GAAD;EAA2B,SAAA;EAAQ,MAAK;CAAmB,CAAA,EAAI,CAAA,IAEpG,kB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B,GAAQ,CAAS;CACtD,OAAO,OAAO,KAAQ,WAAW,IAAM,OAAO,CAAG;AAClD;AAEA,SAAgB,EAId,EACD,UACA,gBACA,aACA,gBACA,SACA,YACA,UACA,aACA,cACA,gBACA,iBACmE;CAEnE,IAAM,IAAQ,EAAQ,KAAqB,OAAY;EACtD,KAAK,OAAO,EAAyB,GAAQ,CAAS,CAAC;EACvD,MAAM,EAA2B,GAAQ,GAAa,CAAS;CAChE,EAAE,GACI,IAAe,IAAI,KAAK,KAAS,CAAC,EAAA,CAAG,KAAK,MAAS,OAAO,CAAI,CAAC,CAAC,GAChE,IAAgB,EAAM,QAAQ,MAAS,EAAa,IAAI,EAAK,GAAG,CAAC;CAEvE,OACC,kBAAC,GAAD;EACQ;EACM;EACH;EACG;EACP;EACC;EACP,SAAQ;EACR,SAAQ;EACR,UAAU,MAAa,KAAA;EACvB,OAAO;EACP,WAAW,MAAc,EAAS,EAAU,KAAK,MAAS,EAAK,GAAG,CAA2C;CAC7G,CAAA;AAEH"}
|
|
1
|
+
{"version":3,"file":"multi-select-BZ9N6Dal.js","names":[],"sources":["../../src/multi-select/ui/MultiSelect.module.scss","../../src/multi-select/ui/MultiSelectOptionSkeleton.tsx","../../src/multi-select/ui/MultiSelect.tsx","../../src/multi-select/model/useODataMultiSelect.ts","../../src/multi-select/ui/ODataMultiSelect.tsx","../../src/multi-select/ui/ODataDependentSegmentMultiSelect.tsx","../../src/multi-select/ui/ODataDependentMultiSelect.tsx","../../src/multi-select/ui/SerializableMultiSelect.tsx"],"sourcesContent":["@use \"@/styles/mixins\" as *;\n\n.multiSelect {\n\t// Общий контейнер\n\tpadding: 0;\n}\n\n.optionCheckBox {\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\n\t--check-box-control-size: auto;\n\tpadding-left: var(--space-sm);\n}\n","import { Text } from \"../../text\";\nimport uiStyles from \"../../ui.module.scss\";\n\ninterface MultiSelectOptionSkeletonProps {\n\ttext: string;\n\tisError?: boolean;\n}\n\n/**\n * Скелетон строки опции для `MultiSelect`. Используется во время загрузки или при отображении ошибок получения списка.\n */\nexport function MultiSelectOptionSkeleton({ text, isError }: MultiSelectOptionSkeletonProps) {\n\treturn (\n\t\t<div className={uiStyles.uiPopupOption}>\n\t\t\t<span className={uiStyles.uiPopupOptionIcon}></span>\n\t\t\t<Text color={isError ? \"error\" : \"primary\"}>{text}</Text>\n\t\t</div>\n\t);\n}\n","import React, { forwardRef, type PropsWithChildren, useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { CheckBox } from \"../../check-box\";\nimport { Option, OptionButton } from \"../../option\";\nimport {\n\tPickerField,\n\tPickerPopup,\n\tPickerStatus,\n\tPickerTrigger,\n\tusePickerDefaultFilter,\n\tusePickerFloatingListbox,\n\tusePickerQuery,\n\tusePickerSelectionLifecycle,\n\tusePickerTriggerController\n} from \"../../picker\";\nimport { Separator } from \"../../separator\";\nimport { type UiBaseProps } from \"../../types\";\n\nimport { createDefaultMultiSelectItemRenderer, createDefaultMultiSelectTokenRenderer, resolveMultiSelectTextKey } from \"./defaultRenderers\";\nimport styles from \"./MultiSelect.module.scss\";\nimport { MultiSelectOptionSkeleton } from \"./MultiSelectOptionSkeleton\";\n\nimport type { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata-service\";\n\ninterface MultiSelectOptionsProps extends PropsWithChildren {\n\tisNoData?: boolean;\n\t// isLoading?: boolean;\n\terror?: string;\n}\n\nfunction MultiSelectOptionsWrapper({ isNoData, error, children }: MultiSelectOptionsProps) {\n\tif (isNoData) return <PickerStatus emptyState={<MultiSelectOptionSkeleton text=\"Нет данных\" />} />;\n\t// if (isLoading) return <PickerStatus loadingState={<MultiSelectOptionSkeleton text=\"Загрузка...\" />} />;\n\tif (error) return <PickerStatus errorState={<MultiSelectOptionSkeleton isError text=\"Ошибка загрузки\" />} />;\n\n\treturn <>{children}</>;\n}\n\nexport interface MultiSelectItemState {\n\tselected: boolean;\n\tactive: boolean;\n\tdisabled: boolean;\n\tquery: string;\n\thighlightQuery: string;\n}\n\n/**\n * Структурированное содержимое опции множественного выбора. `MultiSelect` владеет\n * интерактивной оболочкой и checkbox-слотом, а renderer отвечает только за данные\n * текстовой части, поэтому единая композиция `OptionButton` сохраняется и для\n * произвольного ReactNode.\n */\nexport interface MultiSelectOptionContent {\n\ttext: string;\n\tcode: string | undefined;\n}\n\nexport interface MultiSelectRenderContext {\n\tselectedItems: CollectionItem[];\n\tcommittedSelectedItems: CollectionItem[];\n\tavailableItems: CollectionItem[];\n\tquery: string;\n\topen: boolean;\n\tclearSelection: () => void;\n\tselectAll: () => void;\n\tdeselectAll: () => void;\n}\n\nexport interface MultiSelectOptionDisableContext {\n\tselectedItems: CollectionItem[];\n\tcommittedSelectedItems: CollectionItem[];\n\tselectedKeys: ReadonlySet<string>;\n\topen: boolean;\n}\n\ntype MultiSelectOptionalRenderer<TContext> = ((context: TContext) => React.ReactNode) | null | false;\n\ninterface MultiSelectRenderers {\n\trenderToken?: MultiSelectOptionalRenderer<MultiSelectRenderContext>;\n\trenderToolbar?: MultiSelectOptionalRenderer<MultiSelectRenderContext>;\n\trenderItem?: (item: CollectionItem, state: MultiSelectItemState) => MultiSelectOptionContent;\n}\n\nexport interface MultiSelectProps<TOption extends Record<string, string> = CollectionItem>\n\textends MultiSelectRenderers, UiBaseProps<TOption[]> {\n\tcodeKey: string;\n\ttextKey?: string;\n\thideCode?: boolean;\n\tquery?: string;\n\tdefaultQuery?: string;\n\thighlightQuery?: string;\n\tonQuery?: (value: string) => void;\n\tdefaultFilter?: boolean;\n\titems: TOption[];\n\tgetOptionDisabled?: (item: TOption, context: MultiSelectOptionDisableContext) => boolean;\n\tonOpen?: () => void;\n\tonClose?: (value: TOption[]) => void;\n\terror?: string;\n\tisLoading?: boolean;\n}\n\nconst fallback: CollectionItem[] = [];\n\nfunction getItemKey(item: CollectionItem, codeKey: string) {\n\treturn item[codeKey];\n}\n\nfunction getItemSearchParts(item: CollectionItem, codeKey: string, textKey: string) {\n\treturn Array.from(new Set([item[textKey], item[codeKey], ...Object.values(item)]));\n}\n\nfunction areSelectionsEqual(left: CollectionItem[], right: CollectionItem[], codeKey: string) {\n\tif (left.length !== right.length) {\n\t\treturn false;\n\t}\n\n\tconst rightKeys = new Set(right.map((item) => getItemKey(item, codeKey)));\n\n\treturn left.every((item) => rightKeys.has(getItemKey(item, codeKey)));\n}\n\ninterface MultiSelectOptionEntry {\n\titem: CollectionItem;\n\tindex: number;\n}\n\ninterface MultiSelectOptionGroupProps {\n\tentries: MultiSelectOptionEntry[];\n\tlistId: string;\n\tactiveIndex: number;\n\tselectedKeys: Set<string>;\n\tcodeKey: string;\n\tquery: string;\n\thighlightQuery: string;\n\tgetOptionDisabled?: (item: CollectionItem) => boolean;\n\tgetOptionId: (listId: string, index: number) => string;\n\tsetOptionRef: (index: number, node: HTMLElement | null) => void;\n\ttoggleOption: (item: CollectionItem) => void;\n\tselectOnlyOption: (item: CollectionItem) => void;\n\trenderItem: (item: CollectionItem, state: MultiSelectItemState) => MultiSelectOptionContent;\n}\n\nfunction MultiSelectOptionGroup({\n\tentries,\n\tlistId,\n\tactiveIndex,\n\tselectedKeys,\n\tcodeKey,\n\tquery,\n\thighlightQuery,\n\tgetOptionDisabled,\n\tgetOptionId,\n\tsetOptionRef,\n\ttoggleOption,\n\tselectOnlyOption,\n\trenderItem\n}: MultiSelectOptionGroupProps) {\n\treturn entries.map(({ item, index }) => {\n\t\tconst active = index === activeIndex;\n\t\tconst itemKey = getItemKey(item, codeKey);\n\t\tconst selected = selectedKeys.has(itemKey);\n\t\tconst optionDisabled = getOptionDisabled?.(item) ?? false;\n\t\tconst content = renderItem(item, { selected, active, disabled: optionDisabled, query, highlightQuery });\n\n\t\treturn (\n\t\t\t<Option\n\t\t\t\tkey={`${itemKey}-${index}`}\n\t\t\t\tid={getOptionId(listId, index)}\n\t\t\t\tref={(node) => setOptionRef(index, node)}\n\t\t\t\trole=\"option\"\n\t\t\t\taria-selected={selected}\n\t\t\t\taria-disabled={optionDisabled || undefined}\n\t\t\t\tselected={selected}\n\t\t\t\tactive={active}\n\t\t\t\tdisabled={optionDisabled}>\n\t\t\t\t<div\n\t\t\t\t\tclassName={styles.optionCheckBox}\n\t\t\t\t\tonMouseDown={(event) => event.stopPropagation()}\n\t\t\t\t\tonClick={(event) => event.stopPropagation()}>\n\t\t\t\t\t<CheckBox\n\t\t\t\t\t\tvalue={selected}\n\t\t\t\t\t\tdisabled={optionDisabled}\n\t\t\t\t\t\taria-label={`Выбрать ${highlightQuery ?? itemKey}`}\n\t\t\t\t\t\tonChange={() => toggleOption(item)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<OptionButton\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tdisabled={optionDisabled}\n\t\t\t\t\ttext={content.text}\n\t\t\t\t\tcode={content.code}\n\t\t\t\t\tsearchText={highlightQuery}\n\t\t\t\t\tonMouseDown={(event) => event.preventDefault()}\n\t\t\t\t\tonClick={() => selectOnlyOption(item)}\n\t\t\t\t/>\n\t\t\t</Option>\n\t\t);\n\t});\n}\n\n/**\n * Поле множественного выбора с внутренним черновиком значений и подтверждением выбора при закрытии списка.\n * Подходит как для самостоятельного использования, так и как базовый слой для OData-оберток.\n */\nexport const MultiSelect = forwardRef<HTMLInputElement, MultiSelectProps>(\n\t(\n\t\t{\n\t\t\tcodeKey,\n\t\t\ttextKey,\n\t\t\thideCode,\n\t\t\titems,\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\tplaceholder,\n\t\t\tsize,\n\t\t\tquery,\n\t\t\tdefaultQuery,\n\t\t\thighlightQuery,\n\t\t\tonQuery,\n\t\t\tdefaultFilter = true,\n\t\t\tonOpen,\n\t\t\tonClose,\n\t\t\tgetOptionDisabled,\n\t\t\tdisabled,\n\t\t\terror,\n\t\t\tisLoading,\n\t\t\trenderToken,\n\t\t\trenderToolbar,\n\t\t\trenderItem\n\t\t},\n\t\tref\n\t) => {\n\t\tconst inputRef = useRef<HTMLInputElement | null>(null);\n\t\tconst [open, setOpen] = useState(false);\n\t\tconst triggerMode = \"search-multi\";\n\t\tconst committedSelectedItems = value ?? fallback;\n\t\tconst committedSelectedKeys = useMemo(\n\t\t\t() => new Set(committedSelectedItems.map((item) => getItemKey(item, codeKey))),\n\t\t\t[codeKey, committedSelectedItems]\n\t\t);\n\t\tconst availableItems = useMemo(\n\t\t\t() => items.filter((item) => !committedSelectedKeys.has(getItemKey(item, codeKey))),\n\t\t\t[codeKey, committedSelectedKeys, items]\n\t\t);\n\t\tconst resolvedTextKey = useMemo(\n\t\t\t() => resolveMultiSelectTextKey([...committedSelectedItems, ...items], codeKey, textKey),\n\t\t\t[codeKey, committedSelectedItems, items, textKey]\n\t\t);\n\t\tconst {\n\t\t\tquery: currentQuery,\n\t\t\tsetQuery,\n\t\t\tresetQueryOnClose\n\t\t} = usePickerQuery({\n\t\t\tquery,\n\t\t\tdefaultQuery,\n\t\t\tonQuery,\n\t\t\ttriggerMode\n\t\t});\n\t\tconst handleOpenChange = (nextOpen: boolean) => {\n\t\t\tif (open && !nextOpen && resetQueryOnClose) {\n\t\t\t\tsetQuery(\"\");\n\t\t\t}\n\n\t\t\tsetOpen(nextOpen);\n\t\t};\n\t\tconst filteredCommittedSelectedItems = usePickerDefaultFilter({\n\t\t\toptions: committedSelectedItems,\n\t\t\tquery: currentQuery,\n\t\t\tenabled: defaultFilter,\n\t\t\tgetSearchText: (item) => getItemSearchParts(item, codeKey, resolvedTextKey)\n\t\t});\n\t\tconst filteredAvailableItems = usePickerDefaultFilter({\n\t\t\toptions: availableItems,\n\t\t\tquery: currentQuery,\n\t\t\tenabled: defaultFilter,\n\t\t\tgetSearchText: (item) => getItemSearchParts(item, codeKey, resolvedTextKey)\n\t\t});\n\t\tconst visibleOptions = useMemo(\n\t\t\t() => [...filteredCommittedSelectedItems, ...filteredAvailableItems],\n\t\t\t[filteredAvailableItems, filteredCommittedSelectedItems]\n\t\t);\n\t\tconst selectedIndex = filteredCommittedSelectedItems.length > 0 ? 0 : -1;\n\t\tconst {\n\t\t\tdraftValue: draftSelectedItems,\n\t\t\tsetDraftValue: setDraftSelectedItems,\n\t\t\tprepareOpen\n\t\t} = usePickerSelectionLifecycle({\n\t\t\tvalue: committedSelectedItems,\n\t\t\topen,\n\t\t\tonCommit: onChange,\n\t\t\tonOpen,\n\t\t\tonClose,\n\t\t\tisEqual: (left, right) => areSelectionsEqual(left, right, codeKey)\n\t\t});\n\t\tconst selectedKeys = useMemo(\n\t\t\t() => new Set(draftSelectedItems.map((item) => getItemKey(item, codeKey))),\n\t\t\t[codeKey, draftSelectedItems]\n\t\t);\n\t\tconst optionDisableContext = useMemo<MultiSelectOptionDisableContext>(\n\t\t\t() => ({\n\t\t\t\tselectedItems: draftSelectedItems,\n\t\t\t\tcommittedSelectedItems,\n\t\t\t\tselectedKeys,\n\t\t\t\topen\n\t\t\t}),\n\t\t\t[committedSelectedItems, draftSelectedItems, open, selectedKeys]\n\t\t);\n\t\tconst isOptionDisabled = useCallback(\n\t\t\t(item: CollectionItem) => getOptionDisabled?.(item, optionDisableContext) ?? false,\n\t\t\t[getOptionDisabled, optionDisableContext]\n\t\t);\n\t\tconst {\n\t\t\tactiveIndex,\n\t\t\tcontext,\n\t\t\tfloatingStyles,\n\t\t\tgetFloatingProps,\n\t\t\tsetReference,\n\t\t\tsetFloating,\n\t\t\tsetOptionRef,\n\t\t\tclose,\n\t\t\topenList,\n\t\t\ttoggleOpen,\n\t\t\tselectActiveOption,\n\t\t\thandleReferenceKeyDown,\n\t\t\thandleFloatingKeyDown,\n\t\t\tgetOptionId,\n\t\t\tgetActiveOptionId\n\t\t} = usePickerFloatingListbox({\n\t\t\toptions: visibleOptions,\n\t\t\tselectedIndex,\n\t\t\topen,\n\t\t\tonOpenChange: handleOpenChange,\n\t\t\tonSelect: undefined,\n\t\t\tdisabled,\n\t\t\tgetOptionDisabled: isOptionDisabled,\n\t\t\tcloseOnSelect: false,\n\t\t\tallowOpenWithoutOptions: true,\n\t\t\ttriggerMode\n\t\t});\n\n\t\tconst currentHighlightQuery = highlightQuery ?? currentQuery;\n\t\tconst toggleDraftSelection = (item: CollectionItem) => {\n\t\t\tconst itemKey = getItemKey(item, codeKey);\n\n\t\t\tsetDraftSelectedItems((currentItems) => {\n\t\t\t\tconst isSelected = currentItems.some((selectedItem) => getItemKey(selectedItem, codeKey) === itemKey);\n\n\t\t\t\tif (isSelected) {\n\t\t\t\t\treturn currentItems.filter((selectedItem) => getItemKey(selectedItem, codeKey) !== itemKey);\n\t\t\t\t}\n\n\t\t\t\tif (isOptionDisabled(item)) {\n\t\t\t\t\treturn currentItems;\n\t\t\t\t}\n\n\t\t\t\treturn [...currentItems, item];\n\t\t\t});\n\t\t};\n\n\t\tconst setInputNode = (node: HTMLInputElement | null) => {\n\t\t\tinputRef.current = node;\n\n\t\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(node);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (ref) {\n\t\t\t\tref.current = node;\n\t\t\t}\n\t\t};\n\n\t\tconst clearSelection = () => {\n\t\t\tsetDraftSelectedItems([]);\n\n\t\t\tif (!open) {\n\t\t\t\tonChange([]);\n\t\t\t}\n\t\t};\n\n\t\tconst selectAll = () => {\n\t\t\tsetDraftSelectedItems((currentItems) => {\n\t\t\t\tconst nextItems = [...currentItems];\n\t\t\t\tconst selectedKeys = new Set(currentItems.map((item) => getItemKey(item, codeKey)));\n\n\t\t\t\tfor (const item of visibleOptions) {\n\t\t\t\t\tconst itemKey = getItemKey(item, codeKey);\n\n\t\t\t\t\tif (!selectedKeys.has(itemKey) && !isOptionDisabled(item)) {\n\t\t\t\t\t\tselectedKeys.add(itemKey);\n\t\t\t\t\t\tnextItems.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn nextItems;\n\t\t\t});\n\t\t};\n\n\t\tconst deselectAll = () => {\n\t\t\tsetDraftSelectedItems([]);\n\t\t};\n\n\t\tconst selectOnlyOption = (item: CollectionItem) => {\n\t\t\tif (isOptionDisabled(item)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetDraftSelectedItems([item]);\n\t\t\tclose();\n\t\t};\n\n\t\tconst currentSelectedItems = open ? draftSelectedItems : committedSelectedItems;\n\t\tconst hasSelectedItems = currentSelectedItems.length > 0;\n\t\tconst renderContext: MultiSelectRenderContext = {\n\t\t\tselectedItems: currentSelectedItems,\n\t\t\tcommittedSelectedItems,\n\t\t\tavailableItems: filteredAvailableItems,\n\t\t\tquery: currentQuery,\n\t\t\topen,\n\t\t\tclearSelection,\n\t\t\tselectAll,\n\t\t\tdeselectAll\n\t\t};\n\t\tconst tokenRenderer =\n\t\t\trenderToken === undefined ? createDefaultMultiSelectTokenRenderer({ codeKey, textKey: resolvedTextKey }) : renderToken;\n\t\tconst itemRenderer =\n\t\t\trenderItem ??\n\t\t\tcreateDefaultMultiSelectItemRenderer({\n\t\t\t\tcodeKey,\n\t\t\t\ttextKey: resolvedTextKey,\n\t\t\t\thideCode\n\t\t\t});\n\t\tconst tokenNode = typeof tokenRenderer === \"function\" ? tokenRenderer(renderContext) : null;\n\t\tconst toolbarNode = typeof renderToolbar === \"function\" ? renderToolbar(renderContext) : renderToolbar;\n\t\tconst selectedEntries = filteredCommittedSelectedItems.map((item, index) => ({ item, index }));\n\t\tconst itemEntries = filteredAvailableItems.map((item, index) => ({ item, index: index + selectedEntries.length }));\n\t\tconst isNoData = !isLoading && !error && visibleOptions.length === 0;\n\t\tconst triggerController = usePickerTriggerController({\n\t\t\tmode: triggerMode,\n\t\t\topen,\n\t\t\tcurrentQuery,\n\t\t\thasDisplayValue: false,\n\t\t\tinputRef,\n\t\t\tsetQuery,\n\t\t\topenList,\n\t\t\tclose,\n\t\t\ttoggleOpen,\n\t\t\tonBeforeOpen: () => {\n\t\t\t\tif (!open) {\n\t\t\t\t\tprepareOpen();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn (\n\t\t\t<PickerField label={label} description={description} disabled={disabled} size={size} className={styles.multiSelect}>\n\t\t\t\t{({ controlId, labelId, describedBy }) => {\n\t\t\t\t\tconst listId = `${controlId}-listbox`;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PickerTrigger\n\t\t\t\t\t\t\t\tref={setInputNode}\n\t\t\t\t\t\t\t\trootRef={setReference}\n\t\t\t\t\t\t\t\tid={controlId}\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\topen={open}\n\t\t\t\t\t\t\t\toptionCount={items.length}\n\t\t\t\t\t\t\t\tlabel={label}\n\t\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\t\tplaceholderFallback=\"Выберите значения\"\n\t\t\t\t\t\t\t\tvalue={currentQuery}\n\t\t\t\t\t\t\t\tselectedValue={tokenNode}\n\t\t\t\t\t\t\t\thasSelection={hasSelectedItems}\n\t\t\t\t\t\t\t\tshowSelectedValue={hasSelectedItems && currentQuery.length === 0}\n\t\t\t\t\t\t\t\tclearable\n\t\t\t\t\t\t\t\tonClear={clearSelection}\n\t\t\t\t\t\t\t\tclearAriaLabel=\"Очистить все\"\n\t\t\t\t\t\t\t\tonToggleMouseDown={triggerController.handleToggleMouseDown}\n\t\t\t\t\t\t\t\tonToggleClick={triggerController.handleToggleClick}\n\t\t\t\t\t\t\t\taria-labelledby={labelId}\n\t\t\t\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t\t\taria-expanded={open}\n\t\t\t\t\t\t\t\taria-controls={open ? listId : undefined}\n\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\taria-activedescendant={open ? getActiveOptionId(listId) : undefined}\n\t\t\t\t\t\t\t\trootClassName=\"flex alignItemsCenter\"\n\t\t\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\t\t\ttriggerController.handleTriggerInputChange(event.target.value);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonClick={triggerController.handleTriggerClick}\n\t\t\t\t\t\t\t\tonFocus={(event) => {\n\t\t\t\t\t\t\t\t\ttriggerController.handleTriggerFocus(event.currentTarget);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\t\t\t\t\thandleReferenceKeyDown(event);\n\n\t\t\t\t\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\ttriggerController.handleTriggerKeyDown({\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tonActivateWhenOpen: () => {\n\t\t\t\t\t\t\t\t\t\t\tif (activeIndex >= 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst activeItem = visibleOptions[activeIndex];\n\t\t\t\t\t\t\t\t\t\t\t\tif (activeItem) {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttoggleDraftSelection(activeItem);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tselectActiveOption();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tenableClosedArrowDownOpen: true,\n\t\t\t\t\t\t\t\t\t\tsuppressClosedArrowUp: true\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<PickerPopup\n\t\t\t\t\t\t\t\topen={open}\n\t\t\t\t\t\t\t\tcontext={context}\n\t\t\t\t\t\t\t\tfloatingStyles={floatingStyles}\n\t\t\t\t\t\t\t\tlistId={listId}\n\t\t\t\t\t\t\t\tlabelId={labelId}\n\t\t\t\t\t\t\t\tdescriptionId={describedBy}\n\t\t\t\t\t\t\t\tactiveOptionId={open ? getActiveOptionId(listId) : undefined}\n\t\t\t\t\t\t\t\tsetFloating={setFloating}\n\t\t\t\t\t\t\t\tgetFloatingProps={getFloatingProps}\n\t\t\t\t\t\t\t\tonKeyDown={handleFloatingKeyDown}\n\t\t\t\t\t\t\t\tinitialFocus={-1}\n\t\t\t\t\t\t\t\treturnFocus={false}\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\ttoolbar={toolbarNode}\n\t\t\t\t\t\t\t\tselectionActions={\n\t\t\t\t\t\t\t\t\trenderToolbar === undefined ? { onSelectAll: selectAll, onDeselectAll: deselectAll } : undefined\n\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t<MultiSelectOptionsWrapper isNoData={isNoData} error={error}>\n\t\t\t\t\t\t\t\t\t<div className=\"scrollable overscroll h100\">\n\t\t\t\t\t\t\t\t\t\t<MultiSelectOptionGroup\n\t\t\t\t\t\t\t\t\t\t\tentries={selectedEntries}\n\t\t\t\t\t\t\t\t\t\t\tlistId={listId}\n\t\t\t\t\t\t\t\t\t\t\tactiveIndex={activeIndex}\n\t\t\t\t\t\t\t\t\t\t\tselectedKeys={selectedKeys}\n\t\t\t\t\t\t\t\t\t\t\tcodeKey={codeKey}\n\t\t\t\t\t\t\t\t\t\t\tquery={currentQuery}\n\t\t\t\t\t\t\t\t\t\t\thighlightQuery={currentHighlightQuery}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionDisabled={isOptionDisabled}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionId={getOptionId}\n\t\t\t\t\t\t\t\t\t\t\tsetOptionRef={setOptionRef}\n\t\t\t\t\t\t\t\t\t\t\ttoggleOption={toggleDraftSelection}\n\t\t\t\t\t\t\t\t\t\t\tselectOnlyOption={selectOnlyOption}\n\t\t\t\t\t\t\t\t\t\t\trenderItem={itemRenderer}\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t{selectedEntries.length > 0 && availableItems.length > 0 && <Separator className=\"marginBlockSm\" />}\n\n\t\t\t\t\t\t\t\t\t\t<MultiSelectOptionGroup\n\t\t\t\t\t\t\t\t\t\t\tentries={itemEntries}\n\t\t\t\t\t\t\t\t\t\t\tlistId={listId}\n\t\t\t\t\t\t\t\t\t\t\tactiveIndex={activeIndex}\n\t\t\t\t\t\t\t\t\t\t\tselectedKeys={selectedKeys}\n\t\t\t\t\t\t\t\t\t\t\tcodeKey={codeKey}\n\t\t\t\t\t\t\t\t\t\t\tquery={currentQuery}\n\t\t\t\t\t\t\t\t\t\t\thighlightQuery={currentHighlightQuery}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionDisabled={isOptionDisabled}\n\t\t\t\t\t\t\t\t\t\t\tgetOptionId={getOptionId}\n\t\t\t\t\t\t\t\t\t\t\tsetOptionRef={setOptionRef}\n\t\t\t\t\t\t\t\t\t\t\ttoggleOption={toggleDraftSelection}\n\t\t\t\t\t\t\t\t\t\t\tselectOnlyOption={selectOnlyOption}\n\t\t\t\t\t\t\t\t\t\t\trenderItem={itemRenderer}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</MultiSelectOptionsWrapper>\n\t\t\t\t\t\t\t</PickerPopup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t}}\n\t\t\t</PickerField>\n\t\t);\n\t}\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n","import { ODataCollectionModel, ODataSelectBaseProps } from \"@ryuzaki13/react-foundation-api/odata\";\nimport { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata-service\";\n\nimport { mapSelectedItemsToValues, useODataSelectBase } from \"../../select/model/useODataSelectBase\";\n\ninterface UseODataMultiSelectOptions extends Omit<ODataSelectBaseProps, \"model\"> {\n\tmodel: Required<ODataCollectionModel>;\n\tonChange: (keys: string[]) => void;\n}\n\nexport function useODataMultiSelect({ odata, segment, model, value, dependencies, onChange }: UseODataMultiSelectOptions) {\n\tconst odataModel = useODataSelectBase({\n\t\todata,\n\t\tsegment,\n\t\tmodel,\n\t\tvalue,\n\t\tdependencies\n\t});\n\n\tconst handleChange = (items: CollectionItem[]) => {\n\t\tonChange(mapSelectedItemsToValues(items, odataModel.selectionKey));\n\t};\n\n\treturn {\n\t\t...odataModel,\n\t\thandleChange\n\t};\n}\n","import React from \"react\";\n\nimport { ODataSelectBaseProps, useODataCollectionModel } from \"@ryuzaki13/react-foundation-api/odata\";\n\nimport { UiBaseProps } from \"../../types\";\nimport { useODataMultiSelect } from \"../model/useODataMultiSelect\";\n\nimport { MultiSelect } from \"./MultiSelect\";\n\ntype ODataMultiSelectProps = ODataSelectBaseProps & Omit<UiBaseProps<string[]>, \"placeholder\"> & {};\n\nexport const ODataMultiSelect: React.FC<ODataMultiSelectProps> = ({\n\todata,\n\tsegment,\n\tmodel: initialModel,\n\tlabel,\n\tdescription,\n\tdisabled,\n\tvalue,\n\tdependencies,\n\tonChange,\n\tsize\n}) => {\n\tconst model = useODataCollectionModel(initialModel);\n\tconst odataModel = useODataMultiSelect({\n\t\todata,\n\t\tsegment,\n\t\tmodel,\n\t\tvalue,\n\t\tdependencies,\n\t\tonChange\n\t});\n\n\treturn (\n\t\t<MultiSelect\n\t\t\tlabel={label}\n\t\t\tdescription={description}\n\t\t\tsize={size}\n\t\t\tcodeKey={odataModel.codeKey}\n\t\t\ttextKey={odataModel.textKey}\n\t\t\thideCode={segment.hideCode ?? odata.hideCode}\n\t\t\titems={odataModel.filteredItems}\n\t\t\tvalue={odataModel.selectedItems}\n\t\t\tonChange={odataModel.handleChange}\n\t\t\tonQuery={odataModel.setQuery}\n\t\t\tquery={odataModel.query}\n\t\t\tdefaultFilter={false}\n\t\t\thighlightQuery={odataModel.debouncedQuery}\n\t\t\tisLoading={odataModel.isLoading}\n\t\t\tdisabled={disabled}\n\t\t\tplaceholder={odataModel.placeholder}\n\t\t\terror={odataModel.isError ? \"Ошибка загрузки\" : undefined}\n\t\t/>\n\t);\n};\n","import { useCallback } from \"react\";\n\nimport { useODataDependentSelection } from \"../../odata-dependent\";\n\nimport { ODataMultiSelect } from \"./ODataMultiSelect\";\n\nimport type { ODataDependentSegmentControlProps } from \"../../odata-dependent\";\n\nexport type ODataDependentSegmentMultiSelectProps = ODataDependentSegmentControlProps;\n\nexport function ODataDependentSegmentMultiSelect(props: ODataDependentSegmentMultiSelectProps) {\n\tconst { item, disabled, label, description, size, width = 15 } = props;\n\tconst selection = useODataDependentSelection(props);\n\tconst { updateSegment } = selection;\n\tconst widthStyle = `calc(${width}em + var(--width-add))`;\n\n\tconst handleSelectionChange = useCallback(\n\t\t(keys: string[]) => {\n\t\t\tupdateSegment(item.id, keys);\n\t\t},\n\t\t[item.id, updateSegment]\n\t);\n\n\treturn (\n\t\t<div style={{ maxWidth: widthStyle, minWidth: widthStyle }}>\n\t\t\t<ODataMultiSelect\n\t\t\t\todata={item.odata}\n\t\t\t\tsegment={item.segment}\n\t\t\t\tmodel={item.model}\n\t\t\t\tdependencies={selection.values}\n\t\t\t\tvalue={selection.values[item.id]}\n\t\t\t\tonChange={handleSelectionChange}\n\t\t\t\tdisabled={disabled || selection.isSegmentDisabled(item.id)}\n\t\t\t\tlabel={label}\n\t\t\t\tdescription={description}\n\t\t\t\tsize={size}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n","import { flattenODataDependentServices, type ODataDependentBaseProps } from \"@ryuzaki13/react-foundation-api/odata\";\n\nimport { useODataDependentSelection } from \"../../odata-dependent\";\n\nimport { ODataDependentSegmentMultiSelect } from \"./ODataDependentSegmentMultiSelect\";\n\nimport type { UseODataDependentSelectionOptions } from \"../../odata-dependent\";\n\nexport type ODataDependentMultiSelectProps = Omit<ODataDependentBaseProps, \"dependencies\" | \"value\"> &\n\tUseODataDependentSelectionOptions & {\n\t\t/**\n\t\t * Ширина одного элемента в `em` единицах.\n\t\t *\n\t\t * @default 15\n\t\t */\n\t\twidth?: number;\n\t};\n\nexport function ODataDependentMultiSelect(props: ODataDependentMultiSelectProps) {\n\tconst { width = 15, odata, segments, model, values, defaultValues, onChange, selectionMode, segmentOrder } = props;\n\tconst selection = useODataDependentSelection({ values, defaultValues, onChange });\n\tconst segmentSelectionProps =\n\t\tselectionMode === \"sequential\" ? { selectionMode: \"sequential\" as const, segmentOrder } : { selectionMode, segmentOrder };\n\tconst items = flattenODataDependentServices([\n\t\t{\n\t\t\todata,\n\t\t\tsegments,\n\t\t\tmodel\n\t\t}\n\t]);\n\n\treturn items.map((item) => (\n\t\t<ODataDependentSegmentMultiSelect\n\t\t\tkey={item.id}\n\t\t\titem={item}\n\t\t\tvalues={selection.values}\n\t\t\tonChange={selection.updateValues}\n\t\t\t{...segmentSelectionProps}\n\t\t\twidth={width}\n\t\t/>\n\t));\n}\n","import { MultiSelect } from \"./MultiSelect\";\n\nimport type { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata-service\";\nimport type { UiBaseProps } from \"../../types\";\n\ntype SerializableOptionRecord = Record<string, unknown>;\n\ntype SerializableOptionKeyField<TOption extends SerializableOptionRecord> = {\n\t[K in keyof TOption]: Extract<TOption[K], string> extends never ? never : K;\n}[keyof TOption];\n\nexport interface SerializableMultiSelectProps<\n\tTOption extends SerializableOptionRecord,\n\tTOptionKey extends SerializableOptionKeyField<TOption>,\n\tTOptionLabel extends keyof TOption\n> extends UiBaseProps<Extract<TOption[TOptionKey], string>[]> {\n\toptions: readonly TOption[];\n\toptionKey: TOptionKey;\n\toptionLabel: TOptionLabel;\n\trenderCode?: true;\n}\n\nfunction getSerializableOptionKey<TOption extends SerializableOptionRecord, TOptionKey extends SerializableOptionKeyField<TOption>>(\n\toption: TOption,\n\toptionKey: TOptionKey\n): Extract<TOption[TOptionKey], string> {\n\treturn option[optionKey] as Extract<TOption[TOptionKey], string>;\n}\n\nfunction getSerializableOptionLabel<\n\tTOption extends SerializableOptionRecord,\n\tTOptionKey extends SerializableOptionKeyField<TOption>,\n\tTOptionLabel extends keyof TOption\n>(option: TOption, optionLabel: TOptionLabel, optionKey: TOptionKey): string {\n\tconst label = option[optionLabel];\n\n\tif (typeof label === \"string\") {\n\t\treturn label;\n\t}\n\n\tconst key = getSerializableOptionKey(option, optionKey);\n\treturn typeof key === \"string\" ? key : String(key);\n}\n\nexport function SerializableMultiSelect<\n\tTOption extends SerializableOptionRecord,\n\tTOptionKey extends SerializableOptionKeyField<TOption>,\n\tTOptionLabel extends keyof TOption\n>({\n\tlabel,\n\tdescription,\n\tdisabled,\n\tplaceholder,\n\tsize,\n\toptions,\n\tvalue,\n\tonChange,\n\toptionKey,\n\toptionLabel,\n\trenderCode\n}: SerializableMultiSelectProps<TOption, TOptionKey, TOptionLabel>) {\n\t// Как будто можно не мемоизировать, нет смысла\n\tconst items = options.map<CollectionItem>((option) => ({\n\t\tkey: String(getSerializableOptionKey(option, optionKey)),\n\t\ttext: getSerializableOptionLabel(option, optionLabel, optionKey)\n\t}));\n\tconst selectedKeys = new Set((value ?? []).map((item) => String(item)));\n\tconst selectedItems = items.filter((item) => selectedKeys.has(item.key));\n\n\treturn (\n\t\t<MultiSelect\n\t\t\tlabel={label}\n\t\t\tdescription={description}\n\t\t\tdisabled={disabled}\n\t\t\tplaceholder={placeholder}\n\t\t\tsize={size}\n\t\t\titems={items}\n\t\t\tcodeKey=\"key\"\n\t\t\ttextKey=\"text\"\n\t\t\thideCode={renderCode ? undefined : true}\n\t\t\tvalue={selectedItems}\n\t\t\tonChange={(nextItems) => onChange(nextItems.map((item) => item.key) as Extract<TOption[TOptionKey], string>[])}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;ACWA,SAAgB,EAA0B,EAAE,SAAM,cAA2C;CAC5F,OACC,kBAAC,OAAD;EAAK,WAAW,EAAS;EAAzB,UAAA,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,IAAI;EAAE;EAAe;CAAa;CASzH,OARc,GAA8B,CAC3C;EACC;EACA;EACA;CACD,CACD,CAEO,CAAA,CAAM,KAAK,MACjB,kBAAC,GAAD;EAEO;EACN,QAAQ,EAAU;EAClB,UAAU,EAAU;EACpB,GAAI;EACG;CACP,GANK,EAAK,EAMV,CACD;AACF;;;ACnBA,SAAS,EACR,GACA,GACuC;CACvC,OAAO,EAAO;AACf;AAEA,SAAS,EAIP,GAAiB,GAA2B,GAA+B;CAC5E,IAAM,IAAQ,EAAO;CAErB,IAAI,OAAO,KAAU,UACpB,OAAO;CAGR,IAAM,IAAM,EAAyB,GAAQ,CAAS;CACtD,OAAO,OAAO,KAAQ,WAAW,IAAM,OAAO,CAAG;AAClD;AAEA,SAAgB,EAId,EACD,UACA,gBACA,aACA,gBACA,SACA,YACA,UACA,aACA,cACA,gBACA,iBACmE;CAEnE,IAAM,IAAQ,EAAQ,KAAqB,OAAY;EACtD,KAAK,OAAO,EAAyB,GAAQ,CAAS,CAAC;EACvD,MAAM,EAA2B,GAAQ,GAAa,CAAS;CAChE,EAAE,GACI,IAAe,IAAI,KAAK,KAAS,CAAC,EAAA,CAAG,KAAK,MAAS,OAAO,CAAI,CAAC,CAAC,GAChE,IAAgB,EAAM,QAAQ,MAAS,EAAa,IAAI,EAAK,GAAG,CAAC;CAEvE,OACC,kBAAC,GAAD;EACQ;EACM;EACH;EACG;EACP;EACC;EACP,SAAQ;EACR,SAAQ;EACR,UAAU,MAAa,KAAA;EACvB,OAAO;EACP,WAAW,MAAc,EAAS,EAAU,KAAK,MAAS,EAAK,GAAG,CAA2C;CAC7G,CAAA;AAEH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./ui.module-
|
|
1
|
+
import { t as e } from "./ui.module-oRwY3Zli.js";
|
|
2
2
|
import { t } from "./grid-dI94AAbi.js";
|
|
3
|
-
import { a as n, c as r, d as i, i as a } from "./input-
|
|
3
|
+
import { a as n, c as r, d as i, i as a } from "./input-DSPKgiCK.js";
|
|
4
4
|
import { t as o } from "./separator-B72Aq-6a.js";
|
|
5
5
|
import { forwardRef as s, isValidElement as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
6
6
|
import { cn as p } from "@ryuzaki13/react-foundation-lib/utils";
|
|
@@ -436,4 +436,4 @@ function K({ mode: e, open: t, currentQuery: n, hasDisplayValue: r, inputRef: i,
|
|
|
436
436
|
//#endregion
|
|
437
437
|
export { E as _, V as a, L as c, P as d, N as f, O as g, k as h, H as i, I as l, A as m, W as n, z as o, j as p, U as r, R as s, K as t, F as u, T as v };
|
|
438
438
|
|
|
439
|
-
//# sourceMappingURL=picker-
|
|
439
|
+
//# sourceMappingURL=picker-lvm82d0A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picker-lvm82d0A.js","names":[],"sources":["../../src/picker/PickerField.tsx","../../src/picker/PickerClearButton.tsx","../../src/picker/Picker.module.scss","../../src/picker/PickerSelectionToolbar.tsx","../../src/picker/PickerOptions.tsx","../../src/picker/model/extractPickerTextContent.ts","../../src/picker/PickerPlaceholder.ts","../../src/picker/PickerPopup.tsx","../../src/picker/PickerSelectedToken.tsx","../../src/picker/PickerStatus.tsx","../../src/picker/PickerTriggerActions.tsx","../../src/picker/PickerTriggerInput.tsx","../../src/picker/PickerTrigger.tsx","../../src/picker/model/createPickerTriggerPolicy.ts","../../src/picker/model/usePickerDefaultFilter.ts","../../src/picker/model/usePickerFloatingListbox.ts","../../src/picker/model/usePickerQuery.ts","../../src/picker/model/usePickerSelectionLifecycle.ts","../../src/picker/model/usePickerTriggerController.ts"],"sourcesContent":["import { InputType } from \"@ryuzaki13/react-foundation-lib/types\";\n\nimport { InputUI } from \"../input\";\nimport { useInputFieldIds } from \"../input/lib/useInputFieldIds\";\n\nimport { PickerFieldProps } from \"./types\";\n\nexport function PickerField<TValue extends InputType>({\n\tid,\n\tlabel,\n\tdescription,\n\tdisabled,\n\tsize,\n\tclassName,\n\terror,\n\tchildren\n}: PickerFieldProps<TValue>) {\n\tconst { controlId, labelId, descriptionId, errorId, describedBy } = useInputFieldIds({\n\t\tid,\n\t\thasLabel: label !== undefined && label !== null,\n\t\thasDescription: !!description,\n\t\thasError: !!error\n\t});\n\n\treturn (\n\t\t<InputUI\n\t\t\tlabel={label}\n\t\t\tdescription={description}\n\t\t\tdisabled={disabled}\n\t\t\tsize={size}\n\t\t\tclassName={className}\n\t\t\terror={error}\n\t\t\tcontrolId={controlId}\n\t\t\tlabelId={labelId}\n\t\t\tdescriptionId={descriptionId}\n\t\t\terrorId={errorId}>\n\t\t\t{children({ controlId, labelId, descriptionId, errorId, describedBy })}\n\t\t</InputUI>\n\t);\n}\n","import { type MouseEvent } from \"react\";\n\nimport { XIcon } from \"lucide-react\";\n\nimport uiStyles from \"../ui.module.scss\";\n\ntype PickerClearButtonProps = {\n\tdisabled?: boolean;\n\tariaLabel?: string;\n\tonClear: () => void;\n};\n\n/** Единое действие очистки выбранного значения во всех clearable picker-компонентах. */\nexport function PickerClearButton({ disabled, ariaLabel = \"Очистить выбор\", onClear }: PickerClearButtonProps) {\n\tconst stopTriggerInteraction = (event: MouseEvent<HTMLButtonElement>) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t};\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tdisabled={disabled}\n\t\t\tclassName={uiStyles.uiClearButton}\n\t\t\tdata-ui=\"picker-clear-button\"\n\t\t\tdata-action=\"clear-picker\"\n\t\t\tonMouseDown={stopTriggerInteraction}\n\t\t\tonClick={(event) => {\n\t\t\t\tstopTriggerInteraction(event);\n\t\t\t\tonClear();\n\t\t\t}}\n\t\t\taria-label={ariaLabel}>\n\t\t\t<XIcon />\n\t\t</button>\n\t);\n}\n","@use \"@/styles/mixins\" as *;\n\n.popupPositioner,\n.options {\n\toverflow: hidden;\n\tdisplay: grid;\n\tgrid-template-rows: minmax(0, 1fr);\n\tborder-radius: var(--radius-sm);\n}\n\n.popupPositioner {\n\t--anchor-gap: var(--space-xs);\n\t--anchor-padding: var(--space-xs);\n\t--anchor-offset: 0;\n\n\tmin-width: 0;\n\tz-index: var(--z-dropdown);\n\tbox-shadow: var(--shadow-md);\n}\n\n.options {\n\t--input-width: min(100vw, var(--base-width, 15em));\n\n\twidth: 100%;\n\tmin-width: var(--input-width);\n\tmin-height: 0;\n\tmax-height: 75vh;\n\n\tpadding: var(--space-sm);\n\tbackground-color: var(--surface-0);\n\tborder: var(--border);\n\n\t&:empty {\n\t\tvisibility: hidden;\n\t}\n\n\t&[data-has-toolbar=\"true\"] {\n\t\tgrid-template-rows: auto minmax(0, 1fr);\n\t}\n}\n\n.optionsToolbar {\n\tdisplay: grid;\n\tgap: var(--space-xs);\n\tpadding: var(--space-xs);\n}\n\n.optionsBody {\n\tmin-height: 0;\n}\n\n.status {\n\tpadding: var(--space-xs) var(--space-sm);\n\tcolor: var(--content-2);\n}\n\n.statusError {\n\tcolor: var(--error-text);\n}\n\n.triggerContainer {\n\tposition: relative;\n\n\t&[data-has-overlay=\"true\"] input {\n\t\t--ui-color: transparent;\n\t\t--ui-color-hover: transparent;\n\t\t--ui-color-active: transparent;\n\n\t\tcolor: transparent;\n\t\tcaret-color: transparent;\n\t\t-webkit-text-fill-color: transparent;\n\t}\n}\n\n.triggerHasClear {\n\t--trigger-count: 2;\n\t// Резервирует в input место для кнопок очистки и открытия списка.\n\t--input-end-adornment-width: calc(var(--control-height) * 2);\n}\n\n.selectedToken {\n\tposition: absolute;\n\tinset: 0 calc(var(--control-height) * var(--trigger-count, 1) + var(--space-sm)) 0 var(--space-sm);\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: flex-end;\n\tmin-width: 0;\n\tpointer-events: none;\n}\n\n.selectedTokenText {\n\toverflow: hidden;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n\n@include mobile {\n\t.options {\n\t\t--input-width: calc(100dvw - var(--space-xl));\n\t}\n}\n\n.selectionActionButton {\n\tpadding-block: var(--space-xs);\n\tborder-radius: var(--radius-sm);\n\n\t&:hover {\n\t\tbackground-color: var(--surface-2);\n\t}\n}\n","import { type Ref } from \"react\";\n\nimport { Grid } from \"../grid\";\n\nimport styles from \"./Picker.module.scss\";\n\ntype PickerSelectionToolbarProps = {\n\tonSelectAll: () => void;\n\tonDeselectAll: () => void;\n\tselectAllButtonRef?: Ref<HTMLButtonElement>;\n};\n\n/**\n * Общая панель массовых действий для picker-компонентов с множественным выбором.\n * Компонент не знает формат значения и делегирует изменение владельцу selection-модели.\n */\nexport function PickerSelectionToolbar({ onSelectAll, onDeselectAll, selectAllButtonRef }: PickerSelectionToolbarProps) {\n\treturn (\n\t\t<Grid.Container gap=\"xs\" templateColumns=\"1fr 1fr\">\n\t\t\t<button\n\t\t\t\tref={selectAllButtonRef}\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={styles.selectionActionButton}\n\t\t\t\tonClick={onSelectAll}\n\t\t\t\tdata-ui=\"picker-select-all\"\n\t\t\t\tdata-action=\"select-all\">\n\t\t\t\tВыбрать все\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={styles.selectionActionButton}\n\t\t\t\tonClick={onDeselectAll}\n\t\t\t\tdata-ui=\"picker-deselect-all\"\n\t\t\t\tdata-action=\"deselect-all\">\n\t\t\t\tСнять выбор\n\t\t\t</button>\n\t\t</Grid.Container>\n\t);\n}\n","import { type HTMLAttributes, type ReactNode, type Ref } from \"react\";\n\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport { Separator } from \"../separator\";\n\nimport styles from \"./Picker.module.scss\";\nimport { PickerSelectionToolbar } from \"./PickerSelectionToolbar\";\n\nexport type PickerSelectionActions = {\n\tonSelectAll: () => void;\n\tonDeselectAll: () => void;\n\tselectAllButtonRef?: Ref<HTMLButtonElement>;\n};\n\nexport interface PickerOptionsProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n\trootRef?: Ref<HTMLDivElement>;\n\tchildren: ReactNode;\n\ttoolbar?: ReactNode | false;\n\tselectionActions?: PickerSelectionActions;\n\tlayoutClassName?: string;\n\tbodyClassName?: string;\n\tscrollable?: boolean;\n}\n\n/**\n * Единая оболочка списка опций для picker, listbox и menu. Если переданы\n * selectionActions, но не передан toolbar, компонент показывает стандартные\n * действия выбора и снятия выбора.\n */\nexport function PickerOptions({\n\trootRef,\n\tchildren,\n\ttoolbar,\n\tselectionActions,\n\tlayoutClassName,\n\tbodyClassName,\n\tscrollable = true,\n\tclassName,\n\t...props\n}: PickerOptionsProps) {\n\tconst resolvedToolbar = toolbar === undefined && selectionActions ? <PickerSelectionToolbar {...selectionActions} /> : toolbar || null;\n\n\treturn (\n\t\t<div\n\t\t\t{...props}\n\t\t\tref={rootRef}\n\t\t\tclassName={cn(styles.options, layoutClassName, className)}\n\t\t\tdata-ui=\"picker-options\"\n\t\t\tdata-has-toolbar={resolvedToolbar ? \"true\" : undefined}>\n\t\t\t{resolvedToolbar ? (\n\t\t\t\t<div className={styles.optionsToolbar}>\n\t\t\t\t\t{resolvedToolbar}\n\t\t\t\t\t<Separator />\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<div className={cn(styles.optionsBody, scrollable ? \"scrollable overscroll\" : \"overflowHidden\", bodyClassName)}>{children}</div>\n\t\t</div>\n\t);\n}\n","import { isValidElement, type ReactNode } from \"react\";\n\nexport function extractPickerTextContent(node: ReactNode): string | undefined {\n\tif (typeof node === \"string\" || typeof node === \"number\") {\n\t\treturn String(node);\n\t}\n\n\tif (Array.isArray(node)) {\n\t\tconst values = node\n\t\t\t.map(extractPickerTextContent)\n\t\t\t.filter((value): value is string => Boolean(value))\n\t\t\t.map((value) => value.trim())\n\t\t\t.filter(Boolean);\n\t\treturn values.length ? values.join(\" \") : undefined;\n\t}\n\n\tif (isValidElement<{ children?: ReactNode; searchText?: unknown }>(node)) {\n\t\tif (typeof node.props.searchText === \"string\") {\n\t\t\treturn node.props.searchText;\n\t\t}\n\n\t\treturn extractPickerTextContent(node.props.children);\n\t}\n\n\treturn undefined;\n}\n","import { type ReactNode } from \"react\";\n\nimport { extractPickerTextContent } from \"./model/extractPickerTextContent\";\n\ntype PickerPlaceholderParams = {\n\tplaceholder?: string;\n\tlabel?: ReactNode;\n\toptionCount: number;\n\tfallback?: string;\n};\n\n/**\n * Формирует единый текст placeholder для picker-компонентов и всегда показывает\n * актуальное количество доступных вариантов.\n */\nexport function getPickerPlaceholder({ placeholder, label, optionCount, fallback = \"Выберите значение\" }: PickerPlaceholderParams) {\n\tconst labelText = extractPickerTextContent(label);\n\tconst text = placeholder ?? labelText ?? fallback;\n\n\treturn `${text} <${optionCount}>`;\n}\n","import { type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactNode } from \"react\";\n\nimport { FloatingContext, FloatingFocusManager, FloatingPortal } from \"@floating-ui/react\";\nimport { AnimatePresence, motion } from \"motion/react\";\n\nimport styles from \"./Picker.module.scss\";\nimport { PickerOptions, type PickerSelectionActions } from \"./PickerOptions\";\n\ninterface PickerPopupProps {\n\topen: boolean;\n\tcontext: FloatingContext;\n\tfloatingStyles: CSSProperties;\n\tlistId: string;\n\tlabelId?: string;\n\tpopupAriaLabel?: string;\n\tdescriptionId?: string;\n\tactiveOptionId?: string;\n\tariaMultiselectable?: boolean;\n\tpopupRole?: \"listbox\" | \"dialog\";\n\tsetFloating: (node: HTMLElement | null) => void;\n\tgetFloatingProps: (userProps?: Record<string, unknown>) => Record<string, unknown>;\n\tonKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n\tinitialFocus?: number;\n\treturnFocus?: boolean;\n\ttabIndex?: number;\n\tclassName?: string;\n\tmaxWidth?: CSSProperties[\"maxWidth\"];\n\tlayoutClassName?: string;\n\tbodyClassName?: string;\n\ttoolbar?: ReactNode | false;\n\tselectionActions?: PickerSelectionActions;\n\tchildren: ReactNode;\n}\n\nfunction stopNestedFloatingMouseDown(event: MouseEvent<HTMLElement>): void {\n\tevent.stopPropagation();\n}\n\nexport function PickerPopup({\n\topen,\n\tcontext,\n\tfloatingStyles,\n\tlistId,\n\tlabelId,\n\tpopupAriaLabel,\n\tdescriptionId,\n\tactiveOptionId,\n\tariaMultiselectable,\n\tpopupRole = \"listbox\",\n\tsetFloating,\n\tgetFloatingProps,\n\tonKeyDown,\n\tinitialFocus = -1,\n\treturnFocus = false,\n\ttabIndex = 0,\n\tclassName,\n\tmaxWidth,\n\tlayoutClassName,\n\tbodyClassName,\n\ttoolbar,\n\tselectionActions,\n\tchildren\n}: PickerPopupProps) {\n\treturn (\n\t\t<AnimatePresence>\n\t\t\t{open && (\n\t\t\t\t<FloatingPortal>\n\t\t\t\t\t<FloatingFocusManager context={context} modal={false} initialFocus={initialFocus} returnFocus={returnFocus}>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tref={setFloating}\n\t\t\t\t\t\t\tstyle={{ ...floatingStyles, maxWidth }}\n\t\t\t\t\t\t\tinitial={{ opacity: 0, scale: 0.95 }}\n\t\t\t\t\t\t\tanimate={{ opacity: 1, scale: 1 }}\n\t\t\t\t\t\t\texit={{ opacity: 0, scale: 0.95 }}\n\t\t\t\t\t\t\t{...getFloatingProps({\n\t\t\t\t\t\t\t\tid: listId,\n\t\t\t\t\t\t\t\trole: popupRole,\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\t\"aria-labelledby\": labelId,\n\t\t\t\t\t\t\t\t\"aria-label\": labelId ? undefined : popupAriaLabel,\n\t\t\t\t\t\t\t\t\"aria-describedby\": descriptionId,\n\t\t\t\t\t\t\t\t\"aria-activedescendant\": activeOptionId,\n\t\t\t\t\t\t\t\t\"aria-multiselectable\": ariaMultiselectable || undefined,\n\t\t\t\t\t\t\t\tonMouseDown: stopNestedFloatingMouseDown,\n\t\t\t\t\t\t\t\tonKeyDown,\n\t\t\t\t\t\t\t\tclassName: styles.popupPositioner\n\t\t\t\t\t\t\t})}>\n\t\t\t\t\t\t\t<PickerOptions\n\t\t\t\t\t\t\t\tclassName={className}\n\t\t\t\t\t\t\t\tlayoutClassName={layoutClassName}\n\t\t\t\t\t\t\t\tbodyClassName={bodyClassName}\n\t\t\t\t\t\t\t\ttoolbar={toolbar}\n\t\t\t\t\t\t\t\tselectionActions={selectionActions}\n\t\t\t\t\t\t\t\tscrollable={false}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</PickerOptions>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</FloatingFocusManager>\n\t\t\t\t</FloatingPortal>\n\t\t\t)}\n\t\t</AnimatePresence>\n\t);\n}\n","import { type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport styles from \"./Picker.module.scss\";\n\nexport interface PickerSelectedTokenProps extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\"> {\n\tchildren: ReactNode;\n}\n\n/** Единое визуальное представление выбранного значения внутри picker-trigger. */\nexport function PickerSelectedToken({ children, className, ...props }: PickerSelectedTokenProps) {\n\treturn (\n\t\t<span {...props} className={cn(styles.selectedToken, className)} data-ui=\"picker-selected-token\">\n\t\t\t<span className={styles.selectedTokenText}>{children}</span>\n\t\t</span>\n\t);\n}\n","import { ReactNode } from \"react\";\n\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport uiStyles from \"../ui.module.scss\";\n\nimport styles from \"./Picker.module.scss\";\n\ninterface PickerStatusProps {\n\temptyState?: ReactNode;\n\t// loadingState?: ReactNode;\n\terrorState?: ReactNode;\n}\n\nexport function PickerStatus({ emptyState, errorState }: PickerStatusProps) {\n\tconst content = errorState ?? emptyState;\n\n\tif (content === undefined || content === null) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className={cn(uiStyles.uiPopupOption, styles.status, errorState !== undefined && styles.statusError)} aria-disabled={true}>\n\t\t\t{content}\n\t\t</div>\n\t);\n}\n","import { MouseEvent, ReactNode } from \"react\";\n\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport uiStyles from \"../ui.module.scss\";\n\ninterface PickerTriggerActionsProps {\n\topen: boolean;\n\tdisabled?: boolean;\n\tchildren?: ReactNode;\n\tonToggleMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\tonToggleClick: () => void;\n\topenAriaLabel?: string;\n\tcloseAriaLabel?: string;\n}\n\nexport function PickerTriggerActions({\n\topen,\n\tdisabled,\n\tchildren,\n\tonToggleMouseDown,\n\tonToggleClick,\n\topenAriaLabel = \"Открыть список\",\n\tcloseAriaLabel = \"Закрыть список\"\n}: PickerTriggerActionsProps) {\n\treturn (\n\t\t<div className={uiStyles.uiToggleButtonContainer} data-disabled={disabled || undefined}>\n\t\t\t{children}\n\n\t\t\t<div className={uiStyles.uiButtonSeparator} />\n\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-label={open ? closeAriaLabel : openAriaLabel}\n\t\t\t\tclassName={uiStyles.uiToggleButton}\n\t\t\t\tonMouseDown={onToggleMouseDown}\n\t\t\t\tonClick={onToggleClick}>\n\t\t\t\t<ChevronDownIcon className={cn(uiStyles.uiToggleIcon, open && uiStyles.uiToggleIconOpen)} />\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n","import { ComponentPropsWithoutRef, forwardRef, ReactNode } from \"react\";\n\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport { InputControl, InputLoadingFrame } from \"../input\";\nimport uiStyles from \"../ui.module.scss\";\n\nimport styles from \"./Picker.module.scss\";\n\nexport interface PickerTriggerInputProps extends Omit<ComponentPropsWithoutRef<\"input\">, \"size\"> {\n\trootRef?: (node: HTMLDivElement | null) => void;\n\tendAdornment?: ReactNode;\n\toverlay?: ReactNode;\n\trootClassName?: string;\n\tinputClassName?: string;\n\tisLoading?: boolean;\n}\n\nexport const PickerTriggerInput = forwardRef<HTMLInputElement, PickerTriggerInputProps>(\n\t({ rootRef, endAdornment, overlay, rootClassName, inputClassName, isLoading, ...props }, ref) => {\n\t\tconst hasOverlay = overlay !== undefined && overlay !== null;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={rootRef}\n\t\t\t\tclassName={cn(uiStyles.uiInputContainer, styles.triggerContainer, rootClassName)}\n\t\t\t\tdata-has-overlay={hasOverlay || undefined}>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<InputLoadingFrame />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InputControl endAdornment={endAdornment}>\n\t\t\t\t\t\t\t{({ controlClassName }) => (\n\t\t\t\t\t\t\t\t<input {...props} ref={ref} className={cn(uiStyles.uiInputWithToggle, controlClassName, inputClassName)} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</InputControl>\n\t\t\t\t\t\t{hasOverlay ? overlay : null}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nPickerTriggerInput.displayName = \"PickerTriggerInput\";\n","import { type ReactNode, type Ref } from \"react\";\n\nimport styles from \"./Picker.module.scss\";\nimport { PickerClearButton } from \"./PickerClearButton\";\nimport { getPickerPlaceholder } from \"./PickerPlaceholder\";\nimport { PickerSelectedToken } from \"./PickerSelectedToken\";\nimport { PickerTriggerActions } from \"./PickerTriggerActions\";\nimport { PickerTriggerInput, type PickerTriggerInputProps } from \"./PickerTriggerInput\";\n\nexport interface PickerTriggerProps extends Omit<PickerTriggerInputProps, \"placeholder\" | \"overlay\" | \"endAdornment\"> {\n\tref?: Ref<HTMLInputElement>;\n\topen: boolean;\n\toptionCount: number;\n\tplaceholder?: string;\n\tlabel?: ReactNode;\n\tplaceholderFallback?: string;\n\tselectedValue?: ReactNode;\n\thasSelection?: boolean;\n\tshowSelectedValue?: boolean;\n\tclearable?: boolean;\n\tonClear?: () => void;\n\tclearAriaLabel?: string;\n\tonToggleMouseDown?: PickerTriggerActionsProps[\"onToggleMouseDown\"];\n\tonToggleClick: PickerTriggerActionsProps[\"onToggleClick\"];\n\topenAriaLabel?: string;\n\tcloseAriaLabel?: string;\n}\n\ntype PickerTriggerActionsProps = Parameters<typeof PickerTriggerActions>[0];\n\n/**\n * Общая композиция picker-trigger: input, выбранное значение, очистка и кнопка\n * открытия. Владельцы picker-моделей передают только состояние и обработчики.\n */\nexport function PickerTrigger({\n\tref,\n\topen,\n\toptionCount,\n\tplaceholder,\n\tlabel,\n\tplaceholderFallback,\n\tselectedValue,\n\thasSelection,\n\tshowSelectedValue = selectedValue !== undefined && selectedValue !== null,\n\tclearable = false,\n\tonClear,\n\tclearAriaLabel,\n\tonToggleMouseDown,\n\tonToggleClick,\n\topenAriaLabel,\n\tcloseAriaLabel,\n\tdisabled,\n\tinputClassName,\n\t...inputProps\n}: PickerTriggerProps) {\n\tconst hasSelectedValue = hasSelection ?? (selectedValue !== undefined && selectedValue !== null);\n\tconst canClear = clearable && hasSelectedValue && onClear !== undefined && !disabled;\n\n\treturn (\n\t\t<PickerTriggerInput\n\t\t\t{...inputProps}\n\t\t\tref={ref}\n\t\t\tdisabled={disabled}\n\t\t\tplaceholder={\n\t\t\t\tshowSelectedValue ? undefined : getPickerPlaceholder({ placeholder, label, optionCount, fallback: placeholderFallback })\n\t\t\t}\n\t\t\tinputClassName={inputClassName}\n\t\t\trootClassName={clearable ? styles.triggerHasClear : undefined}\n\t\t\toverlay={showSelectedValue ? <PickerSelectedToken>{selectedValue}</PickerSelectedToken> : undefined}\n\t\t\tendAdornment={\n\t\t\t\t<PickerTriggerActions\n\t\t\t\t\topen={open}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonToggleMouseDown={onToggleMouseDown}\n\t\t\t\t\tonToggleClick={onToggleClick}\n\t\t\t\t\topenAriaLabel={openAriaLabel}\n\t\t\t\t\tcloseAriaLabel={closeAriaLabel}>\n\t\t\t\t\t{canClear ? <PickerClearButton ariaLabel={clearAriaLabel} onClear={onClear} /> : null}\n\t\t\t\t</PickerTriggerActions>\n\t\t\t}\n\t\t/>\n\t);\n}\n","export type PickerTriggerMode = \"display\" | \"search-single\" | \"search-multi\";\n\ninterface PickerTriggerTextFocusParams {\n\topen: boolean;\n\tcurrentQuery: string;\n\thasDisplayValue: boolean;\n}\n\nexport interface PickerTriggerPolicy {\n\tfocusFloatingOnOpen: boolean;\n\trestoreFocusOnClose: boolean;\n\tresetQueryOnClose: boolean;\n\tshouldOpenOnTriggerClick: (open: boolean) => boolean;\n\tshouldOpenOnInputChange: (open: boolean) => boolean;\n\tshouldFocusReferenceOnToggle: (open: boolean) => boolean;\n\tshouldSelectTriggerTextOnFocus: (params: PickerTriggerTextFocusParams) => boolean;\n}\n\n/**\n * Единая политика поведения trigger-input для picker-компонентов.\n * Нормализует различия между display-режимом, single-search и multi-search.\n */\nexport function createPickerTriggerPolicy(mode: PickerTriggerMode): PickerTriggerPolicy {\n\tswitch (mode) {\n\t\tcase \"search-single\":\n\t\t\treturn {\n\t\t\t\tfocusFloatingOnOpen: false,\n\t\t\t\trestoreFocusOnClose: false,\n\t\t\t\tresetQueryOnClose: true,\n\t\t\t\tshouldOpenOnTriggerClick: () => false,\n\t\t\t\tshouldOpenOnInputChange: (open) => !open,\n\t\t\t\tshouldFocusReferenceOnToggle: (open) => !open,\n\t\t\t\tshouldSelectTriggerTextOnFocus: ({ open, currentQuery, hasDisplayValue }) =>\n\t\t\t\t\t!open && currentQuery.length === 0 && hasDisplayValue\n\t\t\t};\n\t\tcase \"search-multi\":\n\t\t\treturn {\n\t\t\t\tfocusFloatingOnOpen: false,\n\t\t\t\trestoreFocusOnClose: false,\n\t\t\t\tresetQueryOnClose: true,\n\t\t\t\tshouldOpenOnTriggerClick: () => false,\n\t\t\t\tshouldOpenOnInputChange: (open) => !open,\n\t\t\t\tshouldFocusReferenceOnToggle: (open) => !open,\n\t\t\t\tshouldSelectTriggerTextOnFocus: () => false\n\t\t\t};\n\t\tcase \"display\":\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tfocusFloatingOnOpen: true,\n\t\t\t\trestoreFocusOnClose: true,\n\t\t\t\tresetQueryOnClose: false,\n\t\t\t\tshouldOpenOnTriggerClick: (open) => !open,\n\t\t\t\tshouldOpenOnInputChange: () => false,\n\t\t\t\tshouldFocusReferenceOnToggle: () => false,\n\t\t\t\tshouldSelectTriggerTextOnFocus: () => false\n\t\t\t};\n\t}\n}\n","import { useMemo } from \"react\";\n\nimport { normalizeTextToLower } from \"@ryuzaki13/react-foundation-lib/formatters\";\n\ninterface UsePickerDefaultFilterOptions<T> {\n\toptions: readonly T[];\n\tquery: string;\n\tenabled?: boolean;\n\tgetSearchText: (option: T) => unknown;\n}\n\nfunction normalizeSearchText(value: unknown) {\n\tconst parts = Array.isArray(value) ? value : [value];\n\n\treturn normalizeTextToLower(parts.filter(Boolean).join(\" \"));\n}\n\nexport function usePickerDefaultFilter<T>({ options, query, enabled = true, getSearchText }: UsePickerDefaultFilterOptions<T>) {\n\tconst normalizedQuery = normalizeTextToLower(query);\n\n\treturn useMemo(() => {\n\t\tif (!enabled || !normalizedQuery) {\n\t\t\treturn [...options];\n\t\t}\n\n\t\treturn options.filter((option) => normalizeSearchText(getSearchText(option)).includes(normalizedQuery));\n\t}, [enabled, getSearchText, normalizedQuery, options]);\n}\n","import { Placement } from \"@floating-ui/react\";\nimport {\n\ttype FloatingListboxPlacementStrategy,\n\ttype FloatingListboxSizeResolver,\n\tuseFloatingListbox\n} from \"@ryuzaki13/react-foundation-lib/hooks\";\n\nimport { PickerTriggerMode, createPickerTriggerPolicy } from \"./createPickerTriggerPolicy\";\n\ninterface UsePickerFloatingListboxParams<T> {\n\toptions: readonly T[];\n\tselectedIndex: number;\n\topen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n\tgetOptionDisabled?: (option: T) => boolean;\n\tonSelect?: (option: T) => void;\n\tdisabled?: boolean;\n\tplacement?: Placement;\n\tplacementStrategy?: FloatingListboxPlacementStrategy;\n\tcloseOnSelect?: boolean;\n\tfocusFloatingOnOpen?: boolean;\n\tallowOpenWithoutOptions?: boolean;\n\trestoreFocusOnClose?: boolean;\n\ttriggerMode?: PickerTriggerMode;\n\tresolveFloatingSize?: FloatingListboxSizeResolver;\n}\n\n/**\n * Единая точка входа для popup/listbox поведения во всех picker-компонентах.\n */\nexport function usePickerFloatingListbox<T>(params: UsePickerFloatingListboxParams<T>) {\n\tconst triggerPolicy = params.triggerMode ? createPickerTriggerPolicy(params.triggerMode) : undefined;\n\n\treturn useFloatingListbox({\n\t\t...params,\n\t\tfocusFloatingOnOpen: params.focusFloatingOnOpen ?? triggerPolicy?.focusFloatingOnOpen,\n\t\trestoreFocusOnClose: params.restoreFocusOnClose ?? triggerPolicy?.restoreFocusOnClose\n\t});\n}\n","import { useState } from \"react\";\n\nimport { PickerTriggerMode, createPickerTriggerPolicy } from \"./createPickerTriggerPolicy\";\n\ninterface UsePickerQueryOptions {\n\tquery?: string;\n\tdefaultQuery?: string;\n\tonQuery?: (value: string) => void;\n\tresetOnClose?: boolean;\n\ttriggerMode?: PickerTriggerMode;\n}\n\n/**\n * Управляет controlled/uncontrolled query и возвращает policy закрытия владельцу open-state.\n * Сброс выполняется самим владельцем в событии close, поэтому hook не зеркалит lifecycle через effect.\n */\nexport function usePickerQuery({ query, defaultQuery, onQuery, resetOnClose, triggerMode }: UsePickerQueryOptions) {\n\tconst isControlled = query !== undefined;\n\tconst [internalQuery, setInternalQuery] = useState(defaultQuery ?? \"\");\n\tconst currentQuery = isControlled ? (query ?? \"\") : internalQuery;\n\tconst resolvedResetOnClose = resetOnClose ?? (triggerMode ? createPickerTriggerPolicy(triggerMode).resetQueryOnClose : true);\n\n\tconst setQuery = (nextValue: string) => {\n\t\tif (!isControlled) {\n\t\t\tsetInternalQuery(nextValue);\n\t\t}\n\n\t\tonQuery?.(nextValue);\n\t};\n\n\treturn {\n\t\tquery: currentQuery,\n\t\tsetQuery,\n\t\tclearQuery: () => setQuery(\"\"),\n\t\tresetQueryOnClose: resolvedResetOnClose\n\t};\n}\n","import { useEffect, useRef, useState } from \"react\";\n\ninterface UsePickerSelectionLifecycleOptions<TValue> {\n\tvalue: TValue;\n\topen: boolean;\n\tonCommit: (value: TValue) => void;\n\tonOpen?: () => void;\n\tonClose?: (value: TValue) => void;\n\tisEqual: (left: TValue, right: TValue) => boolean;\n}\n\n/**\n * Общий жизненный цикл чернового выбора для picker-компонентов,\n * где изменения подтверждаются при закрытии popup.\n */\nexport function usePickerSelectionLifecycle<TValue>({\n\tvalue,\n\topen,\n\tonCommit,\n\tonOpen,\n\tonClose,\n\tisEqual\n}: UsePickerSelectionLifecycleOptions<TValue>) {\n\tconst previousOpenRef = useRef(false);\n\tconst [draftValue, setDraftValue] = useState(value);\n\n\tuseEffect(() => {\n\t\tif (previousOpenRef.current && !open) {\n\t\t\tif (!isEqual(draftValue, value)) {\n\t\t\t\tonCommit(draftValue);\n\t\t\t}\n\n\t\t\tonClose?.(draftValue);\n\t\t}\n\n\t\tpreviousOpenRef.current = open;\n\t}, [draftValue, isEqual, onClose, onCommit, open, value]);\n\n\tconst prepareOpen = () => {\n\t\tsetDraftValue(value);\n\t\tonOpen?.();\n\t};\n\n\treturn {\n\t\tdraftValue,\n\t\tsetDraftValue,\n\t\tprepareOpen\n\t};\n}\n","import { MouseEvent, RefObject } from \"react\";\n\nimport { PickerTriggerMode, createPickerTriggerPolicy } from \"./createPickerTriggerPolicy\";\n\ninterface UsePickerTriggerControllerOptions {\n\tmode: PickerTriggerMode;\n\topen: boolean;\n\tcurrentQuery: string;\n\thasDisplayValue: boolean;\n\tinputRef: RefObject<HTMLInputElement | null>;\n\tsetQuery?: (value: string) => void;\n\topenList?: () => void;\n\tclose?: () => void;\n\ttoggleOpen?: () => void;\n\tonBeforeOpen?: () => void;\n}\n\ninterface HandleTriggerKeyDownOptions {\n\tevent: React.KeyboardEvent<HTMLElement>;\n\tonActivateWhenOpen?: () => void;\n\tenableSpaceActivation?: boolean;\n\tenableClosedArrowDownOpen?: boolean;\n\tsuppressClosedArrowUp?: boolean;\n}\n\nfunction focusInput(inputRef: RefObject<HTMLInputElement | null>) {\n\trequestAnimationFrame(() => {\n\t\tinputRef.current?.focus();\n\t});\n}\n\n/**\n * Единый контроллер пользовательских действий на trigger-input.\n * Держит поведение display/search-single/search-multi в одном месте.\n */\nexport function usePickerTriggerController({\n\tmode,\n\topen,\n\tcurrentQuery,\n\thasDisplayValue,\n\tinputRef,\n\tsetQuery,\n\topenList,\n\tclose,\n\ttoggleOpen,\n\tonBeforeOpen\n}: UsePickerTriggerControllerOptions) {\n\tconst policy = createPickerTriggerPolicy(mode);\n\n\tconst openTrigger = () => {\n\t\tonBeforeOpen?.();\n\n\t\tif (openList) {\n\t\t\topenList();\n\t\t\treturn;\n\t\t}\n\n\t\ttoggleOpen?.();\n\t};\n\n\tconst closeTrigger = () => {\n\t\tif (close) {\n\t\t\tclose();\n\t\t\treturn;\n\t\t}\n\n\t\ttoggleOpen?.();\n\t};\n\n\tconst toggleTrigger = () => {\n\t\tif (open) {\n\t\t\tcloseTrigger();\n\t\t} else {\n\t\t\topenTrigger();\n\t\t}\n\n\t\tif (policy.shouldFocusReferenceOnToggle(open)) {\n\t\t\tfocusInput(inputRef);\n\t\t}\n\t};\n\n\treturn {\n\t\tpolicy,\n\t\thandleTriggerInputChange: (nextValue: string) => {\n\t\t\tsetQuery?.(nextValue);\n\n\t\t\tif (policy.shouldOpenOnInputChange(open)) {\n\t\t\t\topenTrigger();\n\t\t\t}\n\t\t},\n\t\thandleTriggerClick: () => {\n\t\t\tif (policy.shouldOpenOnTriggerClick(open)) {\n\t\t\t\topenTrigger();\n\t\t\t}\n\t\t},\n\t\thandleTriggerFocus: (input: HTMLInputElement) => {\n\t\t\tif (\n\t\t\t\tpolicy.shouldSelectTriggerTextOnFocus({\n\t\t\t\t\topen,\n\t\t\t\t\tcurrentQuery,\n\t\t\t\t\thasDisplayValue\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tinput.select();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\thandleToggleMouseDown: (event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tevent.preventDefault();\n\t\t},\n\t\thandleToggleClick: () => {\n\t\t\ttoggleTrigger();\n\t\t},\n\t\thandleTriggerKeyDown: ({\n\t\t\tevent,\n\t\t\tonActivateWhenOpen,\n\t\t\tenableSpaceActivation = false,\n\t\t\tenableClosedArrowDownOpen = false,\n\t\t\tsuppressClosedArrowUp = false\n\t\t}: HandleTriggerKeyDownOptions) => {\n\t\t\tif (!open && suppressClosedArrowUp && event.key === \"ArrowUp\") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!open && enableClosedArrowDownOpen && event.key === \"ArrowDown\") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleTrigger();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (event.key === \"Enter\") {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif (open) {\n\t\t\t\t\tonActivateWhenOpen?.();\n\t\t\t\t} else {\n\t\t\t\t\ttoggleTrigger();\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (enableSpaceActivation && event.key === \" \") {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif (open) {\n\t\t\t\t\tonActivateWhenOpen?.();\n\t\t\t\t} else {\n\t\t\t\t\ttoggleTrigger();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\ttoggleTrigger\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,SAAgB,EAAsC,EACrD,OACA,UACA,gBACA,aACA,SACA,cACA,UACA,eAC4B;CAC5B,IAAM,EAAE,cAAW,YAAS,kBAAe,YAAS,mBAAgB,EAAiB;EACpF;EACA,UAAU,KAAiC;EAC3C,gBAAgB,CAAC,CAAC;EAClB,UAAU,CAAC,CAAC;CACb,CAAC;CAED,OACC,kBAAC,GAAD;EACQ;EACM;EACH;EACJ;E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;CAErB;CAEA,OAAO;EACN;EACA,2BAA2B,MAAsB;GAGhD,AAFA,IAAW,CAAS,GAEhB,EAAO,wBAAwB,CAAI,KACtC,EAAY;EAEd;EACA,0BAA0B;GACzB,AAAI,EAAO,yBAAyB,CAAI,KACvC,EAAY;EAEd;EACA,qBAAqB,MAA4B;GAChD,AACC,EAAO,+BAA+B;IACrC;IACA;IACA;GACD,CAAC,KAED,4BAA4B;IAC3B,EAAM,OAAO;GACd,CAAC;EAEH;EACA,wBAAwB,MAAyC;GAChE,EAAM,eAAe;EACtB;EACA,yBAAyB;GACxB,EAAc;EACf;EACA,uBAAuB,EACtB,UACA,uBACA,2BAAwB,IACxB,+BAA4B,IAC5B,2BAAwB,SACU;GAClC,IAAI,CAAC,KAAQ,KAAyB,EAAM,QAAQ,WAAW;IAC9D,EAAM,eAAe;IACrB;GACD;GAEA,IAAI,CAAC,KAAQ,KAA6B,EAAM,QAAQ,aAAa;IAEpE,AADA,EAAM,eAAe,GACrB,EAAc;IACd;GACD;GAEA,IAAI,EAAM,QAAQ,SAAS;IAG1B,AAFA,EAAM,eAAe,GAEjB,IACH,IAAqB,IAErB,EAAc;IAGf;GACD;GAEA,AAAI,KAAyB,EAAM,QAAQ,QAC1C,EAAM,eAAe,GAEjB,IACH,IAAqB,IAErB,EAAc;EAGjB;EACA;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-Bne-Ljbs.js","names":[],"sources":["../../src/popover/lib/applyPopoverAvailableSize.ts","../../src/popover/components/Popover.module.scss","../../src/popover/components/PopoverContext.tsx","../../src/popover/components/PopoverContent.tsx","../../src/popover/components/PopoverTrigger.tsx","../../src/popover/components/Popover.tsx","../../src/popover/Popover.module.scss","../../src/popover/FloatingPopover.tsx","../../src/popover/FloatingTooltip.tsx"],"sourcesContent":["type ApplyPopoverAvailableSizeOptions = {\n\treadonly availableWidth: number;\n\treadonly availableHeight: number;\n\treadonly floating: HTMLElement;\n};\n\n/**\n * Передаёт вычисленную Floating UI доступную область самому popover через CSS-переменные.\n * Потребитель может совместить эти границы со своим размером и режимом прокрутки,\n * не дублируя `size()` middleware и правила clipping context.\n */\nexport function applyPopoverAvailableSize({ availableWidth, availableHeight, floating }: ApplyPopoverAvailableSizeOptions) {\n\tfloating.style.setProperty(\"--popover-available-width\", `${Math.max(0, availableWidth)}px`);\n\tfloating.style.setProperty(\"--popover-available-height\", `${Math.max(0, availableHeight)}px`);\n}\n",".popover {\n\tpadding: var(--space-sm);\n\t// background-image: radial-gradient(var(--surface-0) 50%, var(--surface-1) 100%);\n\n\tborder: var(--border-width) solid var(--border-1);\n\tborder-radius: var(--radius-sm);\n\tcolor: var(--content-0);\n\n\tfilter: drop-shadow(var(--shadow-md));\n\n\tz-index: var(--z-popover);\n\n\t&.primary {\n\t\tbackground-color: var(--surface-0);\n\t}\n\n\t&.secondary {\n\t\tbackground-color: var(--surface-1);\n\t}\n}\n","import React, { createContext, useContext } from \"react\";\n\nimport { Placement, useFloating } from \"@floating-ui/react\";\nimport { createMissingContextError } from \"@ryuzaki13/react-foundation-lib/error\";\n\ninterface PopoverContextValue {\n\topen: boolean;\n\tsetOpen: React.Dispatch<React.SetStateAction<boolean>>;\n\trefs: ReturnType<typeof useFloating>[\"refs\"];\n\tfloatingStyles: React.CSSProperties;\n\tplacement: Placement;\n\tmiddlewareData: ReturnType<typeof useFloating>[\"middlewareData\"];\n\tarrowRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport const PopoverContext = createContext<PopoverContextValue | null>(null);\n\nexport function usePopoverContext() {\n\tconst context = useContext(PopoverContext);\n\tif (!context) {\n\t\tthrow createMissingContextError({\n\t\t\thookName: \"usePopoverContext\",\n\t\t\tproviderName: \"Popover\"\n\t\t});\n\t}\n\treturn context;\n}\n","import React, { useCallback, useRef } from \"react\";\n\nimport { FloatingPortal } from \"@floating-ui/react\";\nimport { useClickOutside, useEscapeDismiss, useOverlayFocus } from \"@ryuzaki13/react-foundation-lib/dom\";\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport { TooltipArrow } from \"../../floating-arrow\";\n\nimport styles from \"./Popover.module.scss\";\nimport { usePopoverContext } from \"./PopoverContext\";\n\nexport interface PopoverContentProps {\n\tchildren: React.ReactNode | ((ctx: { setClose: () => void }) => React.ReactNode);\n\tonClose?: () => void;\n\tcloseOnOutside?: boolean;\n\tcloseOnEscape?: boolean;\n\tdisableOutsideClick?: boolean;\n\tbackground?: \"primary\" | \"secondary\";\n}\n\n/**\n * Содержимое Popover, отображаемое в портале.\n */\nexport const PopoverContent: React.FC<PopoverContentProps> = ({\n\tchildren,\n\tonClose,\n\tcloseOnOutside = true,\n\tcloseOnEscape = true,\n\tdisableOutsideClick = false,\n\tbackground = \"secondary\"\n}) => {\n\tconst { open, setOpen, refs, floatingStyles, middlewareData, placement, arrowRef } = usePopoverContext();\n\tconst floatingElementRef = useRef<HTMLDivElement | null>(null);\n\tconst setFloating = useCallback(\n\t\t(node: HTMLDivElement | null) => {\n\t\t\tfloatingElementRef.current = node;\n\t\t\trefs.setFloating(node);\n\t\t},\n\t\t[refs]\n\t);\n\n\tconst floatingRef = useOverlayFocus<HTMLDivElement>({\n\t\tactive: open,\n\t\tinitialFocus: \"container\",\n\t\trestoreFocus: true,\n\t\tcontainerRef: floatingElementRef\n\t});\n\n\tconst setClose = useCallback(() => {\n\t\tif (!open) return;\n\t\tsetOpen(false);\n\t\tonClose?.();\n\t}, [setOpen, onClose, open]);\n\n\tuseEscapeDismiss({\n\t\tactive: open,\n\t\tenabled: closeOnEscape,\n\t\tonDismiss: setClose,\n\t\tcontainerRef: floatingRef as React.RefObject<HTMLElement | null>\n\t});\n\n\tconst outsideClose = useCallback(() => {\n\t\tif (!open || disableOutsideClick) return;\n\t\tif (closeOnOutside) setClose();\n\t}, [open, disableOutsideClick, closeOnOutside, setClose]);\n\n\tuseClickOutside([refs.floating as React.RefObject<HTMLElement>, refs.reference as React.RefObject<HTMLElement>], outsideClose);\n\n\tif (!open) return null;\n\n\treturn (\n\t\t<FloatingPortal>\n\t\t\t<div\n\t\t\t\tref={setFloating}\n\t\t\t\tstyle={floatingStyles}\n\t\t\t\tclassName={cn(styles.popover, styles[background])}\n\t\t\t\trole=\"dialog\"\n\t\t\t\taria-modal=\"true\"\n\t\t\t\ttabIndex={-1}>\n\t\t\t\t{typeof children === \"function\" ? children({ setClose }) : children}\n\t\t\t\t<TooltipArrow ref={arrowRef} placement={placement} middlewareData={middlewareData} />\n\t\t\t</div>\n\t\t</FloatingPortal>\n\t);\n};\n","import React, { cloneElement, useCallback } from \"react\";\n\nimport { usePopoverContext } from \"./PopoverContext\";\n\nexport interface PopoverTriggerProps {\n\tpassive?: true;\n\tchildren: React.ReactElement<React.HTMLAttributes<Element> & { ref?: React.Ref<Element> }>;\n}\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ passive, children }) => {\n\tconst { open, setOpen, refs } = usePopoverContext();\n\n\tconst handleClick = useCallback(\n\t\t(e: React.MouseEvent) => {\n\t\t\tif (children.props.onClick) {\n\t\t\t\tchildren.props.onClick(e);\n\t\t\t}\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\n\t\t\tif (passive) return;\n\n\t\t\tsetOpen((v) => !v);\n\t\t},\n\t\t[children, setOpen, passive]\n\t);\n\n\treturn cloneElement(children as React.JSX.Element, {\n\t\tref: refs.setReference,\n\t\t\"aria-expanded\": open,\n\t\tonClick: handleClick\n\t});\n};\n","/* eslint-disable react-refresh/only-export-components */\nimport React, { useCallback, useRef, useState } from \"react\";\n\nimport { arrow, autoUpdate, flip, offset, Placement, shift, size as floatingSize, useFloating } from \"@floating-ui/react\";\n\nimport { applyPopoverAvailableSize } from \"../lib/applyPopoverAvailableSize\";\n\nimport { PopoverContent } from \"./PopoverContent\";\nimport { PopoverContext } from \"./PopoverContext\";\nimport { PopoverTrigger } from \"./PopoverTrigger\";\n\nconst POPOVER_VIEWPORT_PADDING = 16;\n\nexport interface PopoverProps {\n\tchildren: React.ReactNode;\n\tplacement?: Placement;\n\topen?: boolean;\n\tdefaultOpen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Контролируемый Popover.\n * Используется в связке с Popover.Trigger и Popover.Content.\n */\nconst PopoverRoot: React.FC<PopoverProps> = ({ children, open: controlledOpen, defaultOpen, onOpenChange, placement = \"bottom\" }) => {\n\tconst [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? false);\n\n\tconst isControlled = controlledOpen !== undefined;\n\tconst open = isControlled ? controlledOpen : uncontrolledOpen;\n\tconst setOpen = useCallback<React.Dispatch<React.SetStateAction<boolean>>>(\n\t\t(value) => {\n\t\t\tconst next = typeof value === \"function\" ? value(open) : value;\n\t\t\tif (!isControlled) setUncontrolledOpen(next);\n\t\t\tonOpenChange?.(next);\n\t\t},\n\t\t[isControlled, onOpenChange, open]\n\t);\n\n\tconst arrowRef = useRef<HTMLDivElement | null>(null);\n\n\tconst {\n\t\trefs,\n\t\tfloatingStyles,\n\t\tmiddlewareData,\n\t\tplacement: actualPlacement\n\t} = useFloating({\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tplacement,\n\t\tmiddleware: [\n\t\t\toffset(8),\n\t\t\tflip({ padding: POPOVER_VIEWPORT_PADDING }),\n\t\t\tshift({ padding: POPOVER_VIEWPORT_PADDING }),\n\t\t\tfloatingSize({\n\t\t\t\tpadding: POPOVER_VIEWPORT_PADDING,\n\t\t\t\tapply({ availableWidth, availableHeight, elements }) {\n\t\t\t\t\tapplyPopoverAvailableSize({ availableWidth, availableHeight, floating: elements.floating });\n\t\t\t\t}\n\t\t\t}),\n\t\t\t// eslint-disable-next-line react-hooks/refs\n\t\t\tarrow({ element: arrowRef.current })\n\t\t],\n\t\twhileElementsMounted: autoUpdate\n\t});\n\n\treturn (\n\t\t<PopoverContext.Provider value={{ open, setOpen, refs, floatingStyles, placement: actualPlacement, middlewareData, arrowRef }}>\n\t\t\t{children}\n\t\t</PopoverContext.Provider>\n\t);\n};\n\n/**\n * Композиционное API:\n * <Popover>\n * <Popover.Trigger />\n * <Popover.Content />\n * </Popover>\n */\nexport const Popover = Object.assign(PopoverRoot, {\n\tTrigger: PopoverTrigger,\n\tContent: PopoverContent\n});\n",".tooltipPanel {\n\tpadding: var(--space-sm);\n\t// background-image: radial-gradient(var(--surface-0) 50%, var(--surface-1) 100%);\n\tbackground-color: var(--surface-1);\n\tborder: var(--border-width) solid var(--border-2);\n\tborder-radius: var(--radius-sm);\n\tcolor: var(--content-0);\n\n\tfilter: drop-shadow(var(--shadow-sm));\n\n\t&.negative {\n\t\t--border-1: var(--content-0);\n\n\t\tbackground-color: var(--content-0);\n\t\tborder-color: var(--border-1);\n\t\tcolor: var(--surface-1);\n\t}\n\n\t&.information {\n\t\t--border-1: var(--status-info-text);\n\n\t\tbackground-color: var(--status-info-text);\n\t\tborder-color: var(--status-info-text);\n\t\tcolor: var(--status-info-on-fill);\n\t}\n\n\t&.error {\n\t\t--border-1: var(--status-error-text);\n\n\t\tbackground-color: var(--status-error-text);\n\t\tborder-color: var(--status-error-text);\n\t\tcolor: var(--status-error-on-fill);\n\t}\n\n\t&.warning {\n\t\t--border-1: var(--status-warning-text);\n\n\t\tbackground-color: var(--status-warning-text);\n\t\tborder-color: var(--status-warning-text);\n\t\tcolor: var(--status-warning-on-fill);\n\t}\n\n\t&.success {\n\t\t--border-1: var(--status-success-text);\n\n\t\tbackground-color: var(--status-success-text);\n\t\tborder-color: var(--status-success-text);\n\t\tcolor: var(--status-success-on-fill);\n\t}\n}\n\n.tooltip {\n\tz-index: var(--z-tooltip);\n\tpointer-events: none;\n\n\ttext-align: initial;\n\tfont-size: var(--font-size-sm);\n\tfont-style: normal;\n\tfont-weight: 500;\n\tfont-variation-settings: \"wght\" 500;\n\tline-height: var(--line-height);\n\n\t@extend .tooltipPanel;\n}\n","/* eslint-disable react-hooks/refs */\nimport React, { useLayoutEffect, useRef, useState } from \"react\";\n\nimport {\n\tarrow,\n\tautoUpdate,\n\tflip,\n\toffset,\n\tPlacement,\n\tshift,\n\tuseDismiss,\n\tuseFocus,\n\tuseFloating,\n\tuseHover,\n\tuseInteractions,\n\tuseRole\n} from \"@floating-ui/react\";\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\nimport { createPortal } from \"react-dom\";\n\nimport { FloatingArrow } from \"../floating-arrow/FloatingArrow\";\n\nimport styles from \"./Popover.module.scss\";\n\ninterface FloatingPopoverProps {\n\tcontent: React.ReactNode;\n\tchildren: React.ReactNode;\n\topenOnHover?: boolean;\n\tplacement?: Placement;\n\topenDelay?: number;\n\tcloseDelay?: number;\n\tmaxWidth?: number;\n\tstate?: \"information\" | \"error\" | \"warning\" | \"success\" | \"negative\";\n\ttooltip?: true;\n\t/**\n\t * Изменяется вместе с CSS-координатой trigger, когда её изменение не отслеживается `autoUpdate`.\n\t * После commit React выполняется повторный расчёт позиции открытой floating-панели.\n\t */\n\tpositionUpdateKey?: unknown;\n}\n\nexport const FloatingPopover: React.FC<FloatingPopoverProps> = ({\n\tcontent,\n\tchildren,\n\topenOnHover = true,\n\tplacement = \"bottom\",\n\topenDelay = 200,\n\tcloseDelay = 100,\n\tmaxWidth,\n\tstate,\n\ttooltip,\n\tpositionUpdateKey\n}) => {\n\tconst [open, setOpen] = useState(false);\n\tconst arrowRef = useRef<HTMLDivElement>(null);\n\n\tconst {\n\t\trefs,\n\t\tfloatingStyles,\n\t\tmiddlewareData,\n\t\tcontext,\n\t\tplacement: computedPlacement,\n\t\tupdate\n\t} = useFloating({\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tplacement,\n\t\tmiddleware: [\n\t\t\toffset(8),\n\t\t\tflip({ fallbackAxisSideDirection: \"end\", fallbackPlacements: [\"top\", \"right\", \"bottom\"] }),\n\t\t\tshift({ padding: 8 }),\n\t\t\tarrow({ element: arrowRef, padding: 8 })\n\t\t],\n\t\twhileElementsMounted: autoUpdate\n\t});\n\n\tuseLayoutEffect(() => {\n\t\tif (open) {\n\t\t\tvoid update();\n\t\t}\n\t}, [open, positionUpdateKey, update]);\n\n\tconst hover = useHover(context, {\n\t\tenabled: openOnHover,\n\t\tmove: false,\n\t\tdelay: {\n\t\t\topen: openDelay,\n\t\t\tclose: closeDelay\n\t\t}\n\t});\n\t// Hover-подсказка обязана иметь ту же пассивную точку входа с клавиатуры.\n\t// Связываем focus с тем же флагом, чтобы `openOnHover={false}` не менял\n\t// управляемые сценарии, которые не запрашивали автоматическое открытие.\n\tconst focus = useFocus(context, { enabled: openOnHover });\n\tconst dismiss = useDismiss(context);\n\tconst role = useRole(context);\n\n\tconst { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role]);\n\n\treturn (\n\t\t<>\n\t\t\t<span ref={refs.setReference} {...getReferenceProps()} style={{ lineHeight: 1 }}>\n\t\t\t\t{children}\n\t\t\t</span>\n\n\t\t\t{open &&\n\t\t\t\tcreatePortal(\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={refs.setFloating}\n\t\t\t\t\t\tstyle={{ ...floatingStyles, zIndex: \"var(--z-tooltip)\", maxWidth: maxWidth ? `${maxWidth}em` : undefined }}\n\t\t\t\t\t\t{...getFloatingProps()}\n\t\t\t\t\t\trole=\"tooltip\"\n\t\t\t\t\t\tclassName={cn(styles.tooltipPanel, tooltip && styles.tooltip, state && styles[state])}>\n\t\t\t\t\t\t{content}\n\n\t\t\t\t\t\t<FloatingArrow ref={arrowRef} placement={computedPlacement} middlewareData={middlewareData} />\n\t\t\t\t\t</div>,\n\t\t\t\t\tdocument.body\n\t\t\t\t)}\n\t\t</>\n\t);\n};\n","import React, { useEffect, useRef } from \"react\";\n\nimport { arrow, flip, offset, shift, useFloating } from \"@floating-ui/react\";\n\nimport { FloatingArrow } from \"../floating-arrow/FloatingArrow\";\n\nimport styles from \"./Popover.module.scss\";\n\nexport const FloatingTooltip: React.FC<{\n\tx: number;\n\ty: number;\n\tchildren: React.ReactNode;\n}> = ({ x, y, children }) => {\n\tconst arrowRef = useRef<HTMLDivElement | null>(null);\n\n\tconst {\n\t\trefs,\n\t\tfloatingStyles,\n\t\tmiddlewareData,\n\t\tplacement: computedPlacement\n\t} = useFloating({\n\t\tstrategy: \"absolute\",\n\t\tplacement: \"top\",\n\t\t// eslint-disable-next-line react-hooks/refs\n\t\tmiddleware: [offset(6), flip(), shift({ padding: 16 }), arrow({ element: arrowRef })]\n\t});\n\n\tuseEffect(() => {\n\t\tif (refs.setReference) {\n\t\t\trefs.setReference({\n\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t({\n\t\t\t\t\t\tx,\n\t\t\t\t\t\ty,\n\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\ttop: y,\n\t\t\t\t\t\tleft: x,\n\t\t\t\t\t\tbottom: y,\n\t\t\t\t\t\tright: x,\n\t\t\t\t\t\ttoJSON: () => {}\n\t\t\t\t\t}) as DOMRect\n\t\t\t});\n\t\t}\n\t}, [x, y, refs]);\n\n\treturn (\n\t\t<div ref={refs.setFloating} style={{ ...floatingStyles, position: \"absolute\", pointerEvents: \"none\" }} className={styles.tooltip}>\n\t\t\t{children}\n\n\t\t\t<FloatingArrow ref={arrowRef} placement={computedPlacement} middlewareData={middlewareData} />\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;AAWA,SAAgB,EAA0B,EAAE,mBAAgB,oBAAiB,eAA8C;CAE1H,AADA,EAAS,MAAM,YAAY,6BAA6B,GAAG,KAAK,IAAI,GAAG,CAAc,EAAE,GAAG,GAC1F,EAAS,MAAM,YAAY,8BAA8B,GAAG,KAAK,IAAI,GAAG,CAAe,EAAE,GAAG;AAC7F;;;;;GECa,IAAiB,EAA0C,IAAI;AAE5E,SAAgB,IAAoB;CACnC,IAAM,IAAU,EAAW,CAAc;CACzC,IAAI,CAAC,GACJ,MAAM,EAA0B;EAC/B,UAAU;EACV,cAAc;CACf,CAAC;CAEF,OAAO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AIP,EAAE,MAAG,MAAG,kBAAe;CAC5B,IAAM,IAAW,EAA8B,IAAI,GAE7C,EACL,SACA,mBACA,mBACA,WAAW,MACR,EAAY;EACf,UAAU;EACV,WAAW;EAEX,YAAY;GAAC,EAAO,CAAC;GAAG,EAAK;GAAG,EAAM,EAAE,SAAS,GAAG,CAAC;GAAG,EAAM,EAAE,SAAS,EAAS,CAAC;EAAC;CACrF,CAAC;CAqBD,OAnBA,QAAgB;EACf,AAAI,EAAK,gBACR,EAAK,aAAa,EACjB,8BACE;GACA;GACA;GACA,OAAO;GACP,QAAQ;GACR,KAAK;GACL,MAAM;GACN,QAAQ;GACR,OAAO;GACP,cAAc,CAAC;EAChB,GACF,CAAC;CAEH,GAAG;EAAC;EAAG;EAAG;CAAI,CAAC,GAGd,kBAAC,OAAD;EAAK,KAAK,EAAK;EAAa,OAAO;GAAE,GAAG;GAAgB,UAAU;GAAY,eAAe;EAAO;EAAG,WAAW,EAAO;EAAzH,UAAA,CACE,GAED,kBAAC,GAAD;GAAe,KAAK;GAAU,WAAW;GAAmC;EAAiB,CAAA,CACzF;;AAEP"}
|
|
1
|
+
{"version":3,"file":"popover-Bne-Ljbs.js","names":[],"sources":["../../src/popover/lib/applyPopoverAvailableSize.ts","../../src/popover/components/Popover.module.scss","../../src/popover/components/PopoverContext.tsx","../../src/popover/components/PopoverContent.tsx","../../src/popover/components/PopoverTrigger.tsx","../../src/popover/components/Popover.tsx","../../src/popover/Popover.module.scss","../../src/popover/FloatingPopover.tsx","../../src/popover/FloatingTooltip.tsx"],"sourcesContent":["type ApplyPopoverAvailableSizeOptions = {\n\treadonly availableWidth: number;\n\treadonly availableHeight: number;\n\treadonly floating: HTMLElement;\n};\n\n/**\n * Передаёт вычисленную Floating UI доступную область самому popover через CSS-переменные.\n * Потребитель может совместить эти границы со своим размером и режимом прокрутки,\n * не дублируя `size()` middleware и правила clipping context.\n */\nexport function applyPopoverAvailableSize({ availableWidth, availableHeight, floating }: ApplyPopoverAvailableSizeOptions) {\n\tfloating.style.setProperty(\"--popover-available-width\", `${Math.max(0, availableWidth)}px`);\n\tfloating.style.setProperty(\"--popover-available-height\", `${Math.max(0, availableHeight)}px`);\n}\n",".popover {\n\tpadding: var(--space-sm);\n\t// background-image: radial-gradient(var(--surface-0) 50%, var(--surface-1) 100%);\n\n\tborder: var(--border-width) solid var(--border-1);\n\tborder-radius: var(--radius-sm);\n\tcolor: var(--content-0);\n\n\tfilter: drop-shadow(var(--shadow-md));\n\n\tz-index: var(--z-popover);\n\n\t&.primary {\n\t\tbackground-color: var(--surface-0);\n\t}\n\n\t&.secondary {\n\t\tbackground-color: var(--surface-1);\n\t}\n}\n","import React, { createContext, useContext } from \"react\";\n\nimport { Placement, useFloating } from \"@floating-ui/react\";\nimport { createMissingContextError } from \"@ryuzaki13/react-foundation-lib/error\";\n\ninterface PopoverContextValue {\n\topen: boolean;\n\tsetOpen: React.Dispatch<React.SetStateAction<boolean>>;\n\trefs: ReturnType<typeof useFloating>[\"refs\"];\n\tfloatingStyles: React.CSSProperties;\n\tplacement: Placement;\n\tmiddlewareData: ReturnType<typeof useFloating>[\"middlewareData\"];\n\tarrowRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport const PopoverContext = createContext<PopoverContextValue | null>(null);\n\nexport function usePopoverContext() {\n\tconst context = useContext(PopoverContext);\n\tif (!context) {\n\t\tthrow createMissingContextError({\n\t\t\thookName: \"usePopoverContext\",\n\t\t\tproviderName: \"Popover\"\n\t\t});\n\t}\n\treturn context;\n}\n","import React, { useCallback, useRef } from \"react\";\n\nimport { FloatingPortal } from \"@floating-ui/react\";\nimport { useClickOutside, useEscapeDismiss, useOverlayFocus } from \"@ryuzaki13/react-foundation-lib/dom\";\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport { TooltipArrow } from \"../../floating-arrow\";\n\nimport styles from \"./Popover.module.scss\";\nimport { usePopoverContext } from \"./PopoverContext\";\n\nexport interface PopoverContentProps {\n\tchildren: React.ReactNode | ((ctx: { setClose: () => void }) => React.ReactNode);\n\tonClose?: () => void;\n\tcloseOnOutside?: boolean;\n\tcloseOnEscape?: boolean;\n\tdisableOutsideClick?: boolean;\n\tbackground?: \"primary\" | \"secondary\";\n}\n\n/**\n * Содержимое Popover, отображаемое в портале.\n */\nexport const PopoverContent: React.FC<PopoverContentProps> = ({\n\tchildren,\n\tonClose,\n\tcloseOnOutside = true,\n\tcloseOnEscape = true,\n\tdisableOutsideClick = false,\n\tbackground = \"secondary\"\n}) => {\n\tconst { open, setOpen, refs, floatingStyles, middlewareData, placement, arrowRef } = usePopoverContext();\n\tconst floatingElementRef = useRef<HTMLDivElement | null>(null);\n\tconst setFloating = useCallback(\n\t\t(node: HTMLDivElement | null) => {\n\t\t\tfloatingElementRef.current = node;\n\t\t\trefs.setFloating(node);\n\t\t},\n\t\t[refs]\n\t);\n\n\tconst floatingRef = useOverlayFocus<HTMLDivElement>({\n\t\tactive: open,\n\t\tinitialFocus: \"container\",\n\t\trestoreFocus: true,\n\t\tcontainerRef: floatingElementRef\n\t});\n\n\tconst setClose = useCallback(() => {\n\t\tif (!open) return;\n\t\tsetOpen(false);\n\t\tonClose?.();\n\t}, [setOpen, onClose, open]);\n\n\tuseEscapeDismiss({\n\t\tactive: open,\n\t\tenabled: closeOnEscape,\n\t\tonDismiss: setClose,\n\t\tcontainerRef: floatingRef as React.RefObject<HTMLElement | null>\n\t});\n\n\tconst outsideClose = useCallback(() => {\n\t\tif (!open || disableOutsideClick) return;\n\t\tif (closeOnOutside) setClose();\n\t}, [open, disableOutsideClick, closeOnOutside, setClose]);\n\n\tuseClickOutside([refs.floating as React.RefObject<HTMLElement>, refs.reference as React.RefObject<HTMLElement>], outsideClose);\n\n\tif (!open) return null;\n\n\treturn (\n\t\t<FloatingPortal>\n\t\t\t<div\n\t\t\t\tref={setFloating}\n\t\t\t\tstyle={floatingStyles}\n\t\t\t\tclassName={cn(styles.popover, styles[background])}\n\t\t\t\trole=\"dialog\"\n\t\t\t\taria-modal=\"true\"\n\t\t\t\ttabIndex={-1}>\n\t\t\t\t{typeof children === \"function\" ? children({ setClose }) : children}\n\t\t\t\t<TooltipArrow ref={arrowRef} placement={placement} middlewareData={middlewareData} />\n\t\t\t</div>\n\t\t</FloatingPortal>\n\t);\n};\n","import React, { cloneElement, useCallback } from \"react\";\n\nimport { usePopoverContext } from \"./PopoverContext\";\n\nexport interface PopoverTriggerProps {\n\tpassive?: true;\n\tchildren: React.ReactElement<React.HTMLAttributes<Element> & { ref?: React.Ref<Element> }>;\n}\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ passive, children }) => {\n\tconst { open, setOpen, refs } = usePopoverContext();\n\n\tconst handleClick = useCallback(\n\t\t(e: React.MouseEvent) => {\n\t\t\tif (children.props.onClick) {\n\t\t\t\tchildren.props.onClick(e);\n\t\t\t}\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\n\t\t\tif (passive) return;\n\n\t\t\tsetOpen((v) => !v);\n\t\t},\n\t\t[children, setOpen, passive]\n\t);\n\n\treturn cloneElement(children as React.JSX.Element, {\n\t\tref: refs.setReference,\n\t\t\"aria-expanded\": open,\n\t\tonClick: handleClick\n\t});\n};\n","/* eslint-disable react-refresh/only-export-components */\nimport React, { useCallback, useRef, useState } from \"react\";\n\nimport { arrow, autoUpdate, flip, offset, Placement, shift, size as floatingSize, useFloating } from \"@floating-ui/react\";\n\nimport { applyPopoverAvailableSize } from \"../lib/applyPopoverAvailableSize\";\n\nimport { PopoverContent } from \"./PopoverContent\";\nimport { PopoverContext } from \"./PopoverContext\";\nimport { PopoverTrigger } from \"./PopoverTrigger\";\n\nconst POPOVER_VIEWPORT_PADDING = 16;\n\nexport interface PopoverProps {\n\tchildren: React.ReactNode;\n\tplacement?: Placement;\n\topen?: boolean;\n\tdefaultOpen?: boolean;\n\tonOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Контролируемый Popover.\n * Используется в связке с Popover.Trigger и Popover.Content.\n */\nconst PopoverRoot: React.FC<PopoverProps> = ({ children, open: controlledOpen, defaultOpen, onOpenChange, placement = \"bottom\" }) => {\n\tconst [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? false);\n\n\tconst isControlled = controlledOpen !== undefined;\n\tconst open = isControlled ? controlledOpen : uncontrolledOpen;\n\tconst setOpen = useCallback<React.Dispatch<React.SetStateAction<boolean>>>(\n\t\t(value) => {\n\t\t\tconst next = typeof value === \"function\" ? value(open) : value;\n\t\t\tif (!isControlled) setUncontrolledOpen(next);\n\t\t\tonOpenChange?.(next);\n\t\t},\n\t\t[isControlled, onOpenChange, open]\n\t);\n\n\tconst arrowRef = useRef<HTMLDivElement | null>(null);\n\n\tconst {\n\t\trefs,\n\t\tfloatingStyles,\n\t\tmiddlewareData,\n\t\tplacement: actualPlacement\n\t} = useFloating({\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tplacement,\n\t\tmiddleware: [\n\t\t\toffset(8),\n\t\t\tflip({ padding: POPOVER_VIEWPORT_PADDING }),\n\t\t\tshift({ padding: POPOVER_VIEWPORT_PADDING }),\n\t\t\tfloatingSize({\n\t\t\t\tpadding: POPOVER_VIEWPORT_PADDING,\n\t\t\t\tapply({ availableWidth, availableHeight, elements }) {\n\t\t\t\t\tapplyPopoverAvailableSize({ availableWidth, availableHeight, floating: elements.floating });\n\t\t\t\t}\n\t\t\t}),\n\t\t\t// eslint-disable-next-line react-hooks/refs\n\t\t\tarrow({ element: arrowRef.current })\n\t\t],\n\t\twhileElementsMounted: autoUpdate\n\t});\n\n\treturn (\n\t\t<PopoverContext.Provider value={{ open, setOpen, refs, floatingStyles, placement: actualPlacement, middlewareData, arrowRef }}>\n\t\t\t{children}\n\t\t</PopoverContext.Provider>\n\t);\n};\n\n/**\n * Композиционное API:\n * <Popover>\n * <Popover.Trigger />\n * <Popover.Content />\n * </Popover>\n */\nexport const Popover = Object.assign(PopoverRoot, {\n\tTrigger: PopoverTrigger,\n\tContent: PopoverContent\n});\n",".tooltipPanel {\n\tpadding: var(--space-sm);\n\t// background-image: radial-gradient(var(--surface-0) 50%, var(--surface-1) 100%);\n\tbackground-color: var(--surface-1);\n\tborder: var(--border-width) solid var(--border-2);\n\tborder-radius: var(--radius-sm);\n\tcolor: var(--content-0);\n\n\tfilter: drop-shadow(var(--shadow-sm));\n\n\t&.negative {\n\t\t--border-1: var(--content-0);\n\n\t\tbackground-color: var(--content-0);\n\t\tborder-color: var(--border-1);\n\t\tcolor: var(--surface-1);\n\t}\n\n\t&.information {\n\t\t--border-1: var(--info-text);\n\n\t\tbackground-color: var(--info-text);\n\t\tborder-color: var(--info-text);\n\t\tcolor: var(--info-on-fill);\n\t}\n\n\t&.error {\n\t\t--border-1: var(--error-text);\n\n\t\tbackground-color: var(--error-text);\n\t\tborder-color: var(--error-text);\n\t\tcolor: var(--error-on-fill);\n\t}\n\n\t&.warning {\n\t\t--border-1: var(--warning-text);\n\n\t\tbackground-color: var(--warning-text);\n\t\tborder-color: var(--warning-text);\n\t\tcolor: var(--warning-on-fill);\n\t}\n\n\t&.success {\n\t\t--border-1: var(--success-text);\n\n\t\tbackground-color: var(--success-text);\n\t\tborder-color: var(--success-text);\n\t\tcolor: var(--success-on-fill);\n\t}\n}\n\n.tooltip {\n\tz-index: var(--z-tooltip);\n\tpointer-events: none;\n\n\ttext-align: initial;\n\tfont-size: var(--font-size-sm);\n\tfont-style: normal;\n\tfont-weight: 500;\n\tfont-variation-settings: \"wght\" 500;\n\tline-height: var(--line-height);\n\n\t@extend .tooltipPanel;\n}\n","/* eslint-disable react-hooks/refs */\nimport React, { useLayoutEffect, useRef, useState } from \"react\";\n\nimport {\n\tarrow,\n\tautoUpdate,\n\tflip,\n\toffset,\n\tPlacement,\n\tshift,\n\tuseDismiss,\n\tuseFocus,\n\tuseFloating,\n\tuseHover,\n\tuseInteractions,\n\tuseRole\n} from \"@floating-ui/react\";\nimport { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\nimport { createPortal } from \"react-dom\";\n\nimport { FloatingArrow } from \"../floating-arrow/FloatingArrow\";\n\nimport styles from \"./Popover.module.scss\";\n\ninterface FloatingPopoverProps {\n\tcontent: React.ReactNode;\n\tchildren: React.ReactNode;\n\topenOnHover?: boolean;\n\tplacement?: Placement;\n\topenDelay?: number;\n\tcloseDelay?: number;\n\tmaxWidth?: number;\n\tstate?: \"information\" | \"error\" | \"warning\" | \"success\" | \"negative\";\n\ttooltip?: true;\n\t/**\n\t * Изменяется вместе с CSS-координатой trigger, когда её изменение не отслеживается `autoUpdate`.\n\t * После commit React выполняется повторный расчёт позиции открытой floating-панели.\n\t */\n\tpositionUpdateKey?: unknown;\n}\n\nexport const FloatingPopover: React.FC<FloatingPopoverProps> = ({\n\tcontent,\n\tchildren,\n\topenOnHover = true,\n\tplacement = \"bottom\",\n\topenDelay = 200,\n\tcloseDelay = 100,\n\tmaxWidth,\n\tstate,\n\ttooltip,\n\tpositionUpdateKey\n}) => {\n\tconst [open, setOpen] = useState(false);\n\tconst arrowRef = useRef<HTMLDivElement>(null);\n\n\tconst {\n\t\trefs,\n\t\tfloatingStyles,\n\t\tmiddlewareData,\n\t\tcontext,\n\t\tplacement: computedPlacement,\n\t\tupdate\n\t} = useFloating({\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tplacement,\n\t\tmiddleware: [\n\t\t\toffset(8),\n\t\t\tflip({ fallbackAxisSideDirection: \"end\", fallbackPlacements: [\"top\", \"right\", \"bottom\"] }),\n\t\t\tshift({ padding: 8 }),\n\t\t\tarrow({ element: arrowRef, padding: 8 })\n\t\t],\n\t\twhileElementsMounted: autoUpdate\n\t});\n\n\tuseLayoutEffect(() => {\n\t\tif (open) {\n\t\t\tvoid update();\n\t\t}\n\t}, [open, positionUpdateKey, update]);\n\n\tconst hover = useHover(context, {\n\t\tenabled: openOnHover,\n\t\tmove: false,\n\t\tdelay: {\n\t\t\topen: openDelay,\n\t\t\tclose: closeDelay\n\t\t}\n\t});\n\t// Hover-подсказка обязана иметь ту же пассивную точку входа с клавиатуры.\n\t// Связываем focus с тем же флагом, чтобы `openOnHover={false}` не менял\n\t// управляемые сценарии, которые не запрашивали автоматическое открытие.\n\tconst focus = useFocus(context, { enabled: openOnHover });\n\tconst dismiss = useDismiss(context);\n\tconst role = useRole(context);\n\n\tconst { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role]);\n\n\treturn (\n\t\t<>\n\t\t\t<span ref={refs.setReference} {...getReferenceProps()} style={{ lineHeight: 1 }}>\n\t\t\t\t{children}\n\t\t\t</span>\n\n\t\t\t{open &&\n\t\t\t\tcreatePortal(\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={refs.setFloating}\n\t\t\t\t\t\tstyle={{ ...floatingStyles, zIndex: \"var(--z-tooltip)\", maxWidth: maxWidth ? `${maxWidth}em` : undefined }}\n\t\t\t\t\t\t{...getFloatingProps()}\n\t\t\t\t\t\trole=\"tooltip\"\n\t\t\t\t\t\tclassName={cn(styles.tooltipPanel, tooltip && styles.tooltip, state && styles[state])}>\n\t\t\t\t\t\t{content}\n\n\t\t\t\t\t\t<FloatingArrow ref={arrowRef} placement={computedPlacement} middlewareData={middlewareData} />\n\t\t\t\t\t</div>,\n\t\t\t\t\tdocument.body\n\t\t\t\t)}\n\t\t</>\n\t);\n};\n","import React, { useEffect, useRef } from \"react\";\n\nimport { arrow, flip, offset, shift, useFloating } from \"@floating-ui/react\";\n\nimport { FloatingArrow } from \"../floating-arrow/FloatingArrow\";\n\nimport styles from \"./Popover.module.scss\";\n\nexport const FloatingTooltip: React.FC<{\n\tx: number;\n\ty: number;\n\tchildren: React.ReactNode;\n}> = ({ x, y, children }) => {\n\tconst arrowRef = useRef<HTMLDivElement | null>(null);\n\n\tconst {\n\t\trefs,\n\t\tfloatingStyles,\n\t\tmiddlewareData,\n\t\tplacement: computedPlacement\n\t} = useFloating({\n\t\tstrategy: \"absolute\",\n\t\tplacement: \"top\",\n\t\t// eslint-disable-next-line react-hooks/refs\n\t\tmiddleware: [offset(6), flip(), shift({ padding: 16 }), arrow({ element: arrowRef })]\n\t});\n\n\tuseEffect(() => {\n\t\tif (refs.setReference) {\n\t\t\trefs.setReference({\n\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t({\n\t\t\t\t\t\tx,\n\t\t\t\t\t\ty,\n\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\ttop: y,\n\t\t\t\t\t\tleft: x,\n\t\t\t\t\t\tbottom: y,\n\t\t\t\t\t\tright: x,\n\t\t\t\t\t\ttoJSON: () => {}\n\t\t\t\t\t}) as DOMRect\n\t\t\t});\n\t\t}\n\t}, [x, y, refs]);\n\n\treturn (\n\t\t<div ref={refs.setFloating} style={{ ...floatingStyles, position: \"absolute\", pointerEvents: \"none\" }} className={styles.tooltip}>\n\t\t\t{children}\n\n\t\t\t<FloatingArrow ref={arrowRef} placement={computedPlacement} middlewareData={middlewareData} />\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;AAWA,SAAgB,EAA0B,EAAE,mBAAgB,oBAAiB,eAA8C;CAE1H,AADA,EAAS,MAAM,YAAY,6BAA6B,GAAG,KAAK,IAAI,GAAG,CAAc,EAAE,GAAG,GAC1F,EAAS,MAAM,YAAY,8BAA8B,GAAG,KAAK,IAAI,GAAG,CAAe,EAAE,GAAG;AAC7F;;;;;GECa,IAAiB,EAA0C,IAAI;AAE5E,SAAgB,IAAoB;CACnC,IAAM,IAAU,EAAW,CAAc;CACzC,IAAI,CAAC,GACJ,MAAM,EAA0B;EAC/B,UAAU;EACV,cAAc;CACf,CAAC;CAEF,OAAO;AACR;;;ACHA,IAAa,KAAiD,EAC7D,aACA,YACA,oBAAiB,IACjB,mBAAgB,IAChB,yBAAsB,IACtB,gBAAa,kBACR;CACL,IAAM,EAAE,SAAM,YAAS,SAAM,mBAAgB,mBAAgB,cAAW,gBAAa,EAAkB,GACjG,IAAqB,EAA8B,IAAI,GACv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AAC;GAAG,EAAM,EAAE,SAAS,EAAS,CAAC;EAAC;CACrF,CAAC;CAqBD,OAnBA,QAAgB;EACf,AAAI,EAAK,gBACR,EAAK,aAAa,EACjB,8BACE;GACA;GACA;GACA,OAAO;GACP,QAAQ;GACR,KAAK;GACL,MAAM;GACN,QAAQ;GACR,OAAO;GACP,cAAc,CAAC;EAChB,GACF,CAAC;CAEH,GAAG;EAAC;EAAG;EAAG;CAAI,CAAC,GAGd,kBAAC,OAAD;EAAK,KAAK,EAAK;EAAa,OAAO;GAAE,GAAG;GAAgB,UAAU;GAAY,eAAe;EAAO;EAAG,WAAW,EAAO;EAAzH,UAAA,CACE,GAED,kBAAC,GAAD;GAAe,KAAK;GAAU,WAAW;GAAmC;EAAiB,CAAA,CACzF;;AAEP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./ui.module-
|
|
1
|
+
import { t as e } from "./ui.module-oRwY3Zli.js";
|
|
2
2
|
import { createContext as t, useCallback as n, useContext as r, useId as i, useLayoutEffect as a, useMemo as o, useState as s } from "react";
|
|
3
3
|
import { cn as c, getRovingFocusTargetIndex as l, handleKeyboardActivation as u } from "@ryuzaki13/react-foundation-lib/utils";
|
|
4
4
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
@@ -130,4 +130,4 @@ g.Option = _;
|
|
|
130
130
|
//#endregion
|
|
131
131
|
export { g as n, _ as t };
|
|
132
132
|
|
|
133
|
-
//# sourceMappingURL=radio-group-
|
|
133
|
+
//# sourceMappingURL=radio-group-CRk_1ODZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group-CRk_1ODZ.js","names":[],"sources":["../../src/radio-group/RadioGroup.module.scss","../../src/radio-group/RadioGroup.tsx"],"sourcesContent":[".radioGroup {\n\tdisplay: flex;\n\talign-content: flex-start;\n\tflex-wrap: wrap;\n\t// min-height: var(--control-height);\n\theight: auto;\n\n\t&.noWrap {\n\t\tflex-wrap: nowrap;\n\t}\n\n\t&.horizontal {\n\t\tflex-direction: row;\n\t}\n\n\t&.vertical {\n\t\tflex-direction: column;\n\t\talign-content: stretch;\n\t}\n}\n\n.radioItem {\n\tflex: 1 0 0%;\n\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--space-sm);\n\n\tcolor: var(--content-2);\n\t// border: var(--border-width) solid transparent;\n\tborder-radius: var(--radius-xs);\n\tpadding: 0 var(--space-md);\n\tmargin: var(--border-width);\n\t// baseInputControl = --control-height, + borderTop/Bottom + transparentLineTop/Bottom\n\tmin-height: calc(var(--control-height) - calc(var(--border-width) * 4));\n\n\tcursor: pointer;\n\n\t&:hover {\n\t\tcolor: var(--content-1);\n\t\tbackground-color: var(--surface-2);\n\t\t// border-color: var(--border-1);\n\t}\n\n\t&.checked {\n\t\tcolor: var(--brand-on-fill);\n\t\tbackground-color: var(--brand-fill);\n\t\t// border-color: var(--border-0);\n\t}\n\n\t&:disabled {\n\t\topacity: var(--disabled-opacity);\n\t}\n}\n\n.radioItemContent {\n\tflex: 1 0 0%;\n\n\tdisplay: grid;\n\talign-content: center;\n\tgap: var(--space-sm);\n}\n\n.radioItemIcon {\n\tflex: 0 0 0%;\n\n\tsvg {\n\t\twidth: 1em;\n\t\theight: 1em;\n\t}\n}\n","import React, { createContext, KeyboardEvent, ReactNode, useCallback, useContext, useId, useLayoutEffect, useMemo, useState } from \"react\";\n\nimport { cn, getRovingFocusTargetIndex, handleKeyboardActivation } from \"@ryuzaki13/react-foundation-lib/utils\";\nimport { CheckCircleIcon } from \"lucide-react\";\n\nimport uiStyles from \"../ui.module.scss\";\n\nimport styles from \"./RadioGroup.module.scss\";\n\ninterface RadioGroupContextValue {\n\tvalue?: unknown;\n\tonChange?: (value: unknown) => void;\n\tdisabled?: boolean;\n\torientation: \"vertical\" | \"horizontal\";\n\tgroupId: string;\n\tlabelId?: string;\n\tdescriptionId?: string;\n\tfirstOptionId?: string;\n\tregisterOption: (optionId: string) => () => void;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\ninterface RadioGroupProps<T> {\n\tvalue?: T;\n\tonChange?: (value: T) => void;\n\tlabel?: string;\n\tdescription?: string;\n\tdisabled?: boolean;\n\tclassName?: string;\n\tnoWrap?: true;\n\torientation?: \"vertical\" | \"horizontal\";\n\t\"aria-label\"?: string;\n\tchildren: React.ReactNode;\n}\n\n/**\n * Группа радиокнопок с общим состоянием выбранного значения. Обеспечивает единый API выбора и контекст для дочерних опций.\n */\nexport function RadioGroup<T>({\n\tvalue,\n\tonChange,\n\tlabel,\n\tdescription,\n\tdisabled,\n\tclassName,\n\tnoWrap,\n\torientation = \"horizontal\",\n\t\"aria-label\": ariaLabel,\n\tchildren\n}: RadioGroupProps<T>) {\n\tconst groupId = useId();\n\tconst labelId = label ? `${groupId}-label` : undefined;\n\tconst descriptionId = description ? `${groupId}-description` : undefined;\n\tconst [registeredOptionIds, setRegisteredOptionIds] = useState<string[]>([]);\n\tconst handleChange = useCallback((nextValue: unknown) => onChange?.(nextValue as T), [onChange]);\n\n\t/**\n\t * Хранит порядок опций внутри группы, чтобы при отсутствии выбранного значения\n\t * оставлять ровно один tab stop на первой доступной радиокнопке.\n\t */\n\tconst registerOption = useCallback((optionId: string) => {\n\t\tsetRegisteredOptionIds((currentIds) => (currentIds.includes(optionId) ? currentIds : [...currentIds, optionId]));\n\n\t\treturn () => {\n\t\t\tsetRegisteredOptionIds((currentIds) => currentIds.filter((currentId) => currentId !== optionId));\n\t\t};\n\t}, []);\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tonChange: handleChange,\n\t\t\tdisabled,\n\t\t\torientation,\n\t\t\tgroupId,\n\t\t\tlabelId,\n\t\t\tdescriptionId,\n\t\t\tfirstOptionId: registeredOptionIds[0],\n\t\t\tregisterOption\n\t\t}),\n\t\t[descriptionId, disabled, groupId, handleChange, labelId, orientation, registerOption, registeredOptionIds, value]\n\t);\n\n\treturn (\n\t\t<div className={cn(uiStyles.uiElement, disabled && uiStyles.disabled, className)}>\n\t\t\t{label && (\n\t\t\t\t<div id={labelId} className={uiStyles.uiLabel}>\n\t\t\t\t\t{label}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{description && (\n\t\t\t\t<div id={descriptionId} className={uiStyles.uiDescription}>\n\t\t\t\t\t{description}\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t<RadioGroupContext.Provider value={contextValue}>\n\t\t\t\t<div\n\t\t\t\t\trole=\"radiogroup\"\n\t\t\t\t\taria-labelledby={labelId}\n\t\t\t\t\taria-label={labelId ? undefined : ariaLabel}\n\t\t\t\t\taria-describedby={descriptionId}\n\t\t\t\t\taria-disabled={disabled || undefined}\n\t\t\t\t\tdata-disabled={disabled || undefined}\n\t\t\t\t\tclassName={cn(uiStyles.uiInputControl, styles.radioGroup, noWrap && styles.noWrap, styles[orientation])}>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</RadioGroupContext.Provider>\n\t\t</div>\n\t);\n}\n\ninterface OptionProps<T> {\n\tvalue: T;\n\tlabel: ReactNode;\n\tdescription?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Опция внутри `RadioGroup`, представляющая одно выбираемое значение. Отрисовывает подпись, описание и состояние выбора.\n */\nexport function Option<T>({ value, label, description, className }: OptionProps<T>) {\n\tconst context = useContext(RadioGroupContext);\n\tconst optionId = useId();\n\tconst registerOption = context?.registerOption;\n\n\tuseLayoutEffect(() => {\n\t\tif (!registerOption) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn registerOption(optionId);\n\t}, [registerOption, optionId]);\n\n\tif (!context) {\n\t\treturn (\n\t\t\t<div className={cn(styles.radioItem, className)}>\n\t\t\t\t<p className=\"textNoWrap\">{label}</p>\n\t\t\t\t{description && <div className=\"fontSizeSm content2\">{description}</div>}\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isChecked = Object.is(context.value, value);\n\tconst isDisabled = context.disabled === true;\n\tconst isFallbackTabStop = context.value === undefined && context.firstOptionId === optionId;\n\n\tconst handleChange = () => {\n\t\tif (isDisabled || isChecked) {\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.onChange?.(value);\n\t};\n\n\t// TODO: логика переиспользуемая, надо вынести в хук\n\tconst handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n\t\tif (isDisabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (handleKeyboardActivation(event, handleChange)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentTarget = event.currentTarget;\n\t\tconst groupElement = currentTarget.closest<HTMLElement>('[role=\"radiogroup\"]');\n\t\tconst radioItems = Array.from(groupElement?.querySelectorAll<HTMLButtonElement>('[role=\"radio\"]:not([disabled])') ?? []);\n\n\t\tif (!radioItems.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentIndex = radioItems.indexOf(currentTarget);\n\t\tif (currentIndex === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextIndex = getRovingFocusTargetIndex({\n\t\t\tcurrentIndex,\n\t\t\titemCount: radioItems.length,\n\t\t\tkey: event.key,\n\t\t\torientation: context.orientation\n\t\t});\n\n\t\tif (nextIndex === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\t\tradioItems[nextIndex]?.focus();\n\t\tradioItems[nextIndex]?.click();\n\t};\n\n\treturn (\n\t\t<button\n\t\t\tid={`${context.groupId}-option-${optionId}`}\n\t\t\ttype=\"button\"\n\t\t\trole=\"radio\"\n\t\t\taria-checked={isChecked}\n\t\t\tdisabled={isDisabled}\n\t\t\ttabIndex={isChecked || isFallbackTabStop ? 0 : -1}\n\t\t\tclassName={cn(styles.radioItem, isChecked && styles.checked, className)}\n\t\t\tdata-ui=\"radio-option\"\n\t\t\tdata-action=\"select-radio-option\"\n\t\t\tonClick={handleChange}\n\t\t\tonKeyDown={handleKeyDown}>\n\t\t\t<span className={styles.radioItemContent}>\n\t\t\t\t<span className=\"textNoWrap\">{label}</span>\n\t\t\t\t{description && <span className=\"fontSizeSm\">{description}</span>}\n\t\t\t</span>\n\t\t\t<span className={styles.radioItemIcon}>\n\t\t\t\t<CheckCircleIcon style={{ display: \"block\", visibility: isChecked ? \"visible\" : \"hidden\" }} />\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nRadioGroup.Option = Option;\n"],"mappings":";;;;;;;;;;;;;;GCqBM,IAAoB,EAA6C,IAAI;AAkB3E,SAAgB,EAAc,EAC7B,UACA,aACA,UACA,gBACA,aACA,cACA,WACA,iBAAc,cACd,cAAc,GACd,eACsB;CACtB,IAAM,IAAU,EAAM,GAChB,IAAU,IAAQ,GAAG,EAAQ,UAAU,KAAA,GACvC,IAAgB,IAAc,GAAG,EAAQ,gBAAgB,KAAA,GACzD,CAAC,GAAqB,KAA0B,EAAmB,CAAC,CAAC,GACrE,IAAe,GAAa,MAAuB,IAAW,CAAc,GAAG,CAAC,CAAQ,CAAC,GAMzF,IAAiB,GAAa,OACnC,GAAwB,MAAgB,EAAW,SAAS,CAAQ,IAAI,IAAa,CAAC,GAAG,GAAY,CAAQ,CAAE,SAElG;EACZ,GAAwB,MAAe,EAAW,QAAQ,MAAc,MAAc,CAAQ,CAAC;CAChG,IACE,CAAC,CAAC,GAEC,IAAe,SACb;EACN;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA,eAAe,EAAoB;EACnC;CACD,IACA;EAAC;EAAe;EAAU;EAAS;EAAc;EAAS;EAAa;EAAgB;EAAqB;CAAK,CAClH;CAEA,OACC,kBAAC,OAAD;EAAK,WAAW,EAAG,EAAS,WAAW,KAAY,EAAS,UAAU,CAAS;EAA/E,UAAA;GACE,KACA,kBAAC,OAAD;IAAK,IAAI;IAAS,WAAW,EAAS;IACpC,UAAA;GACG,CAAA;GAEL,KACA,kBAAC,OAAD;IAAK,IAAI;IAAe,WAAW,EAAS;IAC1C,UAAA;GACG,CAAA;GAGN,kBAAC,EAAkB,UAAnB;IAA4B,OAAO;IAClC,UAAA,kBAAC,OAAD;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AAc,iBAAoC,kCAAgC,KAAK,CAAC,CAAC;GAEvH,IAAI,CAAC,EAAW,QACf;GAGD,IAAM,IAAe,EAAW,QAAQ,CAAa;GACrD,IAAI,MAAiB,IACpB;GAGD,IAAM,IAAY,EAA0B;IAC3C;IACA,WAAW,EAAW;IACtB,KAAK,EAAM;IACX,aAAa,EAAQ;GACtB,CAAC;GAEG,MAAc,SAIlB,EAAM,eAAe,GACrB,EAAW,EAAU,EAAE,MAAM,GAC7B,EAAW,EAAU,EAAE,MAAM;EAC9B;EAGC,UAAA,CAYC,kBAAC,QAAD;GAAM,WAAW,EAAO;GAAxB,UAAA,CACC,kBAAC,QAAD;IAAM,WAAU;IAAc,UAAA;GAAY,CAAA,GACzC,KAAe,kBAAC,QAAD;IAAM,WAAU;IAAc,UAAA;GAAkB,CAAA,CAC3D;EACN,CAAA,GAAA,kBAAC,QAAD;GAAM,WAAW,EAAO;GACvB,UAAA,kBAAC,GAAD,EAAiB,OAAO;IAAE,SAAS;IAAS,YAAY,IAAY,YAAY;GAAS,EAAI,CAAA;EACxF,CAAA,CACC;;AAEV;AAEA,EAAW,SAAS"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./ui.module-
|
|
1
|
+
import { t as e } from "./ui.module-oRwY3Zli.js";
|
|
2
2
|
import { HighlightText as t } from "../text/index.js";
|
|
3
|
-
import { u as n } from "./input-
|
|
3
|
+
import { u as n } from "./input-DSPKgiCK.js";
|
|
4
4
|
import { CustomOptionButton as r, Option as i, OptionButton as a, OptionCode as o, OptionText as s } from "../option/index.js";
|
|
5
|
-
import { a as c, f as l, i as u, m as d, r as f, s as p, t as m, u as ee, v as te } from "./picker-
|
|
5
|
+
import { a as c, f as l, i as u, m as d, r as f, s as p, t as m, u as ee, v as te } from "./picker-lvm82d0A.js";
|
|
6
6
|
import { t as h } from "./odata-dependent-C_DCbKY2.js";
|
|
7
7
|
import { n as g } from "./useODataSelectBase-DR4PrY1j.js";
|
|
8
8
|
import { Fragment as ne, useCallback as _, useMemo as v, useRef as re, useState as ie } from "react";
|
|
@@ -360,4 +360,4 @@ function N({ label: e, description: t, disabled: n, placeholder: r, size: i, opt
|
|
|
360
360
|
//#endregion
|
|
361
361
|
export { w as a, E as i, A as n, k as r, N as t };
|
|
362
362
|
|
|
363
|
-
//# sourceMappingURL=select-
|
|
363
|
+
//# sourceMappingURL=select-aTGupQan.js.map
|