@mgdis/mg-components 5.21.0 → 5.22.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/dist/cjs/{components.utils-cd908d4e.js → components.utils-637c479d.js} +9 -5
- package/dist/cjs/components.utils-637c479d.js.map +1 -0
- package/dist/cjs/{index-8532b5e9.js → index-28bf9033.js} +25 -17
- package/dist/cjs/index-28bf9033.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_34.cjs.entry.js +195 -146
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +2 -2
- package/dist/collection/assets/icons/index.js +91 -90
- package/dist/collection/assets/icons/index.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +3 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +32 -11
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +9 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +56 -44
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +27 -10
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/locales/en/messages.json +4 -2
- package/dist/collection/locales/fr/messages.json +4 -2
- package/dist/collection/utils/behaviors.utils.spec.js +1 -1
- package/dist/collection/utils/behaviors.utils.spec.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +1 -1
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/components/index2.js +8 -4
- package/dist/components/index2.js.map +1 -1
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-icon2.js +92 -90
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +25 -12
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +50 -34
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-popover2.js +27 -10
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +3 -1
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/{components.utils-0d67c31c.js → components.utils-f7c073a0.js} +9 -5
- package/dist/esm/components.utils-f7c073a0.js.map +1 -0
- package/dist/esm/{index-f34a3a2c.js → index-93dafb06.js} +25 -17
- package/dist/esm/index-93dafb06.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_34.entry.js +195 -146
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-item-more.entry.js +2 -2
- package/dist/mg-components/locales/en/messages.json +4 -2
- package/dist/mg-components/locales/fr/messages.json +4 -2
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-457dd62a.entry.js +2 -0
- package/dist/mg-components/p-457dd62a.entry.js.map +1 -0
- package/dist/mg-components/{p-ce356bc0.entry.js → p-4fa40a8f.entry.js} +2 -2
- package/dist/mg-components/p-721c4571.js +2 -0
- package/dist/mg-components/{p-af42d17b.js.map → p-721c4571.js.map} +1 -1
- package/dist/mg-components/p-8155d0e2.js +3 -0
- package/dist/mg-components/p-8155d0e2.js.map +1 -0
- package/dist/types/assets/icons/index.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +4 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +14 -12
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +10 -0
- package/dist/types/components.d.ts +10 -2
- package/dist/types/locales/index.d.ts +4 -0
- package/package.json +6 -6
- package/dist/cjs/components.utils-cd908d4e.js.map +0 -1
- package/dist/cjs/index-8532b5e9.js.map +0 -1
- package/dist/esm/components.utils-0d67c31c.js.map +0 -1
- package/dist/esm/index-f34a3a2c.js.map +0 -1
- package/dist/mg-components/p-7444ff40.js +0 -3
- package/dist/mg-components/p-7444ff40.js.map +0 -1
- package/dist/mg-components/p-af42d17b.js +0 -2
- package/dist/mg-components/p-e591ba8f.entry.js +0 -2
- package/dist/mg-components/p-e591ba8f.entry.js.map +0 -1
- /package/dist/mg-components/{p-ce356bc0.entry.js.map → p-4fa40a8f.entry.js.map} +0 -0
|
@@ -27,6 +27,10 @@ export declare class MgInputCheckboxPaginated implements IMgInputCheckboxBase {
|
|
|
27
27
|
* Define mg-input-checkbox input invalid
|
|
28
28
|
*/
|
|
29
29
|
invalid: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Current page
|
|
32
|
+
*/
|
|
33
|
+
currentPage: number;
|
|
30
34
|
/**
|
|
31
35
|
* Define checkboxes to paginate
|
|
32
36
|
*/
|
|
@@ -50,10 +54,6 @@ export declare class MgInputCheckboxPaginated implements IMgInputCheckboxBase {
|
|
|
50
54
|
* Define section title
|
|
51
55
|
*/
|
|
52
56
|
titleKind: SectionTitleKind;
|
|
53
|
-
/**
|
|
54
|
-
* Current page
|
|
55
|
-
*/
|
|
56
|
-
currentPage: number;
|
|
57
57
|
/**
|
|
58
58
|
* Is checked items values expanded
|
|
59
59
|
*/
|
package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts
CHANGED
|
@@ -64,3 +64,11 @@ export interface MgInputCheckboxListProps extends IMgInputCheckboxBase {
|
|
|
64
64
|
checkboxes: CheckboxItem[];
|
|
65
65
|
id: string;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Define select values button key
|
|
69
|
+
*/
|
|
70
|
+
export declare enum SelectValuesButtonKey {
|
|
71
|
+
EDIT = "editButton",
|
|
72
|
+
SHOW = "showButton",
|
|
73
|
+
SELECT = "selectButton"
|
|
74
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../../stencil-public-runtime';
|
|
2
2
|
import { ClassList } from '../../../../utils/components.utils';
|
|
3
|
-
import { CheckboxItem, CheckboxType, CheckboxValue, MgInputCheckboxListProps } from './mg-input-checkbox.conf';
|
|
3
|
+
import { CheckboxItem, CheckboxType, CheckboxValue, MgInputCheckboxListProps, SelectValuesButtonKey } from './mg-input-checkbox.conf';
|
|
4
4
|
export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, 'id' | 'checkboxes' | 'messages'> {
|
|
5
5
|
/************
|
|
6
6
|
* Internal *
|
|
@@ -15,6 +15,7 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
|
|
|
15
15
|
private readonly baseClassName;
|
|
16
16
|
private readonly multiStart;
|
|
17
17
|
private readonly searchStart;
|
|
18
|
+
private hasOpenedPopover;
|
|
18
19
|
/**************
|
|
19
20
|
* Decorators *
|
|
20
21
|
**************/
|
|
@@ -124,6 +125,10 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
|
|
|
124
125
|
* Search current page
|
|
125
126
|
*/
|
|
126
127
|
searchResults: CheckboxItem[];
|
|
128
|
+
/**
|
|
129
|
+
* Select values button text local key
|
|
130
|
+
*/
|
|
131
|
+
selectValuesButtonKey: SelectValuesButtonKey;
|
|
127
132
|
/**
|
|
128
133
|
* Emitted event when value change
|
|
129
134
|
*/
|
|
@@ -157,7 +162,7 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
|
|
|
157
162
|
private handleInput;
|
|
158
163
|
/**
|
|
159
164
|
* Keyboard handler
|
|
160
|
-
* @param event - to
|
|
165
|
+
* @param event - to track "tab" key
|
|
161
166
|
*/
|
|
162
167
|
private handleKeydown;
|
|
163
168
|
/**
|
|
@@ -209,11 +214,9 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
|
|
|
209
214
|
*/
|
|
210
215
|
private checkValidity;
|
|
211
216
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @param selectedValuesNb - nb of selected values
|
|
214
|
-
* @returns translated message
|
|
217
|
+
* Set button text locale key
|
|
215
218
|
*/
|
|
216
|
-
private
|
|
219
|
+
private setButtonText;
|
|
217
220
|
/**
|
|
218
221
|
* Set input error message
|
|
219
222
|
* @param displayError - dispay error condition
|
|
@@ -230,6 +233,11 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
|
|
|
230
233
|
* @returns items to display
|
|
231
234
|
*/
|
|
232
235
|
private getDisplayItems;
|
|
236
|
+
/**
|
|
237
|
+
* get list of selected checkboxItems
|
|
238
|
+
* @returns selected checkboxItems
|
|
239
|
+
*/
|
|
240
|
+
private getSelectedItems;
|
|
233
241
|
/*************
|
|
234
242
|
* Lifecycle *
|
|
235
243
|
*************/
|
|
@@ -242,12 +250,6 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
|
|
|
242
250
|
* add listeners and DOM attributed
|
|
243
251
|
*/
|
|
244
252
|
componentDidLoad(): void;
|
|
245
|
-
/**
|
|
246
|
-
* Render checkbox multi display values
|
|
247
|
-
* @param selectedValuesNb - selected values length
|
|
248
|
-
* @returns display selected values
|
|
249
|
-
*/
|
|
250
|
-
private renderCheckboxMultiDisplaySelectedValues;
|
|
251
253
|
/**
|
|
252
254
|
* Render checkboxes by section
|
|
253
255
|
* @param checkboxes - checkboxes to render
|
|
@@ -61,6 +61,16 @@ export declare class MgPopover {
|
|
|
61
61
|
* Hide popover
|
|
62
62
|
*/
|
|
63
63
|
private hide;
|
|
64
|
+
/**
|
|
65
|
+
* Set popper listeners
|
|
66
|
+
* @param newValue - if true enable popper listners
|
|
67
|
+
*/
|
|
68
|
+
private setPopperListeners;
|
|
69
|
+
/**
|
|
70
|
+
* Manage all clickOustside listeners
|
|
71
|
+
* @param action top process on elements listeners
|
|
72
|
+
*/
|
|
73
|
+
private manageClickOutsideListeners;
|
|
64
74
|
/**
|
|
65
75
|
* Handle content hide event
|
|
66
76
|
*/
|
|
@@ -60,7 +60,7 @@ export namespace Components {
|
|
|
60
60
|
*/
|
|
61
61
|
"displayChevron": boolean;
|
|
62
62
|
/**
|
|
63
|
-
* Define
|
|
63
|
+
* Define displayed icon
|
|
64
64
|
*/
|
|
65
65
|
"icon": MgActionMoreIconType;
|
|
66
66
|
/**
|
|
@@ -326,6 +326,10 @@ export namespace Components {
|
|
|
326
326
|
* Define checkboxes to paginate
|
|
327
327
|
*/
|
|
328
328
|
"checkboxes": CheckboxItem[];
|
|
329
|
+
/**
|
|
330
|
+
* Current page
|
|
331
|
+
*/
|
|
332
|
+
"currentPage": number;
|
|
329
333
|
/**
|
|
330
334
|
* Define if mg-input-checkbox-list is disabled
|
|
331
335
|
*/
|
|
@@ -1897,7 +1901,7 @@ declare namespace LocalJSX {
|
|
|
1897
1901
|
*/
|
|
1898
1902
|
"displayChevron"?: boolean;
|
|
1899
1903
|
/**
|
|
1900
|
-
* Define
|
|
1904
|
+
* Define displayed icon
|
|
1901
1905
|
*/
|
|
1902
1906
|
"icon"?: MgActionMoreIconType;
|
|
1903
1907
|
/**
|
|
@@ -2173,6 +2177,10 @@ declare namespace LocalJSX {
|
|
|
2173
2177
|
* Define checkboxes to paginate
|
|
2174
2178
|
*/
|
|
2175
2179
|
"checkboxes"?: CheckboxItem[];
|
|
2180
|
+
/**
|
|
2181
|
+
* Current page
|
|
2182
|
+
*/
|
|
2183
|
+
"currentPage"?: number;
|
|
2176
2184
|
/**
|
|
2177
2185
|
* Define if mg-input-checkbox-list is disabled
|
|
2178
2186
|
*/
|
|
@@ -35,11 +35,13 @@ declare const messages: {
|
|
|
35
35
|
title: string;
|
|
36
36
|
titlePlurial: string;
|
|
37
37
|
action: string;
|
|
38
|
+
tooltip: string;
|
|
38
39
|
};
|
|
39
40
|
notSelected: {
|
|
40
41
|
title: string;
|
|
41
42
|
titlePlurial: string;
|
|
42
43
|
action: string;
|
|
44
|
+
tooltip: string;
|
|
43
45
|
};
|
|
44
46
|
};
|
|
45
47
|
};
|
|
@@ -121,11 +123,13 @@ declare const messages: {
|
|
|
121
123
|
title: string;
|
|
122
124
|
titlePlurial: string;
|
|
123
125
|
action: string;
|
|
126
|
+
tooltip: string;
|
|
124
127
|
};
|
|
125
128
|
notSelected: {
|
|
126
129
|
title: string;
|
|
127
130
|
titlePlurial: string;
|
|
128
131
|
action: string;
|
|
132
|
+
tooltip: string;
|
|
129
133
|
};
|
|
130
134
|
};
|
|
131
135
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgdis/mg-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.22.0",
|
|
4
4
|
"description": "MG Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@popperjs/core": "^2.11.8",
|
|
27
|
-
"@stencil/core": "4.
|
|
27
|
+
"@stencil/core": "4.9.1",
|
|
28
28
|
"@mgdis/img": "1.6.0",
|
|
29
|
-
"@mgdis/styles": "1.0
|
|
29
|
+
"@mgdis/styles": "1.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@playwright/test": "1.40.1",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"storybook": "^7.5.3",
|
|
60
60
|
"ts-node": "^10.9.1",
|
|
61
61
|
"typescript": "5.3.3",
|
|
62
|
-
"
|
|
63
|
-
"tsconfig": "1.0.0",
|
|
62
|
+
"@mgdis/linting-stencil": "1.1.0",
|
|
64
63
|
"@mgdis/playwright-helpers": "1.0.0",
|
|
65
|
-
"
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EF;;;;;MAKa,aAAa,GAAG,CAAC,KAAc,KAAc,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG;AAE3G;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,KACtC,OAAO,IAAI,KAAK,QAAQ;IACxB,IAAI;SACD,iBAAiB,EAAE;SACnB,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE,EAAE;AAExC;;;;;MAKa,QAAQ,GAAG,OAAO,QAAoB,KAAoB,QAAQ;;;;;;;;;;;;;;;;;;","names":["Direction"],"sources":["src/utils/locale.utils.ts","src/locales/index.ts","src/components/molecules/menu/mg-menu/mg-menu.conf.ts","src/utils/components.utils.ts"],"sourcesContent":["/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n */\nexport const localeCurrency = (number: number, locale: string, currency: string): string => {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n};\n\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @returns formatted number\n */\nexport const localeNumber = (number: number, locale: string): string => {\n return new Intl.NumberFormat(locale).format(number);\n};\n\n/**\n * Date RegExp\n */\nexport const dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @returns formatted date\n */\nexport const localeDate = (date: string, locale: string): string => {\n if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {\n return '';\n }\n return new Intl.DateTimeFormat(locale).format(new Date(date));\n};\n\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nexport const getLocaleMessages = (element: HTMLElement, messages: unknown, defaultLocale: string): { locale: string; messages: Record<string, unknown> } => {\n // Get local\n const closestLangAttribute: HTMLElement = element.closest('[lang]');\n const closestLang: string[] = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // Return\n return {\n locale,\n messages: messages[localeSubtag] || messages[defaultLocale],\n };\n};\n","import en from './en/messages.json';\nimport fr from './fr/messages.json';\nimport { getLocaleMessages } from '../utils/locale.utils';\n\nconst defaultLocale = 'en';\nconst messages = { en, fr };\n\n/**\n * Get Intl object\n * @param element - element we need to get the language\n * @returns messages object\n */\nexport const initLocales = (element: HTMLElement): { locale: string; messages: Record<string, unknown> } => getLocaleMessages(element, messages, defaultLocale);\n","import { MgItemMore } from '../../mg-item-more/mg-item-more';\n\n/**\n * Menu direction type\n */\nexport enum Direction {\n VERTICAL = 'vertical',\n HORIZONTAL = 'horizontal',\n}\n\n/**\n * ItemMore prop type\n */\nexport type ItemMoreType = Pick<MgItemMore, 'icon' | 'slotlabel' | 'size'>;\n\n/**\n * List of all possibles sizes\n */\nexport const sizes = ['regular', 'medium', 'large'] as const;\n\n/**\n * item Size from sizes\n */\nexport type MenuSizeType = (typeof sizes)[number];\n","/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nexport const createID = (prefix = '', length = 10): string => {\n const randomBytes = new Uint8Array(length);\n\n crypto.getRandomValues(randomBytes);\n\n const hexString = Array.from(randomBytes)\n .map(byte => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, length);\n\n return prefix !== '' ? `${prefix}-${hexString}` : hexString;\n};\n\n/**\n * Class to manage component classlist\n * Set() are not working when imported in project\n */\nexport class ClassList {\n /**\n * Available classes\n */\n classes: string[];\n\n constructor(classlist: string[] = []) {\n this.classes = classlist;\n }\n\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className: string): void => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className: string): void => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className: string): boolean => {\n return this.classes.includes(className);\n };\n\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = (): string => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if all items are string\n * @param items - items to check\n * @returns all items are string\n */\nexport const allItemsAreString = (items: unknown): items is string[] => Array.isArray(items) && items.every(item => typeof item === 'string');\n\n/**\n * Check if element is a heading\n * @param element - slotted element\n * @param tagNames - allowed tag names list\n * @returns element is a heading\n */\nexport const isTagName = (element: Element, tagNames: string[]): boolean => {\n return tagNames.includes(element?.tagName.toLowerCase());\n};\n\n/**\n * Focusable elements query selector\n */\nexport const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]';\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nexport const getWindows = (localWindow: Window): Window[] => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nexport const getParentWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow: Window = localWindow.parent;\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n } catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\n/**\n * Validate string\n * @param value - value to check\n * @returns if string is valid\n */\nexport const isValidString = (value: unknown): boolean => typeof value === 'string' && value.trim() !== '';\n\n/**\n * Clean string caraters\n * @param text - text to cliean\n * @returns cleanded string\n */\nexport const cleanString = (text: string): string =>\n typeof text === 'string' &&\n text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '');\n\n/**\n * Use to process code next tick in the event loop\n * @param callback - code to excute on next tick\n * @returns differed code excution\n */\nexport const nextTick = async (callback: () => void): Promise<void> => callback();\n"],"version":3}
|