@ada-cx/lovelace 1.0.0-setup.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 +113 -0
- package/dist/components/AgentMessage/AgentMessage.css.d.ts +2 -0
- package/dist/components/AgentMessage/AgentMessage.css.js +7 -0
- package/dist/components/AgentMessage/AgentMessage.css.js.map +1 -0
- package/dist/components/AgentMessage/AgentMessage.d.ts +21 -0
- package/dist/components/AgentMessage/AgentMessage.js +24 -0
- package/dist/components/AgentMessage/AgentMessage.js.map +1 -0
- package/dist/components/AgentMessage/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.css.d.ts +48 -0
- package/dist/components/Avatar/Avatar.css.js +28 -0
- package/dist/components/Avatar/Avatar.css.js.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +35 -0
- package/dist/components/Avatar/Avatar.js +26 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/AvatarPlaceholder.d.ts +14 -0
- package/dist/components/Avatar/AvatarPlaceholder.js +18 -0
- package/dist/components/Avatar/AvatarPlaceholder.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +4 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.css.d.ts +3 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.css.js +8 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.css.js.map +1 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.d.ts +24 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.js +28 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.js.map +1 -0
- package/dist/components/BubbleOverlay/index.d.ts +1 -0
- package/dist/components/Button/Button.css.d.ts +48 -0
- package/dist/components/Button/Button.css.js +29 -0
- package/dist/components/Button/Button.css.js.map +1 -0
- package/dist/components/Button/Button.d.ts +14 -0
- package/dist/components/Button/Button.js +24 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.css.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.css.js +7 -0
- package/dist/components/Checkbox/Checkbox.css.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +22 -0
- package/dist/components/Checkbox/Checkbox.js +42 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Chip/Chip.css.d.ts +19 -0
- package/dist/components/Chip/Chip.css.js +51 -0
- package/dist/components/Chip/Chip.css.js.map +1 -0
- package/dist/components/Chip/Chip.d.ts +23 -0
- package/dist/components/Chip/Chip.js +21 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/Dialog/Dialog.css.d.ts +15 -0
- package/dist/components/Dialog/Dialog.css.js +16 -0
- package/dist/components/Dialog/Dialog.css.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +15 -0
- package/dist/components/Dialog/Dialog.js +18 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/DialogActions.d.ts +8 -0
- package/dist/components/Dialog/DialogActions.js +14 -0
- package/dist/components/Dialog/DialogActions.js.map +1 -0
- package/dist/components/Dialog/DialogBody.d.ts +7 -0
- package/dist/components/Dialog/DialogBody.js +14 -0
- package/dist/components/Dialog/DialogBody.js.map +1 -0
- package/dist/components/Dialog/DialogContent.d.ts +8 -0
- package/dist/components/Dialog/DialogContent.js +14 -0
- package/dist/components/Dialog/DialogContent.js.map +1 -0
- package/dist/components/Dialog/DialogIcon.d.ts +11 -0
- package/dist/components/Dialog/DialogIcon.js +18 -0
- package/dist/components/Dialog/DialogIcon.js.map +1 -0
- package/dist/components/Dialog/DialogRoot.d.ts +15 -0
- package/dist/components/Dialog/DialogRoot.js +14 -0
- package/dist/components/Dialog/DialogRoot.js.map +1 -0
- package/dist/components/Dialog/DialogTitle.d.ts +7 -0
- package/dist/components/Dialog/DialogTitle.js +16 -0
- package/dist/components/Dialog/DialogTitle.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +6 -0
- package/dist/components/DialogOverlay/DialogOverlay.css.d.ts +3 -0
- package/dist/components/DialogOverlay/DialogOverlay.css.js +8 -0
- package/dist/components/DialogOverlay/DialogOverlay.css.js.map +1 -0
- package/dist/components/DialogOverlay/DialogOverlay.d.ts +30 -0
- package/dist/components/DialogOverlay/DialogOverlay.js +29 -0
- package/dist/components/DialogOverlay/DialogOverlay.js.map +1 -0
- package/dist/components/DialogOverlay/index.d.ts +1 -0
- package/dist/components/Divider/Divider.css.d.ts +27 -0
- package/dist/components/Divider/Divider.css.js +17 -0
- package/dist/components/Divider/Divider.css.js.map +1 -0
- package/dist/components/Divider/Divider.d.ts +27 -0
- package/dist/components/Divider/Divider.js +35 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/FullscreenOverlay/FullscreenOverlay.css.d.ts +3 -0
- package/dist/components/FullscreenOverlay/FullscreenOverlay.css.js +8 -0
- package/dist/components/FullscreenOverlay/FullscreenOverlay.css.js.map +1 -0
- package/dist/components/FullscreenOverlay/FullscreenOverlay.d.ts +22 -0
- package/dist/components/FullscreenOverlay/FullscreenOverlay.js +28 -0
- package/dist/components/FullscreenOverlay/FullscreenOverlay.js.map +1 -0
- package/dist/components/FullscreenOverlay/index.d.ts +1 -0
- package/dist/components/Header/Header.css.d.ts +2 -0
- package/dist/components/Header/Header.css.js +7 -0
- package/dist/components/Header/Header.css.js.map +1 -0
- package/dist/components/Header/Header.d.ts +6 -0
- package/dist/components/Header/Header.js +8 -0
- package/dist/components/Header/Header.js.map +1 -0
- package/dist/components/Header/HeaderRoot.d.ts +11 -0
- package/dist/components/Header/HeaderRoot.js +16 -0
- package/dist/components/Header/HeaderRoot.js.map +1 -0
- package/dist/components/Header/HeaderTitle.d.ts +10 -0
- package/dist/components/Header/HeaderTitle.js +16 -0
- package/dist/components/Header/HeaderTitle.js.map +1 -0
- package/dist/components/Header/index.d.ts +2 -0
- package/dist/components/Icon/Icon.css.d.ts +1 -0
- package/dist/components/Icon/Icon.css.js +7 -0
- package/dist/components/Icon/Icon.css.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +7 -0
- package/dist/components/Icon/Icon.js +22 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Icon/icons/AdaLogo.css.d.ts +1 -0
- package/dist/components/Icon/icons/AdaLogo.css.js +7 -0
- package/dist/components/Icon/icons/AdaLogo.css.js.map +1 -0
- package/dist/components/Icon/icons/AdaLogo.d.ts +6 -0
- package/dist/components/Icon/icons/AdaLogo.js +27 -0
- package/dist/components/Icon/icons/AdaLogo.js.map +1 -0
- package/dist/components/Icon/icons/ArrowDown.d.ts +2 -0
- package/dist/components/Icon/icons/ArrowDown.js +17 -0
- package/dist/components/Icon/icons/ArrowDown.js.map +1 -0
- package/dist/components/Icon/icons/ArrowLeft.d.ts +8 -0
- package/dist/components/Icon/icons/ArrowLeft.js +18 -0
- package/dist/components/Icon/icons/ArrowLeft.js.map +1 -0
- package/dist/components/Icon/icons/ArrowNortheast.d.ts +2 -0
- package/dist/components/Icon/icons/ArrowNortheast.js +14 -0
- package/dist/components/Icon/icons/ArrowNortheast.js.map +1 -0
- package/dist/components/Icon/icons/ArrowNorthwest.d.ts +2 -0
- package/dist/components/Icon/icons/ArrowNorthwest.js +14 -0
- package/dist/components/Icon/icons/ArrowNorthwest.js.map +1 -0
- package/dist/components/Icon/icons/ArrowRight.d.ts +8 -0
- package/dist/components/Icon/icons/ArrowRight.js +18 -0
- package/dist/components/Icon/icons/ArrowRight.js.map +1 -0
- package/dist/components/Icon/icons/Bell.d.ts +2 -0
- package/dist/components/Icon/icons/Bell.js +14 -0
- package/dist/components/Icon/icons/Bell.js.map +1 -0
- package/dist/components/Icon/icons/BellSlash.d.ts +2 -0
- package/dist/components/Icon/icons/BellSlash.js +14 -0
- package/dist/components/Icon/icons/BellSlash.js.map +1 -0
- package/dist/components/Icon/icons/Checkmark.d.ts +2 -0
- package/dist/components/Icon/icons/Checkmark.js +14 -0
- package/dist/components/Icon/icons/Checkmark.js.map +1 -0
- package/dist/components/Icon/icons/ChevronLeft.d.ts +2 -0
- package/dist/components/Icon/icons/ChevronLeft.js +14 -0
- package/dist/components/Icon/icons/ChevronLeft.js.map +1 -0
- package/dist/components/Icon/icons/ChevronRight.d.ts +2 -0
- package/dist/components/Icon/icons/ChevronRight.js +14 -0
- package/dist/components/Icon/icons/ChevronRight.js.map +1 -0
- package/dist/components/Icon/icons/CloudUpload.d.ts +2 -0
- package/dist/components/Icon/icons/CloudUpload.js +14 -0
- package/dist/components/Icon/icons/CloudUpload.js.map +1 -0
- package/dist/components/Icon/icons/Download.d.ts +2 -0
- package/dist/components/Icon/icons/Download.js +14 -0
- package/dist/components/Icon/icons/Download.js.map +1 -0
- package/dist/components/Icon/icons/Ellipses.d.ts +2 -0
- package/dist/components/Icon/icons/Ellipses.js +14 -0
- package/dist/components/Icon/icons/Ellipses.js.map +1 -0
- package/dist/components/Icon/icons/Email.d.ts +2 -0
- package/dist/components/Icon/icons/Email.js +14 -0
- package/dist/components/Icon/icons/Email.js.map +1 -0
- package/dist/components/Icon/icons/ExclamationSync.d.ts +2 -0
- package/dist/components/Icon/icons/ExclamationSync.js +14 -0
- package/dist/components/Icon/icons/ExclamationSync.js.map +1 -0
- package/dist/components/Icon/icons/ExclamationTriangle.d.ts +2 -0
- package/dist/components/Icon/icons/ExclamationTriangle.js +18 -0
- package/dist/components/Icon/icons/ExclamationTriangle.js.map +1 -0
- package/dist/components/Icon/icons/Eye.d.ts +2 -0
- package/dist/components/Icon/icons/Eye.js +14 -0
- package/dist/components/Icon/icons/Eye.js.map +1 -0
- package/dist/components/Icon/icons/EyeSlash.d.ts +2 -0
- package/dist/components/Icon/icons/EyeSlash.js +14 -0
- package/dist/components/Icon/icons/EyeSlash.js.map +1 -0
- package/dist/components/Icon/icons/Glyph.d.ts +16 -0
- package/dist/components/Icon/icons/Glyph.js +24 -0
- package/dist/components/Icon/icons/Glyph.js.map +1 -0
- package/dist/components/Icon/icons/Language.d.ts +2 -0
- package/dist/components/Icon/icons/Language.js +14 -0
- package/dist/components/Icon/icons/Language.js.map +1 -0
- package/dist/components/Icon/icons/MediaSlash.d.ts +2 -0
- package/dist/components/Icon/icons/MediaSlash.js +14 -0
- package/dist/components/Icon/icons/MediaSlash.js.map +1 -0
- package/dist/components/Icon/icons/MessagingFill.d.ts +2 -0
- package/dist/components/Icon/icons/MessagingFill.js +18 -0
- package/dist/components/Icon/icons/MessagingFill.js.map +1 -0
- package/dist/components/Icon/icons/Minimize.d.ts +2 -0
- package/dist/components/Icon/icons/Minimize.js +14 -0
- package/dist/components/Icon/icons/Minimize.js.map +1 -0
- package/dist/components/Icon/icons/Mute.d.ts +2 -0
- package/dist/components/Icon/icons/Mute.js +14 -0
- package/dist/components/Icon/icons/Mute.js.map +1 -0
- package/dist/components/Icon/icons/Paperclip.d.ts +2 -0
- package/dist/components/Icon/icons/Paperclip.js +14 -0
- package/dist/components/Icon/icons/Paperclip.js.map +1 -0
- package/dist/components/Icon/icons/PersonFill.d.ts +2 -0
- package/dist/components/Icon/icons/PersonFill.js +14 -0
- package/dist/components/Icon/icons/PersonFill.js.map +1 -0
- package/dist/components/Icon/icons/PlayFill.d.ts +2 -0
- package/dist/components/Icon/icons/PlayFill.js +14 -0
- package/dist/components/Icon/icons/PlayFill.js.map +1 -0
- package/dist/components/Icon/icons/SendFill.d.ts +2 -0
- package/dist/components/Icon/icons/SendFill.js +14 -0
- package/dist/components/Icon/icons/SendFill.js.map +1 -0
- package/dist/components/Icon/icons/StarBadgeFill.d.ts +2 -0
- package/dist/components/Icon/icons/StarBadgeFill.js +18 -0
- package/dist/components/Icon/icons/StarBadgeFill.js.map +1 -0
- package/dist/components/Icon/icons/ThumbsDown.d.ts +2 -0
- package/dist/components/Icon/icons/ThumbsDown.js +14 -0
- package/dist/components/Icon/icons/ThumbsDown.js.map +1 -0
- package/dist/components/Icon/icons/ThumbsUp.d.ts +2 -0
- package/dist/components/Icon/icons/ThumbsUp.js +14 -0
- package/dist/components/Icon/icons/ThumbsUp.js.map +1 -0
- package/dist/components/Icon/icons/Volume.d.ts +2 -0
- package/dist/components/Icon/icons/Volume.js +14 -0
- package/dist/components/Icon/icons/Volume.js.map +1 -0
- package/dist/components/Icon/icons/Xmark.d.ts +2 -0
- package/dist/components/Icon/icons/Xmark.js +14 -0
- package/dist/components/Icon/icons/Xmark.js.map +1 -0
- package/dist/components/Icon/icons/XmarkCircle.d.ts +2 -0
- package/dist/components/Icon/icons/XmarkCircle.js +14 -0
- package/dist/components/Icon/icons/XmarkCircle.js.map +1 -0
- package/dist/components/Icon/icons/index.d.ts +34 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/IconButton/IconButton.css.d.ts +54 -0
- package/dist/components/IconButton/IconButton.css.js +30 -0
- package/dist/components/IconButton/IconButton.css.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +18 -0
- package/dist/components/IconButton/IconButton.js +25 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/Image/Image.css.d.ts +1 -0
- package/dist/components/Image/Image.css.js +7 -0
- package/dist/components/Image/Image.css.js.map +1 -0
- package/dist/components/Image/Image.d.ts +16 -0
- package/dist/components/Image/Image.js +44 -0
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Input/Input.context.d.ts +12 -0
- package/dist/components/Input/Input.context.js +11 -0
- package/dist/components/Input/Input.context.js.map +1 -0
- package/dist/components/Input/Input.css.d.ts +11 -0
- package/dist/components/Input/Input.css.js +16 -0
- package/dist/components/Input/Input.css.js.map +1 -0
- package/dist/components/Input/Input.d.ts +22 -0
- package/dist/components/Input/Input.js +20 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/InputButton.d.ts +12 -0
- package/dist/components/Input/InputButton.js +21 -0
- package/dist/components/Input/InputButton.js.map +1 -0
- package/dist/components/Input/InputControl.d.ts +8 -0
- package/dist/components/Input/InputControl.js +15 -0
- package/dist/components/Input/InputControl.js.map +1 -0
- package/dist/components/Input/InputField.d.ts +9 -0
- package/dist/components/Input/InputField.js +23 -0
- package/dist/components/Input/InputField.js.map +1 -0
- package/dist/components/Input/InputHelperText.d.ts +8 -0
- package/dist/components/Input/InputHelperText.js +20 -0
- package/dist/components/Input/InputHelperText.js.map +1 -0
- package/dist/components/Input/InputLabel.d.ts +8 -0
- package/dist/components/Input/InputLabel.js +16 -0
- package/dist/components/Input/InputLabel.js.map +1 -0
- package/dist/components/Input/InputRoot.d.ts +11 -0
- package/dist/components/Input/InputRoot.js +30 -0
- package/dist/components/Input/InputRoot.js.map +1 -0
- package/dist/components/Input/InputTextArea.d.ts +15 -0
- package/dist/components/Input/InputTextArea.js +39 -0
- package/dist/components/Input/InputTextArea.js.map +1 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Link/Link.css.d.ts +8 -0
- package/dist/components/Link/Link.css.js +16 -0
- package/dist/components/Link/Link.css.js.map +1 -0
- package/dist/components/Link/Link.d.ts +12 -0
- package/dist/components/Link/Link.js +24 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/MenuItem/Menu.d.ts +14 -0
- package/dist/components/MenuItem/Menu.js +15 -0
- package/dist/components/MenuItem/Menu.js.map +1 -0
- package/dist/components/MenuItem/MenuItem.css.d.ts +4 -0
- package/dist/components/MenuItem/MenuItem.css.js +7 -0
- package/dist/components/MenuItem/MenuItem.css.js.map +1 -0
- package/dist/components/MenuItem/MenuItem.d.ts +10 -0
- package/dist/components/MenuItem/MenuItem.js +12 -0
- package/dist/components/MenuItem/MenuItem.js.map +1 -0
- package/dist/components/MenuItem/MenuItemLeading.d.ts +11 -0
- package/dist/components/MenuItem/MenuItemLeading.js +17 -0
- package/dist/components/MenuItem/MenuItemLeading.js.map +1 -0
- package/dist/components/MenuItem/MenuItemRoot.d.ts +18 -0
- package/dist/components/MenuItem/MenuItemRoot.js +15 -0
- package/dist/components/MenuItem/MenuItemRoot.js.map +1 -0
- package/dist/components/MenuItem/MenuItemTrailing.d.ts +14 -0
- package/dist/components/MenuItem/MenuItemTrailing.js +17 -0
- package/dist/components/MenuItem/MenuItemTrailing.js.map +1 -0
- package/dist/components/MenuItem/index.d.ts +4 -0
- package/dist/components/Overlay/overlay.css.d.ts +2 -0
- package/dist/components/PictureMessage/PictureMessage.css.d.ts +27 -0
- package/dist/components/PictureMessage/PictureMessage.css.js +25 -0
- package/dist/components/PictureMessage/PictureMessage.css.js.map +1 -0
- package/dist/components/PictureMessage/PictureMessage.d.ts +37 -0
- package/dist/components/PictureMessage/PictureMessage.js +34 -0
- package/dist/components/PictureMessage/PictureMessage.js.map +1 -0
- package/dist/components/PictureMessage/index.d.ts +1 -0
- package/dist/components/PillButton/PillButton.css.d.ts +10 -0
- package/dist/components/PillButton/PillButton.css.js +16 -0
- package/dist/components/PillButton/PillButton.css.js.map +1 -0
- package/dist/components/PillButton/PillButton.d.ts +16 -0
- package/dist/components/PillButton/PillButton.js +18 -0
- package/dist/components/PillButton/PillButton.js.map +1 -0
- package/dist/components/PillButton/index.d.ts +2 -0
- package/dist/components/ProactiveMessage/ProactiveMessage.css.d.ts +1 -0
- package/dist/components/ProactiveMessage/ProactiveMessage.css.js +7 -0
- package/dist/components/ProactiveMessage/ProactiveMessage.css.js.map +1 -0
- package/dist/components/ProactiveMessage/ProactiveMessage.d.ts +19 -0
- package/dist/components/ProactiveMessage/ProactiveMessage.js +16 -0
- package/dist/components/ProactiveMessage/ProactiveMessage.js.map +1 -0
- package/dist/components/ProactiveMessage/index.d.ts +2 -0
- package/dist/components/Radio/Radio.css.d.ts +5 -0
- package/dist/components/Radio/Radio.css.js +7 -0
- package/dist/components/Radio/Radio.css.js.map +1 -0
- package/dist/components/Radio/Radio.d.ts +15 -0
- package/dist/components/Radio/Radio.js +23 -0
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/Radio/RadioGroup.d.ts +15 -0
- package/dist/components/Radio/RadioGroup.js +16 -0
- package/dist/components/Radio/RadioGroup.js.map +1 -0
- package/dist/components/Radio/index.d.ts +4 -0
- package/dist/components/ScrollMarker/ScrollMarker.css.d.ts +24 -0
- package/dist/components/ScrollMarker/ScrollMarker.css.js +25 -0
- package/dist/components/ScrollMarker/ScrollMarker.css.js.map +1 -0
- package/dist/components/ScrollMarker/ScrollMarker.d.ts +26 -0
- package/dist/components/ScrollMarker/ScrollMarker.js +29 -0
- package/dist/components/ScrollMarker/ScrollMarker.js.map +1 -0
- package/dist/components/ScrollMarker/index.d.ts +1 -0
- package/dist/components/Sheet/Sheet.css.d.ts +8 -0
- package/dist/components/Sheet/Sheet.css.js +7 -0
- package/dist/components/Sheet/Sheet.css.js.map +1 -0
- package/dist/components/Sheet/Sheet.d.ts +14 -0
- package/dist/components/Sheet/Sheet.js +14 -0
- package/dist/components/Sheet/Sheet.js.map +1 -0
- package/dist/components/Sheet/SheetActions.d.ts +7 -0
- package/dist/components/Sheet/SheetActions.js +14 -0
- package/dist/components/Sheet/SheetActions.js.map +1 -0
- package/dist/components/Sheet/SheetBody.d.ts +11 -0
- package/dist/components/Sheet/SheetBody.js +20 -0
- package/dist/components/Sheet/SheetBody.js.map +1 -0
- package/dist/components/Sheet/SheetHeader.d.ts +17 -0
- package/dist/components/Sheet/SheetHeader.js +44 -0
- package/dist/components/Sheet/SheetHeader.js.map +1 -0
- package/dist/components/Sheet/SheetRoot.d.ts +9 -0
- package/dist/components/Sheet/SheetRoot.js +16 -0
- package/dist/components/Sheet/SheetRoot.js.map +1 -0
- package/dist/components/Sheet/index.d.ts +4 -0
- package/dist/components/SheetOverlay/SheetOverlay.css.d.ts +3 -0
- package/dist/components/SheetOverlay/SheetOverlay.css.js +8 -0
- package/dist/components/SheetOverlay/SheetOverlay.css.js.map +1 -0
- package/dist/components/SheetOverlay/SheetOverlay.d.ts +24 -0
- package/dist/components/SheetOverlay/SheetOverlay.js +28 -0
- package/dist/components/SheetOverlay/SheetOverlay.js.map +1 -0
- package/dist/components/SheetOverlay/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.css.d.ts +22 -0
- package/dist/components/Spinner/Spinner.css.js +25 -0
- package/dist/components/Spinner/Spinner.css.js.map +1 -0
- package/dist/components/Spinner/Spinner.d.ts +19 -0
- package/dist/components/Spinner/Spinner.js +24 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Survey/SurveyRating/SurveyRating.css.d.ts +3 -0
- package/dist/components/Survey/SurveyRating/SurveyRating.css.js +7 -0
- package/dist/components/Survey/SurveyRating/SurveyRating.css.js.map +1 -0
- package/dist/components/Survey/SurveyRating/SurveyRating.d.ts +39 -0
- package/dist/components/Survey/SurveyRating/SurveyRating.js +51 -0
- package/dist/components/Survey/SurveyRating/SurveyRating.js.map +1 -0
- package/dist/components/Survey/SurveyRating/index.d.ts +1 -0
- package/dist/components/Survey/SurveySelect/SurveySelect.css.d.ts +1 -0
- package/dist/components/Survey/SurveySelect/SurveySelect.css.js +7 -0
- package/dist/components/Survey/SurveySelect/SurveySelect.css.js.map +1 -0
- package/dist/components/Survey/SurveySelect/SurveySelect.d.ts +40 -0
- package/dist/components/Survey/SurveySelect/SurveySelect.js +38 -0
- package/dist/components/Survey/SurveySelect/SurveySelect.js.map +1 -0
- package/dist/components/Survey/SurveySelect/index.d.ts +1 -0
- package/dist/components/Survey/index.d.ts +2 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.css.d.ts +6 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.css.js +7 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.css.js.map +1 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.d.ts +36 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.js +44 -0
- package/dist/components/ThinkingShimmer/ThinkingShimmer.js.map +1 -0
- package/dist/components/ThinkingShimmer/index.d.ts +2 -0
- package/dist/components/ToastNotification/ToastNotification.css.d.ts +30 -0
- package/dist/components/ToastNotification/ToastNotification.css.js +25 -0
- package/dist/components/ToastNotification/ToastNotification.css.js.map +1 -0
- package/dist/components/ToastNotification/ToastNotification.d.ts +36 -0
- package/dist/components/ToastNotification/ToastNotification.js +31 -0
- package/dist/components/ToastNotification/ToastNotification.js.map +1 -0
- package/dist/components/ToastNotification/index.d.ts +2 -0
- package/dist/components/Toggle/Toggle.css.d.ts +14 -0
- package/dist/components/Toggle/Toggle.css.js +7 -0
- package/dist/components/Toggle/Toggle.css.js.map +1 -0
- package/dist/components/Toggle/Toggle.d.ts +18 -0
- package/dist/components/Toggle/Toggle.js +19 -0
- package/dist/components/Toggle/Toggle.js.map +1 -0
- package/dist/components/Toggle/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.css.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.css.js +7 -0
- package/dist/components/Tooltip/Tooltip.css.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +19 -0
- package/dist/components/Tooltip/Tooltip.js +32 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/TypingIndicator/TypingIndicator.css.d.ts +3 -0
- package/dist/components/TypingIndicator/TypingIndicator.css.js +7 -0
- package/dist/components/TypingIndicator/TypingIndicator.css.js.map +1 -0
- package/dist/components/TypingIndicator/TypingIndicator.d.ts +27 -0
- package/dist/components/TypingIndicator/TypingIndicator.js +34 -0
- package/dist/components/TypingIndicator/TypingIndicator.js.map +1 -0
- package/dist/components/TypingIndicator/index.d.ts +2 -0
- package/dist/components/UserMessage/UserMessage.css.d.ts +7 -0
- package/dist/components/UserMessage/UserMessage.css.js +7 -0
- package/dist/components/UserMessage/UserMessage.css.js.map +1 -0
- package/dist/components/UserMessage/UserMessage.d.ts +22 -0
- package/dist/components/UserMessage/UserMessage.js +45 -0
- package/dist/components/UserMessage/UserMessage.js.map +1 -0
- package/dist/components/UserMessage/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +3 -0
- package/dist/hooks/usePrefersReducedMotion.js +20 -0
- package/dist/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/hooks/useSubmitOnEnter.d.ts +7 -0
- package/dist/hooks/useSubmitOnEnter.js +11 -0
- package/dist/hooks/useSubmitOnEnter.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +75 -0
- package/dist/runtime/LovelaceProvider.d.ts +24 -0
- package/dist/runtime/LovelaceProvider.js +45 -0
- package/dist/runtime/LovelaceProvider.js.map +1 -0
- package/dist/runtime/branding.d.ts +133 -0
- package/dist/runtime/branding.js +92 -0
- package/dist/runtime/branding.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/style.css +2 -0
- package/dist/tokens/generated/tokens.d.ts +4 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +2 -0
- package/dist/tokens/tokens.d.ts +8 -0
- package/dist/tokens/tokens.js +6 -0
- package/dist/tokens/tokens.js.map +1 -0
- package/dist/tokens.css +316 -0
- package/dist/utils/cx.d.ts +2 -0
- package/dist/utils/cx.js +6 -0
- package/dist/utils/cx.js.map +1 -0
- package/dist/vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js +80 -0
- package/dist/vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode, Ref } from "react";
|
|
2
|
+
export interface UserMessageProps {
|
|
3
|
+
/** The message text the customer sent. One message per bubble. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Localized failed-to-send copy. When set, reveals the retry affordance
|
|
7
|
+
* below the bubble and is its accessible name; pair it with `onRetry` so the
|
|
8
|
+
* retry actually resends. Absent means the message sent successfully.
|
|
9
|
+
*/
|
|
10
|
+
error?: string;
|
|
11
|
+
/** Invoked when the retry affordance is activated (click / Enter / Space). */
|
|
12
|
+
onRetry?: () => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
ref?: Ref<HTMLDivElement>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The customer's outbound chat message bubble — accent background, aligned to the
|
|
19
|
+
* trailing edge. Mirrors automatically under `dir="rtl"` via logical properties.
|
|
20
|
+
* Pair with the agent/bot message component for replies.
|
|
21
|
+
*/
|
|
22
|
+
export declare function UserMessage({ children, error, onRetry, className, ...rest }: UserMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cx as e } from "../../utils/cx.js";
|
|
2
|
+
import { ExclamationSync as t } from "../Icon/icons/ExclamationSync.js";
|
|
3
|
+
import { userMessageBubble as n, userMessageRoot as r, userMessageText as i } from "./UserMessage.css.js";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import { Button as s } from "react-aria-components";
|
|
6
|
+
//#region src/components/UserMessage/UserMessage.tsx
|
|
7
|
+
function c({ children: c, error: l, onRetry: u, className: d, ...f }) {
|
|
8
|
+
return /* @__PURE__ */ o("div", {
|
|
9
|
+
...f,
|
|
10
|
+
"data-error": l ? !0 : void 0,
|
|
11
|
+
className: e(r, d),
|
|
12
|
+
children: [/* @__PURE__ */ a("div", {
|
|
13
|
+
className: n,
|
|
14
|
+
children: /* @__PURE__ */ a("p", {
|
|
15
|
+
dir: "auto",
|
|
16
|
+
className: i,
|
|
17
|
+
children: c
|
|
18
|
+
})
|
|
19
|
+
}), l && /* @__PURE__ */ a("div", {
|
|
20
|
+
role: "alert",
|
|
21
|
+
"aria-live": "assertive",
|
|
22
|
+
className: "jxp4or3",
|
|
23
|
+
children: u ? /* @__PURE__ */ o(s, {
|
|
24
|
+
className: "jxp4or5 jxp4or4",
|
|
25
|
+
onPress: u,
|
|
26
|
+
children: [/* @__PURE__ */ a(t, {}), /* @__PURE__ */ a("span", {
|
|
27
|
+
dir: "auto",
|
|
28
|
+
className: "jxp4or6",
|
|
29
|
+
children: l
|
|
30
|
+
})]
|
|
31
|
+
}) : /* @__PURE__ */ a("span", {
|
|
32
|
+
className: "jxp4or4",
|
|
33
|
+
children: /* @__PURE__ */ a("span", {
|
|
34
|
+
dir: "auto",
|
|
35
|
+
className: "jxp4or6",
|
|
36
|
+
children: l
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { c as UserMessage };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=UserMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserMessage.js","names":[],"sources":["../../../src/components/UserMessage/UserMessage.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { Button as AriaButton } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { ExclamationSync } from \"../Icon/icons/index.js\";\nimport {\n\tuserMessageBubble,\n\tuserMessageError,\n\tuserMessageErrorContent,\n\tuserMessageErrorText,\n\tuserMessageRetry,\n\tuserMessageRoot,\n\tuserMessageText,\n} from \"./UserMessage.css.js\";\n\nexport interface UserMessageProps {\n\t/** The message text the customer sent. One message per bubble. */\n\tchildren: ReactNode;\n\t/**\n\t * Localized failed-to-send copy. When set, reveals the retry affordance\n\t * below the bubble and is its accessible name; pair it with `onRetry` so the\n\t * retry actually resends. Absent means the message sent successfully.\n\t */\n\terror?: string;\n\t/** Invoked when the retry affordance is activated (click / Enter / Space). */\n\tonRetry?: () => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\n/**\n * The customer's outbound chat message bubble — accent background, aligned to the\n * trailing edge. Mirrors automatically under `dir=\"rtl\"` via logical properties.\n * Pair with the agent/bot message component for replies.\n */\nexport function UserMessage({\n\tchildren,\n\terror,\n\tonRetry,\n\tclassName,\n\t...rest\n}: UserMessageProps) {\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-error={error ? true : undefined}\n\t\t\tclassName={cx(userMessageRoot, className)}\n\t\t>\n\t\t\t<div className={userMessageBubble}>\n\t\t\t\t<p dir=\"auto\" className={userMessageText}>\n\t\t\t\t\t{children}\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t{error && (\n\t\t\t\t// Per-message assertive region (unlike AgentMessage's transcript-level\n\t\t\t\t// log): the failure surfaces after mount, so empty→populated announces\n\t\t\t\t// reliably. Assertive because a failed send needs prompt attention.\n\t\t\t\t// Without `onRetry` there's nothing to retry, so the copy is rendered\n\t\t\t\t// as static text rather than a control that does nothing.\n\t\t\t\t<div role=\"alert\" aria-live=\"assertive\" className={userMessageError}>\n\t\t\t\t\t{onRetry ? (\n\t\t\t\t\t\t<AriaButton className={userMessageRetry} onPress={onRetry}>\n\t\t\t\t\t\t\t<ExclamationSync />\n\t\t\t\t\t\t\t<span dir=\"auto\" className={userMessageErrorText}>\n\t\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</AriaButton>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className={userMessageErrorContent}>\n\t\t\t\t\t\t\t<span dir=\"auto\" className={userMessageErrorText}>\n\t\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAmCA,SAAgB,EAAY,EAC3B,aACA,UACA,YACA,cACA,GAAG,KACiB;AACpB,QACC,kBAAC,OAAD;EACC,GAAI;EACJ,cAAY,IAAQ,KAAO,KAAA;EAC3B,WAAW,EAAG,GAAiB,EAAU;YAH1C,CAKC,kBAAC,OAAD;GAAK,WAAW;aACf,kBAAC,KAAD;IAAG,KAAI;IAAO,WAAW;IACvB;IACE,CAAA;GACC,CAAA,EACL,KAMA,kBAAC,OAAD;GAAK,MAAK;GAAQ,aAAU;GAAY,WAAA;aACtC,IACA,kBAAC,GAAD;IAAY,WAAA;IAA6B,SAAS;cAAlD,CACC,kBAAC,GAAD,EAAmB,CAAA,EACnB,kBAAC,QAAD;KAAM,KAAI;KAAO,WAAA;eACf;KACK,CAAA,CACK;QAEb,kBAAC,QAAD;IAAM,WAAA;cACL,kBAAC,QAAD;KAAM,KAAI;KAAO,WAAA;eACf;KACK,CAAA;IACD,CAAA;GAEH,CAAA,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserMessage, type UserMessageProps } from "./UserMessage.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
//#region src/hooks/usePrefersReducedMotion.ts
|
|
3
|
+
var n = "(prefers-reduced-motion: reduce)";
|
|
4
|
+
function r() {
|
|
5
|
+
return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia(n).matches;
|
|
6
|
+
}
|
|
7
|
+
function i() {
|
|
8
|
+
let [i, a] = t(r);
|
|
9
|
+
return e(() => {
|
|
10
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
11
|
+
let e = window.matchMedia(n);
|
|
12
|
+
a(e.matches);
|
|
13
|
+
let t = (e) => a(e.matches);
|
|
14
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
15
|
+
}, []), i;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as readPrefersReducedMotion, i as usePrefersReducedMotion };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=usePrefersReducedMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrefersReducedMotion.js","names":[],"sources":["../../src/hooks/usePrefersReducedMotion.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nconst REDUCED_MOTION_QUERY = \"(prefers-reduced-motion: reduce)\";\n\nexport function readPrefersReducedMotion(): boolean {\n\tif (\n\t\ttypeof window === \"undefined\" ||\n\t\ttypeof window.matchMedia !== \"function\"\n\t) {\n\t\treturn false;\n\t}\n\treturn window.matchMedia(REDUCED_MOTION_QUERY).matches;\n}\n\n/** Tracks the user's `prefers-reduced-motion` setting, updating on change. */\nexport function usePrefersReducedMotion(): boolean {\n\tconst [reduced, setReduced] = useState(readPrefersReducedMotion);\n\n\tuseEffect(() => {\n\t\tif (\n\t\t\ttypeof window === \"undefined\" ||\n\t\t\ttypeof window.matchMedia !== \"function\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst mql = window.matchMedia(REDUCED_MOTION_QUERY);\n\t\tsetReduced(mql.matches);\n\t\tconst listener = (e: MediaQueryListEvent) => setReduced(e.matches);\n\t\tmql.addEventListener(\"change\", listener);\n\t\treturn () => mql.removeEventListener(\"change\", listener);\n\t}, []);\n\n\treturn reduced;\n}\n"],"mappings":";;AAEA,IAAM,IAAuB;AAE7B,SAAgB,IAAoC;AAOnD,QALC,OAAO,SAAW,OAClB,OAAO,OAAO,cAAe,aAEtB,KAED,OAAO,WAAW,EAAqB,CAAC;;AAIhD,SAAgB,IAAmC;CAClD,IAAM,CAAC,GAAS,KAAc,EAAS,EAAyB;AAgBhE,QAdA,QAAgB;AACf,MACC,OAAO,SAAW,OAClB,OAAO,OAAO,cAAe,WAE7B;EAED,IAAM,IAAM,OAAO,WAAW,EAAqB;AACnD,IAAW,EAAI,QAAQ;EACvB,IAAM,KAAY,MAA2B,EAAW,EAAE,QAAQ;AAElE,SADA,EAAI,iBAAiB,UAAU,EAAS,QAC3B,EAAI,oBAAoB,UAAU,EAAS;IACtD,EAAE,CAAC,EAEC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { KeyboardEvent } from "react";
|
|
2
|
+
/** Returns an `onKeyDown` handler that calls `onSubmit` when Enter is pressed
|
|
3
|
+
* without Shift — the standard chat-composer key handling. Shift+Enter falls
|
|
4
|
+
* through so the field inserts a newline. Guards against IME composition:
|
|
5
|
+
* pressing Enter to confirm a candidate (e.g. Japanese/Chinese input) must not
|
|
6
|
+
* submit, so composition keystrokes are ignored. */
|
|
7
|
+
export declare function useSubmitOnEnter<T extends HTMLElement = HTMLTextAreaElement>(onSubmit: () => void): (event: KeyboardEvent<T>) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
//#region src/hooks/useSubmitOnEnter.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
return e((e) => {
|
|
5
|
+
e.key !== "Enter" || e.shiftKey || e.nativeEvent.isComposing || (e.preventDefault(), t());
|
|
6
|
+
}, [t]);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as useSubmitOnEnter };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=useSubmitOnEnter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSubmitOnEnter.js","names":[],"sources":["../../src/hooks/useSubmitOnEnter.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport { useCallback } from \"react\";\n\n/** Returns an `onKeyDown` handler that calls `onSubmit` when Enter is pressed\n * without Shift — the standard chat-composer key handling. Shift+Enter falls\n * through so the field inserts a newline. Guards against IME composition:\n * pressing Enter to confirm a candidate (e.g. Japanese/Chinese input) must not\n * submit, so composition keystrokes are ignored. */\nexport function useSubmitOnEnter<T extends HTMLElement = HTMLTextAreaElement>(\n\tonSubmit: () => void,\n) {\n\treturn useCallback(\n\t\t(event: KeyboardEvent<T>) => {\n\t\t\tif (event.key !== \"Enter\" || event.shiftKey) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Enter confirms an IME candidate rather than sending — never submit mid-composition.\n\t\t\tif (event.nativeEvent.isComposing) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tonSubmit();\n\t\t},\n\t\t[onSubmit],\n\t);\n}\n"],"mappings":";;AAQA,SAAgB,EACf,GACC;AACD,QAAO,GACL,MAA4B;AACxB,IAAM,QAAQ,WAAW,EAAM,YAI/B,EAAM,YAAY,gBAGtB,EAAM,gBAAgB,EACtB,GAAU;IAEX,CAAC,EAAS,CACV"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from "./components/AgentMessage/index.js";
|
|
2
|
+
export * from "./components/Avatar/index.js";
|
|
3
|
+
export * from "./components/BubbleOverlay/index.js";
|
|
4
|
+
export * from "./components/Button/index.js";
|
|
5
|
+
export * from "./components/Checkbox/index.js";
|
|
6
|
+
export * from "./components/Chip/index.js";
|
|
7
|
+
export * from "./components/Dialog/index.js";
|
|
8
|
+
export * from "./components/DialogOverlay/index.js";
|
|
9
|
+
export * from "./components/Divider/index.js";
|
|
10
|
+
export * from "./components/FullscreenOverlay/index.js";
|
|
11
|
+
export * from "./components/Header/index.js";
|
|
12
|
+
export * from "./components/Icon/index.js";
|
|
13
|
+
export * from "./components/IconButton/index.js";
|
|
14
|
+
export * from "./components/Image/index.js";
|
|
15
|
+
export * from "./components/Input/index.js";
|
|
16
|
+
export * from "./components/Link/index.js";
|
|
17
|
+
export * from "./components/MenuItem/index.js";
|
|
18
|
+
export * from "./components/PictureMessage/index.js";
|
|
19
|
+
export * from "./components/PillButton/index.js";
|
|
20
|
+
export * from "./components/ProactiveMessage/index.js";
|
|
21
|
+
export * from "./components/Radio/index.js";
|
|
22
|
+
export * from "./components/ScrollMarker/index.js";
|
|
23
|
+
export * from "./components/Sheet/index.js";
|
|
24
|
+
export * from "./components/SheetOverlay/index.js";
|
|
25
|
+
export * from "./components/Spinner/index.js";
|
|
26
|
+
export * from "./components/Survey/index.js";
|
|
27
|
+
export * from "./components/ThinkingShimmer/index.js";
|
|
28
|
+
export * from "./components/ToastNotification/index.js";
|
|
29
|
+
export * from "./components/Toggle/index.js";
|
|
30
|
+
export * from "./components/Tooltip/index.js";
|
|
31
|
+
export * from "./components/TypingIndicator/index.js";
|
|
32
|
+
export * from "./components/UserMessage/index.js";
|
|
33
|
+
export * from "./hooks/index.js";
|
|
34
|
+
export * from "./runtime/index.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AvatarPlaceholder as e } from "./components/Avatar/AvatarPlaceholder.js";
|
|
2
|
+
import { Avatar as t } from "./components/Avatar/Avatar.js";
|
|
3
|
+
import { AgentMessage as n } from "./components/AgentMessage/AgentMessage.js";
|
|
4
|
+
import { BubbleOverlay as r } from "./components/BubbleOverlay/BubbleOverlay.js";
|
|
5
|
+
import { Button as i } from "./components/Button/Button.js";
|
|
6
|
+
import { Checkbox as a } from "./components/Checkbox/Checkbox.js";
|
|
7
|
+
import { Chip as o } from "./components/Chip/Chip.js";
|
|
8
|
+
import { Icon as s } from "./components/Icon/Icon.js";
|
|
9
|
+
import { Checkmark as c } from "./components/Icon/icons/Checkmark.js";
|
|
10
|
+
import { ExclamationTriangle as l } from "./components/Icon/icons/ExclamationTriangle.js";
|
|
11
|
+
import { Dialog as u } from "./components/Dialog/Dialog.js";
|
|
12
|
+
import { DialogOverlay as d } from "./components/DialogOverlay/DialogOverlay.js";
|
|
13
|
+
import { Divider as f } from "./components/Divider/Divider.js";
|
|
14
|
+
import { FullscreenOverlay as p } from "./components/FullscreenOverlay/FullscreenOverlay.js";
|
|
15
|
+
import { Header as m } from "./components/Header/Header.js";
|
|
16
|
+
import { AdaLogo as h } from "./components/Icon/icons/AdaLogo.js";
|
|
17
|
+
import { ArrowDown as g } from "./components/Icon/icons/ArrowDown.js";
|
|
18
|
+
import { ArrowLeft as _ } from "./components/Icon/icons/ArrowLeft.js";
|
|
19
|
+
import { ArrowNortheast as v } from "./components/Icon/icons/ArrowNortheast.js";
|
|
20
|
+
import { ArrowNorthwest as y } from "./components/Icon/icons/ArrowNorthwest.js";
|
|
21
|
+
import { ArrowRight as b } from "./components/Icon/icons/ArrowRight.js";
|
|
22
|
+
import { Bell as x } from "./components/Icon/icons/Bell.js";
|
|
23
|
+
import { BellSlash as S } from "./components/Icon/icons/BellSlash.js";
|
|
24
|
+
import { ChevronLeft as C } from "./components/Icon/icons/ChevronLeft.js";
|
|
25
|
+
import { ChevronRight as w } from "./components/Icon/icons/ChevronRight.js";
|
|
26
|
+
import { CloudUpload as T } from "./components/Icon/icons/CloudUpload.js";
|
|
27
|
+
import { Download as E } from "./components/Icon/icons/Download.js";
|
|
28
|
+
import { Ellipses as D } from "./components/Icon/icons/Ellipses.js";
|
|
29
|
+
import { Email as O } from "./components/Icon/icons/Email.js";
|
|
30
|
+
import { ExclamationSync as k } from "./components/Icon/icons/ExclamationSync.js";
|
|
31
|
+
import { Eye as A } from "./components/Icon/icons/Eye.js";
|
|
32
|
+
import { EyeSlash as j } from "./components/Icon/icons/EyeSlash.js";
|
|
33
|
+
import { Language as M } from "./components/Icon/icons/Language.js";
|
|
34
|
+
import { MediaSlash as N } from "./components/Icon/icons/MediaSlash.js";
|
|
35
|
+
import { MessagingFill as P } from "./components/Icon/icons/MessagingFill.js";
|
|
36
|
+
import { Minimize as F } from "./components/Icon/icons/Minimize.js";
|
|
37
|
+
import { Mute as I } from "./components/Icon/icons/Mute.js";
|
|
38
|
+
import { Paperclip as L } from "./components/Icon/icons/Paperclip.js";
|
|
39
|
+
import { PersonFill as R } from "./components/Icon/icons/PersonFill.js";
|
|
40
|
+
import { PlayFill as z } from "./components/Icon/icons/PlayFill.js";
|
|
41
|
+
import { SendFill as B } from "./components/Icon/icons/SendFill.js";
|
|
42
|
+
import { StarBadgeFill as V } from "./components/Icon/icons/StarBadgeFill.js";
|
|
43
|
+
import { ThumbsDown as H } from "./components/Icon/icons/ThumbsDown.js";
|
|
44
|
+
import { ThumbsUp as U } from "./components/Icon/icons/ThumbsUp.js";
|
|
45
|
+
import { Volume as W } from "./components/Icon/icons/Volume.js";
|
|
46
|
+
import { Xmark as G } from "./components/Icon/icons/Xmark.js";
|
|
47
|
+
import { XmarkCircle as K } from "./components/Icon/icons/XmarkCircle.js";
|
|
48
|
+
import { IconButton as q } from "./components/IconButton/IconButton.js";
|
|
49
|
+
import { Image as J } from "./components/Image/Image.js";
|
|
50
|
+
import { Input as Y } from "./components/Input/Input.js";
|
|
51
|
+
import { Link as X } from "./components/Link/Link.js";
|
|
52
|
+
import { Menu as Z } from "./components/MenuItem/Menu.js";
|
|
53
|
+
import { MenuItem as Q } from "./components/MenuItem/MenuItem.js";
|
|
54
|
+
import { PictureMessage as $ } from "./components/PictureMessage/PictureMessage.js";
|
|
55
|
+
import { PillButton as ee } from "./components/PillButton/PillButton.js";
|
|
56
|
+
import { ProactiveMessage as te } from "./components/ProactiveMessage/ProactiveMessage.js";
|
|
57
|
+
import { Radio as ne } from "./components/Radio/Radio.js";
|
|
58
|
+
import { RadioGroup as re } from "./components/Radio/RadioGroup.js";
|
|
59
|
+
import { ScrollMarker as ie } from "./components/ScrollMarker/ScrollMarker.js";
|
|
60
|
+
import { Sheet as ae } from "./components/Sheet/Sheet.js";
|
|
61
|
+
import { SheetOverlay as oe } from "./components/SheetOverlay/SheetOverlay.js";
|
|
62
|
+
import { readPrefersReducedMotion as se, usePrefersReducedMotion as ce } from "./hooks/usePrefersReducedMotion.js";
|
|
63
|
+
import { useSubmitOnEnter as le } from "./hooks/useSubmitOnEnter.js";
|
|
64
|
+
import { Spinner as ue } from "./components/Spinner/Spinner.js";
|
|
65
|
+
import { SurveyRating as de } from "./components/Survey/SurveyRating/SurveyRating.js";
|
|
66
|
+
import { SurveySelect as fe } from "./components/Survey/SurveySelect/SurveySelect.js";
|
|
67
|
+
import { ThinkingShimmer as pe } from "./components/ThinkingShimmer/ThinkingShimmer.js";
|
|
68
|
+
import { ToastNotification as me } from "./components/ToastNotification/ToastNotification.js";
|
|
69
|
+
import { Toggle as he } from "./components/Toggle/Toggle.js";
|
|
70
|
+
import { Tooltip as ge, TooltipTrigger as _e } from "./components/Tooltip/Tooltip.js";
|
|
71
|
+
import { TypingIndicator as ve } from "./components/TypingIndicator/TypingIndicator.js";
|
|
72
|
+
import { UserMessage as ye } from "./components/UserMessage/UserMessage.js";
|
|
73
|
+
import { LOVELACE_SURFACES as be, contrastRatioBetween as xe, createBrandOverrides as Se, isLegibleAgainst as Ce, isLegibleOnSurface as we, readableTextOnAccent as Te } from "./runtime/branding.js";
|
|
74
|
+
import { LovelaceProvider as Ee, useResolvedTheme as De } from "./runtime/LovelaceProvider.js";
|
|
75
|
+
export { h as AdaLogo, n as AgentMessage, g as ArrowDown, _ as ArrowLeft, v as ArrowNortheast, y as ArrowNorthwest, b as ArrowRight, t as Avatar, e as AvatarPlaceholder, x as Bell, S as BellSlash, r as BubbleOverlay, i as Button, a as Checkbox, c as Checkmark, C as ChevronLeft, w as ChevronRight, o as Chip, T as CloudUpload, u as Dialog, d as DialogOverlay, f as Divider, E as Download, D as Ellipses, O as Email, k as ExclamationSync, l as ExclamationTriangle, A as Eye, j as EyeSlash, p as FullscreenOverlay, m as Header, s as Icon, q as IconButton, J as Image, Y as Input, be as LOVELACE_SURFACES, M as Language, X as Link, Ee as LovelaceProvider, N as MediaSlash, Z as Menu, Q as MenuItem, P as MessagingFill, F as Minimize, I as Mute, L as Paperclip, R as PersonFill, $ as PictureMessage, ee as PillButton, z as PlayFill, te as ProactiveMessage, ne as Radio, re as RadioGroup, ie as ScrollMarker, B as SendFill, ae as Sheet, oe as SheetOverlay, ue as Spinner, V as StarBadgeFill, de as SurveyRating, fe as SurveySelect, pe as ThinkingShimmer, H as ThumbsDown, U as ThumbsUp, me as ToastNotification, he as Toggle, ge as Tooltip, _e as TooltipTrigger, ve as TypingIndicator, ye as UserMessage, W as Volume, G as Xmark, K as XmarkCircle, xe as contrastRatioBetween, Se as createBrandOverrides, Ce as isLegibleAgainst, we as isLegibleOnSurface, se as readPrefersReducedMotion, Te as readableTextOnAccent, ce as usePrefersReducedMotion, De as useResolvedTheme, le as useSubmitOnEnter };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { LovelaceOverridableToken } from "../tokens/tokens.js";
|
|
3
|
+
export type LovelaceTheme = "light" | "dark" | "auto";
|
|
4
|
+
export interface LovelaceProviderProps {
|
|
5
|
+
/** Color scheme. `auto` resolves via `prefers-color-scheme`. Defaults to `auto`. */
|
|
6
|
+
theme?: LovelaceTheme;
|
|
7
|
+
/**
|
|
8
|
+
* Type-safe token overrides applied to the provider root and cascaded to every
|
|
9
|
+
* Lovelace component inside. Keys are overridable (semantic / component) tokens;
|
|
10
|
+
* values are CSS values — typically a primitive reference via `t()` (e.g.
|
|
11
|
+
* `{ "font-size-body": t("font-size-14") }`) or a raw color.
|
|
12
|
+
*/
|
|
13
|
+
override?: Partial<Record<LovelaceOverridableToken, string>>;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves `auto` against `prefers-color-scheme`, updating live. Exported so a
|
|
18
|
+
* consumer deciding something per-surface (e.g. a contrast guard on a token
|
|
19
|
+
* override) resolves the scheme through the same code path that stamps
|
|
20
|
+
* `data-theme` — two independent media queries would disagree wherever
|
|
21
|
+
* `matchMedia` is unavailable, since each falls back to light on its own.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useResolvedTheme(theme: LovelaceTheme): "light" | "dark";
|
|
24
|
+
export declare function LovelaceProvider({ theme, override, children, }: LovelaceProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { tokenName as e } from "../tokens/tokens.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { UNSAFE_PortalProvider as n } from "react-aria";
|
|
4
|
+
import { useEffect as r, useMemo as i, useState as a } from "react";
|
|
5
|
+
//#region src/runtime/LovelaceProvider.tsx
|
|
6
|
+
var o = "(prefers-color-scheme: dark)";
|
|
7
|
+
function s() {
|
|
8
|
+
return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia(o).matches;
|
|
9
|
+
}
|
|
10
|
+
function c(e) {
|
|
11
|
+
let [t, n] = a(() => e === "auto" ? s() ? "dark" : "light" : e);
|
|
12
|
+
return r(() => {
|
|
13
|
+
if (e !== "auto") {
|
|
14
|
+
n(e);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
18
|
+
let t = window.matchMedia(o), r = (e) => {
|
|
19
|
+
n(e ? "dark" : "light");
|
|
20
|
+
};
|
|
21
|
+
r(t.matches);
|
|
22
|
+
let i = (e) => r(e.matches);
|
|
23
|
+
return t.addEventListener("change", i), () => t.removeEventListener("change", i);
|
|
24
|
+
}, [e]), t;
|
|
25
|
+
}
|
|
26
|
+
function l({ theme: r = "auto", override: o, children: s }) {
|
|
27
|
+
let l = c(r), [u, d] = a(null), f = i(() => {
|
|
28
|
+
let t = { display: "contents" };
|
|
29
|
+
for (let [n, r] of Object.entries(o ?? {})) r != null && (t[e(n)] = r);
|
|
30
|
+
return t;
|
|
31
|
+
}, [o]);
|
|
32
|
+
return /* @__PURE__ */ t("div", {
|
|
33
|
+
ref: d,
|
|
34
|
+
"data-theme": l,
|
|
35
|
+
style: f,
|
|
36
|
+
children: u != null && /* @__PURE__ */ t(n, {
|
|
37
|
+
getContainer: () => u,
|
|
38
|
+
children: s
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { l as LovelaceProvider, c as useResolvedTheme };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=LovelaceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LovelaceProvider.js","names":[],"sources":["../../src/runtime/LovelaceProvider.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { UNSAFE_PortalProvider } from \"react-aria\";\nimport type { LovelaceOverridableToken } from \"../tokens/tokens.js\";\nimport { tokenName } from \"../tokens/tokens.js\";\n\nexport type LovelaceTheme = \"light\" | \"dark\" | \"auto\";\n\nexport interface LovelaceProviderProps {\n\t/** Color scheme. `auto` resolves via `prefers-color-scheme`. Defaults to `auto`. */\n\ttheme?: LovelaceTheme;\n\t/**\n\t * Type-safe token overrides applied to the provider root and cascaded to every\n\t * Lovelace component inside. Keys are overridable (semantic / component) tokens;\n\t * values are CSS values — typically a primitive reference via `t()` (e.g.\n\t * `{ \"font-size-body\": t(\"font-size-14\") }`) or a raw color.\n\t */\n\toverride?: Partial<Record<LovelaceOverridableToken, string>>;\n\tchildren?: ReactNode;\n}\n\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\nfunction readPrefersDark(): boolean {\n\tif (\n\t\ttypeof window === \"undefined\" ||\n\t\ttypeof window.matchMedia !== \"function\"\n\t) {\n\t\treturn false;\n\t}\n\treturn window.matchMedia(DARK_QUERY).matches;\n}\n\n/**\n * Resolves `auto` against `prefers-color-scheme`, updating live. Exported so a\n * consumer deciding something per-surface (e.g. a contrast guard on a token\n * override) resolves the scheme through the same code path that stamps\n * `data-theme` — two independent media queries would disagree wherever\n * `matchMedia` is unavailable, since each falls back to light on its own.\n */\nexport function useResolvedTheme(theme: LovelaceTheme): \"light\" | \"dark\" {\n\tconst [resolved, setResolved] = useState<\"light\" | \"dark\">(() => {\n\t\tif (theme !== \"auto\") {\n\t\t\treturn theme;\n\t\t}\n\t\treturn readPrefersDark() ? \"dark\" : \"light\";\n\t});\n\n\tuseEffect(() => {\n\t\tif (theme !== \"auto\") {\n\t\t\tsetResolved(theme);\n\t\t\treturn;\n\t\t}\n\t\tif (\n\t\t\ttypeof window === \"undefined\" ||\n\t\t\ttypeof window.matchMedia !== \"function\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst mql = window.matchMedia(DARK_QUERY);\n\t\tconst update = (matches: boolean) => {\n\t\t\tsetResolved(matches ? \"dark\" : \"light\");\n\t\t};\n\t\tupdate(mql.matches);\n\t\tconst listener = (e: MediaQueryListEvent) => update(e.matches);\n\t\tmql.addEventListener(\"change\", listener);\n\t\treturn () => mql.removeEventListener(\"change\", listener);\n\t}, [theme]);\n\n\treturn resolved;\n}\n\nexport function LovelaceProvider({\n\ttheme = \"auto\",\n\toverride,\n\tchildren,\n}: LovelaceProviderProps) {\n\tconst resolvedTheme = useResolvedTheme(theme);\n\t// Callback-ref into state (not useRef): attaching the element triggers a\n\t// re-render. Children are gated on it (below) so an overlay never mounts before\n\t// the themed portal container exists — a plain ref wouldn't re-render, and\n\t// deferring the portal to a second render would move an already-open overlay,\n\t// cancelling its entrance transition and stranding it at the `data-entering`\n\t// start state (opacity 0).\n\tconst [themeEl, setThemeEl] = useState<HTMLDivElement | null>(null);\n\n\tconst overrides = useMemo<CSSProperties>(() => {\n\t\t// `display: contents` removes this wrapper from layout so it doesn't\n\t\t// interfere with the parent's sizing — children render as if the wrapper\n\t\t// isn't there. Custom properties and data-attributes still cascade.\n\t\tconst vars: Record<string, string> = { display: \"contents\" };\n\t\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\t\tif (value != null) {\n\t\t\t\tvars[tokenName(name as LovelaceOverridableToken)] = value;\n\t\t\t}\n\t\t}\n\t\treturn vars as CSSProperties;\n\t}, [override]);\n\n\t// Component tokens are declared on `[data-theme]` (this wrapper) so their var()\n\t// chain re-evaluates in the active theme. React Aria overlays (Dialog/Sheet/\n\t// Tooltip) portal to `document.body` by default — outside this element — where\n\t// they'd lose those aliases. Default the portal container to the themed wrapper\n\t// so overlays stay inside the theme boundary; a consumer can still nest its own\n\t// `UNSAFE_PortalProvider` deeper to override (as the app scopes to the chat window).\n\t//\n\t// Children render only once `themeEl` is attached so any overlay open on first\n\t// mount portals straight into the themed container — never to `document.body`\n\t// and then moved (which would cancel its entrance transition). The callback ref's\n\t// setState runs in the commit phase (before paint), so the extra commit causes no\n\t// visible flash. It does mean an SSR render would emit an empty themed div until\n\t// hydration — fine today since every lovelace tree is client-mounted.\n\treturn (\n\t\t<div ref={setThemeEl} data-theme={resolvedTheme} style={overrides}>\n\t\t\t{themeEl != null && (\n\t\t\t\t<UNSAFE_PortalProvider getContainer={() => themeEl}>\n\t\t\t\t\t{children}\n\t\t\t\t</UNSAFE_PortalProvider>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AAqBA,IAAM,IAAa;AAEnB,SAAS,IAA2B;AAOnC,QALC,OAAO,SAAW,OAClB,OAAO,OAAO,cAAe,aAEtB,KAED,OAAO,WAAW,EAAW,CAAC;;AAUtC,SAAgB,EAAiB,GAAwC;CACxE,IAAM,CAAC,GAAU,KAAe,QAC3B,MAAU,SAGP,GAAiB,GAAG,SAAS,UAF5B,EAGP;AAuBF,QArBA,QAAgB;AACf,MAAI,MAAU,QAAQ;AACrB,KAAY,EAAM;AAClB;;AAED,MACC,OAAO,SAAW,OAClB,OAAO,OAAO,cAAe,WAE7B;EAED,IAAM,IAAM,OAAO,WAAW,EAAW,EACnC,KAAU,MAAqB;AACpC,KAAY,IAAU,SAAS,QAAQ;;AAExC,IAAO,EAAI,QAAQ;EACnB,IAAM,KAAY,MAA2B,EAAO,EAAE,QAAQ;AAE9D,SADA,EAAI,iBAAiB,UAAU,EAAS,QAC3B,EAAI,oBAAoB,UAAU,EAAS;IACtD,CAAC,EAAM,CAAC,EAEJ;;AAGR,SAAgB,EAAiB,EAChC,WAAQ,QACR,aACA,eACyB;CACzB,IAAM,IAAgB,EAAiB,EAAM,EAOvC,CAAC,GAAS,KAAc,EAAgC,KAAK,EAE7D,IAAY,QAA6B;EAI9C,IAAM,IAA+B,EAAE,SAAS,YAAY;AAC5D,OAAK,IAAM,CAAC,GAAM,MAAU,OAAO,QAAQ,KAAY,EAAE,CAAC,CACzD,CAAI,KAAS,SACZ,EAAK,EAAU,EAAiC,IAAI;AAGtD,SAAO;IACL,CAAC,EAAS,CAAC;AAed,QACC,kBAAC,OAAD;EAAK,KAAK;EAAY,cAAY;EAAe,OAAO;YACtD,KAAW,QACX,kBAAC,GAAD;GAAuB,oBAAoB;GACzC;GACsB,CAAA;EAEpB,CAAA"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How Ada applies a customer's brand colors — the canonical mapping from
|
|
3
|
+
* dashboard brand settings to Lovelace token overrides, plus the WCAG
|
|
4
|
+
* colorimetry that keeps the result legible.
|
|
5
|
+
*
|
|
6
|
+
* `createBrandOverrides` is the single source of truth: the embedded widget,
|
|
7
|
+
* the docs theme playground, and the theming documentation all describe the
|
|
8
|
+
* same function. The output is a plain token→value map intended for
|
|
9
|
+
* `<LovelaceProvider override={...}>`.
|
|
10
|
+
*/
|
|
11
|
+
import type { LovelaceOverridableToken } from "../tokens/tokens.js";
|
|
12
|
+
/** Token overrides consumable by `LovelaceProvider`'s `override` prop. */
|
|
13
|
+
export type BrandOverrides = Partial<Record<LovelaceOverridableToken, string>>;
|
|
14
|
+
/** Text-size preset. `default` keeps Lovelace's own type scale. */
|
|
15
|
+
export type BrandTextSize = "default" | "small" | "large";
|
|
16
|
+
/** Corner-style preset. `round` keeps Lovelace's own radii. */
|
|
17
|
+
export type BrandCornerStyle = "round" | "rectangular";
|
|
18
|
+
/**
|
|
19
|
+
* Customer brand settings, as configured in the Ada dashboard.
|
|
20
|
+
*
|
|
21
|
+
* Every field is optional: an absent (or `null`) value means "not configured"
|
|
22
|
+
* and contributes no overrides, so `createBrandOverrides({}, scheme)` is `{}`.
|
|
23
|
+
*/
|
|
24
|
+
export interface BrandSettings {
|
|
25
|
+
/**
|
|
26
|
+
* The brand accent color. Painted unconditionally as the accent fill
|
|
27
|
+
* (`color-background-accent`); used as accent *text* (`color-content-accent`)
|
|
28
|
+
* only when it reads against the rendered surface.
|
|
29
|
+
*/
|
|
30
|
+
tintColor?: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Advanced-colors override for text painted on the accent fill
|
|
33
|
+
* (`color-content-on-accent`). Ignored unless `advancedColorsEnabled`.
|
|
34
|
+
*/
|
|
35
|
+
textOverAccentColor?: string | null;
|
|
36
|
+
/** Gate for `textOverAccentColor` and `headerTextColor`. */
|
|
37
|
+
advancedColorsEnabled?: boolean;
|
|
38
|
+
/** Gate for `headerColor`/`headerTextColor`. */
|
|
39
|
+
headerColorEnabled?: boolean;
|
|
40
|
+
/** Header background (`header-background`). */
|
|
41
|
+
headerColor?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Header foreground (`header-content`). Ignored unless
|
|
44
|
+
* `advancedColorsEnabled`; repaired to black or white when it provably
|
|
45
|
+
* falls below the WCAG AA 4.5:1 floor against `headerColor`.
|
|
46
|
+
*/
|
|
47
|
+
headerTextColor?: string | null;
|
|
48
|
+
/** Type-scale preset. Defaults to `default`. */
|
|
49
|
+
textSize?: BrandTextSize;
|
|
50
|
+
/** Corner-radius preset. Defaults to `round`. */
|
|
51
|
+
cornerStyle?: BrandCornerStyle;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Lovelace's `color-background-default` per scheme (`tokens.css`). The surface
|
|
55
|
+
* every accent-as-text legibility judgement is made against.
|
|
56
|
+
*/
|
|
57
|
+
export declare const LOVELACE_SURFACES: {
|
|
58
|
+
readonly light: "#ffffff";
|
|
59
|
+
readonly dark: "#181a1e";
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* WCAG contrast ratio between two hex colors, or `null` when either cannot be parsed.
|
|
63
|
+
*
|
|
64
|
+
* Exported so a caller that needs a different floor than this module's 3:1 — an AA
|
|
65
|
+
* 4.5:1 check on the default palette, say — reuses this colorimetry instead of writing
|
|
66
|
+
* a second copy. Judging *which* colors to compare is still the caller's job.
|
|
67
|
+
*/
|
|
68
|
+
export declare function contrastRatioBetween(a: string, b: string): number | null;
|
|
69
|
+
/**
|
|
70
|
+
* Pick black or white for ordinary text painted on a customer-provided accent fill.
|
|
71
|
+
*
|
|
72
|
+
* One of the two always clears WCAG AA against a valid opaque hex color (their
|
|
73
|
+
* luminances sit at opposite ends of the scale). An unparseable color keeps the
|
|
74
|
+
* caller's existing fallback: CSS may understand a value this deliberately-small
|
|
75
|
+
* parser does not, and silently changing its text color without measuring it would
|
|
76
|
+
* only trade one unknown rendering for another.
|
|
77
|
+
*/
|
|
78
|
+
export declare function readableTextOnAccent(accent: string, fallback: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Whether `color` is safe to use as accent foreground on `surface`.
|
|
81
|
+
*
|
|
82
|
+
* Kept when it clears the floor, and also kept when it is merely below the floor but
|
|
83
|
+
* still no worse than `fallback` — the color withholding would leave in place — so the
|
|
84
|
+
* guard can never trade a tint for a *less* legible replacement. A value it cannot
|
|
85
|
+
* parse fails closed: an unreadable `surface` means the judgement cannot be made, and
|
|
86
|
+
* an unparseable `fallback` only forfeits that second chance.
|
|
87
|
+
*
|
|
88
|
+
* Both clauses are evaluated against `surface` and nothing else, so a caller that
|
|
89
|
+
* paints the tint over a *composite* of itself and the surface gets a verdict that
|
|
90
|
+
* overstates the real contrast — and can therefore keep a tint that is genuinely worse
|
|
91
|
+
* than the fallback it declined. `FileDropZone`'s 15% accent wash is the one such
|
|
92
|
+
* caller today; see the theming spec's auto-contrast row for the measured shortfall.
|
|
93
|
+
*/
|
|
94
|
+
export declare function isLegibleAgainst(color: string, surface: string, fallback: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether `color` is safe to use as accent text on `scheme`'s default Lovelace
|
|
97
|
+
* surface. The comparison fallback is `color-accent-500`, the value the token
|
|
98
|
+
* resolves to when the override is withheld.
|
|
99
|
+
*/
|
|
100
|
+
export declare function isLegibleOnSurface(color: string, scheme: "light" | "dark"): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Map customer brand settings to Lovelace token overrides — exactly how the Ada
|
|
103
|
+
* widget applies your brand colors. Feed the result to
|
|
104
|
+
* `<LovelaceProvider override={...}>`.
|
|
105
|
+
*
|
|
106
|
+
* `scheme` is the *resolved* light/dark surface being painted (resolve `auto`
|
|
107
|
+
* via `useResolvedTheme`), not the configured theme — the accent-text contrast
|
|
108
|
+
* decision has to be made against the surface the label actually lands on.
|
|
109
|
+
*
|
|
110
|
+
* The mapping, in order:
|
|
111
|
+
*
|
|
112
|
+
* 1. `cornerStyle` / `textSize` re-point radius and typography tokens at
|
|
113
|
+
* Lovelace primitives (`rectangular` flattens radii to 10px; `small`/`large`
|
|
114
|
+
* shift the four-step type scale down/up one step).
|
|
115
|
+
* 2. `tintColor` paints `color-background-accent` unconditionally, and
|
|
116
|
+
* `color-content-on-accent` becomes whichever of black or white contrasts
|
|
117
|
+
* more with the tint. The tint is also used as standalone accent *text*
|
|
118
|
+
* (`color-content-accent`) only when it reads on the rendered surface —
|
|
119
|
+
* a tint near that background would render the label invisible.
|
|
120
|
+
* 3. With `advancedColorsEnabled`, `textOverAccentColor` replaces the derived
|
|
121
|
+
* on-accent text color verbatim.
|
|
122
|
+
* 4. With `headerColorEnabled`, `headerColor` paints `header-background`.
|
|
123
|
+
* The header foreground is `headerTextColor` (advanced colors only),
|
|
124
|
+
* repaired to black or white when it measurably falls below the WCAG AA
|
|
125
|
+
* 4.5:1 floor against `headerColor`; without a configured foreground the
|
|
126
|
+
* maximum-contrast black or white is derived from the background.
|
|
127
|
+
*
|
|
128
|
+
* Legibility guards measure hex colors only. Values the hex parser cannot read
|
|
129
|
+
* (named colors, `rgba()`, `var()`, …) pass through unrepaired where they are
|
|
130
|
+
* kept at all: repairing what cannot be measured would trade one unknown
|
|
131
|
+
* rendering for another.
|
|
132
|
+
*/
|
|
133
|
+
export declare function createBrandOverrides(settings: BrandSettings, scheme: "light" | "dark"): BrandOverrides;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { t as e } from "../tokens/tokens.js";
|
|
2
|
+
//#region src/runtime/branding.ts
|
|
3
|
+
var t = {
|
|
4
|
+
light: "#ffffff",
|
|
5
|
+
dark: "#181a1e"
|
|
6
|
+
}, n = 3, r = 4.5, i = "#4e53d1";
|
|
7
|
+
function a(e) {
|
|
8
|
+
let t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
9
|
+
if (!t) return null;
|
|
10
|
+
let n = t[1], r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
11
|
+
return [
|
|
12
|
+
Number.parseInt(r.slice(0, 2), 16),
|
|
13
|
+
Number.parseInt(r.slice(2, 4), 16),
|
|
14
|
+
Number.parseInt(r.slice(4, 6), 16)
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
function o(e) {
|
|
18
|
+
let t = e / 255;
|
|
19
|
+
return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
20
|
+
}
|
|
21
|
+
function s([e, t, n]) {
|
|
22
|
+
return .2126 * o(e) + .7152 * o(t) + .0722 * o(n);
|
|
23
|
+
}
|
|
24
|
+
function c(e, t) {
|
|
25
|
+
let n = s(e), r = s(t);
|
|
26
|
+
return (Math.max(n, r) + .05) / (Math.min(n, r) + .05);
|
|
27
|
+
}
|
|
28
|
+
function l(e, t) {
|
|
29
|
+
let n = a(e), r = a(t);
|
|
30
|
+
return n && r ? c(n, r) : null;
|
|
31
|
+
}
|
|
32
|
+
function u(e, t) {
|
|
33
|
+
let n = l("#ffffff", e), r = l("#000000", e);
|
|
34
|
+
return n === null || r === null ? t : n >= r ? "#ffffff" : "#000000";
|
|
35
|
+
}
|
|
36
|
+
function d(e, t, r) {
|
|
37
|
+
let i = a(e), o = a(t);
|
|
38
|
+
if (!i || !o) return !1;
|
|
39
|
+
let s = c(i, o);
|
|
40
|
+
if (s >= n) return !0;
|
|
41
|
+
let l = a(r);
|
|
42
|
+
return l !== null && s >= c(l, o);
|
|
43
|
+
}
|
|
44
|
+
function f(e, n) {
|
|
45
|
+
return d(e, t[n], i);
|
|
46
|
+
}
|
|
47
|
+
function p(e, t) {
|
|
48
|
+
let n = l(e, t);
|
|
49
|
+
return n === null || n >= r ? t : u(e, t);
|
|
50
|
+
}
|
|
51
|
+
var m = {
|
|
52
|
+
default: {},
|
|
53
|
+
small: {
|
|
54
|
+
"font-size-caption": e("font-size-12"),
|
|
55
|
+
"line-height-caption": e("font-line-height-16"),
|
|
56
|
+
"font-size-body": e("font-size-14"),
|
|
57
|
+
"line-height-body": e("font-line-height-18"),
|
|
58
|
+
"font-size-title-small": e("font-size-16"),
|
|
59
|
+
"line-height-title-small": e("font-line-height-22"),
|
|
60
|
+
"font-size-title-large": e("font-size-18"),
|
|
61
|
+
"line-height-title-large": e("font-line-height-24")
|
|
62
|
+
},
|
|
63
|
+
large: {
|
|
64
|
+
"font-size-caption": e("font-size-16"),
|
|
65
|
+
"line-height-caption": e("font-line-height-22"),
|
|
66
|
+
"font-size-body": e("font-size-18"),
|
|
67
|
+
"line-height-body": e("font-line-height-24"),
|
|
68
|
+
"font-size-title-small": e("font-size-20"),
|
|
69
|
+
"line-height-title-small": e("font-line-height-26"),
|
|
70
|
+
"font-size-title-large": e("font-size-22"),
|
|
71
|
+
"line-height-title-large": e("font-line-height-28")
|
|
72
|
+
}
|
|
73
|
+
}, h = {
|
|
74
|
+
round: {},
|
|
75
|
+
rectangular: {
|
|
76
|
+
"border-radius-message": e("border-radius-10"),
|
|
77
|
+
"border-radius-composer": e("border-radius-10"),
|
|
78
|
+
"border-radius-media-preview": e("border-radius-10"),
|
|
79
|
+
"border-radius-container": e("border-radius-10")
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function g(e, t) {
|
|
83
|
+
let n = {
|
|
84
|
+
...h[e.cornerStyle ?? "round"],
|
|
85
|
+
...m[e.textSize ?? "default"]
|
|
86
|
+
};
|
|
87
|
+
return e.tintColor && (n["color-background-accent"] = e.tintColor, n["color-content-on-accent"] = u(e.tintColor, "#ffffff"), f(e.tintColor, t) && (n["color-content-accent"] = e.tintColor)), e.advancedColorsEnabled && e.textOverAccentColor && (n["color-content-on-accent"] = e.textOverAccentColor), e.headerColorEnabled && e.headerColor && (n["header-background"] = e.headerColor, e.advancedColorsEnabled && e.headerTextColor ? n["header-content"] = p(e.headerColor, e.headerTextColor) : l(e.headerColor, "#000000") !== null && (n["header-content"] = u(e.headerColor, "#000000"))), n;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { t as LOVELACE_SURFACES, l as contrastRatioBetween, g as createBrandOverrides, d as isLegibleAgainst, f as isLegibleOnSurface, u as readableTextOnAccent };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=branding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.js","names":[],"sources":["../../src/runtime/branding.ts"],"sourcesContent":["/**\n * How Ada applies a customer's brand colors — the canonical mapping from\n * dashboard brand settings to Lovelace token overrides, plus the WCAG\n * colorimetry that keeps the result legible.\n *\n * `createBrandOverrides` is the single source of truth: the embedded widget,\n * the docs theme playground, and the theming documentation all describe the\n * same function. The output is a plain token→value map intended for\n * `<LovelaceProvider override={...}>`.\n */\n\nimport type { LovelaceOverridableToken } from \"../tokens/tokens.js\";\nimport { t } from \"../tokens/tokens.js\";\n\n/** Token overrides consumable by `LovelaceProvider`'s `override` prop. */\nexport type BrandOverrides = Partial<Record<LovelaceOverridableToken, string>>;\n\n/** Text-size preset. `default` keeps Lovelace's own type scale. */\nexport type BrandTextSize = \"default\" | \"small\" | \"large\";\n\n/** Corner-style preset. `round` keeps Lovelace's own radii. */\nexport type BrandCornerStyle = \"round\" | \"rectangular\";\n\n/**\n * Customer brand settings, as configured in the Ada dashboard.\n *\n * Every field is optional: an absent (or `null`) value means \"not configured\"\n * and contributes no overrides, so `createBrandOverrides({}, scheme)` is `{}`.\n */\nexport interface BrandSettings {\n\t/**\n\t * The brand accent color. Painted unconditionally as the accent fill\n\t * (`color-background-accent`); used as accent *text* (`color-content-accent`)\n\t * only when it reads against the rendered surface.\n\t */\n\ttintColor?: string | null;\n\t/**\n\t * Advanced-colors override for text painted on the accent fill\n\t * (`color-content-on-accent`). Ignored unless `advancedColorsEnabled`.\n\t */\n\ttextOverAccentColor?: string | null;\n\t/** Gate for `textOverAccentColor` and `headerTextColor`. */\n\tadvancedColorsEnabled?: boolean;\n\t/** Gate for `headerColor`/`headerTextColor`. */\n\theaderColorEnabled?: boolean;\n\t/** Header background (`header-background`). */\n\theaderColor?: string | null;\n\t/**\n\t * Header foreground (`header-content`). Ignored unless\n\t * `advancedColorsEnabled`; repaired to black or white when it provably\n\t * falls below the WCAG AA 4.5:1 floor against `headerColor`.\n\t */\n\theaderTextColor?: string | null;\n\t/** Type-scale preset. Defaults to `default`. */\n\ttextSize?: BrandTextSize;\n\t/** Corner-radius preset. Defaults to `round`. */\n\tcornerStyle?: BrandCornerStyle;\n}\n\ntype Rgb = readonly [number, number, number];\n\n/**\n * Lovelace's `color-background-default` per scheme (`tokens.css`). The surface\n * every accent-as-text legibility judgement is made against.\n */\nexport const LOVELACE_SURFACES = {\n\tlight: \"#ffffff\",\n\tdark: \"#181a1e\",\n} as const satisfies Record<\"light\" | \"dark\", string>;\n\n/**\n * An anti-invisibility floor, not an AA claim: the tinted labels this guards render at\n * 13–16px, which WCAG 1.4.3 would hold to 4.5:1. Neither design system's own withheld\n * fallback clears 4.5 on both surfaces, and 4.5 would strip the brand color from most\n * mid-tone tints, so this catches only the vanishing case.\n */\nconst MIN_CONTRAST_RATIO = 3;\n\n/** WCAG AA floor for the normal-size title and controls painted in the header. */\nconst MIN_HEADER_CONTENT_CONTRAST = 4.5;\n\n/**\n * What `color-content-accent` resolves to when the override is withheld —\n * `color-accent-500` (tokens.css). A scheme-independent primitive, so it is only\n * 2.9:1 on the dark surface: withholding is not itself a legibility guarantee.\n */\nconst FALLBACK_ACCENT = \"#4e53d1\";\n\n/**\n * Hex only, deliberately: enumerating what we can measure keeps the guards\n * honest. CSS may understand values this parser does not; those pass through\n * the mapping byte-for-byte rather than being judged blind.\n */\nfunction parseHexColor(color: string): Rgb | null {\n\tconst match = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());\n\tif (!match) {\n\t\treturn null;\n\t}\n\n\tconst hex = match[1];\n\tconst full =\n\t\thex.length === 3\n\t\t\t? hex\n\t\t\t\t\t.split(\"\")\n\t\t\t\t\t.map((c) => c + c)\n\t\t\t\t\t.join(\"\")\n\t\t\t: hex;\n\n\treturn [\n\t\tNumber.parseInt(full.slice(0, 2), 16),\n\t\tNumber.parseInt(full.slice(2, 4), 16),\n\t\tNumber.parseInt(full.slice(4, 6), 16),\n\t] as const;\n}\n\nfunction channelLuminance(channel: number): number {\n\tconst srgb = channel / 255;\n\n\treturn srgb <= 0.03928 ? srgb / 12.92 : ((srgb + 0.055) / 1.055) ** 2.4;\n}\n\nfunction relativeLuminance([r, g, b]: Rgb): number {\n\treturn (\n\t\t0.2126 * channelLuminance(r) +\n\t\t0.7152 * channelLuminance(g) +\n\t\t0.0722 * channelLuminance(b)\n\t);\n}\n\nfunction contrastRatio(a: Rgb, b: Rgb): number {\n\tconst la = relativeLuminance(a);\n\tconst lb = relativeLuminance(b);\n\n\treturn (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);\n}\n\n/**\n * WCAG contrast ratio between two hex colors, or `null` when either cannot be parsed.\n *\n * Exported so a caller that needs a different floor than this module's 3:1 — an AA\n * 4.5:1 check on the default palette, say — reuses this colorimetry instead of writing\n * a second copy. Judging *which* colors to compare is still the caller's job.\n */\nexport function contrastRatioBetween(a: string, b: string): number | null {\n\tconst rgbA = parseHexColor(a);\n\tconst rgbB = parseHexColor(b);\n\n\treturn rgbA && rgbB ? contrastRatio(rgbA, rgbB) : null;\n}\n\n/**\n * Pick black or white for ordinary text painted on a customer-provided accent fill.\n *\n * One of the two always clears WCAG AA against a valid opaque hex color (their\n * luminances sit at opposite ends of the scale). An unparseable color keeps the\n * caller's existing fallback: CSS may understand a value this deliberately-small\n * parser does not, and silently changing its text color without measuring it would\n * only trade one unknown rendering for another.\n */\nexport function readableTextOnAccent(accent: string, fallback: string): string {\n\tconst whiteRatio = contrastRatioBetween(\"#ffffff\", accent);\n\tconst blackRatio = contrastRatioBetween(\"#000000\", accent);\n\tif (whiteRatio === null || blackRatio === null) {\n\t\treturn fallback;\n\t}\n\treturn whiteRatio >= blackRatio ? \"#ffffff\" : \"#000000\";\n}\n\n/**\n * Whether `color` is safe to use as accent foreground on `surface`.\n *\n * Kept when it clears the floor, and also kept when it is merely below the floor but\n * still no worse than `fallback` — the color withholding would leave in place — so the\n * guard can never trade a tint for a *less* legible replacement. A value it cannot\n * parse fails closed: an unreadable `surface` means the judgement cannot be made, and\n * an unparseable `fallback` only forfeits that second chance.\n *\n * Both clauses are evaluated against `surface` and nothing else, so a caller that\n * paints the tint over a *composite* of itself and the surface gets a verdict that\n * overstates the real contrast — and can therefore keep a tint that is genuinely worse\n * than the fallback it declined. `FileDropZone`'s 15% accent wash is the one such\n * caller today; see the theming spec's auto-contrast row for the measured shortfall.\n */\nexport function isLegibleAgainst(\n\tcolor: string,\n\tsurface: string,\n\tfallback: string,\n): boolean {\n\tconst rgb = parseHexColor(color);\n\tconst surfaceRgb = parseHexColor(surface);\n\tif (!rgb || !surfaceRgb) {\n\t\treturn false;\n\t}\n\n\tconst tintRatio = contrastRatio(rgb, surfaceRgb);\n\tif (tintRatio >= MIN_CONTRAST_RATIO) {\n\t\treturn true;\n\t}\n\n\tconst fallbackRgb = parseHexColor(fallback);\n\n\treturn (\n\t\tfallbackRgb !== null && tintRatio >= contrastRatio(fallbackRgb, surfaceRgb)\n\t);\n}\n\n/**\n * Whether `color` is safe to use as accent text on `scheme`'s default Lovelace\n * surface. The comparison fallback is `color-accent-500`, the value the token\n * resolves to when the override is withheld.\n */\nexport function isLegibleOnSurface(\n\tcolor: string,\n\tscheme: \"light\" | \"dark\",\n): boolean {\n\treturn isLegibleAgainst(color, LOVELACE_SURFACES[scheme], FALLBACK_ACCENT);\n}\n\n/**\n * Keep a customer's configured pair when it is readable, and repair only a\n * valid pair that we can prove falls below AA. Named colors, alpha colors and\n * other values outside the shared hex parser stay byte-for-byte unchanged: CSS\n * may understand them, but choosing a replacement without measuring them would\n * exchange one unknown rendering for another.\n */\nfunction resolveHeaderContentColor(\n\tbackground: string,\n\tcontent: string,\n): string {\n\tconst ratio = contrastRatioBetween(background, content);\n\tif (ratio === null || ratio >= MIN_HEADER_CONTENT_CONTRAST) {\n\t\treturn content;\n\t}\n\treturn readableTextOnAccent(background, content);\n}\n\n/**\n * Text-size and corner style are consumer concerns: Lovelace ships only its\n * default scale, so the mapping re-points the semantic/component tokens at the\n * right Lovelace *primitives* per preset (values stay owned by the token sheet;\n * only the mapping lives here). Only tokens that differ from the default are listed.\n */\nconst TEXT_SIZE_TOKEN_OVERRIDES = {\n\tdefault: {},\n\tsmall: {\n\t\t\"font-size-caption\": t(\"font-size-12\"),\n\t\t\"line-height-caption\": t(\"font-line-height-16\"),\n\t\t\"font-size-body\": t(\"font-size-14\"),\n\t\t\"line-height-body\": t(\"font-line-height-18\"),\n\t\t\"font-size-title-small\": t(\"font-size-16\"),\n\t\t\"line-height-title-small\": t(\"font-line-height-22\"),\n\t\t\"font-size-title-large\": t(\"font-size-18\"),\n\t\t\"line-height-title-large\": t(\"font-line-height-24\"),\n\t},\n\tlarge: {\n\t\t\"font-size-caption\": t(\"font-size-16\"),\n\t\t\"line-height-caption\": t(\"font-line-height-22\"),\n\t\t\"font-size-body\": t(\"font-size-18\"),\n\t\t\"line-height-body\": t(\"font-line-height-24\"),\n\t\t\"font-size-title-small\": t(\"font-size-20\"),\n\t\t\"line-height-title-small\": t(\"font-line-height-26\"),\n\t\t\"font-size-title-large\": t(\"font-size-22\"),\n\t\t\"line-height-title-large\": t(\"font-line-height-28\"),\n\t},\n} satisfies Record<BrandTextSize, BrandOverrides>;\n\nconst CORNER_STYLE_TOKEN_OVERRIDES = {\n\tround: {},\n\trectangular: {\n\t\t\"border-radius-message\": t(\"border-radius-10\"),\n\t\t\"border-radius-composer\": t(\"border-radius-10\"),\n\t\t\"border-radius-media-preview\": t(\"border-radius-10\"),\n\t\t\"border-radius-container\": t(\"border-radius-10\"),\n\t},\n} satisfies Record<BrandCornerStyle, BrandOverrides>;\n\n/**\n * Map customer brand settings to Lovelace token overrides — exactly how the Ada\n * widget applies your brand colors. Feed the result to\n * `<LovelaceProvider override={...}>`.\n *\n * `scheme` is the *resolved* light/dark surface being painted (resolve `auto`\n * via `useResolvedTheme`), not the configured theme — the accent-text contrast\n * decision has to be made against the surface the label actually lands on.\n *\n * The mapping, in order:\n *\n * 1. `cornerStyle` / `textSize` re-point radius and typography tokens at\n * Lovelace primitives (`rectangular` flattens radii to 10px; `small`/`large`\n * shift the four-step type scale down/up one step).\n * 2. `tintColor` paints `color-background-accent` unconditionally, and\n * `color-content-on-accent` becomes whichever of black or white contrasts\n * more with the tint. The tint is also used as standalone accent *text*\n * (`color-content-accent`) only when it reads on the rendered surface —\n * a tint near that background would render the label invisible.\n * 3. With `advancedColorsEnabled`, `textOverAccentColor` replaces the derived\n * on-accent text color verbatim.\n * 4. With `headerColorEnabled`, `headerColor` paints `header-background`.\n * The header foreground is `headerTextColor` (advanced colors only),\n * repaired to black or white when it measurably falls below the WCAG AA\n * 4.5:1 floor against `headerColor`; without a configured foreground the\n * maximum-contrast black or white is derived from the background.\n *\n * Legibility guards measure hex colors only. Values the hex parser cannot read\n * (named colors, `rgba()`, `var()`, …) pass through unrepaired where they are\n * kept at all: repairing what cannot be measured would trade one unknown\n * rendering for another.\n */\nexport function createBrandOverrides(\n\tsettings: BrandSettings,\n\tscheme: \"light\" | \"dark\",\n): BrandOverrides {\n\tconst overrides: BrandOverrides = {\n\t\t...CORNER_STYLE_TOKEN_OVERRIDES[settings.cornerStyle ?? \"round\"],\n\t\t...TEXT_SIZE_TOKEN_OVERRIDES[settings.textSize ?? \"default\"],\n\t};\n\tif (settings.tintColor) {\n\t\toverrides[\"color-background-accent\"] = settings.tintColor;\n\t\toverrides[\"color-content-on-accent\"] = readableTextOnAccent(\n\t\t\tsettings.tintColor,\n\t\t\t\"#ffffff\",\n\t\t);\n\t\t// Only as text when it reads on the surface being painted — a tint near that\n\t\t// background renders the label invisible, and nothing downstream can recover\n\t\t// it (`textOverAccentColor` only covers text *on* the accent fill).\n\t\tif (isLegibleOnSurface(settings.tintColor, scheme)) {\n\t\t\toverrides[\"color-content-accent\"] = settings.tintColor;\n\t\t}\n\t}\n\tif (settings.advancedColorsEnabled && settings.textOverAccentColor) {\n\t\toverrides[\"color-content-on-accent\"] = settings.textOverAccentColor;\n\t}\n\tif (settings.headerColorEnabled && settings.headerColor) {\n\t\toverrides[\"header-background\"] = settings.headerColor;\n\t\tif (settings.advancedColorsEnabled && settings.headerTextColor) {\n\t\t\toverrides[\"header-content\"] = resolveHeaderContentColor(\n\t\t\t\tsettings.headerColor,\n\t\t\t\tsettings.headerTextColor,\n\t\t\t);\n\t\t} else if (contrastRatioBetween(settings.headerColor, \"#000000\") !== null) {\n\t\t\t// The dashboard derives the header foreground from a configured background\n\t\t\t// unless advanced colours explicitly supply one. The parse guard above\n\t\t\t// makes this fallback unreachable, so select the maximum-contrast black\n\t\t\t// or white foreground without implying a color-scheme preference.\n\t\t\toverrides[\"header-content\"] = readableTextOnAccent(\n\t\t\t\tsettings.headerColor,\n\t\t\t\t\"#000000\",\n\t\t\t);\n\t\t}\n\t}\n\treturn overrides;\n}\n"],"mappings":";;AAiEA,IAAa,IAAoB;CAChC,OAAO;CACP,MAAM;CACN,EAQK,IAAqB,GAGrB,IAA8B,KAO9B,IAAkB;AAOxB,SAAS,EAAc,GAA2B;CACjD,IAAM,IAAQ,gCAAgC,KAAK,EAAM,MAAM,CAAC;AAChE,KAAI,CAAC,EACJ,QAAO;CAGR,IAAM,IAAM,EAAM,IACZ,IACL,EAAI,WAAW,IACZ,EACC,MAAM,GAAG,CACT,KAAK,MAAM,IAAI,EAAE,CACjB,KAAK,GAAG,GACT;AAEJ,QAAO;EACN,OAAO,SAAS,EAAK,MAAM,GAAG,EAAE,EAAE,GAAG;EACrC,OAAO,SAAS,EAAK,MAAM,GAAG,EAAE,EAAE,GAAG;EACrC,OAAO,SAAS,EAAK,MAAM,GAAG,EAAE,EAAE,GAAG;EACrC;;AAGF,SAAS,EAAiB,GAAyB;CAClD,IAAM,IAAO,IAAU;AAEvB,QAAO,KAAQ,SAAU,IAAO,UAAU,IAAO,QAAS,UAAU;;AAGrE,SAAS,EAAkB,CAAC,GAAG,GAAG,IAAiB;AAClD,QACC,QAAS,EAAiB,EAAE,GAC5B,QAAS,EAAiB,EAAE,GAC5B,QAAS,EAAiB,EAAE;;AAI9B,SAAS,EAAc,GAAQ,GAAgB;CAC9C,IAAM,IAAK,EAAkB,EAAE,EACzB,IAAK,EAAkB,EAAE;AAE/B,SAAQ,KAAK,IAAI,GAAI,EAAG,GAAG,QAAS,KAAK,IAAI,GAAI,EAAG,GAAG;;AAUxD,SAAgB,EAAqB,GAAW,GAA0B;CACzE,IAAM,IAAO,EAAc,EAAE,EACvB,IAAO,EAAc,EAAE;AAE7B,QAAO,KAAQ,IAAO,EAAc,GAAM,EAAK,GAAG;;AAYnD,SAAgB,EAAqB,GAAgB,GAA0B;CAC9E,IAAM,IAAa,EAAqB,WAAW,EAAO,EACpD,IAAa,EAAqB,WAAW,EAAO;AAI1D,QAHI,MAAe,QAAQ,MAAe,OAClC,IAED,KAAc,IAAa,YAAY;;AAkB/C,SAAgB,EACf,GACA,GACA,GACU;CACV,IAAM,IAAM,EAAc,EAAM,EAC1B,IAAa,EAAc,EAAQ;AACzC,KAAI,CAAC,KAAO,CAAC,EACZ,QAAO;CAGR,IAAM,IAAY,EAAc,GAAK,EAAW;AAChD,KAAI,KAAa,EAChB,QAAO;CAGR,IAAM,IAAc,EAAc,EAAS;AAE3C,QACC,MAAgB,QAAQ,KAAa,EAAc,GAAa,EAAW;;AAS7E,SAAgB,EACf,GACA,GACU;AACV,QAAO,EAAiB,GAAO,EAAkB,IAAS,EAAgB;;AAU3E,SAAS,EACR,GACA,GACS;CACT,IAAM,IAAQ,EAAqB,GAAY,EAAQ;AAIvD,QAHI,MAAU,QAAQ,KAAS,IACvB,IAED,EAAqB,GAAY,EAAQ;;AASjD,IAAM,IAA4B;CACjC,SAAS,EAAE;CACX,OAAO;EACN,qBAAqB,EAAE,eAAe;EACtC,uBAAuB,EAAE,sBAAsB;EAC/C,kBAAkB,EAAE,eAAe;EACnC,oBAAoB,EAAE,sBAAsB;EAC5C,yBAAyB,EAAE,eAAe;EAC1C,2BAA2B,EAAE,sBAAsB;EACnD,yBAAyB,EAAE,eAAe;EAC1C,2BAA2B,EAAE,sBAAsB;EACnD;CACD,OAAO;EACN,qBAAqB,EAAE,eAAe;EACtC,uBAAuB,EAAE,sBAAsB;EAC/C,kBAAkB,EAAE,eAAe;EACnC,oBAAoB,EAAE,sBAAsB;EAC5C,yBAAyB,EAAE,eAAe;EAC1C,2BAA2B,EAAE,sBAAsB;EACnD,yBAAyB,EAAE,eAAe;EAC1C,2BAA2B,EAAE,sBAAsB;EACnD;CACD,EAEK,IAA+B;CACpC,OAAO,EAAE;CACT,aAAa;EACZ,yBAAyB,EAAE,mBAAmB;EAC9C,0BAA0B,EAAE,mBAAmB;EAC/C,+BAA+B,EAAE,mBAAmB;EACpD,2BAA2B,EAAE,mBAAmB;EAChD;CACD;AAkCD,SAAgB,EACf,GACA,GACiB;CACjB,IAAM,IAA4B;EACjC,GAAG,EAA6B,EAAS,eAAe;EACxD,GAAG,EAA0B,EAAS,YAAY;EAClD;AAmCD,QAlCI,EAAS,cACZ,EAAU,6BAA6B,EAAS,WAChD,EAAU,6BAA6B,EACtC,EAAS,WACT,UACA,EAIG,EAAmB,EAAS,WAAW,EAAO,KACjD,EAAU,0BAA0B,EAAS,aAG3C,EAAS,yBAAyB,EAAS,wBAC9C,EAAU,6BAA6B,EAAS,sBAE7C,EAAS,sBAAsB,EAAS,gBAC3C,EAAU,uBAAuB,EAAS,aACtC,EAAS,yBAAyB,EAAS,kBAC9C,EAAU,oBAAoB,EAC7B,EAAS,aACT,EAAS,gBACT,GACS,EAAqB,EAAS,aAAa,UAAU,KAAK,SAKpE,EAAU,oBAAoB,EAC7B,EAAS,aACT,UACA,IAGI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { type BrandCornerStyle, type BrandOverrides, type BrandSettings, type BrandTextSize, contrastRatioBetween, createBrandOverrides, isLegibleAgainst, isLegibleOnSurface, LOVELACE_SURFACES, readableTextOnAccent, } from "./branding.js";
|
|
2
|
+
export { LovelaceProvider, type LovelaceProviderProps, type LovelaceTheme, useResolvedTheme, } from "./LovelaceProvider.js";
|