@flopay/ui 1.9.3 → 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 +131 -13
- package/dist/annotations/index.cjs.map +1 -1
- package/dist/annotations/index.d.cts +1 -1
- package/dist/annotations/index.d.ts +1 -1
- package/dist/annotations/index.mjs.map +1 -1
- 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 +17 -11
- package/styles/components.css +236 -0
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 };
|