@womp/kookie-ui 0.25.0 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.css +19 -3
- package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +4 -4
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-resizable.d.ts +6 -0
- package/dist/cjs/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/accordion.js +1 -1
- package/dist/cjs/components/accordion.js.map +4 -4
- package/dist/cjs/components/alert-dialog.js +1 -1
- package/dist/cjs/components/alert-dialog.js.map +4 -4
- package/dist/cjs/components/avatar.js +1 -1
- package/dist/cjs/components/avatar.js.map +4 -4
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +4 -4
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +4 -4
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +4 -4
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox-group.js.map +4 -4
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +4 -4
- package/dist/cjs/components/chip.js +1 -1
- package/dist/cjs/components/chip.js.map +4 -4
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +4 -4
- package/dist/cjs/components/context-menu.js +1 -1
- package/dist/cjs/components/context-menu.js.map +4 -4
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +4 -4
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +4 -4
- package/dist/cjs/components/index.js +2 -2
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/message-scroller.js +1 -1
- package/dist/cjs/components/message-scroller.js.map +4 -4
- package/dist/cjs/components/navbar.js +1 -1
- package/dist/cjs/components/navbar.js.map +4 -4
- package/dist/cjs/components/notice.js +1 -1
- package/dist/cjs/components/notice.js.map +4 -4
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +4 -4
- package/dist/cjs/components/radio-group.js +1 -1
- package/dist/cjs/components/radio-group.js.map +4 -4
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +4 -4
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/segmented-control.js.map +4 -4
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +4 -4
- package/dist/cjs/components/sheet.js +1 -1
- package/dist/cjs/components/sheet.js.map +4 -4
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +4 -4
- package/dist/cjs/components/sidebar.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +4 -4
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slider.js.map +4 -4
- package/dist/cjs/components/switch.js +1 -1
- package/dist/cjs/components/switch.js.map +4 -4
- package/dist/cjs/components/table.js +1 -1
- package/dist/cjs/components/table.js.map +4 -4
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +4 -4
- package/dist/cjs/components/text-area.js +1 -1
- package/dist/cjs/components/text-area.js.map +4 -4
- package/dist/cjs/components/text-field.js +2 -2
- package/dist/cjs/components/text-field.js.map +4 -4
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +4 -4
- package/dist/cjs/components/toggle.js +1 -1
- package/dist/cjs/components/toggle.js.map +4 -4
- package/dist/cjs/components/toolbar.d.ts.map +1 -1
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +4 -4
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +4 -4
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/index.d.ts.map +1 -1
- package/dist/cjs/helpers/index.js +4 -4
- package/dist/cjs/helpers/index.js.map +3 -3
- package/dist/cjs/helpers/theme-size.d.ts +8 -30
- package/dist/cjs/helpers/theme-size.d.ts.map +1 -1
- package/dist/cjs/helpers/theme-size.js +1 -1
- package/dist/cjs/helpers/theme-size.js.map +3 -3
- package/dist/cjs/hooks/theme-size.d.ts +32 -0
- package/dist/cjs/hooks/theme-size.d.ts.map +1 -0
- package/dist/cjs/hooks/theme-size.js +3 -0
- package/dist/cjs/hooks/theme-size.js.map +7 -0
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +4 -4
- package/dist/esm/chunk-3B25RLWX.js +3 -0
- package/dist/esm/chunk-3B25RLWX.js.map +7 -0
- package/dist/esm/{chunk-PF67GJ5D.js → chunk-3CY6H4TE.js} +2 -2
- package/dist/esm/chunk-3CY6H4TE.js.map +7 -0
- package/dist/esm/{chunk-2EXOL2BR.js → chunk-3L2MDOYC.js} +2 -2
- package/dist/esm/chunk-3L2MDOYC.js.map +7 -0
- package/dist/esm/{chunk-KNBSG2WA.js → chunk-5CFSNNYS.js} +2 -2
- package/dist/esm/chunk-5CFSNNYS.js.map +7 -0
- package/dist/esm/{chunk-4ABQ6CDI.js → chunk-5EBJOOXE.js} +2 -2
- package/dist/esm/chunk-5EBJOOXE.js.map +7 -0
- package/dist/esm/{chunk-E4EMG3RC.js → chunk-5L4DZ2D3.js} +2 -2
- package/dist/esm/chunk-5L4DZ2D3.js.map +7 -0
- package/dist/esm/chunk-5ON3XLRD.js +3 -0
- package/dist/esm/chunk-5ON3XLRD.js.map +7 -0
- package/dist/esm/{chunk-UZAS4PYM.js → chunk-5TJH35TF.js} +2 -2
- package/dist/esm/{chunk-GPQSC6GL.js → chunk-5XR5PTDR.js} +2 -2
- package/dist/esm/chunk-5XR5PTDR.js.map +7 -0
- package/dist/esm/{chunk-AOBY2OUZ.js → chunk-63MUJFVF.js} +2 -2
- package/dist/esm/chunk-63MUJFVF.js.map +7 -0
- package/dist/esm/chunk-6AUIIXXE.js +2 -0
- package/dist/esm/chunk-6AUIIXXE.js.map +7 -0
- package/dist/esm/{chunk-4Q5PUIDJ.js → chunk-6RJQ5LLP.js} +2 -2
- package/dist/esm/{chunk-YVZTQA2L.js → chunk-7B3XDZXZ.js} +2 -2
- package/dist/esm/chunk-7B3XDZXZ.js.map +7 -0
- package/dist/esm/{chunk-7IHBNDCE.js → chunk-7X7VWR3F.js} +2 -2
- package/dist/esm/chunk-7X7VWR3F.js.map +7 -0
- package/dist/esm/{chunk-45O3JZWQ.js → chunk-7XHE6TOA.js} +2 -2
- package/dist/esm/chunk-7XHE6TOA.js.map +7 -0
- package/dist/esm/chunk-AQ7VUGQQ.js +3 -0
- package/dist/esm/chunk-AQ7VUGQQ.js.map +7 -0
- package/dist/esm/{chunk-54HUG34P.js → chunk-BVFHJP5E.js} +2 -2
- package/dist/esm/chunk-BVFHJP5E.js.map +7 -0
- package/dist/esm/{chunk-CRCYUJMK.js → chunk-BXZSJKWA.js} +2 -2
- package/dist/esm/chunk-BXZSJKWA.js.map +7 -0
- package/dist/esm/{chunk-IQ2RMFOM.js → chunk-CQG4U5BR.js} +2 -2
- package/dist/esm/{chunk-YNCI5PY6.js → chunk-FPGBCCML.js} +2 -2
- package/dist/esm/chunk-FPGBCCML.js.map +7 -0
- package/dist/esm/{chunk-A7QRPXXB.js → chunk-HHSFAOIO.js} +2 -2
- package/dist/esm/chunk-HHSFAOIO.js.map +7 -0
- package/dist/esm/{chunk-NMQGDBLD.js → chunk-MQEWEAH5.js} +2 -2
- package/dist/esm/chunk-MQEWEAH5.js.map +7 -0
- package/dist/esm/{chunk-YIKLO2XL.js → chunk-N3QLHFHB.js} +2 -2
- package/dist/esm/chunk-N3QLHFHB.js.map +7 -0
- package/dist/esm/{chunk-LCG3JZ3C.js → chunk-N5H7C3PZ.js} +2 -2
- package/dist/esm/chunk-N5H7C3PZ.js.map +7 -0
- package/dist/esm/{chunk-N53NJCEM.js → chunk-OQWD63AI.js} +2 -2
- package/dist/esm/chunk-OQWD63AI.js.map +7 -0
- package/dist/esm/chunk-PCLO3ZZY.js +3 -0
- package/dist/esm/chunk-PCLO3ZZY.js.map +7 -0
- package/dist/esm/{chunk-2XZ7477Y.js → chunk-PZZJH2LR.js} +2 -2
- package/dist/esm/chunk-PZZJH2LR.js.map +7 -0
- package/dist/esm/chunk-QKCNGEX4.js +3 -0
- package/dist/esm/chunk-QKCNGEX4.js.map +7 -0
- package/dist/esm/{chunk-PPQ7URZL.js → chunk-R4PGFURL.js} +2 -2
- package/dist/esm/{chunk-UUQGOQ5H.js → chunk-RB5VHWAW.js} +2 -2
- package/dist/esm/chunk-RB5VHWAW.js.map +7 -0
- package/dist/esm/{chunk-AG2YETE6.js → chunk-VPRAXHLL.js} +2 -2
- package/dist/esm/chunk-VPRAXHLL.js.map +7 -0
- package/dist/esm/{chunk-7J7RPEPB.js → chunk-VRQEWMC6.js} +2 -2
- package/dist/esm/chunk-VRQEWMC6.js.map +7 -0
- package/dist/esm/{chunk-UFJGZUKK.js → chunk-W4MQ6TEK.js} +2 -2
- package/dist/esm/chunk-W4MQ6TEK.js.map +7 -0
- package/dist/esm/{chunk-3223MHQK.js → chunk-WJ4H2O2G.js} +2 -2
- package/dist/esm/chunk-WMODMXEU.js +3 -0
- package/dist/esm/chunk-WMODMXEU.js.map +7 -0
- package/dist/esm/{chunk-JZVLP2VF.js → chunk-XPVRXQSW.js} +2 -2
- package/dist/esm/chunk-XPVRXQSW.js.map +7 -0
- package/dist/esm/{chunk-BUZGRMDD.js → chunk-Y2BTPKK6.js} +2 -2
- package/dist/esm/chunk-YOSCUA6Z.js +3 -0
- package/dist/esm/chunk-YOSCUA6Z.js.map +7 -0
- package/dist/esm/{chunk-X272YV2E.js → chunk-Z563IAE3.js} +2 -2
- package/dist/esm/chunk-Z563IAE3.js.map +7 -0
- package/dist/esm/{chunk-GZ333J7L.js → chunk-ZDSY6CJL.js} +2 -2
- package/dist/esm/chunk-ZDSY6CJL.js.map +7 -0
- package/dist/esm/{chunk-ENAW44VE.js → chunk-ZYKJTNAT.js} +2 -2
- package/dist/esm/chunk-ZYKJTNAT.js.map +7 -0
- package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-resizable.d.ts +6 -0
- package/dist/esm/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-resizable.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/chip.js +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/message-scroller.js +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/notice.js +1 -1
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/radio-group.js +1 -1
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/toggle.js +1 -1
- package/dist/esm/components/toolbar.d.ts.map +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.d.ts.map +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/index.js.map +4 -4
- package/dist/esm/helpers/theme-size.d.ts +8 -30
- package/dist/esm/helpers/theme-size.d.ts.map +1 -1
- package/dist/esm/helpers/theme-size.js +1 -1
- package/dist/esm/hooks/theme-size.d.ts +32 -0
- package/dist/esm/hooks/theme-size.d.ts.map +1 -0
- package/dist/esm/hooks/theme-size.js +3 -0
- package/dist/esm/hooks/theme-size.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/font-family.prop.js +1 -1
- package/dist/esm/props/font-family.prop.js.map +4 -4
- package/dist/esm/props/index.js +1 -1
- package/dist/esm/props/index.js.map +4 -4
- package/package.json +1 -1
- package/src/components/_internal/base-button.tsx +56 -42
- package/src/components/_internal/shell-inspector.tsx +3 -1
- package/src/components/_internal/shell-resizable.tsx +13 -0
- package/src/components/_internal/shell-sidebar.tsx +3 -1
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +1 -1
- package/src/components/avatar.tsx +1 -1
- package/src/components/card.tsx +1 -1
- package/src/components/chatbar.tsx +1 -1
- package/src/components/checkbox-group.tsx +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +1 -1
- package/src/components/context-menu.tsx +1 -1
- package/src/components/dialog.tsx +1 -1
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/navbar.tsx +1 -1
- package/src/components/notice.tsx +1 -1
- package/src/components/popover.css +4 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/radio-group.tsx +1 -1
- package/src/components/radio.tsx +1 -1
- package/src/components/segmented-control.tsx +1 -1
- package/src/components/select.tsx +1 -1
- package/src/components/sheet.css +4 -2
- package/src/components/sheet.tsx +1 -1
- package/src/components/shell.css +7 -2
- package/src/components/shell.tsx +1 -1
- package/src/components/sidebar.css +10 -0
- package/src/components/sidebar.tsx +16 -1
- package/src/components/slider.tsx +1 -1
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +1 -1
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-area.tsx +1 -1
- package/src/components/text-field.tsx +1 -1
- package/src/components/theme.tsx +1 -1
- package/src/components/toolbar.tsx +17 -8
- package/src/helpers/index.ts +3 -0
- package/src/helpers/theme-size.ts +8 -46
- package/src/hooks/theme-size.ts +50 -0
- package/src/styles/tokens/color.css +3 -0
- package/styles.css +21 -3
- package/tokens/base.css +2 -0
- package/tokens.css +2 -0
- package/dist/esm/chunk-2EXOL2BR.js.map +0 -7
- package/dist/esm/chunk-2IUGM657.js +0 -3
- package/dist/esm/chunk-2IUGM657.js.map +0 -7
- package/dist/esm/chunk-2XZ7477Y.js.map +0 -7
- package/dist/esm/chunk-3WZLXGUE.js +0 -3
- package/dist/esm/chunk-3WZLXGUE.js.map +0 -7
- package/dist/esm/chunk-3YLYGKFB.js +0 -2
- package/dist/esm/chunk-3YLYGKFB.js.map +0 -7
- package/dist/esm/chunk-45O3JZWQ.js.map +0 -7
- package/dist/esm/chunk-4ABQ6CDI.js.map +0 -7
- package/dist/esm/chunk-54HUG34P.js.map +0 -7
- package/dist/esm/chunk-7IHBNDCE.js.map +0 -7
- package/dist/esm/chunk-7J7RPEPB.js.map +0 -7
- package/dist/esm/chunk-A7QRPXXB.js.map +0 -7
- package/dist/esm/chunk-AG2YETE6.js.map +0 -7
- package/dist/esm/chunk-AOBY2OUZ.js.map +0 -7
- package/dist/esm/chunk-CRCYUJMK.js.map +0 -7
- package/dist/esm/chunk-DI7RUMLO.js +0 -3
- package/dist/esm/chunk-DI7RUMLO.js.map +0 -7
- package/dist/esm/chunk-E4EMG3RC.js.map +0 -7
- package/dist/esm/chunk-ENAW44VE.js.map +0 -7
- package/dist/esm/chunk-EVCQ6TG5.js +0 -3
- package/dist/esm/chunk-EVCQ6TG5.js.map +0 -7
- package/dist/esm/chunk-G32GSPNO.js +0 -3
- package/dist/esm/chunk-G32GSPNO.js.map +0 -7
- package/dist/esm/chunk-GPQSC6GL.js.map +0 -7
- package/dist/esm/chunk-GZ333J7L.js.map +0 -7
- package/dist/esm/chunk-JIF77MRB.js +0 -3
- package/dist/esm/chunk-JIF77MRB.js.map +0 -7
- package/dist/esm/chunk-JZVLP2VF.js.map +0 -7
- package/dist/esm/chunk-KNBSG2WA.js.map +0 -7
- package/dist/esm/chunk-LB2HB4NG.js +0 -3
- package/dist/esm/chunk-LB2HB4NG.js.map +0 -7
- package/dist/esm/chunk-LCG3JZ3C.js.map +0 -7
- package/dist/esm/chunk-N53NJCEM.js.map +0 -7
- package/dist/esm/chunk-NMQGDBLD.js.map +0 -7
- package/dist/esm/chunk-PF67GJ5D.js.map +0 -7
- package/dist/esm/chunk-UFJGZUKK.js.map +0 -7
- package/dist/esm/chunk-UUQGOQ5H.js.map +0 -7
- package/dist/esm/chunk-VCV7RACK.js +0 -2
- package/dist/esm/chunk-VCV7RACK.js.map +0 -7
- package/dist/esm/chunk-X272YV2E.js.map +0 -7
- package/dist/esm/chunk-YIKLO2XL.js.map +0 -7
- package/dist/esm/chunk-YNCI5PY6.js.map +0 -7
- package/dist/esm/chunk-YVZTQA2L.js.map +0 -7
- /package/dist/esm/{chunk-UZAS4PYM.js.map → chunk-5TJH35TF.js.map} +0 -0
- /package/dist/esm/{chunk-4Q5PUIDJ.js.map → chunk-6RJQ5LLP.js.map} +0 -0
- /package/dist/esm/{chunk-IQ2RMFOM.js.map → chunk-CQG4U5BR.js.map} +0 -0
- /package/dist/esm/{chunk-PPQ7URZL.js.map → chunk-R4PGFURL.js.map} +0 -0
- /package/dist/esm/{chunk-3223MHQK.js.map → chunk-WJ4H2O2G.js.map} +0 -0
- /package/dist/esm/{chunk-BUZGRMDD.js.map → chunk-Y2BTPKK6.js.map} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/chatbar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { useComposedRefs, useLayoutEffect } from 'radix-ui/internal';\nimport { useDropzone } from 'react-dropzone';\n\nimport { Button } from './button.js';\nimport { CloseIcon, FileTextIcon, PaperclipIcon } from './icons.js';\nimport { Flex } from './flex.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Slot } from './slot.js';\nimport { NoticeSizeContext } from './notice.js';\nimport { useThemeSize } from '../helpers/theme-size.js';\nimport { Spinner } from './spinner.js';\nimport { Text } from './text.js';\nimport { VisuallyHidden } from './visually-hidden.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { accentColors } from '../props/color.prop.js';\nimport type { radii } from '../props/radius.prop.js';\nimport type { ButtonProps, ButtonRankProps } from './button.js';\n\n/**\n * Runs `measure` with the placeholder taken out of layout, so a height read\n * reflects the value alone.\n *\n * A textarea with an empty value lays its placeholder out as real text, so\n * `scrollHeight` reports the placeholder wrapped at whatever width the field\n * has at that instant. That sizes an empty bar to the suggestion showing in it\n * rather than to `minLines`, and when the read lands before the field has its\n * final width -- a panel still animating open, a flex parent whose basis is 0\n * -- it wraps that text at a fraction of the real width and opens the bar at\n * `maxLines`. The first keystroke takes the placeholder out of layout and the\n * height snaps back, which is what made the bug look intermittent rather than\n * simply wrong.\n *\n * The reset to 'auto' and the `scrollHeight` read sit in different functions\n * here, so the whole measurement window is wrapped rather than a single read.\n * Costs one extra style recalc on a path that is already forcing a reflow.\n */\nfunction withoutPlaceholder(el: HTMLTextAreaElement, measure: () => void): void {\n const { placeholder } = el;\n if (!placeholder) {\n measure();\n return;\n }\n el.placeholder = '';\n try {\n measure();\n } finally {\n el.placeholder = placeholder;\n }\n}\n\ntype ExpandOn = 'none' | 'focus' | 'overflow' | 'both';\ntype SendMode = 'always' | 'whenDirty' | 'never';\n\n// Attachments\n/** Status flag for attachment lifecycle. */\ntype AttachmentStatus = 'idle' | 'uploading' | 'error' | 'done';\n/**\n * Attachment data model used by Chatbar.\n * - `file` exposes the original File object for uploads and processing.\n * - `url` is an object URL used for image previews. Chatbar revokes it when the\n * attachment is removed; once an attachment is handed to `onSubmit`, the\n * consumer owns the URL and is responsible for revoking it.\n */\ninterface ChatbarAttachment {\n id: string;\n name: string;\n size: number;\n type: string;\n /** Original File object for uploads and processing */\n file: File;\n url?: string;\n status?: AttachmentStatus;\n progress?: number;\n meta?: Record<string, unknown>;\n}\n\ntype ChatbarRejectReason = 'type' | 'size' | 'count';\ninterface ChatbarAttachmentRejection {\n file: File;\n reason: ChatbarRejectReason;\n}\n\ninterface ChatbarSubmitPayload {\n value: string;\n attachments: ChatbarAttachment[];\n}\n\ninterface FilePickerOptions {\n accept?: string | string[];\n multiple?: boolean;\n}\n\ninterface ChatbarContextValue {\n open: boolean;\n setOpen(next: boolean): void;\n\n setValue(next: string): void;\n\n size: '1' | '2' | '3';\n expandOn: ExpandOn;\n minLines: number;\n maxLines: number;\n sendMode: SendMode;\n disabled?: boolean;\n readOnly?: boolean;\n paste: boolean;\n clearOnSubmit: boolean;\n multiple: boolean;\n\n textareaRef: React.RefObject<HTMLTextAreaElement | null>;\n\n attachments: ChatbarAttachment[];\n removeAttachment(id: string): void;\n\n /** Validates and submits; returns false when there was nothing to submit */\n submit(clear: boolean): boolean;\n appendFiles(files: File[]): number;\n appendFilesFromPaste(files: File[]): number;\n openFilePicker(options?: FilePickerOptions): void;\n /** Guards blur-collapse between pointerdown on a picker trigger and its click */\n beginFilePickerPress(): void;\n}\n\n/** Chatbar's own range; a Theme size of 4 maps to 3. */\nconst chatbarSizePropDef = { values: ['1', '2', '3'] as const };\n\nconst ChatbarContext = React.createContext<ChatbarContextValue | null>(null);\n// Value lives in its own context so keystrokes only re-render parts that read it\nconst ChatbarValueContext = React.createContext<string>('');\n\nconst useChatbarContext = () => {\n const ctx = React.useContext(ChatbarContext);\n if (!ctx) throw new Error('Chatbar context not found. Wrap parts in <Chatbar.Root>.');\n return ctx;\n};\n\nconst toArray = (val: string | string[] | undefined) =>\n Array.isArray(val) ? val : typeof val === 'string' ? val.split(',').map((s) => s.trim()).filter(Boolean) : [];\n\nconst matchesAccept = (file: File, patterns: string[]) => {\n if (patterns.length === 0) return true;\n const mime = file.type.toLowerCase();\n const name = file.name.toLowerCase();\n for (const patRaw of patterns) {\n const pat = patRaw.toLowerCase();\n if (pat.includes('/')) {\n const [type, subtype] = pat.split('/');\n const [fmType, fmSubtype] = mime.split('/');\n if (type === '*' || (type === fmType && (subtype === '*' || subtype === fmSubtype))) return true;\n } else if (pat.startsWith('.')) {\n if (name.endsWith(pat)) return true;\n }\n }\n return false;\n};\n\nconst IMAGE_EXT_RE = /\\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i;\nconst isImageLike = (name: string, type: string) => (type || '').toLowerCase().startsWith('image/') || IMAGE_EXT_RE.test(name);\n\nconst hasText = (value: string) => value.trim().length > 0;\n\nconst plural = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`;\n\nlet attachmentCounter = 0;\nconst createAttachmentId = () => `chatbar-attachment-${Date.now()}-${++attachmentCounter}`;\n\n/**\n * Chatbar container and state provider.\n *\n * Value & Open\n * - Supports controlled/uncontrolled `value` and `open`.\n *\n * Attachments\n * - Controlled/uncontrolled attachments with client-side filtering.\n * - Filters by `accept`/`pasteAccept`, `multiple`, `maxAttachments`, and `maxFileSize`.\n * - Rejections are reported via `onAttachmentReject`.\n *\n * Submit\n * - `onSubmit({ value, attachments })` emits both message and attachments.\n * - Submitting requires text or at least one attachment.\n * - `clearOnSubmit` clears message and attachments by default.\n */\ninterface ChatbarRootBaseProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n /** When the chatbar expands on its own. `none` leaves open state entirely to the consumer. */\n expandOn?: ExpandOn;\n\n /** Minimum visible lines when expanded (default: 3). The compact state is always one line. */\n minLines?: number;\n /** Maximum number of lines before scrolling (default: 6) */\n maxLines?: number;\n\n /** Controls Send button visibility only. Enter-to-submit is controlled by `Textarea submitOnEnter`. */\n sendMode?: SendMode;\n\n /** Disables text input, submission and every way of adding attachments */\n disabled?: boolean;\n /** Prevents editing, submission and adding attachments */\n readOnly?: boolean;\n\n /** Combined submit payload */\n onSubmit?: (payload: ChatbarSubmitPayload) => void;\n\n size?: '1' | '2' | '3';\n variant?: 'raised' | 'surface' | 'outline' | 'ghost' | 'soft';\n /** Accent color for the control (matches TextArea) */\n color?: (typeof accentColors)[number];\n /** Optional radius override (matches TextArea) */\n radius?: (typeof radii)[number];\n\n width?: React.CSSProperties['width'];\n maxWidth?: React.CSSProperties['maxWidth'];\n\n // Attachments API\n attachments?: ChatbarAttachment[];\n defaultAttachments?: ChatbarAttachment[];\n onAttachmentsChange?: (attachments: ChatbarAttachment[]) => void;\n accept?: string | string[];\n /** Allow more than one file per pick, paste or drop */\n multiple?: boolean;\n maxAttachments?: number;\n maxFileSize?: number;\n paste?: boolean;\n /** Accepted types for pasted files. Replaces `accept` for paste when set. */\n pasteAccept?: string | string[];\n /** Clear message and attachments after submit */\n clearOnSubmit?: boolean;\n onAttachmentReject?: (rejections: ChatbarAttachmentRejection[]) => void;\n\n /**\n * Enables drag-and-drop file uploads when true.\n *\n * When enabled:\n * - Files can be dropped anywhere on the chatbar\n * - Same validation rules apply (accept, multiple, maxFileSize, maxAttachments)\n * - Visual feedback shows during drag operations\n * - Rejected files trigger onAttachmentReject\n *\n * @default true\n */\n dropzone?: boolean;\n\n /**\n * Optional API ref to control Chatbar imperatively without relying on DOM refs.\n * Provides methods to focus the textarea and open the file picker.\n */\n apiRef?: React.Ref<ChatbarApi>;\n\n /**\n * Messages that need an answer before the next message, such as `Notice` and `Confirmation`.\n * They stack in a column above the chatbar, in the order given, so put the one the next\n * message answers last, nearest the text. They sit outside the box: a button in a notice never\n * submits the message, and pressing one never collapses the chatbar.\n */\n notices?: React.ReactNode;\n /**\n * Short facts that stay true about the conversation, such as the model or the context left.\n * They sit below the chatbar, inset from its sides.\n */\n context?: React.ReactNode;\n}\n\ntype RootElement = React.ElementRef<'div'>;\n/** Imperative API for Chatbar.Root */\nexport interface ChatbarApi {\n /** Focus the textarea input */\n focusTextarea: () => void;\n /** Open the file picker dialog (respects accept/multiple). No-op when disabled or read-only. */\n openFilePicker: () => void;\n}\n/**\n * Chatbar container and state provider.\n *\n * Behavior\n * - Supports controlled and uncontrolled `value` and `open` states via props.\n * - Provides context to subcomponents like `Textarea`, `Row`, and `Send`.\n * - Exposes `data-state`, `data-disabled`, and `data-readonly` attributes for styling.\n *\n * Attachments\n * - Paste-to-attach: when `paste` is enabled, pasting files adds attachments.\n * - Additions and rejections are announced through a polite live region.\n *\n * Dropzone\n * - When `dropzone` is true, enables drag-and-drop file uploads.\n * - Visual feedback via `data-drop-active` attribute during drag operations.\n *\n * Accessibility\n * - Consumers should label the `Textarea` via `aria-label`/`aria-labelledby`.\n */\ninterface RootProps extends ComponentPropsWithout<'div', RemovedProps | 'onSubmit' | 'color'>, ChatbarRootBaseProps {}\n\nconst Root = React.forwardRef<RootElement, RootProps>((props, forwardedRef) => {\n const {\n className,\n style,\n children,\n value: valueProp,\n defaultValue = '',\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n expandOn = 'both',\n minLines = 3,\n maxLines = 6,\n sendMode = 'whenDirty',\n disabled,\n readOnly,\n onSubmit,\n size: sizeProp,\n variant,\n color,\n radius,\n width,\n maxWidth,\n attachments: attachmentsProp,\n defaultAttachments,\n onAttachmentsChange,\n accept,\n multiple = true,\n maxAttachments,\n maxFileSize,\n paste = true,\n pasteAccept,\n clearOnSubmit = true,\n onAttachmentReject,\n dropzone = true,\n apiRef,\n onBlurCapture,\n notices,\n context,\n ...divProps\n } = props;\n const size = useThemeSize(sizeProp, chatbarSizePropDef);\n\n const isValueControlled = valueProp != null;\n const [valueUncontrolled, setValueUncontrolled] = React.useState<string>(defaultValue);\n const value = isValueControlled ? valueProp : valueUncontrolled;\n\n const isOpenControlled = openProp != null;\n const [openUncontrolled, setOpenUncontrolled] = React.useState<boolean>(defaultOpen);\n const open = isOpenControlled ? openProp : openUncontrolled;\n\n // Treat `attachments` as controlled if the prop is provided, even if its value is `undefined`.\n // This avoids switching between controlled and uncontrolled when a consumer sets\n // `attachments={undefined}` to clear attachments. In that case we normalize to an empty array.\n const isAttachmentsControlled = 'attachments' in props;\n const [attachmentsUncontrolled, setAttachmentsUncontrolled] = React.useState<ChatbarAttachment[]>(() => defaultAttachments ?? []);\n const attachments = React.useMemo(\n () => (isAttachmentsControlled ? (attachmentsProp ?? []) : attachmentsUncontrolled),\n [isAttachmentsControlled, attachmentsProp, attachmentsUncontrolled],\n );\n\n // `id` changes on every announcement so identical messages still update the live region\n const [announcement, setAnnouncementState] = React.useState({ text: '', id: 0 });\n const announce = React.useCallback((text: string) => setAnnouncementState((prev) => ({ text, id: prev.id + 1 })), []);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const composedRootRef = useComposedRefs(forwardedRef, rootRef);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const fileInputRef = React.useRef<HTMLInputElement>(null);\n\n // Blur-collapse guards: `pickerOpenRef` is true while the native dialog is open,\n // `pressGuardRef` covers the gap between pointerdown on a trigger and its click\n // (Safari blurs the textarea before the click fires).\n const pickerOpenRef = React.useRef(false);\n const pressGuardRef = React.useRef(false);\n const pressGuardTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const pickerRef = React.useRef<{ patterns: string[]; multiple: boolean } | null>(null);\n\n const acceptKey = toArray(accept).join(',');\n const pasteAcceptKey = toArray(pasteAccept).join(',');\n const accepts = React.useMemo(() => toArray(acceptKey), [acceptKey]);\n const pasteAccepts = React.useMemo(() => (pasteAcceptKey ? toArray(pasteAcceptKey) : accepts), [pasteAcceptKey, accepts]);\n\n // Latest props/state for stable callbacks. Synced during render (not in an effect) so\n // child layout effects that call setOpen/setValue see this render's handlers.\n const snapshot = {\n value,\n attachments,\n accepts,\n pasteAccepts,\n multiple,\n maxAttachments,\n maxFileSize,\n disabled,\n readOnly,\n expandOn,\n isValueControlled,\n isOpenControlled,\n isAttachmentsControlled,\n onValueChange,\n onOpenChange,\n onAttachmentsChange,\n onAttachmentReject,\n onSubmit,\n };\n const latest = React.useRef(snapshot);\n // eslint-disable-next-line react-hooks/refs -- read only in callbacks/effects; see comment above\n latest.current = snapshot;\n\n // Attachments set during the current event, before Root re-renders. Cleared at the end\n // of the task so a controlled parent that rejects the change is not overridden.\n const pendingAttachmentsRef = React.useRef<ChatbarAttachment[] | null>(null);\n const getAttachments = React.useCallback(() => pendingAttachmentsRef.current ?? latest.current.attachments, []);\n\n const setOpen = React.useCallback((next: boolean) => {\n if (!latest.current.isOpenControlled) setOpenUncontrolled(next);\n latest.current.onOpenChange?.(next);\n }, []);\n\n const setValue = React.useCallback((next: string) => {\n if (!latest.current.isValueControlled) setValueUncontrolled(next);\n latest.current.onValueChange?.(next);\n }, []);\n\n const setAttachments = React.useCallback((next: ChatbarAttachment[]) => {\n // Back-to-back updates in one event must see each other\n pendingAttachmentsRef.current = next;\n queueMicrotask(() => {\n pendingAttachmentsRef.current = null;\n });\n if (!latest.current.isAttachmentsControlled) setAttachmentsUncontrolled(next);\n latest.current.onAttachmentsChange?.(next);\n }, []);\n\n // Object URLs Chatbar created and still owns\n const ownedUrlsRef = React.useRef<Set<string>>(new Set());\n\n const addFiles = React.useCallback(\n (files: File[], patterns: string[], multiple: boolean = latest.current.multiple): number => {\n const cfg = latest.current;\n if (cfg.disabled || cfg.readOnly || files.length === 0) return 0;\n\n const current = getAttachments();\n const next: ChatbarAttachment[] = [];\n const rejected: ChatbarAttachmentRejection[] = [];\n const remainingSlots = typeof cfg.maxAttachments === 'number' ? Math.max(cfg.maxAttachments - current.length, 0) : Infinity;\n const perActionLimit = multiple ? Infinity : 1;\n\n for (const file of files) {\n if (next.length >= remainingSlots || next.length >= perActionLimit) {\n rejected.push({ file, reason: 'count' });\n continue;\n }\n if (typeof cfg.maxFileSize === 'number' && file.size > cfg.maxFileSize) {\n rejected.push({ file, reason: 'size' });\n continue;\n }\n if (!matchesAccept(file, patterns)) {\n rejected.push({ file, reason: 'type' });\n continue;\n }\n const url = isImageLike(file.name, file.type) ? URL.createObjectURL(file) : undefined;\n if (url) ownedUrlsRef.current.add(url);\n next.push({ id: createAttachmentId(), name: file.name, size: file.size, type: file.type, file, url, status: 'idle' });\n }\n\n const messages: string[] = [];\n if (next.length > 0) {\n setAttachments(current.concat(next));\n if (cfg.expandOn !== 'none') setOpen(true);\n messages.push(`${plural(next.length, 'file')} attached.`);\n }\n if (rejected.length > 0) {\n cfg.onAttachmentReject?.(rejected);\n messages.push(`${plural(rejected.length, 'file')} could not be attached.`);\n }\n if (messages.length > 0) announce(messages.join(' '));\n return next.length;\n },\n [getAttachments, setAttachments, setOpen, announce],\n );\n\n const appendFiles = React.useCallback((files: File[]) => addFiles(files, latest.current.accepts), [addFiles]);\n const appendFilesFromPaste = React.useCallback((files: File[]) => addFiles(files, latest.current.pasteAccepts), [addFiles]);\n\n const removeAttachment = React.useCallback(\n (id: string) => {\n const current = getAttachments();\n const removed = current.find((a) => a.id === id);\n if (!removed) return;\n setAttachments(current.filter((a) => a.id !== id));\n announce(`Removed ${removed.name}.`);\n },\n [getAttachments, setAttachments, announce],\n );\n\n const submit = React.useCallback(\n (clear: boolean) => {\n const cfg = latest.current;\n if (cfg.disabled || cfg.readOnly) return false;\n const current = getAttachments();\n if (!hasText(cfg.value) && current.length === 0) return false;\n const payload = { value: cfg.value, attachments: current };\n // Hand preview URLs to the consumer only when they leave the chatbar; URLs still\n // rendered here stay owned so removing them later revokes them\n if (clear && cfg.onSubmit) {\n for (const att of current) if (att.url) ownedUrlsRef.current.delete(att.url);\n }\n cfg.onSubmit?.(payload);\n if (clear) {\n setValue('');\n setAttachments([]);\n }\n return true;\n },\n [getAttachments, setValue, setAttachments],\n );\n\n // Revoke owned object URLs that are no longer referenced by current attachments\n React.useEffect(() => {\n const owned = ownedUrlsRef.current;\n if (owned.size === 0) return;\n const current = new Set(attachments.map((a) => a.url));\n for (const url of Array.from(owned)) {\n if (!current.has(url)) {\n URL.revokeObjectURL(url);\n owned.delete(url);\n }\n }\n }, [attachments]);\n\n // On unmount, revoke URLs only when Chatbar owns the attachment list;\n // controlled attachments may still be rendered by the parent.\n React.useEffect(() => {\n const owned = ownedUrlsRef.current;\n return () => {\n if (latest.current.isAttachmentsControlled) return;\n for (const url of Array.from(owned)) URL.revokeObjectURL(url);\n owned.clear();\n };\n }, []);\n\n const openFilePicker = React.useCallback((options?: FilePickerOptions) => {\n const cfg = latest.current;\n const input = fileInputRef.current;\n // The picker guard takes over from the press guard\n clearTimeout(pressGuardTimerRef.current);\n pressGuardRef.current = false;\n if (!input || cfg.disabled || cfg.readOnly) return;\n const patterns = options?.accept != null ? toArray(options.accept) : cfg.accepts;\n const multiple = options?.multiple ?? cfg.multiple;\n pickerRef.current = { patterns, multiple };\n input.accept = patterns.join(',');\n input.multiple = multiple;\n pickerOpenRef.current = true;\n input.click();\n // Browsers block the dialog outside a user gesture; if the window kept focus,\n // no dialog opened and no focus/cancel/change event will clear the guard\n setTimeout(() => {\n if (document.hasFocus()) pickerOpenRef.current = false;\n }, 1000);\n }, []);\n\n const beginFilePickerPress = React.useCallback(() => {\n // On touch (notably iOS), the compatibility mousedown, blur and click arrive in later\n // tasks than pointerup, so hold the guard until the click or a timeout\n pressGuardRef.current = true;\n clearTimeout(pressGuardTimerRef.current);\n pressGuardTimerRef.current = setTimeout(() => {\n pressGuardRef.current = false;\n }, 800);\n }, []);\n\n React.useEffect(() => () => clearTimeout(pressGuardTimerRef.current), []);\n\n // Clear the picker guard when the dialog closes, whichever way it closes\n React.useEffect(() => {\n const input = fileInputRef.current;\n const reset = () => {\n pickerOpenRef.current = false;\n };\n window.addEventListener('focus', reset);\n input?.addEventListener('cancel', reset);\n return () => {\n window.removeEventListener('focus', reset);\n input?.removeEventListener('cancel', reset);\n };\n }, []);\n\n const handleFileInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const input = event.currentTarget;\n const files = Array.from(input.files ?? []);\n const picker = pickerRef.current;\n addFiles(files, picker?.patterns ?? latest.current.accepts, picker?.multiple);\n pickerOpenRef.current = false;\n pickerRef.current = null;\n // Reset so selecting the same file again still fires change\n input.value = '';\n },\n [addFiles],\n );\n\n const handleBlurCapture = React.useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n onBlurCapture?.(event);\n const cfg = latest.current;\n const rootEl = rootRef.current;\n if (!rootEl || cfg.expandOn === 'none') return;\n const nextTarget = event.relatedTarget as Node | null;\n if (nextTarget && rootEl.contains(nextTarget)) return;\n if (pickerOpenRef.current || pressGuardRef.current) return;\n if (!hasText(cfg.value) && getAttachments().length === 0) setOpen(false);\n },\n [onBlurCapture, setOpen, getAttachments],\n );\n\n const handleDrop = React.useCallback((files: File[]) => {\n appendFiles(files);\n }, [appendFiles]);\n\n // Validation happens in addFiles so drop, paste and picker share one rule set\n const { getRootProps, isDragActive } = useDropzone({\n onDrop: handleDrop,\n // Drop any earlier message so it is not re-announced when the drag hint goes away\n onDragEnter: () => announce(''),\n noClick: true,\n noKeyboard: true,\n // Textarea handles paste itself; letting the dropzone see it attaches twice\n noPaste: true,\n disabled: !dropzone || disabled || readOnly,\n });\n const dragActive = dropzone && isDragActive;\n\n React.useImperativeHandle(\n apiRef,\n () => ({\n focusTextarea: () => textareaRef.current?.focus({ preventScroll: true }),\n openFilePicker: () => openFilePicker(),\n }),\n [openFilePicker],\n );\n\n // Click-to-focus: focus textarea when clicking non-interactive areas inside the container\n const handleContainerPointerDown = React.useCallback(\n (event: React.PointerEvent) => {\n if (disabled) return;\n if (event.pointerType === 'mouse' && event.button !== 0) return;\n const target = event.target;\n if (target instanceof Element && target.closest('button, [role=\"button\"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex=\"-1\"])')) return;\n event.preventDefault();\n textareaRef.current?.focus({ preventScroll: true });\n },\n [disabled],\n );\n\n const contextValue = React.useMemo<ChatbarContextValue>(\n () => ({\n open,\n setOpen,\n setValue,\n size,\n expandOn,\n minLines,\n maxLines,\n sendMode,\n disabled,\n readOnly,\n paste,\n clearOnSubmit,\n multiple,\n textareaRef,\n attachments,\n removeAttachment,\n submit,\n appendFiles,\n appendFilesFromPaste,\n openFilePicker,\n beginFilePickerPress,\n }),\n [\n open, setOpen, setValue, size, expandOn, minLines, maxLines, sendMode, disabled, readOnly, paste,\n clearOnSubmit, multiple, attachments, removeAttachment, submit, appendFiles, appendFilesFromPaste,\n openFilePicker, beginFilePickerPress,\n ],\n );\n\n return (\n <ChatbarContext.Provider value={contextValue}>\n <ChatbarValueContext.Provider value={value}>\n <>\n <div\n {...divProps}\n ref={composedRootRef}\n className={classNames('kui-ChatbarRoot', `kui-r-size-${size}`, className)}\n style={{ position: 'relative', width, maxWidth, ...style }}\n data-state={open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n data-readonly={readOnly ? '' : undefined}\n data-drop-active={dragActive ? '' : undefined}\n data-accent-color={color}\n data-radius={radius}\n onBlurCapture={handleBlurCapture}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n tabIndex={-1}\n aria-hidden\n style={{ display: 'none' }}\n onChange={handleFileInputChange}\n />\n {notices ? (\n <div className=\"kui-ChatbarNotices\">\n <NoticeSizeContext.Provider value={size}>{notices}</NoticeSizeContext.Provider>\n </div>\n ) : null}\n <div {...(dropzone ? getRootProps() : {})} style={{ width: '100%', flex: '1 1 auto', minHeight: 0 }} onPointerDown={handleContainerPointerDown}>\n <div\n className={classNames('kui-ChatbarBox', `kui-variant-${variant ?? 'raised'}`)}\n style={{ position: 'relative' }}\n data-accent-color={color}\n data-radius={radius}\n >\n <div className=\"kui-ChatbarGrid\">\n {children}\n </div>\n {dragActive && (\n <div className=\"kui-ChatbarDropOverlay\" aria-hidden>\n <div className=\"kui-ChatbarDropContent\">\n <Text emphasis=\"medium\" size={size} weight=\"medium\">\n Drop files here to attach\n </Text>\n </div>\n </div>\n )}\n </div>\n </div>\n {context ? (\n <Text as=\"div\" size={size === '3' ? '2' : '1'} emphasis=\"medium\" className=\"kui-ChatbarContext\">\n {context}\n </Text>\n ) : null}\n <VisuallyHidden role=\"status\" aria-live=\"polite\">\n {dragActive ? 'Drop files here to attach.' : <span key={announcement.id}>{announcement.text}</span>}\n </VisuallyHidden>\n </div>\n </>\n </ChatbarValueContext.Provider>\n </ChatbarContext.Provider>\n );\n});\nRoot.displayName = 'Chatbar.Root';\n\n/**\n * Multi-line text input for Chatbar.\n * - Uses onChange to control value and avoid duplicate updates.\n * - Auto-resizes between minLines and maxLines.\n * - Expands on focus/overflow per `expandOn`.\n * - Paste-to-attach: when `paste` is enabled on Root, pasting files adds attachments.\n * - Provide `aria-label` or `aria-labelledby` for an accessible name.\n */\ninterface TextareaProps extends Omit<React.ComponentPropsWithoutRef<'textarea'>, 'size' | 'rows' | 'value' | 'defaultValue'> {\n asChild?: boolean;\n /**\n * When true, pressing Enter submits (Shift+Enter inserts a newline).\n * Works with every `sendMode`. Defaults to false.\n */\n submitOnEnter?: boolean;\n}\n\n/**\n * Chatbar multi-line text input.\n *\n * Behavior\n * - Controls the Chatbar value via React onChange.\n * - Auto-resizes between minLines and maxLines in a single layout effect, which\n * also opens the Chatbar when content overflows the compact height and\n * `expandOn` is `overflow` or `both`.\n * - Consumer handlers run first; calling `preventDefault` in `onKeyDown` or\n * `onPaste` skips the built-in submit or attach behavior.\n *\n * Accessibility\n * - Consumers should provide labeling via aria-label or aria-labelledby\n * on this component, as no implicit label is rendered.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, forwardedRef) => {\n const {\n className,\n style,\n asChild,\n onFocus,\n onChange,\n onPaste,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n submitOnEnter = false,\n ...textareaProps\n } = props;\n const ctx = useChatbarContext();\n const value = React.useContext(ChatbarValueContext);\n const { open, minLines, maxLines, expandOn, disabled, readOnly, setOpen, setValue, textareaRef, paste, appendFilesFromPaste, size, submit, clearOnSubmit } = ctx;\n const composedRef = useComposedRefs(forwardedRef, textareaRef);\n\n // Cached metrics to avoid repeated getComputedStyle calls\n const lineHeightRef = React.useRef(0);\n const paddingRef = React.useRef(0);\n const composingRef = React.useRef(false);\n\n const sizingRef = React.useRef({ open, minLines, maxLines });\n // Declared before the sizing effect so it runs first in the same commit\n useLayoutEffect(() => {\n sizingRef.current = { open, minLines, maxLines };\n }, [open, minLines, maxLines]);\n\n const recomputeMetrics = React.useCallback(() => {\n const el = textareaRef.current;\n if (!el) return;\n const computedStyle = window.getComputedStyle(el);\n lineHeightRef.current = parseFloat(computedStyle.lineHeight) || 20;\n paddingRef.current = (parseFloat(computedStyle.paddingTop) || 0) + (parseFloat(computedStyle.paddingBottom) || 0);\n }, [textareaRef]);\n\n // Sizes `el` for the given open state; caller must have set height to 'auto' first\n const applyHeight = React.useCallback((el: HTMLTextAreaElement, isOpen: boolean) => {\n const { minLines: min, maxLines: max } = sizingRef.current;\n const lineHeight = lineHeightRef.current;\n const padding = paddingRef.current;\n const minHeight = Math.ceil((isOpen ? min : 1) * lineHeight) + padding;\n const maxHeight = Math.ceil((isOpen ? max : 1) * lineHeight) + padding;\n const contentHeight = Math.max(el.scrollHeight, minHeight);\n el.style.height = `${Math.min(contentHeight, maxHeight)}px`;\n const overflowing = contentHeight > maxHeight;\n el.style.overflowY = overflowing ? 'auto' : 'hidden';\n el.style.maxHeight = overflowing ? `${maxHeight}px` : 'none';\n }, []);\n\n // Typography depends on size\n useLayoutEffect(() => {\n recomputeMetrics();\n }, [recomputeMetrics, size]);\n\n // Single place for sizing and overflow auto-open: one height reset, one scrollHeight read\n useLayoutEffect(() => {\n const el = textareaRef.current;\n if (!el) return;\n if (lineHeightRef.current === 0) recomputeMetrics();\n withoutPlaceholder(el, () => {\n el.style.height = 'auto';\n let isOpen = open;\n if (!open && (expandOn === 'overflow' || expandOn === 'both')) {\n const compactHeight = Math.ceil(lineHeightRef.current) + paddingRef.current;\n if (el.scrollHeight > compactHeight + 1) {\n isOpen = true;\n setOpen(true);\n }\n }\n applyHeight(el, isOpen);\n });\n }, [value, open, expandOn, minLines, maxLines, size, setOpen, textareaRef, recomputeMetrics, applyHeight]);\n\n // Width changes re-wrap text; re-measure only when the width actually changes\n React.useEffect(() => {\n const el = textareaRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return;\n let prevWidth = -1;\n const ro = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width ?? 0;\n if (width === prevWidth) return;\n const first = prevWidth === -1;\n prevWidth = width;\n if (first) return;\n recomputeMetrics();\n withoutPlaceholder(el, () => {\n el.style.height = 'auto';\n applyHeight(el, sizingRef.current.open);\n });\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, [textareaRef, recomputeMetrics, applyHeight]);\n\n // Dev-only warning if no accessible name is provided\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n // Read the DOM, not the props: a `<label htmlFor>` or an asChild child's own label counts too.\n const el = textareaRef.current;\n const hasLabel =\n textareaProps['aria-label'] != null ||\n textareaProps['aria-labelledby'] != null ||\n Boolean(el?.getAttribute('aria-label') || el?.getAttribute('aria-labelledby') || el?.labels?.length);\n if (!hasLabel) {\n console.warn('[Chatbar.Textarea] Provide aria-label, aria-labelledby or a <label htmlFor> to ensure the control has an accessible name.');\n }\n // warn only on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleFocus = React.useCallback<React.FocusEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onFocus?.(event);\n if (disabled || readOnly) return;\n if ((expandOn === 'focus' || expandOn === 'both') && !open) setOpen(true);\n },\n [disabled, readOnly, expandOn, open, setOpen, onFocus],\n );\n\n const handleChange = React.useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n (event) => {\n setValue(event.currentTarget.value);\n onChange?.(event);\n },\n [setValue, onChange],\n );\n\n const handlePaste = React.useCallback<React.ClipboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onPaste?.(event);\n if (event.defaultPrevented || !paste || disabled || readOnly) return;\n const files = Array.from(event.clipboardData?.items ?? [])\n .filter((item) => item.kind === 'file')\n .map((item) => item.getAsFile())\n .filter((f): f is File => !!f);\n if (files.length === 0) return;\n // Suppress the filename/text representation only when a file was actually attached\n if (appendFilesFromPaste(files) > 0) event.preventDefault();\n },\n [paste, disabled, readOnly, onPaste, appendFilesFromPaste],\n );\n\n const handleCompositionStart = React.useCallback<React.CompositionEventHandler<HTMLTextAreaElement>>(\n (event) => {\n composingRef.current = true;\n onCompositionStart?.(event);\n },\n [onCompositionStart],\n );\n\n const handleCompositionEnd = React.useCallback<React.CompositionEventHandler<HTMLTextAreaElement>>(\n (event) => {\n composingRef.current = false;\n onCompositionEnd?.(event);\n },\n [onCompositionEnd],\n );\n\n const handleKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !submitOnEnter) return;\n if (event.key !== 'Enter' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;\n // Safari fires the IME-confirming Enter after compositionend with keyCode 229\n if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n // Plain Enter never inserts a newline when submitOnEnter is on, even with nothing to send\n event.preventDefault();\n submit(clearOnSubmit);\n },\n [submitOnEnter, onKeyDown, submit, clearOnSubmit],\n );\n\n const Comp = asChild ? Slot : 'textarea';\n return (\n // className and style both reach the textarea, like every other textarea attribute.\n <div className=\"kui-ChatbarField kui-ChatbarTextarea\">\n <Comp\n {...textareaProps}\n ref={composedRef}\n className={classNames('kui-ChatbarInput', className)}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n disabled={disabled}\n readOnly={readOnly}\n rows={open ? minLines : 1}\n spellCheck={textareaProps.spellCheck ?? true}\n autoCorrect={textareaProps.autoCorrect ?? 'on'}\n style={style}\n />\n </div>\n );\n});\nTextarea.displayName = 'Chatbar.Textarea';\n\ninterface InlineSlotProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nconst InlineStart = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp {...divProps} ref={forwardedRef} className={classNames('kui-ChatbarInlineStart', className)}>\n {children}\n </Comp>\n );\n});\nInlineStart.displayName = 'Chatbar.InlineStart';\n\nconst InlineEnd = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp {...divProps} ref={forwardedRef} className={classNames('kui-ChatbarInlineEnd', className)}>\n {children}\n </Comp>\n );\n});\nInlineEnd.displayName = 'Chatbar.InlineEnd';\n\n/**\n * Renders a horizontally scrollable list of attachments above the inline row.\n * Hidden when empty unless `forceMount`. Override per-item with `renderAttachment`.\n * `Chatbar.Item`s passed as children follow the attachments in the same row.\n */\ninterface AttachmentsRowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n forceMount?: boolean;\n /** If provided, custom-render a tile; otherwise default tile is used */\n renderAttachment?: (attachment: ChatbarAttachment) => React.ReactNode;\n /** `Chatbar.Item`s: things the message refers to that are not files. */\n children?: React.ReactNode;\n}\n\nconst AttachmentsRow = React.forwardRef<HTMLDivElement, AttachmentsRowProps>((props, forwardedRef) => {\n const { asChild, forceMount, renderAttachment, className, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const hasItems = React.Children.toArray(children).length > 0;\n if (ctx.attachments.length === 0 && !hasItems && !forceMount) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <div>\n <Comp {...divProps} ref={forwardedRef} className={classNames('kui-ChatbarAttachmentsRow', className)} role=\"list\" aria-label={divProps['aria-label'] ?? 'Attachments'}>\n <ScrollArea className=\"kui-ChatbarScrollArea\" scrollbars=\"horizontal\">\n <Flex align=\"center\" gap=\"3\" minWidth=\"fit-content\">\n {ctx.attachments.map((att) => (\n <Attachment key={att.id} attachment={att} asChild={!!renderAttachment}>\n {renderAttachment?.(att)}\n </Attachment>\n ))}\n {children}\n </Flex>\n </ScrollArea>\n </Comp>\n </div>\n );\n});\nAttachmentsRow.displayName = 'Chatbar.AttachmentsRow';\n\n/**\n * Moves focus off a pill that is about to unmount, to the next pill's remove\n * button, the previous one's, or the text, so keyboard users are not dropped\n * to <body>.\n */\nfunction moveFocusOffPill(button: HTMLButtonElement, textareaRef: React.RefObject<HTMLTextAreaElement | null>) {\n const pill = button.closest('[role=\"listitem\"]');\n const pills = pill?.parentElement ? Array.from(pill.parentElement.children) : [];\n const index = pill ? pills.indexOf(pill) : -1;\n const neighbour = pills[index + 1] ?? pills[index - 1];\n const nextButton = neighbour?.querySelector<HTMLButtonElement>('.kui-ChatbarItemRemove');\n if (nextButton) nextButton.focus();\n else textareaRef.current?.focus({ preventScroll: true });\n}\n\n/** The pill an attachment and an item share: a lead tile, a label and \u00D7. */\nconst Pill: React.FC<{\n lead: React.ReactNode;\n leadKind: 'image' | 'icon';\n label: React.ReactNode;\n /** Read after the label by screen readers only, e.g. a file's size. */\n detail?: string;\n removeLabel: string;\n onRemove?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n}> = ({ lead, leadKind, label, detail, removeLabel, onRemove }) => {\n const ctx = useChatbarContext();\n return (\n <>\n <span className=\"kui-ChatbarItemLead\" data-kind={leadKind} aria-hidden>\n {lead}\n </span>\n <Text className=\"kui-ChatbarItemLabel\" size={ctx.size} truncate>\n {label}\n {detail ? <VisuallyHidden>, {detail}</VisuallyHidden> : null}\n </Text>\n {onRemove && (\n <Button iconOnly className=\"kui-ChatbarItemRemove\" aria-label={removeLabel} size=\"1\" variant=\"ghost\" color=\"gray\" onClick={onRemove}>\n <CloseIcon />\n </Button>\n )}\n </>\n );\n};\n\n/** Default tile renderer for a single attachment. */\ninterface AttachmentProps extends React.ComponentPropsWithoutRef<'div'> {\n attachment: ChatbarAttachment;\n asChild?: boolean;\n}\n\nconst STATUS_LABEL: Partial<Record<AttachmentStatus, string>> = { uploading: 'uploading', error: 'failed to upload' };\n\nconst Attachment = React.forwardRef<HTMLDivElement, AttachmentProps>((props, forwardedRef) => {\n const { attachment, asChild, className, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const Comp = asChild ? Slot : 'div';\n const isImage = !!attachment.url && isImageLike(attachment.name, attachment.type);\n const sizeLabel = `${Math.ceil(attachment.size / 1024)} KB`;\n const statusLabel = attachment.status ? STATUS_LABEL[attachment.status] : undefined;\n const locked = ctx.disabled || ctx.readOnly;\n\n const handleRemove = (event: React.MouseEvent<HTMLButtonElement>) => {\n moveFocusOffPill(event.currentTarget, ctx.textareaRef);\n ctx.removeAttachment(attachment.id);\n };\n\n const lead =\n attachment.status === 'uploading' ? (\n <Spinner />\n ) : isImage ? (\n <img className=\"kui-ChatbarAttachmentImage\" src={attachment.url} alt=\"\" />\n ) : (\n <FileTextIcon />\n );\n\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames(children ? 'kui-ChatbarAttachment' : 'kui-ChatbarAttachment kui-ChatbarItem', className)}\n role=\"listitem\"\n data-kind={isImage ? 'image' : 'file'}\n data-status={attachment.status}\n title={attachment.name}\n >\n {children ?? (\n <Pill\n lead={lead}\n leadKind={isImage && attachment.status !== 'uploading' ? 'image' : 'icon'}\n label={attachment.name}\n detail={statusLabel ? `${sizeLabel}, ${statusLabel}` : sizeLabel}\n removeLabel={`Remove ${attachment.name}`}\n onRemove={locked ? undefined : handleRemove}\n />\n )}\n </Comp>\n );\n});\nAttachment.displayName = 'Chatbar.Attachment';\n\n/**\n * Something the message refers to that is not a file: a scene object, a\n * picked mode, a selection. The same pill as an attachment, placed in\n * `Chatbar.AttachmentsRow` as a child. The app owns the list, so removing one\n * calls `onRemove` and nothing else; leave it out for a pill that cannot be\n * removed.\n */\ninterface ItemProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children' | 'color'> {\n /** The label. Also names the remove button: \"Remove {label}\". */\n children: string;\n /** Drawn in the lead tile, tinted with `color`. */\n icon?: React.ReactNode;\n /** A thumbnail for the lead tile, in place of the icon. */\n image?: string;\n /** Tint of the icon tile. Defaults to gray. */\n color?: (typeof accentColors)[number];\n onRemove?: () => void;\n /** Overrides the remove button's label. */\n removeLabel?: string;\n}\n\nconst Item = React.forwardRef<HTMLDivElement, ItemProps>((props, forwardedRef) => {\n const { children, icon, image, color, onRemove, removeLabel, className, ...divProps } = props;\n const ctx = useChatbarContext();\n const locked = ctx.disabled || ctx.readOnly;\n\n const handleRemove = onRemove\n ? (event: React.MouseEvent<HTMLButtonElement>) => {\n moveFocusOffPill(event.currentTarget, ctx.textareaRef);\n onRemove();\n }\n : undefined;\n\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n className={classNames('kui-ChatbarItem', className)}\n role=\"listitem\"\n data-accent-color={image ? undefined : (color ?? 'gray')}\n title={children}\n >\n <Pill\n lead={image ? <img className=\"kui-ChatbarAttachmentImage\" src={image} alt=\"\" /> : icon}\n leadKind={image ? 'image' : 'icon'}\n label={children}\n removeLabel={removeLabel ?? `Remove ${children}`}\n onRemove={locked ? undefined : handleRemove}\n />\n </div>\n );\n});\nItem.displayName = 'Chatbar.Item';\n\ninterface AttachTriggerProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n /** Overrides Root `accept` for files chosen through this trigger */\n accept?: string | string[];\n multiple?: boolean;\n}\n\nconst AttachTrigger = React.forwardRef<HTMLButtonElement, AttachTriggerProps>((props, forwardedRef) => {\n // The HTML `color` attribute is dropped: Button reads `color` as an accent colour.\n const { asChild, accept, multiple, disabled: disabledProp, onPointerDown, onClick, children, color: _color, ...buttonProps } = props;\n const ctx = useChatbarContext();\n const disabled = disabledProp || ctx.disabled || ctx.readOnly;\n const triggerProps = {\n ...buttonProps,\n ref: forwardedRef,\n className: classNames('kui-ChatbarAttachTrigger', buttonProps.className),\n type: buttonProps.type ?? 'button',\n 'aria-label': buttonProps['aria-label'] ?? 'Add attachments',\n disabled,\n onPointerDown: (event: React.PointerEvent<HTMLButtonElement>) => {\n onPointerDown?.(event);\n if (!disabled && !event.defaultPrevented) ctx.beginFilePickerPress();\n },\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (disabled || event.defaultPrevented) return;\n ctx.openFilePicker({ accept, multiple });\n },\n } as const;\n\n if (asChild) return <Slot {...triggerProps}>{children}</Slot>;\n\n // Without asChild, the trigger is a quiet icon-only Button at the Chatbar's size.\n return (\n <Button iconOnly emphasis=\"quiet\" color=\"gray\" size={ctx.size} {...triggerProps}>\n {children ?? <PaperclipIcon aria-hidden />}\n </Button>\n );\n});\nAttachTrigger.displayName = 'Chatbar.AttachTrigger';\n\ninterface RowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nconst Row = React.forwardRef<HTMLDivElement, RowProps>((props, forwardedRef) => {\n const { asChild, children, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (!ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <div>\n <Comp {...divProps} ref={forwardedRef} className={classNames('kui-ChatbarRow', className)}>\n <Flex align=\"center\" justify=\"between\" width=\"100%\">\n {children}\n </Flex>\n </Comp>\n </div>\n );\n});\nRow.displayName = 'Chatbar.Row';\n\ntype RowSlotProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst RowStart = React.forwardRef<HTMLDivElement, RowSlotProps>((props, forwardedRef) => {\n const { className, ...divProps } = props;\n return <div {...divProps} ref={forwardedRef} className={classNames('kui-ChatbarRowStart', className)} />;\n});\nRowStart.displayName = 'Chatbar.RowStart';\n\nconst RowEnd = React.forwardRef<HTMLDivElement, RowSlotProps>((props, forwardedRef) => {\n const { className, ...divProps } = props;\n return <div {...divProps} ref={forwardedRef} className={classNames('kui-ChatbarRowEnd', className)} />;\n});\nRowEnd.displayName = 'Chatbar.RowEnd';\n\ntype SendStatus = 'ready' | 'submitted' | 'streaming' | 'error';\n\ntype SendProps = Omit<ButtonProps, 'aria-label' | 'aria-labelledby' | 'variant' | 'emphasis' | 'iconOnly' | 'fullWidth'> &\n ButtonRankProps & {\n /** Optional override for accessible name. Defaults to \"Send\". */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n asChild?: boolean;\n /** Clear message and attachments after sending. Defaults to Root `clearOnSubmit`. */\n clearOnSend?: boolean;\n /**\n * What the button means. `ready` sends. While a reply is `submitted` or `streaming` and the\n * box is empty, the button STOPS the reply (`onStop`); with a draft in the box it still sends,\n * and the app decides whether sending interrupts the reply. After an `error`, an empty box\n * makes it RETRY (`onRetry`). Default `ready`.\n */\n status?: SendStatus;\n /** Called when the button is pressed to stop a reply. */\n onStop?: () => void;\n /** Called when the button is pressed to retry after an error. */\n onRetry?: () => void;\n /** Accessible name while it stops. Default \"Stop\". */\n stopLabel?: string;\n /** Accessible name while it retries. Default \"Retry\". */\n retryLabel?: string;\n /** Glyph while it stops. Defaults to a square, or a spinner while `submitted`. */\n stopIcon?: React.ReactNode;\n /** Glyph while it retries. */\n retryIcon?: React.ReactNode;\n};\n\nconst Send = React.forwardRef<HTMLButtonElement, SendProps>((props, forwardedRef) => {\n const {\n asChild,\n clearOnSend,\n disabled,\n children,\n style,\n className,\n size: sizeProp,\n variant: variantProp, emphasis,\n tabIndex,\n onClick,\n status = 'ready',\n onStop,\n onRetry,\n stopLabel = 'Stop',\n retryLabel = 'Retry',\n stopIcon,\n retryIcon,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...buttonProps\n } = props;\n const ctx = useChatbarContext();\n const value = React.useContext(ChatbarValueContext);\n\n const hasContent = hasText(value) || ctx.attachments.length > 0;\n const running = status === 'submitted' || status === 'streaming';\n const mode: 'send' | 'stop' | 'retry' = hasContent ? 'send' : running ? 'stop' : status === 'error' ? 'retry' : 'send';\n\n if (ctx.sendMode === 'never' && mode === 'send') return null;\n\n const visible = mode !== 'send' || ctx.sendMode === 'always' || hasContent;\n const inactive = mode === 'send' ? disabled || ctx.disabled || ctx.readOnly || !hasContent : disabled || ctx.disabled;\n\n const sendName = ariaLabel ?? 'Send';\n const labelProps: { 'aria-label': string } | { 'aria-labelledby': string } =\n mode === 'stop' ? { 'aria-label': stopLabel } : mode === 'retry' ? { 'aria-label': retryLabel } : ariaLabelledby ? { 'aria-labelledby': ariaLabelledby } : { 'aria-label': sendName };\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || inactive) return;\n if (mode === 'stop') {\n onStop?.();\n return;\n }\n if (mode === 'retry') {\n onRetry?.();\n return;\n }\n const clear = clearOnSend ?? ctx.clearOnSubmit;\n // Clearing hides and disables this button; keep keyboard focus in the composer\n if (ctx.submit(clear) && clear) ctx.textareaRef.current?.focus({ preventScroll: true });\n };\n\n const glyph =\n mode === 'stop' ? (\n stopIcon ?? (status === 'submitted' ? <Spinner /> : (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2\" />\n </svg>\n ))\n ) : mode === 'retry' ? (\n retryIcon ?? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n )\n ) : (\n children ?? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n )\n );\n\n return (\n <Button\n iconOnly\n {...buttonProps}\n ref={forwardedRef}\n size={sizeProp ?? ctx.size}\n {...(emphasis ? { emphasis } : { variant: variantProp ?? (ctx.open || mode !== 'send' ? 'solid' : 'ghost') })}\n disabled={inactive}\n className={classNames('kui-ChatbarSend', className)}\n style={{ opacity: visible ? 1 : 0, pointerEvents: visible ? undefined : 'none', ...style }}\n // Hidden Send must not be reachable by keyboard or announced\n aria-hidden={visible ? undefined : true}\n tabIndex={visible ? tabIndex : -1}\n asChild={asChild}\n onClick={handleClick}\n data-status={status}\n data-mode={mode}\n {...labelProps}\n >\n {glyph}\n </Button>\n );\n});\nSend.displayName = 'Chatbar.Send';\n\nexport { Root, Textarea, InlineStart, InlineEnd, AttachmentsRow, Attachment, Item, AttachTrigger, Row, RowStart, RowEnd, Send };\nexport type {\n RootProps as ChatbarRootProps,\n TextareaProps as ChatbarTextareaProps,\n InlineSlotProps as ChatbarInlineSlotProps,\n AttachmentsRowProps as ChatbarAttachmentsRowProps,\n AttachmentProps as ChatbarAttachmentProps,\n ItemProps as ChatbarItemProps,\n AttachTriggerProps as ChatbarAttachTriggerProps,\n RowProps as ChatbarRowProps,\n RowSlotProps as ChatbarRowSlotProps,\n SendProps as ChatbarSendProps,\n ChatbarAttachment,\n ChatbarAttachmentRejection,\n ChatbarRejectReason,\n ChatbarSubmitPayload,\n AttachmentStatus as ChatbarAttachmentStatus,\n ExpandOn as ChatbarExpandOn,\n SendMode as ChatbarSendMode,\n SendStatus as ChatbarSendStatus,\n};\n"],
|
|
5
|
-
"mappings": ";kdAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,mBAAAE,GAAA,eAAAC,GAAA,mBAAAC,GAAA,cAAAC,GAAA,gBAAAC,GAAA,SAAAC,GAAA,SAAAC,GAAA,QAAAC,GAAA,WAAAC,GAAA,aAAAC,GAAA,SAAAC,GAAA,aAAAC,KAAA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,mBAAAC,GAAiB,mBAAAC,OAAuB,oBACjD,OAAS,eAAAC,OAAmB,iBAmC5B,SAASC,GAAmBC,EAAyBC,EAA2B,CAC9E,GAAM,CAAE,YAAAC,CAAY,EAAIF,EACxB,GAAI,CAACE,EAAa,CAChBD,EAAQ,EACR,MACF,CACAD,EAAG,YAAc,GACjB,GAAI,CACFC,EAAQ,CACV,QAAE,CACAD,EAAG,YAAcE,CACnB,CACF,CA4EA,IAAMC,GAAqB,CAAE,OAAQ,CAAC,IAAK,IAAK,GAAG,CAAW,EAExDC,GAAuB,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,KAAK,OAAO,OAAO,eAAe,YAAY,IAAI,cAAc,QAAQ,eAAe,QAAQ,cAAW,IAC3L,gBAAC,QAAK,EAAE,WAAW,EACnB,gBAAC,QAAK,EAAE,gBAAgB,CAC1B,EAIN,OACE,gBAACwL,GAAA,CACC,SAAQ,GACP,GAAGoB,EACJ,IAAK/M,EACL,KAAMiB,GAAY3C,EAAI,KACrB,GAAIkP,EAAW,CAAE,SAAAA,CAAS,EAAI,CAAE,QAASD,IAAgBjP,EAAI,MAAQ8P,IAAS,OAAS,QAAU,QAAS,EAC3G,SAAUE,EACV,UAAW/G,EAAW,kBAAmBtH,CAAS,EAClD,MAAO,CAAE,QAASoO,EAAU,EAAI,EAAG,cAAeA,EAAU,OAAY,OAAQ,GAAGnO,CAAM,EAEzF,cAAamO,EAAU,OAAY,GACnC,SAAUA,EAAUZ,EAAW,GAC/B,QAAS7F,EACT,QAAS4G,EACT,cAAad,EACb,YAAWU,EACV,GAAGG,GAEHE,CACH,CAEJ,CAAC,EACDpB,GAAK,YAAc",
|
|
6
|
-
"names": ["chatbar_exports", "__export", "AttachTrigger", "Attachment", "AttachmentsRow", "InlineEnd", "InlineStart", "Item", "Root", "Row", "RowEnd", "RowStart", "Send", "Textarea", "React", "classNames", "useComposedRefs", "useLayoutEffect", "useDropzone", "withoutPlaceholder", "el", "measure", "placeholder", "chatbarSizePropDef", "ChatbarContext", "ChatbarValueContext", "useChatbarContext", "ctx", "toArray", "val", "s", "matchesAccept", "file", "patterns", "mime", "name", "patRaw", "pat", "type", "subtype", "fmType", "fmSubtype", "IMAGE_EXT_RE", "isImageLike", "hasText", "value", "plural", "n", "word", "attachmentCounter", "createAttachmentId", "Root", "props", "forwardedRef", "className", "style", "children", "valueProp", "defaultValue", "onValueChange", "openProp", "defaultOpen", "onOpenChange", "expandOn", "minLines", "maxLines", "sendMode", "disabled", "readOnly", "onSubmit", "sizeProp", "variant", "color", "radius", "width", "maxWidth", "attachmentsProp", "defaultAttachments", "onAttachmentsChange", "accept", "multiple", "maxAttachments", "maxFileSize", "paste", "pasteAccept", "clearOnSubmit", "onAttachmentReject", "dropzone", "apiRef", "onBlurCapture", "notices", "context", "divProps", "size", "useThemeSize", "isValueControlled", "valueUncontrolled", "setValueUncontrolled", "isOpenControlled", "openUncontrolled", "setOpenUncontrolled", "open", "isAttachmentsControlled", "attachmentsUncontrolled", "setAttachmentsUncontrolled", "attachments", "announcement", "setAnnouncementState", "announce", "text", "prev", "rootRef", "composedRootRef", "useComposedRefs", "textareaRef", "fileInputRef", "pickerOpenRef", "pressGuardRef", "pressGuardTimerRef", "pickerRef", "acceptKey", "pasteAcceptKey", "accepts", "pasteAccepts", "snapshot", "latest", "pendingAttachmentsRef", "getAttachments", "setOpen", "next", "setValue", "setAttachments", "ownedUrlsRef", "addFiles", "files", "cfg", "current", "rejected", "remainingSlots", "perActionLimit", "url", "messages", "appendFiles", "appendFilesFromPaste", "removeAttachment", "id", "removed", "a", "submit", "clear", "payload", "att", "owned", "openFilePicker", "options", "input", "beginFilePickerPress", "reset", "handleFileInputChange", "event", "picker", "handleBlurCapture", "rootEl", "nextTarget", "handleDrop", "getRootProps", "isDragActive", "useDropzone", "dragActive", "handleContainerPointerDown", "target", "contextValue", "classNames", "NoticeSizeContext", "Text", "VisuallyHidden", "Textarea", "asChild", "onFocus", "onChange", "onPaste", "onKeyDown", "onCompositionStart", "onCompositionEnd", "submitOnEnter", "textareaProps", "composedRef", "lineHeightRef", "paddingRef", "composingRef", "sizingRef", "useLayoutEffect", "recomputeMetrics", "computedStyle", "applyHeight", "isOpen", "min", "max", "lineHeight", "padding", "minHeight", "maxHeight", "contentHeight", "overflowing", "compactHeight", "prevWidth", "ro", "entries", "first", "handleFocus", "handleChange", "handlePaste", "item", "f", "handleCompositionStart", "handleCompositionEnd", "handleKeyDown", "Slot", "InlineStart", "InlineEnd", "AttachmentsRow", "forceMount", "renderAttachment", "hasItems", "ScrollArea", "Flex", "Attachment", "moveFocusOffPill", "button", "pill", "pills", "index", "nextButton", "Pill", "lead", "leadKind", "label", "detail", "removeLabel", "onRemove", "Button", "CloseIcon", "STATUS_LABEL", "attachment", "Comp", "isImage", "sizeLabel", "statusLabel", "locked", "handleRemove", "Spinner", "FileTextIcon", "Item", "icon", "image", "AttachTrigger", "disabledProp", "onPointerDown", "onClick", "_color", "buttonProps", "triggerProps", "PaperclipIcon", "Row", "RowStart", "RowEnd", "Send", "clearOnSend", "variantProp", "emphasis", "tabIndex", "status", "onStop", "onRetry", "stopLabel", "retryLabel", "stopIcon", "retryIcon", "ariaLabel", "ariaLabelledby", "hasContent", "mode", "visible", "inactive", "labelProps", "handleClick", "glyph"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/theme.tsx", "../../src/helpers/get-matching-gray-color.ts"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Direction, Slot } from 'radix-ui';\n\nimport { getMatchingGrayColor } from '../helpers/get-matching-gray-color.js';\nimport { ThemeSizeContext } from '../helpers/theme-size.js';\nimport { usePropSyncedState } from '../hooks/use-prop-synced-state.js';\nimport { themePropDefs } from './theme.props.js';\n\nimport type { ThemeOwnProps } from './theme.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\nconst noop = () => {};\n\ntype ThemeAppearance = (typeof themePropDefs.appearance.values)[number];\ntype ThemeAccentColor = (typeof themePropDefs.accentColor.values)[number];\ntype ThemeGrayColor = (typeof themePropDefs.grayColor.values)[number];\ntype ThemeRadius = (typeof themePropDefs.radius.values)[number];\ntype ThemeFontFamily = (typeof themePropDefs.fontFamily.values)[number];\ntype ThemeSize = (typeof themePropDefs.size.values)[number];\n// Headings follow the body font until something sets this, so `undefined` is a\n// meaningful value here rather than a missing one.\ntype ThemeHeadingFontFamily = ThemeFontFamily | undefined;\n\ninterface ThemeChangeHandlers {\n onAppearanceChange: (appearance: ThemeAppearance) => void;\n onAccentColorChange: (accentColor: ThemeAccentColor) => void;\n onGrayColorChange: (grayColor: ThemeGrayColor) => void;\n onRadiusChange: (radius: ThemeRadius) => void;\n onFontFamilyChange: (fontFamily: ThemeFontFamily) => void;\n onHeadingFontFamilyChange: (headingFontFamily: ThemeHeadingFontFamily) => void;\n onSizeChange: (size: ThemeSize) => void;\n}\n\ninterface ThemeContextValue extends ThemeChangeHandlers {\n appearance: ThemeAppearance;\n accentColor: ThemeAccentColor;\n grayColor: ThemeGrayColor;\n resolvedGrayColor: ThemeGrayColor;\n radius: ThemeRadius;\n fontFamily: ThemeFontFamily;\n headingFontFamily: ThemeHeadingFontFamily;\n size: ThemeSize;\n}\n// Default theme values used when components render outside a Theme provider\nconst defaultThemeContext: ThemeContextValue = {\n appearance: themePropDefs.appearance.default,\n accentColor: themePropDefs.accentColor.default,\n grayColor: themePropDefs.grayColor.default,\n resolvedGrayColor: themePropDefs.grayColor.default,\n radius: themePropDefs.radius.default,\n fontFamily: themePropDefs.fontFamily.default,\n headingFontFamily: undefined,\n size: themePropDefs.size.default,\n onAppearanceChange: noop,\n onAccentColorChange: noop,\n onGrayColorChange: noop,\n onRadiusChange: noop,\n onFontFamilyChange: noop,\n onHeadingFontFamilyChange: noop,\n onSizeChange: noop,\n};\n\nconst ThemeContext = React.createContext<ThemeContextValue | undefined>(undefined);\n\nfunction useThemeContext() {\n const context = React.useContext(ThemeContext);\n // Return default context if used outside Theme provider (e.g., during SSR)\n return context ?? defaultThemeContext;\n}\n\ninterface ThemeProps extends ThemeImplPublicProps {}\nconst Theme = React.forwardRef<ThemeImplElement, ThemeProps>((props, forwardedRef) => {\n const context = React.useContext(ThemeContext);\n // Direction is inherited: a Radix DirectionProvider above the Theme (for a right-to-left app)\n // wins, and left-to-right stays the default when there is none.\n const dir = Direction.useDirection();\n const isRoot = context === undefined;\n if (isRoot) {\n return (\n <Direction.Provider dir={dir}>\n <ThemeRoot {...props} ref={forwardedRef} />\n </Direction.Provider>\n );\n }\n return <ThemeImpl {...props} ref={forwardedRef} />;\n});\nTheme.displayName = 'Theme';\n\nconst ThemeRoot = React.forwardRef<ThemeImplElement, ThemeImplPublicProps>((props, forwardedRef) => {\n const {\n appearance: appearanceProp = themePropDefs.appearance.default,\n accentColor: accentColorProp = themePropDefs.accentColor.default,\n grayColor: grayColorProp = themePropDefs.grayColor.default,\n radius: radiusProp = themePropDefs.radius.default,\n fontFamily: fontFamilyProp = themePropDefs.fontFamily.default,\n headingFontFamily: headingFontFamilyProp,\n size: sizeProp = themePropDefs.size.default,\n hasBackground = themePropDefs.hasBackground.default,\n ...rootProps\n } = props;\n\n // Each of these follows its prop but stays independently settable, so\n // the context setters can change the theme at runtime. Syncing during render\n // rather than in an effect matters here: an effect would commit the old\n // theme first and re-render every consumer of the context a second time.\n const [appearance, setAppearance] = usePropSyncedState(appearanceProp);\n const [accentColor, setAccentColor] = usePropSyncedState(accentColorProp);\n const [grayColor, setGrayColor] = usePropSyncedState(grayColorProp);\n const [radius, setRadius] = usePropSyncedState(radiusProp);\n const [fontFamily, setFontFamily] = usePropSyncedState(fontFamilyProp);\n const [headingFontFamily, setHeadingFontFamily] = usePropSyncedState(headingFontFamilyProp);\n const [size, setSize] = usePropSyncedState(sizeProp);\n\n return (\n <ThemeImpl\n {...rootProps}\n ref={forwardedRef}\n isRoot\n hasBackground={hasBackground}\n //\n appearance={appearance}\n accentColor={accentColor}\n grayColor={grayColor}\n radius={radius}\n fontFamily={fontFamily}\n headingFontFamily={headingFontFamily}\n size={size}\n //\n onAppearanceChange={setAppearance}\n onAccentColorChange={setAccentColor}\n onGrayColorChange={setGrayColor}\n onRadiusChange={setRadius}\n onFontFamilyChange={setFontFamily}\n onHeadingFontFamilyChange={setHeadingFontFamily}\n onSizeChange={setSize}\n />\n );\n});\nThemeRoot.displayName = 'ThemeRoot';\n\ntype ThemeImplElement = React.ElementRef<'div'>;\ninterface ThemeImplProps extends ThemeImplPublicProps, ThemeImplPrivateProps {}\ninterface ThemeImplPublicProps extends ComponentPropsWithout<'div', RemovedProps | 'dir'>, ThemeOwnProps {}\ninterface ThemeImplPrivateProps extends Partial<ThemeChangeHandlers> {\n isRoot?: boolean;\n}\nconst ThemeImpl = React.forwardRef<ThemeImplElement, ThemeImplProps>((props, forwardedRef) => {\n const context = React.useContext(ThemeContext);\n const {\n asChild,\n isRoot,\n hasBackground: hasBackgroundProp,\n //\n appearance = props.appearance ?? context?.appearance ?? themePropDefs.appearance.default,\n accentColor = props.accentColor ?? context?.accentColor ?? themePropDefs.accentColor.default,\n grayColor = props.grayColor ?? context?.resolvedGrayColor ?? themePropDefs.grayColor.default,\n radius = props.radius ?? context?.radius ?? themePropDefs.radius.default,\n fontFamily = props.fontFamily ?? context?.fontFamily ?? themePropDefs.fontFamily.default,\n headingFontFamily = props.headingFontFamily ?? context?.headingFontFamily,\n size = props.size ?? context?.size ?? themePropDefs.size.default,\n // A nested Theme forwards changes to the one above it, so a switcher\n // inside a portal (Dialog, Popover, menus) still reaches the root.\n onAppearanceChange = context?.onAppearanceChange ?? noop,\n onAccentColorChange = context?.onAccentColorChange ?? noop,\n onGrayColorChange = context?.onGrayColorChange ?? noop,\n onRadiusChange = context?.onRadiusChange ?? noop,\n onFontFamilyChange = context?.onFontFamilyChange ?? noop,\n onHeadingFontFamilyChange = context?.onHeadingFontFamilyChange ?? noop,\n onSizeChange = context?.onSizeChange ?? noop,\n //\n ...themeProps\n } = props;\n const Comp = asChild ? Slot.Root : 'div';\n const resolvedGrayColor = grayColor === 'auto' ? getMatchingGrayColor(accentColor) : grayColor;\n const isExplicitAppearance = props.appearance === 'light' || props.appearance === 'dark';\n const hasBackground = hasBackgroundProp === undefined ? isRoot || isExplicitAppearance : hasBackgroundProp;\n\n return (\n <ThemeContext.Provider\n value={React.useMemo(\n () => ({\n appearance,\n accentColor,\n grayColor,\n resolvedGrayColor,\n radius,\n fontFamily,\n headingFontFamily,\n size,\n //\n onAppearanceChange,\n onAccentColorChange,\n onGrayColorChange,\n onRadiusChange,\n onFontFamilyChange,\n onHeadingFontFamilyChange,\n onSizeChange,\n }),\n [\n appearance,\n accentColor,\n grayColor,\n resolvedGrayColor,\n radius,\n fontFamily,\n headingFontFamily,\n size,\n //\n onAppearanceChange,\n onAccentColorChange,\n onGrayColorChange,\n onRadiusChange,\n onFontFamilyChange,\n onHeadingFontFamilyChange,\n onSizeChange,\n ],\n )}\n >\n {/* Size travels on its own context as a bare string, so the components\n that read it do not re-render when another theme value changes. */}\n <ThemeSizeContext.Provider value={size}>\n <Comp\n data-is-root-theme={isRoot ? 'true' : 'false'}\n data-accent-color={accentColor}\n data-gray-color={resolvedGrayColor}\n // for nested `Theme` background\n data-has-background={hasBackground ? 'true' : 'false'}\n data-radius={radius}\n data-font-family={fontFamily}\n data-heading-font-family={headingFontFamily}\n ref={forwardedRef}\n {...themeProps}\n className={classNames(\n 'kui-theme',\n {\n light: appearance === 'light',\n dark: appearance === 'dark',\n },\n themeProps.className,\n )}\n />\n </ThemeSizeContext.Provider>\n </ThemeContext.Provider>\n );\n});\nThemeImpl.displayName = 'ThemeImpl';\n\nexport { Theme, ThemeContext, useThemeContext };\nexport type { ThemeProps, ThemeContextValue };\n", "import type { accentColors } from '../props/color.prop.js';\n\ntype ThemeAccentColor = (typeof accentColors)[number];\n\nexport function getMatchingGrayColor(accentColor: ThemeAccentColor) {\n switch (accentColor) {\n case 'tomato':\n case 'red':\n case 'ruby':\n case 'crimson':\n case 'pink':\n case 'plum':\n case 'purple':\n case 'violet':\n return 'mauve';\n case 'iris':\n case 'indigo':\n case 'blue':\n case 'sky':\n case 'cyan':\n return 'slate';\n case 'teal':\n case 'jade':\n case 'mint':\n case 'green':\n return 'sage';\n case 'grass':\n case 'lime':\n return 'olive';\n case 'yellow':\n case 'amber':\n case 'orange':\n case 'brown':\n case 'gold':\n case 'bronze':\n return 'sand';\n case 'gray':\n return 'gray';\n }\n}\n"],
|
|
5
|
-
"mappings": ";wHAEA,UAAYA,MAAW,QAC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AS,OAAS,QACtC,oBAAmBb,EACnB,kBAAiByB,EAEjB,sBAAqB9B,EAAgB,OAAS,QAC9C,cAAaS,EACb,mBAAkBE,EAClB,2BAA0BE,EAC1B,IAAK1B,EACJ,GAAGwC,EACJ,UAAWO,EACT,YACA,CACE,MAAOhC,IAAe,QACtB,KAAMA,IAAe,MACvB,EACAyB,EAAW,SACb,EACF,CACF,CACF,CAEJ,CAAC,EACDnC,EAAU,YAAc",
|
|
6
|
-
"names": ["React", "classNames", "Direction", "Slot", "getMatchingGrayColor", "accentColor", "noop", "defaultThemeContext", "themePropDefs", "ThemeContext", "useThemeContext", "Theme", "props", "forwardedRef", "context", "dir", "Direction", "ThemeRoot", "ThemeImpl", "appearanceProp", "accentColorProp", "grayColorProp", "radiusProp", "fontFamilyProp", "headingFontFamilyProp", "sizeProp", "hasBackground", "rootProps", "appearance", "setAppearance", "usePropSyncedState", "accentColor", "setAccentColor", "grayColor", "setGrayColor", "radius", "setRadius", "fontFamily", "setFontFamily", "headingFontFamily", "setHeadingFontFamily", "size", "setSize", "asChild", "isRoot", "hasBackgroundProp", "onAppearanceChange", "onAccentColorChange", "onGrayColorChange", "onRadiusChange", "onFontFamilyChange", "onHeadingFontFamilyChange", "onSizeChange", "themeProps", "Comp", "Slot", "resolvedGrayColor", "getMatchingGrayColor", "isExplicitAppearance", "ThemeSizeContext", "classNames"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/popover.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Popover as PopoverPrimitive } from 'radix-ui';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { popoverContentPropDefs } from './popover.props.js';\nimport { Theme } from './theme.js';\n\nimport type { PopoverContentOwnProps } from './popover.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\n// ---------------------------------------------\n// Popover Content Context\n// ---------------------------------------------\ntype PopoverContentContextValue = {\n /** Ref to the Popover.Content DOM node */\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n /** Update content's toolbar offset variable and presence flag */\n setToolbarOffset: (offsetPx: number) => void;\n /** Wire up aria-labelledby for toolbar title */\n setLabelId: (id: string | undefined) => void;\n};\n\nconst PopoverContentContext = React.createContext<PopoverContentContextValue | null>(null);\nconst usePopoverContentContext = (caller: string) => {\n const ctx = React.useContext(PopoverContentContext);\n if (!ctx) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`${caller} must be used within Popover.Content`);\n }\n }\n return ctx;\n};\n\ninterface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\nconst PopoverRoot: React.FC<PopoverRootProps> = (props: PopoverRootProps) => (\n <PopoverPrimitive.Root {...props} />\n);\nPopoverRoot.displayName = 'Popover.Root';\n\ntype PopoverTriggerElement = React.ElementRef<typeof PopoverPrimitive.Trigger>;\ninterface PopoverTriggerProps\n extends ComponentPropsWithout<typeof PopoverPrimitive.Trigger, RemovedProps> {}\nconst PopoverTrigger = React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <PopoverPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </PopoverPrimitive.Trigger>\n ),\n);\nPopoverTrigger.displayName = 'Popover.Trigger';\n\ntype PopoverContentElement = React.ElementRef<typeof PopoverPrimitive.Content>;\ninterface PopoverContentProps\n extends ComponentPropsWithout<typeof PopoverPrimitive.Content, RemovedProps>,\n PopoverContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>['container'];\n}\nconst PopoverContent = React.forwardRef<PopoverContentElement, PopoverContentProps>(\n (ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, popoverContentPropDefs.size);\n const {\n className,\n forceMount,\n container,\n ...contentProps\n } = extractProps(props, popoverContentPropDefs);\n\n // Manage refs (we need the DOM node to apply CSS variables)\n const contentRef = React.useRef<HTMLDivElement>(null);\n const combinedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n contentRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n (forwardedRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [forwardedRef],\n );\n\n const [labelId, setLabelId] = React.useState<string | undefined>(undefined);\n\n const setToolbarOffset = React.useCallback((offsetPx: number) => {\n const el = contentRef.current;\n if (!el) return;\n if (offsetPx > 0) {\n el.style.setProperty('--popover-toolbar-offset', `${offsetPx}px`);\n el.setAttribute('data-has-toolbar', 'true');\n } else {\n el.style.removeProperty('--popover-toolbar-offset');\n el.removeAttribute('data-has-toolbar');\n }\n }, []);\n\n return (\n <PopoverPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={8}\n collisionPadding={10}\n {...contentProps}\n ref={combinedRef}\n // A Toolbar.Title names the panel; without one, the caller's own value stands.\n aria-labelledby={labelId ?? contentProps['aria-labelledby']}\n className={classNames('kui-PopperContent', 'kui-PopoverContent', className)}\n >\n <PopoverContentContext.Provider value={React.useMemo(() => ({ contentRef, setToolbarOffset, setLabelId }), [setToolbarOffset])}>\n {props.children}\n </PopoverContentContext.Provider>\n </PopoverPrimitive.Content>\n </Theme>\n </PopoverPrimitive.Portal>\n );\n },\n);\nPopoverContent.displayName = 'Popover.Content';\n\ntype PopoverCloseElement = React.ElementRef<typeof PopoverPrimitive.Close>;\ninterface PopoverCloseProps\n extends ComponentPropsWithout<typeof PopoverPrimitive.Close, RemovedProps> {}\nconst PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n ({ children, ...props }, forwardedRef) => (\n <PopoverPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </PopoverPrimitive.Close>\n ),\n);\nPopoverClose.displayName = 'Popover.Close';\n\ntype PopoverAnchorElement = React.ElementRef<typeof PopoverPrimitive.Anchor>;\ninterface PopoverAnchorProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor> {}\nconst PopoverAnchor = React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n (props, forwardedRef) => <PopoverPrimitive.Anchor {...props} ref={forwardedRef} />,\n);\n\nPopoverAnchor.displayName = 'Popover.Anchor';\n\n// ---------------------------------------------\n// Toolbar (Popover-only)\n// ---------------------------------------------\n\ntype PopoverToolbarElement = HTMLDivElement;\ntype PopoverToolbarProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst PopoverToolbarBase = React.forwardRef<PopoverToolbarElement, PopoverToolbarProps>(\n ({ className, children, ...props }, forwardedRef) => {\n const ctx = usePopoverContentContext('Popover.Toolbar');\n\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRefs = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [forwardedRef],\n );\n\n React.useEffect(() => {\n if (!ctx || !localRef.current) return;\n const el = localRef.current;\n const update = () => {\n const height = el.getBoundingClientRect().height;\n ctx.setToolbarOffset(height);\n };\n update();\n const ro = new ResizeObserver(update);\n ro.observe(el);\n return () => {\n ro.disconnect();\n ctx.setToolbarOffset(0);\n };\n }, [ctx]);\n\n return (\n <div {...props} ref={setRefs} className={classNames('kui-PopoverToolbar', className)}>\n {children}\n </div>\n );\n },\n);\nPopoverToolbarBase.displayName = 'Popover.Toolbar';\n\ntype PopoverToolbarSectionProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst PopoverToolbarLeft = React.forwardRef<HTMLDivElement, PopoverToolbarSectionProps>(\n ({ className, ...props }, ref) => (\n <div\n {...props}\n ref={ref}\n className={classNames('kui-PopoverToolbarSection', 'kui-PopoverToolbarLeft', className)}\n />\n ),\n);\nPopoverToolbarLeft.displayName = 'Popover.Toolbar.Left';\n\nconst PopoverToolbarCenter = React.forwardRef<HTMLDivElement, PopoverToolbarSectionProps>(\n ({ className, ...props }, ref) => (\n <div\n {...props}\n ref={ref}\n className={classNames('kui-PopoverToolbarSection', 'kui-PopoverToolbarCenter', className)}\n />\n ),\n);\nPopoverToolbarCenter.displayName = 'Popover.Toolbar.Center';\n\nconst PopoverToolbarRight = React.forwardRef<HTMLDivElement, PopoverToolbarSectionProps>(\n ({ className, ...props }, ref) => (\n <div\n {...props}\n ref={ref}\n className={classNames('kui-PopoverToolbarSection', 'kui-PopoverToolbarRight', className)}\n />\n ),\n);\nPopoverToolbarRight.displayName = 'Popover.Toolbar.Right';\n\ntype PopoverToolbarTitleProps = React.ComponentPropsWithoutRef<'span'>;\nconst PopoverToolbarTitle = React.forwardRef<HTMLSpanElement, PopoverToolbarTitleProps>(\n ({ className, id: idProp, ...props }, ref) => {\n const ctx = usePopoverContentContext('Popover.Toolbar.Title');\n const reactId = React.useId();\n const id = idProp ?? `kui-popover-toolbar-title-${reactId}`;\n React.useEffect(() => {\n ctx?.setLabelId(id);\n return () => ctx?.setLabelId(undefined);\n }, [ctx, id]);\n return (\n <span\n {...props}\n id={id}\n ref={ref}\n className={classNames('kui-PopoverToolbarTitle', className)}\n />\n );\n },\n);\nPopoverToolbarTitle.displayName = 'Popover.Toolbar.Title';\n\ntype PopoverToolbarComponent = React.ForwardRefExoticComponent<\n React.PropsWithoutRef<PopoverToolbarProps> & React.RefAttributes<HTMLDivElement>\n> & {\n Left: typeof PopoverToolbarLeft;\n Center: typeof PopoverToolbarCenter;\n Right: typeof PopoverToolbarRight;\n Title: typeof PopoverToolbarTitle;\n};\n\nconst PopoverToolbar = Object.assign(PopoverToolbarBase, {\n Left: PopoverToolbarLeft,\n Center: PopoverToolbarCenter,\n Right: PopoverToolbarRight,\n Title: PopoverToolbarTitle,\n}) as PopoverToolbarComponent;\n\nexport {\n PopoverRoot as Root,\n PopoverContent as Content,\n PopoverTrigger as Trigger,\n PopoverClose as Close,\n PopoverAnchor as Anchor,\n PopoverToolbar as Toolbar,\n};\nexport type {\n PopoverRootProps as RootProps,\n PopoverContentProps as ContentProps,\n PopoverTriggerProps as TriggerProps,\n PopoverCloseProps as CloseProps,\n PopoverAnchorProps as AnchorProps,\n PopoverToolbarProps as ToolbarProps,\n PopoverToolbarSectionProps as ToolbarSectionProps,\n PopoverToolbarTitleProps as ToolbarTitleProps,\n};\n"],
|
|
5
|
-
"mappings": ";gPAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,UAAAC,EAAA,YAAAC,EAAA,SAAAC,EAAA,YAAAC,EAAA,YAAAC,IAAA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,WAAWC,MAAwB,WAuB5C,IAAMC,EAA8B,gBAAiD,IAAI,EACnFC,EAA4BC,GAAmB,CACnD,IAAMC,EAAY,aAAWH,CAAqB,EAMlD,OAAOG,CACT,EAGMC,EAA2CC,GAC/C,gBAACC,EAAiB,KAAjB,CAAuB,GAAGD,EAAO,EAEpCD,EAAY,YAAc,eAK1B,IAAMG,EAAuB,aAC3B,CAAC,CAAE,SAAAC,EAAU,GAAGH,CAAM,EAAGI,IACvB,gBAACH,EAAiB,QAAjB,CAA0B,GAAGD,EAAO,IAAKI,EAAc,QAAO,IAC5DC,EAAoBF,CAAQ,CAC/B,CAEJ,EACAD,EAAe,YAAc,kBAQ7B,IAAMI,EAAuB,aAC3B,CAACC,EAAUH,IAAiB,CAC1B,IAAMJ,EAAQQ,EAAkBD,EAAUE,EAAuB,IAAI,EAC/D,CACJ,UAAAC,EACA,WAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAIC,EAAad,EAAOS,CAAsB,EAGxCM,EAAmB,SAAuB,IAAI,EAC9CC,EAAoB,cACvBC,GAAgC,CAC/BF,EAAW,QAAUE,EACjB,OAAOb,G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AGlC,EACJ,IAAKkC,EACL,UAAWV,EAAW,4BAA6B,0BAA2Bd,CAAS,EACzF,CAEJ,EACA0B,EAAoB,YAAc,wBAGlC,IAAMC,EAA4B,aAChC,CAAC,CAAE,UAAA3B,EAAW,GAAI4B,EAAQ,GAAGtC,CAAM,EAAGkC,IAAQ,CAC5C,IAAMpC,EAAMF,EAAyB,uBAAuB,EACtD2C,EAAgB,QAAM,EACtBC,EAAKF,GAAU,6BAA6BC,CAAO,GACzD,OAAM,YAAU,KACdzC,GAAK,WAAW0C,CAAE,EACX,IAAM1C,GAAK,WAAW,MAAS,GACrC,CAACA,EAAK0C,CAAE,CAAC,EAEV,gBAAC,QACE,GAAGxC,EACJ,GAAIwC,EACJ,IAAKN,EACL,UAAWV,EAAW,0BAA2Bd,CAAS,EAC5D,CAEJ,CACF,EACA2B,EAAoB,YAAc,wBAWlC,IAAMI,EAAiB,OAAO,OAAOd,EAAoB,CACvD,KAAMM,EACN,OAAQE,EACR,MAAOC,EACP,MAAOC,CACT,CAAC",
|
|
6
|
-
"names": ["popover_exports", "__export", "PopoverAnchor", "PopoverClose", "PopoverContent", "PopoverRoot", "PopoverToolbar", "PopoverTrigger", "React", "classNames", "PopoverPrimitive", "PopoverContentContext", "usePopoverContentContext", "caller", "ctx", "PopoverRoot", "props", "PopoverPrimitive", "PopoverTrigger", "children", "forwardedRef", "requireReactElement", "PopoverContent", "ownProps", "useThemeSizeProps", "popoverContentPropDefs", "className", "forceMount", "container", "contentProps", "extractProps", "contentRef", "combinedRef", "node", "labelId", "setLabelId", "setToolbarOffset", "offsetPx", "el", "Theme", "classNames", "PopoverClose", "PopoverAnchor", "PopoverToolbarBase", "localRef", "setRefs", "update", "height", "ro", "PopoverToolbarLeft", "ref", "PopoverToolbarCenter", "PopoverToolbarRight", "PopoverToolbarTitle", "idProp", "reactId", "id", "PopoverToolbar"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/notice.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\n/**\n * Notice and Confirmation \u2014 what the app tells the person while it is true.\n *\n * Two questions place every message: what is it about, and what made it appear.\n *\n * - **Notice** \u2014 a condition that is true now, which nobody just caused: a usage limit, a\n * connection lost, a goal that finished. It takes space in the layout and never floats, so it\n * cannot cover what it is about. At most one action, and that action FIXES the condition. A\n * dismiss button only ACKNOWLEDGES it, and the app owns that state (`onDismiss`), because a\n * component cannot remember a dismissal across a reload.\n * - **Confirmation** \u2014 a question that waits for an answer: a quiet no before a loud yes, and no\n * dismiss button, because closing a question does not answer it. It never takes focus, so a\n * person can answer in the composer instead.\n *\n * Placement is the caller's. In a chat, both go in `Chatbar.Root`'s `notices`.\n * A notice with no action and no dismiss button is just a sentence: use `Text`.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\n\nimport { Button } from './button.js';\nimport { Text } from './text.js';\nimport { ThemeSizeContext, useThemeSize } from '../helpers/theme-size.js';\nimport { accentColorPropDef } from '../props/color.prop.js';\n\ntype NoticeSize = '1' | '2' | '3' | '4';\n\n/** The size a notice takes when it doesn't set one. `Chatbar.Root` provides its own size here. */\nconst NoticeSizeContext = React.createContext<NoticeSize | undefined>(undefined);\n\n/** Notice's own range, the Theme's four sizes. */\nconst noticeSizePropDef = { values: ['1', '2', '3', '4'] as const };\ntype NoticeColor = (typeof accentColorPropDef)['color']['values'][number];\n\ninterface StripProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {\n /** Padding, text and button size. Defaults to the nearest Theme's size. */\n size?: NoticeSize;\n /**\n * The category of the message, not its volume. Default `gray`. Use a colour only when it adds a\n * fact the words don't already give, such as `red` for something that stops the next step.\n */\n color?: NoticeColor;\n /** The message. */\n children: React.ReactNode;\n}\n\ninterface NoticeProps extends StripProps {\n /** An icon before the message. It is hidden from assistive technology. */\n icon?: React.ReactNode;\n /**\n * One action that fixes the condition, such as `<Button>Add credits</Button>`. A control in it\n * that sets no `size` takes the notice's size.\n */\n action?: React.ReactNode;\n /**\n * Called when the person presses the dismiss button, which shows only when this is set.\n * Dismissing hides the message; it does not fix the condition. Remove the notice and remember\n * the choice in your app.\n */\n onDismiss?: () => void;\n /** Accessible name of the dismiss button. Default \"Dismiss\". */\n dismissLabel?: string;\n}\n\ninterface ConfirmationProps extends StripProps {\n /** The yes. Name the action, such as \"Run\" or \"Allow up to $18\". */\n confirmLabel: string;\n /** The no. Default \"Not now\". */\n cancelLabel?: string;\n onConfirm: () => void;\n onCancel: () => void;\n /** The yes is running: it shows a spinner and the no is disabled. */\n busy?: boolean;\n}\n\nconst Strip = React.forwardRef<HTMLDivElement, StripProps & { kind: 'notice' | 'confirmation'; trailing: React.ReactNode; leading?: React.ReactNode }>(\n ({ kind, size = '2', color = 'gray', className, children, trailing, leading, ...props }, forwardedRef) => (\n <div\n role=\"status\"\n aria-live=\"polite\"\n {...props}\n ref={forwardedRef}\n className={classNames('kui-NoticeRoot', `kui-r-size-${size}`, className)}\n data-kind={kind}\n data-accent-color={color}\n >\n {leading ? (\n <span className=\"kui-NoticeIcon\" aria-hidden>\n {leading}\n </span>\n ) : null}\n <Text as=\"div\" size={size} className=\"kui-NoticeText\">\n {children}\n </Text>\n {trailing}\n </div>\n ),\n);\nStrip.displayName = 'Strip';\n\n/** A condition that is true now, with at most one action that fixes it. */\nconst Notice = React.forwardRef<HTMLDivElement, NoticeProps>(({ icon, action, onDismiss, dismissLabel = 'Dismiss', size: sizeProp, ...props }, forwardedRef) => {\n const contextSize = React.useContext(NoticeSizeContext);\n const size = useThemeSize(sizeProp ?? contextSize, noticeSizePropDef);\n const trailing =\n action || onDismiss ? (\n <span className=\"kui-NoticeActions\">\n {action ? <ThemeSizeContext.Provider value={size}>{action}</ThemeSizeContext.Provider> : null}\n {onDismiss ? (\n <Button iconOnly size={size} variant=\"ghost\" color=\"gray\" aria-label={dismissLabel} className=\"kui-NoticeDismiss\" onClick={onDismiss}>\n <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden>\n <path d=\"M4 4l7 7M11 4l-7 7\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n </Button>\n ) : null}\n </span>\n ) : null;\n return <Strip {...props} size={size} ref={forwardedRef} kind=\"notice\" leading={icon} trailing={trailing} />;\n});\nNotice.displayName = 'Notice';\n\n/** A question that waits for an answer: a quiet no, a loud yes, and no dismiss button. */\nconst Confirmation = React.forwardRef<HTMLDivElement, ConfirmationProps>(\n ({ confirmLabel, cancelLabel = 'Not now', onConfirm, onCancel, busy = false, size: sizeProp, color = 'gray', ...props }, forwardedRef) => {\n const contextSize = React.useContext(NoticeSizeContext);\n const size = useThemeSize(sizeProp ?? contextSize, noticeSizePropDef);\n return (\n <Strip\n {...props}\n size={size}\n color={color}\n ref={forwardedRef}\n kind=\"confirmation\"\n trailing={\n <span className=\"kui-NoticeActions\">\n <Button size={size} variant=\"ghost\" color=\"gray\" disabled={busy} onClick={onCancel}>\n {cancelLabel}\n </Button>\n <Button size={size} variant=\"solid\" color={color} loading={busy} onClick={onConfirm}>\n {confirmLabel}\n </Button>\n </span>\n }\n />\n );\n },\n);\nConfirmation.displayName = 'Confirmation';\n\nexport { Notice, Confirmation, NoticeSizeContext };\nexport type { NoticeProps, ConfirmationProps };\n"],
|
|
5
|
-
"mappings": ";+HAoBA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAUvB,IAAMC,EAA0B,gBAAsC,MAAS,EAGzEC,EAAoB,CAAE,OAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,CAAW,EA4C5DC,EAAc,aAClB,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAO,IAAK,MAAAC,EAAQ,OAAQ,UAAAC,EAAW,SAAAC,EAAU,SAAAC,EAAU,QAAAC,EAAS,GAAGC,CAAM,EAAGC,IACvF,gBAAC,OACC,KAAK,SACL,YAAU,SACT,GAAGD,EACJ,IAAKC,EACL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,EAChDI,EAAOiB,EAAaF,GAAYC,EAAanB,CAAiB,EACpE,OACA,gBAACC,EAAA,CACE,GAAGQ,EACJ,KAAMN,EACN,MAAOC,EACP,IAAKM,EACL,KAAK,eACL,SACE,gBAAC,QAAK,UAAU,qBACd,gBAACY,EAAA,CAAO,KAAMnB,EAAM,QAAQ,QAAQ,MAAM,OAAO,SAAUyB,EAAM,QAASD,GACvEF,CACH,EACA,gBAACH,EAAA,CAAO,KAAMnB,EAAM,QAAQ,QAAQ,MAAOC,EAAO,QAASwB,EAAM,QAASF,GACvEF,CACH,CACF,EAEJ,CAEF,CACF,EACAD,EAAa,YAAc",
|
|
6
|
-
"names": ["React", "classNames", "NoticeSizeContext", "noticeSizePropDef", "Strip", "kind", "size", "color", "className", "children", "trailing", "leading", "props", "forwardedRef", "classNames", "Text", "Notice", "icon", "action", "onDismiss", "dismissLabel", "sizeProp", "contextSize", "useThemeSize", "ThemeSizeContext", "Button", "Confirmation", "confirmLabel", "cancelLabel", "onConfirm", "onCancel", "busy"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|