@flopay/ui 1.9.7 → 1.10.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 +117 -0
- package/dist/index.cjs +389 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +102 -2
- package/dist/index.d.ts +102 -2
- package/dist/index.mjs +392 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
- package/styles/components.css +236 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cn.ts","../src/components/badge.tsx","../src/components/button.tsx","../src/components/card.tsx","../src/components/container.tsx","../src/components/feedback.tsx","../src/components/field.tsx","../src/components/section.tsx"],"sourcesContent":["export { cn } from './cn';\n\nexport type { BadgeProps, BadgeVariant } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonProps, ButtonSize, ButtonVariant } from './components/button';\nexport { Button } from './components/button';\nexport type { CardPadding, CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { ContainerProps } from './components/container';\nexport { Container } from './components/container';\nexport type { EmptyStateProps, SpinnerProps } from './components/feedback';\nexport { EmptyState, Spinner } from './components/feedback';\nexport type { FieldProps, InputProps, LabelProps } from './components/field';\nexport { Field, Input, Label } from './components/field';\nexport type { SectionHeaderProps, SectionProps } from './components/section';\nexport { Section, SectionHeader } from './components/section';\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Merge class names, resolving conflicting Tailwind utilities (last wins).\n * Mirrors the helper used across the FloPay frontends so consumers can extend\n * any primitive's classes safely.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { HTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type BadgeVariant = 'neutral' | 'success' | 'warning' | 'danger' | 'info';\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Render a leading status dot. */\n dot?: boolean;\n /** Semantic color. `neutral` is the default outlined pill. */\n variant?: BadgeVariant;\n}\n\nconst variantClass: Record<BadgeVariant, string> = {\n neutral: '',\n success: 'badge-success',\n warning: 'badge-warning',\n danger: 'badge-danger',\n info: 'badge-info',\n};\n\n/** Pill badge — neutral by default, or a semantic variant, optionally with a dot. */\nexport function Badge({\n dot = false,\n variant = 'neutral',\n className,\n children,\n ...props\n}: BadgeProps) {\n return (\n <span className={cn('badge', variantClass[variant], className)} {...props}>\n {dot ? <span className=\"badge-dot\" /> : null}\n {children}\n </span>\n );\n}\n","import type { ButtonHTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'outline';\nexport type ButtonSize = 'md' | 'sm';\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nconst variantClass: Record<ButtonVariant, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n outline: 'btn-outline',\n};\n\nexport function Button({\n variant = 'primary',\n size = 'md',\n className,\n type = 'button',\n ...props\n}: ButtonProps) {\n return (\n <button\n type={type}\n className={cn(variantClass[variant], size === 'sm' && 'btn-sm', className)}\n {...props}\n />\n );\n}\n","import type { HTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type CardPadding = 'none' | 'sm' | 'md' | 'lg';\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n /** Inner padding. Defaults to `md` (28px); use `none` to supply your own. */\n padding?: CardPadding;\n /** Add pointer cursor + hover elevation (for clickable cards). */\n interactive?: boolean;\n}\n\n/** Bordered surface card. Static by default; opt into hover with `interactive`. */\nexport function Card({ padding = 'md', interactive = false, className, ...props }: CardProps) {\n return (\n <div\n className={cn(\n 'card',\n padding !== 'none' && `card-pad-${padding}`,\n interactive && 'card-interactive',\n className,\n )}\n {...props}\n />\n );\n}\n","import type { HTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type ContainerProps = HTMLAttributes<HTMLDivElement>;\n\n/** Centered, max-width content wrapper (var(--max-w)) with horizontal padding. */\nexport function Container({ className, ...props }: ContainerProps) {\n return <div className={cn('container', className)} {...props} />;\n}\n","import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../cn';\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {\n /** Wrap in a centered, padded block (for loading states in a panel). */\n center?: boolean;\n}\n\n/** Brand-colored loading spinner. */\nexport function Spinner({ center = false, className, ...props }: SpinnerProps) {\n const spinner = (\n <span className={cn('spinner', className)} role=\"status\" aria-label=\"Loading\" {...props} />\n );\n return center ? <div className=\"spinner-center\">{spinner}</div> : spinner;\n}\n\nexport interface EmptyStateProps {\n title: ReactNode;\n description?: ReactNode;\n /** Optional icon rendered in the circular badge above the title. */\n icon?: ReactNode;\n className?: string;\n}\n\n/** Centered \"nothing here yet\" placeholder for empty lists/tables. */\nexport function EmptyState({ title, description, icon, className }: EmptyStateProps) {\n return (\n <div className={cn('empty-state', className)}>\n {icon ? <div className=\"empty-state-icon\">{icon}</div> : null}\n <h3 className=\"empty-state-title\">{title}</h3>\n {description ? <p className=\"empty-state-desc\">{description}</p> : null}\n </div>\n );\n}\n","import type { InputHTMLAttributes, LabelHTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../cn';\n\nexport type InputProps = InputHTMLAttributes<HTMLInputElement>;\n\n/** Token-aligned text input (the `.field` look: border, surface, brand focus ring). */\nexport function Input({ className, ...props }: InputProps) {\n return <input className={cn('field', className)} {...props} />;\n}\n\nexport type LabelProps = LabelHTMLAttributes<HTMLLabelElement>;\n\nexport function Label({ className, ...props }: LabelProps) {\n // biome-ignore lint/a11y/noLabelWithoutControl: primitive pass-through: the caller supplies the control association (htmlFor, or the input as a child) through the spread props, which the rule cannot see\n return <label className={cn('field-label', className)} {...props} />;\n}\n\nexport interface FieldProps {\n label?: ReactNode;\n /** Helper text shown below the control (hidden when `error` is set). */\n hint?: ReactNode;\n /** Error text shown below the control (takes precedence over `hint`). */\n error?: ReactNode;\n /** `htmlFor` for the label, matching the control's id. */\n htmlFor?: string;\n className?: string;\n children: ReactNode;\n}\n\n/** Labelled field wrapper: optional label above and hint/error below the control. */\nexport function Field({ label, hint, error, htmlFor, className, children }: FieldProps) {\n const message = error || hint;\n return (\n <div className={cn('field-group', className)}>\n {label ? <Label htmlFor={htmlFor}>{label}</Label> : null}\n {children}\n {message ? <span className={error ? 'field-error' : 'field-hint'}>{message}</span> : null}\n </div>\n );\n}\n","import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../cn';\n\nexport type SectionProps = HTMLAttributes<HTMLElement>;\n\n/** Vertical page section with max-width and standard padding. */\nexport function Section({ className, ...props }: SectionProps) {\n return <section className={cn('section', className)} {...props} />;\n}\n\nexport interface SectionHeaderProps {\n /** Small eyebrow label above the title (brand colored). */\n label?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n className?: string;\n}\n\n/** Centered section heading: optional label, title, optional description. */\nexport function SectionHeader({ label, title, description, className }: SectionHeaderProps) {\n return (\n <div className={cn('section-center', className)}>\n {label ? <div className=\"section-label\">{label}</div> : null}\n <h2 className=\"section-title\">{title}</h2>\n {description ? <p className=\"section-desc\">{description}</p> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AACtC,4BAAwB;AAOjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACmBI;AAjBJ,IAAM,eAA6C;AAAA,EACjD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AACR;AAGO,SAAS,MAAM;AAAA,EACpB,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,GAAG;A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AAA,KACjE;AAEJ;","names":["import_jsx_runtime","variantClass","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cn.ts","../src/components/badge.tsx","../src/components/button.tsx","../src/components/card.tsx","../src/components/code-area.tsx","../src/components/field.tsx","../src/components/container.tsx","../src/components/feedback.tsx","../src/components/preview-frame.tsx","../src/components/section.tsx","../src/components/slot-text-field.tsx","../src/components/text-selection.ts","../src/components/switch.tsx","../src/components/variable-picker.tsx"],"sourcesContent":["export { cn } from './cn';\n\nexport type { BadgeProps, BadgeVariant } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonProps, ButtonSize, ButtonVariant } from './components/button';\nexport { Button } from './components/button';\nexport type { CardPadding, CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CodeAreaProps } from './components/code-area';\nexport { CodeArea } from './components/code-area';\nexport type { ContainerProps } from './components/container';\nexport { Container } from './components/container';\nexport type { EmptyStateProps, SpinnerProps } from './components/feedback';\nexport { EmptyState, Spinner } from './components/feedback';\nexport type { FieldProps, InputProps, LabelProps } from './components/field';\nexport { Field, Input, Label } from './components/field';\nexport type { PreviewFrameProps } from './components/preview-frame';\nexport { PreviewFrame } from './components/preview-frame';\nexport type { SectionHeaderProps, SectionProps } from './components/section';\nexport { Section, SectionHeader } from './components/section';\nexport type { SlotTextFieldProps } from './components/slot-text-field';\nexport { SlotTextField } from './components/slot-text-field';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { VariablePickerProps } from './components/variable-picker';\nexport { VariablePicker } from './components/variable-picker';\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Merge class names, resolving conflicting Tailwind utilities (last wins).\n * Mirrors the helper used across the FloPay frontends so consumers can extend\n * any primitive's classes safely.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { HTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type BadgeVariant = 'neutral' | 'success' | 'warning' | 'danger' | 'info';\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Render a leading status dot. */\n dot?: boolean;\n /** Semantic color. `neutral` is the default outlined pill. */\n variant?: BadgeVariant;\n}\n\nconst variantClass: Record<BadgeVariant, string> = {\n neutral: '',\n success: 'badge-success',\n warning: 'badge-warning',\n danger: 'badge-danger',\n info: 'badge-info',\n};\n\n/** Pill badge — neutral by default, or a semantic variant, optionally with a dot. */\nexport function Badge({\n dot = false,\n variant = 'neutral',\n className,\n children,\n ...props\n}: BadgeProps) {\n return (\n <span className={cn('badge', variantClass[variant], className)} {...props}>\n {dot ? <span className=\"badge-dot\" /> : null}\n {children}\n </span>\n );\n}\n","import type { ButtonHTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'outline';\nexport type ButtonSize = 'md' | 'sm';\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nconst variantClass: Record<ButtonVariant, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n outline: 'btn-outline',\n};\n\nexport function Button({\n variant = 'primary',\n size = 'md',\n className,\n type = 'button',\n ...props\n}: ButtonProps) {\n return (\n <button\n type={type}\n className={cn(variantClass[variant], size === 'sm' && 'btn-sm', className)}\n {...props}\n />\n );\n}\n","import type { HTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type CardPadding = 'none' | 'sm' | 'md' | 'lg';\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n /** Inner padding. Defaults to `md` (28px); use `none` to supply your own. */\n padding?: CardPadding;\n /** Add pointer cursor + hover elevation (for clickable cards). */\n interactive?: boolean;\n}\n\n/** Bordered surface card. Static by default; opt into hover with `interactive`. */\nexport function Card({ padding = 'md', interactive = false, className, ...props }: CardProps) {\n return (\n <div\n className={cn(\n 'card',\n padding !== 'none' && `card-pad-${padding}`,\n interactive && 'card-interactive',\n className,\n )}\n {...props}\n />\n );\n}\n","import { type ChangeEventHandler, type ReactNode, type Ref, useId } from 'react';\nimport { Field } from './field';\n\nexport interface CodeAreaProps {\n label: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n value?: string;\n defaultValue?: string;\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /** Ref to the underlying textarea (the target a `VariablePicker` attaches to). */\n ref?: Ref<HTMLTextAreaElement>;\n id?: string;\n name?: string;\n className?: string;\n}\n\n/**\n * Labelled monospace textarea for custom HTML / Liquid source. No editor dependency (CTO decision\n * 1): spellcheck, autocapitalize, autocomplete and soft wrapping are off, and Tab keeps its normal\n * job of moving focus, so the field never traps keyboard users.\n */\nexport function CodeArea({\n label,\n hint,\n error,\n value,\n defaultValue,\n onChange,\n ref,\n id,\n name,\n className,\n}: CodeAreaProps) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n\n return (\n <Field label={label} hint={hint} error={error} htmlFor={controlId} className={className}>\n <textarea\n ref={ref}\n id={controlId}\n name={name}\n className=\"field code-area\"\n rows={12}\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n spellCheck={false}\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n wrap=\"off\"\n aria-invalid={error ? true : undefined}\n />\n </Field>\n );\n}\n","import type { InputHTMLAttributes, LabelHTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../cn';\n\nexport type InputProps = InputHTMLAttributes<HTMLInputElement>;\n\n/** Token-aligned text input (the `.field` look: border, surface, brand focus ring). */\nexport function Input({ className, ...props }: InputProps) {\n return <input className={cn('field', className)} {...props} />;\n}\n\nexport type LabelProps = LabelHTMLAttributes<HTMLLabelElement>;\n\nexport function Label({ className, ...props }: LabelProps) {\n // biome-ignore lint/a11y/noLabelWithoutControl: primitive pass-through: the caller supplies the control association (htmlFor, or the input as a child) through the spread props, which the rule cannot see\n return <label className={cn('field-label', className)} {...props} />;\n}\n\nexport interface FieldProps {\n label?: ReactNode;\n /** Helper text shown below the control (hidden when `error` is set). */\n hint?: ReactNode;\n /** Error text shown below the control (takes precedence over `hint`). */\n error?: ReactNode;\n /** `htmlFor` for the label, matching the control's id. */\n htmlFor?: string;\n className?: string;\n children: ReactNode;\n}\n\n/** Labelled field wrapper: optional label above and hint/error below the control. */\nexport function Field({ label, hint, error, htmlFor, className, children }: FieldProps) {\n const message = error || hint;\n return (\n <div className={cn('field-group', className)}>\n {label ? <Label htmlFor={htmlFor}>{label}</Label> : null}\n {children}\n {message ? <span className={error ? 'field-error' : 'field-hint'}>{message}</span> : null}\n </div>\n );\n}\n","import type { HTMLAttributes } from 'react';\nimport { cn } from '../cn';\n\nexport type ContainerProps = HTMLAttributes<HTMLDivElement>;\n\n/** Centered, max-width content wrapper (var(--max-w)) with horizontal padding. */\nexport function Container({ className, ...props }: ContainerProps) {\n return <div className={cn('container', className)} {...props} />;\n}\n","import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../cn';\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {\n /** Wrap in a centered, padded block (for loading states in a panel). */\n center?: boolean;\n}\n\n/** Brand-colored loading spinner. */\nexport function Spinner({ center = false, className, ...props }: SpinnerProps) {\n const spinner = (\n <span className={cn('spinner', className)} role=\"status\" aria-label=\"Loading\" {...props} />\n );\n return center ? <div className=\"spinner-center\">{spinner}</div> : spinner;\n}\n\nexport interface EmptyStateProps {\n title: ReactNode;\n description?: ReactNode;\n /** Optional icon rendered in the circular badge above the title. */\n icon?: ReactNode;\n className?: string;\n}\n\n/** Centered \"nothing here yet\" placeholder for empty lists/tables. */\nexport function EmptyState({ title, description, icon, className }: EmptyStateProps) {\n return (\n <div className={cn('empty-state', className)}>\n {icon ? <div className=\"empty-state-icon\">{icon}</div> : null}\n <h3 className=\"empty-state-title\">{title}</h3>\n {description ? <p className=\"empty-state-desc\">{description}</p> : null}\n </div>\n );\n}\n","import { cn } from '../cn';\n\nexport interface PreviewFrameProps {\n /** HTML shown inside the isolated frame. */\n html: string;\n /** Accessible title of the iframe. */\n title: string;\n className?: string;\n}\n\n/**\n * Container that previews client-authored email HTML in an iframe. The HTML goes in `srcdoc` and\n * the frame has the strictest sandbox (`sandbox=\"\"`, CTO decision 6): no scripts, forms, popups or\n * same-origin access, so a preview can never reach the dashboard session. Size it through\n * `className` on the container; the frame fills it.\n */\nexport function PreviewFrame({ html, title, className }: PreviewFrameProps) {\n return (\n <div className={cn('preview-frame', className)}>\n <iframe className=\"preview-frame-iframe\" title={title} srcDoc={html} sandbox=\"\" />\n </div>\n );\n}\n","import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../cn';\n\nexport type SectionProps = HTMLAttributes<HTMLElement>;\n\n/** Vertical page section with max-width and standard padding. */\nexport function Section({ className, ...props }: SectionProps) {\n return <section className={cn('section', className)} {...props} />;\n}\n\nexport interface SectionHeaderProps {\n /** Small eyebrow label above the title (brand colored). */\n label?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n className?: string;\n}\n\n/** Centered section heading: optional label, title, optional description. */\nexport function SectionHeader({ label, title, description, className }: SectionHeaderProps) {\n return (\n <div className={cn('section-center', className)}>\n {label ? <div className=\"section-label\">{label}</div> : null}\n <h2 className=\"section-title\">{title}</h2>\n {description ? <p className=\"section-desc\">{description}</p> : null}\n </div>\n );\n}\n","import {\n type ChangeEventHandler,\n type ReactNode,\n type Ref,\n useCallback,\n useId,\n useRef,\n} from 'react';\nimport { Field } from './field';\nimport {\n assignRef,\n editSelection,\n type TextControl,\n type TextEdit,\n watchFocus,\n} from './text-selection';\n\nexport interface SlotTextFieldProps {\n label: ReactNode;\n /** Helper text (hidden when `error` is set), as in `Field`. */\n hint?: ReactNode;\n /** Error text (takes precedence over `hint`), as in `Field`. */\n error?: ReactNode;\n /** Render a textarea instead of a single-line input. */\n multiline?: boolean;\n value?: string;\n defaultValue?: string;\n onChange?: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /** Ref to the underlying input / textarea (the target a `VariablePicker` attaches to). */\n ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;\n id?: string;\n name?: string;\n className?: string;\n}\n\nconst LINK_PLACEHOLDER = 'https://';\n\n/** Wrap the selection in a Markdown-lite marker, keeping the wrapped text selected. */\nfunction wrapWith(marker: string) {\n return (selected: string): TextEdit => ({\n text: `${marker}${selected}${marker}`,\n select: [marker.length, marker.length + selected.length],\n });\n}\n\n/** Turn the selection into `[label](https://)` and select the URL placeholder to type over. */\nfunction toLink(selected: string): TextEdit {\n const label = selected || 'link';\n const url = label.length + 3;\n return { text: `[${label}](${LINK_PLACEHOLDER})`, select: [url, url + LINK_PLACEHOLDER.length] };\n}\n\nconst FORMATS = [\n { name: 'Bold', edit: wrapWith('**') },\n { name: 'Italic', edit: wrapWith('_') },\n { name: 'Link', edit: toLink },\n] as const;\n\n/** The Markdown-lite subset (CTO decision 2) the toolbar writes, named in the default hint. */\nconst SYNTAX_HINT = 'Markdown-lite: **bold**, _italic_ and [link](https://…).';\nconst PARAGRAPH_HINT = ' A blank line starts a new paragraph.';\n\n/**\n * Labelled text field for an email slot, with a Bold / Italic / Link toolbar that writes only the\n * Markdown-lite subset. Single-line by default; `multiline` renders a textarea. Typed text reaches\n * `onChange` unchanged, and toolbar edits fire `onChange` too, so controlled parents stay in sync.\n */\nexport function SlotTextField({\n label,\n hint,\n error,\n multiline = false,\n value,\n defaultValue,\n onChange,\n ref,\n id,\n name,\n className,\n}: SlotTextFieldProps) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const control = useRef<TextControl | null>(null);\n\n const setControl = useCallback(\n (node: TextControl | null) => {\n control.current = node;\n if (node) watchFocus(node);\n assignRef(ref, node);\n },\n [ref],\n );\n\n const shared = {\n id: controlId,\n name,\n value,\n defaultValue,\n onChange,\n className: multiline ? 'field field-multiline' : 'field',\n 'aria-invalid': error ? true : undefined,\n };\n\n return (\n <Field\n label={label}\n hint={hint ?? (multiline ? SYNTAX_HINT + PARAGRAPH_HINT : SYNTAX_HINT)}\n error={error}\n htmlFor={controlId}\n className={className}\n >\n <div className=\"slot-toolbar\">\n {FORMATS.map((format) => (\n <button\n key={format.name}\n type=\"button\"\n className=\"slot-toolbar-button\"\n onClick={() => {\n if (control.current) editSelection(control.current, format.edit);\n }}\n >\n {format.name}\n </button>\n ))}\n </div>\n {multiline ? (\n <textarea ref={setControl} rows={4} {...shared} />\n ) : (\n <input ref={setControl} type=\"text\" {...shared} />\n )}\n </Field>\n );\n}\n","import type { Ref } from 'react';\n\n/** The native controls the editor blocks edit: a `SlotTextField` input/textarea or a `CodeArea`. */\nexport type TextControl = HTMLInputElement | HTMLTextAreaElement;\n\n/** An edit at the selection: the text that replaces it, and the selection to leave inside that text. */\nexport interface TextEdit {\n text: string;\n /** Selection after the edit, as `[start, end]` offsets into `text`. */\n select: [number, number];\n}\n\nconst watched = new WeakSet<TextControl>();\nconst focused = new WeakSet<TextControl>();\n\n/**\n * Start remembering whether `control` has ever had focus. A control that never had focus has no\n * cursor the user chose, so `editSelection` appends to it instead of editing at offset 0.\n */\nexport function watchFocus(control: TextControl): void {\n if (watched.has(control)) return;\n watched.add(control);\n if (control.ownerDocument.activeElement === control) {\n focused.add(control);\n return;\n }\n control.addEventListener('focus', () => focused.add(control), { once: true });\n}\n\n/**\n * Set the value the way typing does, so React's change handler fires for a controlled control:\n * the prototype's setter bypasses React's value tracker, then an `input` event reports the change.\n */\nfunction setValueAsTyped(control: TextControl, value: string): void {\n const { set } = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(control), 'value') ?? {};\n set?.call(control, value);\n control.dispatchEvent(new Event('input', { bubbles: true }));\n}\n\n/**\n * Replace the control's selection with the edit `build` makes from the selected text (or append it,\n * when the control never had focus), fire its change handler, then return focus to it with the\n * selection the edit asks for. The Markdown-lite toolbar and the variable picker both edit through\n * this one helper, so they behave the same way.\n */\nexport function editSelection(control: TextControl, build: (selected: string) => TextEdit): void {\n const { value } = control;\n const hadFocus = focused.has(control);\n const start = hadFocus ? (control.selectionStart ?? value.length) : value.length;\n const end = hadFocus ? (control.selectionEnd ?? start) : value.length;\n const edit = build(value.slice(start, end));\n\n setValueAsTyped(control, value.slice(0, start) + edit.text + value.slice(end));\n control.focus();\n control.setSelectionRange(start + edit.select[0], start + edit.select[1]);\n}\n\n/** Point a caller's ref (callback or object) at `node`, for components that also keep their own. */\nexport function assignRef<T>(ref: Ref<T> | undefined, node: T | null): void {\n if (typeof ref === 'function') {\n ref(node);\n return;\n }\n if (ref) ref.current = node;\n}\n","import { type MouseEvent, type ReactNode, useId, useState } from 'react';\nimport { cn } from '../cn';\nimport { Spinner } from './feedback';\n\nexport interface SwitchProps {\n /** Accessible name of the switch. Always rendered; `labelHidden` only hides it visually. */\n label: ReactNode;\n labelHidden?: boolean;\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n disabled?: boolean;\n loading?: boolean;\n id?: string;\n name?: string;\n className?: string;\n}\n\n/** A busy switch ignores pointer presses entirely: no toggle, and no focus move on mouse down. */\nfunction ignorePress(event: MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n}\n\n/**\n * On/off switch: a native `<button role=\"switch\">` (WAI-ARIA switch pattern), so Tab, Space and\n * Enter work without extra wiring. Controlled with `checked` + `onCheckedChange`, or uncontrolled\n * with `defaultChecked`. While `loading` it stays reachable with Tab and keeps its state, announces\n * busy and ignores presses; the parent flips `checked` once the save resolves. `labelHidden` keeps\n * the accessible name but hides the label text (for table rows that are labelled by their column).\n * With `name`, a checked switch submits `name=on` in a form, as a checkbox does; like a disabled\n * checkbox, a disabled switch submits nothing.\n */\nexport function Switch({\n label,\n labelHidden = false,\n checked,\n defaultChecked = false,\n onCheckedChange,\n disabled = false,\n loading = false,\n id,\n name,\n className,\n}: SwitchProps) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const labelId = `${controlId}-label`;\n const [ownChecked, setOwnChecked] = useState(defaultChecked);\n const isChecked = checked ?? ownChecked;\n\n const toggle = () => {\n if (loading) return;\n const next = !isChecked;\n if (checked === undefined) setOwnChecked(next);\n onCheckedChange?.(next);\n };\n\n return (\n <span className={cn('switch', className)}>\n <button\n type=\"button\"\n role=\"switch\"\n id={controlId}\n className=\"switch-control\"\n aria-checked={isChecked}\n aria-labelledby={labelId}\n aria-busy={loading || undefined}\n aria-disabled={loading || undefined}\n disabled={disabled}\n onMouseDown={loading ? ignorePress : undefined}\n onClick={toggle}\n >\n <span className=\"switch-thumb\" aria-hidden=\"true\" />\n </button>\n <label\n id={labelId}\n htmlFor={controlId}\n className={cn('switch-label', labelHidden && 'visually-hidden')}\n >\n {label}\n </label>\n {loading ? <Spinner className=\"switch-spinner\" /> : null}\n {name && isChecked && !disabled ? <input type=\"hidden\" name={name} value=\"on\" /> : null}\n </span>\n );\n}\n","import {\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n type RefObject,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { cn } from '../cn';\nimport { editSelection, watchFocus } from './text-selection';\n\nexport interface VariablePickerProps {\n variables: ReadonlyArray<{ name: string; label: string }>;\n /** The `SlotTextField` / `CodeArea` control the chosen `{{ name }}` token is inserted into. */\n targetRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n className?: string;\n}\n\n/** The Liquid output tag for a variable (CTO decision 3). */\nfunction liquidToken(name: string): string {\n return `{{ ${name} }}`;\n}\n\n/** Keep focus where it is on press, so the target keeps its selection and the menu stays open. */\nfunction keepFocus(event: MouseEvent) {\n event.preventDefault();\n}\n\n/**\n * \"Insert variable\" menu button (WAI-ARIA menu-button pattern) for a `SlotTextField` or `CodeArea`.\n * Choosing a variable replaces the target's selection with `{{ name }}` (or appends it, if the\n * target never had focus), fires the target's change handler and returns focus to the target with\n * the cursor after the token. The variable list is a prop; the picker fetches nothing.\n */\nexport function VariablePicker({ variables, targetRef, className }: VariablePickerProps) {\n const menuId = useId();\n const trigger = useRef<HTMLButtonElement>(null);\n const menu = useRef<HTMLDivElement>(null);\n const items = useRef<(HTMLButtonElement | null)[]>([]);\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(0);\n const count = variables.length;\n\n // The target may only mount or change after the picker, so look for it after every render.\n useEffect(() => {\n if (targetRef.current) watchFocus(targetRef.current);\n });\n\n useEffect(() => {\n if (open) items.current[active]?.focus();\n }, [open, active]);\n\n const openAt = (index: number) => {\n setActive(index);\n setOpen(true);\n };\n\n const close = () => {\n setOpen(false);\n trigger.current?.focus();\n };\n\n const choose = (name: string) => {\n setOpen(false);\n const control = targetRef.current;\n if (!control) {\n trigger.current?.focus();\n return;\n }\n const token = liquidToken(name);\n editSelection(control, () => ({ text: token, select: [token.length, token.length] }));\n };\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n const first = new Map([\n ['ArrowDown', 0],\n ['ArrowUp', count - 1],\n ]).get(event.key);\n if (first === undefined) return;\n event.preventDefault();\n openAt(first);\n };\n\n const onItemKeyDown = (event: KeyboardEvent<HTMLButtonElement>, index: number) => {\n const next = new Map([\n ['ArrowDown', (index + 1) % count],\n ['ArrowUp', (index - 1 + count) % count],\n ['Home', 0],\n ['End', count - 1],\n ]).get(event.key);\n if (next !== undefined) {\n event.preventDefault();\n setActive(next);\n return;\n }\n if (event.key !== 'Escape') return;\n event.preventDefault();\n close();\n };\n\n // Close when focus leaves the list: Tab or Shift+Tab, or a click anywhere else.\n const onItemBlur = (event: FocusEvent<HTMLButtonElement>) => {\n if (!menu.current?.contains(event.relatedTarget)) setOpen(false);\n };\n\n return (\n <div className={cn('variable-picker', className)}>\n <button\n ref={trigger}\n type=\"button\"\n className=\"variable-picker-trigger\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n disabled={count === 0}\n onMouseDown={keepFocus}\n onClick={() => {\n if (open) close();\n else openAt(0);\n }}\n onKeyDown={onTriggerKeyDown}\n >\n Insert variable\n </button>\n {open ? (\n <div\n ref={menu}\n id={menuId}\n role=\"menu\"\n aria-label=\"Variables\"\n className=\"variable-picker-menu\"\n >\n {variables.map((variable, index) => (\n <button\n key={variable.name}\n ref={(node) => {\n items.current[index] = node;\n }}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n className=\"variable-picker-item\"\n onMouseDown={keepFocus}\n onClick={() => choose(variable.name)}\n onKeyDown={(event) => onItemKeyDown(event, index)}\n onBlur={onItemBlur}\n >\n <span className=\"variable-picker-item-label\">{variable.label}</span>\n <code className=\"variable-picker-item-token\">{liquidToken(variable.name)}</code>\n </button>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AACtC,4BAAwB;AAOjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACmBI;AAjBJ,IAAM,eAA6C;AAAA,EACjD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AACR;AAGO,SAAS,MAAM;AAAA,EACpB,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAe;AACb,SACE,6CAAC,UAAK,WAAW,GAAG,SAAS,aAAa,OAAO,GAAG,SAAS,GAAI,GAAG,OACjE;AAAA,UAAM,4CAAC,UAAK,WAAU,aAAY,IAAK;AAAA,IACvC;AAAA,KACH;AAEJ;;;ACTI,IAAAA,sBAAA;AAdJ,IAAMC,gBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS;AACX;AAEO,SAAS,OAAO;AAAA,EACrB,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA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8B,sBAAY,SAAS,IAAI,GAAE;AAAA;AAAA;AAAA,UAdpE,SAAS;AAAA,QAehB,CACD;AAAA;AAAA,IACH,IACE;AAAA,KACN;AAEJ;","names":["import_jsx_runtime","variantClass","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { HTMLAttributes, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, LabelHTMLAttributes } from 'react';
|
|
3
|
+
import { HTMLAttributes, ButtonHTMLAttributes, ReactNode, ChangeEventHandler, Ref, InputHTMLAttributes, LabelHTMLAttributes, RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Merge class names, resolving conflicting Tailwind utilities (last wins).
|
|
@@ -37,6 +37,26 @@ interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
37
|
/** Bordered surface card. Static by default; opt into hover with `interactive`. */
|
|
38
38
|
declare function Card({ padding, interactive, className, ...props }: CardProps): react.JSX.Element;
|
|
39
39
|
|
|
40
|
+
interface CodeAreaProps {
|
|
41
|
+
label: ReactNode;
|
|
42
|
+
hint?: ReactNode;
|
|
43
|
+
error?: ReactNode;
|
|
44
|
+
value?: string;
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
47
|
+
/** Ref to the underlying textarea (the target a `VariablePicker` attaches to). */
|
|
48
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
49
|
+
id?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Labelled monospace textarea for custom HTML / Liquid source. No editor dependency (CTO decision
|
|
55
|
+
* 1): spellcheck, autocapitalize, autocomplete and soft wrapping are off, and Tab keeps its normal
|
|
56
|
+
* job of moving focus, so the field never traps keyboard users.
|
|
57
|
+
*/
|
|
58
|
+
declare function CodeArea({ label, hint, error, value, defaultValue, onChange, ref, id, name, className, }: CodeAreaProps): react.JSX.Element;
|
|
59
|
+
|
|
40
60
|
type ContainerProps = HTMLAttributes<HTMLDivElement>;
|
|
41
61
|
/** Centered, max-width content wrapper (var(--max-w)) with horizontal padding. */
|
|
42
62
|
declare function Container({ className, ...props }: ContainerProps): react.JSX.Element;
|
|
@@ -76,6 +96,21 @@ interface FieldProps {
|
|
|
76
96
|
/** Labelled field wrapper: optional label above and hint/error below the control. */
|
|
77
97
|
declare function Field({ label, hint, error, htmlFor, className, children }: FieldProps): react.JSX.Element;
|
|
78
98
|
|
|
99
|
+
interface PreviewFrameProps {
|
|
100
|
+
/** HTML shown inside the isolated frame. */
|
|
101
|
+
html: string;
|
|
102
|
+
/** Accessible title of the iframe. */
|
|
103
|
+
title: string;
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Container that previews client-authored email HTML in an iframe. The HTML goes in `srcdoc` and
|
|
108
|
+
* the frame has the strictest sandbox (`sandbox=""`, CTO decision 6): no scripts, forms, popups or
|
|
109
|
+
* same-origin access, so a preview can never reach the dashboard session. Size it through
|
|
110
|
+
* `className` on the container; the frame fills it.
|
|
111
|
+
*/
|
|
112
|
+
declare function PreviewFrame({ html, title, className }: PreviewFrameProps): react.JSX.Element;
|
|
113
|
+
|
|
79
114
|
type SectionProps = HTMLAttributes<HTMLElement>;
|
|
80
115
|
/** Vertical page section with max-width and standard padding. */
|
|
81
116
|
declare function Section({ className, ...props }: SectionProps): react.JSX.Element;
|
|
@@ -89,4 +124,69 @@ interface SectionHeaderProps {
|
|
|
89
124
|
/** Centered section heading: optional label, title, optional description. */
|
|
90
125
|
declare function SectionHeader({ label, title, description, className }: SectionHeaderProps): react.JSX.Element;
|
|
91
126
|
|
|
92
|
-
|
|
127
|
+
interface SlotTextFieldProps {
|
|
128
|
+
label: ReactNode;
|
|
129
|
+
/** Helper text (hidden when `error` is set), as in `Field`. */
|
|
130
|
+
hint?: ReactNode;
|
|
131
|
+
/** Error text (takes precedence over `hint`), as in `Field`. */
|
|
132
|
+
error?: ReactNode;
|
|
133
|
+
/** Render a textarea instead of a single-line input. */
|
|
134
|
+
multiline?: boolean;
|
|
135
|
+
value?: string;
|
|
136
|
+
defaultValue?: string;
|
|
137
|
+
onChange?: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
138
|
+
/** Ref to the underlying input / textarea (the target a `VariablePicker` attaches to). */
|
|
139
|
+
ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
140
|
+
id?: string;
|
|
141
|
+
name?: string;
|
|
142
|
+
className?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Labelled text field for an email slot, with a Bold / Italic / Link toolbar that writes only the
|
|
146
|
+
* Markdown-lite subset. Single-line by default; `multiline` renders a textarea. Typed text reaches
|
|
147
|
+
* `onChange` unchanged, and toolbar edits fire `onChange` too, so controlled parents stay in sync.
|
|
148
|
+
*/
|
|
149
|
+
declare function SlotTextField({ label, hint, error, multiline, value, defaultValue, onChange, ref, id, name, className, }: SlotTextFieldProps): react.JSX.Element;
|
|
150
|
+
|
|
151
|
+
interface SwitchProps {
|
|
152
|
+
/** Accessible name of the switch. Always rendered; `labelHidden` only hides it visually. */
|
|
153
|
+
label: ReactNode;
|
|
154
|
+
labelHidden?: boolean;
|
|
155
|
+
checked?: boolean;
|
|
156
|
+
defaultChecked?: boolean;
|
|
157
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
158
|
+
disabled?: boolean;
|
|
159
|
+
loading?: boolean;
|
|
160
|
+
id?: string;
|
|
161
|
+
name?: string;
|
|
162
|
+
className?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* On/off switch: a native `<button role="switch">` (WAI-ARIA switch pattern), so Tab, Space and
|
|
166
|
+
* Enter work without extra wiring. Controlled with `checked` + `onCheckedChange`, or uncontrolled
|
|
167
|
+
* with `defaultChecked`. While `loading` it stays reachable with Tab and keeps its state, announces
|
|
168
|
+
* busy and ignores presses; the parent flips `checked` once the save resolves. `labelHidden` keeps
|
|
169
|
+
* the accessible name but hides the label text (for table rows that are labelled by their column).
|
|
170
|
+
* With `name`, a checked switch submits `name=on` in a form, as a checkbox does; like a disabled
|
|
171
|
+
* checkbox, a disabled switch submits nothing.
|
|
172
|
+
*/
|
|
173
|
+
declare function Switch({ label, labelHidden, checked, defaultChecked, onCheckedChange, disabled, loading, id, name, className, }: SwitchProps): react.JSX.Element;
|
|
174
|
+
|
|
175
|
+
interface VariablePickerProps {
|
|
176
|
+
variables: ReadonlyArray<{
|
|
177
|
+
name: string;
|
|
178
|
+
label: string;
|
|
179
|
+
}>;
|
|
180
|
+
/** The `SlotTextField` / `CodeArea` control the chosen `{{ name }}` token is inserted into. */
|
|
181
|
+
targetRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
182
|
+
className?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* "Insert variable" menu button (WAI-ARIA menu-button pattern) for a `SlotTextField` or `CodeArea`.
|
|
186
|
+
* Choosing a variable replaces the target's selection with `{{ name }}` (or appends it, if the
|
|
187
|
+
* target never had focus), fires the target's change handler and returns focus to the target with
|
|
188
|
+
* the cursor after the token. The variable list is a prop; the picker fetches nothing.
|
|
189
|
+
*/
|
|
190
|
+
declare function VariablePicker({ variables, targetRef, className }: VariablePickerProps): react.JSX.Element;
|
|
191
|
+
|
|
192
|
+
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardPadding, type CardProps, CodeArea, type CodeAreaProps, Container, type ContainerProps, EmptyState, type EmptyStateProps, Field, type FieldProps, Input, type InputProps, Label, type LabelProps, PreviewFrame, type PreviewFrameProps, Section, SectionHeader, type SectionHeaderProps, type SectionProps, SlotTextField, type SlotTextFieldProps, Spinner, type SpinnerProps, Switch, type SwitchProps, VariablePicker, type VariablePickerProps, cn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { HTMLAttributes, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, LabelHTMLAttributes } from 'react';
|
|
3
|
+
import { HTMLAttributes, ButtonHTMLAttributes, ReactNode, ChangeEventHandler, Ref, InputHTMLAttributes, LabelHTMLAttributes, RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Merge class names, resolving conflicting Tailwind utilities (last wins).
|
|
@@ -37,6 +37,26 @@ interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
37
|
/** Bordered surface card. Static by default; opt into hover with `interactive`. */
|
|
38
38
|
declare function Card({ padding, interactive, className, ...props }: CardProps): react.JSX.Element;
|
|
39
39
|
|
|
40
|
+
interface CodeAreaProps {
|
|
41
|
+
label: ReactNode;
|
|
42
|
+
hint?: ReactNode;
|
|
43
|
+
error?: ReactNode;
|
|
44
|
+
value?: string;
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
47
|
+
/** Ref to the underlying textarea (the target a `VariablePicker` attaches to). */
|
|
48
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
49
|
+
id?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Labelled monospace textarea for custom HTML / Liquid source. No editor dependency (CTO decision
|
|
55
|
+
* 1): spellcheck, autocapitalize, autocomplete and soft wrapping are off, and Tab keeps its normal
|
|
56
|
+
* job of moving focus, so the field never traps keyboard users.
|
|
57
|
+
*/
|
|
58
|
+
declare function CodeArea({ label, hint, error, value, defaultValue, onChange, ref, id, name, className, }: CodeAreaProps): react.JSX.Element;
|
|
59
|
+
|
|
40
60
|
type ContainerProps = HTMLAttributes<HTMLDivElement>;
|
|
41
61
|
/** Centered, max-width content wrapper (var(--max-w)) with horizontal padding. */
|
|
42
62
|
declare function Container({ className, ...props }: ContainerProps): react.JSX.Element;
|
|
@@ -76,6 +96,21 @@ interface FieldProps {
|
|
|
76
96
|
/** Labelled field wrapper: optional label above and hint/error below the control. */
|
|
77
97
|
declare function Field({ label, hint, error, htmlFor, className, children }: FieldProps): react.JSX.Element;
|
|
78
98
|
|
|
99
|
+
interface PreviewFrameProps {
|
|
100
|
+
/** HTML shown inside the isolated frame. */
|
|
101
|
+
html: string;
|
|
102
|
+
/** Accessible title of the iframe. */
|
|
103
|
+
title: string;
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Container that previews client-authored email HTML in an iframe. The HTML goes in `srcdoc` and
|
|
108
|
+
* the frame has the strictest sandbox (`sandbox=""`, CTO decision 6): no scripts, forms, popups or
|
|
109
|
+
* same-origin access, so a preview can never reach the dashboard session. Size it through
|
|
110
|
+
* `className` on the container; the frame fills it.
|
|
111
|
+
*/
|
|
112
|
+
declare function PreviewFrame({ html, title, className }: PreviewFrameProps): react.JSX.Element;
|
|
113
|
+
|
|
79
114
|
type SectionProps = HTMLAttributes<HTMLElement>;
|
|
80
115
|
/** Vertical page section with max-width and standard padding. */
|
|
81
116
|
declare function Section({ className, ...props }: SectionProps): react.JSX.Element;
|
|
@@ -89,4 +124,69 @@ interface SectionHeaderProps {
|
|
|
89
124
|
/** Centered section heading: optional label, title, optional description. */
|
|
90
125
|
declare function SectionHeader({ label, title, description, className }: SectionHeaderProps): react.JSX.Element;
|
|
91
126
|
|
|
92
|
-
|
|
127
|
+
interface SlotTextFieldProps {
|
|
128
|
+
label: ReactNode;
|
|
129
|
+
/** Helper text (hidden when `error` is set), as in `Field`. */
|
|
130
|
+
hint?: ReactNode;
|
|
131
|
+
/** Error text (takes precedence over `hint`), as in `Field`. */
|
|
132
|
+
error?: ReactNode;
|
|
133
|
+
/** Render a textarea instead of a single-line input. */
|
|
134
|
+
multiline?: boolean;
|
|
135
|
+
value?: string;
|
|
136
|
+
defaultValue?: string;
|
|
137
|
+
onChange?: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
138
|
+
/** Ref to the underlying input / textarea (the target a `VariablePicker` attaches to). */
|
|
139
|
+
ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
140
|
+
id?: string;
|
|
141
|
+
name?: string;
|
|
142
|
+
className?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Labelled text field for an email slot, with a Bold / Italic / Link toolbar that writes only the
|
|
146
|
+
* Markdown-lite subset. Single-line by default; `multiline` renders a textarea. Typed text reaches
|
|
147
|
+
* `onChange` unchanged, and toolbar edits fire `onChange` too, so controlled parents stay in sync.
|
|
148
|
+
*/
|
|
149
|
+
declare function SlotTextField({ label, hint, error, multiline, value, defaultValue, onChange, ref, id, name, className, }: SlotTextFieldProps): react.JSX.Element;
|
|
150
|
+
|
|
151
|
+
interface SwitchProps {
|
|
152
|
+
/** Accessible name of the switch. Always rendered; `labelHidden` only hides it visually. */
|
|
153
|
+
label: ReactNode;
|
|
154
|
+
labelHidden?: boolean;
|
|
155
|
+
checked?: boolean;
|
|
156
|
+
defaultChecked?: boolean;
|
|
157
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
158
|
+
disabled?: boolean;
|
|
159
|
+
loading?: boolean;
|
|
160
|
+
id?: string;
|
|
161
|
+
name?: string;
|
|
162
|
+
className?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* On/off switch: a native `<button role="switch">` (WAI-ARIA switch pattern), so Tab, Space and
|
|
166
|
+
* Enter work without extra wiring. Controlled with `checked` + `onCheckedChange`, or uncontrolled
|
|
167
|
+
* with `defaultChecked`. While `loading` it stays reachable with Tab and keeps its state, announces
|
|
168
|
+
* busy and ignores presses; the parent flips `checked` once the save resolves. `labelHidden` keeps
|
|
169
|
+
* the accessible name but hides the label text (for table rows that are labelled by their column).
|
|
170
|
+
* With `name`, a checked switch submits `name=on` in a form, as a checkbox does; like a disabled
|
|
171
|
+
* checkbox, a disabled switch submits nothing.
|
|
172
|
+
*/
|
|
173
|
+
declare function Switch({ label, labelHidden, checked, defaultChecked, onCheckedChange, disabled, loading, id, name, className, }: SwitchProps): react.JSX.Element;
|
|
174
|
+
|
|
175
|
+
interface VariablePickerProps {
|
|
176
|
+
variables: ReadonlyArray<{
|
|
177
|
+
name: string;
|
|
178
|
+
label: string;
|
|
179
|
+
}>;
|
|
180
|
+
/** The `SlotTextField` / `CodeArea` control the chosen `{{ name }}` token is inserted into. */
|
|
181
|
+
targetRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
182
|
+
className?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* "Insert variable" menu button (WAI-ARIA menu-button pattern) for a `SlotTextField` or `CodeArea`.
|
|
186
|
+
* Choosing a variable replaces the target's selection with `{{ name }}` (or appends it, if the
|
|
187
|
+
* target never had focus), fires the target's change handler and returns focus to the target with
|
|
188
|
+
* the cursor after the token. The variable list is a prop; the picker fetches nothing.
|
|
189
|
+
*/
|
|
190
|
+
declare function VariablePicker({ variables, targetRef, className }: VariablePickerProps): react.JSX.Element;
|
|
191
|
+
|
|
192
|
+
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardPadding, type CardProps, CodeArea, type CodeAreaProps, Container, type ContainerProps, EmptyState, type EmptyStateProps, Field, type FieldProps, Input, type InputProps, Label, type LabelProps, PreviewFrame, type PreviewFrameProps, Section, SectionHeader, type SectionHeaderProps, type SectionProps, SlotTextField, type SlotTextFieldProps, Spinner, type SpinnerProps, Switch, type SwitchProps, VariablePicker, type VariablePickerProps, cn };
|