@pairbo/ui-kit 0.0.5 → 0.1.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 +121 -33
- package/dist/mockServiceWorker.js +302 -0
- package/dist/pairbo.es.js +20790 -0
- package/dist/pairbo.umd.js +2488 -0
- package/dist/public/Greeting Card from Pairbo.png +0 -0
- package/dist/public/mockServiceWorker.js +302 -0
- package/dist/src/components/button/button.component.d.ts +26 -3
- package/dist/src/components/button-group/button-group.component.d.ts +19 -14
- package/dist/src/components/card-selection/card-selection.component.d.ts +1 -2
- package/dist/src/components/category/category.component.d.ts +1 -0
- package/dist/src/components/drawer/drawer.component.d.ts +3 -0
- package/dist/src/components/editor/editor.component.d.ts +15 -5
- package/dist/src/components/{image-slider → editor-card-slider}/editor-card-slider.component.d.ts +26 -6
- package/dist/src/components/editor-selector/editor-selector.component.d.ts +14 -0
- package/dist/src/components/editor-selector/editor-selector.d.ts +8 -0
- package/dist/src/components/editor-selector/editor-selector.styles.d.ts +2 -0
- package/dist/src/components/fabric-example/fabric-example.component.d.ts +8 -3
- package/dist/src/components/gift-options/gift-options.component.d.ts +39 -0
- package/dist/src/components/gift-options/gift-options.d.ts +8 -0
- package/dist/src/components/gift-options/gift-options.styles.d.ts +2 -0
- package/dist/src/components/handwritten-canvas/handwritten-canvas.component.d.ts +60 -0
- package/dist/src/components/handwritten-canvas/handwritten-canvas.d.ts +8 -0
- package/dist/src/components/handwritten-canvas/handwritten-canvas.styles.d.ts +2 -0
- package/dist/src/components/handwritten-form/handwritten-form.component.d.ts +50 -0
- package/dist/src/components/handwritten-form/handwritten-form.d.ts +8 -0
- package/dist/src/components/handwritten-form/handwritten-form.styles.d.ts +2 -0
- package/dist/src/components/main.d.ts +7 -1
- package/dist/src/components/page-manager/page-manager.component.d.ts +5 -4
- package/dist/src/components/radio-button/radio-button.component.d.ts +5 -3
- package/dist/src/components/radio-group/radio-group.component.d.ts +10 -4
- package/dist/src/components/selector/selector.component.d.ts +3 -1
- package/dist/src/components/textarea/textarea.component.d.ts +2 -0
- package/dist/src/components/type-canvas/type-canvas.component.d.ts +52 -0
- package/dist/src/components/type-canvas/type-canvas.d.ts +8 -0
- package/dist/src/components/type-canvas/type-canvas.styles.d.ts +2 -0
- package/dist/src/components/type-form/type-form.component.d.ts +24 -0
- package/dist/src/components/zoomed-preview/zoomed-preview.component.d.ts +33 -0
- package/dist/src/components/zoomed-preview/zoomed-preview.d.ts +8 -0
- package/dist/src/components/zoomed-preview/zoomed-preview.styles.d.ts +2 -0
- package/dist/src/core/pbo-bridge/PboBridge.d.ts +32 -0
- package/dist/src/core/pbo-bridge/createPboBridge.d.ts +20 -0
- package/dist/src/core/pbo-bridge/index.d.ts +2 -0
- package/dist/src/core/pbo-bridge/types.d.ts +69 -0
- package/dist/src/demo.d.ts +1 -0
- package/dist/src/events/events.d.ts +1 -0
- package/dist/src/events/handwritten-image-dimensions-changed.d.ts +13 -0
- package/dist/src/internal/form.d.ts +54 -0
- package/dist/src/mocks/browser.d.ts +1 -0
- package/dist/src/mocks/handlers.d.ts +1 -0
- package/dist/src/mocks/init.d.ts +1 -0
- package/dist/src/mocks/shopifyHandler.d.ts +2 -0
- package/dist/src/themes/default.css +171 -67
- package/dist/src/utilities/mobile.d.ts +3 -0
- package/package.json +18 -2
- package/dist/assets/main-DNmeOojs.js +0 -1145
- /package/dist/src/components/{image-slider → editor-card-slider}/editor-card-slider.d.ts +0 -0
- /package/dist/src/components/{image-slider → editor-card-slider}/editor-card-slider.styles.d.ts +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CSSResultGroup } from 'lit';
|
|
2
|
+
import { default as PairboElement } from '../../internal/pairbo-element.js';
|
|
3
|
+
import { Canvas, FabricImage, Rect, Group } from 'fabric';
|
|
4
|
+
type Size = {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
type Position = {
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @summary Short summary of the component's intended use.
|
|
14
|
+
* @status experimental
|
|
15
|
+
*
|
|
16
|
+
* @dependency pbo-example
|
|
17
|
+
*
|
|
18
|
+
* @event pbo-event-name - Emitted as an example.
|
|
19
|
+
*
|
|
20
|
+
* @slot - The default slot.
|
|
21
|
+
* @slot example - An example slot.
|
|
22
|
+
*
|
|
23
|
+
* @csspart base - The component's base wrapper.
|
|
24
|
+
*
|
|
25
|
+
* @cssproperty --example - An example CSS custom property.
|
|
26
|
+
*/
|
|
27
|
+
export default class PboHandwrittenCanvas extends PairboElement {
|
|
28
|
+
static styles: CSSResultGroup;
|
|
29
|
+
backgroundImageUrl: string | undefined;
|
|
30
|
+
handwrittenImageUrl: string | undefined;
|
|
31
|
+
imageHeight: number | null;
|
|
32
|
+
imageWidth: number | null;
|
|
33
|
+
imageLeft: number | null;
|
|
34
|
+
imageTop: number | null;
|
|
35
|
+
baseCanvas: HTMLCanvasElement;
|
|
36
|
+
canvas: Canvas;
|
|
37
|
+
backgroundFabImg: FabricImage | undefined;
|
|
38
|
+
rect: Rect | undefined;
|
|
39
|
+
areaPosition: Position;
|
|
40
|
+
handwrittenImage: FabricImage | undefined;
|
|
41
|
+
clipMaskOverlay: Group | undefined;
|
|
42
|
+
areaSize: Size;
|
|
43
|
+
handleBackgroundImageUrlChange(): Promise<void>;
|
|
44
|
+
handleHandwrittenImageUrlChange(_: string | undefined, newValue: string | undefined): Promise<void>;
|
|
45
|
+
createClipMaskOverlay(): Group;
|
|
46
|
+
updateProcessedImgAreaPosition(): void;
|
|
47
|
+
private _dimensionsUpdateTimeout;
|
|
48
|
+
handleHandwrittenImageDimensionsChange(oldValue: number | null, newValue: number | null): void;
|
|
49
|
+
applyHandwrittenImageDimensions(): void;
|
|
50
|
+
setHandwrittenImageDimensions(dimensions: {
|
|
51
|
+
top?: number;
|
|
52
|
+
left?: number;
|
|
53
|
+
height?: number;
|
|
54
|
+
width?: number;
|
|
55
|
+
}): void;
|
|
56
|
+
firstUpdated(): Promise<void>;
|
|
57
|
+
appendBackgroundImageToCanvas(url: string, callback?: Function): Promise<void>;
|
|
58
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as PboHandwrittenCanvas } from './handwritten-canvas.component.js';
|
|
2
|
+
export * from './handwritten-canvas.component.js';
|
|
3
|
+
export default PboHandwrittenCanvas;
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
"pbo-handwritten-canvas": PboHandwrittenCanvas;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CSSResultGroup } from 'lit';
|
|
2
|
+
import { default as PairboElement } from '../../internal/pairbo-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* @summary Short summary of the component's intended use.
|
|
5
|
+
* @status experimental
|
|
6
|
+
*
|
|
7
|
+
* @dependency pbo-example
|
|
8
|
+
*
|
|
9
|
+
* @event pbo-event-name - Emitted as an example.
|
|
10
|
+
*
|
|
11
|
+
* @slot - The default slot.
|
|
12
|
+
* @slot example - An example slot.
|
|
13
|
+
*
|
|
14
|
+
* @csspart base - The component's base wrapper.
|
|
15
|
+
*
|
|
16
|
+
* @cssproperty --example - An example CSS custom property.
|
|
17
|
+
*/
|
|
18
|
+
export default class PboHandwrittenForm extends PairboElement {
|
|
19
|
+
static styles: CSSResultGroup;
|
|
20
|
+
imageInput: HTMLInputElement;
|
|
21
|
+
handwrittenForm: HTMLFormElement;
|
|
22
|
+
sourceImg: File | null;
|
|
23
|
+
processedFileUrl: string | null;
|
|
24
|
+
handwrittenDimensions: {
|
|
25
|
+
top: number | null;
|
|
26
|
+
left: number | null;
|
|
27
|
+
width: number | null;
|
|
28
|
+
height: number | null;
|
|
29
|
+
cardHeight: number | null;
|
|
30
|
+
cardWidth: number | null;
|
|
31
|
+
};
|
|
32
|
+
showPicker(): void;
|
|
33
|
+
handleSourceImgChange(oldFile: File | null, newFile: File | null): void;
|
|
34
|
+
handleProcessImageChange(oldFileUrl: string | null, newFileUrl: string | null): void;
|
|
35
|
+
setDimensions(dimensions: {
|
|
36
|
+
top: number | null;
|
|
37
|
+
left: number | null;
|
|
38
|
+
width: number | null;
|
|
39
|
+
height: number | null;
|
|
40
|
+
cardHeight: number | null;
|
|
41
|
+
cardWidth: number | null;
|
|
42
|
+
}): void;
|
|
43
|
+
get form(): {
|
|
44
|
+
isLoading: boolean | null;
|
|
45
|
+
processedFileUrl: string | null;
|
|
46
|
+
};
|
|
47
|
+
handleFileChange(e: Event): Promise<void>;
|
|
48
|
+
handleSubmit(e: Event): void;
|
|
49
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as PboHandwrittenForm } from './handwritten-form.component.js';
|
|
2
|
+
export * from './handwritten-form.component.js';
|
|
3
|
+
export default PboHandwrittenForm;
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
"pbo-handwritten-form": PboHandwrittenForm;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -8,8 +8,14 @@ export { default as PboRadioGroup } from './radio-group/radio-group.js';
|
|
|
8
8
|
export { default as PboTextarea } from './textarea/textarea.js';
|
|
9
9
|
export { default as PboEditor } from './editor/editor.js';
|
|
10
10
|
export { default as PboTypeForm } from './type-form/type-form.js';
|
|
11
|
-
export { default as PboEditorCardSlider } from './
|
|
11
|
+
export { default as PboEditorCardSlider } from './editor-card-slider/editor-card-slider.js';
|
|
12
12
|
export { default as PboCategory } from './category/category.js';
|
|
13
13
|
export { default as PboDrawer } from './drawer/drawer.js';
|
|
14
14
|
export { default as PboPageManager } from './page-manager/page-manager.js';
|
|
15
15
|
export { default as PboCardSelection } from './card-selection/card-selection.js';
|
|
16
|
+
export { default as PboTypeCanvas } from './type-canvas/type-canvas.js';
|
|
17
|
+
export { default as PboZoomedPreview } from './zoomed-preview/zoomed-preview.js';
|
|
18
|
+
export { default as PboEditorSelector } from './editor-selector/editor-selector.js';
|
|
19
|
+
export { default as PboHandwrittenForm } from './handwritten-form/handwritten-form.js';
|
|
20
|
+
export { default as PboHandwrittenCanvas } from './handwritten-canvas/handwritten-canvas.js';
|
|
21
|
+
export { default as PboGiftOption } from './gift-options/gift-options.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CSSResultGroup
|
|
1
|
+
import { CSSResultGroup } from 'lit';
|
|
2
2
|
import { default as PairboElement } from '../../internal/pairbo-element.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PboCardSelection } from '../main.js';
|
|
4
4
|
import { default as PboEditor } from '../editor/editor.component.js';
|
|
5
5
|
/**
|
|
6
6
|
* @summary Short summary of the component's intended use.
|
|
@@ -21,6 +21,7 @@ export default class PboPageManager extends PairboElement {
|
|
|
21
21
|
static styles: CSSResultGroup;
|
|
22
22
|
cardSelectionEl: PboCardSelection;
|
|
23
23
|
editorEl: PboEditor;
|
|
24
|
+
onClose: () => void;
|
|
24
25
|
currentPage: "selection" | "editor";
|
|
25
26
|
selectedCard: string | null;
|
|
26
27
|
categories: Category[];
|
|
@@ -34,8 +35,8 @@ export default class PboPageManager extends PairboElement {
|
|
|
34
35
|
connectedCallback(): void;
|
|
35
36
|
disconnectedCallback(): void;
|
|
36
37
|
protected firstUpdated(): void;
|
|
37
|
-
|
|
38
|
-
findCardInCategoryById
|
|
38
|
+
handleCategoriesUpdate(): void;
|
|
39
|
+
private findCardInCategoryById;
|
|
39
40
|
private handleCardSelected;
|
|
40
41
|
render(): import('lit-html').TemplateResult<1>;
|
|
41
42
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSResultGroup } from 'lit';
|
|
2
|
+
import { default as PairboElement } from '../../internal/pairbo-element.js';
|
|
2
3
|
/**
|
|
3
4
|
* @summary Short summary of the component's intended use.
|
|
4
5
|
* @documentation https://shoelace.style/components/radio-button
|
|
@@ -15,17 +16,18 @@ import { LitElement, CSSResultGroup } from 'lit';
|
|
|
15
16
|
*
|
|
16
17
|
* @cssproperty --example - An example CSS custom property.
|
|
17
18
|
*/
|
|
18
|
-
export default class PboRadioButton extends
|
|
19
|
+
export default class PboRadioButton extends PairboElement {
|
|
19
20
|
static styles: CSSResultGroup;
|
|
20
21
|
private readonly hasSlotController;
|
|
21
22
|
input: HTMLInputElement;
|
|
22
23
|
hiddenInput: HTMLInputElement;
|
|
23
|
-
protected hasFocus: boolean;
|
|
24
24
|
checked: boolean;
|
|
25
25
|
value: string;
|
|
26
26
|
disabled: boolean;
|
|
27
27
|
size: "small" | "medium" | "large";
|
|
28
28
|
circle: boolean;
|
|
29
|
+
iconOnly: boolean;
|
|
30
|
+
protected hasFocus: boolean;
|
|
29
31
|
connectedCallback(): void;
|
|
30
32
|
private handleBlur;
|
|
31
33
|
private handleClick;
|
|
@@ -35,12 +35,17 @@ export default class PboRadioGroup extends PairboElement implements PairboFormCo
|
|
|
35
35
|
defaultValue: string;
|
|
36
36
|
required: boolean;
|
|
37
37
|
name: string;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
value: string;
|
|
39
|
+
helpText: string;
|
|
40
|
+
label: string;
|
|
41
|
+
iconGroup: boolean;
|
|
42
|
+
size: "medium" | "large" | "small";
|
|
40
43
|
disabled: boolean;
|
|
41
44
|
form: string;
|
|
45
|
+
handleValueChange(): void;
|
|
42
46
|
get validity(): ValidityState;
|
|
43
|
-
validationMessage: string;
|
|
47
|
+
get validationMessage(): string;
|
|
48
|
+
connectedCallback(): void;
|
|
44
49
|
checkValidity(): boolean;
|
|
45
50
|
getForm(): HTMLFormElement | null;
|
|
46
51
|
reportValidity(): boolean;
|
|
@@ -48,9 +53,10 @@ export default class PboRadioGroup extends PairboElement implements PairboFormCo
|
|
|
48
53
|
private getAllRadios;
|
|
49
54
|
private updateCheckedRadio;
|
|
50
55
|
private handleRadioClick;
|
|
56
|
+
private handleLabelClick;
|
|
51
57
|
private handleKeyDown;
|
|
52
58
|
private syncRadios;
|
|
59
|
+
private syncRadioElements;
|
|
53
60
|
private handleInvalid;
|
|
54
|
-
handleValueChange(): void;
|
|
55
61
|
render(): import('lit-html').TemplateResult<1>;
|
|
56
62
|
}
|
|
@@ -6,12 +6,14 @@ interface FontOption {
|
|
|
6
6
|
}
|
|
7
7
|
export default class PboSelector extends LitElement {
|
|
8
8
|
static styles: CSSResultGroup;
|
|
9
|
+
private readonly hasSlotController;
|
|
9
10
|
fonts: FontOption[];
|
|
11
|
+
size: "medium" | "large" | "small";
|
|
12
|
+
label: string;
|
|
10
13
|
get value(): any;
|
|
11
14
|
choiceEl: HTMLSelectElement;
|
|
12
15
|
private _choices?;
|
|
13
16
|
firstUpdated(): void;
|
|
14
|
-
updated: (changedProperties: Map<string, any>) => void;
|
|
15
17
|
private _initializeChoices;
|
|
16
18
|
render(): import('lit-html').TemplateResult<1>;
|
|
17
19
|
}
|
|
@@ -18,6 +18,7 @@ import { default as PairboElement, PairboFormControl } from '../../internal/pair
|
|
|
18
18
|
export default class PboTextarea extends PairboElement implements PairboFormControl {
|
|
19
19
|
static styles: CSSResultGroup;
|
|
20
20
|
private readonly formControlController;
|
|
21
|
+
private readonly hasSlotController;
|
|
21
22
|
defaultValue?: unknown;
|
|
22
23
|
defaultChecked?: boolean | undefined;
|
|
23
24
|
pattern?: string | undefined;
|
|
@@ -40,6 +41,7 @@ export default class PboTextarea extends PairboElement implements PairboFormCont
|
|
|
40
41
|
required: boolean;
|
|
41
42
|
minlength: number;
|
|
42
43
|
maxlength: number;
|
|
44
|
+
helpText: string;
|
|
43
45
|
get validity(): ValidityState;
|
|
44
46
|
get validationMessage(): string;
|
|
45
47
|
firstUpdated(): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { CSSResultGroup } from 'lit';
|
|
2
|
+
import { default as PairboElement } from '../../internal/pairbo-element.js';
|
|
3
|
+
import { Rect, Canvas, Textbox, FabricImage } from 'fabric';
|
|
4
|
+
type Size = {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
type Position = {
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @summary Short summary of the component's intended use.
|
|
14
|
+
* @status experimental
|
|
15
|
+
*
|
|
16
|
+
* @dependency pbo-example
|
|
17
|
+
*
|
|
18
|
+
* @event pbo-event-name - Emitted as an example.
|
|
19
|
+
*
|
|
20
|
+
* @slot - The default slot.
|
|
21
|
+
* @slot example - An example slot.
|
|
22
|
+
*
|
|
23
|
+
* @csspart base - The component's base wrapper.
|
|
24
|
+
*
|
|
25
|
+
* @cssproperty --example - An example CSS custom property.
|
|
26
|
+
*/
|
|
27
|
+
export default class PboTypeCanvas extends PairboElement {
|
|
28
|
+
static styles: CSSResultGroup;
|
|
29
|
+
backgroundImageUrl: string | undefined;
|
|
30
|
+
message: string;
|
|
31
|
+
font: string;
|
|
32
|
+
color: string;
|
|
33
|
+
alignment: "left" | "center" | "right";
|
|
34
|
+
baseCanvas: HTMLCanvasElement;
|
|
35
|
+
canvas: Canvas;
|
|
36
|
+
backgroundImage: FabricImage | undefined;
|
|
37
|
+
backgroundFabImg: FabricImage | undefined;
|
|
38
|
+
rect: Rect | undefined;
|
|
39
|
+
textBox: Textbox | undefined;
|
|
40
|
+
areaPosition: Position;
|
|
41
|
+
areaSize: Size;
|
|
42
|
+
handleAlignmentChange(oldAlignment: string, newAlignment: string): void;
|
|
43
|
+
handleColorChange(oldColor: string, newColor: string): void;
|
|
44
|
+
handleFontChange(oldFont: string, newFont: string): void;
|
|
45
|
+
handleMessageChange(oldValue: string, newValue: string): void;
|
|
46
|
+
handleBackgroundImageUrlChange(): Promise<void>;
|
|
47
|
+
updateTextAreaPosition(): void;
|
|
48
|
+
firstUpdated(): Promise<void>;
|
|
49
|
+
appendBackgroundImageToCanvas(url: string, callback?: Function): Promise<void>;
|
|
50
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -33,8 +33,28 @@ export default class PboTypeForm extends PairboElement {
|
|
|
33
33
|
fontSelector: PboSelector;
|
|
34
34
|
textColor: PboRadioGroup;
|
|
35
35
|
textAlignment: PboRadioGroup;
|
|
36
|
+
typingForm: HTMLFormElement;
|
|
37
|
+
textArea: PboTextarea;
|
|
38
|
+
windowHeight: number;
|
|
39
|
+
private resizeTimeout;
|
|
36
40
|
private formData;
|
|
41
|
+
charsNum: number;
|
|
42
|
+
static readonly CTA_STATES: {
|
|
43
|
+
danger: {
|
|
44
|
+
type: string;
|
|
45
|
+
message: string;
|
|
46
|
+
};
|
|
47
|
+
primary: {
|
|
48
|
+
type: string;
|
|
49
|
+
message: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
ctaButtonState: {
|
|
53
|
+
type: string;
|
|
54
|
+
message: string;
|
|
55
|
+
};
|
|
37
56
|
cardInnerImageUrl: string;
|
|
57
|
+
protected firstUpdated(): void;
|
|
38
58
|
get form(): {
|
|
39
59
|
font: any;
|
|
40
60
|
text: string;
|
|
@@ -44,5 +64,9 @@ export default class PboTypeForm extends PairboElement {
|
|
|
44
64
|
private handleFormChange;
|
|
45
65
|
hostConnected(): void;
|
|
46
66
|
hostDisconnected(): void;
|
|
67
|
+
submitFormHandler(e: SubmitEvent): void;
|
|
68
|
+
private handleResize;
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
disconnectedCallback(): void;
|
|
47
71
|
render(): import('lit-html').TemplateResult<1>;
|
|
48
72
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CSSResultGroup } from 'lit';
|
|
2
|
+
import { default as PairboElement } from '../../internal/pairbo-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* @summary Short summary of the component's intended use.
|
|
5
|
+
* @status experimental
|
|
6
|
+
*
|
|
7
|
+
* @dependency pbo-example
|
|
8
|
+
*
|
|
9
|
+
* @event pbo-event-name - Emitted as an example.
|
|
10
|
+
*
|
|
11
|
+
* @slot - The default slot.
|
|
12
|
+
* @slot example - An example slot.
|
|
13
|
+
*
|
|
14
|
+
* @csspart base - The component's base wrapper.
|
|
15
|
+
*
|
|
16
|
+
* @cssproperty --example - An example CSS custom property.
|
|
17
|
+
*/
|
|
18
|
+
export default class PboZoomedPreview extends PairboElement {
|
|
19
|
+
static styles: CSSResultGroup;
|
|
20
|
+
formData: {
|
|
21
|
+
font: string;
|
|
22
|
+
text: string;
|
|
23
|
+
color: string;
|
|
24
|
+
alignment: string;
|
|
25
|
+
};
|
|
26
|
+
cardUrl: string;
|
|
27
|
+
close: () => void;
|
|
28
|
+
handwrittenPreviewProps: {
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
url: string | null;
|
|
31
|
+
};
|
|
32
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Default implementation of PboIntegration
|
|
3
|
+
* @description
|
|
4
|
+
* This class provides a default implementation of the PboIntegration interface.
|
|
5
|
+
* It can be used as a base implementation or extended for custom needs.
|
|
6
|
+
* Sate management, event handling, and API interactions are handled here.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PboBridge {
|
|
9
|
+
drawer: "pbo-drawer";
|
|
10
|
+
giftOptions: "pbo-gift-options";
|
|
11
|
+
private _isLoading;
|
|
12
|
+
private _isError;
|
|
13
|
+
private _isDrawerOpen;
|
|
14
|
+
private _eventListeners;
|
|
15
|
+
constructor(customBridgeProps: PboBridgeProps);
|
|
16
|
+
toggleDrawer(visible: boolean): void;
|
|
17
|
+
get isDrawerOpen(): boolean;
|
|
18
|
+
getCards(): Promise<Card[]>;
|
|
19
|
+
afterGetCards(cards: Card[]): void;
|
|
20
|
+
getCategories(): Promise<Category[]>;
|
|
21
|
+
private afterGetCategories;
|
|
22
|
+
get isLoading(): boolean;
|
|
23
|
+
private _setLoading;
|
|
24
|
+
init(): Promise<void>;
|
|
25
|
+
asyncExecute<T>(callback: () => Promise<T>): Promise<void>;
|
|
26
|
+
uploadHandwrittenImage(file: File): Promise<string>;
|
|
27
|
+
submitCard(payload: SubmittedCardPayload): Promise<void>;
|
|
28
|
+
onSubmitted(): void;
|
|
29
|
+
addEventListener(event: PboIntegrationEvent, callback: (event: CustomEvent) => void): void;
|
|
30
|
+
removeEventListener(event: PboIntegrationEvent, callback: (event: CustomEvent) => void): void;
|
|
31
|
+
private dispatchEvent;
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Factory function to create a PboIntegration instance
|
|
3
|
+
* @description
|
|
4
|
+
* This function creates a new instance of PboIntegration.
|
|
5
|
+
* It can be used with a custom implementation or will use the default implementation.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Use default implementation
|
|
10
|
+
* const integration = createPboIntegration();
|
|
11
|
+
*
|
|
12
|
+
* // Use custom implementation
|
|
13
|
+
* const integration = createPboIntegration({
|
|
14
|
+
* getCards: async () => {
|
|
15
|
+
* return await fetch('/api/cards').then(r => r.json());
|
|
16
|
+
* }
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function createPboBridge(): PboBridgeInterface;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description :
|
|
3
|
+
* @author :
|
|
4
|
+
* @group :
|
|
5
|
+
* @created : 31/03/2025 - 13:21:15
|
|
6
|
+
*
|
|
7
|
+
* MODIFICATION LOG
|
|
8
|
+
* - Version : 1.0.0
|
|
9
|
+
* - Date : 31/03/2025
|
|
10
|
+
* - Author :
|
|
11
|
+
* - Modification :
|
|
12
|
+
**/
|
|
13
|
+
/**
|
|
14
|
+
* @summary Core types for Pairbo UI Kit integration
|
|
15
|
+
*/
|
|
16
|
+
export interface Card {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
categoryId: string;
|
|
21
|
+
imageUrl: string;
|
|
22
|
+
templateUrl?: string;
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
declare interface Category {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
cards: Card[];
|
|
29
|
+
}
|
|
30
|
+
export interface SubmittedCardPayload {
|
|
31
|
+
cardId: string;
|
|
32
|
+
handwrittenImageUrl?: string;
|
|
33
|
+
customText?: string;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export type PboIntegrationEvent = "pbo-drawer-toggle" | "pbo-card-submitted" | "pbo-loading-change" | "pbo-error";
|
|
37
|
+
/**
|
|
38
|
+
* @summary Custom implementation interface for Pairbo UI Kit
|
|
39
|
+
* @description
|
|
40
|
+
* This interface defines what users need to implement for custom behavior.
|
|
41
|
+
* All common logic is handled by the factory function.
|
|
42
|
+
*/
|
|
43
|
+
export interface PboBridgeCustom {
|
|
44
|
+
fetchCards(): Promise<Card[]>;
|
|
45
|
+
fetchCategories(): Promise<Category[]>;
|
|
46
|
+
uploadImage(file: File): Promise<string>;
|
|
47
|
+
submitCardData(payload: SubmittedCardPayload): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @summary Core integration interface for Pairbo UI Kit
|
|
51
|
+
* @description
|
|
52
|
+
* This interface defines the contract between Pairbo UI Kit components
|
|
53
|
+
* and external applications or backend services.
|
|
54
|
+
*/
|
|
55
|
+
export interface PboBridgeInterface {
|
|
56
|
+
drawer: "pbo-drawer" | string;
|
|
57
|
+
giftOptions: "pbo-gift-option" | string;
|
|
58
|
+
toggleDrawer(visible: boolean): void;
|
|
59
|
+
isDrawerOpen: boolean;
|
|
60
|
+
getCards(): Promise<Card[]>;
|
|
61
|
+
getCategories(): Promise<Category[]>;
|
|
62
|
+
isLoading: boolean;
|
|
63
|
+
uploadHandwrittenImage(file: File): Promise<string>;
|
|
64
|
+
submitCard(payload: SubmittedCardPayload): Promise<void>;
|
|
65
|
+
onSubmitted(): void;
|
|
66
|
+
addEventListener(event: PboIntegrationEvent, callback: (event: CustomEvent) => void): void;
|
|
67
|
+
removeEventListener(event: PboIntegrationEvent, callback: (event: CustomEvent) => void): void;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/main';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type HandwrittenImageDimensionsChangedEvent = CustomEvent<{
|
|
2
|
+
top: number;
|
|
3
|
+
left: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
cardHeight: number;
|
|
7
|
+
cardWidth: number;
|
|
8
|
+
}>;
|
|
9
|
+
declare global {
|
|
10
|
+
interface GlobalEventHandlersEventMap {
|
|
11
|
+
"handwritten-image-dimensions-changed": HandwrittenImageDimensionsChangedEvent;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -2,6 +2,24 @@ import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
|
2
2
|
import { PairboFormControl } from './pairbo-element';
|
|
3
3
|
import { PboButton } from '../components/main';
|
|
4
4
|
export declare const formCollections: WeakMap<HTMLFormElement, Set<PairboFormControl>>;
|
|
5
|
+
/**
|
|
6
|
+
* Interface for defining how a form control behaves.
|
|
7
|
+
*
|
|
8
|
+
* This interface provides configuration options for a form control's behavior,
|
|
9
|
+
* including retrieving its associated form, handling values, and managing validation.
|
|
10
|
+
*
|
|
11
|
+
* @interface FormControlControllerOptions
|
|
12
|
+
*
|
|
13
|
+
* @property {function} form - Returns the parent form element associated with the control.
|
|
14
|
+
* @property {function} name - Returns the name identifier of the control.
|
|
15
|
+
* @property {function} defaultValue - Returns the initial/default value of the control.
|
|
16
|
+
* @property {function} value - Returns the current value(s) of the control. If the control supports multiple values (e.g., multi-select), it returns an array.
|
|
17
|
+
* @property {function} disabled - Determines if the control is currently disabled.
|
|
18
|
+
* @property {function} reportValidity - Validates the control and returns `true` if valid, otherwise shows an error message.
|
|
19
|
+
* @property {function} checkValidity - Validates the control and returns `true` if valid, `false` if invalid, without displaying an error.
|
|
20
|
+
* @property {function} setValue - Updates the value of the control programmatically.
|
|
21
|
+
* @property {string[]} assumeInteractionOn - List of event names that indicate user interaction with the control.
|
|
22
|
+
*/
|
|
5
23
|
export interface FormControlControllerOptions {
|
|
6
24
|
form: (input: PairboFormControl) => HTMLFormElement | null;
|
|
7
25
|
name: (input: PairboFormControl) => string;
|
|
@@ -13,6 +31,41 @@ export interface FormControlControllerOptions {
|
|
|
13
31
|
setValue: (input: PairboFormControl, value: unknown) => void;
|
|
14
32
|
assumeInteractionOn: string[];
|
|
15
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* A controller class that manages form control behavior in reactive components.
|
|
36
|
+
* Implements the ReactiveController interface to handle form-related functionality.
|
|
37
|
+
*
|
|
38
|
+
* @implements {ReactiveController}
|
|
39
|
+
*
|
|
40
|
+
* @property {PairboFormControl & ReactiveControllerHost} host - The host element that this controller is attached to
|
|
41
|
+
* @property {HTMLFormElement | null | undefined} form - The associated form element
|
|
42
|
+
* @property {FormControlControllerOptions} options - Configuration options for the form control
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const controller = new FormControlController(hostElement, {
|
|
47
|
+
* // Custom options
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* This controller provides form control functionality including:
|
|
53
|
+
* - Form attachment and detachment
|
|
54
|
+
* - Form validation handling
|
|
55
|
+
* - Form data submission
|
|
56
|
+
* - Form reset handling
|
|
57
|
+
* - User interaction tracking
|
|
58
|
+
* - Custom validity states
|
|
59
|
+
*
|
|
60
|
+
* The controller automatically manages:
|
|
61
|
+
* - Form element lifecycle
|
|
62
|
+
* - Form validation overrides
|
|
63
|
+
* - Form data collection
|
|
64
|
+
* - User interaction states
|
|
65
|
+
* - Form submission and reset events
|
|
66
|
+
*
|
|
67
|
+
* @fires pbo-invalid - Emitted when the form control becomes invalid
|
|
68
|
+
*/
|
|
16
69
|
export declare class FormControlController implements ReactiveController {
|
|
17
70
|
host: PairboFormControl & ReactiveControllerHost;
|
|
18
71
|
form?: HTMLFormElement | null;
|
|
@@ -31,6 +84,7 @@ export declare class FormControlController implements ReactiveController {
|
|
|
31
84
|
private reportFormValidity;
|
|
32
85
|
private setUserInteracted;
|
|
33
86
|
private doAction;
|
|
87
|
+
/** Returns the associated `<form>` element, if one exists. The method to get the form is init in the construct, and the initialization is in the `hostConnected()`*/
|
|
34
88
|
getForm(): HTMLFormElement | null;
|
|
35
89
|
reset(submitter?: HTMLInputElement | PboButton): void;
|
|
36
90
|
submit(submitter?: HTMLInputElement | PboButton): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const worker: import('msw/browser').SetupWorker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handlers: import('msw').HttpHandler[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mswReady: Promise<void>;
|