@dreamcommerce/aurora 2.6.1 → 2.6.2

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.
@@ -10,11 +10,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
 
11
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
 
13
- const CustomLabel = ({ children }) => {
13
+ const CustomLabel = ({ children, disabled }) => {
14
14
  const { toggleDropdown, isOpen } = index.useDropdownContext();
15
15
  const ref = React.useRef(null);
16
16
  use_keyboard_open_close.useKeyboardOpenClose(toggleDropdown, isOpen, ref);
17
- return (React__default['default'].createElement("div", { onClick: toggleDropdown, ref: ref, tabIndex: 0 }, children));
17
+ const handleOnClick = () => {
18
+ if (disabled)
19
+ return;
20
+ toggleDropdown && toggleDropdown();
21
+ };
22
+ return (React__default['default'].createElement("div", { onClick: handleOnClick, ref: ref, tabIndex: 0 }, children));
18
23
  };
19
24
 
20
25
  exports.default = CustomLabel;
@@ -1 +1 @@
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;"}
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;"}
@@ -25,11 +25,20 @@ label,
25
25
  /**
26
26
  * Custom className
27
27
  */
28
- cssClass }) => {
28
+ cssClass,
29
+ /**
30
+ * Allow to disable dropdown
31
+ */
32
+ disabled }) => {
29
33
  const { toggleDropdown, isOpen } = index.useDropdownContext();
30
34
  const ref = React.useRef(null);
31
35
  use_keyboard_open_close.useKeyboardOpenClose(toggleDropdown, isOpen, ref);
32
- return (React__default['default'].createElement("span", { onClick: toggleDropdown, tabIndex: 0, ref: ref, className: cssClass, "data-test-id": constants.DROPDOWN_TEST_ID.label }, label));
36
+ const handleOnClick = () => {
37
+ if (disabled)
38
+ return;
39
+ toggleDropdown && toggleDropdown();
40
+ };
41
+ return (React__default['default'].createElement("span", { onClick: handleOnClick, tabIndex: 0, ref: ref, className: cssClass, "data-test-id": constants.DROPDOWN_TEST_ID.label }, label));
33
42
  };
34
43
 
35
44
  exports.default = Label;
@@ -1 +1 @@
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;"}
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;"}
@@ -2,11 +2,16 @@ import React, { useRef } from 'react';
2
2
  import { useDropdownContext } from '../context/index.js';
3
3
  import { useKeyboardOpenClose } from '../hooks/use_keyboard_open_close.js';
4
4
 
5
- const CustomLabel = ({ children }) => {
5
+ const CustomLabel = ({ children, disabled }) => {
6
6
  const { toggleDropdown, isOpen } = useDropdownContext();
7
7
  const ref = useRef(null);
8
8
  useKeyboardOpenClose(toggleDropdown, isOpen, ref);
9
- return (React.createElement("div", { onClick: toggleDropdown, ref: ref, tabIndex: 0 }, children));
9
+ const handleOnClick = () => {
10
+ if (disabled)
11
+ return;
12
+ toggleDropdown && toggleDropdown();
13
+ };
14
+ return (React.createElement("div", { onClick: handleOnClick, ref: ref, tabIndex: 0 }, children));
10
15
  };
11
16
 
12
17
  export default CustomLabel;
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
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;"}
@@ -17,11 +17,20 @@ label,
17
17
  /**
18
18
  * Custom className
19
19
  */
20
- cssClass }) => {
20
+ cssClass,
21
+ /**
22
+ * Allow to disable dropdown
23
+ */
24
+ disabled }) => {
21
25
  const { toggleDropdown, isOpen } = useDropdownContext();
22
26
  const ref = useRef(null);
23
27
  useKeyboardOpenClose(toggleDropdown, isOpen, ref);
24
- return (React.createElement("span", { onClick: toggleDropdown, tabIndex: 0, ref: ref, className: cssClass, "data-test-id": DROPDOWN_TEST_ID.label }, label));
28
+ const handleOnClick = () => {
29
+ if (disabled)
30
+ return;
31
+ toggleDropdown && toggleDropdown();
32
+ };
33
+ return (React.createElement("span", { onClick: handleOnClick, tabIndex: 0, ref: ref, className: cssClass, "data-test-id": DROPDOWN_TEST_ID.label }, label));
25
34
  };
26
35
 
27
36
  export default Label;
@@ -1 +1 @@
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;"}
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;"}
@@ -33,8 +33,11 @@ export interface IDropdownSelectProps {
33
33
  export interface IDropdownLabelProps {
34
34
  label: string;
35
35
  cssClass?: string;
36
+ disabled?: boolean;
36
37
  }
37
38
  export interface IDropdownCustomLabelProps {
39
+ children: ReactNode;
40
+ disabled?: boolean;
38
41
  }
39
42
  export interface IDropdownContentProps {
40
43
  search?: ReactNode;
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.6.1",
5
+ "version": "2.6.2",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",