@alfadocs/ui-kit-debug 0.66.0 → 0.67.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/{agenda-card-Bl-SBiCh.js → agenda-card-BxSFkqgY.js} +2 -2
- package/dist/_chunks/{agenda-card-Bl-SBiCh.js.map → agenda-card-BxSFkqgY.js.map} +1 -1
- package/dist/_chunks/{agenda-tray-Bh1KfEOG.js → agenda-tray-T-BumlGZ.js} +2 -2
- package/dist/_chunks/{agenda-tray-Bh1KfEOG.js.map → agenda-tray-T-BumlGZ.js.map} +1 -1
- package/dist/_chunks/{ai-consent-banner-Btzmk8OH.js → ai-consent-banner-Dxtx_WAh.js} +2 -2
- package/dist/_chunks/{ai-consent-banner-Btzmk8OH.js.map → ai-consent-banner-Dxtx_WAh.js.map} +1 -1
- package/dist/_chunks/{ai-tools-rail-DAfaW8eA.js → ai-tools-rail-DfmewPUN.js} +57 -50
- package/dist/_chunks/ai-tools-rail-DfmewPUN.js.map +1 -0
- package/dist/_chunks/{alia-sidebar-CN8pA6c-.js → alia-sidebar-Ckv0yCKi.js} +2 -2
- package/dist/_chunks/{alia-sidebar-CN8pA6c-.js.map → alia-sidebar-Ckv0yCKi.js.map} +1 -1
- package/dist/_chunks/{anamnesis-card-qeLYRG79.js → anamnesis-card-N8pIKWuS.js} +2 -2
- package/dist/_chunks/{anamnesis-card-qeLYRG79.js.map → anamnesis-card-N8pIKWuS.js.map} +1 -1
- package/dist/_chunks/{antenatal-schedule-timeline-BfzFjEyb.js → antenatal-schedule-timeline-35ebkcZT.js} +2 -2
- package/dist/_chunks/{antenatal-schedule-timeline-BfzFjEyb.js.map → antenatal-schedule-timeline-35ebkcZT.js.map} +1 -1
- package/dist/_chunks/{appointment-tray-BQnJEora.js → appointment-tray-CQJ3Nbi5.js} +4 -4
- package/dist/_chunks/{appointment-tray-BQnJEora.js.map → appointment-tray-CQJ3Nbi5.js.map} +1 -1
- package/dist/_chunks/{badge-zsf5i5bH.js → badge-CqGsX32l.js} +46 -42
- package/dist/_chunks/badge-CqGsX32l.js.map +1 -0
- package/dist/_chunks/{bishop-score-DPN4Ched.js → bishop-score-CjsB9bM-.js} +2 -2
- package/dist/_chunks/{bishop-score-DPN4Ched.js.map → bishop-score-CjsB9bM-.js.map} +1 -1
- package/dist/_chunks/{bmi-calculator-DuUneHuZ.js → bmi-calculator-n-823_1V.js} +2 -2
- package/dist/_chunks/{bmi-calculator-DuUneHuZ.js.map → bmi-calculator-n-823_1V.js.map} +1 -1
- package/dist/_chunks/{care-plan-card-D42WD4-T.js → care-plan-card-CJei-nl9.js} +4 -4
- package/dist/_chunks/{care-plan-card-D42WD4-T.js.map → care-plan-card-CJei-nl9.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-BukNI7Uy.js → care-plan-entry-card-EmfrbHu8.js} +4 -4
- package/dist/_chunks/{care-plan-entry-card-BukNI7Uy.js.map → care-plan-entry-card-EmfrbHu8.js.map} +1 -1
- package/dist/_chunks/{clinical-note-card-BYo437dU.js → clinical-note-card-gtrxv6zn.js} +2 -2
- package/dist/_chunks/{clinical-note-card-BYo437dU.js.map → clinical-note-card-gtrxv6zn.js.map} +1 -1
- package/dist/_chunks/{color-picker-9tL7pz5y.js → color-picker-B7xsn6tX.js} +186 -167
- package/dist/_chunks/color-picker-B7xsn6tX.js.map +1 -0
- package/dist/_chunks/{contact-profile-card-CCeJmjbd.js → contact-profile-card-7BMB85T6.js} +2 -2
- package/dist/_chunks/{contact-profile-card-CCeJmjbd.js.map → contact-profile-card-7BMB85T6.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-D6LTmtQt.js → cycle-calculator-BF0ointe.js} +2 -2
- package/dist/_chunks/{cycle-calculator-D6LTmtQt.js.map → cycle-calculator-BF0ointe.js.map} +1 -1
- package/dist/_chunks/{dependent-selector-CRWgieHm.js → dependent-selector-DpzGtr_J.js} +2 -2
- package/dist/_chunks/{dependent-selector-CRWgieHm.js.map → dependent-selector-DpzGtr_J.js.map} +1 -1
- package/dist/_chunks/{document-scanner-biBS_f6c.js → document-scanner-D2qehl3-.js} +53 -53
- package/dist/_chunks/{document-scanner-biBS_f6c.js.map → document-scanner-D2qehl3-.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-CIG194vq.js → due-date-calculator-DU9AEWNy.js} +3 -3
- package/dist/_chunks/{due-date-calculator-CIG194vq.js.map → due-date-calculator-DU9AEWNy.js.map} +1 -1
- package/dist/_chunks/{editable-currency-cell-renderer-f3d0Rhue.js → editable-currency-cell-renderer-BVJ04DkB.js} +956 -897
- package/dist/_chunks/editable-currency-cell-renderer-BVJ04DkB.js.map +1 -0
- package/dist/_chunks/{fetal-weight-Xf8-ZoDy.js → fetal-weight-BVSzOhuR.js} +2 -2
- package/dist/_chunks/{fetal-weight-Xf8-ZoDy.js.map → fetal-weight-BVSzOhuR.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-BGsZaWXW.js → gestational-age-calculator-DBlFdoiP.js} +3 -3
- package/dist/_chunks/{gestational-age-calculator-BGsZaWXW.js.map → gestational-age-calculator-DBlFdoiP.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-LH5i6oM7.js → hcg-doubling-if4Q8aSX.js} +2 -2
- package/dist/_chunks/{hcg-doubling-LH5i6oM7.js.map → hcg-doubling-if4Q8aSX.js.map} +1 -1
- package/dist/_chunks/{marketplace-app-shell-Cou6XnMJ.js → marketplace-app-shell-Bu-HD3fy.js} +3 -3
- package/dist/_chunks/{marketplace-app-shell-Cou6XnMJ.js.map → marketplace-app-shell-Bu-HD3fy.js.map} +1 -1
- package/dist/_chunks/{message-card-Bgcvfj6-.js → message-card-Bx4GmLvf.js} +9 -9
- package/dist/_chunks/{message-card-Bgcvfj6-.js.map → message-card-Bx4GmLvf.js.map} +1 -1
- package/dist/_chunks/{message-tray-saAVMeHP.js → message-tray-CVyJajVJ.js} +2 -2
- package/dist/_chunks/{message-tray-saAVMeHP.js.map → message-tray-CVyJajVJ.js.map} +1 -1
- package/dist/_chunks/{operator-hero-CM8949Hd.js → operator-hero-f_KaRhw5.js} +2 -2
- package/dist/_chunks/{operator-hero-CM8949Hd.js.map → operator-hero-f_KaRhw5.js.map} +1 -1
- package/dist/_chunks/{patient-search-Bw9ONucF.js → patient-search-DR9XUYRQ.js} +2 -2
- package/dist/_chunks/{patient-search-Bw9ONucF.js.map → patient-search-DR9XUYRQ.js.map} +1 -1
- package/dist/_chunks/{patient-shell-Tgpv0HND.js → patient-shell-DrV_iekt.js} +2 -2
- package/dist/_chunks/{patient-shell-Tgpv0HND.js.map → patient-shell-DrV_iekt.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-Bgso0p_l.js → patient-summary-card-ByfIU8N0.js} +4 -4
- package/dist/_chunks/{patient-summary-card-Bgso0p_l.js.map → patient-summary-card-ByfIU8N0.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-DBz3hVDz.js → payment-request-card-yTjzKQCU.js} +3 -3
- package/dist/_chunks/{payment-request-card-DBz3hVDz.js.map → payment-request-card-yTjzKQCU.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-card-AYyHtU9K.js → periodontal-chart-card-Dh3KgvYG.js} +2 -2
- package/dist/_chunks/{periodontal-chart-card-AYyHtU9K.js.map → periodontal-chart-card-Dh3KgvYG.js.map} +1 -1
- package/dist/_chunks/{practice-results-CVAgY2RZ.js → practice-results-DND2SAt7.js} +2 -2
- package/dist/_chunks/{practice-results-CVAgY2RZ.js.map → practice-results-DND2SAt7.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-f9aJbiAk.js → pregnancy-dating-QY-sqpvj.js} +3 -3
- package/dist/_chunks/{pregnancy-dating-f9aJbiAk.js.map → pregnancy-dating-QY-sqpvj.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-BMRBeA8V.js → pregnancy-weight-gain-DOJXXNYP.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-BMRBeA8V.js.map → pregnancy-weight-gain-DOJXXNYP.js.map} +1 -1
- package/dist/_chunks/rich-text-editor-BOQr5lHx.js +1970 -0
- package/dist/_chunks/rich-text-editor-BOQr5lHx.js.map +1 -0
- package/dist/_chunks/{scroll-area-BWqCkEGz.js → scroll-area-eccd_Uf-.js} +38 -28
- package/dist/_chunks/scroll-area-eccd_Uf-.js.map +1 -0
- package/dist/_chunks/{sidebar-BFwbx74W.js → sidebar-CGjIk_FQ.js} +25 -22
- package/dist/_chunks/sidebar-CGjIk_FQ.js.map +1 -0
- package/dist/_chunks/{suggestion-chip-C4kxWUIs.js → suggestion-chip-Bk4PmYTg.js} +30 -30
- package/dist/_chunks/suggestion-chip-Bk4PmYTg.js.map +1 -0
- package/dist/_chunks/{tab-bar-Xetknddo.js → tab-bar-B1ovILzh.js} +2 -2
- package/dist/_chunks/{tab-bar-Xetknddo.js.map → tab-bar-B1ovILzh.js.map} +1 -1
- package/dist/_chunks/{tag-CdA0s_VV.js → tag-BQXwuJq1.js} +41 -38
- package/dist/_chunks/tag-BQXwuJq1.js.map +1 -0
- package/dist/_chunks/{transaction-chip-BZCa6XDn.js → transaction-chip-BrW8P50O.js} +19 -19
- package/dist/_chunks/transaction-chip-BrW8P50O.js.map +1 -0
- package/dist/_chunks/{workflow-map-Bt4Of5dT.js → workflow-map-JAZryZJr.js} +2 -2
- package/dist/_chunks/{workflow-map-Bt4Of5dT.js.map → workflow-map-JAZryZJr.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/agenda-card/index.js +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/ai-tools-rail/ai-tools-rail.d.ts.map +1 -1
- package/dist/components/ai-tools-rail/index.js +1 -1
- package/dist/components/anamnesis-card/index.js +1 -1
- package/dist/components/appointment-card/index.js +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/bishop-score/index.js +1 -1
- package/dist/components/bmi-calculator/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/clinical-note-card/index.js +1 -1
- package/dist/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/cell-renderers/actions-cell-renderer.d.ts +16 -0
- package/dist/components/data-table/cell-renderers/actions-cell-renderer.d.ts.map +1 -1
- package/dist/components/data-table/cell-renderers/tooth-cell-renderer.d.ts +12 -0
- package/dist/components/data-table/cell-renderers/tooth-cell-renderer.d.ts.map +1 -0
- package/dist/components/data-table/data-table.d.ts +1 -1
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +13 -12
- package/dist/components/data-table/toolbar.d.ts +5 -1
- package/dist/components/data-table/toolbar.d.ts.map +1 -1
- package/dist/components/dependent-selector/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/fetal-weight/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/message-card/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/periodontal-chart-card/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/rich-text-editor/editor-toolbar.d.ts +25 -1
- package/dist/components/rich-text-editor/editor-toolbar.d.ts.map +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +2 -0
- package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -1
- package/dist/components/scroll-area/index.js +1 -1
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/suggestion-chip/index.js +1 -1
- package/dist/components/tab-bar/index.js +1 -1
- package/dist/components/tag/index.js +1 -1
- package/dist/components/tag/tag.d.ts.map +1 -1
- package/dist/components/transaction-chip/index.js +1 -1
- package/dist/components/transaction-chip/transaction-chip.d.ts.map +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +10 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +11 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +10 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +11 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +10 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +11 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +10 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +11 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +10 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +11 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +10 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +11 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +10 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +11 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +10 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +11 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +10 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +11 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +10 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +9 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +10 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +11 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +10 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +11 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +10 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +11 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +10 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +11 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +10 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +11 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +10 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +9 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +10 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +11 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +10 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +9 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +508 -507
- package/dist/locales/ar.json +11 -1
- package/dist/locales/de.json +11 -1
- package/dist/locales/el.json +11 -1
- package/dist/locales/en.json +11 -1
- package/dist/locales/es.json +11 -1
- package/dist/locales/fr.json +11 -1
- package/dist/locales/hi.json +11 -1
- package/dist/locales/it.json +11 -1
- package/dist/locales/ja.json +11 -1
- package/dist/locales/nl.json +11 -1
- package/dist/locales/pl.json +11 -1
- package/dist/locales/pt.json +11 -1
- package/dist/locales/ro.json +11 -1
- package/dist/locales/ru.json +11 -1
- package/dist/locales/sq.json +11 -1
- package/dist/locales/sv.json +11 -1
- package/dist/locales/tr.json +11 -1
- package/dist/locales/zh.json +11 -1
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +6 -3
- package/package.json +1 -1
- package/dist/_chunks/ai-tools-rail-DAfaW8eA.js.map +0 -1
- package/dist/_chunks/badge-zsf5i5bH.js.map +0 -1
- package/dist/_chunks/color-picker-9tL7pz5y.js.map +0 -1
- package/dist/_chunks/editable-currency-cell-renderer-f3d0Rhue.js.map +0 -1
- package/dist/_chunks/rich-text-editor-B5XQNxe8.js +0 -1586
- package/dist/_chunks/rich-text-editor-B5XQNxe8.js.map +0 -1
- package/dist/_chunks/scroll-area-BWqCkEGz.js.map +0 -1
- package/dist/_chunks/sidebar-BFwbx74W.js.map +0 -1
- package/dist/_chunks/suggestion-chip-C4kxWUIs.js.map +0 -1
- package/dist/_chunks/tag-CdA0s_VV.js.map +0 -1
- package/dist/_chunks/transaction-chip-BZCa6XDn.js.map +0 -1
|
@@ -23,9 +23,9 @@ const Q = q(
|
|
|
23
23
|
{
|
|
24
24
|
variants: {
|
|
25
25
|
intent: {
|
|
26
|
-
default: "ds:bg-muted/20 ds:text-foreground ds:border-
|
|
27
|
-
suggestion: "ds:bg-[color:var(--primary)]/10 ds:text-foreground ds:border-
|
|
28
|
-
followup: "ds:bg-muted/30 ds:text-foreground ds:border-
|
|
26
|
+
default: "ds:bg-muted/20 ds:text-foreground ds:border-[color:var(--border)] ds:hover:bg-accent/10",
|
|
27
|
+
suggestion: "ds:bg-[color:var(--primary)]/10 ds:text-foreground ds:border-[color:var(--foreground)] ds:hover:bg-[color:var(--primary)]/15",
|
|
28
|
+
followup: "ds:bg-muted/30 ds:text-foreground ds:border-[color:var(--border)] ds:hover:bg-muted/40"
|
|
29
29
|
},
|
|
30
30
|
// Weight, family, tracking, line-height all come from `.type-label` on the base.
|
|
31
31
|
// Size variants override --type-label-size to shift the ramp step.
|
|
@@ -38,34 +38,34 @@ const Q = q(
|
|
|
38
38
|
defaultVariants: { intent: "default", size: "md" }
|
|
39
39
|
}
|
|
40
40
|
), F = B(null), W = V(({ label: k, className: I, children: A, ...C }, g) => {
|
|
41
|
-
const { t: p, i18n:
|
|
41
|
+
const { t: p, i18n: d } = J(), v = d.dir() === "rtl", [o, m] = T([]), [i, a] = T(null), l = j(/* @__PURE__ */ new Map()), x = f((t) => {
|
|
42
42
|
m((r) => r.includes(t) ? r : [...r, t]);
|
|
43
43
|
}, []), z = f((t) => {
|
|
44
44
|
m((r) => r.filter((u) => u !== t)), l.current.delete(t);
|
|
45
|
-
}, []),
|
|
45
|
+
}, []), n = f((t) => a(t), []);
|
|
46
46
|
G(() => {
|
|
47
|
-
!i &&
|
|
48
|
-
}, [i,
|
|
47
|
+
!i && o.length > 0 && a(o[0]), i && !o.includes(i) && a(o[0] ?? null);
|
|
48
|
+
}, [i, o]);
|
|
49
49
|
const e = f(
|
|
50
50
|
(t, r) => {
|
|
51
|
-
const u =
|
|
51
|
+
const u = o.indexOf(t);
|
|
52
52
|
if (u === -1) return;
|
|
53
53
|
let c = u;
|
|
54
|
-
r === "next" && (c = (u + 1) %
|
|
55
|
-
const b =
|
|
56
|
-
|
|
54
|
+
r === "next" && (c = (u + 1) % o.length), r === "prev" && (c = (u - 1 + o.length) % o.length), r === "first" && (c = 0), r === "last" && (c = o.length - 1);
|
|
55
|
+
const b = o[c];
|
|
56
|
+
a(b);
|
|
57
57
|
const w = l.current.get(b);
|
|
58
58
|
w == null || w.focus();
|
|
59
59
|
},
|
|
60
|
-
[
|
|
60
|
+
[o]
|
|
61
61
|
), h = f(
|
|
62
62
|
(t, r) => {
|
|
63
63
|
r ? l.current.set(t, r) : l.current.delete(t);
|
|
64
64
|
},
|
|
65
65
|
[]
|
|
66
66
|
), N = U(
|
|
67
|
-
() => ({ register: x, unregister: z, focusedId: i, setFocus:
|
|
68
|
-
[x, z, i,
|
|
67
|
+
() => ({ register: x, unregister: z, focusedId: i, setFocus: n, onArrowMove: e, isRTL: v }),
|
|
68
|
+
[x, z, i, n, e, v]
|
|
69
69
|
);
|
|
70
70
|
return /* @__PURE__ */ y(E.Provider, { value: h, children: /* @__PURE__ */ y(F.Provider, { value: N, children: /* @__PURE__ */ y(
|
|
71
71
|
"div",
|
|
@@ -92,28 +92,28 @@ const E = B(null), X = V(
|
|
|
92
92
|
startIcon: C,
|
|
93
93
|
children: g,
|
|
94
94
|
onSelect: p,
|
|
95
|
-
onRemove:
|
|
95
|
+
onRemove: d,
|
|
96
96
|
keepOnSelect: v = !1,
|
|
97
|
-
className:
|
|
97
|
+
className: o,
|
|
98
98
|
disabled: m,
|
|
99
99
|
onKeyDown: i,
|
|
100
|
-
onFocus:
|
|
100
|
+
onFocus: a,
|
|
101
101
|
onClick: l,
|
|
102
102
|
...x
|
|
103
103
|
}, z) => {
|
|
104
|
-
const
|
|
105
|
-
r.current = s, h == null || h(
|
|
104
|
+
const n = O(), e = L(F), h = L(E), [N, t] = T(!1), r = j(null), u = (s) => {
|
|
105
|
+
r.current = s, h == null || h(n, s);
|
|
106
106
|
}, c = j(e);
|
|
107
107
|
c.current = e, G(() => {
|
|
108
108
|
const s = c.current;
|
|
109
109
|
if (s)
|
|
110
|
-
return s.register(
|
|
111
|
-
}, [
|
|
112
|
-
const b = e ? e.focusedId ===
|
|
113
|
-
p == null || p(M),
|
|
114
|
-
}, [p, M,
|
|
115
|
-
|
|
116
|
-
}, [
|
|
110
|
+
return s.register(n), () => s.unregister(n);
|
|
111
|
+
}, [n]);
|
|
112
|
+
const b = e ? e.focusedId === n : !0, w = e ? b ? 0 : -1 : 0, M = typeof A == "string" ? A : typeof g == "string" ? g : "", R = f(() => {
|
|
113
|
+
p == null || p(M), d ? d() : v || t(!0);
|
|
114
|
+
}, [p, M, d, v]), D = f(() => {
|
|
115
|
+
d ? d() : t(!0);
|
|
116
|
+
}, [d]);
|
|
117
117
|
return S(
|
|
118
118
|
z,
|
|
119
119
|
() => ({
|
|
@@ -135,14 +135,14 @@ const E = B(null), X = V(
|
|
|
135
135
|
onKeyDown: (s) => {
|
|
136
136
|
if (i == null || i(s), !e) return;
|
|
137
137
|
const H = e.isRTL ? "ArrowLeft" : "ArrowRight", P = e.isRTL ? "ArrowRight" : "ArrowLeft";
|
|
138
|
-
s.key === H || s.key === "ArrowDown" ? (s.preventDefault(), e.onArrowMove(
|
|
138
|
+
s.key === H || s.key === "ArrowDown" ? (s.preventDefault(), e.onArrowMove(n, "next")) : s.key === P || s.key === "ArrowUp" ? (s.preventDefault(), e.onArrowMove(n, "prev")) : s.key === "Home" ? (s.preventDefault(), e.onArrowMove(n, "first")) : s.key === "End" && (s.preventDefault(), e.onArrowMove(n, "last"));
|
|
139
139
|
},
|
|
140
140
|
onFocus: (s) => {
|
|
141
|
-
|
|
141
|
+
a == null || a(s), e && !b && e.setFocus(n);
|
|
142
142
|
},
|
|
143
143
|
"data-component": "suggestion-chip",
|
|
144
144
|
"data-component-id": x.id,
|
|
145
|
-
className: Q({ intent: k, size: I, className:
|
|
145
|
+
className: Q({ intent: k, size: I, className: o }),
|
|
146
146
|
...x,
|
|
147
147
|
children: [
|
|
148
148
|
C ? /* @__PURE__ */ y(
|
|
@@ -164,4 +164,4 @@ export {
|
|
|
164
164
|
X as S,
|
|
165
165
|
W as a
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=suggestion-chip-
|
|
167
|
+
//# sourceMappingURL=suggestion-chip-Bk4PmYTg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestion-chip-Bk4PmYTg.js","sources":["../../src/components/suggestion-chip/suggestion-chip.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst chipVariants = cva(\n [\n // `max-w-full` keeps a chip from blowing past its container when the\n // label is long and the container is narrow (e.g. a 22rem Alia sidebar\n // dock). Labels wrap onto multiple lines via `whitespace-normal` +\n // `break-words` so the full text stays legible — rounded pills grow\n // taller rather than hiding content behind an ellipsis.\n 'ds:inline-flex ds:items-center ds:justify-start ds:text-start ds:whitespace-normal ds:break-words ds:max-w-full',\n 'ds:rounded-[var(--radius-full)] ds:border',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]',\n 'type-label',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n 'ds:forced-colors:border-[ButtonText] ds:forced-colors:text-[ButtonText]',\n ].join(' '),\n {\n variants: {\n intent: {\n default:\n 'ds:bg-muted/20 ds:text-foreground ds:border-[color:var(--border)] ds:hover:bg-accent/10',\n suggestion:\n 'ds:bg-[color:var(--primary)]/10 ds:text-foreground ds:border-[color:var(--foreground)] ds:hover:bg-[color:var(--primary)]/15',\n followup:\n 'ds:bg-muted/30 ds:text-foreground ds:border-[color:var(--border)] ds:hover:bg-muted/40',\n },\n // Weight, family, tracking, line-height all come from `.type-label` on the base.\n // Size variants override --type-label-size to shift the ramp step.\n size: {\n sm: 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:[--type-label-size:var(--font-size-xs)]',\n md: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n lg: 'ds:ps-[var(--spacing-lg)] ds:pe-[var(--spacing-lg)] ds:[--type-label-size:var(--font-size-base)]',\n },\n },\n defaultVariants: { intent: 'default', size: 'md' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Group context — roving tabIndex */\n/* ------------------------------------------------------------------ */\n\ninterface ChipGroupCtxValue {\n register: (id: string) => void;\n unregister: (id: string) => void;\n focusedId: string | null;\n setFocus: (id: string) => void;\n onArrowMove: (\n id: string,\n direction: 'prev' | 'next' | 'first' | 'last',\n ) => void;\n isRTL: boolean;\n}\n\nconst ChipGroupCtx = createContext<ChipGroupCtxValue | null>(null);\n\n/* ------------------------------------------------------------------ */\n/* SuggestionChipGroup */\n/* ------------------------------------------------------------------ */\n\nexport interface SuggestionChipGroupProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'role' | 'aria-label'\n> {\n /** Override the default group label (ui.chat.suggestions). */\n label?: string;\n}\n\nexport const SuggestionChipGroup = forwardRef<\n HTMLDivElement,\n SuggestionChipGroupProps\n>(({ label, className, children, ...rest }, ref) => {\n const { t, i18n } = useTranslation();\n const isRTL = i18n.dir() === 'rtl';\n const [order, setOrder] = useState<string[]>([]);\n const [focusedId, setFocusedId] = useState<string | null>(null);\n const nodeMap = useRef<Map<string, HTMLButtonElement>>(new Map());\n\n const register = useCallback((id: string) => {\n setOrder((prev) => (prev.includes(id) ? prev : [...prev, id]));\n }, []);\n const unregister = useCallback((id: string) => {\n setOrder((prev) => prev.filter((x) => x !== id));\n nodeMap.current.delete(id);\n }, []);\n\n const setFocus = useCallback((id: string) => setFocusedId(id), []);\n\n useEffect(() => {\n // Ensure focusedId stays valid — default to first registered.\n if (!focusedId && order.length > 0) setFocusedId(order[0]);\n if (focusedId && !order.includes(focusedId)) {\n setFocusedId(order[0] ?? null);\n }\n }, [focusedId, order]);\n\n const onArrowMove: ChipGroupCtxValue['onArrowMove'] = useCallback(\n (id, direction) => {\n const idx = order.indexOf(id);\n if (idx === -1) return;\n let next = idx;\n if (direction === 'next') next = (idx + 1) % order.length;\n if (direction === 'prev') next = (idx - 1 + order.length) % order.length;\n if (direction === 'first') next = 0;\n if (direction === 'last') next = order.length - 1;\n const nextId = order[next];\n setFocusedId(nextId);\n const el = nodeMap.current.get(nextId);\n el?.focus();\n },\n [order],\n );\n\n // Wrapped in useCallback so the context value reference is stable across\n // renders — otherwise every chip re-runs its ref-registering effect on\n // every focus change.\n const registerNode = useCallback(\n (id: string, el: HTMLButtonElement | null) => {\n if (el) nodeMap.current.set(id, el);\n else nodeMap.current.delete(id);\n },\n [],\n );\n\n // Memoise the context value so child chips don't see a new `group`\n // reference on every render — otherwise their register/unregister\n // effect re-runs each render, driving setOrder in the parent and\n // producing an infinite render loop.\n const ctxValue = useMemo(\n () => ({ register, unregister, focusedId, setFocus, onArrowMove, isRTL }),\n [register, unregister, focusedId, setFocus, onArrowMove, isRTL],\n );\n\n return (\n <ChipGroupCtxNodeContext.Provider value={registerNode}>\n <ChipGroupCtx.Provider value={ctxValue}>\n <div\n ref={ref}\n role=\"group\"\n aria-label={label ?? t('chat.suggestions')}\n className={[\n 'ds:flex ds:flex-wrap ds:items-center',\n 'ds:gap-y-[var(--spacing-xs)] ds:gap-x-[var(--spacing-sm)]',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </div>\n </ChipGroupCtx.Provider>\n </ChipGroupCtxNodeContext.Provider>\n );\n});\n\nSuggestionChipGroup.displayName = 'SuggestionChipGroup';\n\n// Separate context to register the DOM node from the chip without tripping\n// eslint `react-hooks/exhaustive-deps`.\nconst ChipGroupCtxNodeContext = createContext<\n ((id: string, el: HTMLButtonElement | null) => void) | null\n>(null);\n\n/* ------------------------------------------------------------------ */\n/* SuggestionChip */\n/* ------------------------------------------------------------------ */\n\ntype NativeButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onSelect' | 'children'\n>;\n\n/** Curated imperative handle for agent / external automation. */\nexport interface SuggestionChipHandle {\n getValue: () => string;\n select: () => void;\n dismiss: () => void;\n}\n\nexport interface SuggestionChipProps\n extends NativeButtonProps, VariantProps<typeof chipVariants> {\n /** Value emitted on activation. Falls back to children when a string. */\n value?: string;\n startIcon?: ReactNode;\n children: ReactNode;\n /** Activation handler. */\n onSelect?: (value: string) => void;\n /** When provided, parent owns removal. Otherwise the chip manages its own\n * `removed` state and unmounts after selection. */\n onRemove?: () => void;\n /** Opt out of self-removal — useful inside controlled lists. */\n keepOnSelect?: boolean;\n}\n\nexport const SuggestionChip = forwardRef<\n SuggestionChipHandle,\n SuggestionChipProps\n>(\n (\n {\n intent = 'default',\n size = 'md',\n value,\n startIcon,\n children,\n onSelect,\n onRemove,\n keepOnSelect = false,\n className,\n disabled,\n onKeyDown,\n onFocus,\n onClick,\n ...rest\n },\n ref,\n ) => {\n const id = useId();\n const group = useContext(ChipGroupCtx);\n const registerNode = useContext(ChipGroupCtxNodeContext);\n const [removed, setRemoved] = useState(false);\n const localRef = useRef<HTMLButtonElement | null>(null);\n\n const setRef = (node: HTMLButtonElement | null) => {\n localRef.current = node;\n registerNode?.(id, node);\n };\n\n // Keep register/unregister in a ref so the effect runs only on\n // mount / unmount. Depending on `group` directly would re-fire the\n // effect on every parent render (focusedId changes invalidate the\n // group context value), which in turn mutates the parent's `order`\n // state and loops.\n const groupRef = useRef(group);\n groupRef.current = group;\n\n useEffect(() => {\n const g = groupRef.current;\n if (!g) return;\n g.register(id);\n return () => g.unregister(id);\n }, [id]);\n\n const isFocused = group ? group.focusedId === id : true;\n const tabIndex = group ? (isFocused ? 0 : -1) : 0;\n\n const resolvedValue =\n typeof value === 'string'\n ? value\n : typeof children === 'string'\n ? children\n : '';\n\n const performSelect = useCallback(() => {\n onSelect?.(resolvedValue);\n if (onRemove) onRemove();\n else if (!keepOnSelect) setRemoved(true);\n }, [onSelect, resolvedValue, onRemove, keepOnSelect]);\n\n const performDismiss = useCallback(() => {\n if (onRemove) onRemove();\n else setRemoved(true);\n }, [onRemove]);\n\n useImperativeHandle(\n ref,\n () => ({\n getValue: () => resolvedValue,\n select: performSelect,\n dismiss: performDismiss,\n }),\n [resolvedValue, performSelect, performDismiss],\n );\n\n if (removed) return null;\n\n const handleClick: NonNullable<NativeButtonProps['onClick']> = (e) => {\n onClick?.(e);\n performSelect();\n };\n\n const handleKeyDown: NonNullable<NativeButtonProps['onKeyDown']> = (e) => {\n onKeyDown?.(e);\n if (!group) return;\n // Arrow navigation inside a group — RTL inverts Left/Right.\n const nextKey = group.isRTL ? 'ArrowLeft' : 'ArrowRight';\n const prevKey = group.isRTL ? 'ArrowRight' : 'ArrowLeft';\n if (e.key === nextKey || e.key === 'ArrowDown') {\n e.preventDefault();\n group.onArrowMove(id, 'next');\n } else if (e.key === prevKey || e.key === 'ArrowUp') {\n e.preventDefault();\n group.onArrowMove(id, 'prev');\n } else if (e.key === 'Home') {\n e.preventDefault();\n group.onArrowMove(id, 'first');\n } else if (e.key === 'End') {\n e.preventDefault();\n group.onArrowMove(id, 'last');\n }\n };\n\n const handleFocus: NonNullable<NativeButtonProps['onFocus']> = (e) => {\n onFocus?.(e);\n if (group && !isFocused) group.setFocus(id);\n };\n\n return (\n <button\n ref={setRef}\n type=\"button\"\n tabIndex={tabIndex}\n disabled={disabled}\n onClick={disabled ? undefined : handleClick}\n onKeyDown={\n handleKeyDown as unknown as (\n e: KeyboardEvent<HTMLButtonElement>,\n ) => void\n }\n onFocus={handleFocus}\n data-component=\"suggestion-chip\"\n data-component-id={rest.id}\n className={chipVariants({ intent, size, className })}\n {...rest}\n >\n {startIcon ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:me-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:[&>svg]:size-4\"\n >\n {startIcon}\n </span>\n ) : null}\n <span>{children}</span>\n </button>\n );\n },\n);\n\nSuggestionChip.displayName = 'SuggestionChip';\n"],"names":["chipVariants","cva","ChipGroupCtx","createContext","SuggestionChipGroup","forwardRef","label","className","children","rest","ref","t","i18n","useTranslation","isRTL","order","setOrder","useState","focusedId","setFocusedId","nodeMap","useRef","register","useCallback","id","prev","unregister","x","setFocus","useEffect","onArrowMove","direction","idx","next","nextId","el","registerNode","ctxValue","useMemo","jsx","ChipGroupCtxNodeContext","SuggestionChip","intent","size","value","startIcon","onSelect","onRemove","keepOnSelect","disabled","onKeyDown","onFocus","onClick","useId","group","useContext","removed","setRemoved","localRef","setRef","node","groupRef","g","isFocused","tabIndex","resolvedValue","performSelect","performDismiss","useImperativeHandle","jsxs","e","nextKey","prevKey"],"mappings":";;;;AAuBA,MAAMA,IAAeC;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAME;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,QAAQ;AAAA,QACN,SACE;AAAA,QACF,YACE;AAAA,QACF,UACE;AAAA,MAAA;AAAA;AAAA;AAAA,MAIJ,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB,EAAE,QAAQ,WAAW,MAAM,KAAA;AAAA,EAAK;AAErD,GAkBMC,IAAeC,EAAwC,IA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BAAAN,EAAC,UAAM,UAAA/B,EAAA,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGtB;AACF;AAEAiC,EAAe,cAAc;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a, jsxs as u, Fragment as b } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as h, Fragment as x } from "react";
|
|
3
3
|
import { c as o } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { B as C } from "./badge-
|
|
4
|
+
import { B as C } from "./badge-CqGsX32l.js";
|
|
5
5
|
function w(r) {
|
|
6
6
|
return r > 99 ? "99+" : String(r);
|
|
7
7
|
}
|
|
@@ -102,4 +102,4 @@ j.displayName = "TabBar";
|
|
|
102
102
|
export {
|
|
103
103
|
j as T
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=tab-bar-
|
|
105
|
+
//# sourceMappingURL=tab-bar-B1ovILzh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-bar-Xetknddo.js","sources":["../../src/components/tab-bar/tab-bar.tsx"],"sourcesContent":["/**\n * TabBar — a floating-pill bar of page-level navigation tabs.\n *\n * Each tab is an icon + label (+ optional count badge); the active tab is\n * marked with `aria-current=\"page\"` and an `--accent` underline. The bar is a\n * glassy `--card` pill that floats on whatever canvas the consumer provides\n * (the strip area itself is transparent, so it blends with the surrounding\n * surface).\n *\n * Two layouts:\n * - default (`fill` off): content-width tabs that **centre** when they fit and\n * scroll from the inline-start (`safe center`) when they overflow, with a\n * gutter preserved at both ends. The label stacks under the icon below `sm`.\n * Use this when the tab set is open-ended (e.g. a marketplace app's routes).\n * - `fill`: equal-width tabs that fill the bar and always stack the label under\n * the icon — a fixed, always-visible set that fits any column width without\n * scrolling (e.g. a patient portal's four sections).\n *\n * Tabs render as links when given an `href` (real navigation) or as buttons\n * otherwise (in-app view switching via `onSelect`). Use it as a header (top,\n * default) for section navigation; `position=\"bottom\"` floats it from the\n * bottom edge for a footer.\n *\n * SPA / consumer-router links: pass `renderLink` and TabBar hands each `href`\n * tab off to your router's `<Link>` instead of rendering its own `<a>` — the\n * embedded MarketplaceAppShell strip uses this so a tab click is a client-side\n * route change, not a full page navigation. The kit forwards the same\n * `className` + `aria-current` so the accent-underline active styling and the\n * `aria-current=\"page\"` marker survive in both modes. With `renderLink`\n * omitted the output is the plain `<a href>` exactly as before.\n */\nimport { forwardRef, Fragment, type MouseEvent, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\n\nimport { Badge } from '../badge';\n\nexport interface TabBarItem {\n /** Stable id; also the value handed to `onSelect` for button tabs. */\n id: string;\n /** Pre-translated label — consumers localise their own nav copy. */\n label: string;\n /** Optional leading icon (a lucide-react element or equivalent), tinted with `--accent`. */\n icon?: ReactNode;\n /** Optional unseen-item count rendered as a pill badge. */\n badgeCount?: number;\n /** Mark the tab as the current page (`aria-current='page'` + accent underline). */\n isActive?: boolean;\n /** When set, the tab renders as a link to this href; otherwise it's a button. */\n href?: string;\n /**\n * Optional click handler threaded onto the link tab's `<a>` (or, when\n * `renderLink` is supplied, available to the consumer's router element). Use\n * it to intercept a same-origin click and route client-side without a full\n * navigation. Only applies to `href` (link) tabs — button tabs use `onSelect`.\n */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\n/**\n * Props the kit hands to `renderLink` for each `href` tab. The consumer returns\n * their router's `<Link to={href}>` carrying the same `className` (the active\n * accent-underline styling) and `aria-current` (`'page'` on the active tab).\n */\nexport interface TabBarRenderLinkProps {\n /** The tab's destination — feed it to your router's `to` / `href`. */\n href: string;\n /** The kit's tab classes (CVA output) — apply verbatim to the link element. */\n className: string;\n /** Icon + label + badge — render as the link's children. */\n children: ReactNode;\n /** `'page'` on the active tab, otherwise omitted — forward to the link. */\n 'aria-current'?: 'page';\n /** Optional per-item click handler (the item's `onClick`), if supplied. */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport interface TabBarProps {\n /** The tabs, in order. */\n items: TabBarItem[];\n /** Accessible name for the `<nav>` landmark. */\n ariaLabel: string;\n /** Fires with the tab `id` when a button tab (one without `href`) is chosen. */\n onSelect?: (id: string) => void;\n /**\n * Render an `href` tab via the consumer's router instead of the kit's own\n * `<a>`. TabBar calls it for each link tab and renders the returned node; the\n * consumer returns their `<Link to={href}>` carrying the supplied `className`\n * + `aria-current` so the active accent underline and the `aria-current=\"page\"`\n * marker are preserved. Use it for SPA navigation (e.g. the MarketplaceAppShell\n * strip) so a tab click is a client-side route change, not a full page load.\n * Omit it to render the plain `<a href>` exactly as before. Button tabs (no\n * `href`) ignore `renderLink` and continue to use `onSelect`.\n */\n renderLink?: (props: TabBarRenderLinkProps) => ReactNode;\n /**\n * Equal-width tabs that fill the bar and always stack the label under the\n * icon (for a fixed, always-visible set). Off (default) = content-width tabs\n * that centre when they fit and scroll when they overflow.\n */\n fill?: boolean;\n /**\n * Float side. `'top'` (default) gutters from the top edge for a header;\n * `'bottom'` gutters from the bottom edge for a footer.\n */\n position?: 'top' | 'bottom';\n /** Extra classes merged onto the outer strip (e.g. sticky/fixed positioning). */\n className?: string;\n}\n\nfunction formatBadgeCount(count: number): string {\n return count > 99 ? '99+' : String(count);\n}\n\n/* Transparent strip area — provides the floating gutter on the active side. The\n default layout also insets the pill horizontally so it reads as a floating\n strip; `fill` drops that inset so the pill spans the full width and aligns\n with the consumer's content (e.g. a portal's cards). */\nconst stripVariants = cva('ds:shrink-0', {\n variants: {\n position: {\n top: 'ds:pt-[var(--spacing-md)]',\n bottom: 'ds:pb-[var(--spacing-md)]',\n },\n fill: {\n false: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n true: '',\n },\n },\n defaultVariants: { position: 'top', fill: false },\n});\n\n/* The pill is the flex scroll container. `safe center` centres the tabs when\n they fit but falls back to start-alignment the moment they overflow, so the\n row stays fully scrollable end to end with nothing clipped. */\nconst pillClasses =\n 'ds:flex ds:[justify-content:safe_center] ds:overflow-x-auto ds:rounded-[var(--radius-lg)] ds:border ds:border-[color:var(--card-border)] ds:bg-[var(--card)]/80 ds:backdrop-blur-md ds:shadow-[var(--shadow-md)] ds:py-[var(--spacing-xs)]';\n\n/* The nav's inline padding is the start/end gutter — it scrolls WITH the tabs,\n so the gutter survives a full scroll. Content width (`shrink-0`) by default so\n it overflows and scrolls; `w-full` in fill mode so the tabs spread to fit. */\nconst navVariants = cva(\n 'ds:flex ds:items-stretch ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n {\n variants: {\n fill: { false: 'ds:shrink-0', true: 'ds:w-full' },\n },\n defaultVariants: { fill: false },\n },\n);\n\n/* Each tab is a centred flex box so the icon + label sit centred on both axes.\n Regular weight; the active state is carried by the accent underline + accent\n icon, not a heavier weight. */\nconst tabVariants = cva(\n 'ds:group ds:flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)] ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:whitespace-nowrap ds:cursor-pointer ds:appearance-none ds:border-0 ds:bg-transparent ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-regular)] ds:text-[color:var(--foreground)] ds:no-underline ds:hover:bg-[var(--muted)]/20 ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]',\n {\n variants: {\n fill: {\n // Responsive: label under the icon below `sm`, beside it at `sm`+.\n false: 'ds:flex-col ds:sm:flex-row ds:sm:gap-[var(--spacing-sm)]',\n // Fill the bar, always icon-over-label. No `min-w-0`, so a tab never\n // shrinks below its label (labels never overlap); if the full set can't\n // fit, the pill scrolls instead.\n true: 'ds:flex-1 ds:basis-0 ds:flex-col',\n },\n },\n defaultVariants: { fill: false },\n },\n);\n\nconst iconClasses =\n 'ds:inline-flex ds:items-center ds:text-[color:var(--accent)] ds:[&>svg]:size-4';\n\n/* The accent underline rides the label text itself (not the whole tab), so it\n never reaches the icon or badge and never has to propagate through flex. */\nconst labelClasses =\n 'ds:group-aria-[current=page]:underline ds:group-aria-[current=page]:decoration-2 ds:group-aria-[current=page]:decoration-[color:var(--accent)] ds:group-aria-[current=page]:underline-offset-[var(--spacing-xs)]';\n\nexport const TabBar = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n items,\n ariaLabel,\n onSelect,\n renderLink,\n fill = false,\n position = 'top',\n className,\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n data-component=\"tab-bar\"\n className={`${stripVariants({ position, fill })}${className ? ` ${className}` : ''}`}\n >\n <div className={pillClasses}>\n <nav aria-label={ariaLabel} className={navVariants({ fill })}>\n {items.map((item) => {\n const badge =\n typeof item.badgeCount === 'number' && item.badgeCount > 0\n ? item.badgeCount\n : undefined;\n const ariaCurrent = item.isActive ? 'page' : undefined;\n const inner = (\n <>\n {item.icon ? (\n <span aria-hidden=\"true\" className={iconClasses}>\n {item.icon}\n </span>\n ) : null}\n {/* Label + badge stay paired; they sit under the icon when the\n tab stacks to a column. */}\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span className={labelClasses}>{item.label}</span>\n {badge !== undefined ? (\n <Badge variant=\"neutral\">{formatBadgeCount(badge)}</Badge>\n ) : null}\n </span>\n </>\n );\n if (item.href !== undefined) {\n const tabClassName = tabVariants({ fill });\n // Consumer-router mode: hand the tab to the consumer's <Link>,\n // forwarding the same className + aria-current (+ the item's\n // onClick) so the active styling and `aria-current=\"page\"`\n // marker carry over and clicking routes client-side.\n if (renderLink) {\n return (\n <Fragment key={item.id}>\n {renderLink({\n href: item.href,\n className: tabClassName,\n children: inner,\n 'aria-current': ariaCurrent,\n onClick: item.onClick,\n })}\n </Fragment>\n );\n }\n // Default: plain anchor — byte-identical to before when no\n // per-item onClick is supplied (onClick is omitted entirely,\n // not passed as undefined, so the rendered <a> is unchanged).\n return (\n <a\n key={item.id}\n href={item.href}\n aria-current={ariaCurrent}\n className={tabClassName}\n {...(item.onClick ? { onClick: item.onClick } : {})}\n >\n {inner}\n </a>\n );\n }\n return (\n <button\n key={item.id}\n type=\"button\"\n aria-current={ariaCurrent}\n className={tabVariants({ fill })}\n onClick={() => onSelect?.(item.id)}\n >\n {inner}\n </button>\n );\n })}\n </nav>\n </div>\n </div>\n );\n },\n);\nTabBar.displayName = 'TabBar';\n"],"names":["formatBadgeCount","count","stripVariants","cva","pillClasses","navVariants","tabVariants","iconClasses","labelClasses","TabBar","forwardRef","items","ariaLabel","onSelect","renderLink","fill","position","className","ref","jsx","item","badge","ariaCurrent","inner","jsxs","Fragment","Badge","tabClassName"],"mappings":";;;;AA6GA,SAASA,EAAiBC,GAAuB;AAC/C,SAAOA,IAAQ,KAAK,QAAQ,OAAOA,CAAK;AAC1C;AAMA,MAAMC,IAAgBC,EAAI,eAAe;AAAA,EACvC,UAAU;AAAA,IACR,UAAU;AAAA,MACR,KAAK;AAAA,MACL,QAAQ;AAAA,IAAA;AAAA,IAEV,MAAM;AAAA,MACJ,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,EACR;AAAA,EAEF,iBAAiB,EAAE,UAAU,OAAO,MAAM,GAAA;AAC5C,CAAC,GAKKC,IACJ,8OAKIC,IAAcF;AAAA,EAClB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM,EAAE,OAAO,eAAe,MAAM,YAAA;AAAA,IAAY;AAAA,IAElD,iBAAiB,EAAE,MAAM,GAAA;AAAA,EAAM;AAEnC,GAKMG,IAAcH;AAAA,EAClB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA;AAAA,QAEJ,OAAO;AAAA;AAAA;AAAA;AAAA,QAIP,MAAM;AAAA,MAAA;AAAA,IACR;AAAA,I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A,gBAAAK,EAACM,GAAA,EACE,UAAAX,EAAW;AAAA,YACV,MAAMM,EAAK;AAAA,YACX,WAAWO;AAAA,YACX,UAAUJ;AAAA,YACV,gBAAgBD;AAAA,YAChB,SAASF,EAAK;AAAA,UAAA,CACf,EAAA,GAPYA,EAAK,EAQpB,IAOF,gBAAAD;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,MAAMC,EAAK;AAAA,cACX,gBAAcE;AAAA,cACd,WAAWK;AAAA,cACV,GAAIP,EAAK,UAAU,EAAE,SAASA,EAAK,QAAA,IAAY,CAAA;AAAA,cAE/C,UAAAG;AAAA,YAAA;AAAA,YANIH,EAAK;AAAA,UAAA;AAAA,QAShB;AACA,eACE,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,MAAK;AAAA,YACL,gBAAcG;AAAA,YACd,WAAWhB,EAAY,EAAE,MAAAS,GAAM;AAAA,YAC/B,SAAS,MAAMF,KAAA,gBAAAA,EAAWO,EAAK;AAAA,YAE9B,UAAAG;AAAA,UAAA;AAAA,UANIH,EAAK;AAAA,QAAA;AAAA,MAShB,CAAC,GACH,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;AACAX,EAAO,cAAc;"}
|
|
1
|
+
{"version":3,"file":"tab-bar-B1ovILzh.js","sources":["../../src/components/tab-bar/tab-bar.tsx"],"sourcesContent":["/**\n * TabBar — a floating-pill bar of page-level navigation tabs.\n *\n * Each tab is an icon + label (+ optional count badge); the active tab is\n * marked with `aria-current=\"page\"` and an `--accent` underline. The bar is a\n * glassy `--card` pill that floats on whatever canvas the consumer provides\n * (the strip area itself is transparent, so it blends with the surrounding\n * surface).\n *\n * Two layouts:\n * - default (`fill` off): content-width tabs that **centre** when they fit and\n * scroll from the inline-start (`safe center`) when they overflow, with a\n * gutter preserved at both ends. The label stacks under the icon below `sm`.\n * Use this when the tab set is open-ended (e.g. a marketplace app's routes).\n * - `fill`: equal-width tabs that fill the bar and always stack the label under\n * the icon — a fixed, always-visible set that fits any column width without\n * scrolling (e.g. a patient portal's four sections).\n *\n * Tabs render as links when given an `href` (real navigation) or as buttons\n * otherwise (in-app view switching via `onSelect`). Use it as a header (top,\n * default) for section navigation; `position=\"bottom\"` floats it from the\n * bottom edge for a footer.\n *\n * SPA / consumer-router links: pass `renderLink` and TabBar hands each `href`\n * tab off to your router's `<Link>` instead of rendering its own `<a>` — the\n * embedded MarketplaceAppShell strip uses this so a tab click is a client-side\n * route change, not a full page navigation. The kit forwards the same\n * `className` + `aria-current` so the accent-underline active styling and the\n * `aria-current=\"page\"` marker survive in both modes. With `renderLink`\n * omitted the output is the plain `<a href>` exactly as before.\n */\nimport { forwardRef, Fragment, type MouseEvent, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\n\nimport { Badge } from '../badge';\n\nexport interface TabBarItem {\n /** Stable id; also the value handed to `onSelect` for button tabs. */\n id: string;\n /** Pre-translated label — consumers localise their own nav copy. */\n label: string;\n /** Optional leading icon (a lucide-react element or equivalent), tinted with `--accent`. */\n icon?: ReactNode;\n /** Optional unseen-item count rendered as a pill badge. */\n badgeCount?: number;\n /** Mark the tab as the current page (`aria-current='page'` + accent underline). */\n isActive?: boolean;\n /** When set, the tab renders as a link to this href; otherwise it's a button. */\n href?: string;\n /**\n * Optional click handler threaded onto the link tab's `<a>` (or, when\n * `renderLink` is supplied, available to the consumer's router element). Use\n * it to intercept a same-origin click and route client-side without a full\n * navigation. Only applies to `href` (link) tabs — button tabs use `onSelect`.\n */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\n/**\n * Props the kit hands to `renderLink` for each `href` tab. The consumer returns\n * their router's `<Link to={href}>` carrying the same `className` (the active\n * accent-underline styling) and `aria-current` (`'page'` on the active tab).\n */\nexport interface TabBarRenderLinkProps {\n /** The tab's destination — feed it to your router's `to` / `href`. */\n href: string;\n /** The kit's tab classes (CVA output) — apply verbatim to the link element. */\n className: string;\n /** Icon + label + badge — render as the link's children. */\n children: ReactNode;\n /** `'page'` on the active tab, otherwise omitted — forward to the link. */\n 'aria-current'?: 'page';\n /** Optional per-item click handler (the item's `onClick`), if supplied. */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport interface TabBarProps {\n /** The tabs, in order. */\n items: TabBarItem[];\n /** Accessible name for the `<nav>` landmark. */\n ariaLabel: string;\n /** Fires with the tab `id` when a button tab (one without `href`) is chosen. */\n onSelect?: (id: string) => void;\n /**\n * Render an `href` tab via the consumer's router instead of the kit's own\n * `<a>`. TabBar calls it for each link tab and renders the returned node; the\n * consumer returns their `<Link to={href}>` carrying the supplied `className`\n * + `aria-current` so the active accent underline and the `aria-current=\"page\"`\n * marker are preserved. Use it for SPA navigation (e.g. the MarketplaceAppShell\n * strip) so a tab click is a client-side route change, not a full page load.\n * Omit it to render the plain `<a href>` exactly as before. Button tabs (no\n * `href`) ignore `renderLink` and continue to use `onSelect`.\n */\n renderLink?: (props: TabBarRenderLinkProps) => ReactNode;\n /**\n * Equal-width tabs that fill the bar and always stack the label under the\n * icon (for a fixed, always-visible set). Off (default) = content-width tabs\n * that centre when they fit and scroll when they overflow.\n */\n fill?: boolean;\n /**\n * Float side. `'top'` (default) gutters from the top edge for a header;\n * `'bottom'` gutters from the bottom edge for a footer.\n */\n position?: 'top' | 'bottom';\n /** Extra classes merged onto the outer strip (e.g. sticky/fixed positioning). */\n className?: string;\n}\n\nfunction formatBadgeCount(count: number): string {\n return count > 99 ? '99+' : String(count);\n}\n\n/* Transparent strip area — provides the floating gutter on the active side. The\n default layout also insets the pill horizontally so it reads as a floating\n strip; `fill` drops that inset so the pill spans the full width and aligns\n with the consumer's content (e.g. a portal's cards). */\nconst stripVariants = cva('ds:shrink-0', {\n variants: {\n position: {\n top: 'ds:pt-[var(--spacing-md)]',\n bottom: 'ds:pb-[var(--spacing-md)]',\n },\n fill: {\n false: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n true: '',\n },\n },\n defaultVariants: { position: 'top', fill: false },\n});\n\n/* The pill is the flex scroll container. `safe center` centres the tabs when\n they fit but falls back to start-alignment the moment they overflow, so the\n row stays fully scrollable end to end with nothing clipped. */\nconst pillClasses =\n 'ds:flex ds:[justify-content:safe_center] ds:overflow-x-auto ds:rounded-[var(--radius-lg)] ds:border ds:border-[color:var(--card-border)] ds:bg-[var(--card)]/80 ds:backdrop-blur-md ds:shadow-[var(--shadow-md)] ds:py-[var(--spacing-xs)]';\n\n/* The nav's inline padding is the start/end gutter — it scrolls WITH the tabs,\n so the gutter survives a full scroll. Content width (`shrink-0`) by default so\n it overflows and scrolls; `w-full` in fill mode so the tabs spread to fit. */\nconst navVariants = cva(\n 'ds:flex ds:items-stretch ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n {\n variants: {\n fill: { false: 'ds:shrink-0', true: 'ds:w-full' },\n },\n defaultVariants: { fill: false },\n },\n);\n\n/* Each tab is a centred flex box so the icon + label sit centred on both axes.\n Regular weight; the active state is carried by the accent underline + accent\n icon, not a heavier weight. */\nconst tabVariants = cva(\n 'ds:group ds:flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)] ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:whitespace-nowrap ds:cursor-pointer ds:appearance-none ds:border-0 ds:bg-transparent ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-regular)] ds:text-[color:var(--foreground)] ds:no-underline ds:hover:bg-[var(--muted)]/20 ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]',\n {\n variants: {\n fill: {\n // Responsive: label under the icon below `sm`, beside it at `sm`+.\n false: 'ds:flex-col ds:sm:flex-row ds:sm:gap-[var(--spacing-sm)]',\n // Fill the bar, always icon-over-label. No `min-w-0`, so a tab never\n // shrinks below its label (labels never overlap); if the full set can't\n // fit, the pill scrolls instead.\n true: 'ds:flex-1 ds:basis-0 ds:flex-col',\n },\n },\n defaultVariants: { fill: false },\n },\n);\n\nconst iconClasses =\n 'ds:inline-flex ds:items-center ds:text-[color:var(--accent)] ds:[&>svg]:size-4';\n\n/* The accent underline rides the label text itself (not the whole tab), so it\n never reaches the icon or badge and never has to propagate through flex. */\nconst labelClasses =\n 'ds:group-aria-[current=page]:underline ds:group-aria-[current=page]:decoration-2 ds:group-aria-[current=page]:decoration-[color:var(--accent)] ds:group-aria-[current=page]:underline-offset-[var(--spacing-xs)]';\n\nexport const TabBar = forwardRef<HTMLDivElement, TabBarProps>(\n (\n {\n items,\n ariaLabel,\n onSelect,\n renderLink,\n fill = false,\n position = 'top',\n className,\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n data-component=\"tab-bar\"\n className={`${stripVariants({ position, fill })}${className ? ` ${className}` : ''}`}\n >\n <div className={pillClasses}>\n <nav aria-label={ariaLabel} className={navVariants({ fill })}>\n {items.map((item) => {\n const badge =\n typeof item.badgeCount === 'number' && item.badgeCount > 0\n ? item.badgeCount\n : undefined;\n const ariaCurrent = item.isActive ? 'page' : undefined;\n const inner = (\n <>\n {item.icon ? (\n <span aria-hidden=\"true\" className={iconClasses}>\n {item.icon}\n </span>\n ) : null}\n {/* Label + badge stay paired; they sit under the icon when the\n tab stacks to a column. */}\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span className={labelClasses}>{item.label}</span>\n {badge !== undefined ? (\n <Badge variant=\"neutral\">{formatBadgeCount(badge)}</Badge>\n ) : null}\n </span>\n </>\n );\n if (item.href !== undefined) {\n const tabClassName = tabVariants({ fill });\n // Consumer-router mode: hand the tab to the consumer's <Link>,\n // forwarding the same className + aria-current (+ the item's\n // onClick) so the active styling and `aria-current=\"page\"`\n // marker carry over and clicking routes client-side.\n if (renderLink) {\n return (\n <Fragment key={item.id}>\n {renderLink({\n href: item.href,\n className: tabClassName,\n children: inner,\n 'aria-current': ariaCurrent,\n onClick: item.onClick,\n })}\n </Fragment>\n );\n }\n // Default: plain anchor — byte-identical to before when no\n // per-item onClick is supplied (onClick is omitted entirely,\n // not passed as undefined, so the rendered <a> is unchanged).\n return (\n <a\n key={item.id}\n href={item.href}\n aria-current={ariaCurrent}\n className={tabClassName}\n {...(item.onClick ? { onClick: item.onClick } : {})}\n >\n {inner}\n </a>\n );\n }\n return (\n <button\n key={item.id}\n type=\"button\"\n aria-current={ariaCurrent}\n className={tabVariants({ fill })}\n onClick={() => onSelect?.(item.id)}\n >\n {inner}\n </button>\n );\n })}\n </nav>\n </div>\n </div>\n );\n },\n);\nTabBar.displayName = 'TabBar';\n"],"names":["formatBadgeCount","count","stripVariants","cva","pillClasses","navVariants","tabVariants","iconClasses","labelClasses","TabBar","forwardRef","items","ariaLabel","onSelect","renderLink","fill","position","className","ref","jsx","item","badge","ariaCurrent","inner","jsxs","Fragment","Badge","tabClassName"],"mappings":";;;;AA6GA,SAASA,EAAiBC,GAAuB;AAC/C,SAAOA,IAAQ,KAAK,QAAQ,OAAOA,CAAK;AAC1C;AAMA,MAAMC,IAAgBC,EAAI,eAAe;AAAA,EACvC,UAAU;AAAA,IACR,UAAU;AAAA,MACR,KAAK;AAAA,MACL,QAAQ;AAAA,IAAA;AAAA,IAEV,MAAM;AAAA,MACJ,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,EACR;AAAA,EAEF,iBAAiB,EAAE,UAAU,OAAO,MAAM,GAAA;AAC5C,CAAC,GAKKC,IACJ,8OAKIC,IAAcF;AAAA,EAClB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM,EAAE,OAAO,eAAe,MAAM,YAAA;AAAA,IAAY;AAAA,IAElD,iBAAiB,EAAE,MAAM,GAAA;AAAA,EAAM;AAEnC,GAKMG,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,EAAA,CAAE,IAChD;AAAA,UAAA,EAAA,CACN;AAAA,QAAA,GACF;AAEF,YAAID,EAAK,SAAS,QAAW;AAC3B,gBAAMO,IAAerB,EAAY,EAAE,MAAAS,GAAM;AAKzC,iBAAID,IAEA,gBAAAK,EAACM,GAAA,EACE,UAAAX,EAAW;AAAA,YACV,MAAMM,EAAK;AAAA,YACX,WAAWO;AAAA,YACX,UAAUJ;AAAA,YACV,gBAAgBD;AAAA,YAChB,SAASF,EAAK;AAAA,UAAA,CACf,EAAA,GAPYA,EAAK,EAQpB,IAOF,gBAAAD;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,MAAMC,EAAK;AAAA,cACX,gBAAcE;AAAA,cACd,WAAWK;AAAA,cACV,GAAIP,EAAK,UAAU,EAAE,SAASA,EAAK,QAAA,IAAY,CAAA;AAAA,cAE/C,UAAAG;AAAA,YAAA;AAAA,YANIH,EAAK;AAAA,UAAA;AAAA,QAShB;AACA,eACE,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,MAAK;AAAA,YACL,gBAAcG;AAAA,YACd,WAAWhB,EAAY,EAAE,MAAAS,GAAM;AAAA,YAC/B,SAAS,MAAMF,KAAA,gBAAAA,EAAWO,EAAK;AAAA,YAE9B,UAAAG;AAAA,UAAA;AAAA,UANIH,EAAK;AAAA,QAAA;AAAA,MAShB,CAAC,GACH,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;AACAX,EAAO,cAAc;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as X, useRef as q, useState as E, useEffect as F } from "react";
|
|
3
3
|
import { c as B } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as
|
|
4
|
+
import { useTranslation as G } from "react-i18next";
|
|
5
5
|
import { T as v } from "./tooltip-DvmfrNvB.js";
|
|
6
|
-
import { X as
|
|
6
|
+
import { X as H } from "./x-CCcI3eJp.js";
|
|
7
7
|
const V = B(
|
|
8
8
|
[
|
|
9
9
|
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
@@ -26,7 +26,10 @@ const V = B(
|
|
|
26
26
|
brand: ""
|
|
27
27
|
},
|
|
28
28
|
fill: {
|
|
29
|
-
|
|
29
|
+
// Solid chips carry a subtle, theme-aware border (a low-opacity
|
|
30
|
+
// foreground mix) so they read as a defined chip on any surface, not a
|
|
31
|
+
// floating fill — works across every colour variant, light and dark.
|
|
32
|
+
solid: "ds:border ds:border-[color:color-mix(in_srgb,var(--foreground)_15%,transparent)]",
|
|
30
33
|
outline: "ds:border ds:border-[color:var(--border)] ds:bg-transparent"
|
|
31
34
|
},
|
|
32
35
|
size: {
|
|
@@ -43,7 +46,7 @@ const V = B(
|
|
|
43
46
|
{
|
|
44
47
|
fill: "solid",
|
|
45
48
|
variant: "neutral",
|
|
46
|
-
className: "ds:bg-muted/20 ds:text-muted-foreground"
|
|
49
|
+
className: "ds:bg-muted/20 ds:text-muted-foreground ds:border-[color:var(--border)]"
|
|
47
50
|
},
|
|
48
51
|
{
|
|
49
52
|
fill: "solid",
|
|
@@ -74,7 +77,7 @@ const V = B(
|
|
|
74
77
|
{
|
|
75
78
|
fill: "outline",
|
|
76
79
|
variant: "neutral",
|
|
77
|
-
className: "ds:border-
|
|
80
|
+
className: "ds:border-[color:var(--border)] ds:text-muted-foreground"
|
|
78
81
|
},
|
|
79
82
|
{
|
|
80
83
|
fill: "outline",
|
|
@@ -108,7 +111,7 @@ const V = B(
|
|
|
108
111
|
size: "md"
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
|
-
),
|
|
114
|
+
), J = B(
|
|
112
115
|
[
|
|
113
116
|
"ds:inline-flex ds:items-center ds:justify-center ds:shrink-0 ds:rounded-full",
|
|
114
117
|
// Negative end margin keeps the button flush with the pill edge
|
|
@@ -129,48 +132,48 @@ const V = B(
|
|
|
129
132
|
},
|
|
130
133
|
defaultVariants: { size: "md" }
|
|
131
134
|
}
|
|
132
|
-
),
|
|
135
|
+
), L = X(
|
|
133
136
|
({
|
|
134
137
|
label: o,
|
|
135
138
|
variant: g = "neutral",
|
|
136
139
|
fill: p = "solid",
|
|
137
|
-
size:
|
|
140
|
+
size: t = "md",
|
|
138
141
|
leading: m,
|
|
139
|
-
onRemove:
|
|
142
|
+
onRemove: a,
|
|
140
143
|
onClick: b,
|
|
141
|
-
disabled:
|
|
144
|
+
disabled: r = !1,
|
|
142
145
|
maxInlineSize: n = "none",
|
|
143
146
|
className: h
|
|
144
147
|
}, i) => {
|
|
145
|
-
const { t: w } =
|
|
146
|
-
|
|
148
|
+
const { t: w } = G(), y = q(null), [D, C] = E(!1), [O, R] = E("");
|
|
149
|
+
F(() => {
|
|
147
150
|
const s = y.current;
|
|
148
151
|
if (!s || n === "none") return;
|
|
149
152
|
const z = () => C(s.scrollWidth > s.clientWidth), j = new ResizeObserver(z);
|
|
150
153
|
return j.observe(s), z(), () => j.disconnect();
|
|
151
154
|
}, [n]);
|
|
152
155
|
const W = (s) => {
|
|
153
|
-
(s.key === "Backspace" || s.key === "Delete") &&
|
|
156
|
+
(s.key === "Backspace" || s.key === "Delete") && a && !r && (s.preventDefault(), x(), setTimeout(a, 100));
|
|
154
157
|
}, x = () => {
|
|
155
158
|
R(w("tag.removed", { label: o }));
|
|
156
159
|
}, K = () => {
|
|
157
|
-
!
|
|
158
|
-
}, d = !!
|
|
160
|
+
!r && a && (x(), setTimeout(a, 100));
|
|
161
|
+
}, d = !!a, N = !!b && !d, T = V({
|
|
159
162
|
variant: g,
|
|
160
163
|
fill: p,
|
|
161
|
-
size:
|
|
164
|
+
size: t,
|
|
162
165
|
className: [
|
|
163
|
-
N && !
|
|
166
|
+
N && !r ? "ds:hover:brightness-90 ds:cursor-pointer" : "",
|
|
164
167
|
h ?? ""
|
|
165
168
|
].filter(Boolean).join(" ")
|
|
166
|
-
}), l = m ? /* @__PURE__ */
|
|
169
|
+
}), l = m ? /* @__PURE__ */ e(
|
|
167
170
|
"span",
|
|
168
171
|
{
|
|
169
172
|
"aria-hidden": "true",
|
|
170
173
|
className: "ds:shrink-0 ds:inline-flex ds:items-center ds:[&>svg]:size-3.5",
|
|
171
174
|
children: m
|
|
172
175
|
}
|
|
173
|
-
) : null, c = /* @__PURE__ */
|
|
176
|
+
) : null, c = /* @__PURE__ */ e(
|
|
174
177
|
"span",
|
|
175
178
|
{
|
|
176
179
|
ref: y,
|
|
@@ -178,16 +181,16 @@ const V = B(
|
|
|
178
181
|
style: n !== "none" ? { maxInlineSize: n } : void 0,
|
|
179
182
|
children: o
|
|
180
183
|
}
|
|
181
|
-
),
|
|
184
|
+
), _ = /* @__PURE__ */ e("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: O }), A = d ? /* @__PURE__ */ e(
|
|
182
185
|
"button",
|
|
183
186
|
{
|
|
184
187
|
type: "button",
|
|
185
188
|
"aria-label": w("tag.remove", { label: o }),
|
|
186
189
|
onClick: K,
|
|
187
|
-
disabled:
|
|
190
|
+
disabled: r,
|
|
188
191
|
tabIndex: -1,
|
|
189
|
-
className:
|
|
190
|
-
children: /* @__PURE__ */
|
|
192
|
+
className: J({ size: t }),
|
|
193
|
+
children: /* @__PURE__ */ e(H, { "aria-hidden": "true" })
|
|
191
194
|
}
|
|
192
195
|
) : null, u = n !== "none" && D;
|
|
193
196
|
if (N) {
|
|
@@ -196,8 +199,8 @@ const V = B(
|
|
|
196
199
|
{
|
|
197
200
|
ref: i,
|
|
198
201
|
type: "button",
|
|
199
|
-
onClick:
|
|
200
|
-
disabled:
|
|
202
|
+
onClick: r ? void 0 : b,
|
|
203
|
+
disabled: r,
|
|
201
204
|
"data-component": "tag",
|
|
202
205
|
className: T,
|
|
203
206
|
children: [
|
|
@@ -206,7 +209,7 @@ const V = B(
|
|
|
206
209
|
]
|
|
207
210
|
}
|
|
208
211
|
);
|
|
209
|
-
return u ? /* @__PURE__ */
|
|
212
|
+
return u ? /* @__PURE__ */ e(v, { label: o, children: s }) : s;
|
|
210
213
|
}
|
|
211
214
|
if (d) {
|
|
212
215
|
const s = (
|
|
@@ -217,39 +220,39 @@ const V = B(
|
|
|
217
220
|
ref: i,
|
|
218
221
|
role: "group",
|
|
219
222
|
"aria-label": o,
|
|
220
|
-
tabIndex:
|
|
221
|
-
"aria-disabled":
|
|
223
|
+
tabIndex: r ? -1 : 0,
|
|
224
|
+
"aria-disabled": r || void 0,
|
|
222
225
|
onKeyDown: W,
|
|
223
226
|
"data-component": "tag",
|
|
224
227
|
className: T,
|
|
225
228
|
children: [
|
|
226
|
-
|
|
229
|
+
_,
|
|
227
230
|
l,
|
|
228
231
|
c,
|
|
229
|
-
|
|
232
|
+
A
|
|
230
233
|
]
|
|
231
234
|
}
|
|
232
235
|
)
|
|
233
236
|
);
|
|
234
|
-
return u ? /* @__PURE__ */
|
|
237
|
+
return u ? /* @__PURE__ */ e(v, { label: o, children: s }) : s;
|
|
235
238
|
}
|
|
236
239
|
const k = /* @__PURE__ */ f(
|
|
237
240
|
"span",
|
|
238
241
|
{
|
|
239
242
|
ref: i,
|
|
240
243
|
"data-component": "tag",
|
|
241
|
-
className: V({ variant: g, fill: p, size:
|
|
244
|
+
className: V({ variant: g, fill: p, size: t, className: h }),
|
|
242
245
|
children: [
|
|
243
246
|
l,
|
|
244
247
|
c
|
|
245
248
|
]
|
|
246
249
|
}
|
|
247
250
|
);
|
|
248
|
-
return u ? /* @__PURE__ */
|
|
251
|
+
return u ? /* @__PURE__ */ e(v, { label: o, children: k }) : k;
|
|
249
252
|
}
|
|
250
253
|
);
|
|
251
|
-
|
|
254
|
+
L.displayName = "Tag";
|
|
252
255
|
export {
|
|
253
|
-
|
|
256
|
+
L as T
|
|
254
257
|
};
|
|
255
|
-
//# sourceMappingURL=tag-
|
|
258
|
+
//# sourceMappingURL=tag-BQXwuJq1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-BQXwuJq1.js","sources":["../../src/components/tag/tag.tsx"],"sourcesContent":["import { forwardRef, useRef, useState, useEffect, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { X } from 'lucide-react';\nimport { Tooltip } from '../tooltip';\n\n/* ------------------------------------------------------------------ */\n/* CVA — tag pill */\n/* ------------------------------------------------------------------ */\n\nconst tagVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:rounded-[var(--radius-full)]',\n 'type-eyebrow ds:whitespace-nowrap',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:aria-disabled:cursor-not-allowed ds:aria-disabled:opacity-50',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n variant: {\n neutral: '',\n info: '',\n success: '',\n warning: '',\n error: '',\n brand: '',\n },\n fill: {\n // Solid chips carry a subtle, theme-aware border (a low-opacity\n // foreground mix) so they read as a defined chip on any surface, not a\n // floating fill — works across every colour variant, light and dark.\n solid:\n 'ds:border ds:border-[color:color-mix(in_srgb,var(--foreground)_15%,transparent)]',\n outline: 'ds:border ds:border-[color:var(--border)] ds:bg-transparent',\n },\n size: {\n // Symmetric start/end padding — close button uses negative margin to stay flush.\n // Size is the only eyebrow-role axis that varies per Tag size; weight, transform,\n // tracking, line-height, and features all come from `.type-eyebrow` on the base.\n sm: 'ds:h-[calc(var(--spacing)*4)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:[--type-eyebrow-size:var(--font-size-2xs)]',\n md: 'ds:h-[calc(var(--spacing)*5)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:[--type-eyebrow-size:var(--font-size-2xs)]',\n lg: 'ds:h-[calc(var(--spacing)*6)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:[--type-eyebrow-size:var(--font-size-xs)]',\n },\n },\n compoundVariants: [\n // Solid fills — foreground tokens adapt per theme\n {\n fill: 'solid',\n variant: 'neutral',\n className:\n 'ds:bg-muted/20 ds:text-muted-foreground ds:border-[color:var(--border)]',\n },\n {\n fill: 'solid',\n variant: 'info',\n className: 'ds:bg-info ds:text-[color:var(--info-solid-foreground)]',\n },\n {\n fill: 'solid',\n variant: 'success',\n className:\n 'ds:bg-success ds:text-[color:var(--success-solid-foreground)]',\n },\n {\n fill: 'solid',\n variant: 'warning',\n className: 'ds:bg-warning ds:text-foreground',\n },\n {\n fill: 'solid',\n variant: 'error',\n className: 'ds:bg-destructive ds:text-destructive-foreground',\n },\n {\n fill: 'solid',\n variant: 'brand',\n className: 'ds:bg-primary ds:text-primary-foreground',\n },\n // Outline fills\n {\n fill: 'outline',\n variant: 'neutral',\n className: 'ds:border-[color:var(--border)] ds:text-muted-foreground',\n },\n {\n fill: 'outline',\n variant: 'info',\n className: 'ds:border-info ds:text-[var(--info-foreground)]',\n },\n {\n fill: 'outline',\n variant: 'success',\n className: 'ds:border-success ds:text-[var(--success-foreground)]',\n },\n {\n fill: 'outline',\n variant: 'warning',\n className: 'ds:border-warning ds:text-[var(--warning-foreground)]',\n },\n {\n fill: 'outline',\n variant: 'error',\n className: 'ds:border-destructive ds:text-[var(--error-foreground)]',\n },\n {\n fill: 'outline',\n variant: 'brand',\n className: 'ds:border-primary ds:text-primary',\n },\n ],\n defaultVariants: {\n variant: 'neutral',\n fill: 'solid',\n size: 'md',\n },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* CVA — close button */\n/* ------------------------------------------------------------------ */\n\nconst closeButtonVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:justify-center ds:shrink-0 ds:rounded-full',\n // Negative end margin keeps the button flush with the pill edge\n 'ds:-me-[var(--spacing-xs)]',\n 'ds:hover:bg-foreground/10',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:p-1 ds:[&>svg]:size-3',\n md: 'ds:p-1 ds:[&>svg]:size-3.5',\n lg: 'ds:p-1.5 ds:[&>svg]:size-4',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* TagProps */\n/* ------------------------------------------------------------------ */\n\nexport interface TagProps {\n /** The visible label text */\n label: string;\n /** Semantic colour variant */\n variant?: 'neutral' | 'info' | 'success' | 'warning' | 'error' | 'brand';\n /** Visual fill style */\n fill?: 'solid' | 'outline';\n /** Size */\n size?: 'sm' | 'md' | 'lg';\n /** Leading slot — icon element or dot */\n leading?: ReactNode;\n /** Called when the tag is removed (enables close button + Backspace/Delete) */\n onRemove?: () => void;\n /** Called when the tag is clicked (non-removable interactive tag) */\n onClick?: () => void;\n /** Disabled state */\n disabled?: boolean;\n /** Max inline size before truncation with tooltip — default 'none' */\n maxInlineSize?: string | 'none';\n /** Additional class names */\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Tag */\n/* ------------------------------------------------------------------ */\n\nexport const Tag = forwardRef<HTMLElement, TagProps>(\n (\n {\n label,\n variant = 'neutral',\n fill = 'solid',\n size = 'md',\n leading,\n onRemove,\n onClick,\n disabled = false,\n maxInlineSize = 'none',\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const labelRef = useRef<HTMLSpanElement>(null);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const [announcement, setAnnouncement] = useState('');\n\n useEffect(() => {\n const el = labelRef.current;\n if (!el || maxInlineSize === 'none') return;\n\n const check = () => setIsOverflowing(el.scrollWidth > el.clientWidth);\n const observer = new ResizeObserver(check);\n observer.observe(el);\n check();\n return () => observer.disconnect();\n }, [maxInlineSize]);\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (\n (e.key === 'Backspace' || e.key === 'Delete') &&\n onRemove &&\n !disabled\n ) {\n e.preventDefault();\n announce();\n // Delay gives the live region one render cycle before unmount\n setTimeout(onRemove, 100);\n }\n };\n\n const announce = () => {\n setAnnouncement(t('tag.removed', { label }));\n };\n\n const handleRemove = () => {\n if (!disabled && onRemove) {\n announce();\n setTimeout(onRemove, 100);\n }\n };\n\n const isRemovable = !!onRemove;\n const isClickable = !!onClick && !isRemovable;\n\n const rootClasses = tagVariants({\n variant,\n fill,\n size,\n className: [\n isClickable && !disabled\n ? 'ds:hover:brightness-90 ds:cursor-pointer'\n : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' '),\n });\n\n const leadingEl = leading ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:shrink-0 ds:inline-flex ds:items-center ds:[&>svg]:size-3.5\"\n >\n {leading}\n </span>\n ) : null;\n\n // Consumer-controlled layout constraint — not a design token.\n // maxInlineSize is an arbitrary caller-supplied value that cannot be expressed\n // as a static Tailwind class; the style prop is the only cross-browser option.\n const labelEl = (\n <span\n ref={labelRef}\n className={\n maxInlineSize !== 'none'\n ? 'ds:overflow-hidden ds:text-ellipsis ds:whitespace-nowrap'\n : undefined\n }\n // eslint-disable-next-line react/forbid-dom-props -- caller-supplied maxInlineSize, runtime-computed\n style={maxInlineSize !== 'none' ? { maxInlineSize } : undefined}\n >\n {label}\n </span>\n );\n\n // Live region — only for removable tags; must be a sibling outside the button.\n const liveRegion = (\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {announcement}\n </span>\n );\n\n const closeButton = isRemovable ? (\n <button\n type=\"button\"\n aria-label={t('tag.remove', { label })}\n onClick={handleRemove}\n disabled={disabled}\n // Intentionally excluded from tab order: Backspace/Delete on the focused\n // group element provides the same keyboard action.\n tabIndex={-1}\n className={closeButtonVariants({ size })}\n >\n <X aria-hidden=\"true\" />\n </button>\n ) : null;\n\n const shouldWrapTooltip = maxInlineSize !== 'none' && isOverflowing;\n\n // Clickable tag — renders as <button>; live region is a sibling, not inside button\n if (isClickable) {\n const tagEl = (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={!disabled ? onClick : undefined}\n disabled={disabled}\n data-component=\"tag\"\n className={rootClasses}\n >\n {leadingEl}\n {labelEl}\n </button>\n );\n return shouldWrapTooltip ? (\n <Tooltip label={label}>{tagEl}</Tooltip>\n ) : (\n tagEl\n );\n }\n\n // Removable tag — focusable <span> with embedded close button\n if (isRemovable) {\n const tagEl = (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- removable tag is focusable as a group; Backspace/Delete keyboard removal handled via onKeyDown\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n role=\"group\"\n aria-label={label}\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n onKeyDown={handleKeyDown}\n data-component=\"tag\"\n className={rootClasses}\n >\n {liveRegion}\n {leadingEl}\n {labelEl}\n {closeButton}\n </span>\n );\n return shouldWrapTooltip ? (\n <Tooltip label={label}>{tagEl}</Tooltip>\n ) : (\n tagEl\n );\n }\n\n // Decorative tag — plain <span>, no interactive role\n const tagEl = (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n data-component=\"tag\"\n className={tagVariants({ variant, fill, size, className })}\n >\n {leadingEl}\n {labelEl}\n </span>\n );\n return shouldWrapTooltip ? <Tooltip label={label}>{tagEl}</Tooltip> : tagEl;\n },\n);\n\nTag.displayName = 'Tag';\n"],"names":["tagVariants","cva","closeButtonVariants","Tag","forwardRef","label","variant","fill","size","leading","onRemove","onClick","disabled","maxInlineSize","className","ref","t","useTranslation","labelRef","useRef","isOverflowing","setIsOverflowing","useState","announcement","setAnnouncement","useEffect","el","check","observer","handleKeyDown","e","announce","handleRemove","isRemovable","isClickable","rootClasses","leadingEl","jsx","labelEl","liveRegion","closeButton","X","shouldWrapTooltip","tagEl","jsxs","Tooltip"],"mappings":";;;;;;AAUA,MAAMA,IAAcC;AAAA,EAClB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,QACP,OAAO;AAAA,MAAA;AAAA,MAET,MAAM;AAAA;AAAA;AAAA;AAAA,QAIJ,OACE;AAAA,QACF,SAAS;AAAA,MAAA;AAAA,MAEX,MAAM;AAAA;AAAA;AAAA;AAAA,QAIJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,kBAAkB;AAAA;AAAA,MAEhB;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WACE;AAAA,MAAA;AAAA,MAEJ;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WACE;AAAA,MAAA;AAAA,MAEJ;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,MAAA;AAAA;AAAA,MAGb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,MA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M,IAE9BA;AAAAA,IAEJ;AAGA,UAAMA,IACJ,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAA7B;AAAA,QACA,kBAAe;AAAA,QACf,WAAWf,EAAY,EAAE,SAAAM,GAAS,MAAAC,GAAM,MAAAC,GAAM,WAAAM,GAAW;AAAA,QAExD,UAAA;AAAA,UAAAsB;AAAA,UACAE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAGL,WAAOI,IAAoB,gBAAAL,EAACQ,GAAA,EAAQ,OAAAxC,GAAe,aAAM,IAAasC;AAAA,EACxE;AACF;AAEAxC,EAAI,cAAc;"}
|
|
@@ -65,15 +65,15 @@ const L = [
|
|
|
65
65
|
// Text uses the deeper `*-foreground` token (matching Badge / Tag) so
|
|
66
66
|
// small chip text clears WCAG AA (4.5:1) against the 10% tinted
|
|
67
67
|
// background. The surface and border use the lighter alias.
|
|
68
|
-
debt: "ds:bg-destructive/10 ds:text-[color:var(--error-foreground)] ds:border-
|
|
69
|
-
credit: "ds:bg-success/10 ds:text-[color:var(--success-foreground)] ds:border-success
|
|
68
|
+
debt: "ds:bg-destructive/10 ds:text-[color:var(--error-foreground)] ds:border-[color:var(--error-foreground)]",
|
|
69
|
+
credit: "ds:bg-success/10 ds:text-[color:var(--success-foreground)] ds:border-[color:var(--success-foreground)]",
|
|
70
70
|
// The orange "to-invoice" tint has no kit-wide semantic alias — see
|
|
71
71
|
// src/tokens/index.css §Transaction-chip-scoped tokens. The component
|
|
72
72
|
// owns the alias because the customer-anchored "Da fatturare" orange
|
|
73
73
|
// is distinct from `--warning` (yellow) and from `--destructive`.
|
|
74
|
-
"to-invoice": "ds:bg-transaction-chip-to-invoice/10 ds:text-[color:var(--transaction-chip-to-invoice-foreground)] ds:border-transaction-chip-to-invoice
|
|
75
|
-
"to-deliver": "ds:bg-info/10 ds:text-[color:var(--info-foreground)] ds:border-info
|
|
76
|
-
settled: "ds:bg-muted/30 ds:text-muted-foreground ds:border-
|
|
74
|
+
"to-invoice": "ds:bg-transaction-chip-to-invoice/10 ds:text-[color:var(--transaction-chip-to-invoice-foreground)] ds:border-[color:var(--transaction-chip-to-invoice-foreground)]",
|
|
75
|
+
"to-deliver": "ds:bg-info/10 ds:text-[color:var(--info-foreground)] ds:border-[color:var(--info-foreground)]",
|
|
76
|
+
settled: "ds:bg-muted/30 ds:text-muted-foreground ds:border-[color:var(--border)]"
|
|
77
77
|
},
|
|
78
78
|
size: {
|
|
79
79
|
// Heights tuned for table-cell density (sm), default app surfaces (md),
|
|
@@ -116,24 +116,24 @@ const L = [
|
|
|
116
116
|
), G = T(
|
|
117
117
|
({
|
|
118
118
|
state: e,
|
|
119
|
-
amount:
|
|
120
|
-
currency:
|
|
121
|
-
locale:
|
|
122
|
-
size:
|
|
119
|
+
amount: v,
|
|
120
|
+
currency: r = D,
|
|
121
|
+
locale: m,
|
|
122
|
+
size: t = "md",
|
|
123
123
|
showLabel: f = !1,
|
|
124
|
-
className:
|
|
125
|
-
"aria-label":
|
|
124
|
+
className: u,
|
|
125
|
+
"aria-label": p,
|
|
126
126
|
...g
|
|
127
127
|
}, b) => {
|
|
128
|
-
const { t: o, i18n: h } = C(), a =
|
|
128
|
+
const { t: o, i18n: h } = C(), a = m ?? h.language ?? "en", x = F[e], i = M[e], n = Math.abs(v), y = new Intl.NumberFormat(a, {
|
|
129
129
|
style: "currency",
|
|
130
|
-
currency:
|
|
130
|
+
currency: r,
|
|
131
131
|
signDisplay: "never"
|
|
132
132
|
}).format(n), d = o(`financial.state.${S[e]}`), w = new Intl.NumberFormat(a, {
|
|
133
133
|
style: "currency",
|
|
134
|
-
currency:
|
|
134
|
+
currency: r,
|
|
135
135
|
signDisplay: e === "debt" ? "always" : "auto"
|
|
136
|
-
}).format(n * V[e]), z =
|
|
136
|
+
}).format(n * V[e]), z = p ?? o("financial.aria.label", {
|
|
137
137
|
state: d,
|
|
138
138
|
amount: w
|
|
139
139
|
});
|
|
@@ -147,13 +147,13 @@ const L = [
|
|
|
147
147
|
"data-state": e,
|
|
148
148
|
className: U({
|
|
149
149
|
state: e,
|
|
150
|
-
size:
|
|
150
|
+
size: t,
|
|
151
151
|
bold: e !== "settled",
|
|
152
|
-
className:
|
|
152
|
+
className: u
|
|
153
153
|
}),
|
|
154
154
|
...g,
|
|
155
155
|
children: [
|
|
156
|
-
/* @__PURE__ */ s("span", { "aria-hidden": "true", className: j({ size:
|
|
156
|
+
/* @__PURE__ */ s("span", { "aria-hidden": "true", className: j({ size: t }), children: /* @__PURE__ */ s(x, {}) }),
|
|
157
157
|
f && /* @__PURE__ */ s("span", { "aria-hidden": "true", className: "type-eyebrow", children: d }),
|
|
158
158
|
i && /* @__PURE__ */ s(
|
|
159
159
|
"span",
|
|
@@ -182,4 +182,4 @@ export {
|
|
|
182
182
|
G as T,
|
|
183
183
|
R as a
|
|
184
184
|
};
|
|
185
|
-
//# sourceMappingURL=transaction-chip-
|
|
185
|
+
//# sourceMappingURL=transaction-chip-BrW8P50O.js.map
|