@bbl-digital/snorre 4.2.70 → 4.2.71
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/bundle.js +1 -1
- package/esm/core/QuillEditor/classes/IndentAttributor.js +49 -0
- package/esm/core/QuillEditor/classes/ListContainer.js +20 -0
- package/esm/core/Textarea/index.js +1 -1
- package/esm/globals/styles/quill.module.js +1 -0
- package/esm/utils/getContrastColor.js +20 -0
- package/lib/core/Datepicker/index.d.ts +3 -3
- package/lib/core/Datepicker/index.d.ts.map +1 -1
- package/lib/core/QuillEditor/classes/IndentAttributor.d.ts +10 -0
- package/lib/core/QuillEditor/classes/IndentAttributor.d.ts.map +1 -0
- package/lib/core/QuillEditor/classes/IndentAttributor.js +49 -0
- package/lib/core/QuillEditor/classes/ListContainer.d.ts +10 -0
- package/lib/core/QuillEditor/classes/ListContainer.d.ts.map +1 -0
- package/lib/core/QuillEditor/classes/ListContainer.js +20 -0
- package/lib/core/Textarea/index.d.ts +3 -3
- package/lib/core/Textarea/index.d.ts.map +1 -1
- package/lib/core/Textarea/index.js +1 -1
- package/lib/globals/styles/quill.module.d.ts +2 -0
- package/lib/globals/styles/quill.module.d.ts.map +1 -0
- package/lib/globals/styles/quill.module.js +1 -0
- package/lib/utils/getContrastColor.d.ts +2 -0
- package/lib/utils/getContrastColor.d.ts.map +1 -0
- package/lib/utils/getContrastColor.js +20 -0
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
@@ -32421,7 +32421,7 @@
|
|
32421
32421
|
value: inputValue,
|
32422
32422
|
rows: rows,
|
32423
32423
|
placeholder: placeholder,
|
32424
|
-
onChange:
|
32424
|
+
onChange: handleChange,
|
32425
32425
|
maxLength: maxLength,
|
32426
32426
|
autoFocus: focus,
|
32427
32427
|
disabled: disabled,
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import Quill from 'quill';
|
2
|
+
const Parchment = Quill.import('parchment');
|
3
|
+
|
4
|
+
// Extend the Parchment StyleAttributor class
|
5
|
+
export class IndentAttributor extends Parchment.StyleAttributor {
|
6
|
+
constructor(...args) {
|
7
|
+
super(...args);
|
8
|
+
}
|
9
|
+
|
10
|
+
// Add both class and style functionality
|
11
|
+
add(node, value) {
|
12
|
+
if (value === 0) {
|
13
|
+
this.remove(node);
|
14
|
+
return true;
|
15
|
+
} else {
|
16
|
+
// Add the style as before
|
17
|
+
const result = super.add(node, `${value}em`);
|
18
|
+
// Additionally, add a class based on the indent value
|
19
|
+
this.addClass(node, value);
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
// Method to add a class based on the indent value
|
25
|
+
addClass(node, value) {
|
26
|
+
// Remove any existing indent-related classes to avoid conflicts
|
27
|
+
this.removeClass(node);
|
28
|
+
const className = `ql-indent-${value}`; // Example class, you can customize the naming convention
|
29
|
+
node.classList.add(className);
|
30
|
+
}
|
31
|
+
|
32
|
+
// Remove any existing indent-related class (to reset)
|
33
|
+
removeClass(node) {
|
34
|
+
// Find and remove any class starting with "indent-"
|
35
|
+
node.classList.forEach(className => {
|
36
|
+
if (className.startsWith('ql-indent-')) {
|
37
|
+
node.classList.remove(className);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
// Override the remove method to handle both styles and classes
|
43
|
+
remove(node) {
|
44
|
+
// Remove the style as before
|
45
|
+
super.remove(node);
|
46
|
+
// Remove any indent-related classes
|
47
|
+
this.removeClass(node);
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import Quill from 'quill';
|
2
|
+
const ListContainer = Quill.import('formats/list-container');
|
3
|
+
export class MyListContainer extends ListContainer {
|
4
|
+
static tagName = ['OL', 'UL'];
|
5
|
+
static defaultTag = 'OL';
|
6
|
+
static create(value) {
|
7
|
+
return document.createElement(this.getTag(value));
|
8
|
+
}
|
9
|
+
static getTag(val) {
|
10
|
+
const map = {
|
11
|
+
bullet: 'UL',
|
12
|
+
ordered: 'OL'
|
13
|
+
};
|
14
|
+
return map[val] || this.defaultTag;
|
15
|
+
}
|
16
|
+
checkMerge() {
|
17
|
+
// Only merge if the next list is the same type as this one
|
18
|
+
return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
import 'quill/dist/quill.snow.css';
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getContrastColor = getContrastColor;
|
7
|
+
function getContrastColor(bgColor, fallbackColor = 'white') {
|
8
|
+
if (!bgColor) return fallbackColor;
|
9
|
+
// Remove the # if present and parse the hexadecimal color
|
10
|
+
const hex = bgColor.replace('#', '');
|
11
|
+
const r = parseInt(hex?.substring(0, 2), 16);
|
12
|
+
const g = parseInt(hex?.substring(2, 4), 16);
|
13
|
+
const b = parseInt(hex?.substring(4, 6), 16);
|
14
|
+
|
15
|
+
// Calculate the relative luminance
|
16
|
+
const luminance = 0.2126 * (r / 255) ** 2.2 + 0.7152 * (g / 255) ** 2.2 + 0.0722 * (b / 255) ** 2.2;
|
17
|
+
|
18
|
+
// Choose white or black based on luminance
|
19
|
+
return luminance > 0.179 ? 'black' : 'white';
|
20
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
2
|
-
import React
|
3
|
-
interface IProps extends React.HTMLAttributes<HTMLInputElement> {
|
2
|
+
import React from 'react';
|
3
|
+
interface IProps extends Omit<React.HTMLAttributes<HTMLInputElement>, 'onChange'> {
|
4
4
|
/** Adds label to input */
|
5
5
|
label?: string;
|
6
6
|
/** Give the input a value */
|
@@ -20,7 +20,7 @@ interface IProps extends React.HTMLAttributes<HTMLInputElement> {
|
|
20
20
|
/** Adds title if disabled */
|
21
21
|
disabledTitle?: string;
|
22
22
|
/** On change callback, returns date */
|
23
|
-
onChange?:
|
23
|
+
onChange?: (value: Date) => void;
|
24
24
|
/** Callback fired on date picker hide. Only for input */
|
25
25
|
onBlur?: () => void;
|
26
26
|
/** Renders picker without input */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Datepicker/index.tsx"],"names":[],"mappings":"AACA,sCAAsC;AACtC,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Datepicker/index.tsx"],"names":[],"mappings":"AACA,sCAAsC;AACtC,OAAO,KAAsC,MAAM,OAAO,CAAA;AAY1D,UAAU,MACR,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAChE,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oDAAoD;IACpD,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,2BAA2B;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAA;IAChC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAID,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAiNhC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
declare const Parchment: any;
|
2
|
+
export declare class IndentAttributor extends Parchment.StyleAttributor {
|
3
|
+
constructor(...args: any);
|
4
|
+
add(node: any, value: any): any;
|
5
|
+
addClass(node: any, value: any): void;
|
6
|
+
removeClass(node: any): void;
|
7
|
+
remove(node: any): void;
|
8
|
+
}
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=IndentAttributor.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IndentAttributor.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/classes/IndentAttributor.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,EAAgC,GAAG,CAAA;AAGlD,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,eAAe;gBACjD,GAAG,IAAI,EAAE,GAAG;IAKxB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;IAczB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;IAS9B,WAAW,CAAC,IAAI,EAAE,GAAG;IAUrB,MAAM,CAAC,IAAI,EAAE,GAAG;CAMjB"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import Quill from 'quill';
|
2
|
+
const Parchment = Quill.import('parchment');
|
3
|
+
|
4
|
+
// Extend the Parchment StyleAttributor class
|
5
|
+
export class IndentAttributor extends Parchment.StyleAttributor {
|
6
|
+
constructor(...args) {
|
7
|
+
super(...args);
|
8
|
+
}
|
9
|
+
|
10
|
+
// Add both class and style functionality
|
11
|
+
add(node, value) {
|
12
|
+
if (value === 0) {
|
13
|
+
this.remove(node);
|
14
|
+
return true;
|
15
|
+
} else {
|
16
|
+
// Add the style as before
|
17
|
+
const result = super.add(node, `${value}em`);
|
18
|
+
// Additionally, add a class based on the indent value
|
19
|
+
this.addClass(node, value);
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
// Method to add a class based on the indent value
|
25
|
+
addClass(node, value) {
|
26
|
+
// Remove any existing indent-related classes to avoid conflicts
|
27
|
+
this.removeClass(node);
|
28
|
+
const className = `ql-indent-${value}`; // Example class, you can customize the naming convention
|
29
|
+
node.classList.add(className);
|
30
|
+
}
|
31
|
+
|
32
|
+
// Remove any existing indent-related class (to reset)
|
33
|
+
removeClass(node) {
|
34
|
+
// Find and remove any class starting with "indent-"
|
35
|
+
node.classList.forEach(className => {
|
36
|
+
if (className.startsWith('ql-indent-')) {
|
37
|
+
node.classList.remove(className);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
// Override the remove method to handle both styles and classes
|
43
|
+
remove(node) {
|
44
|
+
// Remove the style as before
|
45
|
+
super.remove(node);
|
46
|
+
// Remove any indent-related classes
|
47
|
+
this.removeClass(node);
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
declare const ListContainer: any;
|
2
|
+
export declare class MyListContainer extends ListContainer {
|
3
|
+
static tagName: string[];
|
4
|
+
static defaultTag: string;
|
5
|
+
static create(value: 'bullet' | 'ordered'): HTMLElement;
|
6
|
+
static getTag(val: 'bullet' | 'ordered'): string;
|
7
|
+
checkMerge(): any;
|
8
|
+
}
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=ListContainer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ListContainer.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/classes/ListContainer.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,aAAa,EAA6C,GAAG,CAAA;AACnE,qBAAa,eAAgB,SAAQ,aAAa;IAChD,MAAM,CAAC,OAAO,WAAe;IAC7B,MAAM,CAAC,UAAU,SAAO;IAExB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS;IAIzC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS;IAQvC,UAAU;CAMX"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import Quill from 'quill';
|
2
|
+
const ListContainer = Quill.import('formats/list-container');
|
3
|
+
export class MyListContainer extends ListContainer {
|
4
|
+
static tagName = ['OL', 'UL'];
|
5
|
+
static defaultTag = 'OL';
|
6
|
+
static create(value) {
|
7
|
+
return document.createElement(this.getTag(value));
|
8
|
+
}
|
9
|
+
static getTag(val) {
|
10
|
+
const map = {
|
11
|
+
bullet: 'UL',
|
12
|
+
ordered: 'OL'
|
13
|
+
};
|
14
|
+
return map[val] || this.defaultTag;
|
15
|
+
}
|
16
|
+
checkMerge() {
|
17
|
+
// Only merge if the next list is the same type as this one
|
18
|
+
return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
|
19
|
+
}
|
20
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
2
|
-
import React
|
3
|
-
interface IProps extends React.HTMLAttributes<HTMLTextAreaElement> {
|
2
|
+
import React from 'react';
|
3
|
+
interface IProps extends Omit<React.HTMLAttributes<HTMLTextAreaElement>, 'onChange'> {
|
4
4
|
/** Label of textarea */
|
5
5
|
label?: string;
|
6
6
|
/** Default value */
|
@@ -22,7 +22,7 @@ interface IProps extends React.HTMLAttributes<HTMLTextAreaElement> {
|
|
22
22
|
/** Disable textarea */
|
23
23
|
disabled?: boolean;
|
24
24
|
/** Callback fired on changes */
|
25
|
-
onChange?:
|
25
|
+
onChange?: (value: string) => void;
|
26
26
|
}
|
27
27
|
declare const Textarea: React.FC<IProps>;
|
28
28
|
export default Textarea;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Textarea/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Textarea/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAA8B,MAAM,OAAO,CAAA;AAMlD,UAAU,MACR,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACnE,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAEnC;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CA6D9B,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"quill.module.d.ts","sourceRoot":"","sources":["../../../src/packages/globals/styles/quill.module.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
import 'quill/dist/quill.snow.css';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getContrastColor.d.ts","sourceRoot":"","sources":["../../src/packages/utils/getContrastColor.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,MAAgB,UAiBhC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getContrastColor = getContrastColor;
|
7
|
+
function getContrastColor(bgColor, fallbackColor = 'white') {
|
8
|
+
if (!bgColor) return fallbackColor;
|
9
|
+
// Remove the # if present and parse the hexadecimal color
|
10
|
+
const hex = bgColor.replace('#', '');
|
11
|
+
const r = parseInt(hex?.substring(0, 2), 16);
|
12
|
+
const g = parseInt(hex?.substring(2, 4), 16);
|
13
|
+
const b = parseInt(hex?.substring(4, 6), 16);
|
14
|
+
|
15
|
+
// Calculate the relative luminance
|
16
|
+
const luminance = 0.2126 * (r / 255) ** 2.2 + 0.7152 * (g / 255) ** 2.2 + 0.0722 * (b / 255) ** 2.2;
|
17
|
+
|
18
|
+
// Choose white or black based on luminance
|
19
|
+
return luminance > 0.179 ? 'black' : 'white';
|
20
|
+
}
|