@zentauri-ui/zentauri-components 1.4.51 → 1.4.62
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/README.md +63 -1
- package/cli/registry.json +2 -1
- package/dist/{chunk-UXGHUBNJ.mjs → chunk-2PJF7DLJ.mjs} +3 -3
- package/dist/{chunk-UXGHUBNJ.mjs.map → chunk-2PJF7DLJ.mjs.map} +1 -1
- package/dist/{chunk-WDCIZHXY.mjs → chunk-45FCOQ63.mjs} +5 -3
- package/dist/chunk-45FCOQ63.mjs.map +1 -0
- package/dist/{chunk-RDSPHBHK.mjs → chunk-4ANBTJ5G.mjs} +49 -6
- package/dist/chunk-4ANBTJ5G.mjs.map +1 -0
- package/dist/chunk-4E66ICIR.mjs +158 -0
- package/dist/chunk-4E66ICIR.mjs.map +1 -0
- package/dist/{chunk-XLAFQ24R.js → chunk-4U6FOCFK.js} +22 -14
- package/dist/chunk-4U6FOCFK.js.map +1 -0
- package/dist/{chunk-XWM2S6VV.mjs → chunk-EQSSYK27.mjs} +12 -10
- package/dist/chunk-EQSSYK27.mjs.map +1 -0
- package/dist/{chunk-5QB2KNZQ.js → chunk-FGGYDAX3.js} +5 -3
- package/dist/chunk-FGGYDAX3.js.map +1 -0
- package/dist/{chunk-7HL3A4YF.mjs → chunk-IK75NHRX.mjs} +63 -14
- package/dist/chunk-IK75NHRX.mjs.map +1 -0
- package/dist/{chunk-BORK3BJO.mjs → chunk-J56L4ZQ3.mjs} +10 -10
- package/dist/{chunk-BORK3BJO.mjs.map → chunk-J56L4ZQ3.mjs.map} +1 -1
- package/dist/{chunk-PGH27VTL.mjs → chunk-JF3FKUUP.mjs} +21 -13
- package/dist/chunk-JF3FKUUP.mjs.map +1 -0
- package/dist/{chunk-WZKGRU3U.js → chunk-MQZB5EPD.js} +92 -27
- package/dist/chunk-MQZB5EPD.js.map +1 -0
- package/dist/{chunk-N4NO3SYL.js → chunk-NX3IHMT7.js} +22 -14
- package/dist/chunk-NX3IHMT7.js.map +1 -0
- package/dist/{chunk-BVXTOEBI.mjs → chunk-OG2WM5YK.mjs} +45 -17
- package/dist/chunk-OG2WM5YK.mjs.map +1 -0
- package/dist/{chunk-IXDJ3IPG.mjs → chunk-OXS6UJUG.mjs} +21 -13
- package/dist/chunk-OXS6UJUG.mjs.map +1 -0
- package/dist/{chunk-PCK6LX3K.js → chunk-PFOV3U7W.js} +3 -3
- package/dist/{chunk-PCK6LX3K.js.map → chunk-PFOV3U7W.js.map} +1 -1
- package/dist/{chunk-2PQEXQVR.js → chunk-THCNTPPL.js} +62 -13
- package/dist/chunk-THCNTPPL.js.map +1 -0
- package/dist/chunk-UP6S75V5.js +160 -0
- package/dist/chunk-UP6S75V5.js.map +1 -0
- package/dist/{chunk-P5HUBXUX.js → chunk-V2IWLR4O.js} +48 -5
- package/dist/chunk-V2IWLR4O.js.map +1 -0
- package/dist/{chunk-3OR47XMY.js → chunk-VSKL5LOB.js} +45 -17
- package/dist/chunk-VSKL5LOB.js.map +1 -0
- package/dist/{chunk-E3DZNJAD.js → chunk-Y4EDWZKH.js} +12 -10
- package/dist/chunk-Y4EDWZKH.js.map +1 -0
- package/dist/{chunk-YNCD6TKE.mjs → chunk-Y4IFVO46.mjs} +93 -28
- package/dist/chunk-Y4IFVO46.mjs.map +1 -0
- package/dist/{chunk-BITDSQMR.js → chunk-ZNDHS5OK.js} +10 -10
- package/dist/{chunk-BITDSQMR.js.map → chunk-ZNDHS5OK.js.map} +1 -1
- package/dist/hooks/useFocusManagement/useFocusManagement.d.ts +5 -14
- package/dist/hooks/useFocusManagement/useFocusManagement.d.ts.map +1 -1
- package/dist/hooks/useFocusManagement.js +2 -2
- package/dist/hooks/useFocusManagement.mjs +1 -1
- package/dist/ui/badge/animated.js +2 -2
- package/dist/ui/badge/animated.mjs +1 -1
- package/dist/ui/badge/badge-base.d.ts +1 -1
- package/dist/ui/badge/badge-base.d.ts.map +1 -1
- package/dist/ui/badge/types.d.ts +1 -0
- package/dist/ui/badge/types.d.ts.map +1 -1
- package/dist/ui/badge/variants.d.ts +7 -7
- package/dist/ui/badge.js +4 -4
- package/dist/ui/badge.mjs +2 -2
- package/dist/ui/buttons/animated.js +3 -3
- package/dist/ui/buttons/animated.mjs +1 -1
- package/dist/ui/buttons.js +4 -4
- package/dist/ui/buttons.mjs +2 -2
- package/dist/ui/drawer/animated/drawer-content-animated.d.ts.map +1 -1
- package/dist/ui/drawer/animated.js +17 -18
- package/dist/ui/drawer/animated.js.map +1 -1
- package/dist/ui/drawer/animated.mjs +8 -9
- package/dist/ui/drawer/animated.mjs.map +1 -1
- package/dist/ui/drawer/drawer-base.d.ts +1 -1
- package/dist/ui/drawer/drawer-base.d.ts.map +1 -1
- package/dist/ui/drawer/types.d.ts +1 -0
- package/dist/ui/drawer/types.d.ts.map +1 -1
- package/dist/ui/drawer.js +12 -12
- package/dist/ui/drawer.mjs +2 -2
- package/dist/ui/dropdown/dropdown.d.ts +1 -1
- package/dist/ui/dropdown/dropdown.d.ts.map +1 -1
- package/dist/ui/dropdown/types.d.ts +1 -0
- package/dist/ui/dropdown/types.d.ts.map +1 -1
- package/dist/ui/dropdown/variants.d.ts +1 -1
- package/dist/ui/dropdown.js +25 -7
- package/dist/ui/dropdown.js.map +1 -1
- package/dist/ui/dropdown.mjs +26 -8
- package/dist/ui/dropdown.mjs.map +1 -1
- package/dist/ui/empty-state/animated.js +2 -2
- package/dist/ui/empty-state/animated.mjs +1 -1
- package/dist/ui/empty-state/empty-state-base.d.ts.map +1 -1
- package/dist/ui/empty-state/types.d.ts +1 -0
- package/dist/ui/empty-state/types.d.ts.map +1 -1
- package/dist/ui/empty-state.js +10 -10
- package/dist/ui/empty-state.mjs +2 -2
- package/dist/ui/file-upload/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +1 -3
- package/dist/ui/file-upload.js.map +1 -1
- package/dist/ui/file-upload.mjs +1 -3
- package/dist/ui/file-upload.mjs.map +1 -1
- package/dist/ui/inputs/input-base.d.ts.map +1 -1
- package/dist/ui/inputs/types.d.ts +3 -1
- package/dist/ui/inputs/types.d.ts.map +1 -1
- package/dist/ui/inputs.js +46 -2
- package/dist/ui/inputs.js.map +1 -1
- package/dist/ui/inputs.mjs +46 -2
- package/dist/ui/inputs.mjs.map +1 -1
- package/dist/ui/modal/animated/modal-content-animated.d.ts.map +1 -1
- package/dist/ui/modal/animated.js +10 -11
- package/dist/ui/modal/animated.js.map +1 -1
- package/dist/ui/modal/animated.mjs +7 -8
- package/dist/ui/modal/animated.mjs.map +1 -1
- package/dist/ui/modal/modal-base.d.ts +4 -2
- package/dist/ui/modal/modal-base.d.ts.map +1 -1
- package/dist/ui/modal.js +13 -13
- package/dist/ui/modal.mjs +3 -3
- package/dist/ui/pagination.js +6 -6
- package/dist/ui/pagination.js.map +1 -1
- package/dist/ui/pagination.mjs +3 -3
- package/dist/ui/pagination.mjs.map +1 -1
- package/dist/ui/progress/animated/progress-animated.d.ts.map +1 -1
- package/dist/ui/progress/animated.js +49 -11
- package/dist/ui/progress/animated.js.map +1 -1
- package/dist/ui/progress/animated.mjs +44 -6
- package/dist/ui/progress/animated.mjs.map +1 -1
- package/dist/ui/progress/progress-base.d.ts.map +1 -1
- package/dist/ui/progress/types.d.ts +3 -0
- package/dist/ui/progress/types.d.ts.map +1 -1
- package/dist/ui/progress.js +9 -9
- package/dist/ui/progress.mjs +2 -2
- package/dist/ui/search/search-bar.d.ts +1 -1
- package/dist/ui/search/search-bar.d.ts.map +1 -1
- package/dist/ui/search/search-suggestion-list.d.ts.map +1 -1
- package/dist/ui/search.js +12 -6
- package/dist/ui/search.js.map +1 -1
- package/dist/ui/search.mjs +12 -6
- package/dist/ui/search.mjs.map +1 -1
- package/dist/ui/select/select.d.ts +1 -1
- package/dist/ui/select/select.d.ts.map +1 -1
- package/dist/ui/select/types.d.ts +1 -0
- package/dist/ui/select/types.d.ts.map +1 -1
- package/dist/ui/select/variants.d.ts +1 -1
- package/dist/ui/select/variants.d.ts.map +1 -1
- package/dist/ui/select.js +121 -39
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/select.mjs +122 -40
- package/dist/ui/select.mjs.map +1 -1
- package/dist/ui/skeleton/variants.d.ts +1 -1
- package/dist/ui/slider/slider.d.ts.map +1 -1
- package/dist/ui/slider/types.d.ts +8 -2
- package/dist/ui/slider/types.d.ts.map +1 -1
- package/dist/ui/slider.js +43 -7
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/slider.mjs +43 -7
- package/dist/ui/slider.mjs.map +1 -1
- package/dist/ui/spinner/animated/spinner.d.ts.map +1 -1
- package/dist/ui/spinner/animated.js +62 -50
- package/dist/ui/spinner/animated.js.map +1 -1
- package/dist/ui/spinner/animated.mjs +63 -51
- package/dist/ui/spinner/animated.mjs.map +1 -1
- package/dist/ui/stepper/stepper.d.ts +2 -7
- package/dist/ui/stepper/stepper.d.ts.map +1 -1
- package/dist/ui/stepper/types.d.ts +3 -3
- package/dist/ui/stepper/types.d.ts.map +1 -1
- package/dist/ui/stepper/variants.d.ts +1 -1
- package/dist/ui/stepper.js +7 -5
- package/dist/ui/stepper.js.map +1 -1
- package/dist/ui/stepper.mjs +7 -5
- package/dist/ui/stepper.mjs.map +1 -1
- package/dist/ui/table/animated.js +8 -8
- package/dist/ui/table/animated.mjs +2 -2
- package/dist/ui/table/table-base.d.ts +1 -1
- package/dist/ui/table/table-base.d.ts.map +1 -1
- package/dist/ui/table/types.d.ts +5 -1
- package/dist/ui/table/types.d.ts.map +1 -1
- package/dist/ui/table.js +14 -14
- package/dist/ui/table.mjs +1 -1
- package/dist/ui/tabs/animated.js +2 -2
- package/dist/ui/tabs/animated.mjs +1 -1
- package/dist/ui/tabs/tabs-base.d.ts.map +1 -1
- package/dist/ui/tabs/types.d.ts +2 -1
- package/dist/ui/tabs/types.d.ts.map +1 -1
- package/dist/ui/tabs.js +9 -9
- package/dist/ui/tabs.mjs +1 -1
- package/dist/ui/toast/animated.js +7 -7
- package/dist/ui/toast/animated.mjs +1 -1
- package/dist/ui/toast.js +12 -12
- package/dist/ui/toast.mjs +1 -1
- package/dist/ui/toggle/toggle-base.d.ts.map +1 -1
- package/dist/ui/toggle.js +28 -3
- package/dist/ui/toggle.js.map +1 -1
- package/dist/ui/toggle.mjs +29 -4
- package/dist/ui/toggle.mjs.map +1 -1
- package/dist/ui/tooltip/animated.js +3 -3
- package/dist/ui/tooltip/animated.mjs +1 -1
- package/dist/ui/tooltip/tooltip-base.d.ts.map +1 -1
- package/dist/ui/tooltip/types.d.ts +1 -0
- package/dist/ui/tooltip/types.d.ts.map +1 -1
- package/dist/ui/tooltip.js +7 -7
- package/dist/ui/tooltip.mjs +1 -1
- package/dist/ui/typography/blockquote-base.d.ts +6 -0
- package/dist/ui/typography/blockquote-base.d.ts.map +1 -0
- package/dist/ui/typography/blockquote.d.ts +6 -0
- package/dist/ui/typography/blockquote.d.ts.map +1 -0
- package/dist/ui/typography/code-block-base.d.ts +6 -0
- package/dist/ui/typography/code-block-base.d.ts.map +1 -0
- package/dist/ui/typography/code-block.d.ts +6 -0
- package/dist/ui/typography/code-block.d.ts.map +1 -0
- package/dist/ui/typography/heading-base.d.ts +6 -0
- package/dist/ui/typography/heading-base.d.ts.map +1 -0
- package/dist/ui/typography/heading.d.ts +6 -0
- package/dist/ui/typography/heading.d.ts.map +1 -0
- package/dist/ui/typography/index.d.ts +9 -0
- package/dist/ui/typography/index.d.ts.map +1 -0
- package/dist/ui/typography/inline-code-base.d.ts +6 -0
- package/dist/ui/typography/inline-code-base.d.ts.map +1 -0
- package/dist/ui/typography/inline-code.d.ts +6 -0
- package/dist/ui/typography/inline-code.d.ts.map +1 -0
- package/dist/ui/typography/list-base.d.ts +10 -0
- package/dist/ui/typography/list-base.d.ts.map +1 -0
- package/dist/ui/typography/list.d.ts +12 -0
- package/dist/ui/typography/list.d.ts.map +1 -0
- package/dist/ui/typography/text-base.d.ts +6 -0
- package/dist/ui/typography/text-base.d.ts.map +1 -0
- package/dist/ui/typography/text.d.ts +6 -0
- package/dist/ui/typography/text.d.ts.map +1 -0
- package/dist/ui/typography/types.d.ts +56 -0
- package/dist/ui/typography/types.d.ts.map +1 -0
- package/dist/ui/typography/variants.d.ts +16 -0
- package/dist/ui/typography/variants.d.ts.map +1 -0
- package/dist/ui/typography.js +334 -0
- package/dist/ui/typography.js.map +1 -0
- package/dist/ui/typography.mjs +321 -0
- package/dist/ui/typography.mjs.map +1 -0
- package/package.json +1 -1
- package/src/hooks/useFocusManagement/useFocusManagement.test.tsx +8 -0
- package/src/hooks/useFocusManagement/useFocusManagement.ts +162 -33
- package/src/ui/badge/badge-base.tsx +4 -1
- package/src/ui/badge/types.ts +1 -0
- package/src/ui/badge/variants.ts +7 -7
- package/src/ui/buttons/button.test.tsx +1 -1
- package/src/ui/buttons/variants.ts +8 -8
- package/src/ui/drawer/animated/drawer-content-animated.tsx +4 -5
- package/src/ui/drawer/drawer-base.tsx +16 -8
- package/src/ui/drawer/types.ts +1 -0
- package/src/ui/dropdown/dropdown.test.tsx +1 -3
- package/src/ui/dropdown/dropdown.tsx +23 -5
- package/src/ui/dropdown/types.ts +1 -0
- package/src/ui/dropdown/variants.ts +2 -2
- package/src/ui/empty-state/empty-state-base.tsx +9 -1
- package/src/ui/empty-state/types.ts +1 -0
- package/src/ui/file-upload/file-upload.tsx +0 -2
- package/src/ui/inputs/input-base.tsx +60 -6
- package/src/ui/inputs/types.ts +3 -1
- package/src/ui/modal/animated/modal-content-animated.tsx +4 -5
- package/src/ui/modal/modal-base.tsx +19 -9
- package/src/ui/modal/modal.test.tsx +38 -0
- package/src/ui/pagination/pagination.tsx +2 -2
- package/src/ui/progress/animated/progress-animated.tsx +42 -3
- package/src/ui/progress/progress-base.tsx +59 -3
- package/src/ui/progress/types.ts +3 -0
- package/src/ui/search/search-bar.tsx +6 -1
- package/src/ui/search/search-suggestion-list.tsx +14 -6
- package/src/ui/select/select.tsx +97 -6
- package/src/ui/select/types.ts +1 -0
- package/src/ui/select/variants.ts +5 -3
- package/src/ui/slider/slider.test.tsx +25 -1
- package/src/ui/slider/slider.tsx +45 -4
- package/src/ui/slider/types.ts +8 -2
- package/src/ui/spinner/animated/spinner.tsx +4 -0
- package/src/ui/stepper/stepper.test.tsx +6 -7
- package/src/ui/stepper/stepper.tsx +11 -10
- package/src/ui/stepper/types.ts +7 -3
- package/src/ui/table/table-base.tsx +32 -6
- package/src/ui/table/types.ts +8 -1
- package/src/ui/tabs/tabs-base.tsx +71 -10
- package/src/ui/tabs/types.ts +2 -1
- package/src/ui/tabs/variants.ts +1 -1
- package/src/ui/toast/toast-base.tsx +1 -1
- package/src/ui/toggle/toggle-base.tsx +37 -4
- package/src/ui/tooltip/tooltip-base.tsx +119 -22
- package/src/ui/tooltip/types.ts +1 -0
- package/src/ui/tooltip/variants.ts +2 -2
- package/src/ui/typography/blockquote-base.tsx +39 -0
- package/src/ui/typography/blockquote.tsx +8 -0
- package/src/ui/typography/code-block-base.tsx +37 -0
- package/src/ui/typography/code-block.tsx +8 -0
- package/src/ui/typography/heading-base.tsx +59 -0
- package/src/ui/typography/heading.tsx +8 -0
- package/src/ui/typography/index.ts +28 -0
- package/src/ui/typography/inline-code-base.tsx +27 -0
- package/src/ui/typography/inline-code.tsx +8 -0
- package/src/ui/typography/list-base.tsx +88 -0
- package/src/ui/typography/list.tsx +15 -0
- package/src/ui/typography/text-base.tsx +43 -0
- package/src/ui/typography/text.tsx +8 -0
- package/src/ui/typography/types.ts +90 -0
- package/src/ui/typography/typography.test.tsx +80 -0
- package/src/ui/typography/variants.ts +72 -0
- package/dist/chunk-2PQEXQVR.js.map +0 -1
- package/dist/chunk-3OR47XMY.js.map +0 -1
- package/dist/chunk-5QB2KNZQ.js.map +0 -1
- package/dist/chunk-7HL3A4YF.mjs.map +0 -1
- package/dist/chunk-BVXTOEBI.mjs.map +0 -1
- package/dist/chunk-E3DZNJAD.js.map +0 -1
- package/dist/chunk-IXDJ3IPG.mjs.map +0 -1
- package/dist/chunk-N4NO3SYL.js.map +0 -1
- package/dist/chunk-P5HUBXUX.js.map +0 -1
- package/dist/chunk-PGH27VTL.mjs.map +0 -1
- package/dist/chunk-RDSPHBHK.mjs.map +0 -1
- package/dist/chunk-WDCIZHXY.mjs.map +0 -1
- package/dist/chunk-WL5I7RVS.mjs +0 -54
- package/dist/chunk-WL5I7RVS.mjs.map +0 -1
- package/dist/chunk-WZKGRU3U.js.map +0 -1
- package/dist/chunk-XLAFQ24R.js.map +0 -1
- package/dist/chunk-XWM2S6VV.mjs.map +0 -1
- package/dist/chunk-YNCD6TKE.mjs.map +0 -1
- package/dist/chunk-YPLVTUYL.js +0 -56
- package/dist/chunk-YPLVTUYL.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/typography/variants.ts","../../src/ui/typography/heading-base.tsx","../../src/ui/typography/heading.tsx","../../src/ui/typography/text-base.tsx","../../src/ui/typography/text.tsx","../../src/ui/typography/list-base.tsx","../../src/ui/typography/list.tsx","../../src/ui/typography/blockquote-base.tsx","../../src/ui/typography/blockquote.tsx","../../src/ui/typography/inline-code-base.tsx","../../src/ui/typography/inline-code.tsx","../../src/ui/typography/code-block-base.tsx","../../src/ui/typography/code-block.tsx"],"names":["jsx","tone","className","children","ref","ordered","marker","rest"],"mappings":";;;;AAGO,IAAM,sBAAA,GAAyB,IAAI,EAAA,EAAI;AAAA,EAC5C,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,+BAAA;AAAA,MACT,KAAA,EAAO,gCAAA;AAAA,MACP,OAAA,EAAS,kCAAA;AAAA,MACT,SAAA,EAAW,gCAAA;AAAA,MACX,MAAA,EAAQ,sCAAA;AAAA,MACR,WAAA,EAAa,kCAAA;AAAA,MACb,IAAA,EAAM,gCAAA;AAAA,MACN,OAAA,EAAS,wCAAA;AAAA,MACT,OAAA,EAAS,oCAAA;AAAA,MACT,KAAA,EAAO,gCAAA;AAAA,MACP,sBAAA,EAAwB,0EAAA;AAAA,MACxB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uB,EAAE,IAAA,EAAM,CAAA;AAAA,QAC/B,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAAA,GAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,+DAA+D,QAAA,EAAS;AAAA;AAAA,GAC1F;AAEN,CAAA;AAEA,aAAA,CAAc,WAAA,GAAc,WAAA;ACjCrB,IAAM,SAAA,GAAY,CAAC,KAAA,KAA0B;AAClD,EAAA,uBAAOA,GAAAA,CAAC,aAAA,EAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AACnC;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA","file":"typography.mjs","sourcesContent":["import { cva } from \"class-variance-authority\";\n\n/** Semantic text colors aligned with slate/cyan/violet accents used across the kit (dark-first). */\nexport const typographyToneVariants = cva(\"\", {\n variants: {\n tone: {\n default: \"text-slate-50 border-white/15\",\n muted: \"text-slate-400 border-white/15\",\n primary: \"text-cyan-300 border-cyan-300/40\",\n secondary: \"text-slate-300 border-white/15\",\n accent: \"text-violet-300 border-violet-300/40\",\n destructive: \"text-rose-400 border-rose-300/40\",\n info: \"text-sky-300 border-sky-300/40\",\n success: \"text-emerald-300 border-emerald-300/40\",\n warning: \"text-amber-300 border-amber-300/40\",\n error: \"text-red-300 border-red-300/40\",\n \"gradient-pink-violet\": \"bg-linear-to-r from-pink-400 to-violet-400 bg-clip-text text-transparent\",\n \"gradient-cyan-violet\": \"bg-linear-to-r from-cyan-400 to-violet-400 bg-clip-text text-transparent\",\n \"gradient-cyan-blue\": \"bg-linear-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent\",\n \"gradient-cyan-green\": \"bg-linear-to-r from-cyan-400 to-green-400 bg-clip-text text-transparent\",\n \"gradient-cyan-orange\": \"bg-linear-to-r from-cyan-400 to-orange-400 bg-clip-text text-transparent\",\n \"gradient-cyan-red\": \"bg-linear-to-r from-cyan-400 to-red-400 bg-clip-text text-transparent\",\n \"gradient-cyan-purple\": \"bg-linear-to-r from-cyan-400 to-purple-400 bg-clip-text text-transparent\",\n \"gradient-cyan-pink\": \"bg-linear-to-r from-cyan-400 to-pink-400 bg-clip-text text-transparent\",\n },\n },\n defaultVariants: {\n tone: \"default\",\n },\n});\n\nexport const headingLevelVariants = cva(\"scroll-m-20\", {\n variants: {\n level: {\n 1: \"text-4xl font-bold tracking-tight md:text-5xl\",\n 2: \"text-3xl font-semibold tracking-tight\",\n 3: \"text-2xl font-semibold tracking-tight\",\n 4: \"text-xl font-semibold tracking-tight\",\n 5: \"text-lg font-medium\",\n 6: \"text-base font-medium\",\n },\n },\n});\n\nexport const textSizeVariants = cva(\"\", {\n variants: {\n size: {\n sm: \"text-sm leading-relaxed\",\n base: \"text-base leading-relaxed\",\n lg: \"text-lg leading-relaxed\",\n },\n },\n defaultVariants: {\n size: \"base\",\n },\n});\n\n/** Marker style for unordered lists; ignored when `ordered` is true (decimal numbering). */\nexport const unorderedListMarkerVariants = cva(\"space-y-2 pl-5\", {\n variants: {\n marker: {\n disc: \"list-disc\",\n circle: \"[list-style-type:circle]\",\n none: \"list-none pl-0\",\n },\n },\n defaultVariants: {\n marker: \"disc\",\n },\n});\n\nexport const orderedListVariants = cva(\"list-decimal space-y-2 pl-5\");\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { HeadingProps } from \"./types\";\nimport {\n headingLevelVariants,\n typographyToneVariants,\n} from \"./variants\";\n\nconst HEADING_TAGS = {\n 1: \"h1\",\n 2: \"h2\",\n 3: \"h3\",\n 4: \"h4\",\n 5: \"h5\",\n 6: \"h6\",\n} as const;\n\nexport const HeadingBase = (props: HeadingProps) => {\n const {\n level,\n displayLevel,\n tone,\n bold,\n italic,\n underline,\n strikethrough,\n ref,\n className,\n children,\n ...rest\n } = props;\n\n const Tag = HEADING_TAGS[level];\n const scale = displayLevel ?? level;\n\n return (\n <Tag\n ref={ref}\n data-slot=\"typography-heading\"\n data-level={level}\n className={cn(\n typographyToneVariants({ tone }),\n headingLevelVariants({ level: scale }),\n bold && \"font-bold\",\n italic && \"italic\",\n underline && \"underline underline-offset-4\",\n strikethrough && \"line-through\",\n className,\n )}\n {...rest}\n >\n {children}\n </Tag>\n );\n};\n\nHeadingBase.displayName = \"Heading\";\n","import { HeadingBase } from \"./heading-base\";\nimport type { HeadingProps } from \"./types\";\n\nexport const Heading = (props: HeadingProps) => {\n return <HeadingBase {...props} />;\n};\n\nHeading.displayName = \"Heading\";\n","import { cn } from \"../../lib/utils\";\n\nimport type { TextProps } from \"./types\";\nimport { textSizeVariants, typographyToneVariants } from \"./variants\";\n\nexport const TextBase = (props: TextProps) => {\n const {\n as = \"p\",\n size = \"base\",\n tone,\n bold,\n italic,\n underline,\n strikethrough,\n highlight,\n className,\n children,\n ...rest\n } = props;\n\n const Component = as;\n\n return (\n <Component\n data-slot=\"typography-text\"\n className={cn(\n typographyToneVariants({ tone }),\n textSizeVariants({ size }),\n bold && \"font-semibold\",\n italic && \"italic\",\n underline && \"underline underline-offset-2\",\n strikethrough && \"line-through\",\n highlight && \"rounded bg-amber-400/15 px-0.5\",\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n};\n\nTextBase.displayName = \"Text\";\n","import { TextBase } from \"./text-base\";\nimport type { TextProps } from \"./types\";\n\nexport const Text = (props: TextProps) => {\n return <TextBase {...props} />;\n};\n\nText.displayName = \"Text\";\n","import { cn } from \"../../lib/utils\";\n\nimport type { ListProps, ListItemProps } from \"./types\";\nimport {\n orderedListVariants,\n typographyToneVariants,\n unorderedListMarkerVariants,\n} from \"./variants\";\n\nexport function ListBase(props: ListProps) {\n if (\"ordered\" in props && props.ordered === true) {\n const {\n tone,\n className,\n children,\n ref,\n ordered,\n marker,\n ...rest\n } = props;\n\n void ordered;\n void marker;\n\n return (\n <ol\n ref={ref}\n data-slot=\"typography-list\"\n data-list-type=\"ordered\"\n className={cn(\n typographyToneVariants({ tone }),\n orderedListVariants(),\n className,\n )}\n {...rest}\n >\n {children}\n </ol>\n );\n }\n\n const {\n marker = \"disc\",\n tone,\n className,\n children,\n ref,\n ordered,\n ...rest\n } = props;\n\n void ordered;\n\n return (\n <ul\n ref={ref}\n data-slot=\"typography-list\"\n data-list-type=\"unordered\"\n className={cn(\n typographyToneVariants({ tone }),\n unorderedListMarkerVariants({ marker }),\n className,\n )}\n {...rest}\n >\n {children}\n </ul>\n );\n}\n\nListBase.displayName = \"List\";\n\nexport function ListItemBase(props: ListItemProps) {\n const { className, children, ref, ...rest } = props;\n\n return (\n <li\n ref={ref}\n data-slot=\"typography-list-item\"\n className={cn(\"leading-relaxed\", className)}\n {...rest}\n >\n {children}\n </li>\n );\n}\n\nListItemBase.displayName = \"ListItem\";\n","import type { ListProps } from \"./types\";\n\nimport { ListBase, ListItemBase } from \"./list-base\";\n\nexport const ListItem = ListItemBase;\n\nfunction ListRoot(props: ListProps) {\n return <ListBase {...props} />;\n}\n\nexport const List = Object.assign(ListRoot, {\n Item: ListItem,\n});\n\nListRoot.displayName = \"List\";\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { BlockquoteProps } from \"./types\";\nimport { typographyToneVariants } from \"./variants\";\n\nexport const BlockquoteBase = (props: BlockquoteProps) => {\n const {\n tone,\n attribution,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n return (\n <blockquote\n ref={ref}\n data-slot=\"typography-blockquote\"\n className={cn(\n typographyToneVariants({ tone }),\n \"border-l-4 py-1 pl-4 italic\",\n className,\n )}\n {...rest}\n >\n <div className=\"space-y-2 leading-relaxed\">{children}</div>\n {attribution ? (\n <footer className=\"mt-3 text-sm not-italic\">\n <cite>{attribution}</cite>\n </footer>\n ) : null}\n </blockquote>\n );\n};\n\nBlockquoteBase.displayName = \"Blockquote\";\n","import { BlockquoteBase } from \"./blockquote-base\";\nimport type { BlockquoteProps } from \"./types\";\n\nexport const Blockquote = (props: BlockquoteProps) => {\n return <BlockquoteBase {...props} />;\n};\n\nBlockquote.displayName = \"Blockquote\";\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { InlineCodeProps } from \"./types\";\nimport { typographyToneVariants } from \"./variants\";\n\nexport const InlineCodeBase = (props: InlineCodeProps) => {\n const { tone, className, children, ref, ...rest } = props;\n\n return (\n <code\n ref={ref}\n data-slot=\"typography-inline-code\"\n className={cn(\n typographyToneVariants({ tone }),\n \"rounded-md border border-white/10 bg-white/6 px-1.5 py-0.5 font-mono text-[0.925em] font-normal\",\n className,\n )}\n {...rest}\n >\n {children}\n </code>\n );\n};\n\nInlineCodeBase.displayName = \"InlineCode\";\n","import { InlineCodeBase } from \"./inline-code-base\";\nimport type { InlineCodeProps } from \"./types\";\n\nexport const InlineCode = (props: InlineCodeProps) => {\n return <InlineCodeBase {...props} />;\n};\n\nInlineCode.displayName = \"InlineCode\";\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { CodeBlockProps } from \"./types\";\nimport { typographyToneVariants } from \"./variants\";\n\nexport const CodeBlockBase = (props: CodeBlockProps) => {\n const {\n tone,\n language,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n const ariaLabel = language ? `Code sample (${language})` : \"Code sample\";\n\n return (\n <pre\n ref={ref}\n data-slot=\"typography-code-block\"\n aria-label={ariaLabel}\n className={cn(\n typographyToneVariants({ tone }),\n \"overflow-x-auto rounded-xl border border-white/10 bg-slate-950/80 p-4 text-sm leading-relaxed shadow-inner shadow-slate-950/40\",\n className,\n )}\n {...rest}\n >\n <code className=\"font-mono text-[0.95em] whitespace-pre-wrap wrap-break-word\">{children}</code>\n </pre>\n );\n};\n\nCodeBlockBase.displayName = \"CodeBlock\";\n","import { CodeBlockBase } from \"./code-block-base\";\nimport type { CodeBlockProps } from \"./types\";\n\nexport const CodeBlock = (props: CodeBlockProps) => {\n return <CodeBlockBase {...props} />;\n};\n\nCodeBlock.displayName = \"CodeBlock\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zentauri-ui/zentauri-components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.62",
|
|
4
4
|
"description": "React + Tailwind UI kit with ESM/CJS builds, per-entry exports, and a zentauri-components / zentauri-ui CLI to vendor UI or hook source into your app",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": ["dist", "src/ui", "src/lib", "src/hooks", "cli"],
|
|
@@ -42,4 +42,12 @@ describe("useFocusManagement", () => {
|
|
|
42
42
|
fireEvent.keyDown(window, { key: "Escape" });
|
|
43
43
|
expect(screen.queryByTestId("dialog")).not.toBeInTheDocument();
|
|
44
44
|
});
|
|
45
|
+
|
|
46
|
+
it("should return focus inside the overlay when focus moves outside without Tab", () => {
|
|
47
|
+
render(<Modal initialOpen />);
|
|
48
|
+
const outsideButton = screen.getByTestId("after");
|
|
49
|
+
outsideButton.focus();
|
|
50
|
+
expect(outsideButton).not.toHaveFocus();
|
|
51
|
+
expect(screen.getByRole("button", { name: "first" })).toHaveFocus();
|
|
52
|
+
});
|
|
45
53
|
});
|
|
@@ -1,39 +1,61 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { RefObject } from "react";
|
|
4
|
-
import { useEffect } from "react";
|
|
4
|
+
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
5
5
|
import { useBodyScrollLock } from "../useBodyScrollLock";
|
|
6
6
|
|
|
7
7
|
const FOCUSABLE_SELECTOR =
|
|
8
|
-
|
|
8
|
+
[
|
|
9
|
+
'a[href]',
|
|
10
|
+
'button:not([disabled])',
|
|
11
|
+
'textarea:not([disabled])',
|
|
12
|
+
'input:not([disabled])',
|
|
13
|
+
'select:not([disabled])',
|
|
14
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
15
|
+
].join(", ");
|
|
16
|
+
|
|
17
|
+
function getFocusableElements(
|
|
18
|
+
root: HTMLElement,
|
|
19
|
+
focusableSelector: string,
|
|
20
|
+
): HTMLElement[] {
|
|
21
|
+
return Array.from(
|
|
22
|
+
root.querySelectorAll<HTMLElement>(focusableSelector),
|
|
23
|
+
).filter((element) => {
|
|
24
|
+
if (element.getAttribute("aria-hidden") === "true") {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (typeof window === "undefined") {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const style = getComputedStyle(element);
|
|
31
|
+
if (style.visibility === "hidden" || style.display === "none") {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
9
37
|
|
|
10
38
|
/**
|
|
11
|
-
* Composes modal-like behavior for an open overlay: body scroll lock, Escape to close, and focus
|
|
12
|
-
*
|
|
13
|
-
* - Delegates scroll locking to {@link useBodyScrollLock} while `open` is true.
|
|
14
|
-
* - Listens for `Escape` on `window` and calls `setOpen(false)`.
|
|
15
|
-
* - When `open` becomes true, focuses the first visible focusable inside `contentRef`, or the container itself.
|
|
16
|
-
* - Traps focus within `contentRef` via a capturing `focusin` listener on `document` that redirects focus back inside.
|
|
17
|
-
* - On close/unmount of the open effect, restores focus to the element that was focused before the trap ran.
|
|
18
|
-
*
|
|
19
|
-
* @param params.open - Whether the overlay is visible.
|
|
20
|
-
* @param params.setOpen - Setter used for Escape and cleanup paths.
|
|
21
|
-
* @param params.contentRef - Root of the dialog/drawer content (must point at a focusable container or include focusables).
|
|
22
|
-
* @param params.focusableSelector - Query selector for tabbable elements; defaults to a common interactive set.
|
|
39
|
+
* Composes modal-like behavior for an open overlay: body scroll lock, Escape to close, focus trapping with circular Tab cycling, and restoring focus after close.
|
|
23
40
|
*/
|
|
24
41
|
export const useFocusManagement = ({
|
|
25
42
|
open,
|
|
26
43
|
setOpen,
|
|
27
44
|
contentRef,
|
|
45
|
+
triggerRef,
|
|
28
46
|
focusableSelector = FOCUSABLE_SELECTOR,
|
|
29
47
|
}: {
|
|
30
48
|
open: boolean;
|
|
31
49
|
setOpen: (open: boolean) => void;
|
|
32
|
-
contentRef: RefObject<
|
|
50
|
+
contentRef: RefObject<HTMLElement | null>;
|
|
51
|
+
/** Last modal trigger control; used when focus cannot be inferred at open time. */
|
|
52
|
+
triggerRef?: RefObject<HTMLElement | null>;
|
|
33
53
|
focusableSelector?: string;
|
|
34
54
|
}) => {
|
|
35
55
|
useBodyScrollLock(open);
|
|
36
56
|
|
|
57
|
+
const previousFocusRef = useRef<HTMLElement | null>(null);
|
|
58
|
+
|
|
37
59
|
useEffect(() => {
|
|
38
60
|
if (!open) {
|
|
39
61
|
return;
|
|
@@ -47,31 +69,138 @@ export const useFocusManagement = ({
|
|
|
47
69
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
48
70
|
}, [open, setOpen]);
|
|
49
71
|
|
|
50
|
-
|
|
72
|
+
useLayoutEffect(() => {
|
|
51
73
|
if (!open) {
|
|
52
74
|
return;
|
|
53
75
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
|
|
77
|
+
let cancelled = false;
|
|
78
|
+
let rafId = 0;
|
|
79
|
+
let trapInstalled = false;
|
|
80
|
+
|
|
81
|
+
const detachTrap = () => {
|
|
82
|
+
if (!trapInstalled) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
trapInstalled = false;
|
|
86
|
+
document.removeEventListener("focusin", handleFocusIn, true);
|
|
87
|
+
document.removeEventListener("keydown", handleTabKeyDown, true);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
let trapRoot: HTMLElement | null = null;
|
|
64
91
|
|
|
65
92
|
const handleFocusIn = (event: FocusEvent) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
const node = trapRoot;
|
|
94
|
+
if (!node) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const focused = event.target;
|
|
98
|
+
if (!(focused instanceof Node)) {
|
|
99
|
+
return;
|
|
69
100
|
}
|
|
101
|
+
if (node.contains(focused)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const list = getFocusableElements(node, focusableSelector);
|
|
105
|
+
const redirectTarget = list[0] ?? node;
|
|
106
|
+
redirectTarget.focus({ preventScroll: true });
|
|
70
107
|
};
|
|
71
|
-
|
|
108
|
+
|
|
109
|
+
const handleTabKeyDown = (event: KeyboardEvent) => {
|
|
110
|
+
const node = trapRoot;
|
|
111
|
+
if (!node) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (event.key !== "Tab") {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const list = getFocusableElements(node, focusableSelector);
|
|
118
|
+
if (list.length === 0) {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
node.focus({ preventScroll: true });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const first = list[0];
|
|
124
|
+
const last = list[list.length - 1];
|
|
125
|
+
if (!first || !last) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const activeElement = document.activeElement as HTMLElement | undefined;
|
|
129
|
+
|
|
130
|
+
if (!activeElement || !node.contains(activeElement)) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
(event.shiftKey ? last : first).focus({ preventScroll: true });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (event.shiftKey && activeElement === first) {
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
last.focus({ preventScroll: true });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!event.shiftKey && activeElement === last) {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
first.focus({ preventScroll: true });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const installTrap = () => {
|
|
148
|
+
if (cancelled) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const node = contentRef.current;
|
|
152
|
+
if (!node) {
|
|
153
|
+
rafId = requestAnimationFrame(installTrap);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
trapRoot = node;
|
|
158
|
+
|
|
159
|
+
const active = document.activeElement;
|
|
160
|
+
if (
|
|
161
|
+
active instanceof HTMLElement &&
|
|
162
|
+
active !== document.body &&
|
|
163
|
+
!node.contains(active)
|
|
164
|
+
) {
|
|
165
|
+
previousFocusRef.current = active;
|
|
166
|
+
} else {
|
|
167
|
+
previousFocusRef.current = triggerRef?.current ?? null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const focusables = getFocusableElements(node, focusableSelector);
|
|
171
|
+
const initialFocus = focusables[0] ?? node;
|
|
172
|
+
initialFocus.focus({ preventScroll: true });
|
|
173
|
+
|
|
174
|
+
document.addEventListener("focusin", handleFocusIn, true);
|
|
175
|
+
document.addEventListener("keydown", handleTabKeyDown, true);
|
|
176
|
+
trapInstalled = true;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
installTrap();
|
|
180
|
+
|
|
72
181
|
return () => {
|
|
73
|
-
|
|
74
|
-
|
|
182
|
+
cancelled = true;
|
|
183
|
+
cancelAnimationFrame(rafId);
|
|
184
|
+
detachTrap();
|
|
185
|
+
trapRoot = null;
|
|
186
|
+
|
|
187
|
+
const fallbackTrigger =
|
|
188
|
+
triggerRef?.current &&
|
|
189
|
+
document.body.contains(triggerRef.current) &&
|
|
190
|
+
typeof triggerRef.current.focus === "function"
|
|
191
|
+
? triggerRef.current
|
|
192
|
+
: null;
|
|
193
|
+
|
|
194
|
+
const toRestore = previousFocusRef.current ?? fallbackTrigger;
|
|
195
|
+
previousFocusRef.current = null;
|
|
196
|
+
|
|
197
|
+
if (
|
|
198
|
+
toRestore &&
|
|
199
|
+
typeof toRestore.focus === "function" &&
|
|
200
|
+
document.body.contains(toRestore)
|
|
201
|
+
) {
|
|
202
|
+
toRestore.focus({ preventScroll: true });
|
|
203
|
+
}
|
|
75
204
|
};
|
|
76
|
-
}, [contentRef,
|
|
205
|
+
}, [open, contentRef, triggerRef, focusableSelector]);
|
|
77
206
|
};
|
|
@@ -13,6 +13,7 @@ export function BadgeBase({
|
|
|
13
13
|
size,
|
|
14
14
|
shape,
|
|
15
15
|
closable = false,
|
|
16
|
+
liveRegion = false,
|
|
16
17
|
onClose,
|
|
17
18
|
closeLabel = "Remove",
|
|
18
19
|
children,
|
|
@@ -24,11 +25,13 @@ export function BadgeBase({
|
|
|
24
25
|
const isDot = shape === "dot";
|
|
25
26
|
const resolvedAriaLabel =
|
|
26
27
|
ariaLabel ?? (isDot ? "Status indicator" : undefined);
|
|
28
|
+
const landmarkRole =
|
|
29
|
+
liveRegion === true || isDot ? ("status" as const) : undefined;
|
|
27
30
|
|
|
28
31
|
return (
|
|
29
32
|
<Wrapper
|
|
30
33
|
ref={ref}
|
|
31
|
-
role=
|
|
34
|
+
role={landmarkRole}
|
|
32
35
|
data-slot="badge"
|
|
33
36
|
aria-label={resolvedAriaLabel}
|
|
34
37
|
className={cn(badgeVariants({ appearance, size, shape }), className)}
|
package/src/ui/badge/types.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface BadgeBaseProps extends ComponentPropsWithRef<"span"> {
|
|
|
15
15
|
size?: BadgeVariantProps["size"];
|
|
16
16
|
shape?: BadgeVariantProps["shape"];
|
|
17
17
|
closable?: boolean;
|
|
18
|
+
liveRegion?: boolean;
|
|
18
19
|
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
19
20
|
closeLabel?: string;
|
|
20
21
|
children?: ReactNode;
|
package/src/ui/badge/variants.ts
CHANGED
|
@@ -7,19 +7,19 @@ import { cva } from "class-variance-authority";
|
|
|
7
7
|
export const buttonLikeSolidAppearances = {
|
|
8
8
|
default: "bg-slate-50 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.12)]",
|
|
9
9
|
secondary: "bg-slate-800 text-slate-50",
|
|
10
|
-
destructive: "bg-rose-
|
|
10
|
+
destructive: "bg-rose-700 text-white",
|
|
11
11
|
outline: "border border-white/10 bg-white/5 text-slate-50",
|
|
12
12
|
ghost: "bg-transparent text-slate-200",
|
|
13
13
|
glass: "border border-white/15 bg-white/10 text-white backdrop-blur-md",
|
|
14
|
-
emerald: "bg-emerald-
|
|
14
|
+
emerald: "bg-emerald-800 text-white",
|
|
15
15
|
indigo: "bg-indigo-600 text-white",
|
|
16
16
|
purple: "bg-purple-600 text-white",
|
|
17
17
|
pink: "bg-pink-600 text-white",
|
|
18
|
-
rose: "bg-rose-
|
|
19
|
-
sky: "bg-sky-
|
|
20
|
-
teal: "bg-teal-
|
|
21
|
-
yellow: "bg-yellow-
|
|
22
|
-
orange: "bg-orange-
|
|
18
|
+
rose: "bg-rose-700 text-white",
|
|
19
|
+
sky: "bg-sky-700 text-white",
|
|
20
|
+
teal: "bg-teal-700 text-white",
|
|
21
|
+
yellow: "bg-yellow-800 text-white",
|
|
22
|
+
orange: "bg-orange-800 text-white",
|
|
23
23
|
"gradient-blue": "bg-gradient-to-r from-blue-600 to-purple-600 text-white",
|
|
24
24
|
"gradient-green": "bg-gradient-to-r from-green-600 to-lime-600 text-white",
|
|
25
25
|
"gradient-red": "bg-gradient-to-r from-red-600 to-pink-600 text-white",
|
|
@@ -129,7 +129,7 @@ describe("Button (component library)", () => {
|
|
|
129
129
|
expect(
|
|
130
130
|
root.className,
|
|
131
131
|
"Destructive appearance must surface danger styling",
|
|
132
|
-
).toMatch(/bg-rose-
|
|
132
|
+
).toMatch(/bg-rose-700/);
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
it("should apply outline appearance when appearance='outline'", () => {
|
|
@@ -14,24 +14,24 @@ export const buttonVariants = cva(
|
|
|
14
14
|
default:
|
|
15
15
|
"bg-slate-50 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.12)] hover:bg-white",
|
|
16
16
|
secondary: "bg-slate-800 text-slate-50 hover:bg-slate-700",
|
|
17
|
-
destructive: "bg-rose-
|
|
17
|
+
destructive: "bg-rose-700 text-white hover:bg-rose-800",
|
|
18
18
|
outline:
|
|
19
19
|
"border border-white/10 bg-white/5 text-slate-50 hover:bg-white/10",
|
|
20
20
|
ghost: "bg-transparent text-slate-200 hover:bg-white/5",
|
|
21
21
|
link: "bg-transparent text-cyan-300 underline-offset-4 hover:underline",
|
|
22
22
|
glass:
|
|
23
23
|
"border border-white/15 bg-white/10 text-white backdrop-blur-md hover:bg-white/15",
|
|
24
|
-
emerald: "bg-emerald-
|
|
24
|
+
emerald: "bg-emerald-800 text-white hover:bg-emerald-900",
|
|
25
25
|
indigo: "bg-indigo-600 text-white hover:bg-indigo-600",
|
|
26
26
|
purple: "bg-purple-600 text-white hover:bg-purple-600",
|
|
27
27
|
pink: "bg-pink-600 text-white hover:bg-pink-600",
|
|
28
28
|
rose: "bg-rose-600 text-white hover:bg-rose-600",
|
|
29
|
-
sky: "bg-sky-
|
|
30
|
-
teal: "bg-teal-
|
|
31
|
-
yellow: "bg-yellow-
|
|
32
|
-
orange: "bg-orange-
|
|
33
|
-
gray: "bg-gray-
|
|
34
|
-
amber: "bg-amber-
|
|
29
|
+
sky: "bg-sky-700 text-white hover:bg-sky-800",
|
|
30
|
+
teal: "bg-teal-700 text-white hover:bg-teal-800",
|
|
31
|
+
yellow: "bg-yellow-800 text-white hover:bg-yellow-900",
|
|
32
|
+
orange: "bg-orange-800 text-white hover:bg-orange-900",
|
|
33
|
+
gray: "bg-gray-700 text-white hover:bg-gray-800",
|
|
34
|
+
amber: "bg-amber-800 text-white hover:bg-amber-900",
|
|
35
35
|
violet: "bg-violet-600 text-white hover:bg-violet-600",
|
|
36
36
|
"gradient-blue":
|
|
37
37
|
"bg-gradient-to-r from-blue-600 to-purple-600 text-white hover:from-blue-600 hover:to-purple-600",
|
|
@@ -26,7 +26,7 @@ export function DrawerContentAnimated({
|
|
|
26
26
|
id,
|
|
27
27
|
style,
|
|
28
28
|
}: DrawerContentAnimatedProps) {
|
|
29
|
-
const { open, setOpen, titleId, descriptionId, contentRef } =
|
|
29
|
+
const { open, setOpen, titleId, descriptionId, contentRef, triggerRef } =
|
|
30
30
|
useDrawerContext("DrawerContent");
|
|
31
31
|
const resolvedSide = side ?? "right";
|
|
32
32
|
const reduceMotion = useReducedMotion();
|
|
@@ -39,6 +39,7 @@ export function DrawerContentAnimated({
|
|
|
39
39
|
open,
|
|
40
40
|
setOpen,
|
|
41
41
|
contentRef,
|
|
42
|
+
triggerRef,
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
@@ -50,10 +51,8 @@ export function DrawerContentAnimated({
|
|
|
50
51
|
<AnimatePresence>
|
|
51
52
|
{open ? (
|
|
52
53
|
<div className="fixed inset-0 z-50" data-slot="drawer-portal">
|
|
53
|
-
<motion.
|
|
54
|
-
|
|
55
|
-
aria-hidden
|
|
56
|
-
tabIndex={-1}
|
|
54
|
+
<motion.div
|
|
55
|
+
role="presentation"
|
|
57
56
|
data-slot="drawer-overlay"
|
|
58
57
|
className={drawerOverlayVariants()}
|
|
59
58
|
onClick={() => setOpen(false)}
|
|
@@ -62,6 +62,7 @@ export function Drawer({
|
|
|
62
62
|
const titleId = `${baseId}-title`;
|
|
63
63
|
const descriptionId = `${baseId}-description`;
|
|
64
64
|
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
65
|
+
const triggerRef = useRef<HTMLElement | null>(null);
|
|
65
66
|
|
|
66
67
|
const ctx = useMemo(
|
|
67
68
|
() => ({
|
|
@@ -70,6 +71,7 @@ export function Drawer({
|
|
|
70
71
|
titleId,
|
|
71
72
|
descriptionId,
|
|
72
73
|
contentRef,
|
|
74
|
+
triggerRef,
|
|
73
75
|
}),
|
|
74
76
|
[descriptionId, resolvedOpen, setOpen, titleId],
|
|
75
77
|
);
|
|
@@ -86,13 +88,20 @@ export function DrawerTrigger({
|
|
|
86
88
|
children,
|
|
87
89
|
appearance,
|
|
88
90
|
onClick,
|
|
89
|
-
ref,
|
|
91
|
+
ref: refProp,
|
|
90
92
|
...rest
|
|
91
93
|
}: DrawerTriggerProps) {
|
|
92
|
-
const { setOpen } = useDrawerContext("DrawerTrigger");
|
|
94
|
+
const { setOpen, triggerRef } = useDrawerContext("DrawerTrigger");
|
|
93
95
|
return (
|
|
94
96
|
<button
|
|
95
|
-
ref={
|
|
97
|
+
ref={(node) => {
|
|
98
|
+
triggerRef.current = node;
|
|
99
|
+
if (typeof refProp === "function") {
|
|
100
|
+
refProp(node);
|
|
101
|
+
} else if (refProp) {
|
|
102
|
+
(refProp as RefObject<HTMLButtonElement | null>).current = node;
|
|
103
|
+
}
|
|
104
|
+
}}
|
|
96
105
|
type="button"
|
|
97
106
|
data-slot="drawer-trigger"
|
|
98
107
|
className={cn(drawerTriggerVariants({ appearance }), className)}
|
|
@@ -121,7 +130,7 @@ export function DrawerContent({
|
|
|
121
130
|
id,
|
|
122
131
|
style,
|
|
123
132
|
}: DrawerContentProps) {
|
|
124
|
-
const { open, setOpen, titleId, descriptionId, contentRef } =
|
|
133
|
+
const { open, setOpen, titleId, descriptionId, contentRef, triggerRef } =
|
|
125
134
|
useDrawerContext("DrawerContent");
|
|
126
135
|
const resolvedSide = side ?? "right";
|
|
127
136
|
|
|
@@ -129,6 +138,7 @@ export function DrawerContent({
|
|
|
129
138
|
open,
|
|
130
139
|
setOpen,
|
|
131
140
|
contentRef,
|
|
141
|
+
triggerRef,
|
|
132
142
|
});
|
|
133
143
|
|
|
134
144
|
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
@@ -139,10 +149,8 @@ export function DrawerContent({
|
|
|
139
149
|
return createPortal(
|
|
140
150
|
open ? (
|
|
141
151
|
<div className="fixed inset-0 z-50" data-slot="drawer-portal">
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
aria-hidden
|
|
145
|
-
tabIndex={-1}
|
|
152
|
+
<div
|
|
153
|
+
role="presentation"
|
|
146
154
|
data-slot="drawer-overlay"
|
|
147
155
|
className={drawerOverlayVariants()}
|
|
148
156
|
onClick={() => setOpen(false)}
|
package/src/ui/drawer/types.ts
CHANGED
|
@@ -104,9 +104,7 @@ describe("Dropdown", () => {
|
|
|
104
104
|
</DropdownContent>
|
|
105
105
|
</Dropdown>,
|
|
106
106
|
);
|
|
107
|
-
const item = screen
|
|
108
|
-
.getByText("Alpha")
|
|
109
|
-
.closest('div[tabindex="0"]') as HTMLElement;
|
|
107
|
+
const item = screen.getByRole("menuitem", { name: "Alpha" });
|
|
110
108
|
item.focus();
|
|
111
109
|
fireEvent.keyDown(item, { key: "Enter" });
|
|
112
110
|
expect(handleSelect).toHaveBeenCalledTimes(1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { createContext, useContext, useState, useRef, useEffect } from "react";
|
|
3
|
+
import { createContext, useContext, useState, useRef, useEffect, useId } from "react";
|
|
4
4
|
import { FiCheck } from "react-icons/fi";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
import type {
|
|
@@ -34,6 +34,7 @@ export const Dropdown = ({
|
|
|
34
34
|
onOpenChange,
|
|
35
35
|
multiSelect = false,
|
|
36
36
|
}: DropdownProps) => {
|
|
37
|
+
const menuId = `${useId()}-menu`;
|
|
37
38
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
38
39
|
const [selectedValues, setSelectedValues] = useState<string[]>([]);
|
|
39
40
|
|
|
@@ -70,6 +71,7 @@ export const Dropdown = ({
|
|
|
70
71
|
selectedValues,
|
|
71
72
|
toggleSelect,
|
|
72
73
|
multiSelect,
|
|
74
|
+
menuId,
|
|
73
75
|
}}
|
|
74
76
|
>
|
|
75
77
|
<div className="relative inline-block">{children}</div>
|
|
@@ -85,15 +87,25 @@ export const DropdownTrigger = ({
|
|
|
85
87
|
className,
|
|
86
88
|
variant,
|
|
87
89
|
size,
|
|
90
|
+
onClick,
|
|
88
91
|
...props
|
|
89
92
|
}: DropdownTriggerProps) => {
|
|
90
|
-
const { toggle } = useDropdown();
|
|
93
|
+
const { toggle, open, menuId } = useDropdown();
|
|
91
94
|
|
|
92
95
|
return (
|
|
93
96
|
<button
|
|
94
|
-
|
|
97
|
+
type="button"
|
|
98
|
+
aria-expanded={open}
|
|
99
|
+
aria-haspopup="menu"
|
|
100
|
+
aria-controls={menuId}
|
|
95
101
|
className={cn(triggerVariants({ variant, size }), className)}
|
|
96
102
|
{...props}
|
|
103
|
+
onClick={(event) => {
|
|
104
|
+
onClick?.(event);
|
|
105
|
+
if (!event.defaultPrevented) {
|
|
106
|
+
toggle();
|
|
107
|
+
}
|
|
108
|
+
}}
|
|
97
109
|
>
|
|
98
110
|
{children}
|
|
99
111
|
</button>
|
|
@@ -111,7 +123,7 @@ export const DropdownContent = ({
|
|
|
111
123
|
divider,
|
|
112
124
|
...props
|
|
113
125
|
}: DropdownContentProps) => {
|
|
114
|
-
const { open, setOpen } = useDropdown();
|
|
126
|
+
const { open, setOpen, menuId } = useDropdown();
|
|
115
127
|
const ref = useRef<HTMLDivElement>(null);
|
|
116
128
|
|
|
117
129
|
// click outside
|
|
@@ -122,6 +134,8 @@ export const DropdownContent = ({
|
|
|
122
134
|
return (
|
|
123
135
|
<div
|
|
124
136
|
ref={ref}
|
|
137
|
+
id={menuId}
|
|
138
|
+
role="menu"
|
|
125
139
|
className={cn(
|
|
126
140
|
contentVariants({ placement, spacing }),
|
|
127
141
|
className,
|
|
@@ -157,10 +171,14 @@ export const DropdownItem = ({
|
|
|
157
171
|
|
|
158
172
|
return (
|
|
159
173
|
<div
|
|
174
|
+
role="menuitem"
|
|
160
175
|
tabIndex={0}
|
|
161
176
|
onClick={handleClick}
|
|
162
177
|
onKeyDown={(e) => {
|
|
163
|
-
if (e.key === "Enter")
|
|
178
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
handleClick();
|
|
181
|
+
}
|
|
164
182
|
}}
|
|
165
183
|
className={cn(itemVariants({ variant }), className)}
|
|
166
184
|
{...props}
|
package/src/ui/dropdown/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
|
|
3
3
|
export const triggerVariants = cva(
|
|
4
|
-
"inline-flex items-center justify-between rounded-md font-medium transition focus:outline-none cursor-pointer",
|
|
4
|
+
"inline-flex items-center justify-between rounded-md font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-500/60 cursor-pointer",
|
|
5
5
|
{
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
@@ -81,7 +81,7 @@ export const contentVariants = cva(
|
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
export const itemVariants = cva(
|
|
84
|
-
"flex items-center justify-between px-3 py-2 text-sm cursor-pointer rounded-md transition-colors",
|
|
84
|
+
"flex items-center justify-between px-3 py-2 text-sm cursor-pointer rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-500/60",
|
|
85
85
|
{
|
|
86
86
|
variants: {
|
|
87
87
|
variant: {
|
|
@@ -25,17 +25,25 @@ export function EmptyStateBase(props: EmptyStateProps) {
|
|
|
25
25
|
align,
|
|
26
26
|
children,
|
|
27
27
|
ref,
|
|
28
|
+
liveRegion = false,
|
|
28
29
|
as: Wrapper = "section",
|
|
29
30
|
...rest
|
|
30
31
|
} = props;
|
|
31
32
|
const ctx = useMemo(() => size ?? "md", [size]);
|
|
32
33
|
|
|
34
|
+
const liveAria =
|
|
35
|
+
typeof liveRegion === "string"
|
|
36
|
+
? liveRegion
|
|
37
|
+
: liveRegion === true
|
|
38
|
+
? "polite"
|
|
39
|
+
: undefined;
|
|
40
|
+
|
|
33
41
|
return (
|
|
34
42
|
<EmptyStateSizeContext.Provider value={ctx}>
|
|
35
43
|
<Wrapper
|
|
36
44
|
ref={ref}
|
|
37
45
|
data-slot="empty-state"
|
|
38
|
-
aria-live=
|
|
46
|
+
aria-live={liveAria}
|
|
39
47
|
className={cn(
|
|
40
48
|
emptyStateVariants({ size, appearance, align }),
|
|
41
49
|
className,
|