@alfadocs/ui-kit-debug 1.103.1 → 1.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{ai-credits-exhausted-notice-CwZnSACy.js → ai-credits-exhausted-notice-Lws3113e.js} +2 -2
- package/dist/_chunks/{ai-credits-exhausted-notice-CwZnSACy.js.map → ai-credits-exhausted-notice-Lws3113e.js.map} +1 -1
- package/dist/_chunks/{ai-permission-notice-VNh3W57L.js → ai-permission-notice-BkgcGmu8.js} +2 -2
- package/dist/_chunks/{ai-permission-notice-VNh3W57L.js.map → ai-permission-notice-BkgcGmu8.js.map} +1 -1
- package/dist/_chunks/{alert-9kEwDza3.js → alert-C4WKViaS.js} +59 -50
- package/dist/_chunks/alert-C4WKViaS.js.map +1 -0
- package/dist/_chunks/{anamnesis-summary-rows-B9HqOGd7.js → anamnesis-summary-rows-QhbDdY7b.js} +4 -4
- package/dist/_chunks/{anamnesis-summary-rows-B9HqOGd7.js.map → anamnesis-summary-rows-QhbDdY7b.js.map} +1 -1
- package/dist/_chunks/{audio-recorder-BOm2FgEu.js → audio-recorder-BlDozxdU.js} +2 -2
- package/dist/_chunks/{audio-recorder-BOm2FgEu.js.map → audio-recorder-BlDozxdU.js.map} +1 -1
- package/dist/_chunks/{auth-form-parts-B3GWChvG.js → auth-form-parts-DVHfqnp6.js} +2 -2
- package/dist/_chunks/{auth-form-parts-B3GWChvG.js.map → auth-form-parts-DVHfqnp6.js.map} +1 -1
- package/dist/_chunks/{balance-badge-cell-DGFm2jfP.js → balance-badge-cell-wJ6cTD_h.js} +3 -3
- package/dist/_chunks/{balance-badge-cell-DGFm2jfP.js.map → balance-badge-cell-wJ6cTD_h.js.map} +1 -1
- package/dist/_chunks/{calendar-appointment-editor-dialog-DqyATSh3.js → calendar-appointment-editor-dialog-D8DblVjW.js} +8 -8
- package/dist/_chunks/{calendar-appointment-editor-dialog-DqyATSh3.js.map → calendar-appointment-editor-dialog-D8DblVjW.js.map} +1 -1
- package/dist/_chunks/{care-plan-card-YWKV8Kjq.js → care-plan-card-DMjlYlFc.js} +2 -2
- package/dist/_chunks/{care-plan-card-YWKV8Kjq.js.map → care-plan-card-DMjlYlFc.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-CApivtMW.js → care-plan-entry-card-3hguBW45.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-CApivtMW.js.map → care-plan-entry-card-3hguBW45.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-uExd3pKC.js → contact-profile-card-CAL66GaH.js} +120 -111
- package/dist/_chunks/contact-profile-card-CAL66GaH.js.map +1 -0
- package/dist/_chunks/{data-table-C5uN4ato.js → data-table-zXBxFYpJ.js} +761 -715
- package/dist/_chunks/data-table-zXBxFYpJ.js.map +1 -0
- package/dist/_chunks/{date-range-picker-B_j4VQlV.js → date-range-picker-DCADIR8o.js} +2 -2
- package/dist/_chunks/{date-range-picker-B_j4VQlV.js.map → date-range-picker-DCADIR8o.js.map} +1 -1
- package/dist/_chunks/{date-time-picker-cwsWiB4q.js → date-time-picker-CT2bC7-A.js} +2 -2
- package/dist/_chunks/{date-time-picker-cwsWiB4q.js.map → date-time-picker-CT2bC7-A.js.map} +1 -1
- package/dist/_chunks/{document-preview-U8H6tnDJ.js → document-preview-BalyZqnn.js} +2 -2
- package/dist/_chunks/{document-preview-U8H6tnDJ.js.map → document-preview-BalyZqnn.js.map} +1 -1
- package/dist/_chunks/{document-scanner-Bf3VUp00.js → document-scanner-5p-Uu8dy.js} +2 -2
- package/dist/_chunks/{document-scanner-Bf3VUp00.js.map → document-scanner-5p-Uu8dy.js.map} +1 -1
- package/dist/_chunks/{entity-summary-BKfR4Vws.js → entity-summary-BbqqYqF1.js} +2 -2
- package/dist/_chunks/{entity-summary-BKfR4Vws.js.map → entity-summary-BbqqYqF1.js.map} +1 -1
- package/dist/_chunks/{error-summary-mGxIyDAY.js → error-summary-DxNhwf_G.js} +2 -2
- package/dist/_chunks/{error-summary-mGxIyDAY.js.map → error-summary-DxNhwf_G.js.map} +1 -1
- package/dist/_chunks/{face-scheme-DdVLQ5dP.js → face-scheme-e2M2HJGz.js} +2 -2
- package/dist/_chunks/{face-scheme-DdVLQ5dP.js.map → face-scheme-e2M2HJGz.js.map} +1 -1
- package/dist/_chunks/{file-manager-CnGBVX_q.js → file-manager-BDKe59sg.js} +2 -2
- package/dist/_chunks/{file-manager-CnGBVX_q.js.map → file-manager-BDKe59sg.js.map} +1 -1
- package/dist/_chunks/{forgot-password-form-CeTb5p-x.js → forgot-password-form-vfCO2-Tt.js} +4 -4
- package/dist/_chunks/{forgot-password-form-CeTb5p-x.js.map → forgot-password-form-vfCO2-Tt.js.map} +1 -1
- package/dist/_chunks/{freemium-paywall-CM0zQSDE.js → freemium-paywall-BDeq9QWR.js} +2 -2
- package/dist/_chunks/{freemium-paywall-CM0zQSDE.js.map → freemium-paywall-BDeq9QWR.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-CXcDKQqC.js → gestational-age-calculator-AnaH00nk.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-CXcDKQqC.js.map → gestational-age-calculator-AnaH00nk.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-BJFR3onB.js → hcg-doubling-DdyUt4gz.js} +2 -2
- package/dist/_chunks/{hcg-doubling-BJFR3onB.js.map → hcg-doubling-DdyUt4gz.js.map} +1 -1
- package/dist/_chunks/{heatmap-Cz0Krieg.js → heatmap-D4qqpCEj.js} +1550 -1547
- package/dist/_chunks/{heatmap-Cz0Krieg.js.map → heatmap-D4qqpCEj.js.map} +1 -1
- package/dist/_chunks/{help-me-write-templates-ra5a__Yy.js → help-me-write-templates-YmceSxf5.js} +3 -3
- package/dist/_chunks/{help-me-write-templates-ra5a__Yy.js.map → help-me-write-templates-YmceSxf5.js.map} +1 -1
- package/dist/_chunks/info-tip-C-MPkShR.js +266 -0
- package/dist/_chunks/info-tip-C-MPkShR.js.map +1 -0
- package/dist/_chunks/{kit-extensions-C4o_tFN4.js → kit-extensions-BOnTM4Yf.js} +3 -3
- package/dist/_chunks/{kit-extensions-C4o_tFN4.js.map → kit-extensions-BOnTM4Yf.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-BRek9kz7.js → link-cell-renderer-C8vfCOEp.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-BRek9kz7.js.map → link-cell-renderer-C8vfCOEp.js.map} +1 -1
- package/dist/_chunks/{login-dev-card-D5BV5j1i.js → login-dev-card-Cz1Clugq.js} +3 -3
- package/dist/_chunks/{login-dev-card-D5BV5j1i.js.map → login-dev-card-Cz1Clugq.js.map} +1 -1
- package/dist/_chunks/{marketplace-app-shell-BsctSegT.js → marketplace-app-shell-C-4QF6mp.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-BsctSegT.js.map → marketplace-app-shell-C-4QF6mp.js.map} +1 -1
- package/dist/_chunks/{notes-panel-BjTpaz8d.js → notes-panel-SlzUL8in.js} +4 -4
- package/dist/_chunks/{notes-panel-BjTpaz8d.js.map → notes-panel-SlzUL8in.js.map} +1 -1
- package/dist/_chunks/{notice-group-DkYzKyAZ.js → notice-group-B-trhof8.js} +3 -3
- package/dist/_chunks/{notice-group-DkYzKyAZ.js.map → notice-group-B-trhof8.js.map} +1 -1
- package/dist/_chunks/{patient-details-BXM3dRKb.js → patient-details-wMgTFtpp.js} +2 -2
- package/dist/_chunks/{patient-details-BXM3dRKb.js.map → patient-details-wMgTFtpp.js.map} +1 -1
- package/dist/_chunks/{patient-field-row--dCDO5oB.js → patient-field-row-Bhm2Ig1P.js} +2 -2
- package/dist/_chunks/{patient-field-row--dCDO5oB.js.map → patient-field-row-Bhm2Ig1P.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-DB7fv-Tr.js → patient-summary-card-DMdPPG3n.js} +2 -2
- package/dist/_chunks/{patient-summary-card-DB7fv-Tr.js.map → patient-summary-card-DMdPPG3n.js.map} +1 -1
- package/dist/_chunks/{payment-automation-upsell-BPF0c-5D.js → payment-automation-upsell-u5EuFyCY.js} +2 -2
- package/dist/_chunks/{payment-automation-upsell-BPF0c-5D.js.map → payment-automation-upsell-u5EuFyCY.js.map} +1 -1
- package/dist/_chunks/{payment-form-PBuh8PIa.js → payment-form-C-s1x-bU.js} +2 -2
- package/dist/_chunks/{payment-form-PBuh8PIa.js.map → payment-form-C-s1x-bU.js.map} +1 -1
- package/dist/_chunks/{pdf-viewer-DlceXkfW.js → pdf-viewer-BnBKdx0y.js} +2 -2
- package/dist/_chunks/{pdf-viewer-DlceXkfW.js.map → pdf-viewer-BnBKdx0y.js.map} +1 -1
- package/dist/_chunks/{practice-profile-hero-BAvGdQmt.js → practice-profile-hero-Bb4YyxHA.js} +31 -29
- package/dist/_chunks/practice-profile-hero-Bb4YyxHA.js.map +1 -0
- package/dist/_chunks/{practice-results-ChBP9x2r.js → practice-results-BXz01sti.js} +485 -445
- package/dist/_chunks/practice-results-BXz01sti.js.map +1 -0
- package/dist/_chunks/{pregnancy-dating-D0Kf9s7s.js → pregnancy-dating-D6dLkMpl.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-D0Kf9s7s.js.map → pregnancy-dating-D6dLkMpl.js.map} +1 -1
- package/dist/_chunks/{progress-notice-DiHWZ8Ms.js → progress-notice-F7ao70ZP.js} +2 -2
- package/dist/_chunks/{progress-notice-DiHWZ8Ms.js.map → progress-notice-F7ao70ZP.js.map} +1 -1
- package/dist/_chunks/{radiograph-panel.agent-BQ95uFCd.js → radiograph-panel.agent-0ngF2sGS.js} +2 -2
- package/dist/_chunks/{radiograph-panel.agent-BQ95uFCd.js.map → radiograph-panel.agent-0ngF2sGS.js.map} +1 -1
- package/dist/_chunks/{registration-form-JzzTomhd.js → registration-form-CEJRUS9G.js} +3 -3
- package/dist/_chunks/{registration-form-JzzTomhd.js.map → registration-form-CEJRUS9G.js.map} +1 -1
- package/dist/_chunks/{reserved.agent-BxD0gnbt.js → reserved.agent-C-C9cvO5.js} +2 -2
- package/dist/_chunks/{reserved.agent-BxD0gnbt.js.map → reserved.agent-C-C9cvO5.js.map} +1 -1
- package/dist/_chunks/{reset-password-form-DDdGEoIL.js → reset-password-form-B0acanDD.js} +4 -4
- package/dist/_chunks/{reset-password-form-DDdGEoIL.js.map → reset-password-form-B0acanDD.js.map} +1 -1
- package/dist/_chunks/{rich-text-editor-F04przIt.js → rich-text-editor-C3nANKZt.js} +2 -2
- package/dist/_chunks/{rich-text-editor-F04przIt.js.map → rich-text-editor-C3nANKZt.js.map} +1 -1
- package/dist/_chunks/{send-registration-link-form-DHCQpA4C.js → send-registration-link-form-Nn0jf65G.js} +3 -3
- package/dist/_chunks/{send-registration-link-form-DHCQpA4C.js.map → send-registration-link-form-Nn0jf65G.js.map} +1 -1
- package/dist/_chunks/{sign-document-B5qZhthO.js → sign-document-CQZVzfpk.js} +2 -2
- package/dist/_chunks/{sign-document-B5qZhthO.js.map → sign-document-CQZVzfpk.js.map} +1 -1
- package/dist/_chunks/{signature-request-DB6kePIm.js → signature-request-DtLph5Z4.js} +3 -3
- package/dist/_chunks/{signature-request-DB6kePIm.js.map → signature-request-DtLph5Z4.js.map} +1 -1
- package/dist/_chunks/stat-group-DSNnzkbW.js +107 -0
- package/dist/_chunks/stat-group-DSNnzkbW.js.map +1 -0
- package/dist/_chunks/{switch-D--x7n6h.js → switch-DO6uC4HJ.js} +40 -36
- package/dist/_chunks/switch-DO6uC4HJ.js.map +1 -0
- package/dist/_chunks/{task-editor-BiPGFXtB.js → task-editor-CmXcj6cC.js} +4 -4
- package/dist/_chunks/{task-editor-BiPGFXtB.js.map → task-editor-CmXcj6cC.js.map} +1 -1
- package/dist/_chunks/{tasks-panel-iVeuu9a8.js → tasks-panel-CFo5uIHx.js} +3 -3
- package/dist/_chunks/{tasks-panel-iVeuu9a8.js.map → tasks-panel-CFo5uIHx.js.map} +1 -1
- package/dist/_chunks/{theme-toggle-jZRbAidE.js → theme-toggle-Czq3K9jB.js} +2 -2
- package/dist/_chunks/{theme-toggle-jZRbAidE.js.map → theme-toggle-Czq3K9jB.js.map} +1 -1
- package/dist/_chunks/{time-picker-DSt-ns5F.js → time-picker-DDr5vhwQ.js} +344 -332
- package/dist/_chunks/time-picker-DDr5vhwQ.js.map +1 -0
- package/dist/_chunks/{tooth-scheme-Bd7xECuj.js → tooth-scheme-C-ALCHaV.js} +2 -2
- package/dist/_chunks/{tooth-scheme-Bd7xECuj.js.map → tooth-scheme-C-ALCHaV.js.map} +1 -1
- package/dist/_chunks/{use-appointment-details-read-CmqGGYCy.js → use-appointment-details-read-VI26Z-pc.js} +3 -3
- package/dist/_chunks/{use-appointment-details-read-CmqGGYCy.js.map → use-appointment-details-read-VI26Z-pc.js.map} +1 -1
- package/dist/_chunks/{voice-control-panel-BGJjUwnY.js → voice-control-panel-B0TUZAiP.js} +3 -3
- package/dist/_chunks/{voice-control-panel-BGJjUwnY.js.map → voice-control-panel-B0TUZAiP.js.map} +1 -1
- package/dist/_chunks/{warning-stack-3S7e2q07.js → warning-stack-Dx7cpj10.js} +2 -2
- package/dist/_chunks/{warning-stack-3S7e2q07.js.map → warning-stack-Dx7cpj10.js.map} +1 -1
- package/dist/_chunks/week-availability-CsTiwtYj.js +318 -0
- package/dist/_chunks/week-availability-CsTiwtYj.js.map +1 -0
- package/dist/_chunks/weekly-hours-editor-BsVsgeOc.js +252 -0
- package/dist/_chunks/weekly-hours-editor-BsVsgeOc.js.map +1 -0
- package/dist/_chunks/{workflow-map-B1jf6QaB.js → workflow-map-DWk-rZse.js} +2 -2
- package/dist/_chunks/{workflow-map-B1jf6QaB.js.map → workflow-map-DWk-rZse.js.map} +1 -1
- package/dist/_chunks/{workflow-webhook-action-B_52rH7O.js → workflow-webhook-action-DILFqAVd.js} +2 -2
- package/dist/_chunks/{workflow-webhook-action-B_52rH7O.js.map → workflow-webhook-action-DILFqAVd.js.map} +1 -1
- package/dist/ag-grid.css +5 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/ai-credits-notice/index.js +1 -1
- package/dist/components/ai-permission-notice/index.js +1 -1
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/contact-profile-card/contact-profile-card.d.ts +8 -0
- package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/data-table/data-table.d.ts +6 -0
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/header-min-width.d.ts +21 -0
- package/dist/components/data-table/header-min-width.d.ts.map +1 -0
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/entity-summary/index.js +1 -1
- package/dist/components/error-summary/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/heatmap/heatmap.d.ts +5 -0
- package/dist/components/heatmap/heatmap.d.ts.map +1 -1
- package/dist/components/heatmap/index.js +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/info-tip/index.js +1 -1
- package/dist/components/info-tip/info-tip.d.ts +10 -0
- package/dist/components/info-tip/info-tip.d.ts.map +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/notice-group/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-profile-hero/index.js +1 -1
- package/dist/components/practice-profile-hero/practice-profile-hero.d.ts +7 -0
- package/dist/components/practice-profile-hero/practice-profile-hero.d.ts.map +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/practice-results/practice-results.d.ts +13 -0
- package/dist/components/practice-results/practice-results.d.ts.map +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/progress-notice/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +2 -2
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/stat-group/index.d.ts +3 -0
- package/dist/components/stat-group/index.d.ts.map +1 -0
- package/dist/components/stat-group/index.js +8 -0
- package/dist/components/stat-group/index.js.map +1 -0
- package/dist/components/stat-group/stat-group.d.ts +23 -0
- package/dist/components/stat-group/stat-group.d.ts.map +1 -0
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/switch.d.ts +2 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/time-picker/index.js +1 -1
- package/dist/components/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/tooth-scheme/index.js +1 -1
- package/dist/components/voice-control-panel/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/week-availability/index.d.ts +3 -0
- package/dist/components/week-availability/index.d.ts.map +1 -0
- package/dist/components/week-availability/index.js +10 -0
- package/dist/components/week-availability/index.js.map +1 -0
- package/dist/components/week-availability/week-availability.d.ts +68 -0
- package/dist/components/week-availability/week-availability.d.ts.map +1 -0
- package/dist/components/weekly-hours-editor/index.d.ts +3 -0
- package/dist/components/weekly-hours-editor/index.d.ts.map +1 -0
- package/dist/components/weekly-hours-editor/index.js +9 -0
- package/dist/components/weekly-hours-editor/index.js.map +1 -0
- package/dist/components/weekly-hours-editor/weekly-hours-editor.d.ts +42 -0
- package/dist/components/weekly-hours-editor/weekly-hours-editor.d.ts.map +1 -0
- package/dist/components/workflow/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/i18n/locales/ar.d.ts +34 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +34 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +34 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +34 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +34 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +34 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +34 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +34 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +34 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +34 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +34 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +34 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +34 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +34 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +34 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +34 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +34 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +34 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +34 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +34 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +34 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +34 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +34 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +34 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +34 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +34 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +34 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +34 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +34 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +34 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +34 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +34 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +34 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +34 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +34 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +34 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +885 -867
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +34 -0
- package/dist/locales/de.json +34 -0
- package/dist/locales/el.json +34 -0
- package/dist/locales/en.json +34 -0
- package/dist/locales/es.json +34 -0
- package/dist/locales/fr.json +34 -0
- package/dist/locales/hi.json +34 -0
- package/dist/locales/it.json +34 -0
- package/dist/locales/ja.json +34 -0
- package/dist/locales/nl.json +34 -0
- package/dist/locales/pl.json +34 -0
- package/dist/locales/pt.json +34 -0
- package/dist/locales/ro.json +34 -0
- package/dist/locales/ru.json +34 -0
- package/dist/locales/sq.json +34 -0
- package/dist/locales/sv.json +34 -0
- package/dist/locales/tr.json +34 -0
- package/dist/locales/zh.json +34 -0
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/forgot-password-form/index.js +1 -1
- package/dist/patterns/help-me-write-templates/index.js +2 -2
- package/dist/patterns/login-form/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +1 -1
- package/dist/patterns/registration-form/index.js +1 -1
- package/dist/patterns/reset-password-form/index.js +1 -1
- package/dist/patterns/send-registration-link-form/index.js +1 -1
- package/dist/patterns/signature-request/index.js +1 -1
- package/dist/patterns/workflow-webhook-action/index.js +1 -1
- package/dist/tokens.css +3 -1
- package/package.json +13 -1
- package/dist/_chunks/alert-9kEwDza3.js.map +0 -1
- package/dist/_chunks/contact-profile-card-uExd3pKC.js.map +0 -1
- package/dist/_chunks/data-table-C5uN4ato.js.map +0 -1
- package/dist/_chunks/info-tip-1Xsq9GLi.js +0 -230
- package/dist/_chunks/info-tip-1Xsq9GLi.js.map +0 -1
- package/dist/_chunks/practice-profile-hero-BAvGdQmt.js.map +0 -1
- package/dist/_chunks/practice-results-ChBP9x2r.js.map +0 -1
- package/dist/_chunks/switch-D--x7n6h.js.map +0 -1
- package/dist/_chunks/time-picker-DSt-ns5F.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { jsx as a, jsxs as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as S, useId as E } from "react";
|
|
3
3
|
import { c as x } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as A } from "react-i18next";
|
|
5
|
-
import { C as P, A as b } from "./alert-
|
|
5
|
+
import { C as P, A as b } from "./alert-C4WKViaS.js";
|
|
6
6
|
import { B as U } from "./button-DohK_Ak_.js";
|
|
7
7
|
import { P as _ } from "./progress-D_g_Sl2g.js";
|
|
8
8
|
import { f as j, n as F } from "./intl-locale-FWh-Y5_3.js";
|
|
@@ -284,4 +284,4 @@ export {
|
|
|
284
284
|
an as a,
|
|
285
285
|
$ as i
|
|
286
286
|
};
|
|
287
|
-
//# sourceMappingURL=ai-credits-exhausted-notice-
|
|
287
|
+
//# sourceMappingURL=ai-credits-exhausted-notice-Lws3113e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-credits-exhausted-notice-CwZnSACy.js","sources":["../../node_modules/lucide-react/dist/esm/icons/headset.mjs","../../src/components/ai-credits-notice/ai-credits-exhausted-notice.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z\",\n key: \"12oyoe\"\n }\n ],\n [\"path\", { d: \"M21 16v2a4 4 0 0 1-4 4h-5\", key: \"1x7m43\" }]\n];\nconst Headset = createLucideIcon(\"headset\", __iconNode);\n\nexport { __iconNode, Headset as default };\n//# sourceMappingURL=headset.mjs.map\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n ArrowLeft,\n Astroid,\n CircleArrowUp,\n Headset,\n Hourglass,\n TrendingUp,\n} from 'lucide-react';\nimport { Alert, type AlertAnnounce } from '../alert';\nimport { Button } from '../button';\nimport { Progress } from '../progress';\nimport { formatLocale, numberLocale } from '../_shared/intl-locale';\n\n/* -------------------------------------------------------------------- */\n/* AiCreditsExhaustedNotice and AiCreditsWarning */\n/* */\n/* The practice's AI credits, as the platform keeps them: a yearly */\n/* allowance that comes with the AI credits module and expires at the */\n/* end of the subscription term, then welcome and bought credits that */\n/* never expire. The kit never talks to a backend: the host passes what */\n/* it knows (`AiCreditsInfo`) and the next steps it can offer. */\n/* */\n/* - `AiCreditsExhaustedNotice`: the out-of-credits state. A promo */\n/* Alert with the allowance meter and one clear next step. Promoted */\n/* from the help-me-write-templates pattern, which re-exports it. */\n/* - `AiCreditsWarning`: the quiet, non-blocking lines: running low */\n/* (80% used), credits expiring, or out of credits at rest. */\n/* */\n/* The hover card every AI trigger can carry is `AiCreditsNotice`, in */\n/* the sibling file. */\n/* -------------------------------------------------------------------- */\n\n/** Credits that expire soon: the platform's yearly allowance at the end of\n * the subscription term. Welcome and bought credits never expire. */\nexport interface AiCreditsExpiring {\n /** How many credits expire. */\n amount: number;\n /** When they expire. */\n date: Date;\n}\n\n/** The practice's AI credits and the next steps the host can offer. All\n * optional: the kit shows only what it is given. */\nexport interface AiCreditsInfo {\n /** Credits left. */\n remaining?: number;\n /** The allowance `remaining` counts down from, for the meter. */\n limit?: number;\n /**\n * When a new allowance starts: \"renews on\". On the platform, the yearly\n * allowance at the subscription's renewal. Omit when it will not renew.\n */\n renewsOn?: Date;\n /** @deprecated Use `renewsOn`. Read the same way, as a renewal date. */\n resetsOn?: Date;\n /**\n * Credits that expire soon: \"expire on\". `AiCreditsWarning` shows it as\n * a quiet line; the out-of-credits notice never does (nothing is left to\n * expire).\n */\n expiring?: AiCreditsExpiring;\n /**\n * Shows the running-low line in `AiCreditsWarning`. Default: true when\n * 80% or more of `limit` is used and some credit is left. A host whose\n * balance mixes the yearly allowance with welcome or bought credits\n * passes it itself: 80% of one `limit` does not describe that balance.\n */\n runningLow?: boolean;\n /**\n * Shows a \"Buy AI credits\" button. Omit while the practice cannot buy\n * credits (on the platform, without the module and the pack page).\n */\n onBuyCredits?: () => void;\n /**\n * Shows an \"Enable the AI credits module\" button: the upgrade path for a\n * practice without the module.\n */\n onUpgrade?: () => void;\n /** Shows a \"Contact support\" button. */\n onContactSupport?: () => void;\n /** Shows a \"See what each action costs\" link. */\n onSeeCosts?: () => void;\n}\n\n/** Heading levels the notice title accepts. */\nexport type AiCreditsHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** Share of `limit` used at which credits count as running low. */\nconst RUNNING_LOW_USED = 0.8;\n\n/** Whether `credits` are running low: the host's `runningLow`, else 80% or\n * more of `limit` used with some credit left. */\nexport function isAiCreditsRunningLow(credits?: AiCreditsInfo): boolean {\n if (!credits) return false;\n if (credits.runningLow !== undefined) return credits.runningLow;\n const { remaining, limit } = credits;\n if (remaining === undefined || limit === undefined || limit <= 0) {\n return false;\n }\n return remaining > 0 && limit - remaining >= limit * RUNNING_LOW_USED;\n}\n\n/** The renewal date, from `renewsOn` or the older `resetsOn`. */\nfunction renewalDate(credits?: AiCreditsInfo): Date | undefined {\n return credits?.renewsOn ?? credits?.resetsOn;\n}\n\n/** The kit's number and date formatting for the active UI language.\n * Credits can be fractional on the platform (0.1 is the minimum cost). */\nfunction useCreditsFormat() {\n const { i18n } = useTranslation('ui');\n const locale = formatLocale(i18n.language);\n const numbers = new Intl.NumberFormat(numberLocale(locale), {\n maximumFractionDigits: 1,\n });\n const dates = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n return {\n number: (value: number) => numbers.format(value),\n date: (value: Date) => dates.format(value),\n };\n}\n\n// The kit's target size (44px, 48px in the accessible themes) on every\n// control, at every width. On a size `md` Button: size `sm` drops its\n// minimum height from 640px up.\nconst TARGET = 'ds:min-h-[var(--min-target-size)]';\n\n// The lead step's label wraps instead of truncating: a long translation\n// (\"Das KI-Guthaben-Modul aktivieren\") never loses words in a narrow\n// panel. The Button's own height and nowrap give way; the target stays.\nconst WRAPPING_LABEL = [\n TARGET,\n 'ds:!h-auto ds:!whitespace-normal ds:text-start ds:[overflow-wrap:anywhere]',\n 'ds:py-[var(--spacing-xs)]',\n].join(' ');\n\n// The text links: the notice's secondary steps and the quiet line's step.\n// Native buttons at the target size with the kit focus ring. `inherit`\n// takes the promo Alert's own text colour, which holds AA on its gradient\n// (the Button `link` intent's `--primary` does not); `link` is the `--link`\n// token, which holds AA on the card and popover surfaces in every theme,\n// as in AgendaTray's footer link.\nconst textLinkVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:min-h-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-sm)] ds:ps-[var(--spacing-2xs)] ds:pe-[var(--spacing-2xs)]',\n 'type-body-sm ds:font-medium ds:underline ds:underline-offset-2 ds:hover:no-underline ds:cursor-pointer',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:text-[color:LinkText]',\n ].join(' '),\n {\n variants: {\n tone: {\n inherit: 'ds:text-[color:inherit]',\n link: 'ds:text-[color:var(--link)]',\n },\n },\n defaultVariants: { tone: 'link' },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* AiCreditsExhaustedNotice */\n/* -------------------------------------------------------------------- */\n\nconst noticeRootVariants = cva(\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]',\n);\n\nconst metaClass =\n 'ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]';\n\nexport interface AiCreditsExhaustedNoticeProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n /** The allowance and the next steps the host can offer. */\n credits?: AiCreditsInfo;\n /** Shows a Back button under the notice. */\n onBack?: () => void;\n /** A quiet line under the notice, beside Back: what the user keeps. */\n footnote?: ReactNode;\n /** Heading level of the title. Default 2. */\n headingLevel?: AiCreditsHeadingLevel;\n /**\n * How the notice is announced when it appears. Default: the promo\n * Alert's polite status. Pass `'off'` when the host announces it.\n */\n announce?: AlertAnnounce;\n}\n\n/**\n * The out-of-credits state: what happened, the allowance, and the next\n * step. The first of buy, enable the module and contact support the host\n * passes is the main button; any others follow as links. With none, it\n * says when AI comes back, or plainly that it is unavailable and how to\n * get help: never a dead end.\n */\nexport const AiCreditsExhaustedNotice = forwardRef<\n HTMLDivElement,\n AiCreditsExhaustedNoticeProps\n>(\n (\n {\n credits,\n onBack,\n footnote,\n headingLevel = 2,\n announce,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const format = useCreditsFormat();\n const titleId = useId();\n const limit = credits?.limit;\n const remaining = credits?.remaining ?? 0;\n // A limit of 0 (a host still loading) would divide by zero in the meter.\n const remainingText =\n limit !== undefined && limit > 0\n ? t('aiCredits.remaining', {\n remaining: format.number(remaining),\n limit: format.number(limit),\n })\n : undefined;\n const renews = renewalDate(credits);\n const renewsText = renews ? format.date(renews) : undefined;\n\n // The first next step the host offers leads; the rest follow as links.\n const steps = [\n credits?.onBuyCredits\n ? {\n key: 'buy',\n label: t('aiCredits.buy'),\n icon: <TrendingUp aria-hidden=\"true\" />,\n onClick: credits.onBuyCredits,\n }\n : null,\n credits?.onUpgrade\n ? {\n key: 'upgrade',\n label: t('aiCredits.upgrade'),\n icon: <CircleArrowUp aria-hidden=\"true\" />,\n onClick: credits.onUpgrade,\n }\n : null,\n credits?.onContactSupport\n ? {\n key: 'support',\n label: t('aiCredits.contactSupport'),\n icon: <Headset aria-hidden=\"true\" />,\n onClick: credits.onContactSupport,\n }\n : null,\n ].filter((step) => step !== null);\n const lead = steps[0]?.key;\n\n // The body names the lead step. Without one, it says when AI comes\n // back, or that it is unavailable and how to get help.\n const body =\n lead === 'buy'\n ? t('aiCredits.bodyBuy')\n : lead === 'upgrade'\n ? t('aiCredits.bodyUpgrade')\n : lead === 'support'\n ? t('aiCredits.bodySupport')\n : renewsText\n ? t('aiCredits.bodyRenews', { date: renewsText })\n : t('aiCredits.bodyNone');\n // With a next step, the renewal date is a line of its own.\n const renewsLine = lead && renewsText ? renewsText : undefined;\n\n return (\n <div\n {...rest}\n ref={ref}\n // After `rest`: the marker always wins over a caller's attribute.\n data-component=\"ai-credits-exhausted-notice\"\n // Named by its title, so a host that moves focus here (the\n // VoiceControlPanel does) has it read from the title.\n role=\"group\"\n aria-labelledby={titleId}\n className={noticeRootVariants({ className })}\n >\n <Alert\n variant=\"promo\"\n announce={announce}\n icon={<Astroid aria-hidden=\"true\" />}\n // The focus ring takes the promo text colour, which holds 3:1 on\n // the promo tint in every theme (`--ring` does not on dark).\n className=\"ds:[--ring:var(--promo-foreground)]\"\n >\n <Alert.Title as={`h${headingLevel}` as const} id={titleId}>\n {t('aiCredits.title')}\n </Alert.Title>\n <Alert.Description>{body}</Alert.Description>\n {renewsLine ? (\n <p\n className=\"ds:m-0 ds:[margin-block-start:var(--spacing-2xs)] type-body-sm\"\n data-credits-renews=\"\"\n >\n {t('aiCredits.renewsOn', { date: renewsLine })}\n </p>\n ) : null}\n {remainingText && limit !== undefined ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:[margin-block-start:var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-label\">{t('aiCredits.meterLabel')}</span>\n <span className=\"type-label ds:ms-auto ds:tabular-nums\">\n {remainingText}\n </span>\n </div>\n <Progress\n value={Math.max(0, limit - remaining)}\n max={limit}\n size=\"sm\"\n ariaLabel={t('aiCredits.meterLabel')}\n ariaValueText={remainingText}\n />\n </div>\n ) : null}\n {steps.length > 0 || credits?.onSeeCosts ? (\n <Alert.Action>\n {steps.map((step, index) =>\n index === 0 ? (\n <Button\n key={step.key}\n intent=\"tonal\"\n size=\"md\"\n startIcon={step.icon}\n onClick={step.onClick}\n className={WRAPPING_LABEL}\n data-credits-action={step.key}\n >\n {step.label}\n </Button>\n ) : (\n <button\n key={step.key}\n type=\"button\"\n onClick={step.onClick}\n className={textLinkVariants({ tone: 'inherit' })}\n data-credits-action={step.key}\n >\n {step.label}\n </button>\n ),\n )}\n {credits?.onSeeCosts ? (\n <button\n type=\"button\"\n onClick={credits.onSeeCosts}\n className={textLinkVariants({ tone: 'inherit' })}\n data-credits-action=\"costs\"\n >\n {t('aiCredits.seeCosts')}\n </button>\n ) : null}\n </Alert.Action>\n ) : null}\n </Alert>\n {onBack || footnote ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {onBack ? (\n <Button\n intent=\"ghost\"\n startIcon={<ArrowLeft />}\n flipIconInRtl\n onClick={onBack}\n className={TARGET}\n >\n {t('aiCredits.back')}\n </Button>\n ) : null}\n {footnote ? <p className={metaClass}>{footnote}</p> : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\nAiCreditsExhaustedNotice.displayName = 'AiCreditsExhaustedNotice';\n\n/* -------------------------------------------------------------------- */\n/* AiCreditsWarning */\n/* -------------------------------------------------------------------- */\n\nconst warningLineVariants = cva(\n 'ds:m-0 ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] type-body-sm',\n {\n variants: {\n // Quiet: muted text and no tint, so it never competes with the\n // promo notice. Out of credits reads in the body colour.\n emphasis: {\n quiet: 'ds:text-[color:var(--muted-foreground)]',\n plain: 'ds:text-[color:var(--foreground)]',\n },\n },\n defaultVariants: { emphasis: 'quiet' },\n },\n);\n\nconst warningRootVariants = cva(\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]',\n);\n\nconst warningIconClass = 'ds:size-4 ds:shrink-0';\n\nexport interface AiCreditsWarningProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n /** The allowance, the expiring credits and the next steps. */\n credits?: AiCreditsInfo;\n /**\n * Out of credits: one quiet line saying so, instead of the running-low\n * and expiring lines. The full notice is `AiCreditsExhaustedNotice`.\n */\n exhausted?: boolean;\n}\n\n/**\n * The quiet, non-blocking credit lines: running low (with the buy or\n * upgrade step as a link) and credits expiring, or out of credits at rest.\n * Renders nothing when none applies.\n */\nexport const AiCreditsWarning = forwardRef<\n HTMLDivElement,\n AiCreditsWarningProps\n>(({ credits, exhausted = false, className, ...rest }, ref) => {\n const { t } = useTranslation('ui');\n const format = useCreditsFormat();\n const low = !exhausted && isAiCreditsRunningLow(credits);\n // Rounded as it is shown, so the plural matches the figure (\"1 AI\n // credit\", never \"1 AI credits\" for 0.96).\n const expiringAmount = credits?.expiring\n ? Math.round(credits.expiring.amount * 10) / 10\n : 0;\n const expiring =\n !exhausted && credits?.expiring && expiringAmount > 0\n ? credits.expiring\n : undefined;\n if (!exhausted && !low && !expiring) return null;\n\n const { remaining, limit } = credits ?? {};\n const lowText =\n remaining !== undefined && limit !== undefined && limit > 0\n ? t('aiCredits.runningLow', {\n remaining: format.number(remaining),\n limit: format.number(limit),\n })\n : remaining !== undefined\n ? t('aiCredits.runningLowCount', {\n remaining: format.number(remaining),\n })\n : t('aiCredits.runningLowPlain');\n // Before the wall, the way to more credits: buy, else enable the module.\n const step = credits?.onBuyCredits\n ? { label: t('aiCredits.buy'), onClick: credits.onBuyCredits }\n : credits?.onUpgrade\n ? { label: t('aiCredits.upgrade'), onClick: credits.onUpgrade }\n : undefined;\n\n return (\n <div\n {...rest}\n ref={ref}\n data-component=\"ai-credits-warning\"\n className={warningRootVariants({ className })}\n >\n {exhausted ? (\n <p\n className={warningLineVariants({ emphasis: 'plain' })}\n data-credits-line=\"exhausted\"\n >\n <Astroid aria-hidden=\"true\" className={warningIconClass} />\n <span>{t('aiCredits.title')}</span>\n </p>\n ) : null}\n {low ? (\n <p className={warningLineVariants()} data-credits-line=\"low\">\n <Astroid aria-hidden=\"true\" className={warningIconClass} />\n <span>{lowText}</span>\n {step ? (\n <button\n type=\"button\"\n onClick={step.onClick}\n className={textLinkVariants({ tone: 'link' })}\n >\n {step.label}\n </button>\n ) : null}\n </p>\n ) : null}\n {expiring ? (\n <p className={warningLineVariants()} data-credits-line=\"expiring\">\n <Hourglass aria-hidden=\"true\" className={warningIconClass} />\n <span>\n {t('aiCredits.expiring', {\n count: expiringAmount,\n amount: format.number(expiringAmount),\n date: format.date(expiring.date),\n })}\n </span>\n </p>\n ) : null}\n </div>\n );\n});\nAiCreditsWarning.displayName = 'AiCreditsWarning';\n"],"names":["__iconNode","Headset","createLucideIcon","RUNNING_LOW_USED","isAiCreditsRunningLow","credits","remaining","limit","renewalDate","useCreditsFormat","i18n","useTranslation","locale","formatLocale","numbers","numberLocale","dates","value","TARGET","WRAPPING_LABEL","textLinkVariants","cva","noticeRootVariants","metaClass","AiCreditsExhaustedNotice","forwardRef","onBack","footnote","headingLevel","announce","className","rest","ref","t","format","titleId","useId","remainingText","renews","renewsText","steps","jsx","TrendingUp","CircleArrowUp","step","lead","_a","body","renewsLine","jsxs","Alert","Astroid","Progress","index","Button","ArrowLeft","warningLineVariants","warningRootVariants","warningIconClass","AiCreditsWarning","exhausted","low","expiringAmount","expiring","lowText","Hourglass"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,6BAA6B,KAAK,SAAQ,CAAE;AAC5D,GACMC,IAAUC,EAAiB,WAAWF,CAAU,GCwEhDG,IAAmB;AAIlB,SAASC,EAAsBC,GAAkC;AACtE,MAAI,CAACA,EAAS,QAAO;AACrB,MAAIA,EAAQ,eAAe,OAAW,QAAOA,EAAQ;AACrD,QAAM,EAAE,WAAAC,GAAW,OAAAC,EAAA,IAAUF;AAC7B,SAAIC,MAAc,UAAaC,MAAU,UAAaA,KAAS,IACtD,KAEFD,IAAY,KAAKC,IAAQD,KAAaC,IAAQJ;AACvD;AAGA,SAASK,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AAA,CACN,IACE;AAAA,QACHmB,IACC,gBAAAd,EAAC,KAAA,EAAE,WAAWO,KAAuB,qBAAkB,YACrD,UAAA;AAAA,UAAA,gBAAAf,EAACwB,GAAA,EAAU,eAAY,QAAO,WAAWP,GAAkB;AAAA,UAC3D,gBAAAjB,EAAC,QAAA,EACE,UAAAR,EAAE,sBAAsB;AAAA,YACvB,OAAO6B;AAAA,YACP,QAAQ5B,EAAO,OAAO4B,CAAc;AAAA,YACpC,MAAM5B,EAAO,KAAK6B,EAAS,IAAI;AAAA,UAAA,CAChC,EAAA,CACH;AAAA,QAAA,EAAA,CACF,IACE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDJ,GAAiB,cAAc;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ai-credits-exhausted-notice-Lws3113e.js","sources":["../../node_modules/lucide-react/dist/esm/icons/headset.mjs","../../src/components/ai-credits-notice/ai-credits-exhausted-notice.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z\",\n key: \"12oyoe\"\n }\n ],\n [\"path\", { d: \"M21 16v2a4 4 0 0 1-4 4h-5\", key: \"1x7m43\" }]\n];\nconst Headset = createLucideIcon(\"headset\", __iconNode);\n\nexport { __iconNode, Headset as default };\n//# sourceMappingURL=headset.mjs.map\n","import { forwardRef, useId, type HTMLAttributes, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n ArrowLeft,\n Astroid,\n CircleArrowUp,\n Headset,\n Hourglass,\n TrendingUp,\n} from 'lucide-react';\nimport { Alert, type AlertAnnounce } from '../alert';\nimport { Button } from '../button';\nimport { Progress } from '../progress';\nimport { formatLocale, numberLocale } from '../_shared/intl-locale';\n\n/* -------------------------------------------------------------------- */\n/* AiCreditsExhaustedNotice and AiCreditsWarning */\n/* */\n/* The practice's AI credits, as the platform keeps them: a yearly */\n/* allowance that comes with the AI credits module and expires at the */\n/* end of the subscription term, then welcome and bought credits that */\n/* never expire. The kit never talks to a backend: the host passes what */\n/* it knows (`AiCreditsInfo`) and the next steps it can offer. */\n/* */\n/* - `AiCreditsExhaustedNotice`: the out-of-credits state. A promo */\n/* Alert with the allowance meter and one clear next step. Promoted */\n/* from the help-me-write-templates pattern, which re-exports it. */\n/* - `AiCreditsWarning`: the quiet, non-blocking lines: running low */\n/* (80% used), credits expiring, or out of credits at rest. */\n/* */\n/* The hover card every AI trigger can carry is `AiCreditsNotice`, in */\n/* the sibling file. */\n/* -------------------------------------------------------------------- */\n\n/** Credits that expire soon: the platform's yearly allowance at the end of\n * the subscription term. Welcome and bought credits never expire. */\nexport interface AiCreditsExpiring {\n /** How many credits expire. */\n amount: number;\n /** When they expire. */\n date: Date;\n}\n\n/** The practice's AI credits and the next steps the host can offer. All\n * optional: the kit shows only what it is given. */\nexport interface AiCreditsInfo {\n /** Credits left. */\n remaining?: number;\n /** The allowance `remaining` counts down from, for the meter. */\n limit?: number;\n /**\n * When a new allowance starts: \"renews on\". On the platform, the yearly\n * allowance at the subscription's renewal. Omit when it will not renew.\n */\n renewsOn?: Date;\n /** @deprecated Use `renewsOn`. Read the same way, as a renewal date. */\n resetsOn?: Date;\n /**\n * Credits that expire soon: \"expire on\". `AiCreditsWarning` shows it as\n * a quiet line; the out-of-credits notice never does (nothing is left to\n * expire).\n */\n expiring?: AiCreditsExpiring;\n /**\n * Shows the running-low line in `AiCreditsWarning`. Default: true when\n * 80% or more of `limit` is used and some credit is left. A host whose\n * balance mixes the yearly allowance with welcome or bought credits\n * passes it itself: 80% of one `limit` does not describe that balance.\n */\n runningLow?: boolean;\n /**\n * Shows a \"Buy AI credits\" button. Omit while the practice cannot buy\n * credits (on the platform, without the module and the pack page).\n */\n onBuyCredits?: () => void;\n /**\n * Shows an \"Enable the AI credits module\" button: the upgrade path for a\n * practice without the module.\n */\n onUpgrade?: () => void;\n /** Shows a \"Contact support\" button. */\n onContactSupport?: () => void;\n /** Shows a \"See what each action costs\" link. */\n onSeeCosts?: () => void;\n}\n\n/** Heading levels the notice title accepts. */\nexport type AiCreditsHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** Share of `limit` used at which credits count as running low. */\nconst RUNNING_LOW_USED = 0.8;\n\n/** Whether `credits` are running low: the host's `runningLow`, else 80% or\n * more of `limit` used with some credit left. */\nexport function isAiCreditsRunningLow(credits?: AiCreditsInfo): boolean {\n if (!credits) return false;\n if (credits.runningLow !== undefined) return credits.runningLow;\n const { remaining, limit } = credits;\n if (remaining === undefined || limit === undefined || limit <= 0) {\n return false;\n }\n return remaining > 0 && limit - remaining >= limit * RUNNING_LOW_USED;\n}\n\n/** The renewal date, from `renewsOn` or the older `resetsOn`. */\nfunction renewalDate(credits?: AiCreditsInfo): Date | undefined {\n return credits?.renewsOn ?? credits?.resetsOn;\n}\n\n/** The kit's number and date formatting for the active UI language.\n * Credits can be fractional on the platform (0.1 is the minimum cost). */\nfunction useCreditsFormat() {\n const { i18n } = useTranslation('ui');\n const locale = formatLocale(i18n.language);\n const numbers = new Intl.NumberFormat(numberLocale(locale), {\n maximumFractionDigits: 1,\n });\n const dates = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n return {\n number: (value: number) => numbers.format(value),\n date: (value: Date) => dates.format(value),\n };\n}\n\n// The kit's target size (44px, 48px in the accessible themes) on every\n// control, at every width. On a size `md` Button: size `sm` drops its\n// minimum height from 640px up.\nconst TARGET = 'ds:min-h-[var(--min-target-size)]';\n\n// The lead step's label wraps instead of truncating: a long translation\n// (\"Das KI-Guthaben-Modul aktivieren\") never loses words in a narrow\n// panel. The Button's own height and nowrap give way; the target stays.\nconst WRAPPING_LABEL = [\n TARGET,\n 'ds:!h-auto ds:!whitespace-normal ds:text-start ds:[overflow-wrap:anywhere]',\n 'ds:py-[var(--spacing-xs)]',\n].join(' ');\n\n// The text links: the notice's secondary steps and the quiet line's step.\n// Native buttons at the target size with the kit focus ring. `inherit`\n// takes the promo Alert's own text colour, which holds AA on its gradient\n// (the Button `link` intent's `--primary` does not); `link` is the `--link`\n// token, which holds AA on the card and popover surfaces in every theme,\n// as in AgendaTray's footer link.\nconst textLinkVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:min-h-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-sm)] ds:ps-[var(--spacing-2xs)] ds:pe-[var(--spacing-2xs)]',\n 'type-body-sm ds:font-medium ds:underline ds:underline-offset-2 ds:hover:no-underline ds:cursor-pointer',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:text-[color:LinkText]',\n ].join(' '),\n {\n variants: {\n tone: {\n inherit: 'ds:text-[color:inherit]',\n link: 'ds:text-[color:var(--link)]',\n },\n },\n defaultVariants: { tone: 'link' },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* AiCreditsExhaustedNotice */\n/* -------------------------------------------------------------------- */\n\nconst noticeRootVariants = cva(\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]',\n);\n\nconst metaClass =\n 'ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]';\n\nexport interface AiCreditsExhaustedNoticeProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n /** The allowance and the next steps the host can offer. */\n credits?: AiCreditsInfo;\n /** Shows a Back button under the notice. */\n onBack?: () => void;\n /** A quiet line under the notice, beside Back: what the user keeps. */\n footnote?: ReactNode;\n /** Heading level of the title. Default 2. */\n headingLevel?: AiCreditsHeadingLevel;\n /**\n * How the notice is announced when it appears. Default: the promo\n * Alert's polite status. Pass `'off'` when the host announces it.\n */\n announce?: AlertAnnounce;\n}\n\n/**\n * The out-of-credits state: what happened, the allowance, and the next\n * step. The first of buy, enable the module and contact support the host\n * passes is the main button; any others follow as links. With none, it\n * says when AI comes back, or plainly that it is unavailable and how to\n * get help: never a dead end.\n */\nexport const AiCreditsExhaustedNotice = forwardRef<\n HTMLDivElement,\n AiCreditsExhaustedNoticeProps\n>(\n (\n {\n credits,\n onBack,\n footnote,\n headingLevel = 2,\n announce,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const format = useCreditsFormat();\n const titleId = useId();\n const limit = credits?.limit;\n const remaining = credits?.remaining ?? 0;\n // A limit of 0 (a host still loading) would divide by zero in the meter.\n const remainingText =\n limit !== undefined && limit > 0\n ? t('aiCredits.remaining', {\n remaining: format.number(remaining),\n limit: format.number(limit),\n })\n : undefined;\n const renews = renewalDate(credits);\n const renewsText = renews ? format.date(renews) : undefined;\n\n // The first next step the host offers leads; the rest follow as links.\n const steps = [\n credits?.onBuyCredits\n ? {\n key: 'buy',\n label: t('aiCredits.buy'),\n icon: <TrendingUp aria-hidden=\"true\" />,\n onClick: credits.onBuyCredits,\n }\n : null,\n credits?.onUpgrade\n ? {\n key: 'upgrade',\n label: t('aiCredits.upgrade'),\n icon: <CircleArrowUp aria-hidden=\"true\" />,\n onClick: credits.onUpgrade,\n }\n : null,\n credits?.onContactSupport\n ? {\n key: 'support',\n label: t('aiCredits.contactSupport'),\n icon: <Headset aria-hidden=\"true\" />,\n onClick: credits.onContactSupport,\n }\n : null,\n ].filter((step) => step !== null);\n const lead = steps[0]?.key;\n\n // The body names the lead step. Without one, it says when AI comes\n // back, or that it is unavailable and how to get help.\n const body =\n lead === 'buy'\n ? t('aiCredits.bodyBuy')\n : lead === 'upgrade'\n ? t('aiCredits.bodyUpgrade')\n : lead === 'support'\n ? t('aiCredits.bodySupport')\n : renewsText\n ? t('aiCredits.bodyRenews', { date: renewsText })\n : t('aiCredits.bodyNone');\n // With a next step, the renewal date is a line of its own.\n const renewsLine = lead && renewsText ? renewsText : undefined;\n\n return (\n <div\n {...rest}\n ref={ref}\n // After `rest`: the marker always wins over a caller's attribute.\n data-component=\"ai-credits-exhausted-notice\"\n // Named by its title, so a host that moves focus here (the\n // VoiceControlPanel does) has it read from the title.\n role=\"group\"\n aria-labelledby={titleId}\n className={noticeRootVariants({ className })}\n >\n <Alert\n variant=\"promo\"\n announce={announce}\n icon={<Astroid aria-hidden=\"true\" />}\n // The focus ring takes the promo text colour, which holds 3:1 on\n // the promo tint in every theme (`--ring` does not on dark).\n className=\"ds:[--ring:var(--promo-foreground)]\"\n >\n <Alert.Title as={`h${headingLevel}` as const} id={titleId}>\n {t('aiCredits.title')}\n </Alert.Title>\n <Alert.Description>{body}</Alert.Description>\n {renewsLine ? (\n <p\n className=\"ds:m-0 ds:[margin-block-start:var(--spacing-2xs)] type-body-sm\"\n data-credits-renews=\"\"\n >\n {t('aiCredits.renewsOn', { date: renewsLine })}\n </p>\n ) : null}\n {remainingText && limit !== undefined ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:[margin-block-start:var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-label\">{t('aiCredits.meterLabel')}</span>\n <span className=\"type-label ds:ms-auto ds:tabular-nums\">\n {remainingText}\n </span>\n </div>\n <Progress\n value={Math.max(0, limit - remaining)}\n max={limit}\n size=\"sm\"\n ariaLabel={t('aiCredits.meterLabel')}\n ariaValueText={remainingText}\n />\n </div>\n ) : null}\n {steps.length > 0 || credits?.onSeeCosts ? (\n <Alert.Action>\n {steps.map((step, index) =>\n index === 0 ? (\n <Button\n key={step.key}\n intent=\"tonal\"\n size=\"md\"\n startIcon={step.icon}\n onClick={step.onClick}\n className={WRAPPING_LABEL}\n data-credits-action={step.key}\n >\n {step.label}\n </Button>\n ) : (\n <button\n key={step.key}\n type=\"button\"\n onClick={step.onClick}\n className={textLinkVariants({ tone: 'inherit' })}\n data-credits-action={step.key}\n >\n {step.label}\n </button>\n ),\n )}\n {credits?.onSeeCosts ? (\n <button\n type=\"button\"\n onClick={credits.onSeeCosts}\n className={textLinkVariants({ tone: 'inherit' })}\n data-credits-action=\"costs\"\n >\n {t('aiCredits.seeCosts')}\n </button>\n ) : null}\n </Alert.Action>\n ) : null}\n </Alert>\n {onBack || footnote ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {onBack ? (\n <Button\n intent=\"ghost\"\n startIcon={<ArrowLeft />}\n flipIconInRtl\n onClick={onBack}\n className={TARGET}\n >\n {t('aiCredits.back')}\n </Button>\n ) : null}\n {footnote ? <p className={metaClass}>{footnote}</p> : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\nAiCreditsExhaustedNotice.displayName = 'AiCreditsExhaustedNotice';\n\n/* -------------------------------------------------------------------- */\n/* AiCreditsWarning */\n/* -------------------------------------------------------------------- */\n\nconst warningLineVariants = cva(\n 'ds:m-0 ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] type-body-sm',\n {\n variants: {\n // Quiet: muted text and no tint, so it never competes with the\n // promo notice. Out of credits reads in the body colour.\n emphasis: {\n quiet: 'ds:text-[color:var(--muted-foreground)]',\n plain: 'ds:text-[color:var(--foreground)]',\n },\n },\n defaultVariants: { emphasis: 'quiet' },\n },\n);\n\nconst warningRootVariants = cva(\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]',\n);\n\nconst warningIconClass = 'ds:size-4 ds:shrink-0';\n\nexport interface AiCreditsWarningProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n /** The allowance, the expiring credits and the next steps. */\n credits?: AiCreditsInfo;\n /**\n * Out of credits: one quiet line saying so, instead of the running-low\n * and expiring lines. The full notice is `AiCreditsExhaustedNotice`.\n */\n exhausted?: boolean;\n}\n\n/**\n * The quiet, non-blocking credit lines: running low (with the buy or\n * upgrade step as a link) and credits expiring, or out of credits at rest.\n * Renders nothing when none applies.\n */\nexport const AiCreditsWarning = forwardRef<\n HTMLDivElement,\n AiCreditsWarningProps\n>(({ credits, exhausted = false, className, ...rest }, ref) => {\n const { t } = useTranslation('ui');\n const format = useCreditsFormat();\n const low = !exhausted && isAiCreditsRunningLow(credits);\n // Rounded as it is shown, so the plural matches the figure (\"1 AI\n // credit\", never \"1 AI credits\" for 0.96).\n const expiringAmount = credits?.expiring\n ? Math.round(credits.expiring.amount * 10) / 10\n : 0;\n const expiring =\n !exhausted && credits?.expiring && expiringAmount > 0\n ? credits.expiring\n : undefined;\n if (!exhausted && !low && !expiring) return null;\n\n const { remaining, limit } = credits ?? {};\n const lowText =\n remaining !== undefined && limit !== undefined && limit > 0\n ? t('aiCredits.runningLow', {\n remaining: format.number(remaining),\n limit: format.number(limit),\n })\n : remaining !== undefined\n ? t('aiCredits.runningLowCount', {\n remaining: format.number(remaining),\n })\n : t('aiCredits.runningLowPlain');\n // Before the wall, the way to more credits: buy, else enable the module.\n const step = credits?.onBuyCredits\n ? { label: t('aiCredits.buy'), onClick: credits.onBuyCredits }\n : credits?.onUpgrade\n ? { label: t('aiCredits.upgrade'), onClick: credits.onUpgrade }\n : undefined;\n\n return (\n <div\n {...rest}\n ref={ref}\n data-component=\"ai-credits-warning\"\n className={warningRootVariants({ className })}\n >\n {exhausted ? (\n <p\n className={warningLineVariants({ emphasis: 'plain' })}\n data-credits-line=\"exhausted\"\n >\n <Astroid aria-hidden=\"true\" className={warningIconClass} />\n <span>{t('aiCredits.title')}</span>\n </p>\n ) : null}\n {low ? (\n <p className={warningLineVariants()} data-credits-line=\"low\">\n <Astroid aria-hidden=\"true\" className={warningIconClass} />\n <span>{lowText}</span>\n {step ? (\n <button\n type=\"button\"\n onClick={step.onClick}\n className={textLinkVariants({ tone: 'link' })}\n >\n {step.label}\n </button>\n ) : null}\n </p>\n ) : null}\n {expiring ? (\n <p className={warningLineVariants()} data-credits-line=\"expiring\">\n <Hourglass aria-hidden=\"true\" className={warningIconClass} />\n <span>\n {t('aiCredits.expiring', {\n count: expiringAmount,\n amount: format.number(expiringAmount),\n date: format.date(expiring.date),\n })}\n </span>\n </p>\n ) : null}\n </div>\n );\n});\nAiCreditsWarning.displayName = 'AiCreditsWarning';\n"],"names":["__iconNode","Headset","createLucideIcon","RUNNING_LOW_USED","isAiCreditsRunningLow","credits","remaining","limit","renewalDate","useCreditsFormat","i18n","useTranslation","locale","formatLocale","numbers","numberLocale","dates","value","TARGET","WRAPPING_LABEL","textLinkVariants","cva","noticeRootVariants","metaClass","AiCreditsExhaustedNotice","forwardRef","onBack","footnote","headingLevel","announce","className","rest","ref","t","format","titleId","useId","remainingText","renews","renewsText","steps","jsx","TrendingUp","CircleArrowUp","step","lead","_a","body","renewsLine","jsxs","Alert","Astroid","Progress","index","Button","ArrowLeft","warningLineVariants","warningRootVariants","warningIconClass","AiCreditsWarning","exhausted","low","expiringAmount","expiring","lowText","Hourglass"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,6BAA6B,KAAK,SAAQ,CAAE;AAC5D,GACMC,IAAUC,EAAiB,WAAWF,CAAU,GCwEhDG,IAAmB;AAIlB,SAASC,EAAsBC,GAAkC;AACtE,MAAI,CAACA,EAAS,QAAO;AACrB,MAAIA,EAAQ,eAAe,OAAW,QAAOA,EAAQ;AACrD,QAAM,EAAE,WAAAC,GAAW,OAAAC,EAAA,IAAUF;AAC7B,SAAIC,MAAc,UAAaC,MAAU,UAAaA,KAAS,IACtD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E3C,UAAAwB,EAAK;AAAA,YAAA;AAAA,UAAA,IAEN;AAAA,QAAA,EAAA,CACN,IACE;AAAA,QACHmB,IACC,gBAAAd,EAAC,KAAA,EAAE,WAAWO,KAAuB,qBAAkB,YACrD,UAAA;AAAA,UAAA,gBAAAf,EAACwB,GAAA,EAAU,eAAY,QAAO,WAAWP,GAAkB;AAAA,UAC3D,gBAAAjB,EAAC,QAAA,EACE,UAAAR,EAAE,sBAAsB;AAAA,YACvB,OAAO6B;AAAA,YACP,QAAQ5B,EAAO,OAAO4B,CAAc;AAAA,YACpC,MAAM5B,EAAO,KAAK6B,EAAS,IAAI;AAAA,UAAA,CAChC,EAAA,CACH;AAAA,QAAA,EAAA,CACF,IACE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDJ,GAAiB,cAAc;","x_google_ignoreList":[0]}
|
|
@@ -2,7 +2,7 @@ import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as z, useState as C, useRef as E, useMemo as F } from "react";
|
|
3
3
|
import { c as M } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as P } from "react-i18next";
|
|
5
|
-
import { A as g } from "./alert-
|
|
5
|
+
import { A as g } from "./alert-C4WKViaS.js";
|
|
6
6
|
import { B as D } from "./badge-BUk4RjTS.js";
|
|
7
7
|
import { B as H } from "./button-DohK_Ak_.js";
|
|
8
8
|
import { C as J } from "./checkbox-a7Sh-dXb.js";
|
|
@@ -203,4 +203,4 @@ export {
|
|
|
203
203
|
Q as A,
|
|
204
204
|
$ as a
|
|
205
205
|
};
|
|
206
|
-
//# sourceMappingURL=ai-permission-notice-
|
|
206
|
+
//# sourceMappingURL=ai-permission-notice-BkgcGmu8.js.map
|
package/dist/_chunks/{ai-permission-notice-VNh3W57L.js.map → ai-permission-notice-BkgcGmu8.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-permission-notice-VNh3W57L.js","sources":["../../src/components/ai-permission-notice/ai-permission-notice.agent.ts","../../src/components/ai-permission-notice/ai-permission-notice.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — AiConsentBanner. */\n/* */\n/* Read-only structural surface: the current consent state and whether */\n/* the grant affordance is armed. Identifiers / structural state ONLY — */\n/* never the grantee's name or any PHI. The real consent gate lives */\n/* server-side; this adapter does not expose a grant action so an agent */\n/* cannot consent on a user's behalf. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AiConsentBannerHandle } from './ai-permission-notice';\n\nexport const aiConsentBannerAgent: AgentAdapter<AiConsentBannerHandle> = {\n id: 'ai-consent-banner',\n capabilities: [],\n state: {\n consentState: {\n type: \"'granted' | 'required' | 'pending'\",\n descriptionKey: 'ui.agent.aiConsentBanner.state.consentState',\n description:\n 'Current consent state. Structural only — never the grantee identity.',\n read: (handle) => handle.getState(),\n },\n armed: {\n type: 'boolean',\n descriptionKey: 'ui.agent.aiConsentBanner.state.armed',\n description:\n 'Whether the consent confirmation checkbox is ticked (required state only).',\n read: (handle) => handle.isArmed(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'ai-consent-banner',\n description: 'Marks the AiConsentBanner root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific banner from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Alert } from '../alert/alert';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport { Checkbox } from '../checkbox/checkbox';\nimport { Spinner } from '../spinner/spinner';\nimport { Timestamp } from '../timestamp/timestamp';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { aiConsentBannerAgent } from './ai-permission-notice.agent';\n\n/* -------------------------------------------------------------------- */\n/* AiConsentBanner */\n/* */\n/* Presentational AI-consent gate surfaced above an AI-assisted surface */\n/* (e.g. Alfascribe consultation transcription). The SERVER owns the */\n/* real gate — this component only reflects the consent record and lets */\n/* the operator initiate a grant; it never enforces access itself. */\n/* */\n/* Three states drive the Alert variant + body: */\n/* - granted → success Alert with a Badge + when/who it was granted. */\n/* - required → info Alert with a Checkbox-gated Grant Button. */\n/* - pending → info Alert in a disabled, Spinner-busy state while the */\n/* server persists the grant. */\n/* */\n/* All kit text flows through useTranslation('ui') against the */\n/* `aiConsentBanner.*` namespace. `subject` picks the kit-owned wording */\n/* preset; `copy` lets a host replace single strings with its own text. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n state: {\n granted: '',\n required: '',\n pending: '',\n },\n },\n defaultVariants: {\n state: 'required',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* State derivation */\n/* -------------------------------------------------------------------- */\n\nexport type AiConsentState = NonNullable<\n VariantProps<typeof rootVariants>['state']\n>;\n\n/** Heading levels `AiConsentBanner.headingLevel` accepts. */\nexport type AiConsentBannerHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** Pending wins over granted/required so the busy state is never masked. */\nfunction deriveState(granted: boolean, pending: boolean): AiConsentState {\n if (pending) return 'pending';\n return granted ? 'granted' : 'required';\n}\n\n/* -------------------------------------------------------------------- */\n/* Subject presets */\n/* -------------------------------------------------------------------- */\n\n/** What the consent covers; each subject has kit-owned, translated wording.\n * `'patient-record'` (default) is one patient's record. `'practice-statistics'`\n * is the practice's aggregate figures (totals, rates), never patient data. */\nexport type AiConsentSubject = 'patient-record' | 'practice-statistics';\n\ntype AiConsentSubjectField =\n | 'descriptionRequired'\n | 'descriptionGranted'\n | 'confirmLabel'\n | 'notAllowed';\n\n/* Only these four strings differ by subject; the rest share one key each. */\nconst SUBJECT_KEYS = {\n 'patient-record': {\n descriptionRequired: {\n key: 'aiConsentBanner.description.required',\n fallback: 'AI assistance requires recorded consent before it can run.',\n },\n descriptionGranted: {\n key: 'aiConsentBanner.description.granted',\n fallback: 'AI assistance is enabled for this record.',\n },\n confirmLabel: {\n key: 'aiConsentBanner.confirmLabel',\n fallback: 'I confirm consent has been obtained for AI assistance.',\n },\n notAllowed: {\n key: 'aiConsentBanner.notAllowed',\n fallback: 'You do not have permission to grant AI assistance consent.',\n },\n },\n 'practice-statistics': {\n descriptionRequired: {\n key: 'aiConsentBanner.practiceStatistics.description.required',\n fallback:\n \"AI assistance needs consent before it can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n descriptionGranted: {\n key: 'aiConsentBanner.practiceStatistics.description.granted',\n fallback:\n \"AI assistance can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n confirmLabel: {\n key: 'aiConsentBanner.practiceStatistics.confirmLabel',\n fallback:\n 'I may decide for this practice, and I agree to AI assistance reading its statistics.',\n },\n notAllowed: {\n key: 'aiConsentBanner.practiceStatistics.notAllowed',\n fallback:\n 'You do not have permission to grant AI assistance consent for this practice.',\n },\n },\n} as const satisfies Record<\n AiConsentSubject,\n Record<AiConsentSubjectField, { key: string; fallback: string }>\n>;\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/**\n * Patient AI-consent gate for an AI surface that sends patient data to a\n * service: the RichTextEditor's Help-me-write action and dictation mics, and\n * the VoiceControlPanel's microphone. Omit entirely for today's ungated\n * behaviour — no existing host breaks.\n *\n * Present and `granted: false`: the affordances stay visible (this never\n * hides a control), but using one shows the kit's `AiConsentBanner` instead\n * of starting the AI action. When `granted` flips `true` after a Grant click\n * in that banner, the surface resumes exactly the action it gated; when it\n * flips for any other reason (another patient, another tab) it only closes\n * the banner.\n *\n * Present and `granted: true`: normal behaviour.\n */\nexport interface AiConsentGate {\n /** Whether AI consent has already been recorded for the current patient. */\n granted: boolean;\n /** When consent was granted — passed straight to `AiConsentBanner`. */\n grantedAt?: string | number | Date;\n /** Who granted consent — passed straight to `AiConsentBanner`. */\n grantedBy?: string;\n /** Whether the signed-in reader may grant consent. Default `true`; treated\n * as `false` when `onGrant` is absent, so no dead Grant control shows. */\n canGrant?: boolean;\n /** The grant is being persisted server-side (host-driven busy state). */\n pending?: boolean;\n /**\n * Fired when the reader confirms the grant in the banner. A returned\n * promise drives the banner's own pending/Spinner state until it settles,\n * in addition to (or absent) a host-supplied `pending`.\n */\n onGrant?: () => void | Promise<void>;\n}\n\n/** Host-translated strings; the host owns their wording and translation.\n * Each one replaces the `subject` preset for that string only. Plain text,\n * not i18n keys: interpolate any values (a practice name) before passing. */\nexport interface AiConsentBannerCopy {\n /** Banner heading. */\n title?: string;\n /** Description in the required and pending states. */\n descriptionRequired?: string;\n /** Description in the granted state. */\n descriptionGranted?: string;\n /** Label of the confirmation checkbox. */\n confirmLabel?: string;\n /** Label of the Grant button. */\n grantButton?: string;\n /** Note shown instead of the grant controls when `canGrant` is false. */\n notAllowed?: string;\n /** Badge text in the granted state. */\n badgeGranted?: string;\n /** Busy text (and Spinner label) in the pending state. */\n pendingLabel?: string;\n}\n\n/** Agent-readiness curated handle. Exposes the structural consent state only. */\nexport interface AiConsentBannerHandle {\n /** Current derived state: 'granted' | 'required' | 'pending'. */\n getState: () => AiConsentState;\n /** Whether the Grant affordance is currently armed (checkbox ticked). */\n isArmed: () => boolean;\n}\n\nexport interface AiConsentBannerProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children' | 'role'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific banner. Mirrored to the\n * real DOM `id`.\n */\n id?: string;\n /** Whether consent has already been granted. Server-sourced. */\n granted: boolean;\n /**\n * When consent was granted — ISO-8601 string, ms-epoch, or Date. Rendered\n * via `Timestamp` in the granted state.\n */\n grantedAt?: string | number | Date;\n /** Who granted consent (operator display name / role). Granted state only. */\n grantedBy?: string;\n /**\n * Whether the current user is allowed to grant consent. When `false`, the\n * required-state Grant affordance is hidden and a not-allowed note shows.\n * Default `true`.\n */\n canGrant?: boolean;\n /** The grant is being persisted server-side — shows the busy Spinner state. */\n pending?: boolean;\n /** Fired when the operator confirms the consent grant. */\n onGrantConsent?: () => void;\n /**\n * Heading level for the banner's own title, so it can be nested under a\n * host section's heading without skipping levels (axe `heading-order`).\n * Additive: default `5` matches the banner's original, unconditional\n * `<h5>` — every existing consumer is unaffected.\n */\n headingLevel?: AiConsentBannerHeadingLevel;\n /** What the consent covers; picks the kit's translated wording. Default\n * `'patient-record'`, which renders exactly as before this prop existed. */\n subject?: AiConsentSubject;\n /** Host-translated strings; the host owns their wording and translation.\n * Each key overrides only its own string. `title` also names the region,\n * unless `aria-label` is passed. */\n copy?: Partial<AiConsentBannerCopy>;\n /** Override the region's accessible name. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const AiConsentBanner = forwardRef<HTMLDivElement, AiConsentBannerProps>(\n (\n {\n id,\n granted,\n grantedAt,\n grantedBy,\n canGrant = true,\n pending = false,\n onGrantConsent,\n headingLevel = 5,\n subject = 'patient-record',\n copy,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const state = deriveState(granted, pending);\n\n // A host string wins over the preset for that string only. A blank or\n // whitespace-only one counts as missing, so no control loses its name.\n const own = (value?: string) => value?.trim() || undefined;\n // An unknown subject from an untyped host falls back to the default.\n const keys = SUBJECT_KEYS[subject] ?? SUBJECT_KEYS['patient-record'];\n const text = {\n title:\n own(copy?.title) || t('aiConsentBanner.title', 'AI assistance consent'),\n descriptionRequired:\n own(copy?.descriptionRequired) ||\n t(keys.descriptionRequired.key, keys.descriptionRequired.fallback),\n descriptionGranted:\n own(copy?.descriptionGranted) ||\n t(keys.descriptionGranted.key, keys.descriptionGranted.fallback),\n confirmLabel:\n own(copy?.confirmLabel) ||\n t(keys.confirmLabel.key, keys.confirmLabel.fallback),\n grantButton:\n own(copy?.grantButton) ||\n t('aiConsentBanner.grantButton', 'Grant consent'),\n notAllowed:\n own(copy?.notAllowed) ||\n t(keys.notAllowed.key, keys.notAllowed.fallback),\n badgeGranted:\n own(copy?.badgeGranted) ||\n t('aiConsentBanner.badge.granted', 'Consent granted'),\n pendingLabel:\n own(copy?.pendingLabel) ||\n t('aiConsentBanner.pendingLabel', 'Saving consent…'),\n };\n\n // Grant stays disabled until the checkbox is ticked. Any change of subject\n // or statement unticks it, even back to an earlier one, so a tick only\n // confirms what was on screen when it was given.\n const statement = [\n subject,\n text.confirmLabel,\n text.descriptionRequired,\n ].join('\\u0000');\n const [ticked, setTicked] = useState(false);\n const [tickedFor, setTickedFor] = useState(statement);\n if (tickedFor !== statement) {\n setTickedFor(statement);\n setTicked(false);\n }\n const armed = ticked && tickedFor === statement;\n\n const armedRef = useRef(armed);\n armedRef.current = armed;\n\n const handle = useMemo<AiConsentBannerHandle>(\n () => ({\n getState: () => deriveState(granted, pending),\n isArmed: () => armedRef.current,\n }),\n [granted, pending],\n );\n useAgentRegistration(aiConsentBannerAgent, handle, id);\n\n // A host title also names the region, so the name matches the heading.\n const resolvedAriaLabel =\n own(ariaLabel) ||\n own(copy?.title) ||\n t('aiConsentBanner.regionLabel', 'AI assistance consent');\n\n // Alert variant per state: granted → success, required/pending → info.\n const alertVariant = state === 'granted' ? 'success' : 'info';\n\n let body: React.ReactNode;\n if (state === 'granted') {\n body = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant=\"success\">{text.badgeGranted}</Badge>\n {grantedAt !== undefined ? (\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedAtPrefix', 'Granted')}{' '}\n <Timestamp value={grantedAt} format=\"relative\" shape=\"inline\" />\n </span>\n ) : null}\n </div>\n {grantedBy ? (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedBy', {\n name: grantedBy,\n defaultValue: 'By {{name}}',\n })}\n </p>\n ) : null}\n </div>\n );\n } else if (state === 'pending') {\n body = (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Spinner variant=\"pulse\" size=\"sm\" label={text.pendingLabel} />\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {text.pendingLabel}\n </span>\n </div>\n );\n } else {\n // required\n body = canGrant ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <Checkbox\n checked={armed}\n onCheckedChange={(next) => setTicked(next === true)}\n label={text.confirmLabel}\n />\n <Alert.Action>\n <Button\n intent=\"primary\"\n size=\"sm\"\n disabled={!armed}\n onClick={onGrantConsent}\n >\n {text.grantButton}\n </Button>\n </Alert.Action>\n </div>\n ) : (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {text.notAllowed}\n </p>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-busy={state === 'pending' ? true : undefined}\n data-component=\"ai-consent-banner\"\n data-component-id={id}\n data-state={state}\n id={id}\n className={rootVariants({ state, className })}\n {...rest}\n >\n <Alert\n variant={alertVariant}\n icon={state === 'pending' ? null : undefined}\n >\n <Alert.Title as={`h${headingLevel}` as const}>\n {text.title}\n </Alert.Title>\n <Alert.Description>\n {state === 'granted'\n ? text.descriptionGranted\n : text.descriptionRequired}\n </Alert.Description>\n {body}\n </Alert>\n </div>\n );\n },\n);\n\nAiConsentBanner.displayName = 'AiConsentBanner';\n"],"names":["aiConsentBannerAgent","handle","rootVariants","cva","deriveState","granted","pending","SUBJECT_KEYS","AiConsentBanner","forwardRef","id","grantedAt","grantedBy","canGrant","onGrantConsent","headingLevel","subject","copy","ariaLabel","className","rest","ref","useTranslation","state","own","value","keys","text","statement","ticked","setTicked","useState","tickedFor","setTickedFor","armed","armedRef","useRef","useMemo","useAgentRegistration","resolvedAriaLabel","alertVariant","body","jsxs","jsx","Badge","Timestamp","Spinner","Checkbox","next","Alert","Button"],"mappings":";;;;;;;;;;;AAaO,MAAMA,IAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,aACE;AAAA,IAAA;AAAA,EACJ;AAEJ,GCLMC,IAAeC,EAAI,+CAA+C;AAAA,EACtE,UAAU;AAAA,IACR,OAAO;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,iBAAiB;AAAA,IACf,OAAO;AAAA,EAAA;AAEX,CAAC;AAcD,SAASC,EAAYC,GAAkBC,GAAkC;AACvE,SAAIA,IAAgB,YACbD,IAAU,YAAY;AAC/B;AAkBA,MAAME,IAAe;AAAA,EACnB,kBAAkB;AAAA,IAChB,qBAAqB;AAAA,MACnB,KAAK;AAAA,MACL,UAAU;AAAA,IAAA;AAAA,IAEZ,oBAAoB;AAAA,MAClB,KAAK;AAAA,MACL,UAAU;AAAA,IAAA;AAAA,IAEZ,c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CACF;AAAA,IAAA,GACF,IAEA,gBAAAgB,EAAC,KAAA,EAAE,WAAU,+DACV,YAAK,YACR,GAKF,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAtB;AAAA,QACA,MAAK;AAAA,QACL,cAAYkB;AAAA,QACZ,aAAWhB,MAAU,YAAY,KAAO;AAAA,QACxC,kBAAe;AAAA,QACf,qBAAmBb;AAAA,QACnB,cAAYa;AAAA,QACZ,IAAAb;AAAA,QACA,WAAWR,EAAa,EAAE,OAAAqB,GAAO,WAAAJ,GAAW;AAAA,QAC3C,GAAGC;AAAA,QAEJ,UAAA,gBAAAsB;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,SAAST;AAAA,YACT,MAAMjB,MAAU,YAAY,OAAO;AAAA,YAEnC,UAAA;AAAA,cAAA,gBAAAoB,EAACM,EAAM,OAAN,EAAY,IAAI,IAAIlC,CAAY,IAC9B,YAAK,MAAA,CACR;AAAA,cACA,gBAAA4B,EAACM,EAAM,aAAN,EACE,gBAAU,YACPtB,EAAK,qBACLA,EAAK,oBAAA,CACX;AAAA,cACCc;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEAjC,EAAgB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"ai-permission-notice-BkgcGmu8.js","sources":["../../src/components/ai-permission-notice/ai-permission-notice.agent.ts","../../src/components/ai-permission-notice/ai-permission-notice.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — AiConsentBanner. */\n/* */\n/* Read-only structural surface: the current consent state and whether */\n/* the grant affordance is armed. Identifiers / structural state ONLY — */\n/* never the grantee's name or any PHI. The real consent gate lives */\n/* server-side; this adapter does not expose a grant action so an agent */\n/* cannot consent on a user's behalf. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AiConsentBannerHandle } from './ai-permission-notice';\n\nexport const aiConsentBannerAgent: AgentAdapter<AiConsentBannerHandle> = {\n id: 'ai-consent-banner',\n capabilities: [],\n state: {\n consentState: {\n type: \"'granted' | 'required' | 'pending'\",\n descriptionKey: 'ui.agent.aiConsentBanner.state.consentState',\n description:\n 'Current consent state. Structural only — never the grantee identity.',\n read: (handle) => handle.getState(),\n },\n armed: {\n type: 'boolean',\n descriptionKey: 'ui.agent.aiConsentBanner.state.armed',\n description:\n 'Whether the consent confirmation checkbox is ticked (required state only).',\n read: (handle) => handle.isArmed(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'ai-consent-banner',\n description: 'Marks the AiConsentBanner root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific banner from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Alert } from '../alert/alert';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport { Checkbox } from '../checkbox/checkbox';\nimport { Spinner } from '../spinner/spinner';\nimport { Timestamp } from '../timestamp/timestamp';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { aiConsentBannerAgent } from './ai-permission-notice.agent';\n\n/* -------------------------------------------------------------------- */\n/* AiConsentBanner */\n/* */\n/* Presentational AI-consent gate surfaced above an AI-assisted surface */\n/* (e.g. Alfascribe consultation transcription). The SERVER owns the */\n/* real gate — this component only reflects the consent record and lets */\n/* the operator initiate a grant; it never enforces access itself. */\n/* */\n/* Three states drive the Alert variant + body: */\n/* - granted → success Alert with a Badge + when/who it was granted. */\n/* - required → info Alert with a Checkbox-gated Grant Button. */\n/* - pending → info Alert in a disabled, Spinner-busy state while the */\n/* server persists the grant. */\n/* */\n/* All kit text flows through useTranslation('ui') against the */\n/* `aiConsentBanner.*` namespace. `subject` picks the kit-owned wording */\n/* preset; `copy` lets a host replace single strings with its own text. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n state: {\n granted: '',\n required: '',\n pending: '',\n },\n },\n defaultVariants: {\n state: 'required',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* State derivation */\n/* -------------------------------------------------------------------- */\n\nexport type AiConsentState = NonNullable<\n VariantProps<typeof rootVariants>['state']\n>;\n\n/** Heading levels `AiConsentBanner.headingLevel` accepts. */\nexport type AiConsentBannerHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** Pending wins over granted/required so the busy state is never masked. */\nfunction deriveState(granted: boolean, pending: boolean): AiConsentState {\n if (pending) return 'pending';\n return granted ? 'granted' : 'required';\n}\n\n/* -------------------------------------------------------------------- */\n/* Subject presets */\n/* -------------------------------------------------------------------- */\n\n/** What the consent covers; each subject has kit-owned, translated wording.\n * `'patient-record'` (default) is one patient's record. `'practice-statistics'`\n * is the practice's aggregate figures (totals, rates), never patient data. */\nexport type AiConsentSubject = 'patient-record' | 'practice-statistics';\n\ntype AiConsentSubjectField =\n | 'descriptionRequired'\n | 'descriptionGranted'\n | 'confirmLabel'\n | 'notAllowed';\n\n/* Only these four strings differ by subject; the rest share one key each. */\nconst SUBJECT_KEYS = {\n 'patient-record': {\n descriptionRequired: {\n key: 'aiConsentBanner.description.required',\n fallback: 'AI assistance requires recorded consent before it can run.',\n },\n descriptionGranted: {\n key: 'aiConsentBanner.description.granted',\n fallback: 'AI assistance is enabled for this record.',\n },\n confirmLabel: {\n key: 'aiConsentBanner.confirmLabel',\n fallback: 'I confirm consent has been obtained for AI assistance.',\n },\n notAllowed: {\n key: 'aiConsentBanner.notAllowed',\n fallback: 'You do not have permission to grant AI assistance consent.',\n },\n },\n 'practice-statistics': {\n descriptionRequired: {\n key: 'aiConsentBanner.practiceStatistics.description.required',\n fallback:\n \"AI assistance needs consent before it can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n descriptionGranted: {\n key: 'aiConsentBanner.practiceStatistics.description.granted',\n fallback:\n \"AI assistance can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n confirmLabel: {\n key: 'aiConsentBanner.practiceStatistics.confirmLabel',\n fallback:\n 'I may decide for this practice, and I agree to AI assistance reading its statistics.',\n },\n notAllowed: {\n key: 'aiConsentBanner.practiceStatistics.notAllowed',\n fallback:\n 'You do not have permission to grant AI assistance consent for this practice.',\n },\n },\n} as const satisfies Record<\n AiConsentSubject,\n Record<AiConsentSubjectField, { key: string; fallback: string }>\n>;\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/**\n * Patient AI-consent gate for an AI surface that sends patient data to a\n * service: the RichTextEditor's Help-me-write action and dictation mics, and\n * the VoiceControlPanel's microphone. Omit entirely for today's ungated\n * behaviour — no existing host breaks.\n *\n * Present and `granted: false`: the affordances stay visible (this never\n * hides a control), but using one shows the kit's `AiConsentBanner` instead\n * of starting the AI action. When `granted` flips `true` after a Grant click\n * in that banner, the surface resumes exactly the action it gated; when it\n * flips for any other reason (another patient, another tab) it only closes\n * the banner.\n *\n * Present and `granted: true`: normal behaviour.\n */\nexport interface AiConsentGate {\n /** Whether AI consent has already been recorded for the current patient. */\n granted: boolean;\n /** When consent was granted — passed straight to `AiConsentBanner`. */\n grantedAt?: string | number | Date;\n /** Who granted consent — passed straight to `AiConsentBanner`. */\n grantedBy?: string;\n /** Whether the signed-in reader may grant consent. Default `true`; treated\n * as `false` when `onGrant` is absent, so no dead Grant control shows. */\n canGrant?: boolean;\n /** The grant is being persisted server-side (host-driven busy state). */\n pending?: boolean;\n /**\n * Fired when the reader confirms the grant in the banner. A returned\n * promise drives the banner's own pending/Spinner state until it settles,\n * in addition to (or absent) a host-supplied `pending`.\n */\n onGrant?: () => void | Promise<void>;\n}\n\n/** Host-translated strings; the host owns their wording and translation.\n * Each one replaces the `subject` preset for that string only. Plain text,\n * not i18n keys: interpolate any values (a practice name) before passing. */\nexport interface AiConsentBannerCopy {\n /** Banner heading. */\n title?: string;\n /** Description in the required and pending states. */\n descriptionRequired?: string;\n /** Description in the granted state. */\n descriptionGranted?: string;\n /** Label of the confirmation checkbox. */\n confirmLabel?: string;\n /** Label of the Grant button. */\n grantButton?: string;\n /** Note shown instead of the grant controls when `canGrant` is false. */\n notAllowed?: string;\n /** Badge text in the granted state. */\n badgeGranted?: string;\n /** Busy text (and Spinner label) in the pending state. */\n pendingLabel?: string;\n}\n\n/** Agent-readiness curated handle. Exposes the structural consent state only. */\nexport interface AiConsentBannerHandle {\n /** Current derived state: 'granted' | 'required' | 'pending'. */\n getState: () => AiConsentState;\n /** Whether the Grant affordance is currently armed (checkbox ticked). */\n isArmed: () => boolean;\n}\n\nexport interface AiConsentBannerProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children' | 'role'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific banner. Mirrored to the\n * real DOM `id`.\n */\n id?: string;\n /** Whether consent has already been granted. Server-sourced. */\n granted: boolean;\n /**\n * When consent was granted — ISO-8601 string, ms-epoch, or Date. Rendered\n * via `Timestamp` in the granted state.\n */\n grantedAt?: string | number | Date;\n /** Who granted consent (operator display name / role). Granted state only. */\n grantedBy?: string;\n /**\n * Whether the current user is allowed to grant consent. When `false`, the\n * required-state Grant affordance is hidden and a not-allowed note shows.\n * Default `true`.\n */\n canGrant?: boolean;\n /** The grant is being persisted server-side — shows the busy Spinner state. */\n pending?: boolean;\n /** Fired when the operator confirms the consent grant. */\n onGrantConsent?: () => void;\n /**\n * Heading level for the banner's own title, so it can be nested under a\n * host section's heading without skipping levels (axe `heading-order`).\n * Additive: default `5` matches the banner's original, unconditional\n * `<h5>` — every existing consumer is unaffected.\n */\n headingLevel?: AiConsentBannerHeadingLevel;\n /** What the consent covers; picks the kit's translated wording. Default\n * `'patient-record'`, which renders exactly as before this prop existed. */\n subject?: AiConsentSubject;\n /** Host-translated strings; the host owns their wording and translation.\n * Each key overrides only its own string. `title` also names the region,\n * unless `aria-label` is passed. */\n copy?: Partial<AiConsentBannerCopy>;\n /** Override the region's accessible name. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const AiConsentBanner = forwardRef<HTMLDivElement, AiConsentBannerProps>(\n (\n {\n id,\n granted,\n grantedAt,\n grantedBy,\n canGrant = true,\n pending = false,\n onGrantConsent,\n headingLevel = 5,\n subject = 'patient-record',\n copy,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const state = deriveState(granted, pending);\n\n // A host string wins over the preset for that string only. A blank or\n // whitespace-only one counts as missing, so no control loses its name.\n const own = (value?: string) => value?.trim() || undefined;\n // An unknown subject from an untyped host falls back to the default.\n const keys = SUBJECT_KEYS[subject] ?? SUBJECT_KEYS['patient-record'];\n const text = {\n title:\n own(copy?.title) || t('aiConsentBanner.title', 'AI assistance consent'),\n descriptionRequired:\n own(copy?.descriptionRequired) ||\n t(keys.descriptionRequired.key, keys.descriptionRequired.fallback),\n descriptionGranted:\n own(copy?.descriptionGranted) ||\n t(keys.descriptionGranted.key, keys.descriptionGranted.fallback),\n confirmLabel:\n own(copy?.confirmLabel) ||\n t(keys.confirmLabel.key, keys.confirmLabel.fallback),\n grantButton:\n own(copy?.grantButton) ||\n t('aiConsentBanner.grantButton', 'Grant consent'),\n notAllowed:\n own(copy?.notAllowed) ||\n t(keys.notAllowed.key, keys.notAllowed.fallback),\n badgeGranted:\n own(copy?.badgeGranted) ||\n t('aiConsentBanner.badge.granted', 'Consent granted'),\n pendingLabel:\n own(copy?.pendingLabel) ||\n t('aiConsentBanner.pendingLabel', 'Saving consent…'),\n };\n\n // Grant stays disabled until the checkbox is ticked. Any change of subject\n // or statement unticks it, even back to an earlier one, so a tick only\n // confirms what was on screen when it was given.\n const statement = [\n subject,\n text.confirmLabel,\n text.descriptionRequired,\n ].join('\\u0000');\n const [ticked, setTicked] = useState(false);\n const [tickedFor, setTickedFor] = useState(statement);\n if (tickedFor !== statement) {\n setTickedFor(statement);\n setTicked(false);\n }\n const armed = ticked && tickedFor === statement;\n\n const armedRef = useRef(armed);\n armedRef.current = armed;\n\n const handle = useMemo<AiConsentBannerHandle>(\n () => ({\n getState: () => deriveState(granted, pending),\n isArmed: () => armedRef.current,\n }),\n [granted, pending],\n );\n useAgentRegistration(aiConsentBannerAgent, handle, id);\n\n // A host title also names the region, so the name matches the heading.\n const resolvedAriaLabel =\n own(ariaLabel) ||\n own(copy?.title) ||\n t('aiConsentBanner.regionLabel', 'AI assistance consent');\n\n // Alert variant per state: granted → success, required/pending → info.\n const alertVariant = state === 'granted' ? 'success' : 'info';\n\n let body: React.ReactNode;\n if (state === 'granted') {\n body = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant=\"success\">{text.badgeGranted}</Badge>\n {grantedAt !== undefined ? (\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedAtPrefix', 'Granted')}{' '}\n <Timestamp value={grantedAt} format=\"relative\" shape=\"inline\" />\n </span>\n ) : null}\n </div>\n {grantedBy ? (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedBy', {\n name: grantedBy,\n defaultValue: 'By {{name}}',\n })}\n </p>\n ) : null}\n </div>\n );\n } else if (state === 'pending') {\n body = (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Spinner variant=\"pulse\" size=\"sm\" label={text.pendingLabel} />\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {text.pendingLabel}\n </span>\n </div>\n );\n } else {\n // required\n body = canGrant ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <Checkbox\n checked={armed}\n onCheckedChange={(next) => setTicked(next === true)}\n label={text.confirmLabel}\n />\n <Alert.Action>\n <Button\n intent=\"primary\"\n size=\"sm\"\n disabled={!armed}\n onClick={onGrantConsent}\n >\n {text.grantButton}\n </Button>\n </Alert.Action>\n </div>\n ) : (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {text.notAllowed}\n </p>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-busy={state === 'pending' ? true : undefined}\n data-component=\"ai-consent-banner\"\n data-component-id={id}\n data-state={state}\n id={id}\n className={rootVariants({ state, className })}\n {...rest}\n >\n <Alert\n variant={alertVariant}\n icon={state === 'pending' ? null : undefined}\n >\n <Alert.Title as={`h${headingLevel}` as const}>\n {text.title}\n </Alert.Title>\n <Alert.Description>\n {state === 'granted'\n ? text.descriptionGranted\n : text.descriptionRequired}\n </Alert.Description>\n {body}\n </Alert>\n </div>\n );\n },\n);\n\nAiConsentBanner.displayName = 'AiConsentBanner';\n"],"names":["aiConsentBannerAgent","handle","rootVariants","cva","deriveState","granted","pending","SUBJECT_KEYS","AiConsentBanner","forwardRef","id","grantedAt","grantedBy","canGrant","onGrantConsent","headingLevel","subject","copy","ariaLabel","className","rest","ref","useTranslation","state","own","value","keys","text","statement","ticked","setTicked","useState","tickedFor","setTickedFor","armed","armedRef","useRef","useMemo","useAgentRegistration","resolvedAriaLabel","alertVariant","body","jsxs","jsx","Badge","Timestamp","Spinner","Checkbox","next","Alert","Button"],"mappings":";;;;;;;;;;;AAaO,MAAMA,IAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAA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sB;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,SAAST;AAAA,YACT,MAAMjB,MAAU,YAAY,OAAO;AAAA,YAEnC,UAAA;AAAA,cAAA,gBAAAoB,EAACM,EAAM,OAAN,EAAY,IAAI,IAAIlC,CAAY,IAC9B,YAAK,MAAA,CACR;AAAA,cACA,gBAAA4B,EAACM,EAAM,aAAN,EACE,gBAAU,YACPtB,EAAK,qBACLA,EAAK,oBAAA,CACX;AAAA,cACCc;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEAjC,EAAgB,cAAc;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as E, jsx as e, Fragment as q } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as p, useState as O, useRef as J, useCallback as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
2
|
+
import { forwardRef as p, useState as O, useRef as J, useCallback as y, useEffect as Q, Children as Y, isValidElement as Z, useContext as D, useId as ee, createContext as te } from "react";
|
|
3
|
+
import { c as oe } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as z } from "react-i18next";
|
|
5
|
+
import { u as se } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { u as L } from "./use-clamp-overflow-DQE2kwZ9.js";
|
|
7
7
|
import { c as S, u as re } from "./use-dismissed-CTOWqA0e.js";
|
|
8
|
-
import { i as
|
|
9
|
-
import { T as
|
|
8
|
+
import { i as ae } from "./is-development-CLUAnsU7.js";
|
|
9
|
+
import { T as ie } from "./tooltip-uEBdD1-5.js";
|
|
10
10
|
import { X as ne } from "./x-B5YnXwCz.js";
|
|
11
11
|
import { c as de } from "./createLucideIcon-DhHxpK9K.js";
|
|
12
12
|
import { C as le } from "./circle-alert-rGDZ73Wh.js";
|
|
@@ -36,7 +36,7 @@ const fe = [
|
|
|
36
36
|
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
37
37
|
"ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
38
38
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
39
|
-
].join(" "), ge =
|
|
39
|
+
].join(" "), ge = oe(
|
|
40
40
|
[
|
|
41
41
|
// Default `items-center` keeps the icon + dismiss optically aligned
|
|
42
42
|
// with a single-line description. The `data-[has-title=true]`
|
|
@@ -49,7 +49,11 @@ const fe = [
|
|
|
49
49
|
"ds:rounded-[var(--radius-md)]",
|
|
50
50
|
"ds:border ds:border-[length:var(--border-width-sm)]",
|
|
51
51
|
"ds:p-[var(--spacing-md)]",
|
|
52
|
-
"ds:break-words"
|
|
52
|
+
"ds:break-words",
|
|
53
|
+
// A Button or Link inside keeps the full touch target at any viewport
|
|
54
|
+
// and any root font size: the token is px, and this selector outranks
|
|
55
|
+
// the button's own `sm:min-h-0`. Inline links in a sentence are exempt.
|
|
56
|
+
"ds:[&_[data-component=button]]:min-h-[var(--min-target-size)]"
|
|
53
57
|
].join(" "),
|
|
54
58
|
{
|
|
55
59
|
variants: {
|
|
@@ -63,6 +67,7 @@ const fe = [
|
|
|
63
67
|
"ds:border-[color:var(--info)]",
|
|
64
68
|
"ds:bg-[color-mix(in_srgb,var(--info)_10%,transparent)]",
|
|
65
69
|
"ds:text-[var(--info-foreground)]",
|
|
70
|
+
"ds:[&_[data-component=link]]:text-[color:var(--info-foreground)]",
|
|
66
71
|
"ds:[&_[data-intent=tonal]]:bg-[color:var(--info-foreground)]",
|
|
67
72
|
"ds:[&_[data-intent=tonal]]:text-[color:var(--background)]"
|
|
68
73
|
].join(" "),
|
|
@@ -70,6 +75,7 @@ const fe = [
|
|
|
70
75
|
"ds:border-[color:var(--success)]",
|
|
71
76
|
"ds:bg-[color-mix(in_srgb,var(--success)_10%,transparent)]",
|
|
72
77
|
"ds:text-[var(--success-foreground)]",
|
|
78
|
+
"ds:[&_[data-component=link]]:text-[color:var(--success-foreground)]",
|
|
73
79
|
"ds:[&_[data-intent=tonal]]:bg-[color:var(--success-foreground)]",
|
|
74
80
|
"ds:[&_[data-intent=tonal]]:text-[color:var(--background)]"
|
|
75
81
|
].join(" "),
|
|
@@ -77,6 +83,7 @@ const fe = [
|
|
|
77
83
|
"ds:border-[color:var(--warning)]",
|
|
78
84
|
"ds:bg-[color-mix(in_srgb,var(--warning)_10%,transparent)]",
|
|
79
85
|
"ds:text-[var(--warning-foreground)]",
|
|
86
|
+
"ds:[&_[data-component=link]]:text-[color:var(--warning-foreground)]",
|
|
80
87
|
"ds:[&_[data-intent=tonal]]:bg-[color:var(--warning-foreground)]",
|
|
81
88
|
"ds:[&_[data-intent=tonal]]:text-[color:var(--background)]"
|
|
82
89
|
].join(" "),
|
|
@@ -84,6 +91,7 @@ const fe = [
|
|
|
84
91
|
"ds:border-[color:var(--error)]",
|
|
85
92
|
"ds:bg-[color-mix(in_srgb,var(--error)_10%,transparent)]",
|
|
86
93
|
"ds:text-[var(--error-foreground)]",
|
|
94
|
+
"ds:[&_[data-component=link]]:text-[color:var(--error-foreground)]",
|
|
87
95
|
"ds:[&_[data-intent=tonal]]:bg-[color:var(--error-foreground)]",
|
|
88
96
|
"ds:[&_[data-intent=tonal]]:text-[color:var(--background)]"
|
|
89
97
|
].join(" "),
|
|
@@ -97,6 +105,7 @@ const fe = [
|
|
|
97
105
|
"ds:border-[color:var(--promo)]",
|
|
98
106
|
"ds:bg-[image:var(--gradient-surface-subtle-accent)]",
|
|
99
107
|
"ds:text-[var(--promo-foreground)]",
|
|
108
|
+
"ds:[&_[data-component=link]]:text-[color:var(--promo-foreground)]",
|
|
100
109
|
"ds:[&_[data-intent=tonal]]:bg-[color:var(--promo-foreground)]",
|
|
101
110
|
"ds:[&_[data-intent=tonal]]:text-[color:var(--background)]"
|
|
102
111
|
].join(" ")
|
|
@@ -106,7 +115,7 @@ const fe = [
|
|
|
106
115
|
variant: "info"
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
|
-
),
|
|
118
|
+
), V = "ds:shrink-0 ds:size-5", be = `${V} ds:mt-0.5`, xe = [
|
|
110
119
|
// Default (no title): the alert root uses `items-center` and the
|
|
111
120
|
// button centres in the cross-axis. A centred 16×16 glyph inside a
|
|
112
121
|
// 44×44 button aligns optically with a single-line description.
|
|
@@ -130,7 +139,7 @@ const fe = [
|
|
|
130
139
|
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
131
140
|
"ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
132
141
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
133
|
-
].join(" "),
|
|
142
|
+
].join(" "), _e = {
|
|
134
143
|
info: { icon: /* @__PURE__ */ e(me, { "aria-hidden": "true" }), role: "status", live: "polite" },
|
|
135
144
|
success: {
|
|
136
145
|
icon: /* @__PURE__ */ e(ue, { "aria-hidden": "true" }),
|
|
@@ -153,42 +162,42 @@ const fe = [
|
|
|
153
162
|
role: "status",
|
|
154
163
|
live: "polite"
|
|
155
164
|
}
|
|
156
|
-
},
|
|
165
|
+
}, he = {
|
|
157
166
|
off: { role: void 0, live: void 0 },
|
|
158
167
|
polite: { role: "status", live: "polite" },
|
|
159
168
|
assertive: { role: "alert", live: "assertive" }
|
|
160
169
|
}, C = p(
|
|
161
|
-
({ as: r = "h5", className: n, children:
|
|
162
|
-
const
|
|
170
|
+
({ as: r = "h5", className: n, children: a, ...i }, t) => {
|
|
171
|
+
const o = D(w), { ref: d, isOverflowing: s } = L(o), f = y(
|
|
163
172
|
(l) => {
|
|
164
173
|
d.current = l, typeof t == "function" ? t(l) : t && (t.current = l);
|
|
165
174
|
},
|
|
166
175
|
[t, d]
|
|
167
|
-
), c =
|
|
176
|
+
), c = o && s && typeof a == "string", m = /* @__PURE__ */ e(
|
|
168
177
|
r,
|
|
169
178
|
{
|
|
170
179
|
ref: f,
|
|
171
180
|
tabIndex: c ? 0 : void 0,
|
|
172
181
|
className: [
|
|
173
182
|
"type-title-item",
|
|
174
|
-
|
|
183
|
+
o ? "ds:line-clamp-2" : "",
|
|
175
184
|
n
|
|
176
185
|
].filter(Boolean).join(" "),
|
|
177
|
-
...
|
|
178
|
-
children:
|
|
186
|
+
...i,
|
|
187
|
+
children: a
|
|
179
188
|
}
|
|
180
189
|
);
|
|
181
|
-
return c ? /* @__PURE__ */ e(
|
|
190
|
+
return c ? /* @__PURE__ */ e(ie, { label: a, children: m }) : m;
|
|
182
191
|
}
|
|
183
192
|
);
|
|
184
193
|
C.displayName = "Alert.Title";
|
|
185
|
-
const B = p(({ className: r, children: n, ...
|
|
186
|
-
const t = D(w), { t:
|
|
194
|
+
const B = p(({ className: r, children: n, ...a }, i) => {
|
|
195
|
+
const t = D(w), { t: o } = z("ui"), d = ee(), [s, f] = O(!1), { ref: c, isOverflowing: m } = L(t && !s), l = y(
|
|
187
196
|
(u) => {
|
|
188
|
-
c.current = u, typeof
|
|
197
|
+
c.current = u, typeof i == "function" ? i(u) : i && (i.current = u);
|
|
189
198
|
},
|
|
190
|
-
[
|
|
191
|
-
), g = t && (m ||
|
|
199
|
+
[i, c]
|
|
200
|
+
), g = t && (m || s);
|
|
192
201
|
return /* @__PURE__ */ E(q, { children: [
|
|
193
202
|
/* @__PURE__ */ e(
|
|
194
203
|
"p",
|
|
@@ -197,10 +206,10 @@ const B = p(({ className: r, children: n, ...i }, a) => {
|
|
|
197
206
|
id: t ? d : void 0,
|
|
198
207
|
className: [
|
|
199
208
|
"ds:[[data-has-title=true]_&]:mt-[var(--spacing-xs)] type-body-sm",
|
|
200
|
-
t && !
|
|
209
|
+
t && !s ? "ds:line-clamp-2" : "",
|
|
201
210
|
r
|
|
202
211
|
].filter(Boolean).join(" "),
|
|
203
|
-
...
|
|
212
|
+
...a,
|
|
204
213
|
children: n
|
|
205
214
|
}
|
|
206
215
|
),
|
|
@@ -208,21 +217,21 @@ const B = p(({ className: r, children: n, ...i }, a) => {
|
|
|
208
217
|
"button",
|
|
209
218
|
{
|
|
210
219
|
type: "button",
|
|
211
|
-
"aria-expanded":
|
|
220
|
+
"aria-expanded": s,
|
|
212
221
|
"aria-controls": d,
|
|
213
222
|
onClick: () => f((u) => !u),
|
|
214
223
|
className: pe,
|
|
215
|
-
children:
|
|
224
|
+
children: s ? o("feedback.alert.readLess", "Read less") : o("feedback.alert.readMore", "Read more")
|
|
216
225
|
}
|
|
217
226
|
) : null
|
|
218
227
|
] });
|
|
219
228
|
});
|
|
220
229
|
B.displayName = "Alert.Description";
|
|
221
230
|
const F = p(
|
|
222
|
-
({ className: r, ...n },
|
|
231
|
+
({ className: r, ...n }, a) => /* @__PURE__ */ e(
|
|
223
232
|
"div",
|
|
224
233
|
{
|
|
225
|
-
ref:
|
|
234
|
+
ref: a,
|
|
226
235
|
className: [
|
|
227
236
|
"ds:mt-[var(--spacing-md)] ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
228
237
|
r
|
|
@@ -236,49 +245,49 @@ const U = p(
|
|
|
236
245
|
({
|
|
237
246
|
variant: r = "info",
|
|
238
247
|
dismissKey: n,
|
|
239
|
-
dismissLifetimeMs:
|
|
240
|
-
dismissible:
|
|
248
|
+
dismissLifetimeMs: a,
|
|
249
|
+
dismissible: i = S(n) !== void 0,
|
|
241
250
|
open: t,
|
|
242
|
-
onOpenChange:
|
|
251
|
+
onOpenChange: o,
|
|
243
252
|
icon: d,
|
|
244
|
-
announce:
|
|
253
|
+
announce: s,
|
|
245
254
|
live: f,
|
|
246
255
|
clamp: c = !1,
|
|
247
256
|
className: m,
|
|
248
257
|
children: l,
|
|
249
258
|
...g
|
|
250
259
|
}, u) => {
|
|
251
|
-
const { t: K } =
|
|
260
|
+
const { t: K } = z("ui"), [M, G] = se({
|
|
252
261
|
value: t,
|
|
253
262
|
defaultValue: !0,
|
|
254
|
-
onChange:
|
|
263
|
+
onChange: o
|
|
255
264
|
}), W = M ?? !0, b = S(n), { dismissed: H, dismiss: P } = re(b, {
|
|
256
|
-
lifetimeMs:
|
|
257
|
-
}), [A, N] = O(!1), x = J(null), X =
|
|
265
|
+
lifetimeMs: a
|
|
266
|
+
}), [A, N] = O(!1), x = J(null), X = y(() => {
|
|
258
267
|
if (typeof window > "u") return 200;
|
|
259
268
|
const v = window.getComputedStyle(document.documentElement).getPropertyValue("--animation-duration");
|
|
260
269
|
if (!v) return 200;
|
|
261
|
-
const R = v.trim(),
|
|
262
|
-
return Number.isFinite(
|
|
270
|
+
const R = v.trim(), h = parseFloat(R);
|
|
271
|
+
return Number.isFinite(h) ? R.endsWith("ms") ? h : h * 1e3 : 200;
|
|
263
272
|
}, []), T = b !== void 0 && r === "error";
|
|
264
273
|
if (Q(() => {
|
|
265
|
-
T &&
|
|
274
|
+
T && ae() && console.warn(
|
|
266
275
|
"Alert: an error should stay until it is resolved; drop `dismissKey` from error alerts."
|
|
267
276
|
);
|
|
268
277
|
}, [T]), !W || H) return null;
|
|
269
|
-
const
|
|
278
|
+
const _ = _e[r], k = d !== void 0 ? d : _.icon, j = s ? he[s] : { role: _.role, live: f ?? _.live }, I = Y.toArray(l).some(
|
|
270
279
|
(v) => Z(v) && v.type === C
|
|
271
280
|
), $ = () => {
|
|
272
281
|
A || (N(!0), x.current && clearTimeout(x.current), x.current = setTimeout(() => {
|
|
273
|
-
N(!1), b !== void 0 ? (P(),
|
|
282
|
+
N(!1), b !== void 0 ? (P(), o == null || o(!1)) : G(!1);
|
|
274
283
|
}, X()));
|
|
275
284
|
};
|
|
276
285
|
return /* @__PURE__ */ E(
|
|
277
286
|
"div",
|
|
278
287
|
{
|
|
279
288
|
ref: u,
|
|
280
|
-
role:
|
|
281
|
-
"aria-live":
|
|
289
|
+
role: j.role,
|
|
290
|
+
"aria-live": j.live,
|
|
282
291
|
"data-component": "alert",
|
|
283
292
|
"data-has-title": I ? "true" : "false",
|
|
284
293
|
"data-state": A ? "closing" : "open",
|
|
@@ -299,9 +308,9 @@ const U = p(
|
|
|
299
308
|
].join(" "),
|
|
300
309
|
...g,
|
|
301
310
|
children: [
|
|
302
|
-
|
|
311
|
+
k ? /* @__PURE__ */ e("span", { className: I ? be : V, children: k }) : null,
|
|
303
312
|
/* @__PURE__ */ e("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ e(w.Provider, { value: c, children: l }) }),
|
|
304
|
-
|
|
313
|
+
i ? /* @__PURE__ */ e(
|
|
305
314
|
"button",
|
|
306
315
|
{
|
|
307
316
|
type: "button",
|
|
@@ -318,13 +327,13 @@ const U = p(
|
|
|
318
327
|
}
|
|
319
328
|
);
|
|
320
329
|
U.displayName = "Alert";
|
|
321
|
-
const
|
|
330
|
+
const Le = Object.assign(U, {
|
|
322
331
|
Title: C,
|
|
323
332
|
Description: B,
|
|
324
333
|
Action: F
|
|
325
334
|
});
|
|
326
335
|
export {
|
|
327
|
-
|
|
336
|
+
Le as A,
|
|
328
337
|
ve as C
|
|
329
338
|
};
|
|
330
|
-
//# sourceMappingURL=alert-
|
|
339
|
+
//# sourceMappingURL=alert-C4WKViaS.js.map
|