@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,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../../icons/icon.js";
|
|
3
|
+
import { MinusIcon, PlusIcon } from "../../icons/glyphs.js";
|
|
4
|
+
import { Button } from "../button/button.js";
|
|
5
|
+
import { NumberField as NumberField$1 } from "../../primitives/number-field/number-field.js";
|
|
6
|
+
import { NumberFieldProvider, useNumberFieldContext } from "./number-field.context.js";
|
|
7
|
+
import { NUMBER_FIELD_SLOTS } from "./number-field.slots.js";
|
|
8
|
+
import { decrementProps, groupProps, incrementProps, inputProps, prefixProps, rootProps, scrubAreaCursorProps, scrubAreaProps, suffixProps } from "./number-field.props.js";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/number-field/number-field.tsx
|
|
11
|
+
/** The icon size that pairs with each field size — the stepper glyph scales with the control. */
|
|
12
|
+
const GLYPH_SIZE = {
|
|
13
|
+
md: "sm",
|
|
14
|
+
lg: "sm"
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Owns the numeric value and shares the control `size` with the field's parts. Works controlled
|
|
18
|
+
* (`value` + `onValueChange`) or uncontrolled (`defaultValue`). The wrapped primitive auto-injects the
|
|
19
|
+
* active locale (so the value formats for the reader — Persian numerals under `fa`, grouping per
|
|
20
|
+
* locale) and the translated assistive labels; pass `locale` or `labels` to override. Compose
|
|
21
|
+
* `NumberField.Group` holding the `NumberField.Input` and the `NumberField.Decrement` /
|
|
22
|
+
* `NumberField.Increment` steppers.
|
|
23
|
+
*/
|
|
24
|
+
function NumberFieldRoot({ size = "md", steppers = "end", className, children, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(NumberField$1.Root, {
|
|
26
|
+
"data-slot": NUMBER_FIELD_SLOTS.root,
|
|
27
|
+
"data-size": size,
|
|
28
|
+
className,
|
|
29
|
+
...props,
|
|
30
|
+
children: /* @__PURE__ */ jsx(NumberFieldProvider, {
|
|
31
|
+
value: {
|
|
32
|
+
size,
|
|
33
|
+
steppers
|
|
34
|
+
},
|
|
35
|
+
children
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The bordered field shell wrapping the input, affixes, and steppers — wears the field look and carries
|
|
41
|
+
* the stepper layout (`data-steppers`) the CSS branches off, inherited from the root's `steppers`.
|
|
42
|
+
*/
|
|
43
|
+
function NumberFieldGroup({ className, ...props }) {
|
|
44
|
+
const { steppers } = useNumberFieldContext("Group");
|
|
45
|
+
return /* @__PURE__ */ jsx(NumberField$1.Group, {
|
|
46
|
+
"data-slot": NUMBER_FIELD_SLOTS.group,
|
|
47
|
+
"data-steppers": steppers,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** The numeric input — borderless inside the shell, carrying the field type and derived mobile keypad. */
|
|
53
|
+
function NumberFieldInput({ className, ...props }) {
|
|
54
|
+
useNumberFieldContext("Input");
|
|
55
|
+
return /* @__PURE__ */ jsx(NumberField$1.Input, {
|
|
56
|
+
"data-slot": NUMBER_FIELD_SLOTS.input,
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A leading affix — a quiet, non-interactive unit hint (`$`, `€`) seated inside the shell before the
|
|
63
|
+
* value. Visual chrome only: it never changes the committed value (that is `format`'s job).
|
|
64
|
+
*/
|
|
65
|
+
function NumberFieldPrefix({ className, ...props }) {
|
|
66
|
+
useNumberFieldContext("Prefix");
|
|
67
|
+
return /* @__PURE__ */ jsx("span", {
|
|
68
|
+
"data-slot": NUMBER_FIELD_SLOTS.prefix,
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A trailing affix — a quiet, non-interactive unit hint (`px`, `kg`, `%`) seated inside the shell after
|
|
75
|
+
* the value. Visual chrome only: it never changes the committed value (that is `format`'s job).
|
|
76
|
+
*/
|
|
77
|
+
function NumberFieldSuffix({ className, ...props }) {
|
|
78
|
+
useNumberFieldContext("Suffix");
|
|
79
|
+
return /* @__PURE__ */ jsx("span", {
|
|
80
|
+
"data-slot": NUMBER_FIELD_SLOTS.suffix,
|
|
81
|
+
className,
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The up stepper — a ghost icon button whose placement follows the `steppers` layout. Defaults to a plus
|
|
87
|
+
* glyph; pass `children` to replace it. The accessible name comes from the translated `increase` label.
|
|
88
|
+
*/
|
|
89
|
+
function NumberFieldIncrement({ className, children, ...props }) {
|
|
90
|
+
const { size } = useNumberFieldContext("Increment");
|
|
91
|
+
return /* @__PURE__ */ jsx(NumberField$1.Increment, {
|
|
92
|
+
...Button.props({
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
iconOnly: true
|
|
95
|
+
}),
|
|
96
|
+
"data-slot": NUMBER_FIELD_SLOTS.increment,
|
|
97
|
+
className,
|
|
98
|
+
...props,
|
|
99
|
+
children: children ?? /* @__PURE__ */ jsx(Icon, {
|
|
100
|
+
icon: PlusIcon,
|
|
101
|
+
size: GLYPH_SIZE[size]
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The down stepper — a ghost icon button whose placement follows the `steppers` layout. Defaults to a
|
|
107
|
+
* minus glyph; pass `children` to replace it. The accessible name comes from the translated `decrease` label.
|
|
108
|
+
*/
|
|
109
|
+
function NumberFieldDecrement({ className, children, ...props }) {
|
|
110
|
+
const { size } = useNumberFieldContext("Decrement");
|
|
111
|
+
return /* @__PURE__ */ jsx(NumberField$1.Decrement, {
|
|
112
|
+
...Button.props({
|
|
113
|
+
variant: "ghost",
|
|
114
|
+
iconOnly: true
|
|
115
|
+
}),
|
|
116
|
+
"data-slot": NUMBER_FIELD_SLOTS.decrement,
|
|
117
|
+
className,
|
|
118
|
+
...props,
|
|
119
|
+
children: children ?? /* @__PURE__ */ jsx(Icon, {
|
|
120
|
+
icon: MinusIcon,
|
|
121
|
+
size: GLYPH_SIZE[size]
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A draggable region that scrubs the value by horizontal pointer movement — wrap a label or icon to make
|
|
127
|
+
* it the drag handle. Pointer-precision is opt-in via Base UI's `pixelSensitivity` / `direction`.
|
|
128
|
+
*/
|
|
129
|
+
function NumberFieldScrubArea({ className, ...props }) {
|
|
130
|
+
useNumberFieldContext("ScrubArea");
|
|
131
|
+
return /* @__PURE__ */ jsx(NumberField$1.ScrubArea, {
|
|
132
|
+
"data-slot": NUMBER_FIELD_SLOTS.scrubArea,
|
|
133
|
+
className,
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The virtual cursor that follows the pointer while scrubbing — a small inverse block (the Resolve/Figma
|
|
139
|
+
* feel). Render it inside a `NumberField.ScrubArea`; Base UI shows it only during the drag and tracks the
|
|
140
|
+
* pointer 1:1. Pair with `pixelSensitivity` on the scrub area to tune the drag-to-value ratio.
|
|
141
|
+
*/
|
|
142
|
+
function NumberFieldScrubAreaCursor({ className, ...props }) {
|
|
143
|
+
useNumberFieldContext("ScrubAreaCursor");
|
|
144
|
+
return /* @__PURE__ */ jsx(NumberField$1.ScrubAreaCursor, {
|
|
145
|
+
"data-slot": NUMBER_FIELD_SLOTS.scrubAreaCursor,
|
|
146
|
+
className,
|
|
147
|
+
...props
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* A numeric input with stepper buttons, keyboard arrows, and pointer scrubbing, built on Base UI's
|
|
152
|
+
* NumberField. The field shell wears the field look (`bg-field` / `border-field`, focus ring on the
|
|
153
|
+
* shell), the input is borderless inside it, and the steppers are ghost icon buttons that compose the
|
|
154
|
+
* {@link Button} look. The wrapper injects the active locale (so the value formats for the reader) and
|
|
155
|
+
* translates the steppers' and input's assistive text; per-instance `labels` / `aria-label` always win.
|
|
156
|
+
* Two sizes (`md` / `lg`) share the control rhythm. RTL-aware and respects `prefers-reduced-motion`.
|
|
157
|
+
*
|
|
158
|
+
* Compose from parts: `NumberField.Root` owns the value, the shared `size`, and the `steppers` layout
|
|
159
|
+
* (`end` by default — a horizontal −/+ pair at the inline end; `split` flanks the value; `stacked` blocks
|
|
160
|
+
* them in a column; `none` drops them). `NumberField.Group` is the bordered shell holding the optional `NumberField.Prefix` /
|
|
161
|
+
* `NumberField.Suffix` affixes, the `NumberField.Input`, and the `NumberField.Decrement` /
|
|
162
|
+
* `NumberField.Increment` steppers. The runtime compound is a plain object (kept tree-shakeable);
|
|
163
|
+
* per-part prop and state types are exposed through the matching `NumberField` namespace —
|
|
164
|
+
* e.g. `NumberField.Input.Props`.
|
|
165
|
+
*/
|
|
166
|
+
const NumberField = {
|
|
167
|
+
/** Owns the value, the shared size, and the stepper layout. `NumberField.Root.props({ size })` → its spreadable prop bag. */
|
|
168
|
+
Root: Object.assign(NumberFieldRoot, { props: rootProps }),
|
|
169
|
+
/** The bordered field shell. `NumberField.Group.props({ steppers })` → its spreadable prop bag. */
|
|
170
|
+
Group: Object.assign(NumberFieldGroup, { props: groupProps }),
|
|
171
|
+
/** The numeric input. `NumberField.Input.props()` → its spreadable prop bag. */
|
|
172
|
+
Input: Object.assign(NumberFieldInput, { props: inputProps }),
|
|
173
|
+
/** A leading unit-hint affix. `NumberField.Prefix.props()` → its spreadable prop bag. */
|
|
174
|
+
Prefix: Object.assign(NumberFieldPrefix, { props: prefixProps }),
|
|
175
|
+
/** A trailing unit-hint affix. `NumberField.Suffix.props()` → its spreadable prop bag. */
|
|
176
|
+
Suffix: Object.assign(NumberFieldSuffix, { props: suffixProps }),
|
|
177
|
+
/** The down stepper. `NumberField.Decrement.props()` → its spreadable prop bag. */
|
|
178
|
+
Decrement: Object.assign(NumberFieldDecrement, { props: decrementProps }),
|
|
179
|
+
/** The up stepper. `NumberField.Increment.props()` → its spreadable prop bag. */
|
|
180
|
+
Increment: Object.assign(NumberFieldIncrement, { props: incrementProps }),
|
|
181
|
+
/** The pointer-scrub region. `NumberField.ScrubArea.props()` → its spreadable prop bag. */
|
|
182
|
+
ScrubArea: Object.assign(NumberFieldScrubArea, { props: scrubAreaProps }),
|
|
183
|
+
/** The virtual scrub cursor. `NumberField.ScrubAreaCursor.props()` → its spreadable prop bag. */
|
|
184
|
+
ScrubAreaCursor: Object.assign(NumberFieldScrubAreaCursor, { props: scrubAreaCursorProps })
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
export { NumberField };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { NumberFieldSize, NumberFieldSteppers } from "./number-field.context.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/number-field/number-field.props.d.ts
|
|
4
|
+
/** A spreadable data-attribute prop bag — the shape every `NumberField.*.props()` returns. */
|
|
5
|
+
type NumberFieldPartProps = {
|
|
6
|
+
/** The slot value the matching `number-field.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 `NumberField.Root.props(...)` — the field's shared size, stamped on the root the CSS keys metrics off. */
|
|
16
|
+
interface NumberFieldRootPropsArgs extends BasePropsArgs {
|
|
17
|
+
/** Control height and type — `md` or `lg`. @default "md" */
|
|
18
|
+
size?: NumberFieldSize;
|
|
19
|
+
}
|
|
20
|
+
/** Argument to a stateless part's `.props(...)` — no variants/state of its own; look flows from the root. */
|
|
21
|
+
type NumberFieldStatelessPropsArgs = BasePropsArgs;
|
|
22
|
+
/** Argument to `NumberField.Group.props(...)` — the shell, carrying the stepper-layout attribute the CSS branches off. */
|
|
23
|
+
interface NumberFieldGroupPropsArgs extends BasePropsArgs {
|
|
24
|
+
/** The stepper layout stamped as `data-steppers`. Omit to inherit the default (`side`). */
|
|
25
|
+
steppers?: NumberFieldSteppers;
|
|
26
|
+
}
|
|
27
|
+
/** Root prop bag: `data-slot` plus the `data-size` the descendant metric rules read. */
|
|
28
|
+
declare function rootProps({
|
|
29
|
+
size,
|
|
30
|
+
className
|
|
31
|
+
}?: NumberFieldRootPropsArgs): NumberFieldPartProps;
|
|
32
|
+
/** Group prop bag: the field-shell slot anchor (the bordered input box), carrying the stepper layout. */
|
|
33
|
+
declare function groupProps({
|
|
34
|
+
steppers,
|
|
35
|
+
className
|
|
36
|
+
}?: NumberFieldGroupPropsArgs): NumberFieldPartProps;
|
|
37
|
+
/** Input prop bag: the numeric-input slot anchor. */
|
|
38
|
+
declare function inputProps({
|
|
39
|
+
className
|
|
40
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
41
|
+
/** Prefix prop bag: the leading affix slot anchor (a non-interactive unit hint before the value). */
|
|
42
|
+
declare function prefixProps({
|
|
43
|
+
className
|
|
44
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
45
|
+
/** Suffix prop bag: the trailing affix slot anchor (a non-interactive unit hint after the value). */
|
|
46
|
+
declare function suffixProps({
|
|
47
|
+
className
|
|
48
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
49
|
+
/** Increment prop bag: the up-stepper slot anchor (the button look flows from the composed `Button`). */
|
|
50
|
+
declare function incrementProps({
|
|
51
|
+
className
|
|
52
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
53
|
+
/** Decrement prop bag: the down-stepper slot anchor (the button look flows from the composed `Button`). */
|
|
54
|
+
declare function decrementProps({
|
|
55
|
+
className
|
|
56
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
57
|
+
/** ScrubArea prop bag: the pointer-scrub region slot anchor. */
|
|
58
|
+
declare function scrubAreaProps({
|
|
59
|
+
className
|
|
60
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
61
|
+
/** ScrubAreaCursor prop bag: the virtual cursor shown while scrubbing. */
|
|
62
|
+
declare function scrubAreaCursorProps({
|
|
63
|
+
className
|
|
64
|
+
}?: NumberFieldStatelessPropsArgs): NumberFieldPartProps;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { NumberFieldPartProps, NumberFieldRootPropsArgs, decrementProps, groupProps, incrementProps, inputProps, prefixProps, rootProps, scrubAreaCursorProps, scrubAreaProps, suffixProps };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { NUMBER_FIELD_SLOTS } from "./number-field.slots.js";
|
|
2
|
+
//#region src/components/number-field/number-field.props.ts
|
|
3
|
+
const withClassName = (bag, className) => className === void 0 ? bag : {
|
|
4
|
+
...bag,
|
|
5
|
+
className
|
|
6
|
+
};
|
|
7
|
+
/** Root prop bag: `data-slot` plus the `data-size` the descendant metric rules read. */
|
|
8
|
+
function rootProps({ size = "md", className } = {}) {
|
|
9
|
+
return withClassName({
|
|
10
|
+
"data-slot": NUMBER_FIELD_SLOTS.root,
|
|
11
|
+
"data-size": size
|
|
12
|
+
}, className);
|
|
13
|
+
}
|
|
14
|
+
/** Group prop bag: the field-shell slot anchor (the bordered input box), carrying the stepper layout. */
|
|
15
|
+
function groupProps({ steppers, className } = {}) {
|
|
16
|
+
return withClassName({
|
|
17
|
+
"data-slot": NUMBER_FIELD_SLOTS.group,
|
|
18
|
+
...steppers ? { "data-steppers": steppers } : {}
|
|
19
|
+
}, className);
|
|
20
|
+
}
|
|
21
|
+
/** Input prop bag: the numeric-input slot anchor. */
|
|
22
|
+
function inputProps({ className } = {}) {
|
|
23
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.input }, className);
|
|
24
|
+
}
|
|
25
|
+
/** Prefix prop bag: the leading affix slot anchor (a non-interactive unit hint before the value). */
|
|
26
|
+
function prefixProps({ className } = {}) {
|
|
27
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.prefix }, className);
|
|
28
|
+
}
|
|
29
|
+
/** Suffix prop bag: the trailing affix slot anchor (a non-interactive unit hint after the value). */
|
|
30
|
+
function suffixProps({ className } = {}) {
|
|
31
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.suffix }, className);
|
|
32
|
+
}
|
|
33
|
+
/** Increment prop bag: the up-stepper slot anchor (the button look flows from the composed `Button`). */
|
|
34
|
+
function incrementProps({ className } = {}) {
|
|
35
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.increment }, className);
|
|
36
|
+
}
|
|
37
|
+
/** Decrement prop bag: the down-stepper slot anchor (the button look flows from the composed `Button`). */
|
|
38
|
+
function decrementProps({ className } = {}) {
|
|
39
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.decrement }, className);
|
|
40
|
+
}
|
|
41
|
+
/** ScrubArea prop bag: the pointer-scrub region slot anchor. */
|
|
42
|
+
function scrubAreaProps({ className } = {}) {
|
|
43
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.scrubArea }, className);
|
|
44
|
+
}
|
|
45
|
+
/** ScrubAreaCursor prop bag: the virtual cursor shown while scrubbing. */
|
|
46
|
+
function scrubAreaCursorProps({ className } = {}) {
|
|
47
|
+
return withClassName({ "data-slot": NUMBER_FIELD_SLOTS.scrubAreaCursor }, className);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { decrementProps, groupProps, incrementProps, inputProps, prefixProps, rootProps, scrubAreaCursorProps, scrubAreaProps, suffixProps };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/components/number-field/number-field.slots.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The `data-*` hooks `NumberField` stamps on its parts, for host-side styling and tests. Slot values
|
|
4
|
+
* mark each rendered element; the state attributes are emitted by Base UI's NumberField — pair a slot
|
|
5
|
+
* with a state to target, say, the field shell only while it is focused. The state attributes that come
|
|
6
|
+
* from a wrapping `Field.Root` (validity, touched, dirty, filled) are read off the same elements.
|
|
7
|
+
*/
|
|
8
|
+
declare enum NumberFieldDataAttributes {
|
|
9
|
+
/** The slot marking a rendered element as a NumberField part. */
|
|
10
|
+
slot = "data-slot",
|
|
11
|
+
/** The size scale — `md` | `lg`; the generated layer keys the per-size internals off it. */
|
|
12
|
+
size = "data-size",
|
|
13
|
+
/** The stepper layout — `end` (default) | `split` | `stacked` | `none`; stamped on the group, the CSS branches off it. */
|
|
14
|
+
steppers = "data-steppers",
|
|
15
|
+
/** Present while the value is being scrubbed by pointer drag. */
|
|
16
|
+
scrubbing = "data-scrubbing",
|
|
17
|
+
/** Present when the number field is disabled. */
|
|
18
|
+
disabled = "data-disabled",
|
|
19
|
+
/** Present when the number field is read-only. */
|
|
20
|
+
readonly = "data-readonly",
|
|
21
|
+
/** Present when the number field is required. */
|
|
22
|
+
required = "data-required",
|
|
23
|
+
/** Present when the number field is valid (when wrapped in `Field.Root`). */
|
|
24
|
+
valid = "data-valid",
|
|
25
|
+
/** Present when the number field is invalid (when wrapped in `Field.Root`). */
|
|
26
|
+
invalid = "data-invalid",
|
|
27
|
+
/** Present when the number field is focused (when wrapped in `Field.Root`). */
|
|
28
|
+
focused = "data-focused"
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { NumberFieldDataAttributes };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/components/number-field/number-field.slots.ts
|
|
2
|
+
/**
|
|
3
|
+
* The slot vocabulary every `NumberField` 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 NUMBER_FIELD_SLOTS = {
|
|
8
|
+
root: "noctis-number-field",
|
|
9
|
+
group: "noctis-number-field-group",
|
|
10
|
+
input: "noctis-number-field-input",
|
|
11
|
+
prefix: "noctis-number-field-prefix",
|
|
12
|
+
suffix: "noctis-number-field-suffix",
|
|
13
|
+
increment: "noctis-number-field-increment",
|
|
14
|
+
decrement: "noctis-number-field-decrement",
|
|
15
|
+
scrubArea: "noctis-number-field-scrub-area",
|
|
16
|
+
scrubAreaCursor: "noctis-number-field-scrub-area-cursor"
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The `data-*` hooks `NumberField` stamps on its parts, for host-side styling and tests. Slot values
|
|
20
|
+
* mark each rendered element; the state attributes are emitted by Base UI's NumberField — pair a slot
|
|
21
|
+
* with a state to target, say, the field shell only while it is focused. The state attributes that come
|
|
22
|
+
* from a wrapping `Field.Root` (validity, touched, dirty, filled) are read off the same elements.
|
|
23
|
+
*/
|
|
24
|
+
let NumberFieldDataAttributes = /* @__PURE__ */ function(NumberFieldDataAttributes) {
|
|
25
|
+
/** The slot marking a rendered element as a NumberField part. */
|
|
26
|
+
NumberFieldDataAttributes["slot"] = "data-slot";
|
|
27
|
+
/** The size scale — `md` | `lg`; the generated layer keys the per-size internals off it. */
|
|
28
|
+
NumberFieldDataAttributes["size"] = "data-size";
|
|
29
|
+
/** The stepper layout — `end` (default) | `split` | `stacked` | `none`; stamped on the group, the CSS branches off it. */
|
|
30
|
+
NumberFieldDataAttributes["steppers"] = "data-steppers";
|
|
31
|
+
/** Present while the value is being scrubbed by pointer drag. */
|
|
32
|
+
NumberFieldDataAttributes["scrubbing"] = "data-scrubbing";
|
|
33
|
+
/** Present when the number field is disabled. */
|
|
34
|
+
NumberFieldDataAttributes["disabled"] = "data-disabled";
|
|
35
|
+
/** Present when the number field is read-only. */
|
|
36
|
+
NumberFieldDataAttributes["readonly"] = "data-readonly";
|
|
37
|
+
/** Present when the number field is required. */
|
|
38
|
+
NumberFieldDataAttributes["required"] = "data-required";
|
|
39
|
+
/** Present when the number field is valid (when wrapped in `Field.Root`). */
|
|
40
|
+
NumberFieldDataAttributes["valid"] = "data-valid";
|
|
41
|
+
/** Present when the number field is invalid (when wrapped in `Field.Root`). */
|
|
42
|
+
NumberFieldDataAttributes["invalid"] = "data-invalid";
|
|
43
|
+
/** Present when the number field is focused (when wrapped in `Field.Root`). */
|
|
44
|
+
NumberFieldDataAttributes["focused"] = "data-focused";
|
|
45
|
+
return NumberFieldDataAttributes;
|
|
46
|
+
}({});
|
|
47
|
+
//#endregion
|
|
48
|
+
export { NUMBER_FIELD_SLOTS, NumberFieldDataAttributes };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
//#region src/components/otp-field/otp-field.context.ts
|
|
4
|
+
const OtpFieldContext = createContext(null);
|
|
5
|
+
const OtpFieldProvider = OtpFieldContext.Provider;
|
|
6
|
+
/** Read the field context, throwing a named error when a part renders outside `OtpField.Root`. */
|
|
7
|
+
function useOtpFieldContext(part) {
|
|
8
|
+
const context = use(OtpFieldContext);
|
|
9
|
+
if (context === null) throw new Error(`OtpField.${part} must be rendered inside <OtpField.Root>.`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { OtpFieldProvider, useOtpFieldContext };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { separator_d_exports } from "../../primitives/separator.js";
|
|
2
|
+
import { otp_field_d_exports } from "../../primitives/otp-field.js";
|
|
3
|
+
import { OtpFieldInputPropsArgs, OtpFieldRootPropsArgs, OtpFieldSeparatorPropsArgs, OtpFieldSize, inputProps, rootProps, separatorProps } from "./otp-field.props.js";
|
|
4
|
+
import { ReactElement, ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/otp-field/otp-field.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Owns the OTP value and shares the `size` with the cells. Works controlled (`value` +
|
|
9
|
+
* `onValueChange`) or uncontrolled (`defaultValue`). The required `length` sets the cell count;
|
|
10
|
+
* render that many `OtpField.Input` parts inside. Paste-to-fill, arrow navigation, and completion
|
|
11
|
+
* detection come from Base UI.
|
|
12
|
+
*/
|
|
13
|
+
declare function OtpFieldRoot({
|
|
14
|
+
size,
|
|
15
|
+
length,
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: OtpField.Root.Props): ReactElement;
|
|
20
|
+
/**
|
|
21
|
+
* One character cell. Render `length` of them inside `OtpField.Root`. Base UI stamps the live
|
|
22
|
+
* `data-filled`/`data-disabled`/`data-invalid`/`data-index` from the cell's own state, so the render
|
|
23
|
+
* contributes only the slot anchor. `className` is a consumer passthrough.
|
|
24
|
+
*/
|
|
25
|
+
declare function OtpFieldInput({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: OtpField.Input.Props): ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* The divider between OTP cell groups — render it between two runs of `OtpField.Input` to teach the
|
|
31
|
+
* canonical `123-456` grouping (the layout most one-time codes are pasted in). A thin neutral hairline,
|
|
32
|
+
* never accent. Built on Base UI's Separator, so it carries the `separator` role and a `data-orientation`
|
|
33
|
+
* (passed through) without extra wiring.
|
|
34
|
+
*/
|
|
35
|
+
declare function OtpFieldSeparator({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: OtpField.Separator.Props): ReactElement;
|
|
39
|
+
/**
|
|
40
|
+
* A one-time-passcode field: a row of single-character cells that behave as one input. Each cell wears
|
|
41
|
+
* the field surface; the focused cell takes the accent ring. Built on Base UI's OTP Field, so typing
|
|
42
|
+
* advances to the next cell, Backspace and arrow keys navigate the row (RTL-aware), and a pasted code
|
|
43
|
+
* fills the whole field at once. Wrap it in a `Field.Root` for label, validation, and the invalid
|
|
44
|
+
* border.
|
|
45
|
+
*
|
|
46
|
+
* Compose from parts: `OtpField.Root` owns the value, the `length`, and the shared `size`; render that
|
|
47
|
+
* many `OtpField.Input` cells inside.
|
|
48
|
+
*
|
|
49
|
+
* The runtime compound is a plain object (kept tree-shakeable); per-part prop and state types are
|
|
50
|
+
* exposed through the matching `OtpField` namespace — e.g. `OtpField.Input.Props`.
|
|
51
|
+
*/
|
|
52
|
+
declare const OtpField: {
|
|
53
|
+
/** Owns the value, the `length`, and the shared `size`. `OtpField.Root.props({ size })` → its spreadable prop bag. */Root: typeof OtpFieldRoot & {
|
|
54
|
+
props: typeof rootProps;
|
|
55
|
+
}; /** One character cell. `OtpField.Input.props({ filled, disabled, invalid })` → its spreadable prop bag for a foreign element. */
|
|
56
|
+
Input: typeof OtpFieldInput & {
|
|
57
|
+
props: typeof inputProps;
|
|
58
|
+
}; /** The divider between cell groups. `OtpField.Separator.props()` → its spreadable prop bag for a foreign element. */
|
|
59
|
+
Separator: typeof OtpFieldSeparator & {
|
|
60
|
+
props: typeof separatorProps;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Per-part prop and state types, mirroring Base UI's `Component.Part.Props` convention. Types-only —
|
|
65
|
+
* it emits no runtime code and merges with the `OtpField` object above, so `OtpField.Input` is the
|
|
66
|
+
* component value while `OtpField.Input.Props` is its prop type.
|
|
67
|
+
*/
|
|
68
|
+
declare namespace OtpField {
|
|
69
|
+
/** Control height of the cells — `sm`, `md`, or `lg`. */
|
|
70
|
+
type Size = OtpFieldSize;
|
|
71
|
+
namespace Root {
|
|
72
|
+
type Props = Omit<otp_field_d_exports.OTPFieldRoot.Props, "className" | "children"> & {
|
|
73
|
+
/**
|
|
74
|
+
* Control height of the cells.
|
|
75
|
+
* @default "md"
|
|
76
|
+
*/
|
|
77
|
+
size?: OtpFieldSize; /** The `OtpField.Input` cells — render `length` of them. */
|
|
78
|
+
children?: ReactNode; /** Classes merged onto the root. */
|
|
79
|
+
className?: string;
|
|
80
|
+
};
|
|
81
|
+
type State = otp_field_d_exports.OTPFieldRoot.State;
|
|
82
|
+
/** Argument to the `OtpField.Root.props(...)` escape-hatch helper. */
|
|
83
|
+
type PropsArgs = OtpFieldRootPropsArgs;
|
|
84
|
+
}
|
|
85
|
+
namespace Input {
|
|
86
|
+
type Props = otp_field_d_exports.OTPFieldInput.Props;
|
|
87
|
+
type State = otp_field_d_exports.OTPFieldInput.State;
|
|
88
|
+
/** Argument to the `OtpField.Input.props(...)` escape-hatch helper. */
|
|
89
|
+
type PropsArgs = OtpFieldInputPropsArgs;
|
|
90
|
+
}
|
|
91
|
+
namespace Separator {
|
|
92
|
+
type Props = separator_d_exports.Separator.Props;
|
|
93
|
+
type State = separator_d_exports.Separator.State;
|
|
94
|
+
/** Argument to the `OtpField.Separator.props(...)` escape-hatch helper. */
|
|
95
|
+
type PropsArgs = OtpFieldSeparatorPropsArgs;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { OtpField };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { otp_field_exports } from "../../primitives/otp-field.js";
|
|
3
|
+
import { OtpFieldProvider, useOtpFieldContext } from "./otp-field.context.js";
|
|
4
|
+
import { OTP_FIELD_SLOTS } from "./otp-field.slots.js";
|
|
5
|
+
import { inputProps, rootProps, separatorProps } from "./otp-field.props.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/otp-field/otp-field.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Owns the OTP value and shares the `size` with the cells. Works controlled (`value` +
|
|
10
|
+
* `onValueChange`) or uncontrolled (`defaultValue`). The required `length` sets the cell count;
|
|
11
|
+
* render that many `OtpField.Input` parts inside. Paste-to-fill, arrow navigation, and completion
|
|
12
|
+
* detection come from Base UI.
|
|
13
|
+
*/
|
|
14
|
+
function OtpFieldRoot({ size = "md", length, className, children, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(otp_field_exports.OTPFieldPreview.Root, {
|
|
16
|
+
"data-slot": OTP_FIELD_SLOTS.root,
|
|
17
|
+
"data-size": size,
|
|
18
|
+
length,
|
|
19
|
+
className,
|
|
20
|
+
...props,
|
|
21
|
+
children: /* @__PURE__ */ jsx(OtpFieldProvider, {
|
|
22
|
+
value: { size },
|
|
23
|
+
children
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One character cell. Render `length` of them inside `OtpField.Root`. Base UI stamps the live
|
|
29
|
+
* `data-filled`/`data-disabled`/`data-invalid`/`data-index` from the cell's own state, so the render
|
|
30
|
+
* contributes only the slot anchor. `className` is a consumer passthrough.
|
|
31
|
+
*/
|
|
32
|
+
function OtpFieldInput({ className, ...props }) {
|
|
33
|
+
useOtpFieldContext("Input");
|
|
34
|
+
return /* @__PURE__ */ jsx(otp_field_exports.OTPFieldPreview.Input, {
|
|
35
|
+
"data-slot": OTP_FIELD_SLOTS.input,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The divider between OTP cell groups — render it between two runs of `OtpField.Input` to teach the
|
|
42
|
+
* canonical `123-456` grouping (the layout most one-time codes are pasted in). A thin neutral hairline,
|
|
43
|
+
* never accent. Built on Base UI's Separator, so it carries the `separator` role and a `data-orientation`
|
|
44
|
+
* (passed through) without extra wiring.
|
|
45
|
+
*/
|
|
46
|
+
function OtpFieldSeparator({ className, ...props }) {
|
|
47
|
+
useOtpFieldContext("Separator");
|
|
48
|
+
return /* @__PURE__ */ jsx(otp_field_exports.OTPFieldPreview.Separator, {
|
|
49
|
+
"data-slot": OTP_FIELD_SLOTS.separator,
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A one-time-passcode field: a row of single-character cells that behave as one input. Each cell wears
|
|
56
|
+
* the field surface; the focused cell takes the accent ring. Built on Base UI's OTP Field, so typing
|
|
57
|
+
* advances to the next cell, Backspace and arrow keys navigate the row (RTL-aware), and a pasted code
|
|
58
|
+
* fills the whole field at once. Wrap it in a `Field.Root` for label, validation, and the invalid
|
|
59
|
+
* border.
|
|
60
|
+
*
|
|
61
|
+
* Compose from parts: `OtpField.Root` owns the value, the `length`, and the shared `size`; render that
|
|
62
|
+
* many `OtpField.Input` cells inside.
|
|
63
|
+
*
|
|
64
|
+
* The runtime compound is a plain object (kept tree-shakeable); per-part prop and state types are
|
|
65
|
+
* exposed through the matching `OtpField` namespace — e.g. `OtpField.Input.Props`.
|
|
66
|
+
*/
|
|
67
|
+
const OtpField = {
|
|
68
|
+
/** Owns the value, the `length`, and the shared `size`. `OtpField.Root.props({ size })` → its spreadable prop bag. */
|
|
69
|
+
Root: Object.assign(OtpFieldRoot, { props: rootProps }),
|
|
70
|
+
/** One character cell. `OtpField.Input.props({ filled, disabled, invalid })` → its spreadable prop bag for a foreign element. */
|
|
71
|
+
Input: Object.assign(OtpFieldInput, { props: inputProps }),
|
|
72
|
+
/** The divider between cell groups. `OtpField.Separator.props()` → its spreadable prop bag for a foreign element. */
|
|
73
|
+
Separator: Object.assign(OtpFieldSeparator, { props: separatorProps })
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { OtpField };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/components/otp-field/otp-field.props.d.ts
|
|
2
|
+
/** Control height of the cells — the shared control-height ladder, stamped as `data-size`. */
|
|
3
|
+
type OtpFieldSize = "md" | "lg";
|
|
4
|
+
/** A spreadable data-attribute prop bag — the shape every `OtpField.*.props()` returns. */
|
|
5
|
+
type OtpFieldPartProps = {
|
|
6
|
+
/** The slot value the matching `otp-field.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 `OtpField.Root.props(...)` — the field's control size, stamped on the root the CSS keys cell metrics off. */
|
|
16
|
+
interface OtpFieldRootPropsArgs extends BasePropsArgs {
|
|
17
|
+
/** Control height of the cells — `md` or `lg`. @default "md" */
|
|
18
|
+
size?: OtpFieldSize;
|
|
19
|
+
}
|
|
20
|
+
/** Argument to `OtpField.Separator.props(...)` — the divider drawn between OTP cell groups carries no state, only the slot anchor. */
|
|
21
|
+
type OtpFieldSeparatorPropsArgs = BasePropsArgs;
|
|
22
|
+
/** Argument to `OtpField.Input.props(...)` — the per-cell state the CSS keys its border/affordance off. */
|
|
23
|
+
interface OtpFieldInputPropsArgs extends BasePropsArgs {
|
|
24
|
+
/** Whether this cell contains a character (drives `data-filled`). */
|
|
25
|
+
filled?: boolean;
|
|
26
|
+
/** Whether the field is disabled (drives the not-allowed affordance via `data-disabled`). */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Whether the field is invalid (drives the danger border via `data-invalid`). */
|
|
29
|
+
invalid?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Root prop bag: `data-slot` plus the `data-size` the descendant cell rules read. */
|
|
32
|
+
declare function rootProps({
|
|
33
|
+
size,
|
|
34
|
+
className
|
|
35
|
+
}?: OtpFieldRootPropsArgs): OtpFieldPartProps;
|
|
36
|
+
/** Cell prop bag: slot anchor plus the `data-filled`/`data-disabled`/`data-invalid` state. */
|
|
37
|
+
declare function inputProps({
|
|
38
|
+
filled,
|
|
39
|
+
disabled,
|
|
40
|
+
invalid,
|
|
41
|
+
className
|
|
42
|
+
}?: OtpFieldInputPropsArgs): OtpFieldPartProps;
|
|
43
|
+
/** Separator prop bag: just the slot anchor the divider rule keys off (Base UI stamps `data-orientation` itself). */
|
|
44
|
+
declare function separatorProps({
|
|
45
|
+
className
|
|
46
|
+
}?: OtpFieldSeparatorPropsArgs): OtpFieldPartProps;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { OtpFieldInputPropsArgs, OtpFieldRootPropsArgs, OtpFieldSeparatorPropsArgs, OtpFieldSize, inputProps, rootProps, separatorProps };
|