@dreamcommerce/aurora 2.4.0-20 → 2.4.0-21

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.
@@ -18,7 +18,7 @@ var main_module = require('../../../css/dropdown/main.module.less.js');
18
18
  var utilities = require('../utilities.js');
19
19
  var use_click_outside = require('../../../hooks/use_click_outside.js');
20
20
  var icon_arrow = require('../../../assets/icon_arrow.js');
21
- var ui_dom_utils = require('../../../../../utilities/build/esm/packages/utilities/src/ui_dom_utils.js');
21
+ var utilities$1 = require('@dreamcommerce/utilities');
22
22
 
23
23
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
24
 
@@ -82,7 +82,7 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
82
82
  var _a;
83
83
  if (!(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current) || !isOpen)
84
84
  return;
85
- const scrollableParent = (_a = ui_dom_utils.UiDomUtils.getFirstScrollableParent(wrapperRef.current)) !== null && _a !== void 0 ? _a : document.body;
85
+ const scrollableParent = (_a = utilities$1.UiDomUtils.getFirstScrollableParent(wrapperRef.current)) !== null && _a !== void 0 ? _a : document.body;
86
86
  const handleWindowScroll = () => {
87
87
  if (typeof closeDropdown === 'function') {
88
88
  closeDropdown();
@@ -87,7 +87,7 @@ onChange, hasCloseIcon }) => {
87
87
  /**
88
88
  * isOpen provides state if dropdown is open(visible), toggleDropdown is a function which toggles dropdown content
89
89
  */
90
- const [isOpen, toggleDropdown] = use_toggle.useToggle(defaultIsOpen, onToggle);
90
+ const [isOpen, toggleDropdown, openDropdown, closeDropdown] = use_toggle.useToggle(defaultIsOpen, onToggle);
91
91
  /**
92
92
  * hook with option list state, and method to change option list
93
93
  */
@@ -99,7 +99,7 @@ onChange, hasCloseIcon }) => {
99
99
  /**
100
100
  * context values, they may be used with useContext in any component which is part of Dropdown composition
101
101
  */
102
- const value = React__default['default'].useMemo(() => ({ wrapperRef, isOpen, toggleDropdown }), [isOpen, toggleDropdown]);
102
+ const value = React__default['default'].useMemo(() => ({ wrapperRef, isOpen, toggleDropdown, openDropdown, closeDropdown }), [isOpen, toggleDropdown, openDropdown, closeDropdown]);
103
103
  /**
104
104
  * hook which resets options list to default on close if select has search and it was used
105
105
  */
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var useTranslation = require('../../../../../../external/react-i18next/dist/es/useTranslation.js');
7
- var file_utils = require('../../../../../utilities/build/esm/packages/utilities/src/file_utils.js');
7
+ var utilities = require('@dreamcommerce/utilities');
8
8
  var main_module = require('../../../css/file_picker/main.module.less.js');
9
9
  var css_classes = require('../css_classes.js');
10
10
  var icon_delete = require('../../../assets/icon_delete.js');
@@ -22,8 +22,8 @@ const SelectedFilePreview = ({ file, isPreview, onPreviewError, onFileDelete })
22
22
  React__default['default'].createElement("div", { className: main_module['default'][css_classes['default'].filePickerSelectedFile] },
23
23
  React__default['default'].createElement("div", { className: main_module['default'][css_classes['default'].filePickerSelectedFileNameWrapper] },
24
24
  React__default['default'].createElement("span", { className: main_module['default'][css_classes['default'].filePickerSelectedFileFullName] },
25
- React__default['default'].createElement("span", { className: main_module['default'][css_classes['default'].filePickerSelectedFileName] }, fileFullName && file_utils.FileUtils.getFileName(fileFullName)),
26
- fileFullName && `.${file_utils.FileUtils.getFileExtension(fileFullName)}`)),
25
+ React__default['default'].createElement("span", { className: main_module['default'][css_classes['default'].filePickerSelectedFileName] }, fileFullName && utilities.FileUtils.getFileName(fileFullName)),
26
+ fileFullName && `.${utilities.FileUtils.getFileExtension(fileFullName)}`)),
27
27
  React__default['default'].createElement("div", { className: main_module['default'][css_classes['default'].filePickerSelectedFileRemoveWrapper] },
28
28
  React__default['default'].createElement("span", { onClick: onFileDelete, className: main_module['default'][css_classes['default'].filePickerDeleteButton] },
29
29
  React__default['default'].createElement(icon_delete['default'], { className: main_module['default'][css_classes['default'].filePickerDeleteIcon] }),
@@ -41,10 +41,10 @@ var index$w = require('./components/table/index.js');
41
41
  var dataTable = require('./components/table/hoc/data-table.js');
42
42
  var context = require('./components/flash_messenger/context.js');
43
43
  var index$E = require('./components/message-box/index.js');
44
- var index$x = require('./components/grid/index.js');
45
44
  var flash_messages_list = require('./components/flash_messenger/components/flash_messages_list.js');
46
45
  var index$F = require('./components/flash_messenger/index.js');
47
46
  var index$i = require('./components/gallery/index.js');
47
+ var index$x = require('./components/grid/index.js');
48
48
  var index$p = require('./components/typography/index.js');
49
49
  var index$o = require('./components/heading/index.js');
50
50
  var icon_desktop = require('./assets/icon_desktop.js');
@@ -120,10 +120,10 @@ exports.DataTable = dataTable['default'];
120
120
  exports.FlashMessengerContext = context.FlashMessengerContext;
121
121
  exports.useFlashMessenger = context.useFlashMessenger;
122
122
  exports.MessageBox = index$E['default'];
123
- exports.Grid = index$x['default'];
124
123
  exports.FlashMessagesList = flash_messages_list['default'];
125
124
  exports.FlashMessenger = index$F['default'];
126
125
  exports.Gallery = index$i['default'];
126
+ exports.Grid = index$x['default'];
127
127
  exports.Typography = index$p.Typography;
128
128
  exports.Heading = index$o['default'];
129
129
  exports.IconDesktop = icon_desktop['default'];
@@ -14,7 +14,7 @@ import cssClasses from '../../../css/dropdown/main.module.less.js';
14
14
  import { getXYModifiersForNestedDropdowns, isChildOfModal } from '../utilities.js';
15
15
  import { useClickOutside } from '../../../hooks/use_click_outside.js';
16
16
  import IconArrow from '../../../assets/icon_arrow.js';
17
- import { UiDomUtils } from '../../../../../utilities/build/esm/packages/utilities/src/ui_dom_utils.js';
17
+ import { UiDomUtils } from '@dreamcommerce/utilities';
18
18
 
19
19
  /**
20
20
  * Dropdown.Content component. This togglable part of dropdown.
@@ -79,7 +79,7 @@ onChange, hasCloseIcon }) => {
79
79
  /**
80
80
  * isOpen provides state if dropdown is open(visible), toggleDropdown is a function which toggles dropdown content
81
81
  */
82
- const [isOpen, toggleDropdown] = useToggle(defaultIsOpen, onToggle);
82
+ const [isOpen, toggleDropdown, openDropdown, closeDropdown] = useToggle(defaultIsOpen, onToggle);
83
83
  /**
84
84
  * hook with option list state, and method to change option list
85
85
  */
@@ -91,7 +91,7 @@ onChange, hasCloseIcon }) => {
91
91
  /**
92
92
  * context values, they may be used with useContext in any component which is part of Dropdown composition
93
93
  */
94
- const value = React.useMemo(() => ({ wrapperRef, isOpen, toggleDropdown }), [isOpen, toggleDropdown]);
94
+ const value = React.useMemo(() => ({ wrapperRef, isOpen, toggleDropdown, openDropdown, closeDropdown }), [isOpen, toggleDropdown, openDropdown, closeDropdown]);
95
95
  /**
96
96
  * hook which resets options list to default on close if select has search and it was used
97
97
  */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from '../../../../../../external/react-i18next/dist/es/useTranslation.js';
3
- import { FileUtils } from '../../../../../utilities/build/esm/packages/utilities/src/file_utils.js';
3
+ import { FileUtils } from '@dreamcommerce/utilities';
4
4
  import styles from '../../../css/file_picker/main.module.less.js';
5
5
  import CSS_CLASSES from '../css_classes.js';
6
6
  import IconDelete from '../../../assets/icon_delete.js';
@@ -37,10 +37,10 @@ export { default as Table } from './components/table/index.js';
37
37
  export { default as DataTable } from './components/table/hoc/data-table.js';
38
38
  export { FlashMessengerContext, useFlashMessenger } from './components/flash_messenger/context.js';
39
39
  export { default as MessageBox } from './components/message-box/index.js';
40
- export { default as Grid } from './components/grid/index.js';
41
40
  export { default as FlashMessagesList } from './components/flash_messenger/components/flash_messages_list.js';
42
41
  export { default as FlashMessenger } from './components/flash_messenger/index.js';
43
42
  export { default as Gallery } from './components/gallery/index.js';
43
+ export { default as Grid } from './components/grid/index.js';
44
44
  export { Typography } from './components/typography/index.js';
45
45
  export { default as Heading } from './components/heading/index.js';
46
46
  export { default as IconDesktop } from './assets/icon_desktop.js';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dreamcommerce/aurora",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "2.4.0-20",
5
+ "version": "2.4.0-21",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- class FileUtils {
6
- static bytesToSize(bytes) {
7
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
8
- if (bytes === 0)
9
- return 'n/a';
10
- const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
11
- if (i === 0)
12
- return `${bytes} ${sizes[i]}`;
13
- return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${sizes[i]}`;
14
- }
15
- static getFileExtension(filename) {
16
- var _a;
17
- const filenameParts = filename.split('.').filter((part) => part);
18
- return filenameParts.length > 1 ? (_a = filenameParts.pop()) !== null && _a !== void 0 ? _a : '' : '';
19
- }
20
- static getFileName(filename) {
21
- return filename.substring(0, filename.lastIndexOf('.')) || filename;
22
- }
23
- }
24
-
25
- exports.FileUtils = FileUtils;
26
- //# sourceMappingURL=file_utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,96 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- class UiDomUtils {
6
- static show($el) {
7
- $el.removeAttribute('hidden');
8
- }
9
- static hide($el) {
10
- $el.setAttribute('hidden', '');
11
- }
12
- static empty($el) {
13
- $el.innerHTML = '';
14
- }
15
- static makeUnnavigable($el) {
16
- $el.setAttribute('tabindex', '-1');
17
- }
18
- static makeNavigable($el) {
19
- $el.setAttribute('tabindex', '0');
20
- }
21
- static getFocusableSelector() {
22
- return ('' +
23
- // Namespace problems of [xlink:href] explained in https://stackoverflow.com/a/23047888/515124
24
- // svg a[*|href] does not match in IE9, but since we're filtering
25
- // through is/focusable we can include all <a> from SVG
26
- 'svg a,' +
27
- // may behave as 'svg, svg *,' in chrome as *every* svg element with a focus event listener is focusable
28
- // navigational elements
29
- 'a[href],' +
30
- // validity determined by is/valid-area.js
31
- 'area[href],' +
32
- // validity determined by is/disabled.js
33
- 'input:not([type="hidden"]), select, textarea, button,' +
34
- // browsing context containers
35
- 'iframe, object, embed,' +
36
- // interactive content
37
- 'keygen,' +
38
- // validity determined by is/valid-tabindex.js
39
- '[tabindex]:not([tabindex="-1"]),' +
40
- // editing hosts
41
- '[contenteditable]');
42
- }
43
- static getFocusableElements($container) {
44
- return [...$container.querySelectorAll(this.getFocusableSelector())].filter(($el) => !this._isNotFocusable($el));
45
- }
46
- static getFocusableElement($container) {
47
- return [...$container.querySelectorAll(this.getFocusableSelector())].filter(($el) => !this._isNotFocusable($el))[0];
48
- }
49
- static _isNotFocusable($el) {
50
- const displayValue = getComputedStyle($el).getPropertyValue('display');
51
- return !!($el.hasAttribute('disabled') || $el.getAttribute('aria-hidden') || $el.hasAttribute('hidden') || displayValue === 'none');
52
- }
53
- static isFocusable($element) {
54
- return $element.matches(this.getFocusableSelector());
55
- }
56
- static setFocusToFirstFocusableElementInContainer($container) {
57
- var _a;
58
- (_a = this.getFocusableElement($container)) === null || _a === void 0 ? void 0 : _a.focus();
59
- }
60
- static getDirectChildren($el, selector) {
61
- return selector ? [...$el.children].filter((child) => child.matches(selector)) : [...$el.children];
62
- }
63
- static getAllClosest($el, selector, elements = []) {
64
- if (!$el)
65
- return elements;
66
- const $closestEl = $el.closest(selector);
67
- if ($closestEl)
68
- elements.push($closestEl);
69
- if (!$closestEl)
70
- return elements;
71
- return UiDomUtils.getAllClosest($closestEl.parentElement, selector, elements);
72
- }
73
- static getFirstParentNonStaticElement($el) {
74
- let $currentEl = $el.parentElement;
75
- while ($currentEl) {
76
- if ($currentEl && window.getComputedStyle($currentEl).position !== 'static') {
77
- return $currentEl;
78
- }
79
- $currentEl = $currentEl.parentElement;
80
- }
81
- return null;
82
- }
83
- static getFirstScrollableParent($el) {
84
- let currentParent = $el.parentElement;
85
- while (currentParent) {
86
- if (currentParent.scrollHeight > currentParent.clientHeight) {
87
- return currentParent;
88
- }
89
- currentParent = currentParent === null || currentParent === void 0 ? void 0 : currentParent.parentElement;
90
- }
91
- return null;
92
- }
93
- }
94
-
95
- exports.UiDomUtils = UiDomUtils;
96
- //# sourceMappingURL=ui_dom_utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,22 +0,0 @@
1
- class FileUtils {
2
- static bytesToSize(bytes) {
3
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
4
- if (bytes === 0)
5
- return 'n/a';
6
- const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
7
- if (i === 0)
8
- return `${bytes} ${sizes[i]}`;
9
- return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${sizes[i]}`;
10
- }
11
- static getFileExtension(filename) {
12
- var _a;
13
- const filenameParts = filename.split('.').filter((part) => part);
14
- return filenameParts.length > 1 ? (_a = filenameParts.pop()) !== null && _a !== void 0 ? _a : '' : '';
15
- }
16
- static getFileName(filename) {
17
- return filename.substring(0, filename.lastIndexOf('.')) || filename;
18
- }
19
- }
20
-
21
- export { FileUtils };
22
- //# sourceMappingURL=file_utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,92 +0,0 @@
1
- class UiDomUtils {
2
- static show($el) {
3
- $el.removeAttribute('hidden');
4
- }
5
- static hide($el) {
6
- $el.setAttribute('hidden', '');
7
- }
8
- static empty($el) {
9
- $el.innerHTML = '';
10
- }
11
- static makeUnnavigable($el) {
12
- $el.setAttribute('tabindex', '-1');
13
- }
14
- static makeNavigable($el) {
15
- $el.setAttribute('tabindex', '0');
16
- }
17
- static getFocusableSelector() {
18
- return ('' +
19
- // Namespace problems of [xlink:href] explained in https://stackoverflow.com/a/23047888/515124
20
- // svg a[*|href] does not match in IE9, but since we're filtering
21
- // through is/focusable we can include all <a> from SVG
22
- 'svg a,' +
23
- // may behave as 'svg, svg *,' in chrome as *every* svg element with a focus event listener is focusable
24
- // navigational elements
25
- 'a[href],' +
26
- // validity determined by is/valid-area.js
27
- 'area[href],' +
28
- // validity determined by is/disabled.js
29
- 'input:not([type="hidden"]), select, textarea, button,' +
30
- // browsing context containers
31
- 'iframe, object, embed,' +
32
- // interactive content
33
- 'keygen,' +
34
- // validity determined by is/valid-tabindex.js
35
- '[tabindex]:not([tabindex="-1"]),' +
36
- // editing hosts
37
- '[contenteditable]');
38
- }
39
- static getFocusableElements($container) {
40
- return [...$container.querySelectorAll(this.getFocusableSelector())].filter(($el) => !this._isNotFocusable($el));
41
- }
42
- static getFocusableElement($container) {
43
- return [...$container.querySelectorAll(this.getFocusableSelector())].filter(($el) => !this._isNotFocusable($el))[0];
44
- }
45
- static _isNotFocusable($el) {
46
- const displayValue = getComputedStyle($el).getPropertyValue('display');
47
- return !!($el.hasAttribute('disabled') || $el.getAttribute('aria-hidden') || $el.hasAttribute('hidden') || displayValue === 'none');
48
- }
49
- static isFocusable($element) {
50
- return $element.matches(this.getFocusableSelector());
51
- }
52
- static setFocusToFirstFocusableElementInContainer($container) {
53
- var _a;
54
- (_a = this.getFocusableElement($container)) === null || _a === void 0 ? void 0 : _a.focus();
55
- }
56
- static getDirectChildren($el, selector) {
57
- return selector ? [...$el.children].filter((child) => child.matches(selector)) : [...$el.children];
58
- }
59
- static getAllClosest($el, selector, elements = []) {
60
- if (!$el)
61
- return elements;
62
- const $closestEl = $el.closest(selector);
63
- if ($closestEl)
64
- elements.push($closestEl);
65
- if (!$closestEl)
66
- return elements;
67
- return UiDomUtils.getAllClosest($closestEl.parentElement, selector, elements);
68
- }
69
- static getFirstParentNonStaticElement($el) {
70
- let $currentEl = $el.parentElement;
71
- while ($currentEl) {
72
- if ($currentEl && window.getComputedStyle($currentEl).position !== 'static') {
73
- return $currentEl;
74
- }
75
- $currentEl = $currentEl.parentElement;
76
- }
77
- return null;
78
- }
79
- static getFirstScrollableParent($el) {
80
- let currentParent = $el.parentElement;
81
- while (currentParent) {
82
- if (currentParent.scrollHeight > currentParent.clientHeight) {
83
- return currentParent;
84
- }
85
- currentParent = currentParent === null || currentParent === void 0 ? void 0 : currentParent.parentElement;
86
- }
87
- return null;
88
- }
89
- }
90
-
91
- export { UiDomUtils };
92
- //# sourceMappingURL=ui_dom_utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}