UNPKG

@consentry/ui

Version:

Composable UI components for the Consentry consent manager. Built with Emotion and designed for use with @consentry/core or @consentry/next.

516 lines (507 loc) 16.6 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import react__default, { HTMLAttributes } from 'react'; import * as framer_motion from 'framer-motion'; import * as _emotion_styled from '@emotion/styled'; import * as _emotion_react from '@emotion/react'; type CookiePrefs = { functional: boolean; performance: boolean; advertising: boolean; social: boolean; }; interface CookieCategory { key: keyof CookiePrefs; title?: string; description?: string; mandatory?: boolean; } type Theme = "light" | "dark"; interface ThemeColors { primary?: string; primaryHover?: string; primaryText?: string; settingsButton?: string; settingsButtonHover?: string; settingsButtonText?: string; background?: string; text?: string; border?: string; } type ColorSettings = Partial<Record<Theme, ThemeColors>>; type CookieBannerProps = { onClose: () => void; onCustomizeClick: () => void; onAcceptAll: () => void; onRejectAll: () => void; mode: "top" | "bottom" | "modal"; dark?: boolean; labels?: BannerLabels; classNames?: BannerClassNames; colors?: ColorSettings; theme?: Theme; }; interface BannerLabels { title?: string; description?: string | React.ReactNode; acceptAll?: string; rejectAll?: string; customize?: string; } interface ModalLabels { title?: string; save?: string; cancel?: string; } interface ConsentManagerLabels { banner?: BannerLabels; modal?: ModalLabels; settingsButton?: string; } interface ConsentManagerProps { mode: "modal" | "top" | "bottom"; categories?: CookieCategory[]; dark?: boolean; hideSettingsButton?: boolean; labels?: ConsentManagerLabels; classNames?: ConsentManagerClassNames; settingsButtonIcon?: React.ReactNode; colors?: ColorSettings; theme?: Theme; } interface SettingsButtonProps { setVisible: (visible: boolean) => void; open: boolean; icon?: React.ReactNode; className?: ConsentManagerClassNames["settingsButton"]; colors?: ColorSettings; theme?: Theme; } interface BannerClassNames { container?: string; header?: string; title?: string; message?: string; closeButton?: string; buttonRow?: string; acceptButton?: string; rejectButton?: string; customizeButton?: string; content?: string; } interface ModalClassNames { overlay?: string; container?: string; title?: string; section?: string; row?: string; rowText?: string; rowTitle?: string; rowDescription?: string; toggleSwitch?: string; toggleThumb?: string; saveButton?: string; cancelButton?: string; buttonRow?: string; } interface ConsentManagerClassNames { wrapper?: string; banner?: BannerClassNames; modal?: ModalClassNames; settingsButton?: string; } interface CookieSettingsModalProps$1 { localPrefs: CookiePrefs; setLocalPrefs: React.Dispatch<React.SetStateAction<CookiePrefs>>; categories: CookieCategory[]; onSave: () => void; onClose: () => void; dark?: boolean; labels?: ModalLabels; classNames?: ModalClassNames; colors?: ColorSettings; theme?: Theme; } declare const CookieBanner: ({ onClose, onCustomizeClick, onAcceptAll, onRejectAll, mode, dark, labels, classNames, colors, theme, }: CookieBannerProps) => react_jsx_runtime.JSX.Element; interface CookieSettingsModalProps { localPrefs: CookiePrefs; setLocalPrefs: react__default.Dispatch<react__default.SetStateAction<CookiePrefs>>; categories: CookieCategory[]; onSave: () => void; onClose: () => void; dark?: boolean; labels?: ModalLabels; classNames?: ModalClassNames; colors?: ColorSettings; theme?: Theme; } declare const CookieSettingsModal: ({ localPrefs, setLocalPrefs, categories, onSave, onClose, dark, labels, classNames, colors, theme, }: CookieSettingsModalProps) => react_jsx_runtime.JSX.Element; declare const SettingsButton: ({ setVisible, open, className, icon, colors, theme, }: SettingsButtonProps) => react_jsx_runtime.JSX.Element | null; declare const Wrapper: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; interface OverlayProps extends HTMLAttributes<HTMLDivElement> { } declare const Overlay: _emotion_styled.StyledComponent<{} & framer_motion.MotionProps & react.RefAttributes<unknown> & { theme?: _emotion_react.Theme; } & OverlayProps, {}, {}>; interface ModalContainerProps extends HTMLAttributes<HTMLDivElement> { dark?: boolean; } declare const ModalContainer: _emotion_styled.StyledComponent<{} & framer_motion.MotionProps & react.RefAttributes<unknown> & { theme?: _emotion_react.Theme; } & ModalContainerProps, {}, {}>; interface BannerWrapperProps extends HTMLAttributes<HTMLDivElement> { mode: "top" | "bottom" | "modal"; dark: boolean; colors?: ColorSettings; theme?: Theme; } declare const BannerWrapper: _emotion_styled.StyledComponent<{} & framer_motion.MotionProps & react.RefAttributes<unknown> & { theme?: _emotion_react.Theme; } & BannerWrapperProps, {}, {}>; declare const Header: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; declare const Content: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; declare const Title: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { large?: boolean; dark?: boolean; }, react.DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}>; declare const Message: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>; declare const Section: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; declare const Row: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; declare const RowText: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; declare const RowTitle: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { dark?: boolean; }, react.DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>; declare const RowDescription: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { dark?: boolean; }, react.DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>; declare const ButtonRow: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { align?: "end" | "center"; }, react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>; declare const ActionButton: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { dark: boolean; outlined?: boolean; colors?: ColorSettings; theme?: Theme; }, react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>; declare const SecondaryButton: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { dark?: boolean; }, react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>; declare const CloseButton: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; }, react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>; declare const StyledSwitch: _emotion_styled.StyledComponent<{ style?: any; onAnimationStart?: any; onDragStart?: any; onDragEnd?: any; onDrag?: any; key?: any; color?: any; suppressHydrationWarning?: any; id?: any; lang?: any; "aria-activedescendant"?: any; "aria-atomic"?: any; "aria-autocomplete"?: any; "aria-braillelabel"?: any; "aria-brailleroledescription"?: any; "aria-busy"?: any; "aria-colcount"?: any; "aria-colindex"?: any; "aria-colindextext"?: any; "aria-colspan"?: any; "aria-controls"?: any; "aria-current"?: any; "aria-description"?: any; "aria-details"?: any; "aria-disabled"?: any; "aria-dropeffect"?: any; "aria-errormessage"?: any; "aria-expanded"?: any; "aria-flowto"?: any; "aria-grabbed"?: any; "aria-haspopup"?: any; "aria-hidden"?: any; "aria-invalid"?: any; "aria-keyshortcuts"?: any; "aria-label"?: any; "aria-level"?: any; "aria-live"?: any; "aria-modal"?: any; "aria-multiline"?: any; "aria-multiselectable"?: any; "aria-orientation"?: any; "aria-owns"?: any; "aria-placeholder"?: any; "aria-posinset"?: any; "aria-pressed"?: any; "aria-readonly"?: any; "aria-relevant"?: any; "aria-required"?: any; "aria-roledescription"?: any; "aria-rowcount"?: any; "aria-rowindex"?: any; "aria-rowindextext"?: any; "aria-rowspan"?: any; "aria-selected"?: any; "aria-setsize"?: any; "aria-sort"?: any; "aria-valuemax"?: any; "aria-valuemin"?: any; "aria-valuenow"?: any; "aria-valuetext"?: any; dangerouslySetInnerHTML?: any; onCopy?: any; onCopyCapture?: any; onCut?: any; onCutCapture?: any; onPaste?: any; onPasteCapture?: any; onCompositionEnd?: any; onCompositionEndCapture?: any; onCompositionStart?: any; onCompositionStartCapture?: any; onCompositionUpdate?: any; onCompositionUpdateCapture?: any; onFocus?: any; onFocusCapture?: any; onBlur?: any; onBlurCapture?: any; onChangeCapture?: any; onBeforeInput?: any; onBeforeInputCapture?: any; onInput?: any; onInputCapture?: any; onReset?: any; onResetCapture?: any; onSubmit?: any; onSubmitCapture?: any; onInvalid?: any; onInvalidCapture?: any; onLoad?: any; onLoadCapture?: any; onError?: any; onErrorCapture?: any; onKeyDown?: any; onKeyDownCapture?: any; onKeyPress?: any; onKeyPressCapture?: any; onKeyUp?: any; onKeyUpCapture?: any; onAbort?: any; onAbortCapture?: any; onCanPlay?: any; onCanPlayCapture?: any; onCanPlayThrough?: any; onCanPlayThroughCapture?: any; onDurationChange?: any; onDurationChangeCapture?: any; onEmptied?: any; onEmptiedCapture?: any; onEncrypted?: any; onEncryptedCapture?: any; onEnded?: any; onEndedCapture?: any; onLoadedData?: any; onLoadedDataCapture?: any; onLoadedMetadata?: any; onLoadedMetadataCapture?: any; onLoadStart?: any; onLoadStartCapture?: any; onPause?: any; onPauseCapture?: any; onPlay?: any; onPlayCapture?: any; onPlaying?: any; onPlayingCapture?: any; onProgress?: any; onProgressCapture?: any; onRateChange?: any; onRateChangeCapture?: any; onResize?: any; onResizeCapture?: any; onSeeked?: any; onSeekedCapture?: any; onSeeking?: any; onSeekingCapture?: any; onStalled?: any; onStalledCapture?: any; onSuspend?: any; onSuspendCapture?: any; onTimeUpdate?: any; onTimeUpdateCapture?: any; onVolumeChange?: any; onVolumeChangeCapture?: any; onWaiting?: any; onWaitingCapture?: any; onAuxClick?: any; onAuxClickCapture?: any; onClick?: any; onClickCapture?: any; onContextMenu?: any; onContextMenuCapture?: any; onDoubleClick?: any; onDoubleClickCapture?: any; onDragCapture?: any; onDragEndCapture?: any; onDragEnter?: any; onDragEnterCapture?: any; onDragExit?: any; onDragExitCapture?: any; onDragLeave?: any; onDragLeaveCapture?: any; onDragOver?: any; onDragOverCapture?: any; onDragStartCapture?: any; onDrop?: any; onDropCapture?: any; onMouseDown?: any; onMouseDownCapture?: any; onMouseEnter?: any; onMouseLeave?: any; onMouseMove?: any; onMouseMoveCapture?: any; onMouseOut?: any; onMouseOutCapture?: any; onMouseOver?: any; onMouseOverCapture?: any; onMouseUp?: any; onMouseUpCapture?: any; onSelect?: any; onSelectCapture?: any; onTouchCancel?: any; onTouchCancelCapture?: any; onTouchEnd?: any; onTouchEndCapture?: any; onTouchMove?: any; onTouchMoveCapture?: any; onTouchStart?: any; onTouchStartCapture?: any; onPointerDown?: any; onPointerDownCapture?: any; onPointerMove?: any; onPointerMoveCapture?: any; onPointerUp?: any; onPointerUpCapture?: any; onPointerCancel?: any; onPointerCancelCapture?: any; onPointerEnter?: any; onPointerLeave?: any; onPointerOver?: any; onPointerOverCapture?: any; onPointerOut?: any; onPointerOutCapture?: any; onGotPointerCapture?: any; onGotPointerCaptureCapture?: any; onLostPointerCapture?: any; onLostPointerCaptureCapture?: any; onScroll?: any; onScrollCapture?: any; onScrollEnd?: any; onScrollEndCapture?: any; onWheel?: any; onWheelCapture?: any; onAnimationStartCapture?: any; onAnimationEnd?: any; onAnimationEndCapture?: any; onAnimationIteration?: any; onAnimationIterationCapture?: any; onToggle?: any; onBeforeToggle?: any; onTransitionCancel?: any; onTransitionCancelCapture?: any; onTransitionEnd?: any; onTransitionEndCapture?: any; onTransitionRun?: any; onTransitionRunCapture?: any; onTransitionStart?: any; onTransitionStartCapture?: any; } & { as?: react.ElementType | undefined; children?: react.ReactNode | ((bag: { checked: boolean; hover: boolean; focus: boolean; active: boolean; autofocus: boolean; changing: boolean; disabled: boolean; }) => react.ReactElement); refName?: string; } & { className?: any; } & { checked?: boolean; defaultChecked?: boolean; onChange?(checked: boolean): void; name?: string; value?: string; form?: string; autoFocus?: boolean; disabled?: boolean; tabIndex?: number; } & { ref?: react.Ref<HTMLButtonElement> | undefined; } & { theme?: _emotion_react.Theme; } & { checked: boolean; colors?: ColorSettings; theme?: Theme; }, {}, {}>; interface SwitchThumbProps extends HTMLAttributes<HTMLSpanElement> { } declare const SwitchThumb: _emotion_styled.StyledComponent<{} & framer_motion.MotionProps & react.RefAttributes<unknown> & { theme?: _emotion_react.Theme; } & SwitchThumbProps, {}, {}>; declare const FloatingButton: _emotion_styled.StyledComponent<{ theme?: _emotion_react.Theme; as?: React.ElementType; } & { colors?: ColorSettings; theme?: Theme; }, react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>; declare function setConsentOpener(fn: () => void): void; declare function openConsentSettings(): void; declare const ConsentManager: ({ mode, dark, hideSettingsButton, categories, labels, classNames, settingsButtonIcon, colors, theme, }: ConsentManagerProps) => react_jsx_runtime.JSX.Element; export { ActionButton, type BannerClassNames, type BannerLabels, BannerWrapper, ButtonRow, CloseButton, type ColorSettings, type ConsentManagerClassNames, type ConsentManagerLabels, type ConsentManagerProps, Content, CookieBanner, type CookieBannerProps, type CookieCategory, type CookiePrefs, CookieSettingsModal, type CookieSettingsModalProps$1 as CookieSettingsModalProps, FloatingButton, Header, Message, type ModalClassNames, ModalContainer, type ModalLabels, Overlay, Row, RowDescription, RowText, RowTitle, SecondaryButton, Section, SettingsButton, type SettingsButtonProps, StyledSwitch, SwitchThumb, type Theme, type ThemeColors, Title, Wrapper, ConsentManager as default, openConsentSettings, setConsentOpener };