@stridge/noctis 1.0.0-beta.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 +60 -0
- package/dist/_virtual/_rolldown/runtime.js +27 -0
- package/dist/components/accordion/accordion.context.js +15 -0
- package/dist/components/accordion/accordion.d.ts +136 -0
- package/dist/components/accordion/accordion.js +132 -0
- package/dist/components/accordion/accordion.props.d.ts +45 -0
- package/dist/components/accordion/accordion.props.js +53 -0
- package/dist/components/accordion/accordion.slots.d.ts +24 -0
- package/dist/components/accordion/accordion.slots.js +39 -0
- package/dist/components/accordion/accordion.types.d.ts +11 -0
- package/dist/components/accordion/index.d.ts +3 -0
- package/dist/components/alert-dialog/alert-dialog.context.js +16 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +324 -0
- package/dist/components/alert-dialog/alert-dialog.js +279 -0
- package/dist/components/alert-dialog/alert-dialog.props.d.ts +85 -0
- package/dist/components/alert-dialog/alert-dialog.props.js +84 -0
- package/dist/components/alert-dialog/alert-dialog.slots.d.ts +29 -0
- package/dist/components/alert-dialog/alert-dialog.slots.js +52 -0
- package/dist/components/alert-dialog/alert-dialog.types.d.ts +22 -0
- package/dist/components/alert-dialog/index.d.ts +3 -0
- package/dist/components/autocomplete/autocomplete.context.d.ts +5 -0
- package/dist/components/autocomplete/autocomplete.context.js +13 -0
- package/dist/components/autocomplete/autocomplete.d.ts +364 -0
- package/dist/components/autocomplete/autocomplete.js +373 -0
- package/dist/components/autocomplete/autocomplete.props.d.ts +83 -0
- package/dist/components/autocomplete/autocomplete.props.js +63 -0
- package/dist/components/autocomplete/autocomplete.slots.d.ts +32 -0
- package/dist/components/autocomplete/autocomplete.slots.js +61 -0
- package/dist/components/autocomplete/index.d.ts +3 -0
- package/dist/components/avatar/avatar.context.js +21 -0
- package/dist/components/avatar/avatar.d.ts +235 -0
- package/dist/components/avatar/avatar.js +208 -0
- package/dist/components/avatar/avatar.props.d.ts +86 -0
- package/dist/components/avatar/avatar.props.js +78 -0
- package/dist/components/avatar/avatar.slots.d.ts +35 -0
- package/dist/components/avatar/avatar.slots.js +49 -0
- package/dist/components/avatar/avatar.types.d.ts +28 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/button/button.d.ts +91 -0
- package/dist/components/button/button.js +82 -0
- package/dist/components/button/button.props.d.ts +48 -0
- package/dist/components/button/button.props.js +25 -0
- package/dist/components/button/button.slots.d.ts +30 -0
- package/dist/components/button/button.slots.js +40 -0
- package/dist/components/button/button.types.d.ts +12 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button-group/button-group.context.js +15 -0
- package/dist/components/button-group/button-group.d.ts +60 -0
- package/dist/components/button-group/button-group.js +50 -0
- package/dist/components/button-group/button-group.props.d.ts +22 -0
- package/dist/components/button-group/button-group.props.js +33 -0
- package/dist/components/button-group/button-group.slots.d.ts +12 -0
- package/dist/components/button-group/button-group.slots.js +18 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/checkbox/checkbox-group.d.ts +46 -0
- package/dist/components/checkbox/checkbox-group.js +31 -0
- package/dist/components/checkbox/checkbox.context.js +15 -0
- package/dist/components/checkbox/checkbox.d.ts +130 -0
- package/dist/components/checkbox/checkbox.js +117 -0
- package/dist/components/checkbox/checkbox.props.d.ts +84 -0
- package/dist/components/checkbox/checkbox.props.js +49 -0
- package/dist/components/checkbox/checkbox.slots.d.ts +27 -0
- package/dist/components/checkbox/checkbox.slots.js +40 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/code-block/brand-logo.d.ts +37 -0
- package/dist/components/code-block/brand-logo.js +212 -0
- package/dist/components/code-block/code-block.context.js +13 -0
- package/dist/components/code-block/code-block.d.ts +190 -0
- package/dist/components/code-block/code-block.js +267 -0
- package/dist/components/code-block/code-block.props.d.ts +42 -0
- package/dist/components/code-block/code-block.props.js +51 -0
- package/dist/components/code-block/code-block.slots.d.ts +16 -0
- package/dist/components/code-block/code-block.slots.js +31 -0
- package/dist/components/code-block/index.d.ts +3 -0
- package/dist/components/code-block/language-label.js +43 -0
- package/dist/components/collapsible/collapsible.context.js +18 -0
- package/dist/components/collapsible/collapsible.d.ts +167 -0
- package/dist/components/collapsible/collapsible.js +182 -0
- package/dist/components/collapsible/collapsible.props.d.ts +33 -0
- package/dist/components/collapsible/collapsible.props.js +44 -0
- package/dist/components/collapsible/collapsible.slots.d.ts +25 -0
- package/dist/components/collapsible/collapsible.slots.js +40 -0
- package/dist/components/collapsible/collapsible.types.d.ts +23 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/color-picker/area.d.ts +11 -0
- package/dist/components/color-picker/area.js +148 -0
- package/dist/components/color-picker/color-picker.d.ts +110 -0
- package/dist/components/color-picker/color-picker.js +149 -0
- package/dist/components/color-picker/color-picker.props.d.ts +69 -0
- package/dist/components/color-picker/color-picker.props.js +74 -0
- package/dist/components/color-picker/color-picker.slots.js +21 -0
- package/dist/components/color-picker/color.d.ts +18 -0
- package/dist/components/color-picker/color.js +224 -0
- package/dist/components/color-picker/context.d.ts +25 -0
- package/dist/components/color-picker/context.js +23 -0
- package/dist/components/color-picker/eyedropper.d.ts +14 -0
- package/dist/components/color-picker/eyedropper.js +50 -0
- package/dist/components/color-picker/format-tabs.d.ts +11 -0
- package/dist/components/color-picker/format-tabs.js +35 -0
- package/dist/components/color-picker/index.d.ts +3 -0
- package/dist/components/color-picker/inputs.d.ts +16 -0
- package/dist/components/color-picker/inputs.js +61 -0
- package/dist/components/color-picker/sliders.d.ts +17 -0
- package/dist/components/color-picker/sliders.js +94 -0
- package/dist/components/color-picker/store.js +48 -0
- package/dist/components/color-picker/swatch.d.ts +15 -0
- package/dist/components/color-picker/swatch.js +25 -0
- package/dist/components/color-swatch/color-swatch-picker.d.ts +87 -0
- package/dist/components/color-swatch/color-swatch-picker.js +73 -0
- package/dist/components/color-swatch/color-swatch.context.js +8 -0
- package/dist/components/color-swatch/color-swatch.d.ts +55 -0
- package/dist/components/color-swatch/color-swatch.js +48 -0
- package/dist/components/color-swatch/color-swatch.props.d.ts +54 -0
- package/dist/components/color-swatch/color-swatch.props.js +32 -0
- package/dist/components/color-swatch/color-swatch.slots.js +13 -0
- package/dist/components/color-swatch/index.d.ts +2 -0
- package/dist/components/combobox/combobox.context.js +13 -0
- package/dist/components/combobox/combobox.d.ts +328 -0
- package/dist/components/combobox/combobox.js +315 -0
- package/dist/components/combobox/combobox.props.d.ts +85 -0
- package/dist/components/combobox/combobox.props.js +79 -0
- package/dist/components/combobox/combobox.slots.d.ts +28 -0
- package/dist/components/combobox/combobox.slots.js +63 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/context-menu/context-menu.d.ts +254 -0
- package/dist/components/context-menu/context-menu.js +150 -0
- package/dist/components/context-menu/context-menu.props.d.ts +22 -0
- package/dist/components/context-menu/context-menu.props.js +32 -0
- package/dist/components/context-menu/context-menu.slots.d.ts +24 -0
- package/dist/components/context-menu/context-menu.slots.js +42 -0
- package/dist/components/context-menu/index.d.ts +2 -0
- package/dist/components/copy-button/copy-button.d.ts +56 -0
- package/dist/components/copy-button/copy-button.js +88 -0
- package/dist/components/copy-button/copy-button.props.d.ts +27 -0
- package/dist/components/copy-button/copy-button.props.js +51 -0
- package/dist/components/copy-button/copy-button.slots.d.ts +20 -0
- package/dist/components/copy-button/copy-button.slots.js +36 -0
- package/dist/components/copy-button/index.d.ts +2 -0
- package/dist/components/dialog/dialog.context.js +15 -0
- package/dist/components/dialog/dialog.d.ts +299 -0
- package/dist/components/dialog/dialog.js +263 -0
- package/dist/components/dialog/dialog.props.d.ts +71 -0
- package/dist/components/dialog/dialog.props.js +75 -0
- package/dist/components/dialog/dialog.slots.d.ts +26 -0
- package/dist/components/dialog/dialog.slots.js +46 -0
- package/dist/components/dialog/dialog.types.d.ts +16 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/field/field.d.ts +221 -0
- package/dist/components/field/field.js +192 -0
- package/dist/components/field/field.props.d.ts +66 -0
- package/dist/components/field/field.props.js +65 -0
- package/dist/components/field/field.slots.d.ts +35 -0
- package/dist/components/field/field.slots.js +54 -0
- package/dist/components/field/field.types.d.ts +5 -0
- package/dist/components/field/index.d.ts +4 -0
- package/dist/components/inline-code/index.d.ts +1 -0
- package/dist/components/inline-code/inline-code.d.ts +46 -0
- package/dist/components/inline-code/inline-code.js +36 -0
- package/dist/components/inline-code/inline-code.props.d.ts +17 -0
- package/dist/components/inline-code/inline-code.props.js +27 -0
- package/dist/components/inline-code/inline-code.slots.js +8 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/input.context.js +13 -0
- package/dist/components/input/input.d.ts +161 -0
- package/dist/components/input/input.js +117 -0
- package/dist/components/input/input.props.d.ts +51 -0
- package/dist/components/input/input.props.js +50 -0
- package/dist/components/input/input.slots.d.ts +35 -0
- package/dist/components/input/input.slots.js +46 -0
- package/dist/components/input/input.types.d.ts +12 -0
- package/dist/components/kbd/glyphs.js +45 -0
- package/dist/components/kbd/index.d.ts +1 -0
- package/dist/components/kbd/kbd.d.ts +61 -0
- package/dist/components/kbd/kbd.js +233 -0
- package/dist/components/kbd/kbd.props.d.ts +30 -0
- package/dist/components/kbd/kbd.props.js +39 -0
- package/dist/components/kbd/kbd.slots.js +14 -0
- package/dist/components/kbd/use-apple-platform.js +25 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/menu.d.ts +355 -0
- package/dist/components/menu/menu.js +263 -0
- package/dist/components/menu/menu.props.d.ts +92 -0
- package/dist/components/menu/menu.props.js +97 -0
- package/dist/components/menu/menu.slots.d.ts +32 -0
- package/dist/components/menu/menu.slots.js +60 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/menubar.context.js +13 -0
- package/dist/components/menubar/menubar.d.ts +162 -0
- package/dist/components/menubar/menubar.js +122 -0
- package/dist/components/menubar/menubar.props.d.ts +41 -0
- package/dist/components/menubar/menubar.props.js +45 -0
- package/dist/components/menubar/menubar.slots.d.ts +26 -0
- package/dist/components/menubar/menubar.slots.js +40 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/meter.context.d.ts +9 -0
- package/dist/components/meter/meter.context.js +13 -0
- package/dist/components/meter/meter.d.ts +163 -0
- package/dist/components/meter/meter.js +121 -0
- package/dist/components/meter/meter.props.d.ts +50 -0
- package/dist/components/meter/meter.props.js +33 -0
- package/dist/components/meter/meter.slots.d.ts +18 -0
- package/dist/components/meter/meter.slots.js +31 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +328 -0
- package/dist/components/navigation-menu/navigation-menu.js +274 -0
- package/dist/components/navigation-menu/navigation-menu.props.d.ts +98 -0
- package/dist/components/navigation-menu/navigation-menu.props.js +90 -0
- package/dist/components/navigation-menu/navigation-menu.slots.d.ts +34 -0
- package/dist/components/navigation-menu/navigation-menu.slots.js +60 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/number-field.context.d.ts +13 -0
- package/dist/components/number-field/number-field.context.js +13 -0
- package/dist/components/number-field/number-field.d.ts +197 -0
- package/dist/components/number-field/number-field.js +187 -0
- package/dist/components/number-field/number-field.props.d.ts +66 -0
- package/dist/components/number-field/number-field.props.js +50 -0
- package/dist/components/number-field/number-field.slots.d.ts +31 -0
- package/dist/components/number-field/number-field.slots.js +48 -0
- package/dist/components/otp-field/index.d.ts +3 -0
- package/dist/components/otp-field/otp-field.context.js +13 -0
- package/dist/components/otp-field/otp-field.d.ts +99 -0
- package/dist/components/otp-field/otp-field.js +76 -0
- package/dist/components/otp-field/otp-field.props.d.ts +48 -0
- package/dist/components/otp-field/otp-field.props.js +43 -0
- package/dist/components/otp-field/otp-field.slots.d.ts +28 -0
- package/dist/components/otp-field/otp-field.slots.js +39 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/popover.d.ts +192 -0
- package/dist/components/popover/popover.js +152 -0
- package/dist/components/popover/popover.props.d.ts +34 -0
- package/dist/components/popover/popover.props.js +44 -0
- package/dist/components/popover/popover.slots.d.ts +22 -0
- package/dist/components/popover/popover.slots.js +42 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/preview-card.d.ts +182 -0
- package/dist/components/preview-card/preview-card.js +146 -0
- package/dist/components/preview-card/preview-card.props.d.ts +37 -0
- package/dist/components/preview-card/preview-card.props.js +48 -0
- package/dist/components/preview-card/preview-card.slots.d.ts +22 -0
- package/dist/components/preview-card/preview-card.slots.js +39 -0
- package/dist/components/progress/index.d.ts +3 -0
- package/dist/components/progress/progress.context.d.ts +9 -0
- package/dist/components/progress/progress.context.js +13 -0
- package/dist/components/progress/progress.d.ts +139 -0
- package/dist/components/progress/progress.js +92 -0
- package/dist/components/progress/progress.props.d.ts +56 -0
- package/dist/components/progress/progress.props.js +38 -0
- package/dist/components/progress/progress.slots.d.ts +24 -0
- package/dist/components/progress/progress.slots.js +37 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/radio.context.js +5 -0
- package/dist/components/radio/radio.d.ts +205 -0
- package/dist/components/radio/radio.js +168 -0
- package/dist/components/radio/radio.props.d.ts +106 -0
- package/dist/components/radio/radio.props.js +65 -0
- package/dist/components/radio/radio.slots.d.ts +29 -0
- package/dist/components/radio/radio.slots.js +44 -0
- package/dist/components/rail/index.d.ts +3 -0
- package/dist/components/rail/rail.context.d.ts +17 -0
- package/dist/components/rail/rail.context.js +23 -0
- package/dist/components/rail/rail.d.ts +232 -0
- package/dist/components/rail/rail.js +254 -0
- package/dist/components/rail/rail.props.d.ts +98 -0
- package/dist/components/rail/rail.props.js +64 -0
- package/dist/components/rail/rail.slots.d.ts +20 -0
- package/dist/components/rail/rail.slots.js +40 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/scroll-area.context.js +15 -0
- package/dist/components/scroll-area/scroll-area.d.ts +217 -0
- package/dist/components/scroll-area/scroll-area.js +153 -0
- package/dist/components/scroll-area/scroll-area.props.d.ts +73 -0
- package/dist/components/scroll-area/scroll-area.props.js +64 -0
- package/dist/components/scroll-area/scroll-area.slots.d.ts +40 -0
- package/dist/components/scroll-area/scroll-area.slots.js +54 -0
- package/dist/components/scroll-area/scroll-area.types.d.ts +24 -0
- package/dist/components/search-dialog/index.d.ts +3 -0
- package/dist/components/search-dialog/parts/input.d.ts +24 -0
- package/dist/components/search-dialog/parts/input.js +53 -0
- package/dist/components/search-dialog/parts/messages.d.ts +80 -0
- package/dist/components/search-dialog/parts/messages.js +75 -0
- package/dist/components/search-dialog/parts/results.d.ts +43 -0
- package/dist/components/search-dialog/parts/results.js +63 -0
- package/dist/components/search-dialog/parts/root.d.ts +54 -0
- package/dist/components/search-dialog/parts/root.js +99 -0
- package/dist/components/search-dialog/search-dialog.context.d.ts +15 -0
- package/dist/components/search-dialog/search-dialog.context.js +20 -0
- package/dist/components/search-dialog/search-dialog.d.ts +84 -0
- package/dist/components/search-dialog/search-dialog.js +43 -0
- package/dist/components/search-dialog/search-dialog.props.d.ts +45 -0
- package/dist/components/search-dialog/search-dialog.props.js +49 -0
- package/dist/components/search-dialog/search-dialog.slots.d.ts +16 -0
- package/dist/components/search-dialog/search-dialog.slots.js +32 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/select.context.js +17 -0
- package/dist/components/select/select.d.ts +356 -0
- package/dist/components/select/select.js +314 -0
- package/dist/components/select/select.props.d.ts +110 -0
- package/dist/components/select/select.props.js +103 -0
- package/dist/components/select/select.slots.d.ts +38 -0
- package/dist/components/select/select.slots.js +67 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/separator.d.ts +69 -0
- package/dist/components/separator/separator.js +44 -0
- package/dist/components/separator/separator.props.d.ts +30 -0
- package/dist/components/separator/separator.props.js +30 -0
- package/dist/components/separator/separator.slots.d.ts +22 -0
- package/dist/components/separator/separator.slots.js +21 -0
- package/dist/components/separator/separator.types.d.ts +5 -0
- package/dist/components/sheet/index.d.ts +3 -0
- package/dist/components/sheet/sheet-stack.d.ts +106 -0
- package/dist/components/sheet/sheet-stack.js +146 -0
- package/dist/components/sheet/sheet.d.ts +279 -0
- package/dist/components/sheet/sheet.js +264 -0
- package/dist/components/sheet/sheet.props.d.ts +74 -0
- package/dist/components/sheet/sheet.props.js +77 -0
- package/dist/components/sheet/sheet.slots.js +22 -0
- package/dist/components/sheet/sheet.types.d.ts +12 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/slider/slider.context.d.ts +5 -0
- package/dist/components/slider/slider.context.js +29 -0
- package/dist/components/slider/slider.d.ts +230 -0
- package/dist/components/slider/slider.js +274 -0
- package/dist/components/slider/slider.props.d.ts +72 -0
- package/dist/components/slider/slider.props.js +59 -0
- package/dist/components/slider/slider.slots.d.ts +30 -0
- package/dist/components/slider/slider.slots.js +50 -0
- package/dist/components/surface/index.d.ts +1 -0
- package/dist/components/surface/surface.d.ts +84 -0
- package/dist/components/surface/surface.js +48 -0
- package/dist/components/surface/surface.props.d.ts +35 -0
- package/dist/components/surface/surface.props.js +26 -0
- package/dist/components/surface/surface.slots.js +9 -0
- package/dist/components/surface/surface.types.d.ts +14 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/switch.context.js +14 -0
- package/dist/components/switch/switch.d.ts +110 -0
- package/dist/components/switch/switch.js +92 -0
- package/dist/components/switch/switch.props.d.ts +68 -0
- package/dist/components/switch/switch.props.js +41 -0
- package/dist/components/switch/switch.slots.d.ts +23 -0
- package/dist/components/switch/switch.slots.js +35 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +104 -0
- package/dist/components/table/table.js +92 -0
- package/dist/components/table/table.props.d.ts +38 -0
- package/dist/components/table/table.props.js +49 -0
- package/dist/components/table/table.slots.js +17 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/tabs.context.d.ts +9 -0
- package/dist/components/tabs/tabs.context.js +13 -0
- package/dist/components/tabs/tabs.d.ts +139 -0
- package/dist/components/tabs/tabs.js +118 -0
- package/dist/components/tabs/tabs.props.d.ts +59 -0
- package/dist/components/tabs/tabs.props.js +39 -0
- package/dist/components/tabs/tabs.slots.d.ts +20 -0
- package/dist/components/tabs/tabs.slots.js +33 -0
- package/dist/components/textarea/index.d.ts +3 -0
- package/dist/components/textarea/textarea.context.js +13 -0
- package/dist/components/textarea/textarea.d.ts +142 -0
- package/dist/components/textarea/textarea.js +129 -0
- package/dist/components/textarea/textarea.props.d.ts +44 -0
- package/dist/components/textarea/textarea.props.js +32 -0
- package/dist/components/textarea/textarea.slots.d.ts +23 -0
- package/dist/components/textarea/textarea.slots.js +33 -0
- package/dist/components/textarea/textarea.types.d.ts +5 -0
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/toast.d.ts +241 -0
- package/dist/components/toast/toast.js +193 -0
- package/dist/components/toast/toast.manager.d.ts +76 -0
- package/dist/components/toast/toast.manager.js +71 -0
- package/dist/components/toast/toast.props.d.ts +66 -0
- package/dist/components/toast/toast.props.js +74 -0
- package/dist/components/toast/toast.slots.d.ts +30 -0
- package/dist/components/toast/toast.slots.js +49 -0
- package/dist/components/toast/toast.types.d.ts +19 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/toggle.context.d.ts +11 -0
- package/dist/components/toggle/toggle.context.js +14 -0
- package/dist/components/toggle/toggle.d.ts +136 -0
- package/dist/components/toggle/toggle.js +101 -0
- package/dist/components/toggle/toggle.props.d.ts +51 -0
- package/dist/components/toggle/toggle.props.js +29 -0
- package/dist/components/toggle/toggle.slots.d.ts +26 -0
- package/dist/components/toggle/toggle.slots.js +36 -0
- package/dist/components/toolbar/index.d.ts +3 -0
- package/dist/components/toolbar/toolbar.context.js +23 -0
- package/dist/components/toolbar/toolbar.d.ts +218 -0
- package/dist/components/toolbar/toolbar.js +197 -0
- package/dist/components/toolbar/toolbar.props.d.ts +54 -0
- package/dist/components/toolbar/toolbar.props.js +55 -0
- package/dist/components/toolbar/toolbar.slots.d.ts +24 -0
- package/dist/components/toolbar/toolbar.slots.js +37 -0
- package/dist/components/toolbar/toolbar.types.d.ts +15 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/tooltip.d.ts +170 -0
- package/dist/components/tooltip/tooltip.js +143 -0
- package/dist/components/tooltip/tooltip.props.d.ts +36 -0
- package/dist/components/tooltip/tooltip.props.js +42 -0
- package/dist/components/tooltip/tooltip.slots.d.ts +26 -0
- package/dist/components/tooltip/tooltip.slots.js +42 -0
- package/dist/core/derive-threshold-tone.js +35 -0
- package/dist/core/merge-class-name.d.ts +17 -0
- package/dist/core/merge-class-name.js +16 -0
- package/dist/core/noctis-provider.d.ts +38 -0
- package/dist/core/noctis-provider.js +44 -0
- package/dist/core/primitive/index.d.ts +1 -0
- package/dist/core/primitive/primitive.d.ts +44 -0
- package/dist/core/primitive/primitive.js +27 -0
- package/dist/core/radius-scope/index.d.ts +2 -0
- package/dist/core/radius-scope/radius-scope.d.ts +43 -0
- package/dist/core/radius-scope/radius-scope.js +36 -0
- package/dist/core/radius-scope/radius-scope.styles.d.ts +13 -0
- package/dist/core/radius-scope/radius-scope.styles.js +11 -0
- package/dist/core/render.d.ts +24 -0
- package/dist/core/render.js +12 -0
- package/dist/core/use-copy.d.ts +13 -0
- package/dist/core/use-copy.js +30 -0
- package/dist/core/use-injected-labels.js +55 -0
- package/dist/core/use-reduced-motion.d.ts +9 -0
- package/dist/core/use-reduced-motion.js +26 -0
- package/dist/core/visually-hidden/index.d.ts +1 -0
- package/dist/core/visually-hidden/visually-hidden.d.ts +24 -0
- package/dist/core/visually-hidden/visually-hidden.js +19 -0
- package/dist/i18n/default-messages.d.ts +12 -0
- package/dist/i18n/default-messages.js +10 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/messages/index.d.ts +2 -0
- package/dist/i18n/messages/index.js +2 -0
- package/dist/icons/glyphs.d.ts +2 -0
- package/dist/icons/glyphs.js +2 -0
- package/dist/icons/icon.d.ts +40 -0
- package/dist/icons/icon.js +26 -0
- package/dist/icons/icon.styles.d.ts +9 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +112 -0
- package/dist/primitives/accordion.d.ts +7 -0
- package/dist/primitives/accordion.js +8 -0
- package/dist/primitives/alert-dialog.d.ts +7 -0
- package/dist/primitives/alert-dialog.js +8 -0
- package/dist/primitives/autocomplete/autocomplete.d.ts +58 -0
- package/dist/primitives/autocomplete/autocomplete.js +58 -0
- package/dist/primitives/autocomplete/index.d.ts +1 -0
- package/dist/primitives/autocomplete.d.ts +2 -0
- package/dist/primitives/autocomplete.js +2 -0
- package/dist/primitives/avatar.d.ts +7 -0
- package/dist/primitives/avatar.js +8 -0
- package/dist/primitives/button.d.ts +7 -0
- package/dist/primitives/button.js +8 -0
- package/dist/primitives/checkbox-group.d.ts +7 -0
- package/dist/primitives/checkbox-group.js +8 -0
- package/dist/primitives/checkbox.d.ts +7 -0
- package/dist/primitives/checkbox.js +8 -0
- package/dist/primitives/collapsible.d.ts +7 -0
- package/dist/primitives/collapsible.js +8 -0
- package/dist/primitives/combobox/combobox.d.ts +71 -0
- package/dist/primitives/combobox/combobox.js +66 -0
- package/dist/primitives/combobox/index.d.ts +1 -0
- package/dist/primitives/combobox.d.ts +2 -0
- package/dist/primitives/combobox.js +2 -0
- package/dist/primitives/context-menu.d.ts +7 -0
- package/dist/primitives/context-menu.js +8 -0
- package/dist/primitives/csp-provider.d.ts +1 -0
- package/dist/primitives/csp-provider.js +2 -0
- package/dist/primitives/dialog.d.ts +7 -0
- package/dist/primitives/dialog.js +8 -0
- package/dist/primitives/direction-provider.d.ts +1 -0
- package/dist/primitives/direction-provider.js +8 -0
- package/dist/primitives/drawer.d.ts +1 -0
- package/dist/primitives/drawer.js +2 -0
- package/dist/primitives/field.d.ts +7 -0
- package/dist/primitives/field.js +8 -0
- package/dist/primitives/fieldset.d.ts +7 -0
- package/dist/primitives/fieldset.js +8 -0
- package/dist/primitives/form.d.ts +7 -0
- package/dist/primitives/form.js +8 -0
- package/dist/primitives/index.d.ts +79 -0
- package/dist/primitives/index.js +113 -0
- package/dist/primitives/input.d.ts +7 -0
- package/dist/primitives/input.js +8 -0
- package/dist/primitives/menu.d.ts +7 -0
- package/dist/primitives/menu.js +8 -0
- package/dist/primitives/menubar.d.ts +7 -0
- package/dist/primitives/menubar.js +8 -0
- package/dist/primitives/meter/index.d.ts +1 -0
- package/dist/primitives/meter/meter.d.ts +56 -0
- package/dist/primitives/meter/meter.js +59 -0
- package/dist/primitives/meter.d.ts +2 -0
- package/dist/primitives/meter.js +2 -0
- package/dist/primitives/navigation-menu.d.ts +7 -0
- package/dist/primitives/navigation-menu.js +8 -0
- package/dist/primitives/number-field/context.d.ts +13 -0
- package/dist/primitives/number-field/context.js +36 -0
- package/dist/primitives/number-field/index.d.ts +2 -0
- package/dist/primitives/number-field/number-field.d.ts +90 -0
- package/dist/primitives/number-field/number-field.js +107 -0
- package/dist/primitives/number-field.d.ts +3 -0
- package/dist/primitives/number-field.js +2 -0
- package/dist/primitives/otp-field.d.ts +7 -0
- package/dist/primitives/otp-field.js +8 -0
- package/dist/primitives/popover.d.ts +7 -0
- package/dist/primitives/popover.js +8 -0
- package/dist/primitives/preview-card.d.ts +7 -0
- package/dist/primitives/preview-card.js +8 -0
- package/dist/primitives/progress/index.d.ts +1 -0
- package/dist/primitives/progress/progress.d.ts +56 -0
- package/dist/primitives/progress/progress.js +59 -0
- package/dist/primitives/progress.d.ts +2 -0
- package/dist/primitives/progress.js +2 -0
- package/dist/primitives/radio-group.d.ts +7 -0
- package/dist/primitives/radio-group.js +8 -0
- package/dist/primitives/radio.d.ts +7 -0
- package/dist/primitives/radio.js +8 -0
- package/dist/primitives/scroll-area.d.ts +7 -0
- package/dist/primitives/scroll-area.js +8 -0
- package/dist/primitives/select.d.ts +7 -0
- package/dist/primitives/select.js +8 -0
- package/dist/primitives/separator.d.ts +7 -0
- package/dist/primitives/separator.js +8 -0
- package/dist/primitives/slider/context.d.ts +12 -0
- package/dist/primitives/slider/context.js +18 -0
- package/dist/primitives/slider/index.d.ts +2 -0
- package/dist/primitives/slider/slider.d.ts +83 -0
- package/dist/primitives/slider/slider.js +99 -0
- package/dist/primitives/slider.d.ts +3 -0
- package/dist/primitives/slider.js +2 -0
- package/dist/primitives/switch.d.ts +1 -0
- package/dist/primitives/switch.js +2 -0
- package/dist/primitives/tabs.d.ts +7 -0
- package/dist/primitives/tabs.js +8 -0
- package/dist/primitives/toast/context.d.ts +11 -0
- package/dist/primitives/toast/context.js +18 -0
- package/dist/primitives/toast/index.d.ts +2 -0
- package/dist/primitives/toast/toast.d.ts +122 -0
- package/dist/primitives/toast/toast.js +133 -0
- package/dist/primitives/toast.d.ts +3 -0
- package/dist/primitives/toast.js +2 -0
- package/dist/primitives/toggle-group.d.ts +7 -0
- package/dist/primitives/toggle-group.js +8 -0
- package/dist/primitives/toggle.d.ts +7 -0
- package/dist/primitives/toggle.js +8 -0
- package/dist/primitives/toolbar.d.ts +7 -0
- package/dist/primitives/toolbar.js +8 -0
- package/dist/primitives/tooltip.d.ts +7 -0
- package/dist/primitives/tooltip.js +8 -0
- package/dist/props.d.ts +46 -0
- package/dist/props.js +46 -0
- package/dist/styles.css +11513 -0
- package/dist/tailwind/cn.d.ts +33 -0
- package/dist/tailwind/cn.js +42 -0
- package/dist/tailwind/index.d.ts +3 -0
- package/dist/tailwind/index.js +3 -0
- package/dist/tailwind/tv.d.ts +20 -0
- package/dist/tailwind/tv.js +11 -0
- package/dist/tailwind.css +485 -0
- package/dist/theme/react.d.ts +1 -0
- package/dist/theme/react.js +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +1 -0
- package/dist/tokens/react.d.ts +1 -0
- package/dist/tokens/react.js +1 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tokens.js +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/components/textarea/textarea.slots.ts
|
|
2
|
+
/**
|
|
3
|
+
* The slot vocabulary every `Textarea` part stamps as its `data-slot`. The in-field action and count are
|
|
4
|
+
* the shared `field-*` parts (see {@link FieldDataAttributes}); the toolbar hosts them.
|
|
5
|
+
*/
|
|
6
|
+
const TEXTAREA_SLOTS = {
|
|
7
|
+
root: "noctis-textarea",
|
|
8
|
+
control: "noctis-textarea-control",
|
|
9
|
+
toolbar: "noctis-textarea-toolbar"
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The data attributes the {@link Textarea} (and the Base UI control it renders) expose for styling and
|
|
13
|
+
* testing. The shell's look is keyed off the root `data-slot="noctis-textarea"` plus `data-size`. State
|
|
14
|
+
* flows from the editable control: the shell reads the control's `:disabled`/`aria-invalid`/`readonly`
|
|
15
|
+
* (and Base UI/Field `data-*`) through `:has()`, so validity and disabled have one source of truth, with
|
|
16
|
+
* the root's own `[data-invalid]`/`[data-disabled]` as additive shell-only overrides. Focus is calm and
|
|
17
|
+
* ring-less, shifting the border to the focus role, mirroring Input.
|
|
18
|
+
*/
|
|
19
|
+
let TextareaDataAttributes = /* @__PURE__ */ function(TextareaDataAttributes) {
|
|
20
|
+
/** The rendered element of a given part (root shell, control, or toolbar). */
|
|
21
|
+
TextareaDataAttributes["slot"] = "data-slot";
|
|
22
|
+
/** The size scale — `sm` | `md` | `lg`; the generated layer keys the per-size internals off it. */
|
|
23
|
+
TextareaDataAttributes["size"] = "data-size";
|
|
24
|
+
/** Present when the field is in an invalid state — set by Base UI/Field on the control, or by the root override. */
|
|
25
|
+
TextareaDataAttributes["invalid"] = "data-invalid";
|
|
26
|
+
/** Present when the field is disabled — set by Base UI on the control, or by the root override. */
|
|
27
|
+
TextareaDataAttributes["disabled"] = "data-disabled";
|
|
28
|
+
/** Present when the field is read-only — set by Base UI on the control; the shell holds the rest border. */
|
|
29
|
+
TextareaDataAttributes["readonly"] = "data-readonly";
|
|
30
|
+
return TextareaDataAttributes;
|
|
31
|
+
}({});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { TEXTAREA_SLOTS, TextareaDataAttributes };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ToastPlacement, ToastType } from "./toast.types.js";
|
|
2
|
+
import { ToastManager, ToastObject, ToastOptions, ToastPromiseOptions, ToastStatusOptions, ToastUpdateOptions, useToast } from "./toast.manager.js";
|
|
3
|
+
import { Toast } from "./toast.js";
|
|
4
|
+
import { ToastDataAttributes } from "./toast.slots.js";
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Toast as Toast$1 } from "../../primitives/toast/toast.js";
|
|
2
|
+
import { ToastPlacement, ToastType } from "./toast.types.js";
|
|
3
|
+
import { ToastPartProps, ToastRootPropsArgs, ToastViewportPropsArgs, actionProps, closeProps, contentProps, descriptionProps, iconProps, rootProps, spinnerProps, titleProps, viewportProps } from "./toast.props.js";
|
|
4
|
+
import { ToastManager, ToastObject, ToastOptions, ToastPromiseOptions, ToastStatusOptions, ToastUpdateOptions, useToast } from "./toast.manager.js";
|
|
5
|
+
import { ReactElement } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/toast/toast.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Hosts the toast manager and the timers, and shares the resolved viewport label. Wrap the app (or the
|
|
10
|
+
* region that raises toasts) once. `timeout` (default `5000`ms; `0` disables auto-dismiss), `limit`
|
|
11
|
+
* (default `3` — older toasts collapse behind the stack), and the translated `labels` flow from here.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link Toast.Provider.Props}
|
|
14
|
+
*/
|
|
15
|
+
declare function ToastProvider(props: Toast.Provider.Props): ReactElement;
|
|
16
|
+
/**
|
|
17
|
+
* The fixed live region that holds the stack, docked to the screen corner via `placement` (default
|
|
18
|
+
* `bottom-end`) and labelled with the translated `notifications` string (an explicit `aria-label` wins).
|
|
19
|
+
* The stack collapses into a peek by default and fans out on hover/focus. `placement` is logical — the
|
|
20
|
+
* `*-start`/`*-end` corners flip under RTL, and top placements enter from above.
|
|
21
|
+
*
|
|
22
|
+
* Slot: `noctis-toast-viewport` (with `data-placement` and `data-expanded` when fanned out). Styling is
|
|
23
|
+
* precompiled in `toast.css`.
|
|
24
|
+
* @see {@link Toast.Viewport.Props}
|
|
25
|
+
*/
|
|
26
|
+
declare function ToastViewport({
|
|
27
|
+
placement,
|
|
28
|
+
...props
|
|
29
|
+
}: Toast.Viewport.Props): ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* Groups the parts of one toast and renders them on an elevated `<Surface>`, so each toast carries the
|
|
32
|
+
* elevated scope and its base paint — controls inside (the action and close buttons) re-derive off that
|
|
33
|
+
* base and separate cleanly. Pass the `toast` object from `useToast().toasts`; its `type` drives the
|
|
34
|
+
* leading status accent. Swipe-to-dismiss is enabled toward the docked corner (down/end).
|
|
35
|
+
*
|
|
36
|
+
* Slot: `noctis-toast` (with `data-type`, `data-swiping`, `data-starting-style`/`data-ending-style`).
|
|
37
|
+
* @see {@link Toast.Root.Props}
|
|
38
|
+
*/
|
|
39
|
+
declare function ToastRoot({
|
|
40
|
+
toast,
|
|
41
|
+
className,
|
|
42
|
+
swipeDirection,
|
|
43
|
+
...props
|
|
44
|
+
}: Toast.Root.Props): ReactElement;
|
|
45
|
+
/**
|
|
46
|
+
* The title/description/actions column, growing to fill beside the close button.
|
|
47
|
+
*
|
|
48
|
+
* Slot: `noctis-toast-content`.
|
|
49
|
+
* @see {@link Toast.Content.Props}
|
|
50
|
+
*/
|
|
51
|
+
declare function ToastContent(props: Toast.Content.Props): ReactElement;
|
|
52
|
+
/**
|
|
53
|
+
* The toast's accessible name, linked to the root via `aria-labelledby`.
|
|
54
|
+
*
|
|
55
|
+
* Slot: `noctis-toast-title`.
|
|
56
|
+
* @see {@link Toast.Title.Props}
|
|
57
|
+
*/
|
|
58
|
+
declare function ToastTitle(props: Toast.Title.Props): ReactElement;
|
|
59
|
+
/**
|
|
60
|
+
* Supporting copy under the title, linked to the root via `aria-describedby`.
|
|
61
|
+
*
|
|
62
|
+
* Slot: `noctis-toast-description`.
|
|
63
|
+
* @see {@link Toast.Description.Props}
|
|
64
|
+
*/
|
|
65
|
+
declare function ToastDescription(props: Toast.Description.Props): ReactElement;
|
|
66
|
+
/**
|
|
67
|
+
* An optional leading status glyph (e.g. a check for `success`, a triangle for `warning`). Compose the
|
|
68
|
+
* glyph as its child — `<Toast.Icon><Icon icon={CircleCheck} /></Toast.Icon>` — and it inherits the
|
|
69
|
+
* toast's status colour centrally, so the icon is the single chromatic signal. Decorative by
|
|
70
|
+
* default (`aria-hidden`); the title carries the accessible message.
|
|
71
|
+
*
|
|
72
|
+
* Slot: `noctis-toast-icon`.
|
|
73
|
+
* @see {@link Toast.Icon.Props}
|
|
74
|
+
*/
|
|
75
|
+
declare function ToastIcon(props: Toast.Icon.Props): ReactElement;
|
|
76
|
+
/**
|
|
77
|
+
* The loading spinner for the async-pending phase — render it when the toast's `type` is `loading` (or
|
|
78
|
+
* during a `promise()`'s loading phase). A neutral, CSS-drawn ring that spins, going static under
|
|
79
|
+
* reduced motion; labelled with the translated `loading` string (`role="status"`).
|
|
80
|
+
*
|
|
81
|
+
* Slot: `noctis-toast-spinner`.
|
|
82
|
+
* @see {@link Toast.Spinner.Props}
|
|
83
|
+
*/
|
|
84
|
+
declare function ToastSpinner(props: Toast.Spinner.Props): ReactElement;
|
|
85
|
+
/**
|
|
86
|
+
* An inline action inside a toast (e.g. Undo). Carries the toast's status accent and a focus-visible
|
|
87
|
+
* ring; compose a `Button` through `render` for a full button look, or use the styled default.
|
|
88
|
+
*
|
|
89
|
+
* Slot: `noctis-toast-action`.
|
|
90
|
+
* @see {@link Toast.Action.Props}
|
|
91
|
+
*/
|
|
92
|
+
declare function ToastAction(props: Toast.Action.Props): ReactElement;
|
|
93
|
+
/**
|
|
94
|
+
* The trailing dismiss button. Renders a bare button with a quiet default look; compose a `Button`
|
|
95
|
+
* through `render` to inherit its behaviour. Give it an `aria-label` for the accessible name.
|
|
96
|
+
*
|
|
97
|
+
* Slot: `noctis-toast-close`.
|
|
98
|
+
* @see {@link Toast.Close.Props}
|
|
99
|
+
*/
|
|
100
|
+
declare function ToastClose(props: Toast.Close.Props): ReactElement;
|
|
101
|
+
/**
|
|
102
|
+
* Portals an anchored toast to the end of the document, out of the stacked viewport flow. Pair it with
|
|
103
|
+
* `Toast.Positioner` and the `positionerProps` option on a raised toast to pin a transient toast to a
|
|
104
|
+
* trigger (e.g. a "Copied" bubble). Stacked toasts do not need this — the viewport already portals.
|
|
105
|
+
*
|
|
106
|
+
* @see {@link Toast.Portal.Props}
|
|
107
|
+
*/
|
|
108
|
+
declare function ToastPortal(props: Toast.Portal.Props): ReactElement;
|
|
109
|
+
/**
|
|
110
|
+
* Positions an anchored toast against its trigger, mirroring popup positioning (`side`, `align`,
|
|
111
|
+
* `sideOffset`, collision avoidance). Supply the anchor through the raised toast's `positionerProps`.
|
|
112
|
+
*
|
|
113
|
+
* Slot: `noctis-toast-positioner`.
|
|
114
|
+
* @see {@link Toast.Positioner.Props}
|
|
115
|
+
*/
|
|
116
|
+
declare function ToastPositioner(props: Toast.Positioner.Props): ReactElement;
|
|
117
|
+
/**
|
|
118
|
+
* The pointer arrow of an anchored toast, aimed at its trigger. Stamps `data-side`/`data-align` for the
|
|
119
|
+
* CSS to rotate it to the resolved side.
|
|
120
|
+
*
|
|
121
|
+
* Slot: `noctis-toast-arrow`.
|
|
122
|
+
* @see {@link Toast.Arrow.Props}
|
|
123
|
+
*/
|
|
124
|
+
declare function ToastArrow(props: Toast.Arrow.Props): ReactElement;
|
|
125
|
+
/**
|
|
126
|
+
* Transient notification messages — a stacked, auto-dismissing, swipe-to-dismiss queue raised
|
|
127
|
+
* imperatively. Built on Base UI's Toast for focus, live-region announcement, timers, and swipe;
|
|
128
|
+
* the Noctis layer renders each toast on an elevated `<Surface>` and exposes a typed `useToast()`
|
|
129
|
+
* manager. Wrap the tree in `Toast.Provider`, render a `Toast.Viewport` that maps `useToast().toasts`
|
|
130
|
+
* into `Toast.Root`s, and raise toasts from anywhere with `useToast().success(…)` / `.info(…)` / etc.
|
|
131
|
+
*
|
|
132
|
+
* Styling is precompiled in `toast.css`, keyed off each part's `data-slot` (plus `data-type` on the
|
|
133
|
+
* root); the root renders through `Surface` for its elevated scope and base paint. Each part's function
|
|
134
|
+
* value carries the D12 `props()` escape hatch via `Object.assign` — spread it onto a foreign element
|
|
135
|
+
* to style it as that part.
|
|
136
|
+
*
|
|
137
|
+
* The runtime compound is a plain object (kept tree-shakeable); per-part prop and state types are
|
|
138
|
+
* exposed through the matching `Toast` namespace below — e.g. `Toast.Root.Props`, `Toast.Close.State`.
|
|
139
|
+
*/
|
|
140
|
+
declare const Toast: {
|
|
141
|
+
Provider: typeof ToastProvider;
|
|
142
|
+
Viewport: typeof ToastViewport & {
|
|
143
|
+
props: typeof viewportProps;
|
|
144
|
+
};
|
|
145
|
+
Root: typeof ToastRoot & {
|
|
146
|
+
props: typeof rootProps;
|
|
147
|
+
};
|
|
148
|
+
Content: typeof ToastContent & {
|
|
149
|
+
props: typeof contentProps;
|
|
150
|
+
};
|
|
151
|
+
Title: typeof ToastTitle & {
|
|
152
|
+
props: typeof titleProps;
|
|
153
|
+
};
|
|
154
|
+
Description: typeof ToastDescription & {
|
|
155
|
+
props: typeof descriptionProps;
|
|
156
|
+
};
|
|
157
|
+
Icon: typeof ToastIcon & {
|
|
158
|
+
props: typeof iconProps;
|
|
159
|
+
};
|
|
160
|
+
Spinner: typeof ToastSpinner & {
|
|
161
|
+
props: typeof spinnerProps;
|
|
162
|
+
};
|
|
163
|
+
Action: typeof ToastAction & {
|
|
164
|
+
props: typeof actionProps;
|
|
165
|
+
};
|
|
166
|
+
Close: typeof ToastClose & {
|
|
167
|
+
props: typeof closeProps;
|
|
168
|
+
};
|
|
169
|
+
Portal: typeof ToastPortal;
|
|
170
|
+
Positioner: typeof ToastPositioner;
|
|
171
|
+
Arrow: typeof ToastArrow;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Per-part prop and state types, mirroring Base UI's `Component.Part.Props` convention. This namespace
|
|
175
|
+
* is types-only — it emits no runtime code and merges with the `Toast` object above, so `Toast.Root` is
|
|
176
|
+
* the component value while `Toast.Root.Props` is its prop type.
|
|
177
|
+
*/
|
|
178
|
+
declare namespace Toast {
|
|
179
|
+
/** The status type driving a toast's leading accent — re-points it to the matching status role. */
|
|
180
|
+
type Type = ToastType;
|
|
181
|
+
/** The logical placement the viewport docks at — the `*-start`/`*-end` corners flip under RTL. */
|
|
182
|
+
type Placement = ToastPlacement;
|
|
183
|
+
/** The spreadable data-attribute prop bag every `Toast.*.props()` returns (D12). */
|
|
184
|
+
type PartProps = ToastPartProps;
|
|
185
|
+
namespace Provider {
|
|
186
|
+
type Props = Toast$1.Provider.Props;
|
|
187
|
+
}
|
|
188
|
+
namespace Viewport {
|
|
189
|
+
type Props = Toast$1.Viewport.Props & {
|
|
190
|
+
/** Where the viewport docks on screen — logical, flips under RTL. Defaults to `bottom-end`. */placement?: ToastPlacement;
|
|
191
|
+
};
|
|
192
|
+
type State = Toast$1.Viewport.State;
|
|
193
|
+
/** Argument to the `Toast.Viewport.props(...)` escape-hatch helper. */
|
|
194
|
+
type PropsArgs = ToastViewportPropsArgs;
|
|
195
|
+
}
|
|
196
|
+
namespace Root {
|
|
197
|
+
type Props = Toast$1.Root.Props;
|
|
198
|
+
type State = Toast$1.Root.State;
|
|
199
|
+
/** Argument to the `Toast.Root.props(...)` escape-hatch helper. */
|
|
200
|
+
type PropsArgs = ToastRootPropsArgs;
|
|
201
|
+
}
|
|
202
|
+
namespace Content {
|
|
203
|
+
type Props = Toast$1.Content.Props;
|
|
204
|
+
type State = Toast$1.Content.State;
|
|
205
|
+
}
|
|
206
|
+
namespace Title {
|
|
207
|
+
type Props = Toast$1.Title.Props;
|
|
208
|
+
type State = Toast$1.Title.State;
|
|
209
|
+
}
|
|
210
|
+
namespace Description {
|
|
211
|
+
type Props = Toast$1.Description.Props;
|
|
212
|
+
type State = Toast$1.Description.State;
|
|
213
|
+
}
|
|
214
|
+
namespace Icon {
|
|
215
|
+
type Props = Toast$1.Icon.Props;
|
|
216
|
+
}
|
|
217
|
+
namespace Spinner {
|
|
218
|
+
type Props = Toast$1.Spinner.Props;
|
|
219
|
+
}
|
|
220
|
+
namespace Action {
|
|
221
|
+
type Props = Toast$1.Action.Props;
|
|
222
|
+
type State = Toast$1.Action.State;
|
|
223
|
+
}
|
|
224
|
+
namespace Close {
|
|
225
|
+
type Props = Toast$1.Close.Props;
|
|
226
|
+
type State = Toast$1.Close.State;
|
|
227
|
+
}
|
|
228
|
+
namespace Portal {
|
|
229
|
+
type Props = Toast$1.Portal.Props;
|
|
230
|
+
}
|
|
231
|
+
namespace Positioner {
|
|
232
|
+
type Props = Toast$1.Positioner.Props;
|
|
233
|
+
type State = Toast$1.Positioner.State;
|
|
234
|
+
}
|
|
235
|
+
namespace Arrow {
|
|
236
|
+
type Props = Toast$1.Arrow.Props;
|
|
237
|
+
type State = Toast$1.Arrow.State;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
export { Toast };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Surface } from "../surface/surface.js";
|
|
3
|
+
import { direction_provider_exports } from "../../primitives/direction-provider.js";
|
|
4
|
+
import { Toast as Toast$2 } from "../../primitives/toast/toast.js";
|
|
5
|
+
import { TOAST_SLOTS } from "./toast.slots.js";
|
|
6
|
+
import { actionProps, closeProps, contentProps, descriptionProps, iconProps, resolveSwipeDirection, rootProps, spinnerProps, titleProps, viewportProps } from "./toast.props.js";
|
|
7
|
+
import "./toast.manager.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { Toast } from "@base-ui/react/toast";
|
|
10
|
+
//#region src/components/toast/toast.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Hosts the toast manager and the timers, and shares the resolved viewport label. Wrap the app (or the
|
|
13
|
+
* region that raises toasts) once. `timeout` (default `5000`ms; `0` disables auto-dismiss), `limit`
|
|
14
|
+
* (default `3` — older toasts collapse behind the stack), and the translated `labels` flow from here.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link Toast.Provider.Props}
|
|
17
|
+
*/
|
|
18
|
+
function ToastProvider(props) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Toast$2.Provider, { ...props });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The fixed live region that holds the stack, docked to the screen corner via `placement` (default
|
|
23
|
+
* `bottom-end`) and labelled with the translated `notifications` string (an explicit `aria-label` wins).
|
|
24
|
+
* The stack collapses into a peek by default and fans out on hover/focus. `placement` is logical — the
|
|
25
|
+
* `*-start`/`*-end` corners flip under RTL, and top placements enter from above.
|
|
26
|
+
*
|
|
27
|
+
* Slot: `noctis-toast-viewport` (with `data-placement` and `data-expanded` when fanned out). Styling is
|
|
28
|
+
* precompiled in `toast.css`.
|
|
29
|
+
* @see {@link Toast.Viewport.Props}
|
|
30
|
+
*/
|
|
31
|
+
function ToastViewport({ placement = "bottom-end", ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Toast$2.Viewport, {
|
|
33
|
+
"data-placement": placement,
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Groups the parts of one toast and renders them on an elevated `<Surface>`, so each toast carries the
|
|
39
|
+
* elevated scope and its base paint — controls inside (the action and close buttons) re-derive off that
|
|
40
|
+
* base and separate cleanly. Pass the `toast` object from `useToast().toasts`; its `type` drives the
|
|
41
|
+
* leading status accent. Swipe-to-dismiss is enabled toward the docked corner (down/end).
|
|
42
|
+
*
|
|
43
|
+
* Slot: `noctis-toast` (with `data-type`, `data-swiping`, `data-starting-style`/`data-ending-style`).
|
|
44
|
+
* @see {@link Toast.Root.Props}
|
|
45
|
+
*/
|
|
46
|
+
function ToastRoot({ toast, className, swipeDirection, ...props }) {
|
|
47
|
+
const direction = (0, direction_provider_exports.useDirection)();
|
|
48
|
+
const resolvedSwipeDirection = swipeDirection ?? resolveSwipeDirection(direction);
|
|
49
|
+
return /* @__PURE__ */ jsx(Surface, {
|
|
50
|
+
elevation: "elevated",
|
|
51
|
+
shadow: "popover",
|
|
52
|
+
"data-slot": TOAST_SLOTS.root,
|
|
53
|
+
"data-type": toast.type,
|
|
54
|
+
render: /* @__PURE__ */ jsx(Toast.Root, {
|
|
55
|
+
toast,
|
|
56
|
+
swipeDirection: resolvedSwipeDirection,
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The title/description/actions column, growing to fill beside the close button.
|
|
64
|
+
*
|
|
65
|
+
* Slot: `noctis-toast-content`.
|
|
66
|
+
* @see {@link Toast.Content.Props}
|
|
67
|
+
*/
|
|
68
|
+
function ToastContent(props) {
|
|
69
|
+
return /* @__PURE__ */ jsx(Toast$2.Content, { ...props });
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The toast's accessible name, linked to the root via `aria-labelledby`.
|
|
73
|
+
*
|
|
74
|
+
* Slot: `noctis-toast-title`.
|
|
75
|
+
* @see {@link Toast.Title.Props}
|
|
76
|
+
*/
|
|
77
|
+
function ToastTitle(props) {
|
|
78
|
+
return /* @__PURE__ */ jsx(Toast$2.Title, { ...props });
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Supporting copy under the title, linked to the root via `aria-describedby`.
|
|
82
|
+
*
|
|
83
|
+
* Slot: `noctis-toast-description`.
|
|
84
|
+
* @see {@link Toast.Description.Props}
|
|
85
|
+
*/
|
|
86
|
+
function ToastDescription(props) {
|
|
87
|
+
return /* @__PURE__ */ jsx(Toast$2.Description, { ...props });
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* An optional leading status glyph (e.g. a check for `success`, a triangle for `warning`). Compose the
|
|
91
|
+
* glyph as its child — `<Toast.Icon><Icon icon={CircleCheck} /></Toast.Icon>` — and it inherits the
|
|
92
|
+
* toast's status colour centrally, so the icon is the single chromatic signal. Decorative by
|
|
93
|
+
* default (`aria-hidden`); the title carries the accessible message.
|
|
94
|
+
*
|
|
95
|
+
* Slot: `noctis-toast-icon`.
|
|
96
|
+
* @see {@link Toast.Icon.Props}
|
|
97
|
+
*/
|
|
98
|
+
function ToastIcon(props) {
|
|
99
|
+
return /* @__PURE__ */ jsx(Toast$2.Icon, { ...props });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The loading spinner for the async-pending phase — render it when the toast's `type` is `loading` (or
|
|
103
|
+
* during a `promise()`'s loading phase). A neutral, CSS-drawn ring that spins, going static under
|
|
104
|
+
* reduced motion; labelled with the translated `loading` string (`role="status"`).
|
|
105
|
+
*
|
|
106
|
+
* Slot: `noctis-toast-spinner`.
|
|
107
|
+
* @see {@link Toast.Spinner.Props}
|
|
108
|
+
*/
|
|
109
|
+
function ToastSpinner(props) {
|
|
110
|
+
return /* @__PURE__ */ jsx(Toast$2.Spinner, { ...props });
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* An inline action inside a toast (e.g. Undo). Carries the toast's status accent and a focus-visible
|
|
114
|
+
* ring; compose a `Button` through `render` for a full button look, or use the styled default.
|
|
115
|
+
*
|
|
116
|
+
* Slot: `noctis-toast-action`.
|
|
117
|
+
* @see {@link Toast.Action.Props}
|
|
118
|
+
*/
|
|
119
|
+
function ToastAction(props) {
|
|
120
|
+
return /* @__PURE__ */ jsx(Toast$2.Action, { ...props });
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The trailing dismiss button. Renders a bare button with a quiet default look; compose a `Button`
|
|
124
|
+
* through `render` to inherit its behaviour. Give it an `aria-label` for the accessible name.
|
|
125
|
+
*
|
|
126
|
+
* Slot: `noctis-toast-close`.
|
|
127
|
+
* @see {@link Toast.Close.Props}
|
|
128
|
+
*/
|
|
129
|
+
function ToastClose(props) {
|
|
130
|
+
return /* @__PURE__ */ jsx(Toast$2.Close, { ...props });
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Portals an anchored toast to the end of the document, out of the stacked viewport flow. Pair it with
|
|
134
|
+
* `Toast.Positioner` and the `positionerProps` option on a raised toast to pin a transient toast to a
|
|
135
|
+
* trigger (e.g. a "Copied" bubble). Stacked toasts do not need this — the viewport already portals.
|
|
136
|
+
*
|
|
137
|
+
* @see {@link Toast.Portal.Props}
|
|
138
|
+
*/
|
|
139
|
+
function ToastPortal(props) {
|
|
140
|
+
return /* @__PURE__ */ jsx(Toast$2.Portal, { ...props });
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Positions an anchored toast against its trigger, mirroring popup positioning (`side`, `align`,
|
|
144
|
+
* `sideOffset`, collision avoidance). Supply the anchor through the raised toast's `positionerProps`.
|
|
145
|
+
*
|
|
146
|
+
* Slot: `noctis-toast-positioner`.
|
|
147
|
+
* @see {@link Toast.Positioner.Props}
|
|
148
|
+
*/
|
|
149
|
+
function ToastPositioner(props) {
|
|
150
|
+
return /* @__PURE__ */ jsx(Toast$2.Positioner, { ...props });
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The pointer arrow of an anchored toast, aimed at its trigger. Stamps `data-side`/`data-align` for the
|
|
154
|
+
* CSS to rotate it to the resolved side.
|
|
155
|
+
*
|
|
156
|
+
* Slot: `noctis-toast-arrow`.
|
|
157
|
+
* @see {@link Toast.Arrow.Props}
|
|
158
|
+
*/
|
|
159
|
+
function ToastArrow(props) {
|
|
160
|
+
return /* @__PURE__ */ jsx(Toast$2.Arrow, { ...props });
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Transient notification messages — a stacked, auto-dismissing, swipe-to-dismiss queue raised
|
|
164
|
+
* imperatively. Built on Base UI's Toast for focus, live-region announcement, timers, and swipe;
|
|
165
|
+
* the Noctis layer renders each toast on an elevated `<Surface>` and exposes a typed `useToast()`
|
|
166
|
+
* manager. Wrap the tree in `Toast.Provider`, render a `Toast.Viewport` that maps `useToast().toasts`
|
|
167
|
+
* into `Toast.Root`s, and raise toasts from anywhere with `useToast().success(…)` / `.info(…)` / etc.
|
|
168
|
+
*
|
|
169
|
+
* Styling is precompiled in `toast.css`, keyed off each part's `data-slot` (plus `data-type` on the
|
|
170
|
+
* root); the root renders through `Surface` for its elevated scope and base paint. Each part's function
|
|
171
|
+
* value carries the D12 `props()` escape hatch via `Object.assign` — spread it onto a foreign element
|
|
172
|
+
* to style it as that part.
|
|
173
|
+
*
|
|
174
|
+
* The runtime compound is a plain object (kept tree-shakeable); per-part prop and state types are
|
|
175
|
+
* exposed through the matching `Toast` namespace below — e.g. `Toast.Root.Props`, `Toast.Close.State`.
|
|
176
|
+
*/
|
|
177
|
+
const Toast$1 = {
|
|
178
|
+
Provider: ToastProvider,
|
|
179
|
+
Viewport: Object.assign(ToastViewport, { props: viewportProps }),
|
|
180
|
+
Root: Object.assign(ToastRoot, { props: rootProps }),
|
|
181
|
+
Content: Object.assign(ToastContent, { props: contentProps }),
|
|
182
|
+
Title: Object.assign(ToastTitle, { props: titleProps }),
|
|
183
|
+
Description: Object.assign(ToastDescription, { props: descriptionProps }),
|
|
184
|
+
Icon: Object.assign(ToastIcon, { props: iconProps }),
|
|
185
|
+
Spinner: Object.assign(ToastSpinner, { props: spinnerProps }),
|
|
186
|
+
Action: Object.assign(ToastAction, { props: actionProps }),
|
|
187
|
+
Close: Object.assign(ToastClose, { props: closeProps }),
|
|
188
|
+
Portal: ToastPortal,
|
|
189
|
+
Positioner: ToastPositioner,
|
|
190
|
+
Arrow: ToastArrow
|
|
191
|
+
};
|
|
192
|
+
//#endregion
|
|
193
|
+
export { Toast$1 as Toast };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Toast as Toast$1 } from "../../primitives/toast/toast.js";
|
|
2
|
+
import { ToastManagerPromiseOptions } from "@base-ui/react/toast";
|
|
3
|
+
|
|
4
|
+
//#region src/components/toast/toast.manager.d.ts
|
|
5
|
+
/** Base UI's live manager — the source of truth for the toast list and its imperative methods. */
|
|
6
|
+
type BaseManager = ReturnType<typeof Toast$1.useToastManager>;
|
|
7
|
+
/** The options Base UI's `add`/`update` accept (title, description, timeout, priority, action, …). */
|
|
8
|
+
type AddOptions = Parameters<BaseManager["add"]>[0];
|
|
9
|
+
/** The mounted-toast object Base UI tracks — read it off `toasts` to render the list. */
|
|
10
|
+
type ToastObject = BaseManager["toasts"][number];
|
|
11
|
+
/** Options for `show` and the typed convenience helpers — Base UI's add options minus the `type` it sets. */
|
|
12
|
+
type ToastOptions = Omit<AddOptions, "type">;
|
|
13
|
+
/** Options for `update` — Base UI's update options, which keep `type` so a toast can change status in place. */
|
|
14
|
+
type ToastUpdateOptions = Parameters<BaseManager["update"]>[1];
|
|
15
|
+
/** Options for the typed status helpers — the title is passed positionally, so it is optional here. */
|
|
16
|
+
type ToastStatusOptions = Omit<ToastOptions, "title">;
|
|
17
|
+
/** Custom per-toast data Base UI carries (defaults to the empty object — toasts here carry no extra data). */
|
|
18
|
+
type ToastData = ToastObject extends {
|
|
19
|
+
data?: infer D;
|
|
20
|
+
} ? NonNullable<D> : object;
|
|
21
|
+
/**
|
|
22
|
+
* The promise descriptor `useToast().promise` resolves a toast against — the loading message and the
|
|
23
|
+
* success/error mappers Base UI swaps in as the promise settles. Generic over the resolved value so the
|
|
24
|
+
* `success` mapper is typed against it.
|
|
25
|
+
*/
|
|
26
|
+
type ToastPromiseOptions<Value> = ToastManagerPromiseOptions<Value, ToastData>;
|
|
27
|
+
/**
|
|
28
|
+
* The Noctis toast manager — a typed, ergonomic façade over Base UI's `useToastManager`. The live list
|
|
29
|
+
* and timers live in Base UI's `Toast.Provider`; this hook reads that manager and exposes the status
|
|
30
|
+
* helpers the design system documents, so a button anywhere under the provider can raise a toast
|
|
31
|
+
* without prop threading. Like Sheet's `useSheetStack`, the state is owned upstream and the manager is
|
|
32
|
+
* reached through context (here, Base UI's provider) — call `useToast()` in any descendant.
|
|
33
|
+
*/
|
|
34
|
+
interface ToastManager {
|
|
35
|
+
/** Every mounted toast, front to back — render these inside the viewport. */
|
|
36
|
+
toasts: readonly ToastObject[];
|
|
37
|
+
/** The number of mounted toasts (≈ `useSheetStack().depth`) — read it to badge or gate the stack. */
|
|
38
|
+
count: number;
|
|
39
|
+
/**
|
|
40
|
+
* Raise a toast with explicit options (`title`, `description`, `timeout`, `priority`, …). A caller
|
|
41
|
+
* `timeout` is floored to 5000ms (slow readers and screen-zoom users); pass `0` to keep it up until
|
|
42
|
+
* acted on. Returns its id.
|
|
43
|
+
*/
|
|
44
|
+
show: (options: ToastOptions) => string;
|
|
45
|
+
/** Raise an `info`-typed toast (polite live region) — the title positional, the rest optional. Returns its id. */
|
|
46
|
+
info: (title: string, options?: ToastStatusOptions) => string;
|
|
47
|
+
/** Raise a `success`-typed toast (polite live region). Returns its id. */
|
|
48
|
+
success: (title: string, options?: ToastStatusOptions) => string;
|
|
49
|
+
/** Raise a `warning`-typed toast — announced assertively (urgent). Returns its id. */
|
|
50
|
+
warning: (title: string, options?: ToastStatusOptions) => string;
|
|
51
|
+
/** Raise a `danger`-typed toast — announced assertively (urgent). Returns its id. */
|
|
52
|
+
danger: (title: string, options?: ToastStatusOptions) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Raise a persistent `loading`-typed toast (neutral, no auto-dismiss) — render `Toast.Spinner` for
|
|
55
|
+
* it, then `update(id, …)` or `close(id)` when the work settles. Returns its id.
|
|
56
|
+
*/
|
|
57
|
+
loading: (title: string, options?: ToastStatusOptions) => string;
|
|
58
|
+
/**
|
|
59
|
+
* Dismiss a toast by id; **omit the id to clear every toast** (Base UI closes the whole stack). It
|
|
60
|
+
* animates out, then unmounts. Prefer {@link ToastManager.clear} for the explicit all-clear.
|
|
61
|
+
*/
|
|
62
|
+
dismiss: (id?: string) => void;
|
|
63
|
+
/** Clear the whole stack at once (≈ `useSheetStack().reset()`); equivalent to `dismiss()` with no id. */
|
|
64
|
+
clear: () => void;
|
|
65
|
+
/** Update a live toast in place by id (its `type`, copy, timeout, …), refreshing its auto-dismiss timer. */
|
|
66
|
+
update: (id: string, options: ToastUpdateOptions) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Drive a single toast through a promise's lifecycle: it shows the `loading` message (with the
|
|
69
|
+
* spinner), then swaps that same toast to the `success` or `error` result as the promise settles —
|
|
70
|
+
* one toast, never a stack. Resolves with the promise's value.
|
|
71
|
+
*/
|
|
72
|
+
promise: <Value>(promise: Promise<Value>, options: ToastPromiseOptions<Value>) => Promise<Value>;
|
|
73
|
+
}
|
|
74
|
+
declare function useToast(): ToastManager;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { ToastManager, ToastObject, ToastOptions, ToastPromiseOptions, ToastStatusOptions, ToastUpdateOptions, useToast };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Toast } from "../../primitives/toast/toast.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
//#region src/components/toast/toast.manager.ts
|
|
5
|
+
/**
|
|
6
|
+
* Read the toast manager. Use it inside any component under `Toast.Provider` to raise, update, or
|
|
7
|
+
* dismiss toasts — the typed status helpers (`info` / `success` / `warning` / `danger`) set the
|
|
8
|
+
* matching `type`, which drives the leading status icon's colour; `show` raises a neutral toast and takes the
|
|
9
|
+
* full option set.
|
|
10
|
+
*
|
|
11
|
+
* const toast = useToast();
|
|
12
|
+
* toast.success("Saved", { description: "Your changes are live." });
|
|
13
|
+
*/
|
|
14
|
+
/** Spectrum's floor: a toast never auto-dismisses faster than this, so slow readers can keep up. */
|
|
15
|
+
const TIMEOUT_FLOOR_MS = 5e3;
|
|
16
|
+
/** Status types announced assertively (APG `alert`): the urgent outcomes interrupt; the rest stay polite. */
|
|
17
|
+
const ASSERTIVE = {
|
|
18
|
+
warning: true,
|
|
19
|
+
danger: true
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The live-region politeness for a status (APG): `warning`/`danger` are urgent → assertive (`high`);
|
|
23
|
+
* `info`/`success`/`loading` advise → polite (Base UI's default, so `undefined`).
|
|
24
|
+
*/
|
|
25
|
+
function statusPriority(type) {
|
|
26
|
+
return ASSERTIVE[type] ? "high" : void 0;
|
|
27
|
+
}
|
|
28
|
+
/** Clamp a caller `timeout` to the floor; `0` (persistent) and an unset timeout pass through untouched. */
|
|
29
|
+
function floorTimeout(options) {
|
|
30
|
+
const { timeout } = options;
|
|
31
|
+
if (timeout === void 0 || timeout === 0 || timeout >= 5e3) return options;
|
|
32
|
+
return {
|
|
33
|
+
...options,
|
|
34
|
+
timeout: TIMEOUT_FLOOR_MS
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function useToast() {
|
|
38
|
+
const manager = Toast.useToastManager();
|
|
39
|
+
return useMemo(() => {
|
|
40
|
+
const status = (type) => (title, options = {}) => {
|
|
41
|
+
const priority = statusPriority(type) ?? options.priority;
|
|
42
|
+
return manager.add(floorTimeout({
|
|
43
|
+
...options,
|
|
44
|
+
title,
|
|
45
|
+
type,
|
|
46
|
+
priority
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
toasts: manager.toasts,
|
|
51
|
+
count: manager.toasts.length,
|
|
52
|
+
show: (options) => manager.add(floorTimeout(options)),
|
|
53
|
+
info: status("info"),
|
|
54
|
+
success: status("success"),
|
|
55
|
+
warning: status("warning"),
|
|
56
|
+
danger: status("danger"),
|
|
57
|
+
loading: (title, options = {}) => manager.add({
|
|
58
|
+
...options,
|
|
59
|
+
title,
|
|
60
|
+
type: "loading",
|
|
61
|
+
timeout: 0
|
|
62
|
+
}),
|
|
63
|
+
dismiss: (id) => manager.close(id),
|
|
64
|
+
clear: () => manager.close(),
|
|
65
|
+
update: (id, options) => manager.update(id, floorTimeout(options)),
|
|
66
|
+
promise: (promise, options) => manager.promise(promise, options)
|
|
67
|
+
};
|
|
68
|
+
}, [manager]);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { useToast };
|