@keboola/design 14.0.0 → 15.0.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/AGENTS.md +11 -23
- package/CHANGELOG.md +33 -0
- package/COMPONENT-API.md +109 -115
- package/dist/{AIKit-BRSZ3nY7.js → AIKit-CaAW4GLx.js} +13 -18
- package/dist/AIKit-CaAW4GLx.js.map +1 -0
- package/dist/{Alert-CZ0dDsuk.js → Alert-Chz6KZ7e.js} +11 -20
- package/dist/Alert-Chz6KZ7e.js.map +1 -0
- package/dist/{AlertModal-BDle9ZVQ.js → AlertModal-D4AtpvLS.js} +15 -35
- package/dist/AlertModal-D4AtpvLS.js.map +1 -0
- package/dist/{AppShell-B03fj1j7.js → AppShell-C8V1KRr_.js} +2 -2
- package/dist/{AppShell-B03fj1j7.js.map → AppShell-C8V1KRr_.js.map} +1 -1
- package/dist/{AutoSaveTextarea-jiqNeeE4.js → AutoSaveTextarea-BbMhC5Aq.js} +3 -3
- package/dist/AutoSaveTextarea-BbMhC5Aq.js.map +1 -0
- package/dist/{Badge-Ba3epgcI.js → Badge-5GHIsgRS.js} +14 -3
- package/dist/Badge-5GHIsgRS.js.map +1 -0
- package/dist/{BrandEditor-CN2HJ_12.js → BrandEditor-CTGtQUFZ.js} +7 -9
- package/dist/BrandEditor-CTGtQUFZ.js.map +1 -0
- package/dist/{BrandLogo-BfITD0im.js → BrandLogo-DkESE19K.js} +2 -2
- package/dist/{BrandLogo-BfITD0im.js.map → BrandLogo-DkESE19K.js.map} +1 -1
- package/dist/{Breadcrumb-BnIlsoIH.js → Breadcrumb-B2YSNON4.js} +4 -4
- package/dist/{Breadcrumb-BnIlsoIH.js.map → Breadcrumb-B2YSNON4.js.map} +1 -1
- package/dist/{Button-D2JqBAq7.js → Button-BNkyYU8u.js} +9 -185
- package/dist/Button-BNkyYU8u.js.map +1 -0
- package/dist/{Card-Bpc_ZlL4.js → Card-DxjGiqH8.js} +11 -18
- package/dist/Card-DxjGiqH8.js.map +1 -0
- package/dist/{Checkbox-uFE8XLT_.js → Checkbox-CHDDJyAA.js} +20 -45
- package/dist/Checkbox-CHDDJyAA.js.map +1 -0
- package/dist/{Clipboard-D-9XOqy4.js → Clipboard-DlwVZS1P.js} +2 -2
- package/dist/{Clipboard-D-9XOqy4.js.map → Clipboard-DlwVZS1P.js.map} +1 -1
- package/dist/{ClipboardButton-DxvZG_H0.js → ClipboardButton-B1Hr_n_Z.js} +3 -3
- package/dist/{ClipboardButton-DxvZG_H0.js.map → ClipboardButton-B1Hr_n_Z.js.map} +1 -1
- package/dist/{CodeEditor-BfRSCKEs.js → CodeEditor-DVSPdfdo.js} +24 -31
- package/dist/CodeEditor-DVSPdfdo.js.map +1 -0
- package/dist/{ColorInput-CDKH8q_f.js → ColorInput-B_eZIu39.js} +5 -7
- package/dist/ColorInput-B_eZIu39.js.map +1 -0
- package/dist/{ColorModeSwitch-DR6J2U6M.js → ColorModeSwitch-B6UEzG0H.js} +3 -3
- package/dist/{ColorModeSwitch-DR6J2U6M.js.map → ColorModeSwitch-B6UEzG0H.js.map} +1 -1
- package/dist/{Combobox-CEesMe2M.js → Combobox-CaKqgstG.js} +15 -23
- package/dist/Combobox-CaKqgstG.js.map +1 -0
- package/dist/{Command-T3MLRaen.js → Command-DhXmqFLT.js} +46 -32
- package/dist/Command-DhXmqFLT.js.map +1 -0
- package/dist/{CopyField-CNbCHw9a.js → CopyField-D0Pg4Z0R.js} +2 -2
- package/dist/{CopyField-CNbCHw9a.js.map → CopyField-D0Pg4Z0R.js.map} +1 -1
- package/dist/{DateInput-ClK1lCxz.js → DateInput-BgbMDJkm.js} +5 -7
- package/dist/DateInput-BgbMDJkm.js.map +1 -0
- package/dist/{DatePicker-CgHAu9KX.js → DatePicker-BXpDRo-R.js} +2 -2
- package/dist/{DatePicker-CgHAu9KX.js.map → DatePicker-BXpDRo-R.js.map} +1 -1
- package/dist/{DateRangeInput-DtlAffS1.js → DateRangeInput-BW0-_jV0.js} +5 -7
- package/dist/DateRangeInput-BW0-_jV0.js.map +1 -0
- package/dist/{DateRangePicker-CXpXPMoh.js → DateRangePicker-C4-DoWac.js} +7 -12
- package/dist/DateRangePicker-C4-DoWac.js.map +1 -0
- package/dist/{DropdownMenu-B1gGvZoh.js → DropdownMenu-CcVbZ_5u.js} +35 -64
- package/dist/DropdownMenu-CcVbZ_5u.js.map +1 -0
- package/dist/{FieldItem-CYvJyjiI.js → FieldItem-BHUqgSO1.js} +3 -3
- package/dist/{FieldItem-CYvJyjiI.js.map → FieldItem-BHUqgSO1.js.map} +1 -1
- package/dist/{FileUpload-D6vPG3WB.js → FileUpload-BYFONpEl.js} +3 -3
- package/dist/FileUpload-BYFONpEl.js.map +1 -0
- package/dist/{Form-CD55zJiy.js → Form-CAofWyMI.js} +8 -8
- package/dist/{Form-CD55zJiy.js.map → Form-CAofWyMI.js.map} +1 -1
- package/dist/{FormGroup-DiYFdEhH.js → FormGroup-V5kIgQRN.js} +3 -3
- package/dist/{FormGroup-DiYFdEhH.js.map → FormGroup-V5kIgQRN.js.map} +1 -1
- package/dist/{FullScreenModal-CUuAakh3.js → FullScreenModal-DAvvlGOz.js} +2 -5
- package/dist/FullScreenModal-DAvvlGOz.js.map +1 -0
- package/dist/HoverCard-Cv5rmvJq.js +26 -0
- package/dist/HoverCard-Cv5rmvJq.js.map +1 -0
- package/dist/{InlineEdit-D5RdunZo.js → InlineEdit-D4P0SvCB.js} +5 -9
- package/dist/InlineEdit-D4P0SvCB.js.map +1 -0
- package/dist/{InputGroup-Dm014ruw.js → InputGroup-CZv_7QlM.js} +39 -146
- package/dist/InputGroup-CZv_7QlM.js.map +1 -0
- package/dist/{Kbd-3YM7NQO4.js → Kbd-CflKthfu.js} +5 -14
- package/dist/Kbd-CflKthfu.js.map +1 -0
- package/dist/{MermaidDiagram-CeiOkI60.js → MermaidDiagram-Te-5gOCU.js} +4 -4
- package/dist/{MermaidDiagram-CeiOkI60.js.map → MermaidDiagram-Te-5gOCU.js.map} +1 -1
- package/dist/{Modal-DMZRswk4.js → Modal-CbUz-5YH.js} +17 -36
- package/dist/Modal-CbUz-5YH.js.map +1 -0
- package/dist/{ModalTitle-CTECVgL8.js → ModalTitle-cy0Ht9VY.js} +2 -2
- package/dist/{ModalTitle-CTECVgL8.js.map → ModalTitle-cy0Ht9VY.js.map} +1 -1
- package/dist/{MultiActionButtonGroup-CEv_txvz.js → MultiActionButtonGroup-Dzig87s1.js} +3 -3
- package/dist/{MultiActionButtonGroup-CEv_txvz.js.map → MultiActionButtonGroup-Dzig87s1.js.map} +1 -1
- package/dist/{Navbar-CtVYcRFn.js → Navbar-DHUS7XiU.js} +2 -2
- package/dist/{Navbar-CtVYcRFn.js.map → Navbar-DHUS7XiU.js.map} +1 -1
- package/dist/OtpInput-CY8yCaJk.js.map +1 -1
- package/dist/{PageToolbar-B_e7HGva.js → PageToolbar-DJ5tdYla.js} +4 -4
- package/dist/{PageToolbar-B_e7HGva.js.map → PageToolbar-DJ5tdYla.js.map} +1 -1
- package/dist/{Pagination-DDp6PRqf.js → Pagination-D27x5KmH.js} +2 -2
- package/dist/{Pagination-DDp6PRqf.js.map → Pagination-D27x5KmH.js.map} +1 -1
- package/dist/{Popconfirm-BgV6a0sl.js → Popconfirm-DwLCYNaF.js} +3 -3
- package/dist/{Popconfirm-BgV6a0sl.js.map → Popconfirm-DwLCYNaF.js.map} +1 -1
- package/dist/{Popover-BU7nGOv-.js → Popover-DtUDwUVO.js} +24 -37
- package/dist/Popover-DtUDwUVO.js.map +1 -0
- package/dist/{RadioGroup-C8EC3fqO.js → RadioGroup-B0TwHjBb.js} +9 -13
- package/dist/RadioGroup-B0TwHjBb.js.map +1 -0
- package/dist/{Search-aaUMI4ix.js → Search-vyZwGKMU.js} +3 -3
- package/dist/{Search-aaUMI4ix.js.map → Search-vyZwGKMU.js.map} +1 -1
- package/dist/{SearchInput-Dxi2GK4n.js → SearchInput-DyYXyw3u.js} +4 -6
- package/dist/SearchInput-DyYXyw3u.js.map +1 -0
- package/dist/{SectionNav-BnHOMLtE.js → SectionNav-tLK3iF6c.js} +5 -5
- package/dist/{SectionNav-BnHOMLtE.js.map → SectionNav-tLK3iF6c.js.map} +1 -1
- package/dist/{Select-CjQgU_6K.js → Select-B22hB_-w.js} +11 -25
- package/dist/Select-B22hB_-w.js.map +1 -0
- package/dist/{Sheet-utw4_rUa.js → Sheet-0TWKTqid.js} +12 -15
- package/dist/Sheet-0TWKTqid.js.map +1 -0
- package/dist/{Sidebar-BAmux2Uj.js → Sidebar-C5hdANBU.js} +11 -11
- package/dist/Sidebar-C5hdANBU.js.map +1 -0
- package/dist/{Slider-DbzzSDRV.js → Slider-DrcsM8_G.js} +4 -4
- package/dist/Slider-DrcsM8_G.js.map +1 -0
- package/dist/{Stepper-BBPembeK.js → Stepper-CQrUPVFL.js} +2 -2
- package/dist/Stepper-CQrUPVFL.js.map +1 -0
- package/dist/Switch-DccpSpzC.js +66 -0
- package/dist/Switch-DccpSpzC.js.map +1 -0
- package/dist/{Tabs-C0uvkPHc.js → Tabs-Ck4uWf8U.js} +2 -2
- package/dist/{Tabs-C0uvkPHc.js.map → Tabs-Ck4uWf8U.js.map} +1 -1
- package/dist/{TextInput-K2DSDs5O.js → TextInput-CR0_USaY.js} +4 -7
- package/dist/TextInput-CR0_USaY.js.map +1 -0
- package/dist/{ThemeProvider-C8yaKlM1.js → ThemeProvider-BTK7AL-T.js} +21 -8
- package/dist/ThemeProvider-BTK7AL-T.js.map +1 -0
- package/dist/{TimePicker-DyyV3nw8.js → TimePicker-CoRpiEM3.js} +2 -2
- package/dist/{TimePicker-DyyV3nw8.js.map → TimePicker-CoRpiEM3.js.map} +1 -1
- package/dist/{Toast-BGnUL4jV.js → Toast-937n7n8i.js} +2 -2
- package/dist/{Toast-BGnUL4jV.js.map → Toast-937n7n8i.js.map} +1 -1
- package/dist/{ToggleAllTooltip-Dlmq-yqS.js → ToggleAllTooltip-DEjbWFoj.js} +2 -2
- package/dist/{ToggleAllTooltip-Dlmq-yqS.js.map → ToggleAllTooltip-DEjbWFoj.js.map} +1 -1
- package/dist/{ZoomableSvg-Dh1OstPN.js → ZoomableSvg-DnFXo2L4.js} +4 -4
- package/dist/{ZoomableSvg-Dh1OstPN.js.map → ZoomableSvg-DnFXo2L4.js.map} +1 -1
- package/dist/editors.js +4 -4
- package/dist/flint.js +4 -4
- package/dist/index.d.ts +72 -118
- package/dist/index.js +60 -61
- package/dist/internal/blocks/AIKit.js +1 -1
- package/dist/internal/blocks/AppShell.js +1 -1
- package/dist/internal/blocks/AuthLayout.js +1 -1
- package/dist/internal/blocks/AutoSaveTextarea.js +1 -1
- package/dist/internal/blocks/BrandEditor.js +1 -1
- package/dist/internal/blocks/ChartPanel.js +1 -1
- package/dist/internal/blocks/ChipEditor.js +5 -9
- package/dist/internal/blocks/ChipEditor.js.map +1 -1
- package/dist/internal/blocks/ClipboardButton.js +1 -1
- package/dist/internal/blocks/ColorInput.js +1 -1
- package/dist/internal/blocks/ColorModeSwitch.js +1 -1
- package/dist/internal/blocks/Command.js +1 -1
- package/dist/internal/blocks/CopyField.js +1 -1
- package/dist/internal/blocks/DateInput.js +1 -1
- package/dist/internal/blocks/DateRangeInput.js +1 -1
- package/dist/internal/blocks/EmptyConfigurationActionCard.js +1 -1
- package/dist/internal/blocks/ErrorState.js +18 -29
- package/dist/internal/blocks/ErrorState.js.map +1 -1
- package/dist/internal/blocks/ExportMenu.js +3 -3
- package/dist/internal/blocks/ExportMenu.js.map +1 -1
- package/dist/internal/blocks/Form/connectors/ComboboxField.js +2 -2
- package/dist/internal/blocks/Form/connectors/MultiComboboxField.js +1 -1
- package/dist/internal/blocks/Form.js +1 -1
- package/dist/internal/blocks/FormGroup.js +1 -1
- package/dist/internal/blocks/InlineEdit.js +1 -1
- package/dist/internal/blocks/MultiActionButtonGroup.js +1 -1
- package/dist/internal/blocks/MultiCombobox.js +5 -9
- package/dist/internal/blocks/MultiCombobox.js.map +1 -1
- package/dist/internal/blocks/NumberInput.js +2 -4
- package/dist/internal/blocks/NumberInput.js.map +1 -1
- package/dist/internal/blocks/PageToolbar.js +1 -1
- package/dist/internal/blocks/PasswordInput.js +3 -5
- package/dist/internal/blocks/PasswordInput.js.map +1 -1
- package/dist/internal/blocks/SearchInput.js +1 -1
- package/dist/internal/blocks/SearchInputWithNavigation.js +6 -7
- package/dist/internal/blocks/SearchInputWithNavigation.js.map +1 -1
- package/dist/internal/blocks/SectionNav.js +1 -1
- package/dist/internal/blocks/SplitButton.js +2 -2
- package/dist/internal/blocks/StatCard.js +1 -1
- package/dist/internal/blocks/TextInput.js +1 -1
- package/dist/internal/blocks/Textarea.js +3 -8
- package/dist/internal/blocks/Textarea.js.map +1 -1
- package/dist/internal/blocks/TimeInput.js +4 -6
- package/dist/internal/blocks/TimeInput.js.map +1 -1
- package/dist/internal/components/Alert.js +1 -1
- package/dist/internal/components/AlertModal.js +1 -1
- package/dist/internal/components/Avatar.js +1 -1
- package/dist/internal/components/Badge.js +1 -1
- package/dist/internal/components/BrandLogo.js +1 -1
- package/dist/internal/components/Breadcrumb.js +1 -1
- package/dist/internal/components/Button.js +2 -2
- package/dist/internal/components/ButtonGroup.js +1 -1
- package/dist/internal/components/ButtonGroup.js.map +1 -1
- package/dist/internal/components/Card.js +1 -1
- package/dist/internal/components/Checkbox.js +1 -1
- package/dist/internal/components/Clipboard.js +1 -1
- package/dist/internal/components/CollapsiblePanel.js +1 -1
- package/dist/internal/components/Combobox.js +1 -1
- package/dist/internal/components/DatePicker.js +1 -1
- package/dist/internal/components/DateRangePicker.js +1 -1
- package/dist/internal/components/DropdownMenu.js +1 -1
- package/dist/internal/components/FileUpload.js +1 -1
- package/dist/internal/components/FullScreenModal.js +1 -1
- package/dist/internal/components/HoverCard.js +1 -1
- package/dist/internal/components/InputGroup.js +1 -1
- package/dist/internal/components/Kbd.js +1 -1
- package/dist/internal/components/Modal.js +1 -1
- package/dist/internal/components/Navbar.js +1 -1
- package/dist/internal/components/Pagination.js +1 -1
- package/dist/internal/components/Popconfirm.js +1 -1
- package/dist/internal/components/Popover.js +1 -1
- package/dist/internal/components/RadioGroup.js +1 -1
- package/dist/internal/components/Search.js +1 -1
- package/dist/internal/components/Select.js +1 -1
- package/dist/internal/components/Sheet.js +1 -1
- package/dist/internal/components/Sidebar.js +1 -1
- package/dist/internal/components/Skeleton/Skeleton.js +1 -1
- package/dist/internal/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/internal/components/Slider.js +1 -1
- package/dist/internal/components/Stepper.js +1 -1
- package/dist/internal/components/Switch.js +1 -1
- package/dist/internal/components/Tabs.js +1 -1
- package/dist/internal/components/ThemeProvider.js +3 -4
- package/dist/internal/components/TimePicker.js +1 -1
- package/dist/internal/components/Toast.js +2 -2
- package/dist/internal/components/Toggle.js +13 -3
- package/dist/internal/components/Toggle.js.map +1 -1
- package/dist/internal/components/Tooltip.js +1 -1
- package/dist/internal/components/Truncated.js +1 -1
- package/dist/internal/components/ZoomableSvg.js +1 -1
- package/dist/internal/utils.js +1 -1
- package/dist/markdown-editor.js +16 -18
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mermaid.js +1 -1
- package/dist/rjsf.js +33 -42
- package/dist/rjsf.js.map +1 -1
- package/dist/styles-DxazJ8Mz.js +81 -0
- package/dist/styles-DxazJ8Mz.js.map +1 -0
- package/dist/styles-T8xwr0sR.js +73 -0
- package/dist/styles-T8xwr0sR.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/testing.d.ts +0 -2
- package/dist/testing.js +3 -10
- package/dist/testing.js.map +1 -1
- package/dist/{useColorSchemeState-Cw4MCXUs.js → themeScopeContext-CEVXbYvZ.js} +43 -15
- package/dist/themeScopeContext-CEVXbYvZ.js.map +1 -0
- package/dist/{useThemeAttributes-B199Regy.js → themeTokens-DCeb62ap.js} +22 -4
- package/dist/themeTokens-DCeb62ap.js.map +1 -0
- package/dist/{toast-D6Z6MOB5.js → toast-Y3cTMBW8.js} +7 -10
- package/dist/toast-Y3cTMBW8.js.map +1 -0
- package/dist/{utils-LQ4jJA-9.js → utils-DwC9u0tM.js} +26 -52
- package/dist/utils-DwC9u0tM.js.map +1 -0
- package/dist/vega.js +2 -2
- package/dist/{vegaTheme-BrmVoPEz.js → vegaTheme-ISwGXvof.js} +2 -2
- package/dist/{vegaTheme-BrmVoPEz.js.map → vegaTheme-ISwGXvof.js.map} +1 -1
- package/dist/{vegaTokens-Ce07C0DH.js → vegaTokens-DCkvpIVE.js} +2 -2
- package/dist/{vegaTokens-Ce07C0DH.js.map → vegaTokens-DCkvpIVE.js.map} +1 -1
- package/package.json +2 -2
- package/src/styles.css +0 -35
- package/src/theme.css +42 -0
- package/dist/AIKit-BRSZ3nY7.js.map +0 -1
- package/dist/Alert-CZ0dDsuk.js.map +0 -1
- package/dist/AlertModal-BDle9ZVQ.js.map +0 -1
- package/dist/AutoSaveTextarea-jiqNeeE4.js.map +0 -1
- package/dist/Badge-Ba3epgcI.js.map +0 -1
- package/dist/BrandEditor-CN2HJ_12.js.map +0 -1
- package/dist/Button-D2JqBAq7.js.map +0 -1
- package/dist/Card-Bpc_ZlL4.js.map +0 -1
- package/dist/Checkbox-uFE8XLT_.js.map +0 -1
- package/dist/CodeEditor-BfRSCKEs.js.map +0 -1
- package/dist/ColorInput-CDKH8q_f.js.map +0 -1
- package/dist/Combobox-CEesMe2M.js.map +0 -1
- package/dist/Command-T3MLRaen.js.map +0 -1
- package/dist/DateInput-ClK1lCxz.js.map +0 -1
- package/dist/DateRangeInput-DtlAffS1.js.map +0 -1
- package/dist/DateRangePicker-CXpXPMoh.js.map +0 -1
- package/dist/DropdownMenu-B1gGvZoh.js.map +0 -1
- package/dist/FileUpload-D6vPG3WB.js.map +0 -1
- package/dist/FullScreenModal-CUuAakh3.js.map +0 -1
- package/dist/HoverCard-BBdPYqEf.js +0 -31
- package/dist/HoverCard-BBdPYqEf.js.map +0 -1
- package/dist/InlineEdit-D5RdunZo.js.map +0 -1
- package/dist/InputGroup-Dm014ruw.js.map +0 -1
- package/dist/Kbd-3YM7NQO4.js.map +0 -1
- package/dist/Modal-DMZRswk4.js.map +0 -1
- package/dist/Popover-BU7nGOv-.js.map +0 -1
- package/dist/RadioGroup-C8EC3fqO.js.map +0 -1
- package/dist/SearchInput-Dxi2GK4n.js.map +0 -1
- package/dist/Select-CjQgU_6K.js.map +0 -1
- package/dist/Sheet-utw4_rUa.js.map +0 -1
- package/dist/Sidebar-BAmux2Uj.js.map +0 -1
- package/dist/Slider-DbzzSDRV.js.map +0 -1
- package/dist/Stepper-BBPembeK.js.map +0 -1
- package/dist/Switch-Dw4tvQls.js +0 -201
- package/dist/Switch-Dw4tvQls.js.map +0 -1
- package/dist/TextInput-K2DSDs5O.js.map +0 -1
- package/dist/ThemeProvider-C8yaKlM1.js.map +0 -1
- package/dist/context-U293r3v-.js +0 -29
- package/dist/context-U293r3v-.js.map +0 -1
- package/dist/defaults-i_xG2F_1.js +0 -32
- package/dist/defaults-i_xG2F_1.js.map +0 -1
- package/dist/styles-BDA5rQz3.js +0 -127
- package/dist/styles-BDA5rQz3.js.map +0 -1
- package/dist/styles-YQdM7G8c.js +0 -159
- package/dist/styles-YQdM7G8c.js.map +0 -1
- package/dist/themeTokens-l2Fsfcs7.js +0 -22
- package/dist/themeTokens-l2Fsfcs7.js.map +0 -1
- package/dist/toast-D6Z6MOB5.js.map +0 -1
- package/dist/useColorSchemeState-Cw4MCXUs.js.map +0 -1
- package/dist/useThemeAttributes-B199Regy.js.map +0 -1
- package/dist/utils-LQ4jJA-9.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputGroup-CZv_7QlM.js","names":[],"sources":["../src/components/InputGroup/InputGroupAddon.tsx","../src/components/InputGroup/InputGroupButton.tsx","../src/components/InputGroup/InputGroupInput.tsx","../src/components/InputGroup/InputGroupText.tsx","../src/components/InputGroup/InputGroupTextArea.tsx","../src/components/InputGroup/InputGroup.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../utils';\n\n// Padding only fires when the addon actually has content — keeps an empty\n// `<Addon>{maybeNull}</Addon>` from carving 16px out of the input row.\nconst addonVariants = cva(\n [\n 'tw:flex',\n 'tw:items-center',\n 'tw:gap-1',\n\n // Default size for nested Lucide icons in prefix/suffix slots; callers can override on the icon.\n \"tw:[&_svg.lucide:not([class*='tw:size-'])]:size-4\",\n 'tw:[&_svg]:shrink-0',\n ],\n {\n defaultVariants: {\n align: 'inline-start',\n },\n variants: {\n align: {\n 'inline-start': ['tw:order-first', 'tw:shrink-0', 'tw:[&:not(:empty)]:pl-4'],\n 'inline-end': ['tw:order-last', 'tw:shrink-0', 'tw:[&:not(:empty)]:pr-4'],\n 'block-start': [\n 'tw:order-first',\n // `tw:w-full` needs to be empty-conditional too — when the addon\n // has no content the root stays in flex-row, and a 100%-wide\n // empty addon would claim half of the input row beside the input.\n 'tw:[&:not(:empty)]:w-full',\n 'tw:[&:not(:empty)]:px-4',\n 'tw:[&:not(:empty)]:py-1.5',\n ],\n 'block-end': [\n 'tw:order-last',\n 'tw:[&:not(:empty)]:w-full',\n 'tw:[&:not(:empty)]:px-4',\n 'tw:[&:not(:empty)]:py-1.5',\n ],\n },\n },\n },\n);\n\ntype Props = ComponentProps<'div'> & VariantProps<typeof addonVariants>;\n\nexport const InputGroupAddon = ({\n children,\n align = 'inline-start',\n className,\n ...props\n}: Props) => (\n <div {...props} data-align={align} className={cn(addonVariants({ align, className }))}>\n {children}\n </div>\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\nimport { Button } from '../Button';\n\ntype ButtonProps = ComponentProps<typeof Button>;\n\ntype Props = Omit<ButtonProps, 'size' | 'block' | 'variant'>;\n\nexport const InputGroupButton = ({ ref, className, tabIndex = -1, ...props }: Props) => (\n <Button\n {...props}\n tabIndex={tabIndex}\n ref={ref}\n variant=\"invisible\"\n size=\"icon-sm\"\n className={cn('tw:size-5', 'tw:[&_svg]:text-muted-foreground', className)}\n />\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'input'>;\n\nexport const InputGroupInput = ({ ref, className, ...inputProps }: Props) => (\n <input\n {...inputProps}\n ref={ref}\n className={cn(\n 'tw:flex-1',\n 'tw:min-w-0',\n 'tw:bg-transparent',\n 'tw:outline-hidden',\n\n // font\n 'tw:font-sans',\n 'tw:text-sm',\n\n // placeholder\n 'tw:placeholder:text-neutral-400',\n 'tw:placeholder:font-normal',\n\n // disabled\n 'tw:disabled:cursor-not-allowed',\n\n className,\n )}\n />\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'span'>;\n\nexport const InputGroupText = ({ className, ...props }: Props) => (\n <span\n className={cn(\n 'tw:flex',\n 'tw:items-center',\n 'tw:gap-2',\n 'tw:text-sm',\n 'tw:text-muted-foreground',\n 'tw:[&_svg]:pointer-events-none',\n 'tw:[&_svg:not([class*=\"tw:size-\"])]:size-4',\n className,\n )}\n {...props}\n />\n);\n","import type { ChangeEventHandler, ComponentProps, FocusEventHandler } from 'react';\nimport TextareaAutosize from 'react-textarea-autosize';\n\nimport { cn } from '../../utils';\n\ntype TextareaNativeProps = Omit<\n ComponentProps<typeof TextareaAutosize>,\n 'value' | 'defaultValue' | 'rows' | 'maxRows'\n>;\n\ntype Props = TextareaNativeProps & {\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string) => void;\n onValueBlur?: (value: string) => void;\n maxRows?: number | 'unlimited';\n disableResize?: boolean;\n};\n\nexport const InputGroupTextArea = ({\n ref,\n className,\n onChange,\n onValueChange,\n value,\n defaultValue,\n onBlur,\n onValueBlur,\n disableResize = false,\n minRows = 1,\n maxRows = 4,\n ...props\n}: Props) => {\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (event) => {\n onValueChange?.(event.target.value);\n onChange?.(event);\n };\n\n const handleBlur: FocusEventHandler<HTMLTextAreaElement> = (event) => {\n onValueBlur?.(event.target.value);\n onBlur?.(event);\n };\n\n return (\n <TextareaAutosize\n {...props}\n ref={ref}\n value={value ?? undefined}\n defaultValue={defaultValue ?? undefined}\n onChange={handleChange}\n onBlur={handleBlur}\n minRows={minRows}\n maxRows={maxRows === 'unlimited' ? undefined : maxRows}\n className={cn(\n 'tw:w-full',\n 'tw:bg-transparent',\n 'tw:outline-hidden',\n 'tw:px-4',\n\n // font\n 'tw:font-sans',\n 'tw:text-sm',\n\n // placeholder\n 'tw:placeholder:text-neutral-400',\n 'tw:placeholder:font-normal',\n\n // disabled\n 'tw:disabled:cursor-not-allowed',\n {\n 'tw:resize-none': disableResize,\n },\n\n className,\n )}\n />\n );\n};\n","import type { ComponentPropsWithRef } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../utils';\n\nimport { InputGroupAddon } from './InputGroupAddon';\nimport { InputGroupButton } from './InputGroupButton';\nimport { InputGroupInput } from './InputGroupInput';\nimport { InputGroupText } from './InputGroupText';\nimport { InputGroupTextArea } from './InputGroupTextArea';\n\nconst inputGroupVariants = cva(\n [\n 'tailwindcss-preflight',\n 'tw:group',\n\n 'tw:overflow-hidden',\n 'tw:box-border',\n\n // positioning\n 'tw:flex',\n 'tw:items-center',\n // A flex item's default `min-width: auto` floors the group at its content's intrinsic width,\n // so a constrained row (several groups side by side) overflows rather than sharing the space.\n // The group clips its own content anyway, and the input inside already carries `min-w-0`.\n 'tw:min-w-0',\n\n 'tw:rounded-[var(--radius-lg,0.25rem)]',\n 'tw:border',\n 'tw:border-solid',\n 'tw:border-input',\n // A grey inset field, distinct from white containers.\n 'tw:bg-muted',\n 'tw:text-foreground',\n 'tw:transition',\n\n // focus\n 'tw:has-[:is(input,textarea):focus]:ring-4',\n\n // readonly — higher specificity than the focus border, so a readonly field never takes it.\n 'tw:has-[:is(input,textarea)[readonly]]:focus-within:ring-0',\n 'tw:has-[:is(input,textarea)[readonly]]:border-input',\n 'tw:has-[:is(input,textarea)[readonly]:focus]:border-input',\n\n // disabled\n 'tw:has-[:is(input,textarea):disabled]:cursor-not-allowed',\n 'tw:has-[:is(input,textarea):disabled]:opacity-disabled',\n\n // `aria-invalid` on the control surfaces the error chrome without a `state` prop.\n 'tw:has-[:is(input,textarea)[aria-invalid=true]]:border-destructive',\n 'tw:has-[:is(input,textarea)[aria-invalid=true]:focus]:border-destructive',\n 'tw:has-[:is(input,textarea)[aria-invalid=true]:focus]:ring-destructive/20',\n\n // textarea: top-align addons, allow vertical expansion, own its y-padding\n 'tw:has-[textarea]:items-start',\n\n 'tw:has-[[data-align=block-start]:not(:empty)]:flex-wrap',\n 'tw:has-[[data-align=block-end]:not(:empty)]:flex-wrap',\n 'tw:[&>input]:has-[[data-align=block-start]:not(:empty)]:w-auto',\n 'tw:[&>input]:has-[[data-align=block-start]:not(:empty)]:flex-1',\n 'tw:[&>input]:has-[[data-align=block-end]:not(:empty)]:w-auto',\n 'tw:[&>input]:has-[[data-align=block-end]:not(:empty)]:flex-1',\n\n 'tw:[&_input]:px-4',\n 'tw:[&>input]:has-[[data-align=inline-start]:not(:empty)]:pl-2',\n 'tw:[&>input]:has-[[data-align=inline-end]:not(:empty)]:pr-2',\n\n 'tw:[&_:is(input,textarea)]:py-2',\n 'tw:[&_:is(input,textarea)]:leading-[18px]',\n 'tw:[&_textarea]:!min-h-[calc(2.25rem-2px)]',\n ],\n {\n defaultVariants: {\n state: 'default',\n focusVariant: 'default',\n },\n compoundVariants: [\n {\n state: 'error',\n focusVariant: 'on',\n className: ['tw:!border-destructive', 'tw:!ring-destructive/20'],\n },\n {\n state: 'default',\n focusVariant: 'off',\n className: ['tw:has-[:is(input,textarea):focus]:border-input'],\n },\n ],\n variants: {\n focusVariant: {\n default: [],\n on: ['tw:!border-primary', 'tw:!ring-ring/50', 'tw:!ring-4'],\n off: ['tw:has-[:is(input,textarea):focus]:!ring-0'],\n },\n state: {\n default: [\n 'tw:has-[:is(input,textarea):focus]:border-primary',\n 'tw:has-[:is(input,textarea):focus]:ring-ring/50',\n ],\n error: [\n 'tw:border-destructive',\n 'tw:has-[:is(input,textarea):focus]:border-destructive',\n 'tw:has-[:is(input,textarea):focus]:ring-destructive/20',\n ],\n warning: [\n 'tw:border-warning-500',\n 'tw:has-[:is(input,textarea):focus]:border-warning-500',\n 'tw:has-[:is(input,textarea):focus]:ring-warning/20',\n ],\n },\n },\n },\n);\n\ntype Props = ComponentPropsWithRef<'div'> & VariantProps<typeof inputGroupVariants>;\n\nconst InputGroupRoot = ({ ref, children, state, focusVariant, className, ...props }: Props) => (\n <div {...props} ref={ref} className={cn(inputGroupVariants({ state, focusVariant, className }))}>\n {children}\n </div>\n);\n\nexport const InputGroup = InputGroupRoot as typeof InputGroupRoot & {\n Input: typeof InputGroupInput;\n Addon: typeof InputGroupAddon;\n Button: typeof InputGroupButton;\n TextArea: typeof InputGroupTextArea;\n Text: typeof InputGroupText;\n};\n\nInputGroup.Input = InputGroupInput;\nInputGroup.Addon = InputGroupAddon;\nInputGroup.Button = InputGroupButton;\nInputGroup.TextArea = InputGroupTextArea;\nInputGroup.Text = InputGroupText;\n"],"mappings":";;;;;;AAOA,MAAM,gBAAgB,IACpB;CACE;CACA;CACA;CAGA;CACA;AACF,GACA;CACE,iBAAiB,EACf,OAAO,eACT;CACA,UAAU,EACR,OAAO;EACL,gBAAgB;GAAC;GAAkB;GAAe;EAAyB;EAC3E,cAAc;GAAC;GAAiB;GAAe;EAAyB;EACxE,eAAe;GACb;GAIA;GACA;GACA;EACF;EACA,aAAa;GACX;GACA;GACA;GACA;EACF;CACF,EACF;AACF,CACF;AAIA,MAAa,mBAAmB,EAC9B,UACA,QAAQ,gBACR,WACA,GAAG,YAEH,oBAAC,OAAD;CAAK,GAAI;CAAO,cAAY;CAAO,WAAW,GAAG,cAAc;EAAE;EAAO;CAAU,CAAC,CAAC;CACjF;AACE,CAAA;;;AC9CP,MAAa,oBAAoB,EAAE,KAAK,WAAW,WAAW,IAAI,GAAG,YACnE,oBAAC,QAAD;CACE,GAAI;C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EACE,OAAO;EACP,cAAc;EACd,WAAW,CAAC,0BAA0B,yBAAyB;CACjE,GACA;EACE,OAAO;EACP,cAAc;EACd,WAAW,CAAC,iDAAiD;CAC/D,CACF;CACA,UAAU;EACR,cAAc;GACZ,SAAS,CAAC;GACV,IAAI;IAAC;IAAsB;IAAoB;GAAY;GAC3D,KAAK,CAAC,4CAA4C;EACpD;EACA,OAAO;GACL,SAAS,CACP,qDACA,iDACF;GACA,OAAO;IACL;IACA;IACA;GACF;GACA,SAAS;IACP;IACA;IACA;GACF;EACF;CACF;AACF,CACF;AAIA,MAAM,kBAAkB,EAAE,KAAK,UAAU,OAAO,cAAc,WAAW,GAAG,YAC1E,oBAAC,OAAD;CAAK,GAAI;CAAY;CAAK,WAAW,GAAG,mBAAmB;EAAE;EAAO;EAAc;CAAU,CAAC,CAAC;CAC3F;AACE,CAAA;AAGP,MAAa,aAAa;AAQ1B,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,WAAW,WAAW;AACtB,WAAW,OAAO"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { cn } from "./classNames-DcGnTh2N.js";
|
|
2
|
-
import { isMac } from "./utils-
|
|
2
|
+
import { isMac } from "./utils-DwC9u0tM.js";
|
|
3
3
|
import { Children, Fragment } from "react";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Kbd/KbdSeparator.tsx
|
|
7
|
-
/**
|
|
8
|
-
* The `+` / `then` glue between two `Kbd` keys.
|
|
9
|
-
*
|
|
10
|
-
* - Follows the muted chrome token by default.
|
|
11
|
-
* - Turns white inside the legacy dark tooltip, which sets `data-tooltip-content`.
|
|
12
|
-
*/
|
|
7
|
+
/** The `+` / `then` glue between two `Kbd` keys, in the muted chrome token. */
|
|
13
8
|
const KbdSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx("span", {
|
|
14
9
|
...props,
|
|
15
|
-
className: cn("tw:text-xs tw:text-muted-foreground",
|
|
10
|
+
className: cn("tw:text-xs tw:text-muted-foreground", className)
|
|
16
11
|
});
|
|
17
12
|
//#endregion
|
|
18
13
|
//#region src/components/Kbd/KbdGroup.tsx
|
|
@@ -54,11 +49,7 @@ const kbdVariants = cva([
|
|
|
54
49
|
},
|
|
55
50
|
variant: {
|
|
56
51
|
default: "tw:bg-muted tw:text-muted-foreground",
|
|
57
|
-
primary:
|
|
58
|
-
"tw:bg-muted tw:text-muted-foreground",
|
|
59
|
-
"tw:[[data-tooltip-content=true]_&]:bg-white/20",
|
|
60
|
-
"tw:[[data-tooltip-content=true]_&]:text-white"
|
|
61
|
-
]
|
|
52
|
+
primary: "tw:bg-muted tw:text-muted-foreground"
|
|
62
53
|
}
|
|
63
54
|
}
|
|
64
55
|
});
|
|
@@ -128,4 +119,4 @@ const keys = createKeyboardKeys();
|
|
|
128
119
|
//#endregion
|
|
129
120
|
export { Kbd, kbdVariants, keys };
|
|
130
121
|
|
|
131
|
-
//# sourceMappingURL=Kbd-
|
|
122
|
+
//# sourceMappingURL=Kbd-CflKthfu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd-CflKthfu.js","names":[],"sources":["../src/components/Kbd/KbdSeparator.tsx","../src/components/Kbd/KbdGroup.tsx","../src/components/Kbd/styles.ts","../src/components/Kbd/Kbd.tsx","../src/components/Kbd/keyboardKeys.ts"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'span'>;\n\n/** The `+` / `then` glue between two `Kbd` keys, in the muted chrome token. */\nexport const KbdSeparator = ({ className, ...props }: Props) => (\n <span {...props} className={cn('tw:text-xs tw:text-muted-foreground', className)} />\n);\n","import { Children, Fragment } from 'react';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\nimport { KbdSeparator } from './KbdSeparator';\n\ntype Props = { separator?: string } & ComponentProps<'kbd'>;\n\nexport const KbdGroup = ({ ref, className, children, separator, ...props }: Props) => {\n return (\n <kbd\n {...props}\n ref={ref}\n className={cn('tw:inline-flex', 'tw:items-center', 'tw:gap-1', className)}\n >\n {separator\n ? // oxlint-disable-next-line react-x/no-children-to-array\n Children.toArray(children).map((child, index) => (\n // oxlint-disable-next-line\n <Fragment key={index}>\n {index > 0 && <KbdSeparator>{separator}</KbdSeparator>}\n {child}\n </Fragment>\n ))\n : children}\n </kbd>\n );\n};\n","import { cva } from 'class-variance-authority';\n\nexport const kbdVariants = cva(\n [\n 'tailwindcss-preflight',\n // style\n 'tw:pointer-events-none',\n 'tw:w-fit',\n 'tw:h-5',\n 'tw:min-w-5',\n\n // layout\n 'tw:inline-flex',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:gap-1',\n 'tw:shrink-0',\n\n // spacing\n 'tw:px-1',\n 'tw:[&_svg:not([class*=\"size-\"])]:size-2.5',\n\n 'tw:text-xs',\n 'tw:font-medium',\n\n 'tw:rounded',\n ],\n {\n defaultVariants: {\n variant: 'default',\n casing: 'upper',\n },\n variants: {\n // Uppercase like a keycap; `as-written` for layout-printed labels, where the transform\n // changes glyph count (`ß` → `SS`).\n casing: {\n upper: 'tw:uppercase',\n 'as-written': '',\n },\n variant: {\n default: 'tw:bg-muted tw:text-muted-foreground',\n // Tooltip shortcut key.\n primary: 'tw:bg-muted tw:text-muted-foreground',\n },\n },\n },\n);\n","import type { ComponentProps } from 'react';\nimport type { VariantProps } from 'class-variance-authority';\n\nimport { KbdGroup } from './KbdGroup';\nimport { KbdSeparator } from './KbdSeparator';\nimport { kbdVariants } from './styles';\n\ntype Props = ComponentProps<'kbd'> & VariantProps<typeof kbdVariants>;\n\nexport const Kbd = ({ children, className, variant, casing, ...rest }: Props) => (\n <kbd {...rest} className={kbdVariants({ className, variant, casing })}>\n {children}\n </kbd>\n);\n\nKbd.Group = KbdGroup;\nKbd.Separator = KbdSeparator;\n","import { isMac } from '../../utils';\n\ntype KeyName = 'mod' | 'option' | 'shift' | 'enter';\ntype KeyRepresentation = { symbol: string; text: string };\n\ntype KeyDefinition = {\n mac: KeyRepresentation;\n windows: KeyRepresentation;\n};\n\nconst KEY_DEFINITIONS: Record<KeyName, KeyDefinition> = {\n mod: {\n mac: { symbol: '⌘', text: 'Command' },\n windows: { symbol: 'Ctrl', text: 'Ctrl' },\n },\n option: {\n mac: { symbol: '⌥', text: 'Option' },\n windows: { symbol: 'Alt', text: 'Alt' },\n },\n shift: {\n mac: { symbol: '⇧', text: 'Shift' },\n windows: { symbol: '⇧', text: 'Shift' },\n },\n enter: {\n mac: { symbol: '⏎', text: 'Enter' },\n windows: { symbol: '⏎', text: 'Enter' },\n },\n};\n\nconst createKeyboardKeys = () => {\n const keysObj: Record<KeyName, KeyRepresentation> = {} as Record<KeyName, KeyRepresentation>;\n\n for (const keyName of Object.keys(KEY_DEFINITIONS) as KeyName[]) {\n keysObj[keyName] = KEY_DEFINITIONS[keyName][isMac ? 'mac' : 'windows'];\n }\n\n return keysObj;\n};\n\nexport const keys = createKeyboardKeys();\n"],"mappings":";;;;;;;AAOA,MAAa,gBAAgB,EAAE,WAAW,GAAG,YAC3C,oBAAC,QAAD;CAAM,GAAI;CAAO,WAAW,GAAG,uCAAuC,SAAS;AAAI,CAAA;;;ACCrF,MAAa,YAAY,EAAE,KAAK,WAAW,UAAU,WAAW,GAAG,YAAmB;CACpF,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,kBAAkB,mBAAmB,YAAY,SAAS;EAEvE,UAAA,YAEG,SAAS,QAAQ,QAAQ,CAAC,CAAC,KAAK,OAAO,UAErC,qBAAC,UAAD,EAAA,UAAA,CACG,QAAQ,KAAK,oBAAC,cAAD,EAAA,UAAe,UAAwB,CAAA,GACpD,KACO,EAAA,GAHK,KAGL,CACX,IACD;CACD,CAAA;AAET;;;AC1BA,MAAa,cAAc,IACzB;CACE;CAEA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CAGA;CACA;CAEA;CACA;CAEA;AACF,GACA;CACE,iBAAiB;EACf,SAAS;EACT,QAAQ;CACV;CACA,UAAU;EAGR,QAAQ;GACN,OAAO;GACP,cAAc;EAChB;EACA,SAAS;GACP,SAAS;GAET,SAAS;EACX;CACF;AACF,CACF;;;ACrCA,MAAa,OAAO,EAAE,UAAU,WAAW,SAAS,QAAQ,GAAG,WAC7D,oBAAC,OAAD;CAAK,GAAI;CAAM,WAAW,YAAY;EAAE;EAAW;EAAS;CAAO,CAAC;CACjE;AACE,CAAA;AAGP,IAAI,QAAQ;AACZ,IAAI,YAAY;;;ACNhB,MAAM,kBAAkD;CACtD,KAAK;EACH,KAAK;GAAE,QAAQ;GAAK,MAAM;EAAU;EACpC,SAAS;GAAE,QAAQ;GAAQ,MAAM;EAAO;CAC1C;CACA,QAAQ;EACN,KAAK;GAAE,QAAQ;GAAK,MAAM;EAAS;EACnC,SAAS;GAAE,QAAQ;GAAO,MAAM;EAAM;CACxC;CACA,OAAO;EACL,KAAK;GAAE,QAAQ;GAAK,MAAM;EAAQ;EAClC,SAAS;GAAE,QAAQ;GAAK,MAAM;EAAQ;CACxC;CACA,OAAO;EACL,KAAK;GAAE,QAAQ;GAAK,MAAM;EAAQ;EAClC,SAAS;GAAE,QAAQ;GAAK,MAAM;EAAQ;CACxC;AACF;AAEA,MAAM,2BAA2B;CAC/B,MAAM,UAA8C,CAAC;CAErD,KAAK,MAAM,WAAW,OAAO,KAAK,eAAe,GAC/C,QAAQ,WAAW,gBAAgB,QAAQ,CAAC,QAAQ,QAAQ;CAG9D,OAAO;AACT;AAEA,MAAa,OAAO,mBAAmB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __exportAll } from "./rolldown-runtime-Bdc48AWt.js";
|
|
2
|
-
import { useThemeAttributes } from "./useThemeAttributes-B199Regy.js";
|
|
3
2
|
import { DiagramSkeleton } from "./internal/blocks/DiagramShared/DiagramSkeleton.js";
|
|
4
3
|
import { DiagramSource, makeResponsive } from "./svgTransforms-Hnvev3Vs.js";
|
|
5
|
-
import { ZoomableSvg } from "./ZoomableSvg-
|
|
6
|
-
import {
|
|
4
|
+
import { ZoomableSvg } from "./ZoomableSvg-DnFXo2L4.js";
|
|
5
|
+
import { useThemeAttributes } from "./themeTokens-DCeb62ap.js";
|
|
6
|
+
import { SERIES_TOKENS, createVegaColorResolver, tierTwoColour } from "./vegaTokens-DCkvpIVE.js";
|
|
7
7
|
import { createSvgCache, diagramCacheKey } from "./svgCache-Dhmbe-7i.js";
|
|
8
8
|
import { useEffect, useState } from "react";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -196,4 +196,4 @@ const MermaidDiagram = ({ code, renderActions }) => {
|
|
|
196
196
|
//#endregion
|
|
197
197
|
export { MermaidDiagram, MermaidDiagram_exports };
|
|
198
198
|
|
|
199
|
-
//# sourceMappingURL=MermaidDiagram-
|
|
199
|
+
//# sourceMappingURL=MermaidDiagram-Te-5gOCU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MermaidDiagram-CeiOkI60.js","names":[],"sources":["../src/blocks/MermaidDiagram/peleTheme.ts","../src/blocks/MermaidDiagram/MermaidDiagram.tsx"],"sourcesContent":["import type { ResolvedColorScheme } from '../../components/ThemeProvider/types';\nimport { createVegaColorResolver, SERIES_TOKENS, tierTwoColour } from '../../vega/vegaTokens';\n\nexport const DIAGRAM_FONT = 'Inter, system-ui, sans-serif';\n\n/**\n * The `--pele-*` declarations for one scheme, as a `style` attribute fragment.\n *\n * - Resolved colours, not `var()` refs: an exported SVG or PNG has no page CSS to read.\n * - One `getComputedStyle` snapshot per call; never hoist — values follow scheme and brand.\n * - Series 6–8 are the charts' second tier, as in Flint charts.\n */\nexport const peleThemeStyle = (scheme: ResolvedColorScheme, from?: Element | null): string => {\n const token = createVegaColorResolver(scheme, from);\n const series = SERIES_TOKENS.map((name) => token(name));\n\n const vars: Record<string, string> = {\n bg: token('card'),\n fg: token('foreground'),\n muted: token('muted-foreground'),\n line: token('muted-foreground'),\n surface: token('muted'),\n 'surface-alt': token('accent'),\n border: token('border'),\n accent: token('primary'),\n critical: token('destructive'),\n error: token('destructive'),\n font: DIAGRAM_FONT,\n radius: '6px',\n };\n [...series, ...series.map((colour) => tierTwoColour(colour, scheme))]\n .slice(0, 8)\n .forEach((colour, index) => {\n vars[`series-${index + 1}`] = colour;\n });\n\n return Object.entries(vars)\n .map(([name, value]) => `--pele-${name}:${value}`)\n .join(';');\n};\n","import { useEffect, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport type { DiagramType, IconResolver } from 'pele/lazy';\nimport { detectType, load, PeleError, registered, render } from 'pele/lazy';\n\nimport type { ResolvedColorScheme } from '../../components/ThemeProvider/types';\nimport { useThemeAttributes } from '../../components/ThemeProvider/useThemeAttributes';\nimport { ZoomableSvg } from '../../components/ZoomableSvg';\nimport { DiagramSkeleton } from '../DiagramShared/DiagramSkeleton';\nimport { DiagramSource } from '../DiagramShared/DiagramSource';\nimport { createSvgCache, diagramCacheKey } from '../DiagramShared/svgCache';\nimport { makeResponsive } from '../DiagramShared/svgTransforms';\n\nimport { DIAGRAM_FONT, peleThemeStyle } from './peleTheme';\n\ntype IconPack = {\n icons: Record<string, { body: string }>;\n aliases?: Record<string, { parent: string }>;\n};\n\nlet lucidePack: IconPack | null = null;\nlet lucidePromise: Promise<void> | null = null;\n\n// The pack is a lazy local chunk, so no CDN fetch and it works under strict CSP.\nconst loadLucidePack = (): Promise<void> => {\n lucidePromise ??= import('@iconify-json/lucide/icons.json')\n .then((mod) => {\n lucidePack = mod.default;\n })\n .catch((err: unknown) => {\n lucidePromise = null;\n throw err;\n });\n return lucidePromise;\n};\n\n// `lucide:name` refs resolve to the pack's 24×24 stroke body, which is the frame Pele draws.\nconst lucideIcon: IconResolver = (ref) => {\n if (!lucidePack || !ref.startsWith('lucide:')) return null;\n const name = ref.slice('lucide:'.length);\n return (lucidePack.icons[name] ?? lucidePack.icons[lucidePack.aliases?.[name]?.parent ?? ''])\n ?.body;\n};\n\nconst usesLucide = (code: string): boolean => code.includes('lucide:');\n\nconst diagramType = (code: string): DiagramType | null => {\n try {\n return detectType(code);\n } catch (err) {\n console.debug('[MermaidDiagram] no diagram type detected:', err);\n return null;\n }\n};\n\n/**\n * Whether a render error means \"ran out of input\" rather than \"bad syntax\".\n *\n * - A syntax error at the last non-blank character or past it, as in every streaming frame.\n * - No type yet and at most one line after the preamble: the header itself is still arriving.\n * - Lower bound only: a real error on the last character shows as truncated until the grace period.\n */\n// Closed front matter and `%%` directive or comment lines before the type header.\nconst PREAMBLE = /^(?:\\s*---\\n[\\s\\S]*?\\n---[^\\S\\n]*(?:\\n|$)|[^\\S\\n]*%%.*(?:\\n|$)|\\s*\\n)*/;\n\nconst isHeaderArriving = (code: string): boolean => {\n const rest = code.replace(PREAMBLE, '');\n // Front matter whose closing `---` has not arrived yet.\n if (/^\\s*---\\n/.test(rest)) return true;\n return !rest.trim().includes('\\n');\n};\n\nconst isTruncatedDiagram = (err: unknown, code: string): boolean => {\n if (!(err instanceof PeleError)) return false;\n if (err.code === 'unsupported-diagram') return isHeaderArriving(code);\n if (err.code !== 'syntax') return false;\n const tail = code\n .split('\\n')\n .slice(err.line - 1)\n .join('\\n');\n return tail.slice(Math.max(err.column - 1, 0)).trim().length <= 1;\n};\n\n// Longer than the gap between streamed chunks, short enough for an abandoned stream.\nconst TRUNCATION_GRACE_MS = 2_000;\n\nconst svgCache = createSvgCache();\n\n// Every streamed frame shares one theme, so its palette is read once per theme key.\nlet lastTheme = { key: '', style: '' };\nconst themeStyleFor = (themeKey: string, scheme: ResolvedColorScheme, scope: Element | null) => {\n if (lastTheme.key !== themeKey) {\n lastTheme = { key: themeKey, style: peleThemeStyle(scheme, scope) };\n }\n return lastTheme.style;\n};\n\ntype Outcome =\n | { svg: string }\n | { error: unknown; truncated: boolean }\n | { loading: DiagramType | null };\n\ntype Theme = { key: string; scheme: ResolvedColorScheme; scope: Element | null };\n\n/**\n * The diagram for `code`, rendered synchronously.\n *\n * 1. A cached SVG for this code and theme.\n * 2. `loading` while the diagram type's chunk or the icon pack is not loaded yet.\n * 3. A fresh render, or the error Pele threw.\n */\nconst renderNow = (code: string, theme: Theme): Outcome => {\n const cacheKey = diagramCacheKey(code, theme.key);\n const cached = svgCache.get(cacheKey);\n if (cached) return { svg: cached };\n const type = diagramType(code);\n if ((type !== null && !registered(type)) || (usesLucide(code) && lucidePack === null)) {\n return { loading: type };\n }\n try {\n const { svg } = render(code, { fontFamily: DIAGRAM_FONT, icons: lucideIcon });\n const themed = makeResponsive(svg, themeStyleFor(theme.key, theme.scheme, theme.scope));\n svgCache.set(cacheKey, themed);\n return { svg: themed };\n } catch (error) {\n return { error, truncated: isTruncatedDiagram(error, code) };\n }\n};\n\ntype Props = {\n /** Mermaid source. */\n code: string;\n /** Extra toolbar controls forwarded to `ZoomableSvg`; receives the sanitized SVG. */\n renderActions?: (safeSvg: string) => ReactNode;\n};\n\nexport const MermaidDiagram = ({ code, renderActions }: Props) => {\n // - Scheme and key come from one read, so a palette is never cached under the wrong scheme.\n // - `scope` is the element tokens are read off (`null` = `<html>`) and is part of `themeKey`.\n const { scheme, cacheKey: themeKey, scope } = useThemeAttributes();\n const cacheKey = diagramCacheKey(code, themeKey);\n\n const [state, setState] = useState(() => ({\n key: cacheKey,\n outcome: renderNow(code, { key: themeKey, scheme, scope }),\n }));\n const [gaveUpKey, setGaveUpKey] = useState<string | null>(null);\n\n // Render-phase reset avoids a one-frame flash of the previous diagram.\n if (state.key !== cacheKey) {\n setState({ key: cacheKey, outcome: renderNow(code, { key: themeKey, scheme, scope }) });\n }\n const { outcome } = state;\n\n useEffect(() => {\n if (!('loading' in outcome)) return;\n let cancelled = false;\n Promise.all([load(outcome.loading), usesLucide(code) ? loadLucidePack() : null])\n .then(() => renderNow(code, { key: themeKey, scheme, scope }))\n .catch((error: unknown) => ({ error, truncated: false }))\n .then((next) => {\n if (!cancelled) setState({ key: cacheKey, outcome: next });\n });\n return () => {\n cancelled = true;\n };\n }, [outcome, code, cacheKey, themeKey, scheme, scope]);\n\n useEffect(() => {\n if (!('error' in outcome)) return;\n if (!outcome.truncated) {\n console.error('[MermaidDiagram] render failed:', outcome.error);\n return;\n }\n // A streaming diagram is truncated at almost every frame; one that stops arriving shows its source.\n const timer = setTimeout(() => setGaveUpKey(cacheKey), TRUNCATION_GRACE_MS);\n return () => clearTimeout(timer);\n }, [outcome, cacheKey]);\n\n if ('svg' in outcome) {\n return (\n <ZoomableSvg\n key={code}\n html={outcome.svg}\n copyText={`\\`\\`\\`mermaid\\n${code}\\n\\`\\`\\``}\n className=\"tw:my-3\"\n renderActions={renderActions}\n />\n );\n }\n\n if ('error' in outcome && (!outcome.truncated || gaveUpKey === cacheKey)) {\n return <DiagramSource code={code} />;\n }\n\n return <DiagramSkeleton />;\n};\n"],"mappings":";;;;;;;;;;;AAGA,MAAa,eAAe;;;;;;;;AAS5B,MAAa,kBAAkB,QAA6B,SAAkC;CAC5F,MAAM,QAAQ,wBAAwB,QAAQ,IAAI;CAClD,MAAM,SAAS,cAAc,KAAK,SAAS,MAAM,IAAI,CAAC;CAEtD,MAAM,OAA+B;EACnC,IAAI,MAAM,MAAM;EAChB,IAAI,MAAM,YAAY;EACtB,OAAO,MAAM,kBAAkB;EAC/B,MAAM,MAAM,kBAAkB;EAC9B,SAAS,MAAM,OAAO;EACtB,eAAe,MAAM,QAAQ;EAC7B,QAAQ,MAAM,QAAQ;EACtB,QAAQ,MAAM,SAAS;EACvB,UAAU,MAAM,aAAa;EAC7B,OAAO,MAAM,aAAa;EAC1B,MAAM;EACN,QAAQ;CACV;CACA,CAAC,GAAG,QAAQ,GAAG,OAAO,KAAK,WAAW,cAAc,QAAQ,MAAM,CAAC,CAAC,CAAC,CAClE,MAAM,GAAG,CAAC,CAAC,CACX,SAAS,QAAQ,UAAU;EAC1B,KAAK,UAAU,QAAQ,OAAO;CAChC,CAAC;CAEH,OAAO,OAAO,QAAQ,IAAI,CAAC,CACxB,KAAK,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,UAAU,MAAM;GAAE,KAAK;GAAU;GAAQ;EAAM,CAAC;CAAE,CAAC;CAExF,MAAM,EAAE,YAAY;CAEpB,gBAAgB;EACd,IAAI,EAAE,aAAa,UAAU;EAC7B,IAAI,YAAY;EAChB,QAAQ,IAAI,CAAC,KAAK,QAAQ,OAAO,GAAG,WAAW,IAAI,IAAI,eAAe,IAAI,IAAI,CAAC,CAAC,CAC7E,WAAW,UAAU,MAAM;GAAE,KAAK;GAAU;GAAQ;EAAM,CAAC,CAAC,CAAC,CAC7D,OAAO,WAAoB;GAAE;GAAO,WAAW;EAAM,EAAE,CAAC,CACxD,MAAM,SAAS;GACd,IAAI,CAAC,WAAW,SAAS;IAAE,KAAK;IAAU,SAAS;GAAK,CAAC;EAC3D,CAAC;EACH,aAAa;GACX,YAAY;EACd;CACF,GAAG;EAAC;EAAS;EAAM;EAAU;EAAU;EAAQ;CAAK,CAAC;CAErD,gBAAgB;EACd,IAAI,EAAE,WAAW,UAAU;EAC3B,IAAI,CAAC,QAAQ,WAAW;GACtB,QAAQ,MAAM,mCAAmC,QAAQ,KAAK;GAC9D;EACF;EAEA,MAAM,QAAQ,iBAAiB,aAAa,QAAQ,GAAG,mBAAmB;EAC1E,aAAa,aAAa,KAAK;CACjC,GAAG,CAAC,SAAS,QAAQ,CAAC;CAEtB,IAAI,SAAS,SACX,OACE,oBAAC,aAAD;EAEE,MAAM,QAAQ;EACd,UAAU,kBAAkB,KAAK;EACjC,WAAU;EACK;CAChB,GALM,IAKN;CAIL,IAAI,WAAW,YAAY,CAAC,QAAQ,aAAa,cAAc,WAC7D,OAAO,oBAAC,eAAD,EAAqB,KAAO,CAAA;CAGrC,OAAO,oBAAC,iBAAD,CAAkB,CAAA;AAC3B"}
|
|
1
|
+
{"version":3,"file":"MermaidDiagram-Te-5gOCU.js","names":[],"sources":["../src/blocks/MermaidDiagram/peleTheme.ts","../src/blocks/MermaidDiagram/MermaidDiagram.tsx"],"sourcesContent":["import type { ResolvedColorScheme } from '../../components/ThemeProvider/types';\nimport { createVegaColorResolver, SERIES_TOKENS, tierTwoColour } from '../../vega/vegaTokens';\n\nexport const DIAGRAM_FONT = 'Inter, system-ui, sans-serif';\n\n/**\n * The `--pele-*` declarations for one scheme, as a `style` attribute fragment.\n *\n * - Resolved colours, not `var()` refs: an exported SVG or PNG has no page CSS to read.\n * - One `getComputedStyle` snapshot per call; never hoist — values follow scheme and brand.\n * - Series 6–8 are the charts' second tier, as in Flint charts.\n */\nexport const peleThemeStyle = (scheme: ResolvedColorScheme, from?: Element | null): string => {\n const token = createVegaColorResolver(scheme, from);\n const series = SERIES_TOKENS.map((name) => token(name));\n\n const vars: Record<string, string> = {\n bg: token('card'),\n fg: token('foreground'),\n muted: token('muted-foreground'),\n line: token('muted-foreground'),\n surface: token('muted'),\n 'surface-alt': token('accent'),\n border: token('border'),\n accent: token('primary'),\n critical: token('destructive'),\n error: token('destructive'),\n font: DIAGRAM_FONT,\n radius: '6px',\n };\n [...series, ...series.map((colour) => tierTwoColour(colour, scheme))]\n .slice(0, 8)\n .forEach((colour, index) => {\n vars[`series-${index + 1}`] = colour;\n });\n\n return Object.entries(vars)\n .map(([name, value]) => `--pele-${name}:${value}`)\n .join(';');\n};\n","import { useEffect, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport type { DiagramType, IconResolver } from 'pele/lazy';\nimport { detectType, load, PeleError, registered, render } from 'pele/lazy';\n\nimport type { ResolvedColorScheme } from '../../components/ThemeProvider/types';\nimport { useThemeAttributes } from '../../components/ThemeProvider/useThemeAttributes';\nimport { ZoomableSvg } from '../../components/ZoomableSvg';\nimport { DiagramSkeleton } from '../DiagramShared/DiagramSkeleton';\nimport { DiagramSource } from '../DiagramShared/DiagramSource';\nimport { createSvgCache, diagramCacheKey } from '../DiagramShared/svgCache';\nimport { makeResponsive } from '../DiagramShared/svgTransforms';\n\nimport { DIAGRAM_FONT, peleThemeStyle } from './peleTheme';\n\ntype IconPack = {\n icons: Record<string, { body: string }>;\n aliases?: Record<string, { parent: string }>;\n};\n\nlet lucidePack: IconPack | null = null;\nlet lucidePromise: Promise<void> | null = null;\n\n// The pack is a lazy local chunk, so no CDN fetch and it works under strict CSP.\nconst loadLucidePack = (): Promise<void> => {\n lucidePromise ??= import('@iconify-json/lucide/icons.json')\n .then((mod) => {\n lucidePack = mod.default;\n })\n .catch((err: unknown) => {\n lucidePromise = null;\n throw err;\n });\n return lucidePromise;\n};\n\n// `lucide:name` refs resolve to the pack's 24×24 stroke body, which is the frame Pele draws.\nconst lucideIcon: IconResolver = (ref) => {\n if (!lucidePack || !ref.startsWith('lucide:')) return null;\n const name = ref.slice('lucide:'.length);\n return (lucidePack.icons[name] ?? lucidePack.icons[lucidePack.aliases?.[name]?.parent ?? ''])\n ?.body;\n};\n\nconst usesLucide = (code: string): boolean => code.includes('lucide:');\n\nconst diagramType = (code: string): DiagramType | null => {\n try {\n return detectType(code);\n } catch (err) {\n console.debug('[MermaidDiagram] no diagram type detected:', err);\n return null;\n }\n};\n\n/**\n * Whether a render error means \"ran out of input\" rather than \"bad syntax\".\n *\n * - A syntax error at the last non-blank character or past it, as in every streaming frame.\n * - No type yet and at most one line after the preamble: the header itself is still arriving.\n * - Lower bound only: a real error on the last character shows as truncated until the grace period.\n */\n// Closed front matter and `%%` directive or comment lines before the type header.\nconst PREAMBLE = /^(?:\\s*---\\n[\\s\\S]*?\\n---[^\\S\\n]*(?:\\n|$)|[^\\S\\n]*%%.*(?:\\n|$)|\\s*\\n)*/;\n\nconst isHeaderArriving = (code: string): boolean => {\n const rest = code.replace(PREAMBLE, '');\n // Front matter whose closing `---` has not arrived yet.\n if (/^\\s*---\\n/.test(rest)) return true;\n return !rest.trim().includes('\\n');\n};\n\nconst isTruncatedDiagram = (err: unknown, code: string): boolean => {\n if (!(err instanceof PeleError)) return false;\n if (err.code === 'unsupported-diagram') return isHeaderArriving(code);\n if (err.code !== 'syntax') return false;\n const tail = code\n .split('\\n')\n .slice(err.line - 1)\n .join('\\n');\n return tail.slice(Math.max(err.column - 1, 0)).trim().length <= 1;\n};\n\n// Longer than the gap between streamed chunks, short enough for an abandoned stream.\nconst TRUNCATION_GRACE_MS = 2_000;\n\nconst svgCache = createSvgCache();\n\n// Every streamed frame shares one theme, so its palette is read once per theme key.\nlet lastTheme = { key: '', style: '' };\nconst themeStyleFor = (themeKey: string, scheme: ResolvedColorScheme, scope: Element | null) => {\n if (lastTheme.key !== themeKey) {\n lastTheme = { key: themeKey, style: peleThemeStyle(scheme, scope) };\n }\n return lastTheme.style;\n};\n\ntype Outcome =\n | { svg: string }\n | { error: unknown; truncated: boolean }\n | { loading: DiagramType | null };\n\ntype Theme = { key: string; scheme: ResolvedColorScheme; scope: Element | null };\n\n/**\n * The diagram for `code`, rendered synchronously.\n *\n * 1. A cached SVG for this code and theme.\n * 2. `loading` while the diagram type's chunk or the icon pack is not loaded yet.\n * 3. A fresh render, or the error Pele threw.\n */\nconst renderNow = (code: string, theme: Theme): Outcome => {\n const cacheKey = diagramCacheKey(code, theme.key);\n const cached = svgCache.get(cacheKey);\n if (cached) return { svg: cached };\n const type = diagramType(code);\n if ((type !== null && !registered(type)) || (usesLucide(code) && lucidePack === null)) {\n return { loading: type };\n }\n try {\n const { svg } = render(code, { fontFamily: DIAGRAM_FONT, icons: lucideIcon });\n const themed = makeResponsive(svg, themeStyleFor(theme.key, theme.scheme, theme.scope));\n svgCache.set(cacheKey, themed);\n return { svg: themed };\n } catch (error) {\n return { error, truncated: isTruncatedDiagram(error, code) };\n }\n};\n\ntype Props = {\n /** Mermaid source. */\n code: string;\n /** Extra toolbar controls forwarded to `ZoomableSvg`; receives the sanitized SVG. */\n renderActions?: (safeSvg: string) => ReactNode;\n};\n\nexport const MermaidDiagram = ({ code, renderActions }: Props) => {\n // - Scheme and key come from one read, so a palette is never cached under the wrong scheme.\n // - `scope` is the element tokens are read off (`null` = `<html>`) and is part of `themeKey`.\n const { scheme, cacheKey: themeKey, scope } = useThemeAttributes();\n const cacheKey = diagramCacheKey(code, themeKey);\n\n const [state, setState] = useState(() => ({\n key: cacheKey,\n outcome: renderNow(code, { key: themeKey, scheme, scope }),\n }));\n const [gaveUpKey, setGaveUpKey] = useState<string | null>(null);\n\n // Render-phase reset avoids a one-frame flash of the previous diagram.\n if (state.key !== cacheKey) {\n setState({ key: cacheKey, outcome: renderNow(code, { key: themeKey, scheme, scope }) });\n }\n const { outcome } = state;\n\n useEffect(() => {\n if (!('loading' in outcome)) return;\n let cancelled = false;\n Promise.all([load(outcome.loading), usesLucide(code) ? loadLucidePack() : null])\n .then(() => renderNow(code, { key: themeKey, scheme, scope }))\n .catch((error: unknown) => ({ error, truncated: false }))\n .then((next) => {\n if (!cancelled) setState({ key: cacheKey, outcome: next });\n });\n return () => {\n cancelled = true;\n };\n }, [outcome, code, cacheKey, themeKey, scheme, scope]);\n\n useEffect(() => {\n if (!('error' in outcome)) return;\n if (!outcome.truncated) {\n console.error('[MermaidDiagram] render failed:', outcome.error);\n return;\n }\n // A streaming diagram is truncated at almost every frame; one that stops arriving shows its source.\n const timer = setTimeout(() => setGaveUpKey(cacheKey), TRUNCATION_GRACE_MS);\n return () => clearTimeout(timer);\n }, [outcome, cacheKey]);\n\n if ('svg' in outcome) {\n return (\n <ZoomableSvg\n key={code}\n html={outcome.svg}\n copyText={`\\`\\`\\`mermaid\\n${code}\\n\\`\\`\\``}\n className=\"tw:my-3\"\n renderActions={renderActions}\n />\n );\n }\n\n if ('error' in outcome && (!outcome.truncated || gaveUpKey === cacheKey)) {\n return <DiagramSource code={code} />;\n }\n\n return <DiagramSkeleton />;\n};\n"],"mappings":";;;;;;;;;;;AAGA,MAAa,eAAe;;;;;;;;AAS5B,MAAa,kBAAkB,QAA6B,SAAkC;CAC5F,MAAM,QAAQ,wBAAwB,QAAQ,IAAI;CAClD,MAAM,SAAS,cAAc,KAAK,SAAS,MAAM,IAAI,CAAC;CAEtD,MAAM,OAA+B;EACnC,IAAI,MAAM,MAAM;EAChB,IAAI,MAAM,YAAY;EACtB,OAAO,MA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C,GAAG,CAAC,SAAS,QAAQ,CAAC;CAEtB,IAAI,SAAS,SACX,OACE,oBAAC,aAAD;EAEE,MAAM,QAAQ;EACd,UAAU,kBAAkB,KAAK;EACjC,WAAU;EACK;CAChB,GALM,IAKN;CAIL,IAAI,WAAW,YAAY,CAAC,QAAQ,aAAa,cAAc,WAC7D,OAAO,oBAAC,eAAD,EAAqB,KAAO,CAAA;CAGrC,OAAO,oBAAC,iBAAD,CAAkB,CAAA;AAC3B"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { cn } from "./classNames-DcGnTh2N.js";
|
|
2
|
-
import { useArgoDesign } from "./context-U293r3v-.js";
|
|
3
2
|
import { X } from "./icons-ZIeZXXS7.js";
|
|
4
|
-
import { Button } from "./Button-
|
|
5
|
-
import { ModalDescription, ModalOverlay, ModalTitle } from "./ModalTitle-
|
|
6
|
-
import { Separator } from "./internal/components/Separator.js";
|
|
3
|
+
import { Button } from "./Button-BNkyYU8u.js";
|
|
4
|
+
import { ModalDescription, ModalOverlay, ModalTitle } from "./ModalTitle-cy0Ht9VY.js";
|
|
7
5
|
import { useEffect, useState } from "react";
|
|
8
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
7
|
import { Close, Content, Portal, Root, Trigger } from "@radix-ui/react-dialog";
|
|
@@ -14,23 +12,21 @@ import { Close, Content, Portal, Root, Trigger } from "@radix-ui/react-dialog";
|
|
|
14
12
|
*/
|
|
15
13
|
const ModalBody = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
16
14
|
"data-slot": "modal-body",
|
|
17
|
-
className: cn("tw:flex-1", "tw:overflow-y-auto", "tw:
|
|
15
|
+
className: cn("tw:flex-1", "tw:overflow-y-auto", "tw:scroll-fade-y", "tw:px-4", "tw:py-1", "tw:[&_svg.lucide:not([class*='tw:size-'])]:size-4", "tw:[&_svg]:shrink-0", className),
|
|
18
16
|
...props
|
|
19
17
|
});
|
|
20
18
|
//#endregion
|
|
21
19
|
//#region src/components/Modal/ModalContent.tsx
|
|
22
20
|
const ModalContent = ({ size = "medium", align = "center", className, children, onEscapeKeyDown, ...props }) => {
|
|
23
|
-
const renderArgo = useArgoDesign();
|
|
24
21
|
const handleEscapeKeyDown = (event) => {
|
|
25
22
|
event.stopPropagation();
|
|
26
23
|
onEscapeKeyDown?.(event);
|
|
27
24
|
};
|
|
28
25
|
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(ModalOverlay, { children: /* @__PURE__ */ jsx(Content, {
|
|
29
26
|
...props,
|
|
30
|
-
"data-argo": renderArgo,
|
|
31
27
|
"data-size": size,
|
|
32
28
|
"data-align": align,
|
|
33
|
-
className: cn("tailwindcss-preflight", "tw:group/modal", "tw:fixed", "tw:left-1/2", "tw:-translate-x-1/2", "tw:z-[1051]", "tw:
|
|
29
|
+
className: cn("tailwindcss-preflight", "tw:group/modal", "tw:fixed", "tw:left-1/2", "tw:-translate-x-1/2", "tw:z-[1051]", "tw:top-1/2", "tw:-translate-y-1/2", "tw:data-[align=top]:top-20", "tw:data-[align=top]:translate-y-0", "tw:w-full", "tw:max-w-2xl", "tw:max-h-[calc(100vh-2*theme(spacing.20))]", "tw:flex", "tw:flex-col", "tw:gap-4", "tw:rounded-modal", "tw:bg-card", "tw:text-card-foreground", "tw:py-4", "tw:duration-200", "tw:data-[state=open]:animate-in", "tw:data-[state=open]:fade-in-0", "tw:data-[state=closed]:animate-out", "tw:data-[state=closed]:fade-out-0", "tw:data-[state=open]:zoom-in-95", "tw:data-[state=closed]:zoom-out-95", {
|
|
34
30
|
"tw:max-w-[480px]": size === "small",
|
|
35
31
|
"tw:max-w-4xl": size === "large"
|
|
36
32
|
}, className),
|
|
@@ -48,7 +44,7 @@ const ModalContent = ({ size = "medium", align = "center", className, children,
|
|
|
48
44
|
*/
|
|
49
45
|
const ModalFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
50
46
|
...props,
|
|
51
|
-
className: cn("tw:flex", "tw:items-center", "tw:justify-end", "tw:gap-2", "tw:
|
|
47
|
+
className: cn("tw:flex", "tw:items-center", "tw:justify-end", "tw:gap-2", "tw:px-4", className)
|
|
52
48
|
});
|
|
53
49
|
//#endregion
|
|
54
50
|
//#region src/components/Modal/ModalActions.tsx
|
|
@@ -57,7 +53,7 @@ const ModalFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
57
53
|
* close icon. Sits in the header grid's last column, top-aligned. Mirrors `Alert`'s action slot.
|
|
58
54
|
*/
|
|
59
55
|
const ModalActions = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
60
|
-
className: cn("tw:col-start-3", "tw:row-start-1", "tw:self-start", "tw:flex", "tw:items-center", "tw:gap-1", "tw:
|
|
56
|
+
className: cn("tw:col-start-3", "tw:row-start-1", "tw:self-start", "tw:flex", "tw:items-center", "tw:gap-1", "tw:ml-3", className),
|
|
61
57
|
...props
|
|
62
58
|
});
|
|
63
59
|
//#endregion
|
|
@@ -66,7 +62,7 @@ const ModalActions = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
66
62
|
const ModalHeader = ({ className, icon, description, "aria-description": ariaDescription, actions, hideCloseIcon = false, children, ...props }) => /* @__PURE__ */ jsxs("div", {
|
|
67
63
|
...props,
|
|
68
64
|
"data-slot": "modal-header",
|
|
69
|
-
className: cn("tw:grid", "tw:grid-cols-[auto_1fr_auto]", "tw:items-center", "tw:
|
|
65
|
+
className: cn("tw:grid", "tw:grid-cols-[auto_1fr_auto]", "tw:items-center", "tw:px-4", className),
|
|
70
66
|
children: [
|
|
71
67
|
icon,
|
|
72
68
|
children && /* @__PURE__ */ jsx(ModalTitle, {
|
|
@@ -87,10 +83,6 @@ const ModalHeader = ({ className, icon, description, "aria-description": ariaDes
|
|
|
87
83
|
(description || ariaDescription) && /* @__PURE__ */ jsx(ModalDescription, {
|
|
88
84
|
className: cn("tw:col-start-1", "tw:col-end-4", "tw:row-start-2", description ? "tw:mt-1" : "tw:sr-only"),
|
|
89
85
|
children: description ?? ariaDescription
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ jsx("div", {
|
|
92
|
-
className: cn("tw:col-start-1", "tw:col-end-4", "tw:mt-5", "tw:hidden", "tw:group-data-[argo=false]/modal:[[data-slot=modal-header]:has(~[data-slot=modal-body])_&]:block", "tw:group-data-[argo=false]/modal:[[data-slot=modal-header]:has(~[data-slot=modal-body]_[data-slot=tabs-root])_&]:!hidden"),
|
|
93
|
-
children: /* @__PURE__ */ jsx(Separator, { orientation: "horizontal" })
|
|
94
86
|
})
|
|
95
87
|
]
|
|
96
88
|
});
|
|
@@ -107,31 +99,20 @@ const NAMED_COLORS = /* @__PURE__ */ new Set([
|
|
|
107
99
|
/**
|
|
108
100
|
* Status-coloured icon for `Modal`, authored inside `Modal.Header`; remote images use `Modal.Image`.
|
|
109
101
|
*
|
|
110
|
-
* -
|
|
111
|
-
* - Argo (`data-argo` on `Modal.Content`): soft-tinted inline badge next to the title.
|
|
112
|
-
* - CSS (`group-data-[argo=true]/modal:`) toggles the two, no context.
|
|
102
|
+
* - Soft-tinted inline badge in the header grid's first column, next to the title.
|
|
113
103
|
* - `color` is categorical (`red` destructive … `violet` agent), fixed across brand themes.
|
|
114
104
|
*/
|
|
115
105
|
const ModalIcon = ({ color, icon }) => {
|
|
116
106
|
const customColor = color && !NAMED_COLORS.has(color) ? color : void 0;
|
|
117
107
|
return /* @__PURE__ */ jsx("span", {
|
|
118
108
|
"data-slot": "modal-icon",
|
|
119
|
-
className: cn("tw:flex", "tw:shrink-0", "tw:items-center", "tw:justify-center", "tw:[&_svg]:aspect-square", "tw:
|
|
120
|
-
"tw:
|
|
121
|
-
"tw:
|
|
122
|
-
"tw:
|
|
123
|
-
"tw:
|
|
124
|
-
"tw:
|
|
125
|
-
"tw:
|
|
126
|
-
"tw:group-data-[argo=false]/modal:text-white": color !== "violet",
|
|
127
|
-
"tw:group-data-[argo=false]/modal:text-purple-500": color === "violet"
|
|
128
|
-
}, {
|
|
129
|
-
"tw:group-data-[argo=true]/modal:bg-warning-100 tw:group-data-[argo=true]/modal:text-warning-500": color === "orange",
|
|
130
|
-
"tw:group-data-[argo=true]/modal:bg-blue-100 tw:group-data-[argo=true]/modal:text-blue-600": color === "blue",
|
|
131
|
-
"tw:group-data-[argo=true]/modal:bg-green-100 tw:group-data-[argo=true]/modal:text-green-900": color === "green",
|
|
132
|
-
"tw:group-data-[argo=true]/modal:bg-error-100 tw:group-data-[argo=true]/modal:text-error-500": color === "red",
|
|
133
|
-
"tw:group-data-[argo=true]/modal:bg-neutral-100 tw:group-data-[argo=true]/modal:text-neutral-500": color === "gray",
|
|
134
|
-
"tw:group-data-[argo=true]/modal:bg-purple-100 tw:group-data-[argo=true]/modal:text-purple-500": color === "violet"
|
|
109
|
+
className: cn("tw:flex", "tw:shrink-0", "tw:items-center", "tw:justify-center", "tw:[&_svg]:aspect-square", "tw:col-start-1", "tw:row-start-1", "tw:self-start", "tw:mr-3", "tw:size-8", "tw:rounded", "tw:overflow-hidden", "tw:[&_svg:not([class*=\"tw:size-\"])]:size-5", {
|
|
110
|
+
"tw:bg-warning-100 tw:text-warning-500 tw:[[data-theme=dark]_&]:bg-warning-900 tw:[[data-theme=dark]_&]:text-warning-200": color === "orange",
|
|
111
|
+
"tw:bg-blue-100 tw:text-blue-600 tw:[[data-theme=dark]_&]:bg-blue-900 tw:[[data-theme=dark]_&]:text-blue-200": color === "blue",
|
|
112
|
+
"tw:bg-green-100 tw:text-green-900 tw:[[data-theme=dark]_&]:bg-green-900 tw:[[data-theme=dark]_&]:text-green-200": color === "green",
|
|
113
|
+
"tw:bg-error-100 tw:text-error-500 tw:[[data-theme=dark]_&]:bg-error-900 tw:[[data-theme=dark]_&]:text-error-200": color === "red",
|
|
114
|
+
"tw:bg-neutral-100 tw:text-neutral-500 tw:[[data-theme=dark]_&]:bg-neutral-700 tw:[[data-theme=dark]_&]:text-neutral-300": color === "gray",
|
|
115
|
+
"tw:bg-purple-100 tw:text-purple-500 tw:[[data-theme=dark]_&]:bg-purple-900 tw:[[data-theme=dark]_&]:text-purple-200": color === "violet"
|
|
135
116
|
}, { "tw:text-white": !!customColor }),
|
|
136
117
|
style: customColor ? { backgroundColor: customColor } : void 0,
|
|
137
118
|
children: icon
|
|
@@ -145,7 +126,7 @@ const ModalImage = ({ src, alt = "" }) => {
|
|
|
145
126
|
if (hasImageError) return null;
|
|
146
127
|
return /* @__PURE__ */ jsx("span", {
|
|
147
128
|
"data-slot": "modal-image",
|
|
148
|
-
className: cn("tw:shrink-0", "tw:overflow-hidden", "tw:
|
|
129
|
+
className: cn("tw:shrink-0", "tw:overflow-hidden", "tw:flex", "tw:col-start-1", "tw:row-start-1", "tw:self-start", "tw:mr-3", "tw:items-center", "tw:justify-center", "tw:rounded", "tw:size-8"),
|
|
149
130
|
children: /* @__PURE__ */ jsx("img", {
|
|
150
131
|
src,
|
|
151
132
|
alt,
|
|
@@ -178,4 +159,4 @@ Modal.Overlay = ModalOverlay;
|
|
|
178
159
|
//#endregion
|
|
179
160
|
export { Modal };
|
|
180
161
|
|
|
181
|
-
//# sourceMappingURL=Modal-
|
|
162
|
+
//# sourceMappingURL=Modal-CbUz-5YH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal-CbUz-5YH.js","names":[],"sources":["../src/components/Modal/ModalBody.tsx","../src/components/Modal/ModalContent.tsx","../src/components/Modal/ModalFooter.tsx","../src/components/Modal/ModalActions.tsx","../src/components/Modal/ModalHeader.tsx","../src/components/Modal/ModalIcon.tsx","../src/components/Modal/ModalImage.tsx","../src/components/Modal/Modal.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\n/** Props for `Modal.Body`. Accepts all `<div>` attributes; `as=\"form\"` is reserved for future use. */\ntype Props = ComponentProps<'div'> & {\n as?: 'form';\n};\n\n/**\n * Scrollable body slot for `Modal`. Place form fields, content blocks, or detail panels here.\n * Takes available height inside `Modal.Content` and scrolls when content overflows.\n */\nexport const ModalBody = ({ className, ...props }: Props) => (\n <div\n data-slot=\"modal-body\"\n className={cn(\n // scrollable body - takes available space and scrolls when content overflows\n 'tw:flex-1',\n 'tw:overflow-y-auto',\n\n // soft top/bottom edge fade in place of header/footer separators (pure-CSS utility)\n 'tw:scroll-fade-y',\n\n // Own horizontal padding, matching Header/Footer so content edges align (ModalContent adds none)\n 'tw:px-4',\n 'tw:py-1',\n\n // normalize nested Lucide icon sizing, matching Popover/HoverCard/Alert content surfaces\n \"tw:[&_svg.lucide:not([class*='tw:size-'])]:size-4\",\n 'tw:[&_svg]:shrink-0',\n className,\n )}\n {...props}\n />\n);\n","import type { ComponentProps } from 'react';\nimport { Content, Portal } from '@radix-ui/react-dialog';\n\nimport { cn } from '../../utils';\n\nimport { ModalOverlay } from './ModalOverlay';\n\ntype Props = ComponentProps<typeof Content> & {\n size?: 'small' | 'medium' | 'large';\n /** `top` keeps a form that changes height in place; ignored by the legacy brand (always top-anchored). */\n align?: 'center' | 'top';\n};\n\nexport const ModalContent = ({\n size = 'medium',\n align = 'center',\n className,\n children,\n onEscapeKeyDown,\n ...props\n}: Props) => {\n const handleEscapeKeyDown: typeof onEscapeKeyDown = (event) => {\n // Keeps parent modals (e.g. FullScreenModal) open\n event.stopPropagation();\n onEscapeKeyDown?.(event);\n };\n\n return (\n <Portal>\n <ModalOverlay>\n <Content\n // props first so callers can't override the computed data-size\n {...props}\n data-size={size}\n data-align={align}\n className={cn(\n 'tailwindcss-preflight',\n 'tw:group/modal',\n\n 'tw:fixed',\n 'tw:left-1/2',\n 'tw:-translate-x-1/2',\n 'tw:z-[1051]',\n\n 'tw:top-1/2',\n 'tw:-translate-y-1/2',\n 'tw:data-[align=top]:top-20',\n 'tw:data-[align=top]:translate-y-0',\n\n 'tw:w-full',\n 'tw:max-w-2xl',\n 'tw:max-h-[calc(100vh-2*theme(spacing.20))]',\n\n 'tw:flex',\n 'tw:flex-col',\n 'tw:gap-4',\n 'tw:rounded-modal',\n 'tw:bg-card',\n 'tw:text-card-foreground',\n\n // Vertical padding here survives an omitted Header/Footer; horizontal is theirs, so the\n // Body scrollbar sits at the modal edge.\n 'tw:py-4',\n\n 'tw:duration-200',\n 'tw:data-[state=open]:animate-in',\n 'tw:data-[state=open]:fade-in-0',\n 'tw:data-[state=closed]:animate-out',\n 'tw:data-[state=closed]:fade-out-0',\n\n // No -1/2 slide classes: centring uses `translate`, the animation `transform`; they\n // compose, so a -50% slide would stack to -100% and fly in from the top-left.\n 'tw:data-[state=open]:zoom-in-95',\n 'tw:data-[state=closed]:zoom-out-95',\n\n {\n 'tw:max-w-[480px]': size === 'small',\n 'tw:max-w-4xl': size === 'large',\n },\n\n className,\n )}\n onEscapeKeyDown={handleEscapeKeyDown}\n >\n {children}\n </Content>\n </ModalOverlay>\n </Portal>\n );\n};\n","import type { ComponentPropsWithRef } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentPropsWithRef<'div'>;\n\n/**\n * The modal's action row.\n *\n * - A child that should fill the row carries `tw:w-full` itself; the footer is already full width.\n * - tailwind-merge replaces only within a group: `tw:flex-col` keeps `items-center`, so add `tw:items-stretch`.\n */\nexport const ModalFooter = ({ className, ...props }: Props) => (\n <div\n {...props}\n className={cn('tw:flex', 'tw:items-center', 'tw:justify-end', 'tw:gap-2', 'tw:px-4', className)}\n />\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'div'>;\n\n/**\n * Container for the header's top-right controls — any `actions` passed to `Modal.Header` plus the\n * close icon. Sits in the header grid's last column, top-aligned. Mirrors `Alert`'s action slot.\n */\nexport const ModalActions = ({ className, ...props }: Props) => (\n <div\n className={cn(\n 'tw:col-start-3',\n 'tw:row-start-1',\n 'tw:self-start',\n 'tw:flex',\n 'tw:items-center',\n 'tw:gap-1',\n // gutter from the title, carried here so the header grid needs no column gap\n 'tw:ml-3',\n className,\n )}\n {...props}\n />\n);\n","import type { ComponentProps, ReactNode } from 'react';\nimport { Close } from '@radix-ui/react-dialog';\n\nimport { X } from '../../icons';\nimport { cn } from '../../utils';\nimport { Button } from '../Button';\n\nimport { ModalActions } from './ModalActions';\nimport { ModalDescription } from './ModalDescription';\nimport { ModalTitle } from './ModalTitle';\n\ntype Props = {\n /** Status icon slot — `<Modal.Icon />` or `<Modal.Image />`. */\n icon?: ReactNode;\n /** Visible subtitle below the title (also fills `aria-describedby`). */\n description?: ReactNode;\n /** Screen-reader-only description; fills `aria-describedby` without rendering visibly. */\n 'aria-description'?: string;\n /** Controls rendered top-right, before the close icon. */\n actions?: ReactNode;\n /** Hide the top-right close icon. */\n hideCloseIcon?: boolean;\n} & ComponentProps<'div'>;\n\n/** Modal header: `[icon] | title (children) | actions + close` on row 1, `description` on row 2. */\nexport const ModalHeader = ({\n className,\n icon,\n description,\n 'aria-description': ariaDescription,\n actions,\n hideCloseIcon = false,\n children,\n ...props\n}: Props) => (\n <div\n {...props}\n data-slot=\"modal-header\"\n className={cn(\n 'tw:grid',\n 'tw:grid-cols-[auto_1fr_auto]',\n 'tw:items-center',\n 'tw:px-4',\n className,\n )}\n >\n {icon}\n\n {children && <ModalTitle className=\"tw:col-start-2 tw:row-start-1\">{children}</ModalTitle>}\n {(actions || !hideCloseIcon) && (\n <ModalActions>\n {actions}\n {!hideCloseIcon && (\n <Close asChild>\n <Button variant=\"invisible\" size=\"icon-sm\">\n <X />\n <span className=\"tw:sr-only\">Close</span>\n </Button>\n </Close>\n )}\n </ModalActions>\n )}\n {(description || ariaDescription) && (\n <ModalDescription\n className={cn(\n 'tw:col-start-1',\n 'tw:col-end-4',\n 'tw:row-start-2',\n description ? 'tw:mt-1' : 'tw:sr-only',\n )}\n >\n {description ?? ariaDescription}\n </ModalDescription>\n )}\n </div>\n);\n","import type { ReactNode } from 'react';\n\nimport { cn } from '../../utils';\n\ntype NamedColor = 'orange' | 'blue' | 'red' | 'green' | 'gray' | 'violet';\n\ntype Props = {\n color: NamedColor | (string & {});\n icon: ReactNode;\n};\n\nconst NAMED_COLORS = new Set<string>(['orange', 'blue', 'red', 'green', 'gray', 'violet']);\n\n/**\n * Status-coloured icon for `Modal`, authored inside `Modal.Header`; remote images use `Modal.Image`.\n *\n * - Soft-tinted inline badge in the header grid's first column, next to the title.\n * - `color` is categorical (`red` destructive … `violet` agent), fixed across brand themes.\n */\nexport const ModalIcon = ({ color, icon }: Props) => {\n const customColor = color && !NAMED_COLORS.has(color) ? color : undefined;\n\n return (\n <span\n data-slot=\"modal-icon\"\n className={cn(\n 'tw:flex',\n 'tw:shrink-0',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:[&_svg]:aspect-square',\n 'tw:col-start-1',\n 'tw:row-start-1',\n 'tw:self-start',\n 'tw:mr-3',\n 'tw:size-8',\n 'tw:rounded',\n 'tw:overflow-hidden',\n 'tw:[&_svg:not([class*=\"tw:size-\"])]:size-5',\n\n {\n 'tw:bg-warning-100 tw:text-warning-500 tw:[[data-theme=dark]_&]:bg-warning-900 tw:[[data-theme=dark]_&]:text-warning-200':\n color === 'orange',\n 'tw:bg-blue-100 tw:text-blue-600 tw:[[data-theme=dark]_&]:bg-blue-900 tw:[[data-theme=dark]_&]:text-blue-200':\n color === 'blue',\n 'tw:bg-green-100 tw:text-green-900 tw:[[data-theme=dark]_&]:bg-green-900 tw:[[data-theme=dark]_&]:text-green-200':\n color === 'green',\n 'tw:bg-error-100 tw:text-error-500 tw:[[data-theme=dark]_&]:bg-error-900 tw:[[data-theme=dark]_&]:text-error-200':\n color === 'red',\n 'tw:bg-neutral-100 tw:text-neutral-500 tw:[[data-theme=dark]_&]:bg-neutral-700 tw:[[data-theme=dark]_&]:text-neutral-300':\n color === 'gray',\n 'tw:bg-purple-100 tw:text-purple-500 tw:[[data-theme=dark]_&]:bg-purple-900 tw:[[data-theme=dark]_&]:text-purple-200':\n color === 'violet',\n },\n\n // custom (non-named) colour\n { 'tw:text-white': !!customColor },\n )}\n style={customColor ? { backgroundColor: customColor } : undefined}\n >\n {icon}\n </span>\n );\n};\n","import { useEffect, useState } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = {\n src: string;\n /** Accessible alt text. Defaults to `\"\"` (decorative) — provide it when the image carries meaning. */\n alt?: string;\n};\n\nexport const ModalImage = ({ src, alt = '' }: Props) => {\n const [hasImageError, setHasImageError] = useState(false);\n\n // Reset the error state when the source changes, so a reused badge (new logo, or a retry after a\n // transient failure) isn't permanently hidden by an earlier onError.\n useEffect(() => setHasImageError(false), [src]);\n\n if (hasImageError) return null;\n\n return (\n <span\n data-slot=\"modal-image\"\n className={cn(\n 'tw:shrink-0',\n 'tw:overflow-hidden',\n\n // inline badge in the header grid's first column\n 'tw:flex',\n 'tw:col-start-1',\n 'tw:row-start-1',\n 'tw:self-start',\n 'tw:mr-3',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:rounded',\n 'tw:size-8',\n )}\n >\n <img\n src={src}\n alt={alt}\n className=\"tw:size-full tw:object-contain\"\n onError={() => setHasImageError(true)}\n />\n </span>\n );\n};\n","import type { ComponentProps } from 'react';\nimport { Close, Root, Trigger } from '@radix-ui/react-dialog';\n\nimport { ModalBody } from './ModalBody';\nimport { ModalContent } from './ModalContent';\nimport { ModalFooter } from './ModalFooter';\nimport { ModalHeader } from './ModalHeader';\nimport { ModalIcon } from './ModalIcon';\nimport { ModalImage } from './ModalImage';\nimport { ModalOverlay } from './ModalOverlay';\n\ntype Props = ComponentProps<typeof Root>;\n\n/**\n * Blocking dialog the user must act on before continuing. Built on Radix Dialog.\n *\n * - Not for side editing (`Sheet`), anchored confirms (`Popconfirm`) or hover previews (`HoverCard`).\n * - `Modal.Content` wraps Header + Body + Footer; a form's `FormBody` goes in Body, its buttons in Footer.\n *\n * @see RECIPES.md#modal-form\n * @see RECIPES.md#confirm-dialog\n */\nexport const Modal = (props: Props) => <Root {...props} />;\n\nModal.Close = Close;\nModal.Trigger = Trigger;\n\nModal.Content = ModalContent;\nModal.Body = ModalBody;\nModal.Icon = ModalIcon;\nModal.Image = ModalImage;\nModal.Footer = ModalFooter;\nModal.Header = ModalHeader;\nModal.Overlay = ModalOverlay;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,aAAa,EAAE,WAAW,GAAG,YACxC,oBAAC,OAAD;CACE,aAAU;CACV,WAAW,GAET,aACA,sBAGA,oBAGA,WACA,WAGA,qDACA,uBACA,SACF;CACA,GAAI;AACL,CAAA;;;ACrBH,MAAa,gBAAgB,EAC3B,OAAO,UACP,QAAQ,UACR,WACA,UACA,iBACA,GAAG,YACQ;CACX,MAAM,uBAA+C,UAAU;EAE7D,MAAM,gBAAgB;EACtB,kBAAkB,KAAK;CACzB;CAEA,OACE,oBAAC,QAAD,EAAA,UACE,oBAAC,cAAD,EAAA,UACE,oBAAC,SAAD;EAEE,GAAI;EACJ,aAAW;EACX,cAAY;EACZ,WAAW,GACT,yBACA,kBAEA,YACA,eACA,uBACA,eAEA,cACA,uBACA,8BACA,qCAEA,aACA,gBACA,8CAEA,WACA,eACA,YACA,oBACA,cACA,2BAIA,WAEA,mBACA,mCACA,kCACA,sCACA,qCAIA,mCACA,sCAEA;GACE,oBAAoB,SAAS;GAC7B,gBAAgB,SAAS;EAC3B,GAEA,SACF;EACA,iBAAiB;EAEhB;CACM,CAAA,EACG,CAAA,EACR,CAAA;AAEZ;;;;;;;;;AC7EA,MAAa,eAAe,EAAE,WAAW,GAAG,YAC1C,oBAAC,OAAD;CACE,GAAI;CACJ,WAAW,GAAG,WAAW,mBAAmB,kBAAkB,YAAY,WAAW,SAAS;AAC/F,CAAA;;;;;;;ACNH,MAAa,gBAAgB,EAAE,WAAW,GAAG,YAC3C,oBAAC,OAAD;CACE,WAAW,GACT,kBACA,kBACA,iBACA,WACA,mBACA,YAEA,WACA,SACF;CACA,GAAI;AACL,CAAA;;;;ACCH,MAAa,eAAe,EAC1B,WACA,MACA,aACA,oBAAoB,iBACpB,SACA,gBAAgB,OAChB,UACA,GAAG,YAEH,qBAAC,OAAD;CACE,GAAI;CACJ,aAAU;CACV,WAAW,GACT,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OAAO;CAE1B,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,eACA,sBAGA,WACA,kBACA,kBACA,iBACA,WACA,mBACA,qBACA,cACA,WACF;EAEA,UAAA,oBAAC,OAAD;GACO;GACA;GACL,WAAU;GACV,eAAe,iBAAiB,IAAI;EACrC,CAAA;CACG,CAAA;AAEV;;;;;;;;;;;;ACxBA,MAAa,SAAS,UAAiB,oBAAC,MAAD,EAAM,GAAI,MAAQ,CAAA;AAEzD,MAAM,QAAQ;AACd,MAAM,UAAU;AAEhB,MAAM,UAAU;AAChB,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,UAAU"}
|
|
@@ -12,7 +12,7 @@ const ModalOverlay = ({ ref, className, disableTransition = false, ...props }) =
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/components/Modal/ModalDescription.tsx
|
|
14
14
|
const ModalDescription = ({ className, ...props }) => /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
15
|
-
className: cn("tw:wrap-anywhere", "tw:text-sm", "tw:font-sans", "tw:tracking-normal", "tw:font-normal", "tw:text-
|
|
15
|
+
className: cn("tw:wrap-anywhere", "tw:text-sm", "tw:font-sans", "tw:tracking-normal", "tw:font-normal", "tw:text-muted-foreground", className),
|
|
16
16
|
...props
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
@@ -25,4 +25,4 @@ const ModalTitle = ({ children, className, ...props }) => /* @__PURE__ */ jsx(Ti
|
|
|
25
25
|
//#endregion
|
|
26
26
|
export { ModalDescription, ModalOverlay, ModalTitle };
|
|
27
27
|
|
|
28
|
-
//# sourceMappingURL=ModalTitle-
|
|
28
|
+
//# sourceMappingURL=ModalTitle-cy0Ht9VY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalTitle-
|
|
1
|
+
{"version":3,"file":"ModalTitle-cy0Ht9VY.js","names":[],"sources":["../src/components/Modal/ModalOverlay.tsx","../src/components/Modal/ModalDescription.tsx","../src/components/Modal/ModalTitle.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { Overlay } from '@radix-ui/react-dialog';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<typeof Overlay> & {\n disableTransition?: boolean;\n};\n\nexport const ModalOverlay = ({ ref, className, disableTransition = false, ...props }: Props) => (\n <Overlay\n {...props}\n ref={ref}\n className={cn(\n // positioning\n 'tw:fixed',\n 'tw:inset-0',\n 'tw:z-[1051]',\n\n // background\n 'tw:bg-scrim',\n\n // opening animation\n 'tw:data-[state=open]:duration-500',\n 'tw:data-[state=open]:fade-in-0',\n\n // closing animation\n 'tw:data-[state=closed]:duration-500',\n 'tw:data-[state=closed]:fade-out-0',\n {\n 'tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out': !disableTransition,\n },\n className,\n )}\n onClick={(event) => event.stopPropagation()}\n />\n);\n","import type { ComponentProps } from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<typeof DialogPrimitive.Description>;\n\nexport const ModalDescription = ({ className, ...props }: Props) => (\n <DialogPrimitive.Description\n className={cn(\n // `wrap-anywhere` because the slot routinely carries an identifier — a Storage table id, a\n // fully-qualified name — which offers no break opportunity and paints outside the frame\n // without one. `ModalTitle` carries it for the same reason.\n 'tw:wrap-anywhere',\n 'tw:text-sm',\n 'tw:font-sans',\n 'tw:tracking-normal',\n 'tw:font-normal',\n 'tw:text-muted-foreground',\n className,\n )}\n {...props}\n />\n);\n","import type { ComponentProps } from 'react';\nimport { Title } from '@radix-ui/react-dialog';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<typeof Title>;\n\nexport const ModalTitle = ({ children, className, ...props }: Props) => (\n <Title\n {...props}\n className={cn('tw:flex-1', 'tw:wrap-anywhere', 'tw:text-base', 'tw:font-semibold', className)}\n >\n {children}\n </Title>\n);\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,KAAK,WAAW,oBAAoB,OAAO,GAAG,YAC3E,oBAAC,SAAD;CACE,GAAI;CACC;CACL,WAAW,GAET,YACA,cACA,eAGA,eAGA,qCACA,kCAGA,uCACA,qCACA,EACE,sEAAsE,CAAC,kBACzE,GACA,SACF;CACA,UAAU,UAAU,MAAM,gBAAgB;AAC3C,CAAA;;;AC5BH,MAAa,oBAAoB,EAAE,WAAW,GAAG,YAC/C,oBAAC,gBAAgB,aAAjB;CACE,WAAW,GAIT,oBACA,cACA,gBACA,sBACA,kBACA,4BACA,SACF;CACA,GAAI;AACL,CAAA;;;ACfH,MAAa,cAAc,EAAE,UAAU,WAAW,GAAG,YACnD,oBAAC,OAAD;CACE,GAAI;CACJ,WAAW,GAAG,aAAa,oBAAoB,gBAAgB,oBAAoB,SAAS;CAE3F;AACI,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "./classNames-DcGnTh2N.js";
|
|
2
|
-
import { Tooltip } from "./utils-
|
|
3
|
-
import { Button } from "./Button-
|
|
2
|
+
import { Tooltip } from "./utils-DwC9u0tM.js";
|
|
3
|
+
import { Button } from "./Button-BNkyYU8u.js";
|
|
4
4
|
import { ButtonGroup } from "./internal/components/ButtonGroup.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/blocks/MultiActionButtonGroup/MultiActionButton.tsx
|
|
@@ -30,4 +30,4 @@ MultiActionButtonGroup.Button = MultiActionButton;
|
|
|
30
30
|
//#endregion
|
|
31
31
|
export { MultiActionButtonGroup };
|
|
32
32
|
|
|
33
|
-
//# sourceMappingURL=MultiActionButtonGroup-
|
|
33
|
+
//# sourceMappingURL=MultiActionButtonGroup-Dzig87s1.js.map
|
package/dist/{MultiActionButtonGroup-CEv_txvz.js.map → MultiActionButtonGroup-Dzig87s1.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiActionButtonGroup-
|
|
1
|
+
{"version":3,"file":"MultiActionButtonGroup-Dzig87s1.js","names":[],"sources":["../src/blocks/MultiActionButtonGroup/MultiActionButton.tsx","../src/blocks/MultiActionButtonGroup/MultiActionButtonGroup.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport { Button } from '../../components/Button';\nimport { Tooltip } from '../../components/Tooltip';\n\ntype Props = {\n disabled?: boolean;\n icon: ReactNode;\n isLoading?: boolean;\n label: string;\n onClick: ComponentProps<typeof Button>['onClick'];\n tooltipContent: ReactNode;\n tooltipVariant?: ComponentProps<typeof Tooltip>['variant'];\n 'data-testid'?: string;\n};\n\nexport const MultiActionButton = ({\n disabled,\n icon,\n isLoading,\n label,\n onClick,\n tooltipContent,\n tooltipVariant,\n 'data-testid': dataTestId,\n}: Props) => (\n <Tooltip placement=\"top\" tooltip={tooltipContent} triggerAsChild variant={tooltipVariant}>\n <Button\n disabled={disabled}\n isLoading={isLoading}\n aria-label={label}\n onClick={onClick}\n variant=\"invisible\"\n size=\"icon\"\n data-testid={dataTestId}\n >\n {icon}\n </Button>\n </Tooltip>\n);\n","import type { PropsWithChildren } from 'react';\n\nimport { ButtonGroup } from '../../components/ButtonGroup';\nimport { cn } from '../../utils';\n\nimport { MultiActionButton } from './MultiActionButton';\n\ntype Props = {\n className?: string;\n} & PropsWithChildren;\n\nexport const MultiActionButtonGroup = ({ children, className }: Props) => (\n <ButtonGroup className={cn('tw:text-nowrap', className)}>{children}</ButtonGroup>\n);\n\nMultiActionButtonGroup.Button = MultiActionButton;\n"],"mappings":";;;;;;AAgBA,MAAa,qBAAqB,EAChC,UACA,MACA,WACA,OACA,SACA,gBACA,gBACA,eAAe,iBAEf,oBAAC,SAAD;CAAS,WAAU;CAAM,SAAS;CAAgB,gBAAA;CAAe,SAAS;CACxE,UAAA,oBAAC,QAAD;EACY;EACC;EACX,cAAY;EACH;EACT,SAAQ;EACR,MAAK;EACL,eAAa;EAEZ,UAAA;CACK,CAAA;AACD,CAAA;;;AC3BX,MAAa,0BAA0B,EAAE,UAAU,gBACjD,oBAAC,aAAD;CAAa,WAAW,GAAG,kBAAkB,SAAS;CAAI;AAAsB,CAAA;AAGlF,uBAAuB,SAAS"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "./classNames-DcGnTh2N.js";
|
|
2
2
|
import { Search } from "./icons-ZIeZXXS7.js";
|
|
3
3
|
import { ScrollArea } from "./internal/components/ScrollArea.js";
|
|
4
|
-
import { BrandLogo } from "./BrandLogo-
|
|
4
|
+
import { BrandLogo } from "./BrandLogo-DkESE19K.js";
|
|
5
5
|
import { Root, Slot, Slottable } from "@radix-ui/react-slot";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -322,4 +322,4 @@ Navbar.MenuAvatar = NavbarMenuAvatar;
|
|
|
322
322
|
//#endregion
|
|
323
323
|
export { Navbar };
|
|
324
324
|
|
|
325
|
-
//# sourceMappingURL=Navbar-
|
|
325
|
+
//# sourceMappingURL=Navbar-DHUS7XiU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navbar-CtVYcRFn.js","names":["variants","variants"],"sources":["../src/components/Navbar/NavbarContent.tsx","../src/components/Navbar/NavbarFooter.tsx","../src/components/Navbar/NavbarHeader.tsx","../src/components/Navbar/NavbarMenu.tsx","../src/components/Navbar/NavbarMenuAvatar.tsx","../src/components/Navbar/NavbarMenuItemAdornment.tsx","../src/components/Navbar/NavbarMenuButton.tsx","../src/components/Navbar/NavbarMenuItem.tsx","../src/components/Navbar/Navbar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn } from '../../utils';\nimport { ScrollArea } from '../ScrollArea';\n\ntype Props = {\n className?: string;\n children?: ReactNode;\n};\n\nexport const NavbarContent = ({ children, className }: Props) => (\n <ScrollArea\n type=\"auto\"\n orientation=\"horizontal\"\n className=\"tw:flex-1\"\n scrollBarClassName=\"tw:h-1.5\"\n >\n <div className={cn('tw:flex', 'tw:py-1.5', className)}>{children}</div>\n </ScrollArea>\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'div'>;\n\n// `flex items-center`, not a bare block: this slot is documented to hold several\n// items (search, notifications, avatar). As a block they are inline-level boxes\n// aligned on a text baseline, so a button carrying an icon and a text-only button\n// sit at different heights — visibly off-centre against the bar. Centring them is\n// a no-op for the common single-`Navbar.Menu` child, and `gap` only applies\n// between siblings, so existing compositions keep their spacing.\nexport const NavbarFooter = ({ children, className, ...rest }: Props) => (\n <div {...rest} className={cn('tw:flex tw:items-center tw:gap-2 tw:py-1.5', className)}>\n {children}\n </div>\n);\n","import { type ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\nimport { BrandLogo } from '../BrandLogo';\n\ntype Props = ComponentProps<'div'>;\n\nexport const NavbarHeader = ({ children, className, ...rest }: Props) => (\n // BrandLogo reads the nearest ThemeProvider (or the default context) and\n // renders null when the active brand ships no logo, so no provider gate needed.\n <div {...rest} className={cn('tw:overflow-hidden', 'tw:py-1.5', className)}>\n {children ?? <BrandLogo variant=\"wordmark\" className=\"tw:h-7\" />}\n </div>\n);\n","import type { ComponentProps } from 'react';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\n// `tw:m-0` alongside `tw:p-0`: browsers give `<ul>` a default block margin. In a plain\n// app the scoped preflight resets it, but in kbc-ui the legacy Bootstrap layer (which sits\n// above the preflight so Bootstrap padding survives on its own elements) re-applies\n// `ul { margin-bottom: 10px }`, which then inflates this menu's height and pushes the whole\n// navbar row off-center. Resetting the margin explicitly (utilities beat the legacy layer)\n// keeps the row centered everywhere.\nconst variants = cva(\n ['tw:m-0', 'tw:p-0', 'tw:flex', 'tw:items-center', 'tw:justify-center', 'tw:gap-2'],\n {\n variants: {\n marker: {\n none: [],\n 'forward-slash': [\n // Style all li children with pseudo-element marker\n 'tw:[&_li]:flex',\n 'tw:[&_li]:items-center',\n 'tw:[&_li]:before:content-[\"/\"]',\n 'tw:[&_li]:before:text-border',\n 'tw:[&_li]:before:text-sm',\n 'tw:[&_li]:before:mr-0.5',\n 'tw:[&_li:not(:first-child)]:before:ml-0.5',\n ],\n },\n },\n defaultVariants: {\n marker: 'none',\n },\n },\n);\n\ntype Props = ComponentProps<'ul'> & VariantProps<typeof variants>;\n\nexport const NavbarMenu = ({ className, marker, ...rest }: Props) => (\n <ul {...rest} className={variants({ marker, className })} />\n);\n","import type { ComponentProps } from 'react';\nimport * as RadixAvatar from '@radix-ui/react-avatar';\nimport BoringAvatar from 'boring-avatars';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'button'> & {\n src?: string;\n alt?: string;\n};\n\nexport const NavbarMenuAvatar = ({ ref, className, type = 'button', src, alt, ...rest }: Props) => {\n const altText = alt ?? 'Avatar';\n\n return (\n <button\n {...rest}\n ref={ref}\n type={type}\n className={cn(\n 'tw:flex',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:size-8',\n\n 'tw:aspect-square',\n 'tw:overflow-hidden',\n 'tw:shrink-0',\n\n 'tw:rounded-lg',\n 'tw:bg-transparent',\n 'tw:cursor-pointer',\n\n // Disabled state\n 'tw:disabled:opacity-disabled',\n 'tw:disabled:cursor-not-allowed',\n\n // Focus-visible (matches SidebarMenuButton exactly)\n 'tw:focus-visible:outline-hidden',\n 'tw:focus-visible:ring-2',\n 'tw:focus-visible:ring-sidebar-ring/50',\n className,\n )}\n >\n <RadixAvatar.Root>\n <RadixAvatar.Image src={src} alt={altText} className=\"tw:size-full tw:object-cover\" />\n\n <RadixAvatar.Fallback asChild>\n <BoringAvatar\n square\n name={altText}\n variant=\"beam\"\n colors={['#1F8FFF', '#004787', '#28D8FF', '#925cff', '#A8C2E6']}\n size={32}\n />\n </RadixAvatar.Fallback>\n </RadixAvatar.Root>\n </button>\n );\n};\n","import type { ComponentProps } from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\nconst variants = cva(\n [\n 'tw:flex',\n 'tw:justify-center',\n 'tw:items-center',\n\n 'tw:[&_svg:not([class*=\"tw:size-\"])]:size-3',\n 'tw:[&:not(svg)]:h-5',\n 'tw:[&:not(svg)]:min-w-5',\n\n 'tw:p-1',\n 'tw:aspect-square',\n 'tw:rounded-md',\n ],\n {\n defaultVariants: { variant: 'icon-accent' },\n variants: {\n variant: {\n icon: ['tw:text-sidebar-foreground', 'tw:[&_svg]:text-sidebar-foreground'],\n 'icon-emphasized': ['tw:text-white', 'tw:[&_svg]:text-white'],\n 'icon-accent': [\n // color-aware accent styling\n 'tw:group-data-[accent=blue]/navbar:text-sidebar-primary',\n 'tw:group-data-[accent=blue]/navbar:[&_svg]:text-sidebar-primary',\n 'tw:group-data-[accent=purple]/navbar:text-purple-500',\n 'tw:group-data-[accent=purple]/navbar:[&_svg]:text-purple-500',\n 'tw:group-data-[accent=orange]/navbar:text-warning-500',\n 'tw:group-data-[accent=orange]/navbar:[&_svg]:text-warning-500',\n 'tw:group-data-[accent=green]/navbar:text-primary-500',\n 'tw:group-data-[accent=green]/navbar:[&_svg]:text-primary-500',\n ],\n 'icon-accent-emphasized': [\n 'tw:text-white',\n 'tw:[&_svg]:text-white',\n\n 'tw:group-data-[accent=blue]/navbar:bg-sidebar-primary',\n 'tw:group-data-[accent=purple]/navbar:bg-purple-500',\n 'tw:group-data-[accent=orange]/navbar:bg-warning-500',\n 'tw:group-data-[accent=green]/navbar:bg-primary-500',\n ],\n 'icon-button': ['tw:size-4', 'tw:!p-0', 'tw:[&_svg:not([class*=\"tw:size-\"])]:size-4'],\n shortcut: ['tw:bg-muted', 'tw:text-sidebar-foreground', 'tw:ml-auto'],\n },\n },\n },\n);\n\ntype Props = { asChild?: boolean } & ComponentProps<'span'> & VariantProps<typeof variants>;\n\nexport const NavbarMenuItemAdornment = ({\n ref,\n asChild = false,\n className,\n variant = 'icon-accent',\n ...props\n}: Props) => {\n const Comp = asChild ? Slot : 'span';\n\n return <Comp {...props} ref={ref} className={variants({ variant, className })} />;\n};\n","import type { ComponentProps, ReactNode } from 'react';\nimport { Root, Slottable } from '@radix-ui/react-slot';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\nimport { Search } from '../../icons';\nimport { cn } from '../../utils';\n\nimport { NavbarMenuItemAdornment } from './NavbarMenuItemAdornment';\n\nconst variants = cva(\n [\n 'tw:group/navbar-menu-button',\n 'tw:box-border',\n 'tw:flex',\n 'tw:items-center',\n 'tw:gap-2',\n 'tw:bg-transparent',\n\n 'tw:leading-9',\n\n 'tw:border',\n 'tw:rounded-lg',\n 'tw:whitespace-nowrap',\n 'tw:select-none',\n\n // focus-visible\n 'tw:!outline-hidden',\n 'tw:focus-visible:ring-2',\n 'tw:focus-visible:ring-sidebar-ring/50',\n\n // disabled\n 'tw:disabled:opacity-disabled',\n 'tw:disabled:hover:bg-transparent',\n 'tw:disabled:cursor-not-allowed',\n ],\n {\n defaultVariants: {\n variant: 'default',\n },\n variants: {\n variant: {\n default: [\n 'tw:max-h-9',\n 'tw:border-transparent',\n 'tw:py-2',\n 'tw:px-1.5',\n 'tw:text-sidebar-foreground',\n 'tw:hover:bg-sidebar-hover',\n 'tw:aria-expanded:bg-sidebar-hover',\n\n // Active page. Mirrors `Sidebar.MenuButton`, which styles `aria-current=\"page\"` — a top nav\n // needs the same affordance, and without it a Navbar-shelled app cannot show where you are.\n // `aria-current` rather than a prop: with `asChild` the slot is an <a>, and that is the\n // attribute a router sets on an active link (TanStack's `Link` does it for free).\n 'tw:aria-[current=page]:bg-sidebar-selected',\n 'tw:aria-[current=page]:hover:bg-sidebar-selected',\n 'tw:aria-[current=page]:text-[var(--sidebar-selected-foreground,rgb(var(--sidebar-foreground)))]',\n 'tw:aria-[current=page]:font-medium',\n ],\n emphasized: [\n 'tw:max-h-9',\n 'tw:border-transparent',\n 'tw:py-2',\n 'tw:px-1.5',\n\n 'tw:text-sidebar-foreground',\n 'tw:hover:bg-sidebar-hover',\n 'tw:aria-expanded:bg-sidebar-hover',\n\n 'tw:aria-[current=page]:bg-sidebar-selected',\n 'tw:aria-[current=page]:hover:bg-sidebar-selected',\n 'tw:aria-[current=page]:text-[var(--sidebar-selected-foreground,rgb(var(--sidebar-foreground)))]',\n\n 'tw:font-semibold',\n ],\n icon: [\n 'tw:size-8',\n 'tw:aspect-square',\n 'tw:justify-center',\n 'tw:font-normal',\n 'tw:border-transparent',\n 'tw:text-primary',\n 'tw:[&_svg]:!text-primary',\n 'tw:hover:bg-sidebar-hover',\n 'tw:aria-expanded:bg-sidebar-hover',\n ],\n search: [\n 'tw:max-h-8',\n 'tw:min-w-52',\n 'tw:px-3',\n 'tw:py-1',\n 'tw:font-normal',\n 'tw:border-input',\n 'tw:text-muted-foreground',\n 'tw:[&_svg]:!text-muted-foreground',\n ],\n },\n },\n },\n);\n\ntype Props = ComponentProps<'button'> & {\n /** Optional leading-icon slot. Pass a Lucide icon node to render an adornment before children. */\n icon?: ReactNode;\n asChild?: boolean;\n} & VariantProps<typeof variants>;\n\nexport const NavbarMenuButton = ({\n ref,\n className,\n type = 'button',\n children,\n icon,\n asChild = false,\n variant = 'default',\n ...rest\n}: Props) => {\n const Comp = asChild ? Root : 'button';\n const isSearchVariant = variant === 'search';\n const isEmphasizedVariant = variant === 'emphasized';\n const adornment = isSearchVariant ? <Search /> : icon;\n\n const adornmentVariant: ComponentProps<typeof NavbarMenuItemAdornment>['variant'] = (() => {\n if (isSearchVariant || variant === 'icon') return 'icon-button';\n if (isEmphasizedVariant) return 'icon-accent-emphasized';\n return 'icon-accent';\n })();\n\n return (\n <Comp\n {...rest}\n ref={ref}\n type={type}\n data-variant={variant}\n className={cn(variants({ className, variant }))}\n >\n {adornment && (\n <NavbarMenuItemAdornment variant={adornmentVariant}>{adornment}</NavbarMenuItemAdornment>\n )}\n\n <Slottable>{children}</Slottable>\n </Comp>\n );\n};\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'li'>;\n\nexport const NavbarMenuItem = ({ className, ...rest }: Props) => (\n <li {...rest} className={cn('tw:flex', 'tw:items-center', 'tw:gap-2', className)} />\n);\n","import type { ComponentProps } from 'react';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\nimport { NavbarContent } from './NavbarContent';\nimport { NavbarFooter } from './NavbarFooter';\nimport { NavbarHeader } from './NavbarHeader';\nimport { NavbarMenu } from './NavbarMenu';\nimport { NavbarMenuAvatar } from './NavbarMenuAvatar';\nimport { NavbarMenuButton } from './NavbarMenuButton';\nimport { NavbarMenuItem } from './NavbarMenuItem';\nimport { NavbarMenuItemAdornment } from './NavbarMenuItemAdornment';\n\nconst navbarClassnames = cva(\n [\n 'tailwindcss-preflight',\n 'tw:group/navbar',\n 'tw:sticky',\n 'tw:top-0',\n 'tw:z-50',\n 'tw:flex',\n 'tw:gap-2',\n 'tw:items-center',\n\n // The left side is intentionally smaller to align the logo with the sidebar icons.\n 'tw:pl-2',\n 'tw:pr-3',\n\n 'tw:bg-sidebar',\n // Required with `bg-sidebar`: otherwise `currentColor` (text, `BrandLogo`) is black on dark.\n 'tw:text-sidebar-foreground',\n 'tw:text-xs',\n 'tw:leading-4',\n ],\n {\n defaultVariants: {\n bordered: false,\n },\n variants: {\n bordered: {\n true: [\n 'tw:before:content',\n 'tw:before:h-0.5',\n 'tw:before:w-full',\n 'tw:before:absolute',\n 'tw:before:left-0',\n 'tw:before:top-0',\n 'tw:data-[accent=blue]:before:bg-sidebar-primary',\n 'tw:data-[accent=purple]:before:bg-purple-500',\n 'tw:data-[accent=green]:before:bg-primary-500',\n 'tw:data-[accent=orange]:before:bg-warning-500',\n ],\n false: '',\n },\n },\n },\n);\n\ntype Props = ComponentProps<'nav'> &\n VariantProps<typeof navbarClassnames> & {\n accent?: 'blue' | 'purple' | 'green' | 'orange';\n };\n\n/**\n * Top navigation bar for the app shell, hosted inside `<AppShell.Header>`.\n *\n * - Composition: `Navbar.Header` (brand), `Navbar.Content` (scrollable menu), `Navbar.Footer`.\n * - `bordered` adds a top hairline coloured by `accent`.\n * - Override the default `aria-label` when a page has more than one nav.\n *\n * @see AppShell — the sidebar rail uses `Sidebar` instead.\n */\nexport const Navbar = ({ className, accent = 'blue', bordered = false, ...rest }: Props) => (\n // - `<nav>`, not `<header>`: `AppShell.Header` is already the `<header>` landmark.\n // - `aria-label` precedes `...rest` so a caller's label wins.\n <nav\n aria-label=\"Main navigation\"\n {...rest}\n // `Tooltip` reads this: a trigger inside the bar gets the argo tooltip under any brand.\n data-slot=\"navbar\"\n data-accent={accent}\n className={navbarClassnames({ bordered, className })}\n />\n);\n\nNavbar.Header = NavbarHeader;\nNavbar.Footer = NavbarFooter;\nNavbar.Content = NavbarContent;\n\nNavbar.Menu = NavbarMenu;\nNavbar.MenuItem = NavbarMenuItem;\nNavbar.MenuButton = NavbarMenuButton;\nNavbar.MenuItemAdornment = NavbarMenuItemAdornment;\nNavbar.MenuAvatar = NavbarMenuAvatar;\n"],"mappings":";;;;;;;;;;AAUA,MAAa,iBAAiB,EAAE,UAAU,gBACxC,oBAAC,YAAD;CACE,MAAK;CACL,aAAY;CACZ,WAAU;CACV,oBAAmB;CAEnB,UAAA,oBAAC,OAAD;EAAK,WAAW,GAAG,WAAW,aAAa,SAAS;EAAI;CAAc,CAAA;AAC5D,CAAA;;;ACNd,MAAa,gBAAgB,EAAE,UAAU,WAAW,GAAG,WACrD,oBAAC,OAAD;CAAK,GAAI;CAAM,WAAW,GAAG,8CAA8C,SAAS;CACjF;AACE,CAAA;;;ACRP,MAAa,gBAAgB,EAAE,UAAU,WAAW,GAAG,WAGrD,oBAAC,OAAD;CAAK,GAAI;CAAM,WAAW,GAAG,sBAAsB,aAAa,SAAS;CACtE,UAAA,YAAY,oBAAC,WAAD;EAAW,SAAQ;EAAW,WAAU;CAAU,CAAA;AAC5D,CAAA;;;ACFP,MAAMA,aAAW,IACf;CAAC;CAA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GAAmB,UAAA;EAAmC,CAAA,GAG1F,oBAAC,WAAD,EAAY,SAAoB,CAAA,CAC5B;;AAEV;;;AC1IA,MAAa,kBAAkB,EAAE,WAAW,GAAG,WAC7C,oBAAC,MAAD;CAAI,GAAI;CAAM,WAAW,GAAG,WAAW,mBAAmB,YAAY,SAAS;AAAI,CAAA;;;ACMrF,MAAM,mBAAmB,IACvB;CACE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CAEA;CAEA;CACA;CACA;AACF,GACA;CACE,iBAAiB,EACf,UAAU,MACZ;CACA,UAAU,EACR,UAAU;EACR,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,OAAO;CACT,EACF;AACF,CACF;;;;;;;;;;AAgBA,MAAa,UAAU,EAAE,WAAW,SAAS,QAAQ,WAAW,OAAO,GAAG,WAGxE,oBAAC,OAAD;CACE,cAAW;CACX,GAAI;CAEJ,aAAU;CACV,eAAa;CACb,WAAW,iBAAiB;EAAE;EAAU;CAAU,CAAC;AACpD,CAAA;AAGH,OAAO,SAAS;AAChB,OAAO,SAAS;AAChB,OAAO,UAAU;AAEjB,OAAO,OAAO;AACd,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,OAAO,oBAAoB;AAC3B,OAAO,aAAa"}
|
|
1
|
+
{"version":3,"file":"Navbar-DHUS7XiU.js","names":["variants","variants"],"sources":["../src/components/Navbar/NavbarContent.tsx","../src/components/Navbar/NavbarFooter.tsx","../src/components/Navbar/NavbarHeader.tsx","../src/components/Navbar/NavbarMenu.tsx","../src/components/Navbar/NavbarMenuAvatar.tsx","../src/components/Navbar/NavbarMenuItemAdornment.tsx","../src/components/Navbar/NavbarMenuButton.tsx","../src/components/Navbar/NavbarMenuItem.tsx","../src/components/Navbar/Navbar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn } from '../../utils';\nimport { ScrollArea } from '../ScrollArea';\n\ntype Props = {\n className?: string;\n children?: ReactNode;\n};\n\nexport const NavbarContent = ({ children, className }: Props) => (\n <ScrollArea\n type=\"auto\"\n orientation=\"horizontal\"\n className=\"tw:flex-1\"\n scrollBarClassName=\"tw:h-1.5\"\n >\n <div className={cn('tw:flex', 'tw:py-1.5', className)}>{children}</div>\n </ScrollArea>\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'div'>;\n\n// `flex items-center`, not a bare block: this slot is documented to hold several\n// items (search, notifications, avatar). As a block they are inline-level boxes\n// aligned on a text baseline, so a button carrying an icon and a text-only button\n// sit at different heights — visibly off-centre against the bar. Centring them is\n// a no-op for the common single-`Navbar.Menu` child, and `gap` only applies\n// between siblings, so existing compositions keep their spacing.\nexport const NavbarFooter = ({ children, className, ...rest }: Props) => (\n <div {...rest} className={cn('tw:flex tw:items-center tw:gap-2 tw:py-1.5', className)}>\n {children}\n </div>\n);\n","import { type ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\nimport { BrandLogo } from '../BrandLogo';\n\ntype Props = ComponentProps<'div'>;\n\nexport const NavbarHeader = ({ children, className, ...rest }: Props) => (\n // BrandLogo reads the nearest ThemeProvider (or the default context) and\n // renders null when the active brand ships no logo, so no provider gate needed.\n <div {...rest} className={cn('tw:overflow-hidden', 'tw:py-1.5', className)}>\n {children ?? <BrandLogo variant=\"wordmark\" className=\"tw:h-7\" />}\n </div>\n);\n","import type { ComponentProps } from 'react';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\n// `tw:m-0` alongside `tw:p-0`: browsers give `<ul>` a default block margin. In a plain\n// app the scoped preflight resets it, but in kbc-ui the legacy Bootstrap layer (which sits\n// above the preflight so Bootstrap padding survives on its own elements) re-applies\n// `ul { margin-bottom: 10px }`, which then inflates this menu's height and pushes the whole\n// navbar row off-center. Resetting the margin explicitly (utilities beat the legacy layer)\n// keeps the row centered everywhere.\nconst variants = cva(\n ['tw:m-0', 'tw:p-0', 'tw:flex', 'tw:items-center', 'tw:justify-center', 'tw:gap-2'],\n {\n variants: {\n marker: {\n none: [],\n 'forward-slash': [\n // Style all li children with pseudo-element marker\n 'tw:[&_li]:flex',\n 'tw:[&_li]:items-center',\n 'tw:[&_li]:before:content-[\"/\"]',\n 'tw:[&_li]:before:text-border',\n 'tw:[&_li]:before:text-sm',\n 'tw:[&_li]:before:mr-0.5',\n 'tw:[&_li:not(:first-child)]:before:ml-0.5',\n ],\n },\n },\n defaultVariants: {\n marker: 'none',\n },\n },\n);\n\ntype Props = ComponentProps<'ul'> & VariantProps<typeof variants>;\n\nexport const NavbarMenu = ({ className, marker, ...rest }: Props) => (\n <ul {...rest} className={variants({ marker, className })} />\n);\n","import type { ComponentProps } from 'react';\nimport * as RadixAvatar from '@radix-ui/react-avatar';\nimport BoringAvatar from 'boring-avatars';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'button'> & {\n src?: string;\n alt?: string;\n};\n\nexport const NavbarMenuAvatar = ({ ref, className, type = 'button', src, alt, ...rest }: Props) => {\n const altText = alt ?? 'Avatar';\n\n return (\n <button\n {...rest}\n ref={ref}\n type={type}\n className={cn(\n 'tw:flex',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:size-8',\n\n 'tw:aspect-square',\n 'tw:overflow-hidden',\n 'tw:shrink-0',\n\n 'tw:rounded-lg',\n 'tw:bg-transparent',\n 'tw:cursor-pointer',\n\n // Disabled state\n 'tw:disabled:opacity-disabled',\n 'tw:disabled:cursor-not-allowed',\n\n // Focus-visible (matches SidebarMenuButton exactly)\n 'tw:focus-visible:outline-hidden',\n 'tw:focus-visible:ring-2',\n 'tw:focus-visible:ring-sidebar-ring/50',\n className,\n )}\n >\n <RadixAvatar.Root>\n <RadixAvatar.Image src={src} alt={altText} className=\"tw:size-full tw:object-cover\" />\n\n <RadixAvatar.Fallback asChild>\n <BoringAvatar\n square\n name={altText}\n variant=\"beam\"\n colors={['#1F8FFF', '#004787', '#28D8FF', '#925cff', '#A8C2E6']}\n size={32}\n />\n </RadixAvatar.Fallback>\n </RadixAvatar.Root>\n </button>\n );\n};\n","import type { ComponentProps } from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\nconst variants = cva(\n [\n 'tw:flex',\n 'tw:justify-center',\n 'tw:items-center',\n\n 'tw:[&_svg:not([class*=\"tw:size-\"])]:size-3',\n 'tw:[&:not(svg)]:h-5',\n 'tw:[&:not(svg)]:min-w-5',\n\n 'tw:p-1',\n 'tw:aspect-square',\n 'tw:rounded-md',\n ],\n {\n defaultVariants: { variant: 'icon-accent' },\n variants: {\n variant: {\n icon: ['tw:text-sidebar-foreground', 'tw:[&_svg]:text-sidebar-foreground'],\n 'icon-emphasized': ['tw:text-white', 'tw:[&_svg]:text-white'],\n 'icon-accent': [\n // color-aware accent styling\n 'tw:group-data-[accent=blue]/navbar:text-sidebar-primary',\n 'tw:group-data-[accent=blue]/navbar:[&_svg]:text-sidebar-primary',\n 'tw:group-data-[accent=purple]/navbar:text-purple-500',\n 'tw:group-data-[accent=purple]/navbar:[&_svg]:text-purple-500',\n 'tw:group-data-[accent=orange]/navbar:text-warning-500',\n 'tw:group-data-[accent=orange]/navbar:[&_svg]:text-warning-500',\n 'tw:group-data-[accent=green]/navbar:text-primary-500',\n 'tw:group-data-[accent=green]/navbar:[&_svg]:text-primary-500',\n ],\n 'icon-accent-emphasized': [\n 'tw:text-white',\n 'tw:[&_svg]:text-white',\n\n 'tw:group-data-[accent=blue]/navbar:bg-sidebar-primary',\n 'tw:group-data-[accent=purple]/navbar:bg-purple-500',\n 'tw:group-data-[accent=orange]/navbar:bg-warning-500',\n 'tw:group-data-[accent=green]/navbar:bg-primary-500',\n ],\n 'icon-button': ['tw:size-4', 'tw:!p-0', 'tw:[&_svg:not([class*=\"tw:size-\"])]:size-4'],\n shortcut: ['tw:bg-muted', 'tw:text-sidebar-foreground', 'tw:ml-auto'],\n },\n },\n },\n);\n\ntype Props = { asChild?: boolean } & ComponentProps<'span'> & VariantProps<typeof variants>;\n\nexport const NavbarMenuItemAdornment = ({\n ref,\n asChild = false,\n className,\n variant = 'icon-accent',\n ...props\n}: Props) => {\n const Comp = asChild ? Slot : 'span';\n\n return <Comp {...props} ref={ref} className={variants({ variant, className })} />;\n};\n","import type { ComponentProps, ReactNode } from 'react';\nimport { Root, Slottable } from '@radix-ui/react-slot';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\nimport { Search } from '../../icons';\nimport { cn } from '../../utils';\n\nimport { NavbarMenuItemAdornment } from './NavbarMenuItemAdornment';\n\nconst variants = cva(\n [\n 'tw:group/navbar-menu-button',\n 'tw:box-border',\n 'tw:flex',\n 'tw:items-center',\n 'tw:gap-2',\n 'tw:bg-transparent',\n\n 'tw:leading-9',\n\n 'tw:border',\n 'tw:rounded-lg',\n 'tw:whitespace-nowrap',\n 'tw:select-none',\n\n // focus-visible\n 'tw:!outline-hidden',\n 'tw:focus-visible:ring-2',\n 'tw:focus-visible:ring-sidebar-ring/50',\n\n // disabled\n 'tw:disabled:opacity-disabled',\n 'tw:disabled:hover:bg-transparent',\n 'tw:disabled:cursor-not-allowed',\n ],\n {\n defaultVariants: {\n variant: 'default',\n },\n variants: {\n variant: {\n default: [\n 'tw:max-h-9',\n 'tw:border-transparent',\n 'tw:py-2',\n 'tw:px-1.5',\n 'tw:text-sidebar-foreground',\n 'tw:hover:bg-sidebar-hover',\n 'tw:aria-expanded:bg-sidebar-hover',\n\n // Active page. Mirrors `Sidebar.MenuButton`, which styles `aria-current=\"page\"` — a top nav\n // needs the same affordance, and without it a Navbar-shelled app cannot show where you are.\n // `aria-current` rather than a prop: with `asChild` the slot is an <a>, and that is the\n // attribute a router sets on an active link (TanStack's `Link` does it for free).\n 'tw:aria-[current=page]:bg-sidebar-selected',\n 'tw:aria-[current=page]:hover:bg-sidebar-selected',\n 'tw:aria-[current=page]:text-[var(--sidebar-selected-foreground,rgb(var(--sidebar-foreground)))]',\n 'tw:aria-[current=page]:font-medium',\n ],\n emphasized: [\n 'tw:max-h-9',\n 'tw:border-transparent',\n 'tw:py-2',\n 'tw:px-1.5',\n\n 'tw:text-sidebar-foreground',\n 'tw:hover:bg-sidebar-hover',\n 'tw:aria-expanded:bg-sidebar-hover',\n\n 'tw:aria-[current=page]:bg-sidebar-selected',\n 'tw:aria-[current=page]:hover:bg-sidebar-selected',\n 'tw:aria-[current=page]:text-[var(--sidebar-selected-foreground,rgb(var(--sidebar-foreground)))]',\n\n 'tw:font-semibold',\n ],\n icon: [\n 'tw:size-8',\n 'tw:aspect-square',\n 'tw:justify-center',\n 'tw:font-normal',\n 'tw:border-transparent',\n 'tw:text-primary',\n 'tw:[&_svg]:!text-primary',\n 'tw:hover:bg-sidebar-hover',\n 'tw:aria-expanded:bg-sidebar-hover',\n ],\n search: [\n 'tw:max-h-8',\n 'tw:min-w-52',\n 'tw:px-3',\n 'tw:py-1',\n 'tw:font-normal',\n 'tw:border-input',\n 'tw:text-muted-foreground',\n 'tw:[&_svg]:!text-muted-foreground',\n ],\n },\n },\n },\n);\n\ntype Props = ComponentProps<'button'> & {\n /** Optional leading-icon slot. Pass a Lucide icon node to render an adornment before children. */\n icon?: ReactNode;\n asChild?: boolean;\n} & VariantProps<typeof variants>;\n\nexport const NavbarMenuButton = ({\n ref,\n className,\n type = 'button',\n children,\n icon,\n asChild = false,\n variant = 'default',\n ...rest\n}: Props) => {\n const Comp = asChild ? Root : 'button';\n const isSearchVariant = variant === 'search';\n const isEmphasizedVariant = variant === 'emphasized';\n const adornment = isSearchVariant ? <Search /> : icon;\n\n const adornmentVariant: ComponentProps<typeof NavbarMenuItemAdornment>['variant'] = (() => {\n if (isSearchVariant || variant === 'icon') return 'icon-button';\n if (isEmphasizedVariant) return 'icon-accent-emphasized';\n return 'icon-accent';\n })();\n\n return (\n <Comp\n {...rest}\n ref={ref}\n type={type}\n data-variant={variant}\n className={cn(variants({ className, variant }))}\n >\n {adornment && (\n <NavbarMenuItemAdornment variant={adornmentVariant}>{adornment}</NavbarMenuItemAdornment>\n )}\n\n <Slottable>{children}</Slottable>\n </Comp>\n );\n};\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\ntype Props = ComponentProps<'li'>;\n\nexport const NavbarMenuItem = ({ className, ...rest }: Props) => (\n <li {...rest} className={cn('tw:flex', 'tw:items-center', 'tw:gap-2', className)} />\n);\n","import type { ComponentProps } from 'react';\nimport type { VariantProps } from 'class-variance-authority';\nimport { cva } from 'class-variance-authority';\n\nimport { NavbarContent } from './NavbarContent';\nimport { NavbarFooter } from './NavbarFooter';\nimport { NavbarHeader } from './NavbarHeader';\nimport { NavbarMenu } from './NavbarMenu';\nimport { NavbarMenuAvatar } from './NavbarMenuAvatar';\nimport { NavbarMenuButton } from './NavbarMenuButton';\nimport { NavbarMenuItem } from './NavbarMenuItem';\nimport { NavbarMenuItemAdornment } from './NavbarMenuItemAdornment';\n\nconst navbarClassnames = cva(\n [\n 'tailwindcss-preflight',\n 'tw:group/navbar',\n 'tw:sticky',\n 'tw:top-0',\n 'tw:z-50',\n 'tw:flex',\n 'tw:gap-2',\n 'tw:items-center',\n\n // The left side is intentionally smaller to align the logo with the sidebar icons.\n 'tw:pl-2',\n 'tw:pr-3',\n\n 'tw:bg-sidebar',\n // Required with `bg-sidebar`: otherwise `currentColor` (text, `BrandLogo`) is black on dark.\n 'tw:text-sidebar-foreground',\n 'tw:text-xs',\n 'tw:leading-4',\n ],\n {\n defaultVariants: {\n bordered: false,\n },\n variants: {\n bordered: {\n true: [\n 'tw:before:content',\n 'tw:before:h-0.5',\n 'tw:before:w-full',\n 'tw:before:absolute',\n 'tw:before:left-0',\n 'tw:before:top-0',\n 'tw:data-[accent=blue]:before:bg-sidebar-primary',\n 'tw:data-[accent=purple]:before:bg-purple-500',\n 'tw:data-[accent=green]:before:bg-primary-500',\n 'tw:data-[accent=orange]:before:bg-warning-500',\n ],\n false: '',\n },\n },\n },\n);\n\ntype Props = ComponentProps<'nav'> &\n VariantProps<typeof navbarClassnames> & {\n accent?: 'blue' | 'purple' | 'green' | 'orange';\n };\n\n/**\n * Top navigation bar for the app shell, hosted inside `<AppShell.Header>`.\n *\n * - Composition: `Navbar.Header` (brand), `Navbar.Content` (scrollable menu), `Navbar.Footer`.\n * - `bordered` adds a top hairline coloured by `accent`.\n * - Override the default `aria-label` when a page has more than one nav.\n *\n * @see AppShell — the sidebar rail uses `Sidebar` instead.\n */\nexport const Navbar = ({ className, accent = 'blue', bordered = false, ...rest }: Props) => (\n // - `<nav>`, not `<header>`: `AppShell.Header` is already the `<header>` landmark.\n // - `aria-label` precedes `...rest` so a caller's label wins.\n <nav\n aria-label=\"Main navigation\"\n {...rest}\n data-slot=\"navbar\"\n data-accent={accent}\n className={navbarClassnames({ bordered, className })}\n />\n);\n\nNavbar.Header = NavbarHeader;\nNavbar.Footer = NavbarFooter;\nNavbar.Content = NavbarContent;\n\nNavbar.Menu = NavbarMenu;\nNavbar.MenuItem = NavbarMenuItem;\nNavbar.MenuButton = NavbarMenuButton;\nNavbar.MenuItemAdornment = NavbarMenuItemAdornment;\nNavbar.MenuAvatar = NavbarMenuAvatar;\n"],"mappings":";;;;;;;;;;AAUA,MAAa,iBAAiB,EAAE,UAAU,gBACxC,oBAAC,YAAD;CACE,MAAK;CACL,aAAY;CACZ,WAAU;CACV,oBAAmB;CAEnB,UAAA,oBAAC,OAAD;EAAK,WAAW,GAAG,WAAW,aAAa,SAAS;EAAI;CAAc,CAAA;AAC5D,CAAA;;;ACNd,MAAa,gBAAgB,EAAE,UAAU,WAAW,GAAG,WACrD,oBAAC,OAAD;CAAK,GAAI;CAAM,WAAW,GAAG,8CAA8C,SAAS;CACjF;AACE,CAAA;;;ACRP,MAAa,gBAAgB,EAAE,UAAU,WAAW,GAAG,WAGrD,oBAAC,OAAD;CAAK,GAAI;CAAM,WAAW,GAAG,sBAAsB,aAAa,SAAS;CACtE,UAAA,YAAY,oBAAC,WAAD;EAAW,SAAQ;E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ACA;GACA;EACF;EACA,0BAA0B;GACxB;GACA;GAEA;GACA;GACA;GACA;EACF;EACA,eAAe;GAAC;GAAa;GAAW;EAA4C;EACpF,UAAU;GAAC;GAAe;GAA8B;EAAY;CACtE,EACF;AACF,CACF;AAIA,MAAa,2BAA2B,EACtC,KACA,UAAU,OACV,WACA,UAAU,eACV,GAAG,YACQ;CAGX,OAAO,oBAFM,UAAU,OAAO,QAEvB;EAAM,GAAI;EAAY;EAAK,WAAWA,WAAS;GAAE;GAAS;EAAU,CAAC;CAAI,CAAA;AAClF;;;ACtDA,MAAM,WAAW,IACf;CACE;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;CACA;CAGA;CACA;CACA;CAGA;CACA;CACA;AACF,GACA;CACE,iBAAiB,EACf,SAAS,UACX;CACA,UAAU,EACR,SAAS;EACP,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GAMA;GACA;GACA;GACA;EACF;EACA,YAAY;GACV;GACA;GACA;GACA;GAEA;GACA;GACA;GAEA;GACA;GACA;GAEA;EACF;EACA,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,QAAQ;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF,EACF;AACF,CACF;AAQA,MAAa,oBAAoB,EAC/B,KACA,WACA,OAAO,UACP,UACA,MACA,UAAU,OACV,UAAU,WACV,GAAG,WACQ;CACX,MAAM,OAAO,UAAU,OAAO;CAC9B,MAAM,kBAAkB,YAAY;CACpC,MAAM,sBAAsB,YAAY;CACxC,MAAM,YAAY,kBAAkB,oBAAC,QAAD,CAAS,CAAA,IAAI;CAEjD,MAAM,0BAAqF;EACzF,IAAI,mBAAmB,YAAY,QAAQ,OAAO;EAClD,IAAI,qBAAqB,OAAO;EAChC,OAAO;CACT,EAAA,CAAG;CAEH,OACE,qBAAC,MAAD;EACE,GAAI;EACC;EACC;EACN,gBAAc;EACd,WAAW,GAAG,SAAS;GAAE;GAAW;EAAQ,CAAC,CAAC;EALhD,UAAA,CAOG,aACC,oBAAC,yBAAD;GAAyB,SAAS;GAAmB,UAAA;EAAmC,CAAA,GAG1F,oBAAC,WAAD,EAAY,SAAoB,CAAA,CAC5B;;AAEV;;;AC1IA,MAAa,kBAAkB,EAAE,WAAW,GAAG,WAC7C,oBAAC,MAAD;CAAI,GAAI;CAAM,WAAW,GAAG,WAAW,mBAAmB,YAAY,SAAS;AAAI,CAAA;;;ACMrF,MAAM,mBAAmB,IACvB;CACE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CAEA;CAEA;CACA;CACA;AACF,GACA;CACE,iBAAiB,EACf,UAAU,MACZ;CACA,UAAU,EACR,UAAU;EACR,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,OAAO;CACT,EACF;AACF,CACF;;;;;;;;;;AAgBA,MAAa,UAAU,EAAE,WAAW,SAAS,QAAQ,WAAW,OAAO,GAAG,WAGxE,oBAAC,OAAD;CACE,cAAW;CACX,GAAI;CACJ,aAAU;CACV,eAAa;CACb,WAAW,iBAAiB;EAAE;EAAU;CAAU,CAAC;AACpD,CAAA;AAGH,OAAO,SAAS;AAChB,OAAO,SAAS;AAChB,OAAO,UAAU;AAEjB,OAAO,OAAO;AACd,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,OAAO,oBAAoB;AAC3B,OAAO,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OtpInput-CY8yCaJk.js","names":[],"sources":["../src/blocks/OtpInput/OtpInputGroup.tsx","../src/blocks/OtpInput/OtpInputSeparator.tsx","../src/blocks/OtpInput/OtpInputSlot.tsx","../src/blocks/OtpInput/OtpInput.tsx"],"sourcesContent":["import type { ComponentProps, Ref } from 'react';\n\nimport { cn } from '../../utils';\n\ntype GroupProps = ComponentProps<'div'>;\n\nexport const OtpInputGroup = ({\n ref,\n className,\n ...props\n}: GroupProps & { ref?: Ref<HTMLDivElement> }) => (\n <div ref={ref} className={cn('tw:flex tw:items-center tw:gap-2', className)} {...props} />\n);\n","import type { ComponentProps, Ref } from 'react';\n\nimport { Minus } from '../../icons';\nimport { cn } from '../../utils';\n\ntype SeparatorProps = ComponentProps<'div'>;\n\nexport const OtpInputSeparator = ({\n ref,\n children,\n className,\n ...props\n}: SeparatorProps & { ref?: Ref<HTMLDivElement> }) => (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn('tw:flex tw:items-center tw:text-muted-foreground', className)}\n {...props}\n >\n {children ?? <Minus className=\"tw:size-4\" />}\n </div>\n);\n","import { type ComponentProps, type Ref, use } from 'react';\nimport { OTPInputContext } from 'input-otp';\n\nimport { cn } from '../../utils';\n\nconst slotClassName = [\n // layout\n 'tw:relative',\n 'tw:flex',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:font-medium',\n 'tw:tabular-nums',\n 'tw:outline-hidden',\n 'tw:transition',\n // resting chrome — always-visible input border on a muted fill (matches InputGroup)\n 'tw:border',\n 'tw:border-solid',\n 'tw:border-input',\n 'tw:bg-muted',\n 'tw:text-foreground',\n 'tw:rounded-[var(--radius-lg,0.25rem)]',\n // focus — the active slot mirrors InputGroup's
|
|
1
|
+
{"version":3,"file":"OtpInput-CY8yCaJk.js","names":[],"sources":["../src/blocks/OtpInput/OtpInputGroup.tsx","../src/blocks/OtpInput/OtpInputSeparator.tsx","../src/blocks/OtpInput/OtpInputSlot.tsx","../src/blocks/OtpInput/OtpInput.tsx"],"sourcesContent":["import type { ComponentProps, Ref } from 'react';\n\nimport { cn } from '../../utils';\n\ntype GroupProps = ComponentProps<'div'>;\n\nexport const OtpInputGroup = ({\n ref,\n className,\n ...props\n}: GroupProps & { ref?: Ref<HTMLDivElement> }) => (\n <div ref={ref} className={cn('tw:flex tw:items-center tw:gap-2', className)} {...props} />\n);\n","import type { ComponentProps, Ref } from 'react';\n\nimport { Minus } from '../../icons';\nimport { cn } from '../../utils';\n\ntype SeparatorProps = ComponentProps<'div'>;\n\nexport const OtpInputSeparator = ({\n ref,\n children,\n className,\n ...props\n}: SeparatorProps & { ref?: Ref<HTMLDivElement> }) => (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn('tw:flex tw:items-center tw:text-muted-foreground', className)}\n {...props}\n >\n {children ?? <Minus className=\"tw:size-4\" />}\n </div>\n);\n","import { type ComponentProps, type Ref, use } from 'react';\nimport { OTPInputContext } from 'input-otp';\n\nimport { cn } from '../../utils';\n\nconst slotClassName = [\n // layout\n 'tw:relative',\n 'tw:flex',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:font-medium',\n 'tw:tabular-nums',\n 'tw:outline-hidden',\n 'tw:transition',\n // resting chrome — always-visible input border on a muted fill (matches InputGroup)\n 'tw:border',\n 'tw:border-solid',\n 'tw:border-input',\n 'tw:bg-muted',\n 'tw:text-foreground',\n 'tw:rounded-[var(--radius-lg,0.25rem)]',\n // focus — the active slot mirrors InputGroup's focus ring; z-10 so the ring isn't clipped\n 'tw:data-[active=true]:z-10',\n 'tw:data-[active=true]:border-primary',\n 'tw:data-[active=true]:ring-4',\n 'tw:data-[active=true]:ring-ring/50',\n // size — from `data-size` on the group/otp container\n 'tw:group-data-[size=sm]/otp:h-8 tw:group-data-[size=sm]/otp:w-8 tw:group-data-[size=sm]/otp:text-sm',\n 'tw:group-data-[size=md]/otp:h-9 tw:group-data-[size=md]/otp:w-9 tw:group-data-[size=md]/otp:text-base',\n 'tw:group-data-[size=lg]/otp:h-10 tw:group-data-[size=lg]/otp:w-10 tw:group-data-[size=lg]/otp:text-lg',\n // error — from `aria-invalid` on the OTP input (mirrors InputGroup's error chrome). `!` beats\n // the base/active border once tailwind-merge dedupes.\n 'tw:group-has-[input[aria-invalid=true]]/otp:!border-destructive',\n 'tw:group-has-[input[aria-invalid=true]]/otp:data-[active=true]:!border-destructive',\n 'tw:group-has-[input[aria-invalid=true]]/otp:data-[active=true]:ring-destructive/20',\n];\n\ntype SlotProps = Omit<ComponentProps<'div'>, 'children'> & {\n index: number;\n};\n\nexport const OtpInputSlot = ({\n ref,\n index,\n className,\n ...props\n}: SlotProps & { ref?: Ref<HTMLDivElement> }) => {\n // `input-otp` exposes per-slot char / active / caret state through its render context.\n const { slots } = use(OTPInputContext);\n // The context default has no `slots` — a slot rendered outside `<OtpInput>` would otherwise throw\n // a cryptic \"cannot read properties of undefined\". Fail with an actionable message instead.\n if (!slots) throw new Error('<OtpInput.Slot> must be rendered inside <OtpInput>.');\n const slot = slots[index];\n const char = slot?.char ?? null;\n const isActive = slot?.isActive ?? false;\n const hasFakeCaret = slot?.hasFakeCaret ?? false;\n\n return (\n <div\n ref={ref}\n data-active={isActive || undefined}\n data-slot-index={index}\n className={cn(slotClassName, className)}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div\n aria-hidden=\"true\"\n className=\"tw:pointer-events-none tw:absolute tw:inset-0 tw:flex tw:items-center tw:justify-center\"\n >\n <div className=\"tw:h-1/2 tw:w-px tw:animate-caret-blink tw:bg-foreground\" />\n </div>\n )}\n </div>\n );\n};\n","import type { ComponentProps, ReactNode, Ref } from 'react';\nimport { OTPInput, REGEXP_ONLY_DIGITS } from 'input-otp';\n\nimport { cn } from '../../utils';\n\nimport { OtpInputGroup } from './OtpInputGroup';\nimport { OtpInputSeparator } from './OtpInputSeparator';\nimport { OtpInputSlot } from './OtpInputSlot';\n\ntype OtpInputSizing = 'sm' | 'md' | 'lg';\n\ntype OtpElementProps = ComponentProps<typeof OTPInput>;\ntype OtpElementChildrenProps = Omit<\n Extract<OtpElementProps, { children: ReactNode }>,\n 'containerClassName'\n>;\n\ntype RootOwnProps = {\n sizing?: OtpInputSizing;\n containerClassName?: string;\n};\n\ntype RootProps = OtpElementChildrenProps & RootOwnProps;\n\nconst Root = ({\n ref,\n sizing = 'md',\n pattern = REGEXP_ONLY_DIGITS,\n containerClassName,\n className,\n children,\n 'aria-invalid': ariaInvalid,\n ...rest\n}: RootProps & { ref?: Ref<HTMLInputElement> }) => (\n <div className=\"tw:group/otp tw:w-fit\" data-size={sizing}>\n <OTPInput\n {...rest}\n ref={ref}\n pattern={pattern}\n aria-invalid={ariaInvalid}\n containerClassName={cn(\n 'tw:flex tw:items-center tw:gap-2 tw:has-[:disabled]:opacity-disabled',\n containerClassName,\n )}\n className={cn('tw:disabled:cursor-not-allowed', className)}\n >\n {children}\n </OTPInput>\n </div>\n);\n\nexport const OtpInput = Object.assign(Root, {\n Group: OtpInputGroup,\n Slot: OtpInputSlot,\n Separator: OtpInputSeparator,\n});\nexport type { RootProps as OtpInputProps };\n"],"mappings":";;;;;;AAMA,MAAa,iBAAiB,EAC5B,KACA,WACA,GAAG,YAEH,oBAAC,OAAD;CAAU;CAAK,WAAW,GAAG,oCAAoC,SAAS;CAAG,GAAI;AAAQ,CAAA;;;ACJ3F,MAAa,qBAAqB,EAChC,KACA,UACA,WACA,GAAG,YAEH,oBAAC,OAAD;CACO;CACL,MAAK;CACL,oBAAiB;CACjB,WAAW,GAAG,oDAAoD,SAAS;CAC3E,GAAI;CAEH,UAAA,YAAY,oBAAC,OAAD,EAAO,WAAU,YAAa,CAAA;AACxC,CAAA;;;AChBP,MAAM,gBAAgB;CAEpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CAGA;CACA;CACA;AACF;AAMA,MAAa,gBAAgB,EAC3B,KACA,OACA,WACA,GAAG,YAC4C;CAE/C,MAAM,EAAE,UAAU,IAAI,eAAe;CAGrC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,qDAAqD;CACjF,MAAM,OAAO,MAAM;CACnB,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,eAAe,MAAM,gBAAgB;CAE3C,OACE,qBAAC,OAAD;EACO;EACL,eAAa,YAAY,KAAA;EACzB,mBAAiB;EACjB,WAAW,GAAG,eAAe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