@krizaka/ui 2.0.0-beta.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -28
- package/dist/{button-D5aSsmxX.d.ts → button-Cgfkg_3y.d.ts} +5 -1
- package/dist/button.d.ts +5 -1
- package/dist/button.js +4 -2
- package/dist/button.js.map +1 -1
- package/dist/card.d.ts +7 -1
- package/dist/card.js +2 -2
- package/dist/card.js.map +1 -1
- package/dist/{chunk-IUGBKMJC.js → chunk-FHYZSO2S.js} +2 -2
- package/dist/{chunk-6DJ6SQY3.js → chunk-PESA2R4U.js} +5 -3
- package/dist/chunk-PESA2R4U.js.map +1 -0
- package/dist/command.d.ts +11 -2
- package/dist/command.js +17 -6
- package/dist/command.js.map +1 -1
- package/dist/confirm-button.d.ts +1 -1
- package/dist/confirm-button.js +1 -1
- package/dist/countdown.d.ts +7 -6
- package/dist/countdown.js +12 -8
- package/dist/countdown.js.map +1 -1
- package/dist/dialog.js +2 -2
- package/dist/dropdown-menu.js +3 -3
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/field.js +2 -2
- package/dist/field.js.map +1 -1
- package/dist/native.d.ts +56 -6
- package/dist/native.js +129 -85
- package/dist/native.js.map +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/package.json +11 -11
- package/registry/alert.json +141 -3
- package/registry/avatar.json +314 -3
- package/registry/badge.json +233 -3
- package/registry/button.json +522 -8
- package/registry/card.json +427 -4
- package/registry/checkbox.json +127 -3
- package/registry/chip.json +394 -3
- package/registry/cn.json +51 -3
- package/registry/command.json +246 -5
- package/registry/confirm-button.json +172 -5
- package/registry/countdown.json +318 -7
- package/registry/dialog.json +310 -3
- package/registry/dropdown-menu.json +117 -4
- package/registry/empty-state.json +170 -3
- package/registry/examples/alert/danger.d.ts +4 -0
- package/registry/examples/alert/danger.js +22 -0
- package/registry/examples/alert/danger.tsx +25 -0
- package/registry/examples/alert/info.d.ts +4 -0
- package/registry/{demos/alert.js → examples/alert/info.js} +3 -3
- package/registry/{demos/alert.tsx → examples/alert/info.tsx} +1 -1
- package/registry/examples/alert/success.d.ts +4 -0
- package/registry/examples/alert/success.js +12 -0
- package/registry/examples/alert/success.tsx +15 -0
- package/registry/examples/alert/title-only.d.ts +4 -0
- package/registry/examples/alert/title-only.js +11 -0
- package/registry/examples/alert/title-only.tsx +5 -0
- package/registry/examples/alert/warning.d.ts +4 -0
- package/registry/examples/alert/warning.js +13 -0
- package/registry/examples/alert/warning.tsx +17 -0
- package/registry/examples/avatar/fallback.d.ts +4 -0
- package/registry/examples/avatar/fallback.js +11 -0
- package/registry/examples/avatar/fallback.tsx +6 -0
- package/registry/examples/avatar/group.d.ts +4 -0
- package/registry/examples/avatar/group.js +20 -0
- package/registry/examples/avatar/group.tsx +21 -0
- package/registry/examples/avatar/native/group.d.ts +4 -0
- package/registry/examples/avatar/native/group.dark.png +0 -0
- package/registry/examples/avatar/native/group.js +17 -0
- package/registry/examples/avatar/native/group.light.png +0 -0
- package/registry/examples/avatar/native/group.tsx +13 -0
- package/registry/examples/avatar/native/sizes.d.ts +4 -0
- package/registry/examples/avatar/native/sizes.dark.png +0 -0
- package/registry/examples/avatar/native/sizes.js +18 -0
- package/registry/examples/avatar/native/sizes.light.png +0 -0
- package/registry/examples/avatar/native/sizes.tsx +15 -0
- package/registry/examples/avatar/sizes.d.ts +4 -0
- package/registry/examples/avatar/sizes.js +17 -0
- package/registry/examples/avatar/sizes.tsx +13 -0
- package/registry/examples/avatar/with-image.d.ts +4 -0
- package/registry/{demos/avatar.js → examples/avatar/with-image.js} +3 -3
- package/registry/{demos/avatar.tsx → examples/avatar/with-image.tsx} +1 -1
- package/registry/examples/badge/accent.d.ts +4 -0
- package/registry/examples/badge/accent.js +11 -0
- package/registry/examples/badge/accent.tsx +9 -0
- package/registry/examples/badge/danger.d.ts +4 -0
- package/registry/examples/badge/danger.js +11 -0
- package/registry/examples/badge/danger.tsx +9 -0
- package/registry/examples/badge/medium.d.ts +4 -0
- package/registry/examples/badge/medium.js +11 -0
- package/registry/examples/badge/medium.tsx +9 -0
- package/registry/examples/badge/native/dot.d.ts +4 -0
- package/registry/examples/badge/native/dot.dark.png +0 -0
- package/registry/examples/badge/native/dot.js +15 -0
- package/registry/examples/badge/native/dot.light.png +0 -0
- package/registry/examples/badge/native/dot.tsx +16 -0
- package/registry/examples/badge/native/scrim.d.ts +4 -0
- package/registry/examples/badge/native/scrim.dark.png +0 -0
- package/registry/examples/badge/native/scrim.js +13 -0
- package/registry/examples/badge/native/scrim.light.png +0 -0
- package/registry/examples/badge/native/scrim.tsx +14 -0
- package/registry/examples/badge/native/tones.d.ts +4 -0
- package/registry/examples/badge/native/tones.dark.png +0 -0
- package/registry/examples/badge/native/tones.js +18 -0
- package/registry/examples/badge/native/tones.light.png +0 -0
- package/registry/examples/badge/native/tones.tsx +14 -0
- package/registry/examples/badge/neutral.d.ts +4 -0
- package/registry/{demos/badge.js → examples/badge/neutral.js} +3 -3
- package/registry/{demos/badge.tsx → examples/badge/neutral.tsx} +1 -1
- package/registry/examples/badge/scrim.d.ts +4 -0
- package/registry/examples/badge/scrim.js +11 -0
- package/registry/examples/badge/scrim.tsx +10 -0
- package/registry/examples/badge/success.d.ts +4 -0
- package/registry/examples/badge/success.js +11 -0
- package/registry/examples/badge/success.tsx +9 -0
- package/registry/examples/badge/warning.d.ts +4 -0
- package/registry/examples/badge/warning.js +11 -0
- package/registry/examples/badge/warning.tsx +9 -0
- package/registry/examples/button/as-child-link.d.ts +4 -0
- package/registry/examples/button/as-child-link.js +11 -0
- package/registry/examples/button/as-child-link.tsx +10 -0
- package/registry/examples/button/danger.d.ts +4 -0
- package/registry/examples/button/danger.js +11 -0
- package/registry/examples/button/danger.tsx +5 -0
- package/registry/examples/button/disabled.d.ts +4 -0
- package/registry/examples/button/disabled.js +11 -0
- package/registry/examples/button/disabled.tsx +9 -0
- package/registry/examples/button/ghost.d.ts +4 -0
- package/registry/examples/button/ghost.js +11 -0
- package/registry/examples/button/ghost.tsx +5 -0
- package/registry/examples/button/gradient.d.ts +4 -0
- package/registry/examples/button/gradient.js +11 -0
- package/registry/examples/button/gradient.tsx +5 -0
- package/registry/examples/button/icon.d.ts +4 -0
- package/registry/examples/button/icon.js +14 -0
- package/registry/examples/button/icon.tsx +18 -0
- package/registry/examples/button/loading.d.ts +4 -0
- package/registry/examples/button/loading.js +11 -0
- package/registry/examples/button/loading.tsx +10 -0
- package/registry/examples/button/native/danger.d.ts +4 -0
- package/registry/examples/button/native/danger.dark.png +0 -0
- package/registry/examples/button/native/danger.js +12 -0
- package/registry/examples/button/native/danger.light.png +0 -0
- package/registry/examples/button/native/danger.tsx +5 -0
- package/registry/examples/button/native/disabled.d.ts +4 -0
- package/registry/examples/button/native/disabled.dark.png +0 -0
- package/registry/examples/button/native/disabled.js +11 -0
- package/registry/examples/button/native/disabled.light.png +0 -0
- package/registry/examples/button/native/disabled.tsx +5 -0
- package/registry/examples/button/native/ghost.d.ts +4 -0
- package/registry/examples/button/native/ghost.dark.png +0 -0
- package/registry/examples/button/native/ghost.js +12 -0
- package/registry/examples/button/native/ghost.light.png +0 -0
- package/registry/examples/button/native/ghost.tsx +5 -0
- package/registry/examples/button/native/gradient.d.ts +4 -0
- package/registry/examples/button/native/gradient.dark.png +0 -0
- package/registry/examples/button/native/gradient.js +12 -0
- package/registry/examples/button/native/gradient.light.png +0 -0
- package/registry/examples/button/native/gradient.tsx +5 -0
- package/registry/examples/button/native/icon-only.d.ts +4 -0
- package/registry/examples/button/native/icon-only.dark.png +0 -0
- package/registry/examples/button/native/icon-only.js +19 -0
- package/registry/examples/button/native/icon-only.light.png +0 -0
- package/registry/examples/button/native/icon-only.tsx +21 -0
- package/registry/examples/button/native/icon.d.ts +4 -0
- package/registry/examples/button/native/icon.dark.png +0 -0
- package/registry/examples/button/native/icon.js +16 -0
- package/registry/examples/button/native/icon.light.png +0 -0
- package/registry/examples/button/native/icon.tsx +15 -0
- package/registry/examples/button/native/loading.d.ts +4 -0
- package/registry/examples/button/native/loading.dark.png +0 -0
- package/registry/examples/button/native/loading.js +11 -0
- package/registry/examples/button/native/loading.light.png +0 -0
- package/registry/examples/button/native/loading.tsx +6 -0
- package/registry/examples/button/native/outline.d.ts +4 -0
- package/registry/examples/button/native/outline.dark.png +0 -0
- package/registry/examples/button/native/outline.js +12 -0
- package/registry/examples/button/native/outline.light.png +0 -0
- package/registry/examples/button/native/outline.tsx +5 -0
- package/registry/examples/button/native/primary.d.ts +4 -0
- package/registry/examples/button/native/primary.dark.png +0 -0
- package/registry/examples/button/native/primary.js +12 -0
- package/registry/examples/button/native/primary.light.png +0 -0
- package/registry/examples/button/native/primary.tsx +5 -0
- package/registry/examples/button/native/secondary.d.ts +4 -0
- package/registry/examples/button/native/secondary.dark.png +0 -0
- package/registry/examples/button/native/secondary.js +12 -0
- package/registry/examples/button/native/secondary.light.png +0 -0
- package/registry/examples/button/native/secondary.tsx +6 -0
- package/registry/examples/button/native/sizes.d.ts +4 -0
- package/registry/examples/button/native/sizes.dark.png +0 -0
- package/registry/examples/button/native/sizes.js +15 -0
- package/registry/examples/button/native/sizes.light.png +0 -0
- package/registry/examples/button/native/sizes.tsx +11 -0
- package/registry/examples/button/outline.d.ts +4 -0
- package/registry/examples/button/outline.js +11 -0
- package/registry/examples/button/outline.tsx +5 -0
- package/registry/examples/button/pill.d.ts +4 -0
- package/registry/examples/button/pill.js +11 -0
- package/registry/examples/button/pill.tsx +9 -0
- package/registry/examples/button/primary.d.ts +4 -0
- package/registry/{demos/button.js → examples/button/primary.js} +3 -3
- package/registry/{demos/button.tsx → examples/button/primary.tsx} +1 -1
- package/registry/examples/button/secondary.d.ts +4 -0
- package/registry/examples/button/secondary.js +11 -0
- package/registry/examples/button/secondary.tsx +6 -0
- package/registry/examples/button/sizes.d.ts +4 -0
- package/registry/examples/button/sizes.js +15 -0
- package/registry/examples/button/sizes.tsx +17 -0
- package/registry/examples/card/interactive-link.d.ts +4 -0
- package/registry/examples/card/interactive-link.js +15 -0
- package/registry/examples/card/interactive-link.tsx +16 -0
- package/registry/examples/card/media-card.d.ts +4 -0
- package/registry/{demos/card.js → examples/card/media-card.js} +3 -3
- package/registry/{demos/card.tsx → examples/card/media-card.tsx} +1 -1
- package/registry/examples/card/media-fallback.d.ts +4 -0
- package/registry/examples/card/media-fallback.js +18 -0
- package/registry/examples/card/media-fallback.tsx +22 -0
- package/registry/examples/card/native/body.d.ts +4 -0
- package/registry/examples/card/native/body.dark.png +0 -0
- package/registry/examples/card/native/body.js +15 -0
- package/registry/examples/card/native/body.light.png +0 -0
- package/registry/examples/card/native/body.tsx +13 -0
- package/registry/examples/card/native/default.d.ts +4 -0
- package/registry/examples/card/native/default.dark.png +0 -0
- package/registry/examples/card/native/default.js +24 -0
- package/registry/examples/card/native/default.light.png +0 -0
- package/registry/examples/card/native/default.tsx +28 -0
- package/registry/examples/card/native/elevated.d.ts +4 -0
- package/registry/examples/card/native/elevated.dark.png +0 -0
- package/registry/examples/card/native/elevated.js +24 -0
- package/registry/examples/card/native/elevated.light.png +0 -0
- package/registry/examples/card/native/elevated.tsx +28 -0
- package/registry/examples/card/native/pressable.d.ts +4 -0
- package/registry/examples/card/native/pressable.dark.png +0 -0
- package/registry/examples/card/native/pressable.js +15 -0
- package/registry/examples/card/native/pressable.light.png +0 -0
- package/registry/examples/card/native/pressable.tsx +13 -0
- package/registry/examples/card/reveal-grid.d.ts +4 -0
- package/registry/examples/card/reveal-grid.js +28 -0
- package/registry/examples/card/reveal-grid.tsx +31 -0
- package/registry/examples/card/stat-card.d.ts +4 -0
- package/registry/examples/card/stat-card.js +18 -0
- package/registry/examples/card/stat-card.tsx +17 -0
- package/registry/examples/checkbox/checked.d.ts +4 -0
- package/registry/examples/checkbox/checked.js +11 -0
- package/registry/examples/checkbox/checked.tsx +5 -0
- package/registry/examples/checkbox/disabled.d.ts +4 -0
- package/registry/examples/checkbox/disabled.js +14 -0
- package/registry/examples/checkbox/disabled.tsx +12 -0
- package/registry/examples/checkbox/indeterminate.d.ts +4 -0
- package/registry/examples/checkbox/indeterminate.js +11 -0
- package/registry/examples/checkbox/indeterminate.tsx +6 -0
- package/registry/examples/checkbox/invalid.d.ts +4 -0
- package/registry/examples/checkbox/invalid.js +15 -0
- package/registry/examples/checkbox/invalid.tsx +14 -0
- package/registry/examples/checkbox/unchecked.d.ts +4 -0
- package/registry/{demos/checkbox.js → examples/checkbox/unchecked.js} +3 -3
- package/registry/{demos/checkbox.tsx → examples/checkbox/unchecked.tsx} +2 -1
- package/registry/examples/chip/multiple.d.ts +4 -0
- package/registry/examples/chip/multiple.js +16 -0
- package/registry/examples/chip/multiple.tsx +12 -0
- package/registry/examples/chip/native/multiple.d.ts +4 -0
- package/registry/examples/chip/native/multiple.dark.png +0 -0
- package/registry/examples/chip/native/multiple.js +18 -0
- package/registry/examples/chip/native/multiple.light.png +0 -0
- package/registry/examples/chip/native/multiple.tsx +17 -0
- package/registry/examples/chip/native/removable.d.ts +4 -0
- package/registry/examples/chip/native/removable.dark.png +0 -0
- package/registry/examples/chip/native/removable.js +17 -0
- package/registry/examples/chip/native/removable.light.png +0 -0
- package/registry/examples/chip/native/removable.tsx +15 -0
- package/registry/examples/chip/native/single.d.ts +4 -0
- package/registry/examples/chip/native/single.dark.png +0 -0
- package/registry/examples/chip/native/single.js +15 -0
- package/registry/examples/chip/native/single.light.png +0 -0
- package/registry/examples/chip/native/single.tsx +11 -0
- package/registry/examples/chip/native/toggle.d.ts +4 -0
- package/registry/examples/chip/native/toggle.dark.png +0 -0
- package/registry/examples/chip/native/toggle.js +17 -0
- package/registry/examples/chip/native/toggle.light.png +0 -0
- package/registry/examples/chip/native/toggle.tsx +16 -0
- package/registry/examples/chip/removable.d.ts +4 -0
- package/registry/examples/chip/removable.js +16 -0
- package/registry/examples/chip/removable.tsx +15 -0
- package/registry/examples/chip/single.d.ts +4 -0
- package/registry/examples/chip/single.js +16 -0
- package/registry/examples/chip/single.tsx +13 -0
- package/registry/examples/chip/small.d.ts +4 -0
- package/registry/examples/chip/small.js +16 -0
- package/registry/examples/chip/small.tsx +12 -0
- package/registry/examples/chip/toggle.d.ts +4 -0
- package/registry/{demos/chip.js → examples/chip/toggle.js} +3 -3
- package/registry/{demos/chip.tsx → examples/chip/toggle.tsx} +2 -1
- package/registry/examples/cn/merge.d.ts +4 -0
- package/registry/{demos/cn.js → examples/cn/merge.js} +3 -3
- package/registry/{demos/cn.tsx → examples/cn/merge.tsx} +1 -1
- package/registry/examples/command/dialog.d.ts +4 -0
- package/registry/examples/command/dialog.js +39 -0
- package/registry/examples/command/dialog.tsx +35 -0
- package/registry/examples/command/inline.d.ts +4 -0
- package/registry/{demos/command.js → examples/command/inline.js} +4 -5
- package/registry/{demos/command.tsx → examples/command/inline.tsx} +2 -3
- package/registry/examples/command/no-results.d.ts +4 -0
- package/registry/examples/command/no-results.js +19 -0
- package/registry/examples/command/no-results.tsx +20 -0
- package/registry/examples/confirm-button/armed.d.ts +4 -0
- package/registry/examples/confirm-button/armed.js +12 -0
- package/registry/examples/confirm-button/armed.tsx +14 -0
- package/registry/examples/confirm-button/idle.d.ts +4 -0
- package/registry/{demos/confirm-button.js → examples/confirm-button/idle.js} +3 -3
- package/registry/{demos/confirm-button.tsx → examples/confirm-button/idle.tsx} +1 -1
- package/registry/examples/confirm-button/with-text.d.ts +4 -0
- package/registry/examples/confirm-button/with-text.js +12 -0
- package/registry/examples/confirm-button/with-text.tsx +12 -0
- package/registry/examples/countdown/days.d.ts +4 -0
- package/registry/examples/countdown/days.js +13 -0
- package/registry/examples/countdown/days.tsx +10 -0
- package/registry/examples/countdown/ended.d.ts +4 -0
- package/registry/examples/countdown/ended.js +13 -0
- package/registry/examples/countdown/ended.tsx +10 -0
- package/registry/examples/countdown/hours.d.ts +4 -0
- package/registry/{demos/countdown.js → examples/countdown/hours.js} +3 -3
- package/registry/{demos/countdown.tsx → examples/countdown/hours.tsx} +1 -1
- package/registry/examples/countdown/native/days.d.ts +4 -0
- package/registry/examples/countdown/native/days.dark.png +0 -0
- package/registry/examples/countdown/native/days.js +13 -0
- package/registry/examples/countdown/native/days.light.png +0 -0
- package/registry/examples/countdown/native/days.tsx +7 -0
- package/registry/examples/countdown/native/hours.d.ts +4 -0
- package/registry/examples/countdown/native/hours.dark.png +0 -0
- package/registry/examples/countdown/native/hours.js +13 -0
- package/registry/examples/countdown/native/hours.light.png +0 -0
- package/registry/examples/countdown/native/hours.tsx +7 -0
- package/registry/examples/countdown/native/sizes.d.ts +4 -0
- package/registry/examples/countdown/native/sizes.dark.png +0 -0
- package/registry/examples/countdown/native/sizes.js +18 -0
- package/registry/examples/countdown/native/sizes.light.png +0 -0
- package/registry/examples/countdown/native/sizes.tsx +15 -0
- package/registry/examples/countdown/native/urgent.d.ts +4 -0
- package/registry/examples/countdown/native/urgent.dark.png +0 -0
- package/registry/examples/countdown/native/urgent.js +13 -0
- package/registry/examples/countdown/native/urgent.light.png +0 -0
- package/registry/examples/countdown/native/urgent.tsx +7 -0
- package/registry/examples/countdown/native/with-label.d.ts +4 -0
- package/registry/examples/countdown/native/with-label.dark.png +0 -0
- package/registry/examples/countdown/native/with-label.js +13 -0
- package/registry/examples/countdown/native/with-label.light.png +0 -0
- package/registry/examples/countdown/native/with-label.tsx +7 -0
- package/registry/examples/countdown/sizes.d.ts +4 -0
- package/registry/examples/countdown/sizes.js +18 -0
- package/registry/examples/countdown/sizes.tsx +17 -0
- package/registry/examples/countdown/urgent.d.ts +4 -0
- package/registry/examples/countdown/urgent.js +13 -0
- package/registry/examples/countdown/urgent.tsx +10 -0
- package/registry/examples/countdown/with-label.d.ts +4 -0
- package/registry/examples/countdown/with-label.js +13 -0
- package/registry/examples/countdown/with-label.tsx +10 -0
- package/registry/examples/dialog/alert-destructive.d.ts +4 -0
- package/registry/examples/dialog/alert-destructive.js +24 -0
- package/registry/examples/dialog/alert-destructive.tsx +20 -0
- package/registry/examples/dialog/bottom.d.ts +4 -0
- package/registry/examples/dialog/bottom.js +29 -0
- package/registry/examples/dialog/bottom.tsx +32 -0
- package/registry/examples/dialog/center.d.ts +4 -0
- package/registry/{demos/dialog.js → examples/dialog/center.js} +3 -3
- package/registry/{demos/dialog.tsx → examples/dialog/center.tsx} +1 -1
- package/registry/examples/dialog/gate.d.ts +4 -0
- package/registry/examples/dialog/gate.js +24 -0
- package/registry/examples/dialog/gate.tsx +27 -0
- package/registry/examples/dialog/right.d.ts +4 -0
- package/registry/examples/dialog/right.js +29 -0
- package/registry/examples/dialog/right.tsx +32 -0
- package/registry/examples/dialog/sheet-form.d.ts +4 -0
- package/registry/examples/dialog/sheet-form.js +35 -0
- package/registry/examples/dialog/sheet-form.tsx +36 -0
- package/registry/examples/dropdown-menu/actions.d.ts +4 -0
- package/registry/{demos/dropdown-menu.js → examples/dropdown-menu/actions.js} +3 -3
- package/registry/{demos/dropdown-menu.tsx → examples/dropdown-menu/actions.tsx} +1 -1
- package/registry/examples/empty-state/default.d.ts +4 -0
- package/registry/{demos/empty-state.js → examples/empty-state/default.js} +3 -3
- package/registry/{demos/empty-state.tsx → examples/empty-state/default.tsx} +1 -1
- package/registry/examples/empty-state/native/default.d.ts +4 -0
- package/registry/examples/empty-state/native/default.dark.png +0 -0
- package/registry/examples/empty-state/native/default.js +25 -0
- package/registry/examples/empty-state/native/default.light.png +0 -0
- package/registry/examples/empty-state/native/default.tsx +25 -0
- package/registry/examples/empty-state/title-only.d.ts +4 -0
- package/registry/examples/empty-state/title-only.js +11 -0
- package/registry/examples/empty-state/title-only.tsx +5 -0
- package/registry/examples/empty-state/with-action.d.ts +4 -0
- package/registry/examples/empty-state/with-action.js +24 -0
- package/registry/examples/empty-state/with-action.tsx +25 -0
- package/registry/examples/field/default.d.ts +4 -0
- package/registry/{demos/field.js → examples/field/default.js} +3 -3
- package/registry/{demos/field.tsx → examples/field/default.tsx} +1 -1
- package/registry/examples/field/disabled.d.ts +4 -0
- package/registry/examples/field/disabled.js +14 -0
- package/registry/examples/field/disabled.tsx +10 -0
- package/registry/examples/field/invalid.d.ts +4 -0
- package/registry/examples/field/invalid.js +15 -0
- package/registry/examples/field/invalid.tsx +12 -0
- package/registry/examples/field/select.d.ts +4 -0
- package/registry/examples/field/select.js +18 -0
- package/registry/examples/field/select.tsx +15 -0
- package/registry/examples/field/textarea.d.ts +4 -0
- package/registry/examples/field/textarea.js +14 -0
- package/registry/examples/field/textarea.tsx +10 -0
- package/registry/examples/kbd/key.d.ts +4 -0
- package/registry/{demos/kbd.js → examples/kbd/key.js} +3 -3
- package/registry/{demos/kbd.tsx → examples/kbd/key.tsx} +1 -1
- package/registry/examples/kbd/shortcut.d.ts +4 -0
- package/registry/examples/kbd/shortcut.js +15 -0
- package/registry/examples/kbd/shortcut.tsx +11 -0
- package/registry/examples/kbd/small.d.ts +4 -0
- package/registry/examples/kbd/small.js +11 -0
- package/registry/examples/kbd/small.tsx +5 -0
- package/registry/examples/page-header/default.d.ts +4 -0
- package/registry/{demos/page-header.js → examples/page-header/default.js} +3 -3
- package/registry/{demos/page-header.tsx → examples/page-header/default.tsx} +1 -1
- package/registry/examples/page-header/with-actions.d.ts +4 -0
- package/registry/examples/page-header/with-actions.js +22 -0
- package/registry/examples/page-header/with-actions.tsx +17 -0
- package/registry/examples/page-header/with-breadcrumb.d.ts +4 -0
- package/registry/examples/page-header/with-breadcrumb.js +24 -0
- package/registry/examples/page-header/with-breadcrumb.tsx +26 -0
- package/registry/examples/popover/form.d.ts +4 -0
- package/registry/{demos/popover.js → examples/popover/form.js} +3 -3
- package/registry/{demos/popover.tsx → examples/popover/form.tsx} +1 -1
- package/registry/examples/progress/bar-indeterminate.d.ts +4 -0
- package/registry/examples/progress/bar-indeterminate.js +11 -0
- package/registry/examples/progress/bar-indeterminate.tsx +6 -0
- package/registry/examples/progress/bar-sizes.d.ts +4 -0
- package/registry/examples/progress/bar-sizes.js +15 -0
- package/registry/examples/progress/bar-sizes.tsx +11 -0
- package/registry/examples/progress/bar.d.ts +4 -0
- package/registry/{demos/progress.js → examples/progress/bar.js} +3 -3
- package/registry/{demos/progress.tsx → examples/progress/bar.tsx} +1 -1
- package/registry/examples/progress/native/bar.d.ts +4 -0
- package/registry/examples/progress/native/bar.dark.png +0 -0
- package/registry/examples/progress/native/bar.js +16 -0
- package/registry/examples/progress/native/bar.light.png +0 -0
- package/registry/examples/progress/native/bar.tsx +12 -0
- package/registry/examples/progress/native/indeterminate.d.ts +4 -0
- package/registry/examples/progress/native/indeterminate.dark.png +0 -0
- package/registry/examples/progress/native/indeterminate.js +15 -0
- package/registry/examples/progress/native/indeterminate.light.png +0 -0
- package/registry/examples/progress/native/indeterminate.tsx +12 -0
- package/registry/examples/progress/native/ring.d.ts +4 -0
- package/registry/examples/progress/native/ring.dark.png +0 -0
- package/registry/examples/progress/native/ring.js +19 -0
- package/registry/examples/progress/native/ring.light.png +0 -0
- package/registry/examples/progress/native/ring.tsx +19 -0
- package/registry/examples/progress/ring-indeterminate.d.ts +4 -0
- package/registry/examples/progress/ring-indeterminate.js +11 -0
- package/registry/examples/progress/ring-indeterminate.tsx +5 -0
- package/registry/examples/progress/ring.d.ts +4 -0
- package/registry/examples/progress/ring.js +18 -0
- package/registry/examples/progress/ring.tsx +17 -0
- package/registry/examples/radio-group/cards.d.ts +4 -0
- package/registry/examples/radio-group/cards.js +19 -0
- package/registry/examples/radio-group/cards.tsx +21 -0
- package/registry/examples/radio-group/horizontal.d.ts +4 -0
- package/registry/examples/radio-group/horizontal.js +15 -0
- package/registry/examples/radio-group/horizontal.tsx +12 -0
- package/registry/examples/radio-group/items.d.ts +4 -0
- package/registry/{demos/radio-group.js → examples/radio-group/items.js} +3 -3
- package/registry/{demos/radio-group.tsx → examples/radio-group/items.tsx} +1 -1
- package/registry/examples/section-backdrop/depth-of-field.d.ts +4 -0
- package/registry/examples/section-backdrop/depth-of-field.js +18 -0
- package/registry/examples/section-backdrop/depth-of-field.tsx +13 -0
- package/registry/examples/section-backdrop/hero.d.ts +4 -0
- package/registry/{demos/section-backdrop.js → examples/section-backdrop/hero.js} +3 -3
- package/registry/{demos/section-backdrop.tsx → examples/section-backdrop/hero.tsx} +1 -1
- package/registry/examples/section-backdrop/plain.d.ts +4 -0
- package/registry/examples/section-backdrop/plain.js +11 -0
- package/registry/examples/section-backdrop/plain.tsx +10 -0
- package/registry/examples/section-backdrop/sequence.d.ts +4 -0
- package/registry/examples/section-backdrop/sequence.js +14 -0
- package/registry/examples/section-backdrop/sequence.tsx +15 -0
- package/registry/examples/section-backdrop/up.d.ts +4 -0
- package/registry/examples/section-backdrop/up.js +11 -0
- package/registry/examples/section-backdrop/up.tsx +10 -0
- package/registry/examples/segmented/native/default.d.ts +4 -0
- package/registry/examples/segmented/native/default.dark.png +0 -0
- package/registry/examples/segmented/native/default.js +19 -0
- package/registry/examples/segmented/native/default.light.png +0 -0
- package/registry/examples/segmented/native/default.tsx +19 -0
- package/registry/examples/segmented/native/small.d.ts +4 -0
- package/registry/examples/segmented/native/small.dark.png +0 -0
- package/registry/examples/segmented/native/small.js +19 -0
- package/registry/examples/segmented/native/small.light.png +0 -0
- package/registry/examples/segmented/native/small.tsx +19 -0
- package/registry/examples/separator/horizontal.d.ts +4 -0
- package/registry/{demos/separator.js → examples/separator/horizontal.js} +3 -3
- package/registry/{demos/separator.tsx → examples/separator/horizontal.tsx} +1 -1
- package/registry/examples/separator/vertical.d.ts +4 -0
- package/registry/examples/separator/vertical.js +17 -0
- package/registry/examples/separator/vertical.tsx +14 -0
- package/registry/examples/skeleton/circle.d.ts +4 -0
- package/registry/examples/skeleton/circle.js +11 -0
- package/registry/examples/skeleton/circle.tsx +5 -0
- package/registry/examples/skeleton/composition.d.ts +4 -0
- package/registry/{demos/skeleton.js → examples/skeleton/composition.js} +3 -3
- package/registry/{demos/skeleton.tsx → examples/skeleton/composition.tsx} +1 -1
- package/registry/examples/skeleton/native/shapes.d.ts +4 -0
- package/registry/examples/skeleton/native/shapes.dark.png +0 -0
- package/registry/examples/skeleton/native/shapes.js +21 -0
- package/registry/examples/skeleton/native/shapes.light.png +0 -0
- package/registry/examples/skeleton/native/shapes.tsx +18 -0
- package/registry/examples/skeleton/rect.d.ts +4 -0
- package/registry/examples/skeleton/rect.js +11 -0
- package/registry/examples/skeleton/rect.tsx +5 -0
- package/registry/examples/skeleton/text.d.ts +4 -0
- package/registry/examples/skeleton/text.js +11 -0
- package/registry/examples/skeleton/text.tsx +5 -0
- package/registry/examples/slider/centred.d.ts +4 -0
- package/registry/examples/slider/centred.js +11 -0
- package/registry/examples/slider/centred.tsx +8 -0
- package/registry/examples/slider/default.d.ts +4 -0
- package/registry/{demos/slider.js → examples/slider/default.js} +3 -3
- package/registry/{demos/slider.tsx → examples/slider/default.tsx} +1 -1
- package/registry/examples/slider/disabled.d.ts +4 -0
- package/registry/examples/slider/disabled.js +11 -0
- package/registry/examples/slider/disabled.tsx +5 -0
- package/registry/examples/slider/range.d.ts +4 -0
- package/registry/examples/slider/range.js +22 -0
- package/registry/examples/slider/range.tsx +18 -0
- package/registry/examples/slider/with-label.d.ts +4 -0
- package/registry/examples/slider/with-label.js +11 -0
- package/registry/examples/slider/with-label.tsx +8 -0
- package/registry/examples/slot/as-child.d.ts +4 -0
- package/registry/{demos/slot.js → examples/slot/as-child.js} +3 -3
- package/registry/{demos/slot.tsx → examples/slot/as-child.tsx} +1 -1
- package/registry/examples/slot/visually-hidden.d.ts +4 -0
- package/registry/examples/slot/visually-hidden.js +14 -0
- package/registry/examples/slot/visually-hidden.tsx +13 -0
- package/registry/examples/spinner/default.d.ts +4 -0
- package/registry/{demos/spinner.js → examples/spinner/default.js} +3 -3
- package/registry/{demos/spinner.tsx → examples/spinner/default.tsx} +1 -1
- package/registry/examples/spinner/muted.d.ts +4 -0
- package/registry/examples/spinner/muted.js +11 -0
- package/registry/examples/spinner/muted.tsx +6 -0
- package/registry/examples/spinner/native/sizes.d.ts +4 -0
- package/registry/examples/spinner/native/sizes.dark.png +0 -0
- package/registry/examples/spinner/native/sizes.js +16 -0
- package/registry/examples/spinner/native/sizes.light.png +0 -0
- package/registry/examples/spinner/native/sizes.tsx +13 -0
- package/registry/examples/spinner/sizes.d.ts +4 -0
- package/registry/examples/spinner/sizes.js +15 -0
- package/registry/examples/spinner/sizes.tsx +11 -0
- package/registry/examples/stat/down.d.ts +4 -0
- package/registry/examples/stat/down.js +11 -0
- package/registry/examples/stat/down.tsx +5 -0
- package/registry/examples/stat/flat.d.ts +4 -0
- package/registry/examples/stat/flat.js +11 -0
- package/registry/examples/stat/flat.tsx +5 -0
- package/registry/examples/stat/plain.d.ts +4 -0
- package/registry/examples/stat/plain.js +11 -0
- package/registry/examples/stat/plain.tsx +5 -0
- package/registry/examples/stat/row.d.ts +4 -0
- package/registry/examples/stat/row.js +15 -0
- package/registry/examples/stat/row.tsx +12 -0
- package/registry/examples/stat/up.d.ts +4 -0
- package/registry/{demos/stat.js → examples/stat/up.js} +3 -3
- package/registry/{demos/stat.tsx → examples/stat/up.tsx} +1 -1
- package/registry/examples/switch/disabled.d.ts +4 -0
- package/registry/examples/switch/disabled.js +14 -0
- package/registry/examples/switch/disabled.tsx +10 -0
- package/registry/examples/switch/off.d.ts +4 -0
- package/registry/{demos/switch.js → examples/switch/off.js} +3 -3
- package/registry/{demos/switch.tsx → examples/switch/off.tsx} +1 -1
- package/registry/examples/switch/on.d.ts +4 -0
- package/registry/examples/switch/on.js +11 -0
- package/registry/examples/switch/on.tsx +5 -0
- package/registry/examples/switch/small.d.ts +4 -0
- package/registry/examples/switch/small.js +11 -0
- package/registry/examples/switch/small.tsx +5 -0
- package/registry/examples/switch/with-label.d.ts +4 -0
- package/registry/examples/switch/with-label.js +18 -0
- package/registry/examples/switch/with-label.tsx +17 -0
- package/registry/examples/tabs/pills.d.ts +4 -0
- package/registry/examples/tabs/pills.js +20 -0
- package/registry/examples/tabs/pills.tsx +23 -0
- package/registry/examples/tabs/segmented.d.ts +4 -0
- package/registry/examples/tabs/segmented.js +20 -0
- package/registry/examples/tabs/segmented.tsx +23 -0
- package/registry/examples/tabs/underline.d.ts +4 -0
- package/registry/{demos/tabs.js → examples/tabs/underline.js} +3 -3
- package/registry/{demos/tabs.tsx → examples/tabs/underline.tsx} +1 -1
- package/registry/examples/tabs/vertical.d.ts +4 -0
- package/registry/examples/tabs/vertical.js +20 -0
- package/registry/examples/tabs/vertical.tsx +23 -0
- package/registry/examples/theme/native/provider.d.ts +4 -0
- package/registry/examples/theme/native/provider.js +23 -0
- package/registry/examples/theme/native/provider.tsx +21 -0
- package/registry/examples/theme/secondary.d.ts +4 -0
- package/registry/examples/theme/secondary.js +11 -0
- package/registry/examples/theme/secondary.tsx +10 -0
- package/registry/examples/theme/toggle.d.ts +4 -0
- package/registry/{demos/theme.js → examples/theme/toggle.js} +3 -3
- package/registry/{demos/theme.tsx → examples/theme/toggle.tsx} +1 -1
- package/registry/examples/toast/custom.d.ts +4 -0
- package/registry/examples/toast/custom.js +30 -0
- package/registry/examples/toast/custom.tsx +35 -0
- package/registry/examples/toast/native/notification.d.ts +4 -0
- package/registry/examples/toast/native/notification.dark.png +0 -0
- package/registry/examples/toast/native/notification.js +29 -0
- package/registry/examples/toast/native/notification.light.png +0 -0
- package/registry/examples/toast/native/notification.tsx +30 -0
- package/registry/examples/toast/native/tones.d.ts +4 -0
- package/registry/examples/toast/native/tones.dark.png +0 -0
- package/registry/examples/toast/native/tones.js +28 -0
- package/registry/examples/toast/native/tones.light.png +0 -0
- package/registry/examples/toast/native/tones.tsx +25 -0
- package/registry/examples/toast/tones.d.ts +4 -0
- package/registry/{demos/toast.js → examples/toast/tones.js} +3 -3
- package/registry/{demos/toast.tsx → examples/toast/tones.tsx} +1 -1
- package/registry/examples/tooltip/right.d.ts +4 -0
- package/registry/examples/tooltip/right.js +15 -0
- package/registry/examples/tooltip/right.tsx +15 -0
- package/registry/examples/tooltip/top.d.ts +4 -0
- package/registry/{demos/tooltip.js → examples/tooltip/top.js} +3 -3
- package/registry/{demos/tooltip.tsx → examples/tooltip/top.tsx} +1 -1
- package/registry/examples/txt/native/tones.d.ts +4 -0
- package/registry/examples/txt/native/tones.dark.png +0 -0
- package/registry/examples/txt/native/tones.js +16 -0
- package/registry/examples/txt/native/tones.light.png +0 -0
- package/registry/examples/txt/native/tones.tsx +17 -0
- package/registry/examples/txt/native/variants.d.ts +4 -0
- package/registry/examples/txt/native/variants.dark.png +0 -0
- package/registry/examples/txt/native/variants.js +18 -0
- package/registry/examples/txt/native/variants.light.png +0 -0
- package/registry/examples/txt/native/variants.tsx +15 -0
- package/registry/field.json +142 -4
- package/registry/index.json +353 -33
- package/registry/kbd.json +90 -3
- package/registry/page-header.json +121 -3
- package/registry/popover.json +90 -3
- package/registry/progress.json +265 -3
- package/registry/radio-group.json +136 -3
- package/registry/section-backdrop.json +144 -3
- package/registry/segmented.json +125 -0
- package/registry/separator.json +67 -3
- package/registry/skeleton.json +166 -3
- package/registry/slider.json +177 -3
- package/registry/slot.json +79 -3
- package/registry/spinner.json +144 -3
- package/registry/stat.json +140 -3
- package/registry/switch.json +130 -3
- package/registry/tabs.json +117 -3
- package/registry/theme.json +190 -4
- package/registry/toast.json +190 -3
- package/registry/tooltip.json +143 -3
- package/registry/txt.json +97 -0
- package/dist/chunk-6DJ6SQY3.js.map +0 -1
- package/registry/demos/alert.d.ts +0 -5
- package/registry/demos/avatar.d.ts +0 -5
- package/registry/demos/badge.d.ts +0 -5
- package/registry/demos/button.d.ts +0 -5
- package/registry/demos/card.d.ts +0 -5
- package/registry/demos/checkbox.d.ts +0 -5
- package/registry/demos/chip.d.ts +0 -5
- package/registry/demos/cn.d.ts +0 -7
- package/registry/demos/command.d.ts +0 -5
- package/registry/demos/confirm-button.d.ts +0 -5
- package/registry/demos/countdown.d.ts +0 -5
- package/registry/demos/dialog.d.ts +0 -7
- package/registry/demos/dropdown-menu.d.ts +0 -7
- package/registry/demos/empty-state.d.ts +0 -5
- package/registry/demos/field.d.ts +0 -5
- package/registry/demos/kbd.d.ts +0 -5
- package/registry/demos/page-header.d.ts +0 -5
- package/registry/demos/popover.d.ts +0 -7
- package/registry/demos/progress.d.ts +0 -5
- package/registry/demos/radio-group.d.ts +0 -5
- package/registry/demos/section-backdrop.d.ts +0 -5
- package/registry/demos/separator.d.ts +0 -5
- package/registry/demos/skeleton.d.ts +0 -5
- package/registry/demos/slider.d.ts +0 -5
- package/registry/demos/slot.d.ts +0 -5
- package/registry/demos/spinner.d.ts +0 -5
- package/registry/demos/stat.d.ts +0 -5
- package/registry/demos/switch.d.ts +0 -5
- package/registry/demos/tabs.d.ts +0 -5
- package/registry/demos/theme.d.ts +0 -5
- package/registry/demos/toast.d.ts +0 -8
- package/registry/demos/tooltip.d.ts +0 -7
- /package/dist/{chunk-IUGBKMJC.js.map → chunk-FHYZSO2S.js.map} +0 -0
package/registry/dialog.json
CHANGED
|
@@ -1,7 +1,306 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dialog",
|
|
3
3
|
"type": "primitive",
|
|
4
|
-
"
|
|
4
|
+
"title": "Dialog",
|
|
5
|
+
"summary": "A window over the page — centred, a bottom sheet or a side panel — and `AlertDialog` for a confirmation.",
|
|
6
|
+
"description": "A window over the page — centred, a bottom sheet or a side panel — and `AlertDialog` for a confirmation.",
|
|
7
|
+
"status": "stable",
|
|
8
|
+
"category": "overlays",
|
|
9
|
+
"platforms": "web",
|
|
10
|
+
"whenToUse": [
|
|
11
|
+
"For a short task that must be finished or cancelled before going back: invite someone, edit a title.",
|
|
12
|
+
"`AlertDialog` to confirm a destructive or irreversible action, with an async `onConfirm`.",
|
|
13
|
+
"`Sheet` (bottom) on phones, `placement=\"right\"` for a side panel of details.",
|
|
14
|
+
"A gate the user must answer (age, terms): `hideClose` and `dismissible={false}`."
|
|
15
|
+
],
|
|
16
|
+
"whenNotToUse": [
|
|
17
|
+
{
|
|
18
|
+
"when": "For information next to an element, without blocking the page.",
|
|
19
|
+
"use": "popover"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"when": "For a message that needs no answer.",
|
|
23
|
+
"use": "toast"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"when": "For a long form or a flow of several steps: give it its own page."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"when": "To confirm the deletion of one item in place.",
|
|
30
|
+
"use": "confirm-button"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"bestPractices": [
|
|
34
|
+
"Always a `Dialog.Title`; a `Dialog.Description` when the title is not enough.",
|
|
35
|
+
"Name the buttons by what they do (“Send the invitation”), the cancel one by what it keeps (“Keep it”).",
|
|
36
|
+
"Pass `closeLabel` translated: it names the close button."
|
|
37
|
+
],
|
|
38
|
+
"accessibility": {
|
|
39
|
+
"keyboard": [
|
|
40
|
+
{
|
|
41
|
+
"keys": "Esc",
|
|
42
|
+
"action": "Closes the dialog (unless `dismissible={false}`)."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"keys": "Tab / Shift+Tab",
|
|
46
|
+
"action": "Move within the dialog: the focus is trapped while it is open."
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"notes": [
|
|
50
|
+
"Radix Dialog: `role=\"dialog\"` (or `alertdialog`), `aria-modal`, named by its title and described by its description.",
|
|
51
|
+
"The focus moves into the dialog when it opens and returns to the trigger when it closes; the page behind does not scroll.",
|
|
52
|
+
"`AlertDialog` keeps the focus on the cancel button first."
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"related": [
|
|
56
|
+
"popover",
|
|
57
|
+
"confirm-button",
|
|
58
|
+
"command",
|
|
59
|
+
"toast"
|
|
60
|
+
],
|
|
61
|
+
"web": {
|
|
62
|
+
"entry": "@krizaka/ui/dialog",
|
|
63
|
+
"import": "import { Dialog, Sheet, AlertDialog } from \"@krizaka/ui/dialog\";",
|
|
64
|
+
"props": [
|
|
65
|
+
{
|
|
66
|
+
"component": "AlertDialog",
|
|
67
|
+
"description": "",
|
|
68
|
+
"props": [
|
|
69
|
+
{
|
|
70
|
+
"name": "cancelLabel",
|
|
71
|
+
"type": "string",
|
|
72
|
+
"default": null,
|
|
73
|
+
"description": "The words of the cancel button (it takes the focus at open) — passed translated.",
|
|
74
|
+
"required": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "confirmLabel",
|
|
78
|
+
"type": "string",
|
|
79
|
+
"default": null,
|
|
80
|
+
"description": "The words of the confirm button — passed translated.",
|
|
81
|
+
"required": true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "onConfirm",
|
|
85
|
+
"type": "() => void | Promise<unknown>",
|
|
86
|
+
"default": null,
|
|
87
|
+
"description": "Runs on confirm. A promise keeps the dialog open and the button loading until it settles.",
|
|
88
|
+
"required": true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "title",
|
|
92
|
+
"type": "ReactNode",
|
|
93
|
+
"default": null,
|
|
94
|
+
"description": "The question asked (\"Delete this video?\"): the dialog's accessible name.",
|
|
95
|
+
"required": true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "children",
|
|
99
|
+
"type": "ReactNode",
|
|
100
|
+
"default": null,
|
|
101
|
+
"description": "More content between the description and the actions.",
|
|
102
|
+
"required": false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "className",
|
|
106
|
+
"type": "string",
|
|
107
|
+
"default": null,
|
|
108
|
+
"description": "Classes of the dialog's content, merged last.",
|
|
109
|
+
"required": false
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "container",
|
|
113
|
+
"type": "HTMLElement | null",
|
|
114
|
+
"default": null,
|
|
115
|
+
"description": "The element the portal renders into (default: document.body).",
|
|
116
|
+
"required": false
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "defaultOpen",
|
|
120
|
+
"type": "boolean",
|
|
121
|
+
"default": "false",
|
|
122
|
+
"description": "Open at first, uncontrolled.",
|
|
123
|
+
"required": false
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "description",
|
|
127
|
+
"type": "ReactNode",
|
|
128
|
+
"default": null,
|
|
129
|
+
"description": "What the action does and what it costs: the dialog's description.",
|
|
130
|
+
"required": false
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "onOpenChange",
|
|
134
|
+
"type": "((open: boolean) => void)",
|
|
135
|
+
"default": null,
|
|
136
|
+
"description": "Called when it opens or closes (never while `onConfirm` is pending).",
|
|
137
|
+
"required": false
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "open",
|
|
141
|
+
"type": "boolean",
|
|
142
|
+
"default": null,
|
|
143
|
+
"description": "Open or closed (controlled), with `onOpenChange`.",
|
|
144
|
+
"required": false
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "tone",
|
|
148
|
+
"type": "\"danger\" | \"primary\"",
|
|
149
|
+
"default": "primary",
|
|
150
|
+
"description": "`danger` for a destructive action (delete, leave, cancel a payment).",
|
|
151
|
+
"required": false
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "trigger",
|
|
155
|
+
"type": "ReactNode",
|
|
156
|
+
"default": null,
|
|
157
|
+
"description": "The element that opens the dialog (rendered as is, `asChild`): a Button, an IconButton.",
|
|
158
|
+
"required": false
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"component": "DialogContent",
|
|
164
|
+
"description": "The dialog itself, portalled over a dimmed overlay, with a close button. Give it a `Dialog.Title`.",
|
|
165
|
+
"props": [
|
|
166
|
+
{
|
|
167
|
+
"name": "closeLabel",
|
|
168
|
+
"type": "string",
|
|
169
|
+
"default": null,
|
|
170
|
+
"description": "The accessible name of the close button — passed translated.",
|
|
171
|
+
"required": false
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "container",
|
|
175
|
+
"type": "HTMLElement | null",
|
|
176
|
+
"default": null,
|
|
177
|
+
"description": "The element the portal renders into (default: document.body).",
|
|
178
|
+
"required": false
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "dismissible",
|
|
182
|
+
"type": "boolean",
|
|
183
|
+
"default": "true",
|
|
184
|
+
"description": "`false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes\nthrough `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.",
|
|
185
|
+
"required": false
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "hideClose",
|
|
189
|
+
"type": "boolean",
|
|
190
|
+
"default": null,
|
|
191
|
+
"description": "Leaves the close button out (the content brings its own way out, or none: see `dismissible`).",
|
|
192
|
+
"required": false
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "placement",
|
|
196
|
+
"type": "\"center\" | \"bottom\" | \"right\"",
|
|
197
|
+
"default": "center",
|
|
198
|
+
"description": "center · bottom (a sheet on a phone, centred from `sm` up) · right (a side panel, full height).",
|
|
199
|
+
"required": false
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "size",
|
|
203
|
+
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
204
|
+
"default": "md",
|
|
205
|
+
"description": "sm · md · lg: the width of the dialog.",
|
|
206
|
+
"required": false
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"component": "Sheet",
|
|
212
|
+
"description": "A sheet is a dialog anchored at the bottom (centred from `sm` up): `Dialog.Content placement=\"bottom\"`.",
|
|
213
|
+
"props": [
|
|
214
|
+
{
|
|
215
|
+
"name": "closeLabel",
|
|
216
|
+
"type": "string",
|
|
217
|
+
"default": null,
|
|
218
|
+
"description": "The accessible name of the close button — passed translated.",
|
|
219
|
+
"required": false
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "container",
|
|
223
|
+
"type": "HTMLElement | null",
|
|
224
|
+
"default": null,
|
|
225
|
+
"description": "The element the portal renders into (default: document.body).",
|
|
226
|
+
"required": false
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "dismissible",
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"default": null,
|
|
232
|
+
"description": "`false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes\nthrough `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.",
|
|
233
|
+
"required": false
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"name": "hideClose",
|
|
237
|
+
"type": "boolean",
|
|
238
|
+
"default": null,
|
|
239
|
+
"description": "Leaves the close button out (the content brings its own way out, or none: see `dismissible`).",
|
|
240
|
+
"required": false
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "size",
|
|
244
|
+
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
245
|
+
"default": "md",
|
|
246
|
+
"description": "sm · md · lg: the width of the dialog.",
|
|
247
|
+
"required": false
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"examples": [
|
|
253
|
+
{
|
|
254
|
+
"name": "center",
|
|
255
|
+
"title": "Centred",
|
|
256
|
+
"description": "A short form, `size=\"md\"`.",
|
|
257
|
+
"path": "examples/dialog/center.tsx",
|
|
258
|
+
"module": "@krizaka/ui/registry/examples/dialog/center",
|
|
259
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\nimport { Field, Input } from \"@krizaka/ui/field\";\n\nexport default function DialogCenter({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <Dialog.Root defaultOpen={defaultOpen}>\n <Dialog.Trigger asChild>\n <Button>Open</Button>\n </Dialog.Trigger>\n <Dialog.Content closeLabel=\"Close\">\n <Dialog.Header>\n <Dialog.Title>Invite a collaborator</Dialog.Title>\n <Dialog.Description>They get access to the drafts of this channel.</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body>\n <Field.Root>\n <Field.Label htmlFor=\"invite-email\">Email</Field.Label>\n <Input id=\"invite-email\" type=\"email\" placeholder=\"name@example.com\" />\n </Field.Root>\n </Dialog.Body>\n <Dialog.Footer>\n <Dialog.Close asChild>\n <Button variant=\"ghost\">Cancel</Button>\n </Dialog.Close>\n <Button variant=\"primary\">Send the invitation</Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "bottom",
|
|
263
|
+
"title": "Bottom sheet",
|
|
264
|
+
"description": "`placement=\"bottom\"`: a sheet on a phone, centred from `sm` up.",
|
|
265
|
+
"path": "examples/dialog/bottom.tsx",
|
|
266
|
+
"module": "@krizaka/ui/registry/examples/dialog/bottom",
|
|
267
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\nimport { Field, Input } from \"@krizaka/ui/field\";\n\n// `placement=\"bottom\"`: a sheet on a phone, centred from `sm` up.\nexport default function DialogBottom({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <Dialog.Root defaultOpen={defaultOpen}>\n <Dialog.Trigger asChild>\n <Button>Open</Button>\n </Dialog.Trigger>\n <Dialog.Content closeLabel=\"Close\" placement=\"bottom\">\n <Dialog.Header>\n <Dialog.Title>Invite a collaborator</Dialog.Title>\n <Dialog.Description>They get access to the drafts of this channel.</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body>\n <Field.Root>\n <Field.Label htmlFor=\"invite-email-bottom\">Email</Field.Label>\n <Input id=\"invite-email-bottom\" type=\"email\" placeholder=\"name@example.com\" />\n </Field.Root>\n </Dialog.Body>\n <Dialog.Footer>\n <Dialog.Close asChild>\n <Button variant=\"ghost\">Cancel</Button>\n </Dialog.Close>\n <Button variant=\"primary\">Send the invitation</Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"name": "right",
|
|
271
|
+
"title": "Side panel",
|
|
272
|
+
"description": "`placement=\"right\"`: full height, for details.",
|
|
273
|
+
"path": "examples/dialog/right.tsx",
|
|
274
|
+
"module": "@krizaka/ui/registry/examples/dialog/right",
|
|
275
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\nimport { Field, Input } from \"@krizaka/ui/field\";\n\n// `placement=\"right\"`: a side panel, full height.\nexport default function DialogRight({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <Dialog.Root defaultOpen={defaultOpen}>\n <Dialog.Trigger asChild>\n <Button>Open</Button>\n </Dialog.Trigger>\n <Dialog.Content closeLabel=\"Close\" placement=\"right\">\n <Dialog.Header>\n <Dialog.Title>Invite a collaborator</Dialog.Title>\n <Dialog.Description>They get access to the drafts of this channel.</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body>\n <Field.Root>\n <Field.Label htmlFor=\"invite-email-right\">Email</Field.Label>\n <Input id=\"invite-email-right\" type=\"email\" placeholder=\"name@example.com\" />\n </Field.Root>\n </Dialog.Body>\n <Dialog.Footer>\n <Dialog.Close asChild>\n <Button variant=\"ghost\">Cancel</Button>\n </Dialog.Close>\n <Button variant=\"primary\">Send the invitation</Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "sheet-form",
|
|
279
|
+
"title": "Sheet with a form",
|
|
280
|
+
"description": "`Sheet`, `size=\"lg\"`.",
|
|
281
|
+
"path": "examples/dialog/sheet-form.tsx",
|
|
282
|
+
"module": "@krizaka/ui/registry/examples/dialog/sheet-form",
|
|
283
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog, Sheet } from \"@krizaka/ui/dialog\";\nimport { Field, Input, Textarea } from \"@krizaka/ui/field\";\n\n// `Sheet` = `Dialog.Content placement=\"bottom\"`: a form, `size=\"lg\"`.\nexport default function DialogSheetForm({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <Dialog.Root defaultOpen={defaultOpen}>\n <Dialog.Trigger asChild>\n <Button>Edit</Button>\n </Dialog.Trigger>\n <Sheet closeLabel=\"Close\" size=\"lg\">\n <Dialog.Header>\n <Dialog.Title>Edit the video</Dialog.Title>\n <Dialog.Description>The title and the description are public.</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body className=\"flex flex-col gap-4\">\n <Field.Root>\n <Field.Label htmlFor=\"video-title\">Title</Field.Label>\n <Input id=\"video-title\" defaultValue=\"Night ride across the city\" />\n </Field.Root>\n <Field.Root>\n <Field.Label htmlFor=\"video-description\">Description</Field.Label>\n <Textarea id=\"video-description\" defaultValue=\"Ten minutes of neon, rain and empty avenues.\" />\n </Field.Root>\n </Dialog.Body>\n <Dialog.Footer>\n <Dialog.Close asChild>\n <Button variant=\"ghost\">Cancel</Button>\n </Dialog.Close>\n <Button variant=\"primary\">Save</Button>\n </Dialog.Footer>\n </Sheet>\n </Dialog.Root>\n );\n}\n"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "alert-destructive",
|
|
287
|
+
"title": "Alert dialog",
|
|
288
|
+
"description": "`AlertDialog tone=\"danger\"` with an async `onConfirm`.",
|
|
289
|
+
"path": "examples/dialog/alert-destructive.tsx",
|
|
290
|
+
"module": "@krizaka/ui/registry/examples/dialog/alert-destructive",
|
|
291
|
+
"code": "\"use client\";\n\nimport { Button } from \"@krizaka/ui/button\";\nimport { AlertDialog } from \"@krizaka/ui/dialog\";\n\n// An async `onConfirm`: the button loads until it settles; the dialog closes when it resolves, stays open when it rejects.\nexport default function DialogAlertDestructive({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <AlertDialog\n defaultOpen={defaultOpen}\n trigger={<Button variant=\"danger\">Delete the video</Button>}\n title=\"Delete this video?\"\n description=\"Its views, comments and earnings history go with it. This cannot be undone.\"\n confirmLabel=\"Delete\"\n cancelLabel=\"Keep it\"\n tone=\"danger\"\n onConfirm={() => new Promise((resolve) => setTimeout(resolve, 1200))}\n />\n );\n}\n"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "gate",
|
|
295
|
+
"title": "Gate",
|
|
296
|
+
"description": "No close button: it closes only through its actions.",
|
|
297
|
+
"path": "examples/dialog/gate.tsx",
|
|
298
|
+
"module": "@krizaka/ui/registry/examples/dialog/gate",
|
|
299
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\n\n// A question the user must answer: no close button, Escape and the overlay do nothing — it closes through its actions.\nexport default function DialogGate({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <Dialog.Root defaultOpen={defaultOpen}>\n <Dialog.Trigger asChild>\n <Button>Enter the channel</Button>\n </Dialog.Trigger>\n <Dialog.Content hideClose dismissible={false} size=\"sm\">\n <Dialog.Header className=\"pr-5\">\n <Dialog.Title>Are you 18 or older?</Dialog.Title>\n <Dialog.Description>This channel shows content for adults only.</Dialog.Description>\n </Dialog.Header>\n <Dialog.Footer>\n <Dialog.Close asChild>\n <Button variant=\"ghost\">Leave</Button>\n </Dialog.Close>\n <Dialog.Close asChild>\n <Button variant=\"primary\">I am 18 or older</Button>\n </Dialog.Close>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
"native": null,
|
|
5
304
|
"files": [
|
|
6
305
|
{
|
|
7
306
|
"path": "dialog/alert-dialog.tsx",
|
|
@@ -14,6 +313,14 @@
|
|
|
14
313
|
{
|
|
15
314
|
"path": "dialog/index.ts",
|
|
16
315
|
"content": "/** @krizaka/ui/dialog — `Dialog.*`, `Sheet`, `AlertDialog`, `dialog` (the slots). Client (\"use client\"). */\nexport { AlertDialog, type AlertDialogProps } from \"./alert-dialog\";\nexport {\n Dialog,\n dialog,\n DialogBody,\n DialogContent,\n type DialogContentProps,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n type DialogVariants,\n Sheet,\n type SheetProps,\n} from \"./dialog\";\n"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"path": "dialog/meta.ts",
|
|
319
|
+
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Dialog\",\n summary: \"A window over the page — centred, a bottom sheet or a side panel — and `AlertDialog` for a confirmation.\",\n status: \"stable\",\n category: \"overlays\",\n platforms: \"web\",\n whenToUse: [\n \"For a short task that must be finished or cancelled before going back: invite someone, edit a title.\",\n \"`AlertDialog` to confirm a destructive or irreversible action, with an async `onConfirm`.\",\n \"`Sheet` (bottom) on phones, `placement=\\\"right\\\"` for a side panel of details.\",\n \"A gate the user must answer (age, terms): `hideClose` and `dismissible={false}`.\",\n ],\n whenNotToUse: [\n { when: \"For information next to an element, without blocking the page.\", use: \"popover\" },\n { when: \"For a message that needs no answer.\", use: \"toast\" },\n { when: \"For a long form or a flow of several steps: give it its own page.\" },\n { when: \"To confirm the deletion of one item in place.\", use: \"confirm-button\" },\n ],\n bestPractices: [\n \"Always a `Dialog.Title`; a `Dialog.Description` when the title is not enough.\",\n \"Name the buttons by what they do (“Send the invitation”), the cancel one by what it keeps (“Keep it”).\",\n \"Pass `closeLabel` translated: it names the close button.\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"Esc\", action: \"Closes the dialog (unless `dismissible={false}`).\" },\n { keys: \"Tab / Shift+Tab\", action: \"Move within the dialog: the focus is trapped while it is open.\" },\n ],\n notes: [\n \"Radix Dialog: `role=\\\"dialog\\\"` (or `alertdialog`), `aria-modal`, named by its title and described by its description.\",\n \"The focus moves into the dialog when it opens and returns to the trigger when it closes; the page behind does not scroll.\",\n \"`AlertDialog` keeps the focus on the cancel button first.\",\n ],\n },\n related: [\"popover\", \"confirm-button\", \"command\", \"toast\"],\n web: {\n imports: [\"Dialog\", \"Sheet\", \"AlertDialog\"],\n examples: [\n { name: \"center\", title: \"Centred\", description: \"A short form, `size=\\\"md\\\"`.\" },\n { name: \"bottom\", title: \"Bottom sheet\", description: \"`placement=\\\"bottom\\\"`: a sheet on a phone, centred from `sm` up.\" },\n { name: \"right\", title: \"Side panel\", description: \"`placement=\\\"right\\\"`: full height, for details.\" },\n { name: \"sheet-form\", title: \"Sheet with a form\", description: \"`Sheet`, `size=\\\"lg\\\"`.\" },\n { name: \"alert-destructive\", title: \"Alert dialog\", description: \"`AlertDialog tone=\\\"danger\\\"` with an async `onConfirm`.\" },\n { name: \"gate\", title: \"Gate\", description: \"No close button: it closes only through its actions.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"path": "meta.ts",
|
|
323
|
+
"content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which krizaka.com renders as\n// /docs/ui/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"alert\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"checkbox\"\n | \"chip\"\n | \"cn\"\n | \"command\"\n | \"confirm-button\"\n | \"countdown\"\n | \"dialog\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"field\"\n | \"kbd\"\n | \"page-header\"\n | \"popover\"\n | \"progress\"\n | \"radio-group\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"skeleton\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"stat\"\n | \"switch\"\n | \"tabs\"\n | \"theme\"\n | \"toast\"\n | \"tooltip\"\n | \"txt\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/** `stable`: its API only changes in a major. `beta`: it may still change in a minor. */\nexport type Status = \"stable\" | \"beta\";\n\n/** The group of the catalogue. */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"layout\" | \"foundations\";\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\nexport interface Example {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
|
|
17
324
|
}
|
|
18
325
|
],
|
|
19
326
|
"dependencies": [
|
|
@@ -24,8 +331,8 @@
|
|
|
24
331
|
"button"
|
|
25
332
|
],
|
|
26
333
|
"demo": {
|
|
27
|
-
"path": "
|
|
28
|
-
"content": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\nimport { Field, Input } from \"@krizaka/ui/field\";\n\nexport default function
|
|
334
|
+
"path": "examples/dialog/center.tsx",
|
|
335
|
+
"content": "import { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\nimport { Field, Input } from \"@krizaka/ui/field\";\n\nexport default function DialogCenter({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <Dialog.Root defaultOpen={defaultOpen}>\n <Dialog.Trigger asChild>\n <Button>Open</Button>\n </Dialog.Trigger>\n <Dialog.Content closeLabel=\"Close\">\n <Dialog.Header>\n <Dialog.Title>Invite a collaborator</Dialog.Title>\n <Dialog.Description>They get access to the drafts of this channel.</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body>\n <Field.Root>\n <Field.Label htmlFor=\"invite-email\">Email</Field.Label>\n <Input id=\"invite-email\" type=\"email\" placeholder=\"name@example.com\" />\n </Field.Root>\n </Dialog.Body>\n <Dialog.Footer>\n <Dialog.Close asChild>\n <Button variant=\"ghost\">Cancel</Button>\n </Dialog.Close>\n <Button variant=\"primary\">Send the invitation</Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
29
336
|
},
|
|
30
337
|
"props": [
|
|
31
338
|
{
|
|
@@ -1,19 +1,132 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dropdown-menu",
|
|
3
3
|
"type": "primitive",
|
|
4
|
-
"
|
|
4
|
+
"title": "Dropdown menu",
|
|
5
|
+
"summary": "A menu of actions opened from a trigger: items with icons, checkbox items, labels, separators, a destructive item.",
|
|
6
|
+
"description": "A menu of actions opened from a trigger: items with icons, checkbox items, labels, separators, a destructive item.",
|
|
7
|
+
"status": "stable",
|
|
8
|
+
"category": "overlays",
|
|
9
|
+
"platforms": "web",
|
|
10
|
+
"whenToUse": [
|
|
11
|
+
"For the secondary actions of an item or a page: edit, share, download, delete (a “more” button).",
|
|
12
|
+
"For a few options toggled from a toolbar (`CheckboxItem`)."
|
|
13
|
+
],
|
|
14
|
+
"whenNotToUse": [
|
|
15
|
+
{
|
|
16
|
+
"when": "For the main action of a view: show it as a button.",
|
|
17
|
+
"use": "button"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"when": "To search among many commands.",
|
|
21
|
+
"use": "command"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"when": "For content that is not a list of actions (a form, details).",
|
|
25
|
+
"use": "popover"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"when": "To pick a value in a form: use a select.",
|
|
29
|
+
"use": "field"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"bestPractices": [
|
|
33
|
+
"Start each item with a verb; put the destructive one last, after a separator, with `tone=\"danger\"`.",
|
|
34
|
+
"Keep the menu short: more than about seven items is a page or a palette.",
|
|
35
|
+
"An `IconButton` trigger needs a `label` (“More actions”)."
|
|
36
|
+
],
|
|
37
|
+
"accessibility": {
|
|
38
|
+
"keyboard": [
|
|
39
|
+
{
|
|
40
|
+
"keys": "Enter / Space / Arrow down",
|
|
41
|
+
"action": "Opens the menu from its trigger."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"keys": "Arrow keys / Home / End",
|
|
45
|
+
"action": "Move through the items; typing a letter jumps to an item."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"keys": "Esc",
|
|
49
|
+
"action": "Closes the menu and returns the focus to the trigger."
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"notes": [
|
|
53
|
+
"Radix DropdownMenu: `role=\"menu\"`, `menuitem`, `menuitemcheckbox`; disabled items are skipped.",
|
|
54
|
+
"Icons in items are decorative (`aria-hidden`)."
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"related": [
|
|
58
|
+
"popover",
|
|
59
|
+
"command",
|
|
60
|
+
"button"
|
|
61
|
+
],
|
|
62
|
+
"web": {
|
|
63
|
+
"entry": "@krizaka/ui/dropdown-menu",
|
|
64
|
+
"import": "import { DropdownMenu } from \"@krizaka/ui/dropdown-menu\";",
|
|
65
|
+
"props": [
|
|
66
|
+
{
|
|
67
|
+
"component": "DropdownMenuContent",
|
|
68
|
+
"description": "",
|
|
69
|
+
"props": [
|
|
70
|
+
{
|
|
71
|
+
"name": "container",
|
|
72
|
+
"type": "HTMLElement | null",
|
|
73
|
+
"default": null,
|
|
74
|
+
"description": "The element the portal renders into (default: document.body).",
|
|
75
|
+
"required": false
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"component": "DropdownMenuItem",
|
|
81
|
+
"description": "An action. `tone=\"danger\"` for a destructive one; `onSelect` runs it (the menu closes).",
|
|
82
|
+
"props": [
|
|
83
|
+
{
|
|
84
|
+
"name": "tone",
|
|
85
|
+
"type": "\"danger\" | \"default\"",
|
|
86
|
+
"default": null,
|
|
87
|
+
"description": "`danger` for a destructive action: the icon and the highlight carry the danger, the label stays legible.",
|
|
88
|
+
"required": false
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"component": "DropdownMenuCheckboxItem",
|
|
94
|
+
"description": "A toggled option: `checked` + `onCheckedChange`.",
|
|
95
|
+
"props": []
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"examples": [
|
|
99
|
+
{
|
|
100
|
+
"name": "actions",
|
|
101
|
+
"title": "Actions",
|
|
102
|
+
"description": "A label, items with icons, a checkbox item, a separator and a destructive item.",
|
|
103
|
+
"path": "examples/dropdown-menu/actions.tsx",
|
|
104
|
+
"module": "@krizaka/ui/registry/examples/dropdown-menu/actions",
|
|
105
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { DropdownMenu } from \"@krizaka/ui/dropdown-menu\";\n\nconst icon = (d: string) => (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={d} />\n </svg>\n);\n\nexport default function DropdownMenuActions({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <DropdownMenu.Root defaultOpen={defaultOpen} modal={false}>\n <DropdownMenu.Trigger asChild>\n <Button variant=\"outline\">Actions</Button>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"center\">\n <DropdownMenu.Label>Video</DropdownMenu.Label>\n <DropdownMenu.Item>{icon(\"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z\")}Edit</DropdownMenu.Item>\n <DropdownMenu.Item>{icon(\"M4 12v8h16v-8M16 6l-4-4-4 4M12 2v13\")}Share</DropdownMenu.Item>\n <DropdownMenu.Item disabled>{icon(\"M12 3v12M7 10l5 5 5-5M5 21h14\")}Download</DropdownMenu.Item>\n <DropdownMenu.CheckboxItem checked>Pinned to the profile</DropdownMenu.CheckboxItem>\n <DropdownMenu.Separator />\n <DropdownMenu.Item tone=\"danger\">{icon(\"M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6\")}Delete</DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n );\n}\n"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"native": null,
|
|
5
110
|
"files": [
|
|
6
111
|
{
|
|
7
112
|
"path": "dropdown-menu/dropdown-menu.tsx",
|
|
8
|
-
"content": "// Client (a portal). Radix does the roving focus, the arrows, Home/End, typeahead, Escape and the focus return.\nimport { DropdownMenu as MenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { floating } from \"../floating\";\n\nexport const menu = tv({\n slots: {\n content: cn(floating, \"min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-1 origin-(--radix-dropdown-menu-content-transform-origin)\"),\n item:\n \"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors \" +\n \"data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 \" +\n \"[&>svg]:text-fg-secondary\",\n indicator: \"ml-auto flex h-4 w-4 items-center justify-center text-fg-accent\",\n label: \"px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary\",\n separator: \"-mx-1 my-1 h-px bg-border-subtle\",\n },\n variants: {\n // The
|
|
113
|
+
"content": "// Client (a portal). Radix does the roving focus, the arrows, Home/End, typeahead, Escape and the focus return.\nimport { DropdownMenu as MenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { floating } from \"../floating\";\n\nexport const menu = tv({\n slots: {\n content: cn(floating, \"min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-1 origin-(--radix-dropdown-menu-content-transform-origin)\"),\n item:\n \"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors \" +\n \"data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 \" +\n \"[&>svg]:text-fg-secondary\",\n indicator: \"ml-auto flex h-4 w-4 items-center justify-center text-fg-accent\",\n label: \"px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary\",\n separator: \"-mx-1 my-1 h-px bg-border-subtle\",\n },\n variants: {\n // The label reads in the danger text role (≥ 4.5:1 on the menu surface, both themes); the icon and the highlight\n // carry the danger fill.\n tone: { default: {}, danger: { item: \"text-fg-danger data-highlighted:bg-danger/15 [&>svg]:text-danger\" } },\n },\n defaultVariants: { tone: \"default\" },\n});\nconst s = menu();\n\nexport type DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Content> & {\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n};\n\nexport function DropdownMenuContent({ sideOffset = 6, align = \"end\", collisionPadding = 8, container, className, ...props }: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Content sideOffset={sideOffset} align={align} collisionPadding={collisionPadding} className={s.content({ className })} {...props} />\n </MenuPrimitive.Portal>\n );\n}\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n /** `danger` for a destructive action: the icon and the highlight carry the danger, the label stays legible. */\n tone?: \"default\" | \"danger\";\n};\n\n/** An action. `tone=\"danger\"` for a destructive one; `onSelect` runs it (the menu closes). */\nexport function DropdownMenuItem({ tone, className, ...props }: DropdownMenuItemProps) {\n return <MenuPrimitive.Item data-tone={tone ?? \"default\"} className={menu({ tone }).item({ className })} {...props} />;\n}\n\n/** A toggled option: `checked` + `onCheckedChange`. */\nexport function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n return (\n <MenuPrimitive.CheckboxItem className={s.item({ className })} {...props}>\n {children}\n <MenuPrimitive.ItemIndicator className={s.indicator()}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </MenuPrimitive.ItemIndicator>\n </MenuPrimitive.CheckboxItem>\n );\n}\n\nexport function DropdownMenuLabel({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Label>) {\n return <MenuPrimitive.Label className={s.label({ className })} {...props} />;\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return <MenuPrimitive.Separator className={s.separator({ className })} {...props} />;\n}\n\n/** `DropdownMenu.Root/Trigger/Content/Item/CheckboxItem/Label/Separator/Group`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const DropdownMenu = {\n Root: MenuPrimitive.Root,\n Trigger: MenuPrimitive.Trigger,\n Content: DropdownMenuContent,\n Item: DropdownMenuItem,\n CheckboxItem: DropdownMenuCheckboxItem,\n Label: DropdownMenuLabel,\n Separator: DropdownMenuSeparator,\n Group: MenuPrimitive.Group,\n};\n"
|
|
9
114
|
},
|
|
10
115
|
{
|
|
11
116
|
"path": "dropdown-menu/index.ts",
|
|
12
117
|
"content": "/** @krizaka/ui/dropdown-menu — `DropdownMenu.*`, `menu` (the slots). Client (\"use client\"). */\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n type DropdownMenuContentProps,\n DropdownMenuItem,\n type DropdownMenuItemProps,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n menu,\n} from \"./dropdown-menu\";\n"
|
|
13
118
|
},
|
|
119
|
+
{
|
|
120
|
+
"path": "dropdown-menu/meta.ts",
|
|
121
|
+
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Dropdown menu\",\n summary: \"A menu of actions opened from a trigger: items with icons, checkbox items, labels, separators, a destructive item.\",\n status: \"stable\",\n category: \"overlays\",\n platforms: \"web\",\n whenToUse: [\n \"For the secondary actions of an item or a page: edit, share, download, delete (a “more” button).\",\n \"For a few options toggled from a toolbar (`CheckboxItem`).\",\n ],\n whenNotToUse: [\n { when: \"For the main action of a view: show it as a button.\", use: \"button\" },\n { when: \"To search among many commands.\", use: \"command\" },\n { when: \"For content that is not a list of actions (a form, details).\", use: \"popover\" },\n { when: \"To pick a value in a form: use a select.\", use: \"field\" },\n ],\n bestPractices: [\n \"Start each item with a verb; put the destructive one last, after a separator, with `tone=\\\"danger\\\"`.\",\n \"Keep the menu short: more than about seven items is a page or a palette.\",\n \"An `IconButton` trigger needs a `label` (“More actions”).\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"Enter / Space / Arrow down\", action: \"Opens the menu from its trigger.\" },\n { keys: \"Arrow keys / Home / End\", action: \"Move through the items; typing a letter jumps to an item.\" },\n { keys: \"Esc\", action: \"Closes the menu and returns the focus to the trigger.\" },\n ],\n notes: [\n \"Radix DropdownMenu: `role=\\\"menu\\\"`, `menuitem`, `menuitemcheckbox`; disabled items are skipped.\",\n \"Icons in items are decorative (`aria-hidden`).\",\n ],\n },\n related: [\"popover\", \"command\", \"button\"],\n web: {\n imports: [\"DropdownMenu\"],\n examples: [\n { name: \"actions\", title: \"Actions\", description: \"A label, items with icons, a checkbox item, a separator and a destructive item.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
|
|
122
|
+
},
|
|
14
123
|
{
|
|
15
124
|
"path": "floating.ts",
|
|
16
125
|
"content": "// The one surface of everything that floats next to its trigger (popover, menu, tooltip): a raised surface, a border,\n// the large shadow and the `kz-pop` entrance from the side Radix measured (`--radix-*-transform-origin`).\nexport const floating =\n \"kz-pop z-50 rounded-lg border border-border-default bg-surface-2 text-fg shadow-lg outline-hidden\";\n"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"path": "meta.ts",
|
|
129
|
+
"content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which krizaka.com renders as\n// /docs/ui/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"alert\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"checkbox\"\n | \"chip\"\n | \"cn\"\n | \"command\"\n | \"confirm-button\"\n | \"countdown\"\n | \"dialog\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"field\"\n | \"kbd\"\n | \"page-header\"\n | \"popover\"\n | \"progress\"\n | \"radio-group\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"skeleton\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"stat\"\n | \"switch\"\n | \"tabs\"\n | \"theme\"\n | \"toast\"\n | \"tooltip\"\n | \"txt\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/** `stable`: its API only changes in a major. `beta`: it may still change in a minor. */\nexport type Status = \"stable\" | \"beta\";\n\n/** The group of the catalogue. */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"layout\" | \"foundations\";\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\nexport interface Example {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
|
|
17
130
|
}
|
|
18
131
|
],
|
|
19
132
|
"dependencies": [
|
|
@@ -24,8 +137,8 @@
|
|
|
24
137
|
"cn"
|
|
25
138
|
],
|
|
26
139
|
"demo": {
|
|
27
|
-
"path": "
|
|
28
|
-
"content": "import { Button } from \"@krizaka/ui/button\";\nimport { DropdownMenu } from \"@krizaka/ui/dropdown-menu\";\n\nconst icon = (d: string) => (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={d} />\n </svg>\n);\n\nexport default function
|
|
140
|
+
"path": "examples/dropdown-menu/actions.tsx",
|
|
141
|
+
"content": "import { Button } from \"@krizaka/ui/button\";\nimport { DropdownMenu } from \"@krizaka/ui/dropdown-menu\";\n\nconst icon = (d: string) => (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={d} />\n </svg>\n);\n\nexport default function DropdownMenuActions({ defaultOpen = false }: { defaultOpen?: boolean }) {\n return (\n <DropdownMenu.Root defaultOpen={defaultOpen} modal={false}>\n <DropdownMenu.Trigger asChild>\n <Button variant=\"outline\">Actions</Button>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"center\">\n <DropdownMenu.Label>Video</DropdownMenu.Label>\n <DropdownMenu.Item>{icon(\"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z\")}Edit</DropdownMenu.Item>\n <DropdownMenu.Item>{icon(\"M4 12v8h16v-8M16 6l-4-4-4 4M12 2v13\")}Share</DropdownMenu.Item>\n <DropdownMenu.Item disabled>{icon(\"M12 3v12M7 10l5 5 5-5M5 21h14\")}Download</DropdownMenu.Item>\n <DropdownMenu.CheckboxItem checked>Pinned to the profile</DropdownMenu.CheckboxItem>\n <DropdownMenu.Separator />\n <DropdownMenu.Item tone=\"danger\">{icon(\"M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6\")}Delete</DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n );\n}\n"
|
|
29
142
|
},
|
|
30
143
|
"props": [
|
|
31
144
|
{
|