entasis 0.13.5 → 0.13.6
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/dist/components/Address/Address.svelte +44 -0
- package/dist/components/Address/Address.svelte.d.ts +4 -0
- package/dist/components/Address/address.d.ts +99 -0
- package/dist/components/Address/address.google.d.ts +89 -0
- package/dist/components/Address/address.google.fixtures.json +808 -0
- package/dist/components/Address/address.google.js +184 -0
- package/dist/components/Address/address.js +109 -0
- package/dist/components/Address/address.mcp.d.ts +1 -0
- package/dist/components/Address/address.mcp.js +100 -0
- package/dist/components/Address/address.props.d.ts +26 -0
- package/dist/components/Address/address.props.js +1 -0
- package/dist/components/Address/address.provider.d.ts +19 -0
- package/dist/components/Address/address.provider.js +69 -0
- package/dist/components/Address/address.theme.d.ts +63 -0
- package/dist/components/Address/address.theme.js +42 -0
- package/dist/components/Address/index.d.ts +6 -0
- package/dist/components/Address/index.js +5 -0
- package/dist/components/Form/AddressInput/AddressInput.svelte +482 -0
- package/dist/components/Form/AddressInput/AddressInput.svelte.d.ts +4 -0
- package/dist/components/Form/AddressInput/addressInput.mcp.d.ts +1 -0
- package/dist/components/Form/AddressInput/addressInput.mcp.js +110 -0
- package/dist/components/Form/AddressInput/addressInput.props.d.ts +72 -0
- package/dist/components/Form/AddressInput/addressInput.props.js +1 -0
- package/dist/components/Form/AddressInput/addressInput.theme.d.ts +63 -0
- package/dist/components/Form/AddressInput/addressInput.theme.js +55 -0
- package/dist/components/Form/AddressInput/index.d.ts +3 -0
- package/dist/components/Form/AddressInput/index.js +2 -0
- package/dist/components/Form/Field/field.d.ts +5 -2
- package/dist/components/Form/Field/field.state.svelte.js +4 -0
- package/dist/components/Form/Field/index.d.ts +1 -1
- package/dist/components/Form/Field/schemas.js +8 -0
- package/dist/components/Form/Form/FormInputRenderer.svelte +6 -0
- package/dist/components/Form/Form/form.d.ts +6 -0
- package/dist/components/Form/Form/form.mcp.d.ts +1 -1
- package/dist/components/Form/Form/form.mcp.js +1 -1
- package/dist/components/Form/Form/form.state.svelte.d.ts +142 -11
- package/dist/components/Form/Form/form.state.svelte.js +2 -0
- package/dist/components/Form/Form/visibility.d.ts +186 -20
- package/dist/components/Form/MultiStepForm/multiStepForm.state.svelte.d.ts +136 -0
- package/dist/components/Form/SignatureInput/SignatureInput.svelte +327 -0
- package/dist/components/Form/SignatureInput/SignatureInput.svelte.d.ts +4 -0
- package/dist/components/Form/SignatureInput/index.d.ts +4 -0
- package/dist/components/Form/SignatureInput/index.js +2 -0
- package/dist/components/Form/SignatureInput/signatureInput.mcp.d.ts +1 -0
- package/dist/components/Form/SignatureInput/signatureInput.mcp.js +74 -0
- package/dist/components/Form/SignatureInput/signatureInput.props.d.ts +29 -0
- package/dist/components/Form/SignatureInput/signatureInput.props.js +1 -0
- package/dist/components/Form/SignatureInput/signatureInput.strokes.d.ts +77 -0
- package/dist/components/Form/SignatureInput/signatureInput.strokes.js +149 -0
- package/dist/components/Form/SignatureInput/signatureInput.theme.d.ts +99 -0
- package/dist/components/Form/SignatureInput/signatureInput.theme.js +70 -0
- package/dist/generated/componentAliases.d.ts +3 -0
- package/dist/generated/componentAliases.js +3 -0
- package/dist/generated/componentContract.d.ts +46 -1
- package/dist/generated/componentContract.js +113 -0
- package/dist/generated/componentMcpRegistry.js +6 -0
- package/dist/i18n/ar.js +18 -0
- package/dist/i18n/de.js +18 -0
- package/dist/i18n/en.d.ts +18 -0
- package/dist/i18n/en.js +18 -0
- package/dist/i18n/es.js +18 -0
- package/dist/i18n/fr.js +18 -0
- package/dist/i18n/ja.js +18 -0
- package/dist/i18n/pt.js +18 -0
- package/dist/i18n/zh.js +18 -0
- package/package.json +25 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strokes of a signature and the images they export to. Pure geometry: no DOM except the
|
|
3
|
+
* canvas context a caller passes in, so it runs the same in a test, on the pad and on export.
|
|
4
|
+
*/
|
|
5
|
+
/** One sampled pointer position, in CSS pixels of the pad. */
|
|
6
|
+
export type SignaturePoint = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
/** Pen pressure from 0 to 1. Mouse and touch report 0.5. */
|
|
10
|
+
pressure: number;
|
|
11
|
+
};
|
|
12
|
+
/** One continuous line, from a pointer down to its pointer up. */
|
|
13
|
+
export type SignatureStroke = readonly SignaturePoint[];
|
|
14
|
+
export type SignatureBounds = {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
/** Exported image format: a PNG or an SVG, each as a data URL. */
|
|
21
|
+
export type SignatureFormat = 'png' | 'svg';
|
|
22
|
+
export type SignatureRenderOptions = {
|
|
23
|
+
/** CSS color of the ink. */
|
|
24
|
+
color: string;
|
|
25
|
+
/** Base line width in CSS pixels, at a pressure of 0.5. */
|
|
26
|
+
width: number;
|
|
27
|
+
};
|
|
28
|
+
/** Width of a segment drawn at `pressure`: half the base at no pressure, 1.5 times at full. */
|
|
29
|
+
export declare const strokeWidthAt: (pressure: number, width: number) => number;
|
|
30
|
+
/**
|
|
31
|
+
* The segments a stroke is drawn as: quadratic curves through the midpoints of its samples, so
|
|
32
|
+
* the line is smooth however coarse the pointer events were. Each segment carries the pressure it
|
|
33
|
+
* is drawn at, so a pen's line thickens and thins along the way.
|
|
34
|
+
*/
|
|
35
|
+
export declare function strokeSegments(stroke: SignatureStroke): {
|
|
36
|
+
from: SignaturePoint;
|
|
37
|
+
control: SignaturePoint;
|
|
38
|
+
to: SignaturePoint;
|
|
39
|
+
pressure: number;
|
|
40
|
+
}[];
|
|
41
|
+
/** Draws `strokes` on a 2D context already scaled to CSS pixels. A tap draws a dot. */
|
|
42
|
+
export declare function drawStrokes(context: CanvasRenderingContext2D, strokes: readonly SignatureStroke[], { color, width }: SignatureRenderOptions): void;
|
|
43
|
+
/** The box the ink covers, line width included, or null when there is no ink. */
|
|
44
|
+
export declare function strokesBounds(strokes: readonly SignatureStroke[], width: number): SignatureBounds | null;
|
|
45
|
+
/** One drawable piece of a stroke: a dot for a tap, or a path at one line width. */
|
|
46
|
+
export type SignatureShape = {
|
|
47
|
+
kind: 'dot';
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
r: number;
|
|
51
|
+
} | {
|
|
52
|
+
kind: 'path';
|
|
53
|
+
d: string;
|
|
54
|
+
width: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The shapes a stroke draws as, in SVG path syntax, shifted by `offset`. Consecutive segments
|
|
58
|
+
* at the same width share one path, so a mouse or finger stroke is a single path and only a
|
|
59
|
+
* pen's changing pressure splits it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function strokeShapes(stroke: SignatureStroke, width: number, offset?: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
}): SignatureShape[];
|
|
65
|
+
/** A standalone SVG of the strokes, cropped to the ink plus `padding`. */
|
|
66
|
+
export declare function strokesToSvg(strokes: readonly SignatureStroke[], { color, width, padding }: SignatureRenderOptions & {
|
|
67
|
+
padding: number;
|
|
68
|
+
}): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Exports the strokes as a data URL cropped to the ink plus `padding`: an SVG, or a PNG drawn at
|
|
71
|
+
* `scale` device pixels per CSS pixel so it stays sharp in a document. Null when there is no ink.
|
|
72
|
+
*/
|
|
73
|
+
export declare function exportStrokes(strokes: readonly SignatureStroke[], { format, color, width, padding, scale }: SignatureRenderOptions & {
|
|
74
|
+
format: SignatureFormat;
|
|
75
|
+
padding: number;
|
|
76
|
+
scale: number;
|
|
77
|
+
}): string | null;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strokes of a signature and the images they export to. Pure geometry: no DOM except the
|
|
3
|
+
* canvas context a caller passes in, so it runs the same in a test, on the pad and on export.
|
|
4
|
+
*/
|
|
5
|
+
/** Width of a segment drawn at `pressure`: half the base at no pressure, 1.5 times at full. */
|
|
6
|
+
export const strokeWidthAt = (pressure, width) => width * (0.5 + Math.min(Math.max(pressure, 0), 1));
|
|
7
|
+
const midpoint = (a, b) => ({
|
|
8
|
+
x: (a.x + b.x) / 2,
|
|
9
|
+
y: (a.y + b.y) / 2,
|
|
10
|
+
pressure: (a.pressure + b.pressure) / 2
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* The segments a stroke is drawn as: quadratic curves through the midpoints of its samples, so
|
|
14
|
+
* the line is smooth however coarse the pointer events were. Each segment carries the pressure it
|
|
15
|
+
* is drawn at, so a pen's line thickens and thins along the way.
|
|
16
|
+
*/
|
|
17
|
+
export function strokeSegments(stroke) {
|
|
18
|
+
const segments = [];
|
|
19
|
+
if (stroke.length < 2)
|
|
20
|
+
return segments;
|
|
21
|
+
let from = stroke[0];
|
|
22
|
+
for (let index = 1; index < stroke.length - 1; index++) {
|
|
23
|
+
const control = stroke[index];
|
|
24
|
+
const to = midpoint(control, stroke[index + 1]);
|
|
25
|
+
segments.push({ from, control, to, pressure: control.pressure });
|
|
26
|
+
from = to;
|
|
27
|
+
}
|
|
28
|
+
const last = stroke[stroke.length - 1];
|
|
29
|
+
segments.push({ from, control: last, to: last, pressure: last.pressure });
|
|
30
|
+
return segments;
|
|
31
|
+
}
|
|
32
|
+
/** Draws `strokes` on a 2D context already scaled to CSS pixels. A tap draws a dot. */
|
|
33
|
+
export function drawStrokes(context, strokes, { color, width }) {
|
|
34
|
+
context.save();
|
|
35
|
+
context.strokeStyle = color;
|
|
36
|
+
context.fillStyle = color;
|
|
37
|
+
context.lineCap = 'round';
|
|
38
|
+
context.lineJoin = 'round';
|
|
39
|
+
for (const stroke of strokes) {
|
|
40
|
+
if (stroke.length === 1) {
|
|
41
|
+
const [dot] = stroke;
|
|
42
|
+
context.beginPath();
|
|
43
|
+
context.arc(dot.x, dot.y, strokeWidthAt(dot.pressure, width) / 2, 0, Math.PI * 2);
|
|
44
|
+
context.fill();
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
for (const segment of strokeSegments(stroke)) {
|
|
48
|
+
context.beginPath();
|
|
49
|
+
context.lineWidth = strokeWidthAt(segment.pressure, width);
|
|
50
|
+
context.moveTo(segment.from.x, segment.from.y);
|
|
51
|
+
context.quadraticCurveTo(segment.control.x, segment.control.y, segment.to.x, segment.to.y);
|
|
52
|
+
context.stroke();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
context.restore();
|
|
56
|
+
}
|
|
57
|
+
/** The box the ink covers, line width included, or null when there is no ink. */
|
|
58
|
+
export function strokesBounds(strokes, width) {
|
|
59
|
+
let minX = Infinity;
|
|
60
|
+
let minY = Infinity;
|
|
61
|
+
let maxX = -Infinity;
|
|
62
|
+
let maxY = -Infinity;
|
|
63
|
+
for (const stroke of strokes) {
|
|
64
|
+
for (const point of stroke) {
|
|
65
|
+
const half = strokeWidthAt(point.pressure, width) / 2;
|
|
66
|
+
minX = Math.min(minX, point.x - half);
|
|
67
|
+
minY = Math.min(minY, point.y - half);
|
|
68
|
+
maxX = Math.max(maxX, point.x + half);
|
|
69
|
+
maxY = Math.max(maxY, point.y + half);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (minX === Infinity)
|
|
73
|
+
return null;
|
|
74
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
75
|
+
}
|
|
76
|
+
const round = (value) => Math.round(value * 100) / 100;
|
|
77
|
+
/**
|
|
78
|
+
* The shapes a stroke draws as, in SVG path syntax, shifted by `offset`. Consecutive segments
|
|
79
|
+
* at the same width share one path, so a mouse or finger stroke is a single path and only a
|
|
80
|
+
* pen's changing pressure splits it.
|
|
81
|
+
*/
|
|
82
|
+
export function strokeShapes(stroke, width, offset = { x: 0, y: 0 }) {
|
|
83
|
+
const x = (value) => round(value - offset.x);
|
|
84
|
+
const y = (value) => round(value - offset.y);
|
|
85
|
+
if (stroke.length === 1) {
|
|
86
|
+
const [dot] = stroke;
|
|
87
|
+
return [
|
|
88
|
+
{ kind: 'dot', x: x(dot.x), y: y(dot.y), r: round(strokeWidthAt(dot.pressure, width) / 2) }
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
const shapes = [];
|
|
92
|
+
for (const segment of strokeSegments(stroke)) {
|
|
93
|
+
const segmentWidth = round(strokeWidthAt(segment.pressure, width));
|
|
94
|
+
const curve = `Q${x(segment.control.x)} ${y(segment.control.y)} ${x(segment.to.x)} ${y(segment.to.y)}`;
|
|
95
|
+
const last = shapes.at(-1);
|
|
96
|
+
if (last?.kind === 'path' && last.width === segmentWidth)
|
|
97
|
+
last.d += curve;
|
|
98
|
+
else
|
|
99
|
+
shapes.push({
|
|
100
|
+
kind: 'path',
|
|
101
|
+
d: `M${x(segment.from.x)} ${y(segment.from.y)}${curve}`,
|
|
102
|
+
width: segmentWidth
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return shapes;
|
|
106
|
+
}
|
|
107
|
+
/** A standalone SVG of the strokes, cropped to the ink plus `padding`. */
|
|
108
|
+
export function strokesToSvg(strokes, { color, width, padding }) {
|
|
109
|
+
const bounds = strokesBounds(strokes, width);
|
|
110
|
+
if (!bounds)
|
|
111
|
+
return null;
|
|
112
|
+
const offset = { x: bounds.x - padding, y: bounds.y - padding };
|
|
113
|
+
const boxWidth = round(bounds.width + padding * 2);
|
|
114
|
+
const boxHeight = round(bounds.height + padding * 2);
|
|
115
|
+
const shapes = strokes
|
|
116
|
+
.flatMap((stroke) => strokeShapes(stroke, width, offset))
|
|
117
|
+
.map((shape) => shape.kind === 'dot'
|
|
118
|
+
? `<circle cx="${shape.x}" cy="${shape.y}" r="${shape.r}" fill="${color}"/>`
|
|
119
|
+
: `<path d="${shape.d}" stroke-width="${shape.width}"/>`);
|
|
120
|
+
return [
|
|
121
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${boxWidth}" height="${boxHeight}" viewBox="0 0 ${boxWidth} ${boxHeight}">`,
|
|
122
|
+
`<g fill="none" stroke="${color}" stroke-linecap="round" stroke-linejoin="round">`,
|
|
123
|
+
shapes.join(''),
|
|
124
|
+
'</g></svg>'
|
|
125
|
+
].join('');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Exports the strokes as a data URL cropped to the ink plus `padding`: an SVG, or a PNG drawn at
|
|
129
|
+
* `scale` device pixels per CSS pixel so it stays sharp in a document. Null when there is no ink.
|
|
130
|
+
*/
|
|
131
|
+
export function exportStrokes(strokes, { format, color, width, padding, scale }) {
|
|
132
|
+
if (format === 'svg') {
|
|
133
|
+
const svg = strokesToSvg(strokes, { color, width, padding });
|
|
134
|
+
return svg ? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}` : null;
|
|
135
|
+
}
|
|
136
|
+
const bounds = strokesBounds(strokes, width);
|
|
137
|
+
if (!bounds || typeof document === 'undefined')
|
|
138
|
+
return null;
|
|
139
|
+
const canvas = document.createElement('canvas');
|
|
140
|
+
canvas.width = Math.ceil((bounds.width + padding * 2) * scale);
|
|
141
|
+
canvas.height = Math.ceil((bounds.height + padding * 2) * scale);
|
|
142
|
+
const context = canvas.getContext('2d');
|
|
143
|
+
if (!context)
|
|
144
|
+
return null;
|
|
145
|
+
context.scale(scale, scale);
|
|
146
|
+
context.translate(padding - bounds.x, padding - bounds.y);
|
|
147
|
+
drawStrokes(context, strokes, { color, width });
|
|
148
|
+
return canvas.toDataURL('image/png');
|
|
149
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type InferComponentTheme } from '../../../utils/cva/index.js';
|
|
2
|
+
export declare const signatureInputTheme: {
|
|
3
|
+
frame: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
4
|
+
pad: (props?: (import("../../../utils/cva/types.ts").CVAVariantSchema<{
|
|
5
|
+
size: {
|
|
6
|
+
small: string;
|
|
7
|
+
normal: string;
|
|
8
|
+
large: string;
|
|
9
|
+
};
|
|
10
|
+
interactive: {
|
|
11
|
+
true: string;
|
|
12
|
+
false: string;
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
true: string;
|
|
16
|
+
false: string;
|
|
17
|
+
};
|
|
18
|
+
hasError: {
|
|
19
|
+
true: string;
|
|
20
|
+
false: string;
|
|
21
|
+
};
|
|
22
|
+
}> & import("../../../utils/cva/types.ts").CVAClassProp) | undefined) => string;
|
|
23
|
+
ink: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
24
|
+
image: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
25
|
+
placeholder: (props?: (import("../../../utils/cva/types.ts").CVAVariantSchema<{
|
|
26
|
+
size: {
|
|
27
|
+
small: string;
|
|
28
|
+
normal: string;
|
|
29
|
+
large: string;
|
|
30
|
+
};
|
|
31
|
+
}> & import("../../../utils/cva/types.ts").CVAClassProp) | undefined) => string;
|
|
32
|
+
actions: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
33
|
+
};
|
|
34
|
+
export type SignatureInputTheme = typeof signatureInputTheme;
|
|
35
|
+
export type SignatureInputThemeProps = InferComponentTheme<SignatureInputTheme>;
|
|
36
|
+
export declare const setSignatureInputTheme: (theme: InferComponentTheme<{
|
|
37
|
+
frame: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
38
|
+
pad: (props?: (import("../../../utils/cva/types.ts").CVAVariantSchema<{
|
|
39
|
+
size: {
|
|
40
|
+
small: string;
|
|
41
|
+
normal: string;
|
|
42
|
+
large: string;
|
|
43
|
+
};
|
|
44
|
+
interactive: {
|
|
45
|
+
true: string;
|
|
46
|
+
false: string;
|
|
47
|
+
};
|
|
48
|
+
disabled: {
|
|
49
|
+
true: string;
|
|
50
|
+
false: string;
|
|
51
|
+
};
|
|
52
|
+
hasError: {
|
|
53
|
+
true: string;
|
|
54
|
+
false: string;
|
|
55
|
+
};
|
|
56
|
+
}> & import("../../../utils/cva/types.ts").CVAClassProp) | undefined) => string;
|
|
57
|
+
ink: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
58
|
+
image: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
59
|
+
placeholder: (props?: (import("../../../utils/cva/types.ts").CVAVariantSchema<{
|
|
60
|
+
size: {
|
|
61
|
+
small: string;
|
|
62
|
+
normal: string;
|
|
63
|
+
large: string;
|
|
64
|
+
};
|
|
65
|
+
}> & import("../../../utils/cva/types.ts").CVAClassProp) | undefined) => string;
|
|
66
|
+
actions: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
67
|
+
}>) => void;
|
|
68
|
+
export declare const useSignatureInputTheme: import("../../../utils/cva/theme.ts").UseComponentTheme<{
|
|
69
|
+
frame: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
70
|
+
pad: (props?: (import("../../../utils/cva/types.ts").CVAVariantSchema<{
|
|
71
|
+
size: {
|
|
72
|
+
small: string;
|
|
73
|
+
normal: string;
|
|
74
|
+
large: string;
|
|
75
|
+
};
|
|
76
|
+
interactive: {
|
|
77
|
+
true: string;
|
|
78
|
+
false: string;
|
|
79
|
+
};
|
|
80
|
+
disabled: {
|
|
81
|
+
true: string;
|
|
82
|
+
false: string;
|
|
83
|
+
};
|
|
84
|
+
hasError: {
|
|
85
|
+
true: string;
|
|
86
|
+
false: string;
|
|
87
|
+
};
|
|
88
|
+
}> & import("../../../utils/cva/types.ts").CVAClassProp) | undefined) => string;
|
|
89
|
+
ink: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
90
|
+
image: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
91
|
+
placeholder: (props?: (import("../../../utils/cva/types.ts").CVAVariantSchema<{
|
|
92
|
+
size: {
|
|
93
|
+
small: string;
|
|
94
|
+
normal: string;
|
|
95
|
+
large: string;
|
|
96
|
+
};
|
|
97
|
+
}> & import("../../../utils/cva/types.ts").CVAClassProp) | undefined) => string;
|
|
98
|
+
actions: (props?: import("../../../utils/cva/types.ts").CVAClassProp | undefined) => string;
|
|
99
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cva, setComponentTheme, useComponentTheme } from '../../../utils/cva/index.js';
|
|
2
|
+
// Holds the pad and, over its corner, the buttons: they cannot sit inside the pad, whose image
|
|
3
|
+
// role would hide them from assistive technology.
|
|
4
|
+
const defaultFrame = cva({
|
|
5
|
+
base: 'relative w-full min-w-0'
|
|
6
|
+
});
|
|
7
|
+
// The pad is the control: it takes focus, so its own ring shows keyboard focus, and the strokes
|
|
8
|
+
// are drawn in its text color (an SVG in `currentColor`), so they follow the theme.
|
|
9
|
+
const defaultPad = cva({
|
|
10
|
+
base: 'relative w-full min-w-0 touch-none overflow-hidden rounded-md border border-neutral-muted bg-surface-raised text-neutral outline-none select-none focus-visible:ring-2 focus-visible:ring-focus/50',
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
small: 'h-28',
|
|
14
|
+
normal: 'h-36',
|
|
15
|
+
large: 'h-44'
|
|
16
|
+
},
|
|
17
|
+
interactive: {
|
|
18
|
+
true: 'cursor-crosshair',
|
|
19
|
+
false: ''
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
true: 'cursor-not-allowed opacity-50',
|
|
23
|
+
false: ''
|
|
24
|
+
},
|
|
25
|
+
hasError: {
|
|
26
|
+
true: 'border-danger focus-visible:ring-danger/50',
|
|
27
|
+
false: ''
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
size: 'normal',
|
|
32
|
+
interactive: true,
|
|
33
|
+
disabled: false,
|
|
34
|
+
hasError: false
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const defaultInk = cva({
|
|
38
|
+
base: 'pointer-events-none absolute inset-0 size-full overflow-visible'
|
|
39
|
+
});
|
|
40
|
+
// A value set from outside (a saved signature) shows as an image, scaled to fit the pad.
|
|
41
|
+
const defaultImage = cva({
|
|
42
|
+
base: 'pointer-events-none absolute inset-0 size-full object-contain p-md'
|
|
43
|
+
});
|
|
44
|
+
// The line to sign on and its hint: decorative, gone as soon as there is ink.
|
|
45
|
+
const defaultPlaceholder = cva({
|
|
46
|
+
base: 'pointer-events-none absolute inset-x-[var(--space-xl)] bottom-1/4 flex items-end gap-sm border-b border-dashed border-neutral-muted pb-xs text-neutral/45',
|
|
47
|
+
variants: {
|
|
48
|
+
size: {
|
|
49
|
+
small: 'text-xs',
|
|
50
|
+
normal: 'text-sm',
|
|
51
|
+
large: 'text-base'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
size: 'normal'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const defaultActions = cva({
|
|
59
|
+
base: 'absolute end-[var(--space-xs)] top-[var(--space-xs)] flex items-center gap-xs'
|
|
60
|
+
});
|
|
61
|
+
export const signatureInputTheme = {
|
|
62
|
+
frame: defaultFrame,
|
|
63
|
+
pad: defaultPad,
|
|
64
|
+
ink: defaultInk,
|
|
65
|
+
image: defaultImage,
|
|
66
|
+
placeholder: defaultPlaceholder,
|
|
67
|
+
actions: defaultActions
|
|
68
|
+
};
|
|
69
|
+
export const setSignatureInputTheme = setComponentTheme('signature-input');
|
|
70
|
+
export const useSignatureInputTheme = useComponentTheme('signature-input', signatureInputTheme);
|
|
@@ -36,6 +36,7 @@ export const componentAliases: {
|
|
|
36
36
|
'entasis/selection-menu': string;
|
|
37
37
|
'entasis/ask': string;
|
|
38
38
|
'entasis/field': string;
|
|
39
|
+
'entasis/address-input': string;
|
|
39
40
|
'entasis/autocomplete': string;
|
|
40
41
|
'entasis/calendar': string;
|
|
41
42
|
'entasis/checkbox': string;
|
|
@@ -57,6 +58,7 @@ export const componentAliases: {
|
|
|
57
58
|
'entasis/rating-input': string;
|
|
58
59
|
'entasis/rich-text-input': string;
|
|
59
60
|
'entasis/select': string;
|
|
61
|
+
'entasis/signature-input': string;
|
|
60
62
|
'entasis/slider': string;
|
|
61
63
|
'entasis/switch': string;
|
|
62
64
|
'entasis/tag-group': string;
|
|
@@ -65,6 +67,7 @@ export const componentAliases: {
|
|
|
65
67
|
'entasis/text-area': string;
|
|
66
68
|
'entasis/time-input': string;
|
|
67
69
|
'entasis/voice-input': string;
|
|
70
|
+
'entasis/address': string;
|
|
68
71
|
'entasis/avatar': string;
|
|
69
72
|
'entasis/chart': string;
|
|
70
73
|
'entasis/chip': string;
|
|
@@ -37,6 +37,7 @@ export const componentAliases = {
|
|
|
37
37
|
'entasis/selection-menu': './src/lib/components/SelectionMenu/index.ts',
|
|
38
38
|
'entasis/ask': './src/lib/components/Form/Ask/index.ts',
|
|
39
39
|
'entasis/field': './src/lib/components/Form/Field/index.ts',
|
|
40
|
+
'entasis/address-input': './src/lib/components/Form/AddressInput/index.ts',
|
|
40
41
|
'entasis/autocomplete': './src/lib/components/Form/Autocomplete/index.ts',
|
|
41
42
|
'entasis/calendar': './src/lib/components/Form/Calendar/index.ts',
|
|
42
43
|
'entasis/checkbox': './src/lib/components/Form/Checkbox/index.ts',
|
|
@@ -58,6 +59,7 @@ export const componentAliases = {
|
|
|
58
59
|
'entasis/rating-input': './src/lib/components/Form/RatingInput/index.ts',
|
|
59
60
|
'entasis/rich-text-input': './src/lib/components/RichTextInput/index.ts',
|
|
60
61
|
'entasis/select': './src/lib/components/Form/Select/index.ts',
|
|
62
|
+
'entasis/signature-input': './src/lib/components/Form/SignatureInput/index.ts',
|
|
61
63
|
'entasis/slider': './src/lib/components/Form/Slider/index.ts',
|
|
62
64
|
'entasis/switch': './src/lib/components/Form/Switch/index.ts',
|
|
63
65
|
'entasis/tag-group': './src/lib/components/Form/TagGroup/index.ts',
|
|
@@ -66,6 +68,7 @@ export const componentAliases = {
|
|
|
66
68
|
'entasis/text-area': './src/lib/components/Form/TextArea/index.ts',
|
|
67
69
|
'entasis/time-input': './src/lib/components/Form/TimeInput/index.ts',
|
|
68
70
|
'entasis/voice-input': './src/lib/components/Form/VoiceInput/index.ts',
|
|
71
|
+
'entasis/address': './src/lib/components/Address/index.ts',
|
|
69
72
|
'entasis/avatar': './src/lib/components/Avatar/index.ts',
|
|
70
73
|
'entasis/chart': './src/lib/components/Chart/index.ts',
|
|
71
74
|
'entasis/chip': './src/lib/components/Chip/index.ts',
|
|
@@ -482,11 +482,25 @@ export declare const componentInventory: readonly [{
|
|
|
482
482
|
readonly id: "field";
|
|
483
483
|
readonly subpath: "entasis/field";
|
|
484
484
|
readonly sourceIndex: "src/lib/components/Form/Field/index.ts";
|
|
485
|
-
readonly exportedSymbols: readonly ["BooleanInputType", "CalendarInputType", "ColorInputType", "DateInputType", "Field", "FieldActionButton", "FieldAttributes", "FieldButtonAttributes", "FieldControlAttributes", "FieldHiddenInputOption", "FieldHiddenInputValue", "FieldHiddenInputs", "FieldHiddenInputsProps", "FieldLabelPosition", "FieldMessageOverrides", "FieldMessages", "FieldProps", "FieldState", "FieldTheme", "FieldThemeProps", "FieldValidationResult", "FieldValidatorResult", "FieldValue", "FileInputType", "InputProps", "InputType", "KeyValueInputType", "KeyValuePair", "MultipleChoiceInputType", "NumberInputType", "PinInputType", "RatingInputType", "RichTextInputType", "SingleOptionInputType", "SliderRangeInputType", "TagGroupInputType", "TagInputType", "TextInputType", "TimeInputType", "ValidationMode", "VoiceInputType", "createFieldState", "fieldSchemas", "fieldStructure", "fieldTheme", "llmDescription", "setFieldTheme", "useFieldTheme"];
|
|
485
|
+
readonly exportedSymbols: readonly ["AddressInputType", "BooleanInputType", "CalendarInputType", "ColorInputType", "DateInputType", "Field", "FieldActionButton", "FieldAttributes", "FieldButtonAttributes", "FieldControlAttributes", "FieldHiddenInputOption", "FieldHiddenInputValue", "FieldHiddenInputs", "FieldHiddenInputsProps", "FieldLabelPosition", "FieldMessageOverrides", "FieldMessages", "FieldProps", "FieldState", "FieldTheme", "FieldThemeProps", "FieldValidationResult", "FieldValidatorResult", "FieldValue", "FileInputType", "InputProps", "InputType", "KeyValueInputType", "KeyValuePair", "MultipleChoiceInputType", "NumberInputType", "PinInputType", "RatingInputType", "RichTextInputType", "SignatureInputType", "SingleOptionInputType", "SliderRangeInputType", "TagGroupInputType", "TagInputType", "TextInputType", "TimeInputType", "ValidationMode", "VoiceInputType", "createFieldState", "fieldSchemas", "fieldStructure", "fieldTheme", "llmDescription", "setFieldTheme", "useFieldTheme"];
|
|
486
486
|
readonly docs: readonly [];
|
|
487
487
|
readonly capabilities: readonly ["svelte", "component", "forms"];
|
|
488
488
|
readonly relatedComponents: readonly ["form"];
|
|
489
489
|
readonly visibility: "public";
|
|
490
|
+
}, {
|
|
491
|
+
readonly id: "address-input";
|
|
492
|
+
readonly subpath: "entasis/address-input";
|
|
493
|
+
readonly sourceIndex: "src/lib/components/Form/AddressInput/index.ts";
|
|
494
|
+
readonly exportedSymbols: readonly ["AddressFieldConfig", "AddressFieldItem", "AddressFieldRow", "AddressInput", "AddressInputLayout", "AddressInputProps", "AddressInputTheme", "AddressInputThemeProps", "addressInputTheme", "setAddressInputTheme", "useAddressInputTheme"];
|
|
495
|
+
readonly docs: readonly [{
|
|
496
|
+
readonly id: "address-input";
|
|
497
|
+
readonly route: "/components/address-input";
|
|
498
|
+
readonly category: "Forms";
|
|
499
|
+
readonly label: "Address input";
|
|
500
|
+
}];
|
|
501
|
+
readonly capabilities: readonly ["svelte", "component", "forms"];
|
|
502
|
+
readonly relatedComponents: readonly ["address", "autocomplete"];
|
|
503
|
+
readonly visibility: "public";
|
|
490
504
|
}, {
|
|
491
505
|
readonly id: "autocomplete";
|
|
492
506
|
readonly subpath: "entasis/autocomplete";
|
|
@@ -781,6 +795,20 @@ export declare const componentInventory: readonly [{
|
|
|
781
795
|
readonly capabilities: readonly ["svelte", "component", "forms"];
|
|
782
796
|
readonly relatedComponents: readonly ["combobox", "selection-menu"];
|
|
783
797
|
readonly visibility: "public";
|
|
798
|
+
}, {
|
|
799
|
+
readonly id: "signature-input";
|
|
800
|
+
readonly subpath: "entasis/signature-input";
|
|
801
|
+
readonly sourceIndex: "src/lib/components/Form/SignatureInput/index.ts";
|
|
802
|
+
readonly exportedSymbols: readonly ["SignatureFormat", "SignatureInput", "SignatureInputProps", "SignatureInputTheme", "SignatureInputThemeProps", "SignaturePoint", "SignatureStroke", "setSignatureInputTheme", "signatureInputTheme", "useSignatureInputTheme"];
|
|
803
|
+
readonly docs: readonly [{
|
|
804
|
+
readonly id: "signature-input";
|
|
805
|
+
readonly route: "/components/signature-input";
|
|
806
|
+
readonly category: "Forms";
|
|
807
|
+
readonly label: "Signature input";
|
|
808
|
+
}];
|
|
809
|
+
readonly capabilities: readonly ["svelte", "component", "forms"];
|
|
810
|
+
readonly relatedComponents: readonly ["voice-input", "file-input"];
|
|
811
|
+
readonly visibility: "public";
|
|
784
812
|
}, {
|
|
785
813
|
readonly id: "slider";
|
|
786
814
|
readonly subpath: "entasis/slider";
|
|
@@ -893,6 +921,20 @@ export declare const componentInventory: readonly [{
|
|
|
893
921
|
readonly capabilities: readonly ["svelte", "component", "forms"];
|
|
894
922
|
readonly relatedComponents: readonly ["text-input", "ai-composer"];
|
|
895
923
|
readonly visibility: "public";
|
|
924
|
+
}, {
|
|
925
|
+
readonly id: "address";
|
|
926
|
+
readonly subpath: "entasis/address";
|
|
927
|
+
readonly sourceIndex: "src/lib/components/Address/index.ts";
|
|
928
|
+
readonly exportedSymbols: readonly ["ADDRESS_FIELDS", "Address", "AddressField", "AddressLayout", "AddressLocation", "AddressProps", "AddressProvider", "AddressProviderRequest", "AddressSuggestion", "AddressTheme", "AddressThemeProps", "AddressValue", "COUNTRY_CODES", "DEFAULT_ADDRESS_ENDPOINT", "FormatAddressOptions", "GooglePlace", "GooglePlaceAddressComponent", "GooglePlacesError", "GooglePlacesProviderOptions", "GooglePlacesProxyOptions", "addressCountryName", "addressTheme", "composeStreetLine", "countryName", "createGooglePlacesProvider", "createGooglePlacesProxy", "formatAddress", "formatAddressLine", "isAddressEmpty", "parseGooglePlace", "setAddressProvider", "setAddressTheme", "useAddressTheme"];
|
|
929
|
+
readonly docs: readonly [{
|
|
930
|
+
readonly id: "address";
|
|
931
|
+
readonly route: "/components/address";
|
|
932
|
+
readonly category: "Data display";
|
|
933
|
+
readonly label: "Address";
|
|
934
|
+
}];
|
|
935
|
+
readonly capabilities: readonly ["svelte", "component", "dataDisplay"];
|
|
936
|
+
readonly relatedComponents: readonly ["address-input"];
|
|
937
|
+
readonly visibility: "public";
|
|
896
938
|
}, {
|
|
897
939
|
readonly id: "avatar";
|
|
898
940
|
readonly subpath: "entasis/avatar";
|
|
@@ -1963,6 +2005,7 @@ export declare const relatedComponents: {
|
|
|
1963
2005
|
readonly 'selection-menu': readonly ["toggle-menu", "select"];
|
|
1964
2006
|
readonly ask: readonly [];
|
|
1965
2007
|
readonly field: readonly ["form"];
|
|
2008
|
+
readonly 'address-input': readonly ["address", "autocomplete"];
|
|
1966
2009
|
readonly autocomplete: readonly ["combobox", "text-input", "tags-input"];
|
|
1967
2010
|
readonly calendar: readonly ["date-input", "date-selector", "mini-calendar"];
|
|
1968
2011
|
readonly checkbox: readonly [];
|
|
@@ -1984,6 +2027,7 @@ export declare const relatedComponents: {
|
|
|
1984
2027
|
readonly 'rating-input': readonly ["rating"];
|
|
1985
2028
|
readonly 'rich-text-input': readonly ["text-area", "markdown"];
|
|
1986
2029
|
readonly select: readonly ["combobox", "selection-menu"];
|
|
2030
|
+
readonly 'signature-input': readonly ["voice-input", "file-input"];
|
|
1987
2031
|
readonly slider: readonly ["number-input"];
|
|
1988
2032
|
readonly switch: readonly ["checkbox", "toggle-button"];
|
|
1989
2033
|
readonly 'tag-group': readonly ["tags-input", "chip"];
|
|
@@ -1992,6 +2036,7 @@ export declare const relatedComponents: {
|
|
|
1992
2036
|
readonly 'text-area': readonly ["text-input", "rich-text-input"];
|
|
1993
2037
|
readonly 'time-input': readonly ["date-input"];
|
|
1994
2038
|
readonly 'voice-input': readonly ["text-input", "ai-composer"];
|
|
2039
|
+
readonly address: readonly ["address-input"];
|
|
1995
2040
|
readonly avatar: readonly [];
|
|
1996
2041
|
readonly 'avatar-group': readonly [];
|
|
1997
2042
|
readonly chart: readonly [];
|