@commmerce/ui 1.3.0 → 1.4.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/THIRD_PARTY_NOTICES.txt +101 -0
- package/dist/cdn.js +936 -589
- package/dist/components/app-frame.d.ts +1 -0
- package/dist/components/app-frame.js +2 -1
- package/dist/components/calendar.d.ts +380 -0
- package/dist/components/calendar.js +1479 -0
- package/dist/components/signature-field.d.ts +153 -0
- package/dist/components/signature-field.js +726 -0
- package/dist/custom-elements.json +9986 -6870
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
|
+
declare const strings: {
|
|
3
|
+
/** Name of the Draw / Type tab list when the field has no label. */
|
|
4
|
+
modes: string;
|
|
5
|
+
/** The two tabs. */
|
|
6
|
+
draw: string;
|
|
7
|
+
type: string;
|
|
8
|
+
/** Accessible name of the drawing area, and the same once something is drawn. */
|
|
9
|
+
pad: string;
|
|
10
|
+
padSigned: string;
|
|
11
|
+
/** Read with the drawing area: how to draw, and the keyboard alternative. */
|
|
12
|
+
instructions: string;
|
|
13
|
+
/** Hint above the line while nothing is drawn. */
|
|
14
|
+
signHere: string;
|
|
15
|
+
/** Accessible name and placeholder of the box in Type mode. */
|
|
16
|
+
typeLabel: string;
|
|
17
|
+
typePlaceholder: string;
|
|
18
|
+
/** Undo and Clear buttons: visible text and accessible names. */
|
|
19
|
+
undo: string;
|
|
20
|
+
undoLabel: string;
|
|
21
|
+
clear: string;
|
|
22
|
+
clearLabel: string;
|
|
23
|
+
/** Announced after Clear and Undo. */
|
|
24
|
+
cleared: string;
|
|
25
|
+
undone: string;
|
|
26
|
+
/** Validation message when `required` and nothing is signed. */
|
|
27
|
+
required: string;
|
|
28
|
+
};
|
|
29
|
+
declare module '../localize.js' {
|
|
30
|
+
interface CmStrings {
|
|
31
|
+
signatureField: typeof strings;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Signature field: sign by drawing with a mouse, finger or pen, or by typing a name that is shown in a handwriting
|
|
36
|
+
* font. Gives a PNG of the signature, cropped to the ink, as a data URL (`value`, `toDataURL()`) or a Blob
|
|
37
|
+
* (`toBlob()`). Participates in native forms: submits the data URL under `name`; `required` blocks submission
|
|
38
|
+
* until something is signed. For e-sign screens ("Sign now") and signing pages.
|
|
39
|
+
*
|
|
40
|
+
* Load `@commmerce/tokens/fonts.css` (the hosted build's fonts.css) for the typed signature's font, Dancing Script;
|
|
41
|
+
* without it, typed signatures use the system's cursive font.
|
|
42
|
+
* @element cm-signature-field
|
|
43
|
+
* @fires cm-change - After a stroke is finished, Undo, Clear, a switch between Draw and Type, or typing stops for 400ms. `detail`: `{ value, empty, mode }`. A plain `change` event (no detail) follows it, for code that treats every form field alike.
|
|
44
|
+
* @csspart label - The label.
|
|
45
|
+
* @csspart tabs - The Draw / Type tab list.
|
|
46
|
+
* @csspart pad - The signing area (both modes).
|
|
47
|
+
* @csspart canvas - The drawing canvas.
|
|
48
|
+
* @csspart input - The text box in Type mode.
|
|
49
|
+
* @csspart undo - The Undo button (Draw mode).
|
|
50
|
+
* @csspart clear - The Clear button.
|
|
51
|
+
* @cssprop --cm-signature-font - Font of typed signatures. Default: Dancing Script, then cursive system fonts.
|
|
52
|
+
*/
|
|
53
|
+
export declare class CmSignatureField extends CmLocalizedElement {
|
|
54
|
+
#private;
|
|
55
|
+
static formAssociated: boolean;
|
|
56
|
+
static shadowRootOptions: {
|
|
57
|
+
delegatesFocus: boolean;
|
|
58
|
+
mode: ShadowRootMode;
|
|
59
|
+
serializable?: boolean;
|
|
60
|
+
slotAssignment?: SlotAssignmentMode;
|
|
61
|
+
};
|
|
62
|
+
static properties: {
|
|
63
|
+
label: {};
|
|
64
|
+
hint: {};
|
|
65
|
+
helpText: {
|
|
66
|
+
attribute: string;
|
|
67
|
+
};
|
|
68
|
+
error: {
|
|
69
|
+
reflect: boolean;
|
|
70
|
+
};
|
|
71
|
+
name: {
|
|
72
|
+
reflect: boolean;
|
|
73
|
+
};
|
|
74
|
+
value: {};
|
|
75
|
+
mode: {
|
|
76
|
+
reflect: boolean;
|
|
77
|
+
};
|
|
78
|
+
typedName: {
|
|
79
|
+
attribute: string;
|
|
80
|
+
};
|
|
81
|
+
required: {
|
|
82
|
+
type: BooleanConstructor;
|
|
83
|
+
reflect: boolean;
|
|
84
|
+
};
|
|
85
|
+
disabled: {
|
|
86
|
+
type: BooleanConstructor;
|
|
87
|
+
reflect: boolean;
|
|
88
|
+
};
|
|
89
|
+
_announce: {
|
|
90
|
+
state: boolean;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/** Visible label above the field, e.g. "Your signature". Without one, give the element an `aria-label`. */
|
|
94
|
+
label: string;
|
|
95
|
+
/** Lowercase bracketed note after the label. */
|
|
96
|
+
hint: string;
|
|
97
|
+
/** One sentence under the field in text-tertiary, e.g. what the signer agrees to. */
|
|
98
|
+
helpText: string;
|
|
99
|
+
/** Error message from your own validation; turns the pad's border critical and is announced. */
|
|
100
|
+
error: string;
|
|
101
|
+
/** Form field name. */
|
|
102
|
+
name: string;
|
|
103
|
+
/**
|
|
104
|
+
* The signature as a PNG data URL (`data:image/png;base64,…`), cropped to the ink, or empty when nothing is
|
|
105
|
+
* signed. Updated after every stroke and keystroke. Set it to a PNG or SVG data URL (or any image URL the page
|
|
106
|
+
* may read) to show a saved signature in Draw mode; set it to `''` to clear both modes.
|
|
107
|
+
*/
|
|
108
|
+
value: string;
|
|
109
|
+
/** The selected tab: `draw` (pointer, touch, pen) or `type` (keyboard). Each keeps its own signature. */
|
|
110
|
+
mode: 'draw' | 'type';
|
|
111
|
+
/** The name typed in Type mode. Set it to prefill the box with the signer's name. */
|
|
112
|
+
typedName: string;
|
|
113
|
+
/** Shows a red asterisk and blocks form submission until something is signed. */
|
|
114
|
+
required: boolean;
|
|
115
|
+
/** Blocks interaction. Also set by a disabled `<fieldset>`. */
|
|
116
|
+
disabled: boolean;
|
|
117
|
+
/** @internal Text in the polite status region. */
|
|
118
|
+
_announce: string;
|
|
119
|
+
static styles: import("lit").CSSResult[];
|
|
120
|
+
connectedCallback(): void;
|
|
121
|
+
disconnectedCallback(): void;
|
|
122
|
+
get form(): HTMLFormElement | null;
|
|
123
|
+
get validity(): ValidityState;
|
|
124
|
+
get validationMessage(): string;
|
|
125
|
+
checkValidity(): boolean;
|
|
126
|
+
reportValidity(): boolean;
|
|
127
|
+
formResetCallback(): void;
|
|
128
|
+
formDisabledCallback(d: boolean): void;
|
|
129
|
+
formStateRestoreCallback(state: string): void;
|
|
130
|
+
/** True when the current mode has nothing signed: no strokes (or saved image) in Draw, no text in Type. */
|
|
131
|
+
get empty(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The signature as a PNG data URL: black ink on transparent at 2x the pad's size, cropped to the ink with 8px
|
|
134
|
+
* (16 image pixels) around it. Empty string when nothing is signed.
|
|
135
|
+
*/
|
|
136
|
+
toDataURL(): string;
|
|
137
|
+
/** The same PNG as `toDataURL()` as a Blob, for uploading. `null` when nothing is signed. */
|
|
138
|
+
toBlob(): Promise<Blob | null>;
|
|
139
|
+
/** Removes the current mode's signature (Draw: every stroke and any saved image; Type: the text). */
|
|
140
|
+
clear(): void;
|
|
141
|
+
/** Removes the last stroke in Draw mode (then the saved image, if one was loaded). */
|
|
142
|
+
undo(): void;
|
|
143
|
+
willUpdate(changed: Map<string, unknown>): void;
|
|
144
|
+
firstUpdated(): void;
|
|
145
|
+
updated(changed: Map<string, unknown>): void;
|
|
146
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
147
|
+
}
|
|
148
|
+
declare global {
|
|
149
|
+
interface HTMLElementTagNameMap {
|
|
150
|
+
'cm-signature-field': CmSignatureField;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export {};
|