@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,51 @@
|
|
|
1
|
+
import { InputAdornmentSide, InputAdornmentVariant, InputSize } from "./input.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/input/input.props.d.ts
|
|
4
|
+
/** A spreadable data-attribute prop bag — the shape every `Input.*.props()` returns. */
|
|
5
|
+
type InputPartProps = {
|
|
6
|
+
/** The slot value the matching `input.css` rules anchor on. */"data-slot": string; /** Forwarded verbatim — styling is attribute-driven, so this is an optional consumer passthrough. */
|
|
7
|
+
className?: string; /** A data-attribute present (empty string) or absent (`undefined`); never `false`. */
|
|
8
|
+
[attr: `data-${string}`]: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** Common shape: every part's `.props()` accepts an optional `className` passthrough. */
|
|
11
|
+
interface BasePropsArgs {
|
|
12
|
+
/** Forwarded verbatim onto the returned prop bag. */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Argument to `Input.Root.props(...)` — the shell's size + validity, stamped on the slot the CSS keys metrics off. */
|
|
16
|
+
interface InputRootPropsArgs extends BasePropsArgs {
|
|
17
|
+
/** Field height/padding/text scale. @default "md" */
|
|
18
|
+
size?: InputSize;
|
|
19
|
+
/** Shell-only override: force the invalid border via `data-invalid` (the default path reads the control). */
|
|
20
|
+
invalid?: boolean;
|
|
21
|
+
/** Shell-only override: force the disabled affordance via `data-disabled` (the default path reads the control). */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Argument to `Input.Adornment.props(...)` — which edge the adornment sits on and how it paints. */
|
|
25
|
+
interface InputAdornmentPropsArgs extends BasePropsArgs {
|
|
26
|
+
/** Which edge the adornment sits on — leading (`start`) or trailing (`end`). @default "start" */
|
|
27
|
+
side?: InputAdornmentSide;
|
|
28
|
+
/** How the adornment paints — `quiet` (default) or a bordered `segment` cell. @default "quiet" */
|
|
29
|
+
variant?: InputAdornmentVariant;
|
|
30
|
+
}
|
|
31
|
+
/** Argument to a stateless part's `.props(...)` — no variants/state of its own; look flows from the root. */
|
|
32
|
+
type InputControlPropsArgs = BasePropsArgs;
|
|
33
|
+
/** Root prop bag: `data-slot` plus the `data-size` and the `data-invalid`/`data-disabled` shell overrides. */
|
|
34
|
+
declare function rootProps({
|
|
35
|
+
size,
|
|
36
|
+
invalid,
|
|
37
|
+
disabled,
|
|
38
|
+
className
|
|
39
|
+
}?: InputRootPropsArgs): InputPartProps;
|
|
40
|
+
/** Control prop bag: just the slot anchor (the editable input; metrics flow from the root). */
|
|
41
|
+
declare function controlProps({
|
|
42
|
+
className
|
|
43
|
+
}?: InputControlPropsArgs): InputPartProps;
|
|
44
|
+
/** Adornment prop bag: slot anchor plus the `data-side` edge and the `data-variant` paint. */
|
|
45
|
+
declare function adornmentProps({
|
|
46
|
+
side,
|
|
47
|
+
variant,
|
|
48
|
+
className
|
|
49
|
+
}?: InputAdornmentPropsArgs): InputPartProps;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { InputAdornmentPropsArgs, InputPartProps, InputRootPropsArgs, adornmentProps, controlProps, rootProps };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { INPUT_SLOTS } from "./input.slots.js";
|
|
2
|
+
//#region src/components/input/input.props.ts
|
|
3
|
+
/**
|
|
4
|
+
* The D12 unified variant contract for Input — each compound part exposes a `props(...)` builder
|
|
5
|
+
* returning a **spreadable props object** of the form `{ "data-slot": "noctis-input-<part>",
|
|
6
|
+
* ...dataAttrs }`, derived from the part's size/state inputs. Under the single-`data-slot` anchor model
|
|
7
|
+
* `input.css` keys every rule off the slot the bag carries, so spreading a part's `props()` onto a
|
|
8
|
+
* *foreign* element styles it as that part:
|
|
9
|
+
*
|
|
10
|
+
* <div {...Input.Root.props({ size: "lg", invalid: true })}>
|
|
11
|
+
* <input {...Input.Control.props()} />
|
|
12
|
+
* <button {...Input.Action.props({ side: "end" })} />
|
|
13
|
+
* </div>
|
|
14
|
+
* // → <div data-slot="noctis-input" data-size="lg" data-invalid="">…
|
|
15
|
+
*
|
|
16
|
+
* The escape hatch carries no className (styling is attribute-driven); an optional `className`
|
|
17
|
+
* passthrough is accepted and forwarded verbatim. Inputs are typed from the public `InputSize` /
|
|
18
|
+
* `InputAdornmentSide` / `InputAdornmentVariant`. The same size→data-attribute→values mapping is
|
|
19
|
+
* emitted as data from the token graph (`generated/declarations.json` → `variantSchema`) so non-React /
|
|
20
|
+
* agent consumers can hand-write the markup from the docs.
|
|
21
|
+
*/
|
|
22
|
+
/** Stamp a boolean state as a bare data-attribute: present (`""`) when on, absent (`undefined`) when off. */
|
|
23
|
+
const flag = (on) => on ? "" : void 0;
|
|
24
|
+
const withClassName = (bag, className) => className === void 0 ? bag : {
|
|
25
|
+
...bag,
|
|
26
|
+
className
|
|
27
|
+
};
|
|
28
|
+
/** Root prop bag: `data-slot` plus the `data-size` and the `data-invalid`/`data-disabled` shell overrides. */
|
|
29
|
+
function rootProps({ size = "md", invalid, disabled, className } = {}) {
|
|
30
|
+
return withClassName({
|
|
31
|
+
"data-slot": INPUT_SLOTS.root,
|
|
32
|
+
"data-size": size,
|
|
33
|
+
"data-invalid": flag(invalid),
|
|
34
|
+
"data-disabled": flag(disabled)
|
|
35
|
+
}, className);
|
|
36
|
+
}
|
|
37
|
+
/** Control prop bag: just the slot anchor (the editable input; metrics flow from the root). */
|
|
38
|
+
function controlProps({ className } = {}) {
|
|
39
|
+
return withClassName({ "data-slot": INPUT_SLOTS.control }, className);
|
|
40
|
+
}
|
|
41
|
+
/** Adornment prop bag: slot anchor plus the `data-side` edge and the `data-variant` paint. */
|
|
42
|
+
function adornmentProps({ side = "start", variant = "quiet", className } = {}) {
|
|
43
|
+
return withClassName({
|
|
44
|
+
"data-slot": INPUT_SLOTS.adornment,
|
|
45
|
+
"data-side": side,
|
|
46
|
+
"data-variant": variant
|
|
47
|
+
}, className);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { adornmentProps, controlProps, rootProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/components/input/input.slots.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The data attributes the {@link Input} (and the Base UI input it renders) expose for styling and
|
|
4
|
+
* testing. Each member's value is the attribute name and its JSDoc is the description; the docs API
|
|
5
|
+
* reference reads this enum directly, so the documented attributes can't drift from the component.
|
|
6
|
+
*
|
|
7
|
+
* The shell's look is keyed off the root `data-slot="noctis-input"` plus `data-size`. State flows
|
|
8
|
+
* from the editable control: the shell reads the control's Base-UI/Field `data-invalid`,
|
|
9
|
+
* `data-disabled`, `data-readonly`, `data-filled`, and `data-dirty` through `:has()`, so there is one
|
|
10
|
+
* source of truth. The matching `data-invalid`/`data-disabled` on the root stay as additive
|
|
11
|
+
* shell-only override escape hatches. Focus is calm and ring-less: it shifts the border to the focus
|
|
12
|
+
* role (itself the accent focus-ring colour) so the indicator stays visible without a surrounding ring.
|
|
13
|
+
*/
|
|
14
|
+
declare enum InputDataAttributes {
|
|
15
|
+
/** The rendered element of a given part (root shell, control, or adornment). */
|
|
16
|
+
slot = "data-slot",
|
|
17
|
+
/** The size scale — `sm` | `md` | `lg`; the generated layer keys the per-size internals off it. */
|
|
18
|
+
size = "data-size",
|
|
19
|
+
/** Which edge an adornment sits on — `start` (leading) | `end` (trailing). */
|
|
20
|
+
side = "data-side",
|
|
21
|
+
/** How an adornment paints — `quiet` (default) | `segment` (a bordered cell flush to the field edge). */
|
|
22
|
+
variant = "data-variant",
|
|
23
|
+
/** Present when the field is in an invalid state — set by Base UI/Field on the control, or by the root override. */
|
|
24
|
+
invalid = "data-invalid",
|
|
25
|
+
/** Present when the field is disabled — set by Base UI on the control, or by the root override. */
|
|
26
|
+
disabled = "data-disabled",
|
|
27
|
+
/** Present when the field is read-only — set by Base UI on the control; the shell mutes the border and skips the focus fill. */
|
|
28
|
+
readonly = "data-readonly",
|
|
29
|
+
/** Present (on the control) when the field holds a value — gates the clear action's visibility. */
|
|
30
|
+
filled = "data-filled",
|
|
31
|
+
/** Present (on the control) when the value has changed from its initial — swaps the ⌘K chip to Esc. */
|
|
32
|
+
dirty = "data-dirty"
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { InputDataAttributes };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/components/input/input.slots.ts
|
|
2
|
+
/**
|
|
3
|
+
* The slot vocabulary every `Input` part stamps as its `data-slot`. The authored source the
|
|
4
|
+
* orchestration file reads from, kebab-cased `{component}[-{part}]` under the `noctis-` prefix; SLOTS.md
|
|
5
|
+
* still generates from the token-graph declarations.
|
|
6
|
+
*/
|
|
7
|
+
const INPUT_SLOTS = {
|
|
8
|
+
root: "noctis-input",
|
|
9
|
+
control: "noctis-input-control",
|
|
10
|
+
adornment: "noctis-input-adornment"
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The data attributes the {@link Input} (and the Base UI input it renders) expose for styling and
|
|
14
|
+
* testing. Each member's value is the attribute name and its JSDoc is the description; the docs API
|
|
15
|
+
* reference reads this enum directly, so the documented attributes can't drift from the component.
|
|
16
|
+
*
|
|
17
|
+
* The shell's look is keyed off the root `data-slot="noctis-input"` plus `data-size`. State flows
|
|
18
|
+
* from the editable control: the shell reads the control's Base-UI/Field `data-invalid`,
|
|
19
|
+
* `data-disabled`, `data-readonly`, `data-filled`, and `data-dirty` through `:has()`, so there is one
|
|
20
|
+
* source of truth. The matching `data-invalid`/`data-disabled` on the root stay as additive
|
|
21
|
+
* shell-only override escape hatches. Focus is calm and ring-less: it shifts the border to the focus
|
|
22
|
+
* role (itself the accent focus-ring colour) so the indicator stays visible without a surrounding ring.
|
|
23
|
+
*/
|
|
24
|
+
let InputDataAttributes = /* @__PURE__ */ function(InputDataAttributes) {
|
|
25
|
+
/** The rendered element of a given part (root shell, control, or adornment). */
|
|
26
|
+
InputDataAttributes["slot"] = "data-slot";
|
|
27
|
+
/** The size scale — `sm` | `md` | `lg`; the generated layer keys the per-size internals off it. */
|
|
28
|
+
InputDataAttributes["size"] = "data-size";
|
|
29
|
+
/** Which edge an adornment sits on — `start` (leading) | `end` (trailing). */
|
|
30
|
+
InputDataAttributes["side"] = "data-side";
|
|
31
|
+
/** How an adornment paints — `quiet` (default) | `segment` (a bordered cell flush to the field edge). */
|
|
32
|
+
InputDataAttributes["variant"] = "data-variant";
|
|
33
|
+
/** Present when the field is in an invalid state — set by Base UI/Field on the control, or by the root override. */
|
|
34
|
+
InputDataAttributes["invalid"] = "data-invalid";
|
|
35
|
+
/** Present when the field is disabled — set by Base UI on the control, or by the root override. */
|
|
36
|
+
InputDataAttributes["disabled"] = "data-disabled";
|
|
37
|
+
/** Present when the field is read-only — set by Base UI on the control; the shell mutes the border and skips the focus fill. */
|
|
38
|
+
InputDataAttributes["readonly"] = "data-readonly";
|
|
39
|
+
/** Present (on the control) when the field holds a value — gates the clear action's visibility. */
|
|
40
|
+
InputDataAttributes["filled"] = "data-filled";
|
|
41
|
+
/** Present (on the control) when the value has changed from its initial — swaps the ⌘K chip to Esc. */
|
|
42
|
+
InputDataAttributes["dirty"] = "data-dirty";
|
|
43
|
+
return InputDataAttributes;
|
|
44
|
+
}({});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { INPUT_SLOTS, InputDataAttributes };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/components/input/input.types.d.ts
|
|
2
|
+
/** Field height/padding/text scale — `md` or `lg`. */
|
|
3
|
+
type InputSize = "md" | "lg";
|
|
4
|
+
/** Which edge an adornment or action sits on — leading (`start`) or trailing (`end`). */
|
|
5
|
+
type InputAdornmentSide = "start" | "end";
|
|
6
|
+
/**
|
|
7
|
+
* How an adornment paints — a quiet, transparent flank (`quiet`, the default) or a bordered cell
|
|
8
|
+
* flush to the field edge (`segment`), for prefix/suffix addon groups like `https://` ▸ field ▸ `.com`.
|
|
9
|
+
*/
|
|
10
|
+
type InputAdornmentVariant = "quiet" | "segment";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { InputAdornmentSide, InputAdornmentVariant, InputSize };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { KBD_SLOTS } from "./kbd.slots.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/kbd/glyphs.tsx
|
|
4
|
+
/**
|
|
5
|
+
* The glyph paths, all on a 24×24 grid with their content kept inside roughly the 3–21 box. That inset
|
|
6
|
+
* (≈0.75 of the viewBox) lands the visible mark near the mono font's cap height at the `1em` render
|
|
7
|
+
* size below, so a glyph sits level with the letters beside it. One uniform stroke weight keeps every
|
|
8
|
+
* key the same visual heft.
|
|
9
|
+
*/
|
|
10
|
+
const PATHS = {
|
|
11
|
+
command: /* @__PURE__ */ jsx("path", { d: "M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z" }),
|
|
12
|
+
shift: /* @__PURE__ */ jsx("path", { d: "M12 4 4.5 11.5H8.5V18.5H15.5V11.5H19.5Z" }),
|
|
13
|
+
option: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M4 7h6l8 10h2" }), /* @__PURE__ */ jsx("path", { d: "M14 7h6" })] }),
|
|
14
|
+
enter: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M9 10 4 15l5 5" }), /* @__PURE__ */ jsx("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" })] }),
|
|
15
|
+
up: /* @__PURE__ */ jsx("path", { d: "M12 19V5M5 12l7-7 7 7" }),
|
|
16
|
+
down: /* @__PURE__ */ jsx("path", { d: "M12 5v14M19 12l-7 7-7-7" }),
|
|
17
|
+
left: /* @__PURE__ */ jsx("path", { d: "M19 12H5M12 19l-7-7 7-7" }),
|
|
18
|
+
right: /* @__PURE__ */ jsx("path", { d: "M5 12h14M12 5l7 7-7 7" }),
|
|
19
|
+
backspace: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M9 5 3 12l6 7h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z" }), /* @__PURE__ */ jsx("path", { d: "M17 9 11 15M11 9l6 6" })] }),
|
|
20
|
+
tab: /* @__PURE__ */ jsx("path", { d: "M3 12h11M10 8l4 4-4 4M19 6v12" })
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A single keyboard glyph, sized in `em` so it tracks the chip's font size (and through it the global
|
|
24
|
+
* `--noctis-seed-font-scale`). Always `aria-hidden` — the spoken key name is rendered visually-hidden beside it by
|
|
25
|
+
* {@link Kbd}. The `data-slot="noctis-kbd-glyph"` anchor carries its `display: inline-block` from
|
|
26
|
+
* `kbd.css`; the `data-kbd-glyph` attribute names the glyph for styling and tests.
|
|
27
|
+
*/
|
|
28
|
+
function KbdGlyph({ name }) {
|
|
29
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
30
|
+
"data-slot": KBD_SLOTS.glyph,
|
|
31
|
+
width: "1em",
|
|
32
|
+
height: "1em",
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: 2,
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeLinejoin: "round",
|
|
39
|
+
"aria-hidden": true,
|
|
40
|
+
"data-kbd-glyph": name,
|
|
41
|
+
children: PATHS[name]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { KbdGlyph };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Kbd } from "./kbd.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { chordProps, glyphProps, keyProps, rootProps } from "./kbd.props.js";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/kbd/kbd.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A keyboard hint. Every key is its own small cap — a raised, physical key cap on the dedicated `kbd`
|
|
7
|
+
* shade with a rim and depth shadow — so a chord like `Mod+C` reads as two distinct keys, never a
|
|
8
|
+
* run-on word. Keys
|
|
9
|
+
* within a chord sit nearly flush while sequence chords are spaced apart and joined by a
|
|
10
|
+
* visually-hidden connector ("G then D"), so grouping is legible at a glance. Each cap shows its
|
|
11
|
+
* glyph or text `aria-hidden` beside a visually-hidden spoken name, so screen readers hear
|
|
12
|
+
* "Command K" while sighted users see the compact symbols. The markup is the nested-`<kbd>` pattern
|
|
13
|
+
* (a `<kbd>` of `<kbd>`s, each inner one a real key), and all sizing is `em`-relative so the hint
|
|
14
|
+
* sits proportionally inside any text and scales with the global `--noctis-seed-font-scale`.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link Kbd.Props}
|
|
17
|
+
*/
|
|
18
|
+
declare function KbdComponent({
|
|
19
|
+
keys,
|
|
20
|
+
thenLabel,
|
|
21
|
+
className
|
|
22
|
+
}: Kbd.Props): _$react.JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* A keyboard hint, with per-part D12 `props()` escape hatches attached as namespaced statics. `Kbd` is
|
|
25
|
+
* the component value; `Kbd.root`/`Kbd.chord`/`Kbd.key`/`Kbd.glyph` each expose a `.props()` builder
|
|
26
|
+
* returning a spreadable `{ "data-slot": "noctis-kbd-<part>" }` bag for hand-authored markup. Docgen
|
|
27
|
+
* reads the part descriptions through this `Object.assign`.
|
|
28
|
+
*/
|
|
29
|
+
declare const Kbd: typeof KbdComponent & {
|
|
30
|
+
/** The hint root. `Kbd.root.props()` → its spreadable slot-anchor prop bag. */root: {
|
|
31
|
+
props: typeof rootProps;
|
|
32
|
+
}; /** One chord of nearly-flush keys. `Kbd.chord.props()` → its spreadable prop bag. */
|
|
33
|
+
chord: {
|
|
34
|
+
props: typeof chordProps;
|
|
35
|
+
}; /** One square key cap. `Kbd.key.props()` → its spreadable prop bag. */
|
|
36
|
+
key: {
|
|
37
|
+
props: typeof keyProps;
|
|
38
|
+
}; /** A drawn key glyph. `Kbd.glyph.props()` → its spreadable prop bag. */
|
|
39
|
+
glyph: {
|
|
40
|
+
props: typeof glyphProps;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Prop types for `Kbd`. Types-only — it emits no runtime code and merges with the `Kbd` function
|
|
45
|
+
* above, so `Kbd` is the component value while `Kbd.Props` is its prop type.
|
|
46
|
+
*/
|
|
47
|
+
declare namespace Kbd {
|
|
48
|
+
type Props = {
|
|
49
|
+
/**
|
|
50
|
+
* The keybinding to render. Whitespace separates chords in a *sequence* (`"G D"` → press G then D);
|
|
51
|
+
* `+` joins keys pressed *together* in one chord (`"Mod+K"`). Key ids are case-insensitive and map
|
|
52
|
+
* to a glyph + spoken name (`Mod`→⌘/Ctrl "Command"/"Control", `Enter`→↵, `ArrowUp`→↑, …); anything
|
|
53
|
+
* else renders as written.
|
|
54
|
+
*/
|
|
55
|
+
keys: string; /** The connector announced (visually-hidden) between sequence chords. Defaults to `then`. */
|
|
56
|
+
thenLabel?: string; /** Merged onto the rendered root's class list. */
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Kbd };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { VisuallyHidden } from "../../core/visually-hidden/visually-hidden.js";
|
|
3
|
+
import { KBD_SLOTS } from "./kbd.slots.js";
|
|
4
|
+
import { KbdGlyph } from "./glyphs.js";
|
|
5
|
+
import { chordProps, glyphProps, keyProps, rootProps } from "./kbd.props.js";
|
|
6
|
+
import { useIsApplePlatform } from "./use-apple-platform.js";
|
|
7
|
+
import { Fragment } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/kbd/kbd.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Key id → token. Modifier and navigation keys resolve to a drawn {@link KbdGlyph} (`aria-hidden`) with
|
|
12
|
+
* a visually-hidden spoken name, so "⌘" is announced as "Command" rather than read as a meaningless
|
|
13
|
+
* symbol. `Mod` is platform-aware (⌘ on Apple, Ctrl elsewhere); `cmd`/`command`/`meta` stay literal ⌘
|
|
14
|
+
* and `ctrl`/`control` stay literal Ctrl, so authors can pin a specific modifier when they need to.
|
|
15
|
+
*/
|
|
16
|
+
const KEY_MAP = {
|
|
17
|
+
mod: {
|
|
18
|
+
kind: "mod",
|
|
19
|
+
label: "Mod"
|
|
20
|
+
},
|
|
21
|
+
cmd: {
|
|
22
|
+
kind: "glyph",
|
|
23
|
+
glyph: "command",
|
|
24
|
+
label: "Command"
|
|
25
|
+
},
|
|
26
|
+
command: {
|
|
27
|
+
kind: "glyph",
|
|
28
|
+
glyph: "command",
|
|
29
|
+
label: "Command"
|
|
30
|
+
},
|
|
31
|
+
meta: {
|
|
32
|
+
kind: "glyph",
|
|
33
|
+
glyph: "command",
|
|
34
|
+
label: "Command"
|
|
35
|
+
},
|
|
36
|
+
ctrl: {
|
|
37
|
+
kind: "text",
|
|
38
|
+
text: "Ctrl",
|
|
39
|
+
label: "Control"
|
|
40
|
+
},
|
|
41
|
+
control: {
|
|
42
|
+
kind: "text",
|
|
43
|
+
text: "Ctrl",
|
|
44
|
+
label: "Control"
|
|
45
|
+
},
|
|
46
|
+
shift: {
|
|
47
|
+
kind: "glyph",
|
|
48
|
+
glyph: "shift",
|
|
49
|
+
label: "Shift"
|
|
50
|
+
},
|
|
51
|
+
alt: {
|
|
52
|
+
kind: "glyph",
|
|
53
|
+
glyph: "option",
|
|
54
|
+
label: "Alt"
|
|
55
|
+
},
|
|
56
|
+
option: {
|
|
57
|
+
kind: "glyph",
|
|
58
|
+
glyph: "option",
|
|
59
|
+
label: "Option"
|
|
60
|
+
},
|
|
61
|
+
enter: {
|
|
62
|
+
kind: "glyph",
|
|
63
|
+
glyph: "enter",
|
|
64
|
+
label: "Enter"
|
|
65
|
+
},
|
|
66
|
+
return: {
|
|
67
|
+
kind: "glyph",
|
|
68
|
+
glyph: "enter",
|
|
69
|
+
label: "Enter"
|
|
70
|
+
},
|
|
71
|
+
esc: {
|
|
72
|
+
kind: "text",
|
|
73
|
+
text: "Esc",
|
|
74
|
+
label: "Escape"
|
|
75
|
+
},
|
|
76
|
+
escape: {
|
|
77
|
+
kind: "text",
|
|
78
|
+
text: "Esc",
|
|
79
|
+
label: "Escape"
|
|
80
|
+
},
|
|
81
|
+
up: {
|
|
82
|
+
kind: "glyph",
|
|
83
|
+
glyph: "up",
|
|
84
|
+
label: "Up arrow"
|
|
85
|
+
},
|
|
86
|
+
arrowup: {
|
|
87
|
+
kind: "glyph",
|
|
88
|
+
glyph: "up",
|
|
89
|
+
label: "Up arrow"
|
|
90
|
+
},
|
|
91
|
+
down: {
|
|
92
|
+
kind: "glyph",
|
|
93
|
+
glyph: "down",
|
|
94
|
+
label: "Down arrow"
|
|
95
|
+
},
|
|
96
|
+
arrowdown: {
|
|
97
|
+
kind: "glyph",
|
|
98
|
+
glyph: "down",
|
|
99
|
+
label: "Down arrow"
|
|
100
|
+
},
|
|
101
|
+
left: {
|
|
102
|
+
kind: "glyph",
|
|
103
|
+
glyph: "left",
|
|
104
|
+
label: "Left arrow"
|
|
105
|
+
},
|
|
106
|
+
arrowleft: {
|
|
107
|
+
kind: "glyph",
|
|
108
|
+
glyph: "left",
|
|
109
|
+
label: "Left arrow"
|
|
110
|
+
},
|
|
111
|
+
right: {
|
|
112
|
+
kind: "glyph",
|
|
113
|
+
glyph: "right",
|
|
114
|
+
label: "Right arrow"
|
|
115
|
+
},
|
|
116
|
+
arrowright: {
|
|
117
|
+
kind: "glyph",
|
|
118
|
+
glyph: "right",
|
|
119
|
+
label: "Right arrow"
|
|
120
|
+
},
|
|
121
|
+
backspace: {
|
|
122
|
+
kind: "glyph",
|
|
123
|
+
glyph: "backspace",
|
|
124
|
+
label: "Backspace"
|
|
125
|
+
},
|
|
126
|
+
delete: {
|
|
127
|
+
kind: "glyph",
|
|
128
|
+
glyph: "backspace",
|
|
129
|
+
label: "Delete"
|
|
130
|
+
},
|
|
131
|
+
tab: {
|
|
132
|
+
kind: "glyph",
|
|
133
|
+
glyph: "tab",
|
|
134
|
+
label: "Tab"
|
|
135
|
+
},
|
|
136
|
+
space: {
|
|
137
|
+
kind: "text",
|
|
138
|
+
text: "Space",
|
|
139
|
+
label: "Space"
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
function resolveKey(raw) {
|
|
143
|
+
const key = raw.trim();
|
|
144
|
+
const mapped = KEY_MAP[key.toLowerCase()];
|
|
145
|
+
if (mapped) return mapped;
|
|
146
|
+
if (key.length === 1) return {
|
|
147
|
+
kind: "text",
|
|
148
|
+
text: key.toUpperCase(),
|
|
149
|
+
label: key.toLowerCase()
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
kind: "text",
|
|
153
|
+
text: key,
|
|
154
|
+
label: key
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/** A stable key for a chord, derived from its tokens. */
|
|
158
|
+
function chordKey(chord) {
|
|
159
|
+
return chord.map((token) => token.kind === "glyph" ? token.glyph : token.kind === "mod" ? "mod" : token.text).join("+");
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* One key as its own cap: a physical key cap on the dedicated `kbd` shade — a `kbd-border` rim over a
|
|
163
|
+
* layered depth shadow (top sheen, bottom lip, floor shadow) — holding the key's glyph or text
|
|
164
|
+
* (`aria-hidden`) plus the spoken name for screen readers. Every metric is em-relative so the cap and
|
|
165
|
+
* its depth track its own font size (and the global `--noctis-seed-font-scale`); a rem-based scale
|
|
166
|
+
* wouldn't follow. The metrics flow through the `--_kbd-key-*` slot internals (read by `kbd.css`),
|
|
167
|
+
* whose values the generated component layer resolves through the public `--noctis-kbd-key-*` override
|
|
168
|
+
* tokens.
|
|
169
|
+
*/
|
|
170
|
+
function KeyCap({ token, isApple }) {
|
|
171
|
+
const resolved = token.kind === "mod" ? isApple ? {
|
|
172
|
+
kind: "glyph",
|
|
173
|
+
glyph: "command",
|
|
174
|
+
label: "Command"
|
|
175
|
+
} : {
|
|
176
|
+
kind: "text",
|
|
177
|
+
text: "Ctrl",
|
|
178
|
+
label: "Control"
|
|
179
|
+
} : token;
|
|
180
|
+
return /* @__PURE__ */ jsxs("kbd", {
|
|
181
|
+
"data-slot": KBD_SLOTS.key,
|
|
182
|
+
children: [resolved.kind === "glyph" ? /* @__PURE__ */ jsx(KbdGlyph, { name: resolved.glyph }) : /* @__PURE__ */ jsx("span", {
|
|
183
|
+
"aria-hidden": true,
|
|
184
|
+
children: resolved.text
|
|
185
|
+
}), /* @__PURE__ */ jsx(VisuallyHidden, { children: resolved.label })]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A keyboard hint. Every key is its own small cap — a raised, physical key cap on the dedicated `kbd`
|
|
190
|
+
* shade with a rim and depth shadow — so a chord like `Mod+C` reads as two distinct keys, never a
|
|
191
|
+
* run-on word. Keys
|
|
192
|
+
* within a chord sit nearly flush while sequence chords are spaced apart and joined by a
|
|
193
|
+
* visually-hidden connector ("G then D"), so grouping is legible at a glance. Each cap shows its
|
|
194
|
+
* glyph or text `aria-hidden` beside a visually-hidden spoken name, so screen readers hear
|
|
195
|
+
* "Command K" while sighted users see the compact symbols. The markup is the nested-`<kbd>` pattern
|
|
196
|
+
* (a `<kbd>` of `<kbd>`s, each inner one a real key), and all sizing is `em`-relative so the hint
|
|
197
|
+
* sits proportionally inside any text and scales with the global `--noctis-seed-font-scale`.
|
|
198
|
+
*
|
|
199
|
+
* @see {@link Kbd.Props}
|
|
200
|
+
*/
|
|
201
|
+
function KbdComponent({ keys, thenLabel = "then", className }) {
|
|
202
|
+
const isApple = useIsApplePlatform();
|
|
203
|
+
const chords = keys.trim().split(/\s+/).filter(Boolean).map((chord) => chord.split("+").filter(Boolean).map(resolveKey));
|
|
204
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
205
|
+
"data-slot": KBD_SLOTS.root,
|
|
206
|
+
className,
|
|
207
|
+
children: chords.map((chord, chordIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [chordIndex > 0 && /* @__PURE__ */ jsx(VisuallyHidden, { children: ` ${thenLabel} ` }), /* @__PURE__ */ jsx("span", {
|
|
208
|
+
"data-slot": KBD_SLOTS.chord,
|
|
209
|
+
children: chord.map((token, keyIndex) => /* @__PURE__ */ jsx(KeyCap, {
|
|
210
|
+
token,
|
|
211
|
+
isApple
|
|
212
|
+
}, `${chordKey([token])}-${keyIndex}`))
|
|
213
|
+
})] }, `${chordKey(chord)}-${chordIndex}`))
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* A keyboard hint, with per-part D12 `props()` escape hatches attached as namespaced statics. `Kbd` is
|
|
218
|
+
* the component value; `Kbd.root`/`Kbd.chord`/`Kbd.key`/`Kbd.glyph` each expose a `.props()` builder
|
|
219
|
+
* returning a spreadable `{ "data-slot": "noctis-kbd-<part>" }` bag for hand-authored markup. Docgen
|
|
220
|
+
* reads the part descriptions through this `Object.assign`.
|
|
221
|
+
*/
|
|
222
|
+
const Kbd = Object.assign(KbdComponent, {
|
|
223
|
+
/** The hint root. `Kbd.root.props()` → its spreadable slot-anchor prop bag. */
|
|
224
|
+
root: { props: rootProps },
|
|
225
|
+
/** One chord of nearly-flush keys. `Kbd.chord.props()` → its spreadable prop bag. */
|
|
226
|
+
chord: { props: chordProps },
|
|
227
|
+
/** One square key cap. `Kbd.key.props()` → its spreadable prop bag. */
|
|
228
|
+
key: { props: keyProps },
|
|
229
|
+
/** A drawn key glyph. `Kbd.glyph.props()` → its spreadable prop bag. */
|
|
230
|
+
glyph: { props: glyphProps }
|
|
231
|
+
});
|
|
232
|
+
//#endregion
|
|
233
|
+
export { Kbd };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/components/kbd/kbd.props.d.ts
|
|
2
|
+
/** A spreadable data-attribute prop bag — the shape every `Kbd.*.props()` returns. */
|
|
3
|
+
type KbdPartProps = {
|
|
4
|
+
/** The slot value the matching `kbd.css` rules anchor on. */"data-slot": string; /** Forwarded verbatim — styling is attribute-driven, so this is an optional consumer passthrough. */
|
|
5
|
+
className?: string; /** A data-attribute present (empty string) or absent (`undefined`); never `false`. */
|
|
6
|
+
[attr: `data-${string}`]: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
/** Argument to a `Kbd.*.props(...)` helper — no variants/state of its own, just an optional class. */
|
|
9
|
+
interface KbdPartPropsArgs {
|
|
10
|
+
/** Forwarded verbatim onto the returned prop bag. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Root prop bag: the slot anchor for the hint row. */
|
|
14
|
+
declare function rootProps({
|
|
15
|
+
className
|
|
16
|
+
}?: KbdPartPropsArgs): KbdPartProps;
|
|
17
|
+
/** Chord prop bag: the slot anchor for one chord of nearly-flush keys. */
|
|
18
|
+
declare function chordProps({
|
|
19
|
+
className
|
|
20
|
+
}?: KbdPartPropsArgs): KbdPartProps;
|
|
21
|
+
/** Key prop bag: the slot anchor for one square key cap. */
|
|
22
|
+
declare function keyProps({
|
|
23
|
+
className
|
|
24
|
+
}?: KbdPartPropsArgs): KbdPartProps;
|
|
25
|
+
/** Glyph prop bag: the slot anchor for a drawn key glyph. */
|
|
26
|
+
declare function glyphProps({
|
|
27
|
+
className
|
|
28
|
+
}?: KbdPartPropsArgs): KbdPartProps;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { chordProps, glyphProps, keyProps, rootProps };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { KBD_SLOTS } from "./kbd.slots.js";
|
|
2
|
+
//#region src/components/kbd/kbd.props.ts
|
|
3
|
+
/**
|
|
4
|
+
* The D12 unified part contract for Kbd — the data-attribute-native generalization of the old
|
|
5
|
+
* `kbd*` class-string helpers.
|
|
6
|
+
*
|
|
7
|
+
* Each part exposes a `props(...)` builder returning a **spreadable props object** of the form
|
|
8
|
+
* `{ "data-slot": "noctis-kbd-<part>", ...dataAttrs }`. Under the single-`data-slot` anchor model
|
|
9
|
+
* (D4 final) the `data-slot` is the only styling hook needed — `kbd.css` keys every rule off it — so
|
|
10
|
+
* spreading a part's `props()` onto a *foreign* element styles it as that part:
|
|
11
|
+
*
|
|
12
|
+
* <kbd {...Kbd.Key.props()}>K</kbd>
|
|
13
|
+
* // → <kbd data-slot="noctis-kbd-key">
|
|
14
|
+
*
|
|
15
|
+
* Kbd has no variant/state axes — every part is a plain slot anchor — so each helper accepts only an
|
|
16
|
+
* optional `className` passthrough, forwarded verbatim (styling is attribute-driven).
|
|
17
|
+
*/
|
|
18
|
+
const withClassName = (bag, className) => className === void 0 ? bag : {
|
|
19
|
+
...bag,
|
|
20
|
+
className
|
|
21
|
+
};
|
|
22
|
+
/** Root prop bag: the slot anchor for the hint row. */
|
|
23
|
+
function rootProps({ className } = {}) {
|
|
24
|
+
return withClassName({ "data-slot": KBD_SLOTS.root }, className);
|
|
25
|
+
}
|
|
26
|
+
/** Chord prop bag: the slot anchor for one chord of nearly-flush keys. */
|
|
27
|
+
function chordProps({ className } = {}) {
|
|
28
|
+
return withClassName({ "data-slot": KBD_SLOTS.chord }, className);
|
|
29
|
+
}
|
|
30
|
+
/** Key prop bag: the slot anchor for one square key cap. */
|
|
31
|
+
function keyProps({ className } = {}) {
|
|
32
|
+
return withClassName({ "data-slot": KBD_SLOTS.key }, className);
|
|
33
|
+
}
|
|
34
|
+
/** Glyph prop bag: the slot anchor for a drawn key glyph. */
|
|
35
|
+
function glyphProps({ className } = {}) {
|
|
36
|
+
return withClassName({ "data-slot": KBD_SLOTS.glyph }, className);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { chordProps, glyphProps, keyProps, rootProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/components/kbd/kbd.slots.ts
|
|
2
|
+
/**
|
|
3
|
+
* The slot vocabulary every `Kbd` part stamps as its `data-slot`. The authored source the
|
|
4
|
+
* orchestration file reads from, kebab-cased `{component}-{part}`; SLOTS.md still generates from the
|
|
5
|
+
* token-graph declarations.
|
|
6
|
+
*/
|
|
7
|
+
const KBD_SLOTS = {
|
|
8
|
+
root: "noctis-kbd",
|
|
9
|
+
chord: "noctis-kbd-chord",
|
|
10
|
+
key: "noctis-kbd-key",
|
|
11
|
+
glyph: "noctis-kbd-glyph"
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { KBD_SLOTS };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
//#region src/components/kbd/use-apple-platform.ts
|
|
4
|
+
/** The platform doesn't change within a session, so there is nothing to subscribe to. */
|
|
5
|
+
function subscribe() {
|
|
6
|
+
return () => {};
|
|
7
|
+
}
|
|
8
|
+
function getSnapshot() {
|
|
9
|
+
const nav = navigator;
|
|
10
|
+
const platform = nav.userAgentData?.platform || nav.platform || "";
|
|
11
|
+
return /mac|iphone|ipad|ipod/i.test(platform);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The server can't know the platform, so it assumes Apple — the modifier renders as `⌘` on first
|
|
15
|
+
* paint, matching the symbol set, and corrects to `Ctrl` after hydration on non-Apple platforms.
|
|
16
|
+
*/
|
|
17
|
+
function getServerSnapshot() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
/** Whether the current device is an Apple platform (macOS / iOS / iPadOS). Drives the `Mod` glyph. */
|
|
21
|
+
function useIsApplePlatform() {
|
|
22
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useIsApplePlatform };
|