@commercetools-uikit/primary-action-dropdown 16.0.0 → 16.1.1

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.
@@ -23,28 +23,24 @@ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceP
23
23
  var AccessibleButton__default = /*#__PURE__*/_interopDefault(AccessibleButton);
24
24
  var Text__default = /*#__PURE__*/_interopDefault(Text);
25
25
 
26
- const getButtonStyles = (isDisabled, isNewTheme) => {
26
+ const getButtonStyles = isDisabled => {
27
27
  const baseButtonStyles = /*#__PURE__*/react$1.css("display:flex;align-items:center;height:", designSystem.designTokens.bigButtonHeight, ";" + ("" ), "" );
28
-
29
28
  if (isDisabled) {
30
- return [baseButtonStyles, /*#__PURE__*/react$1.css("box-shadow:none;background-color:", designSystem.designTokens.backgroundColorForPrimaryActionDropdownWhenDisabled, ";border:", isNewTheme && "1px solid ".concat(designSystem.designTokens.colorNeutral), ";" + ("" ), "" )];
29
+ return [baseButtonStyles, /*#__PURE__*/react$1.css("box-shadow:none;background-color:", designSystem.designTokens.backgroundColorForPrimaryActionDropdownWhenDisabled, ";border:", "1px solid ".concat(designSystem.designTokens.colorNeutral), ";" + ("" ), "" )];
31
30
  }
32
-
33
- return [baseButtonStyles, /*#__PURE__*/react$1.css("background-color:", designSystem.designTokens.colorSurface, ";box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdown, ";border:", isNewTheme && "1px solid ".concat(designSystem.designTokens.colorNeutral), ";&:hover{box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdownWhenHovered, ";background-color:", isNewTheme && designSystem.designTokens.colorNeutral95, ";}&:active{box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdownWhenActive, ";background-color:", designSystem.designTokens.backgroundColorForPrimaryActionDropdownWhenActive, ";}" + ("" ), "" )];
31
+ return [baseButtonStyles, /*#__PURE__*/react$1.css("background-color:", designSystem.designTokens.colorSurface, ";box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdown, ";border:", "1px solid ".concat(designSystem.designTokens.colorNeutral), ";&:hover{box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdownWhenHovered, ";background-color:", designSystem.designTokens.colorNeutral95, ";}&:active{box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdownWhenActive, ";background-color:", designSystem.designTokens.backgroundColorForPrimaryActionDropdownWhenActive, ";}" + ("" ), "" )];
34
32
  };
35
-
36
33
  var _ref2 = {
37
34
  name: "s5xdrg",
38
35
  styles: "display:flex;align-items:center"
39
36
  } ;
40
-
41
37
  const DropdownHead = props => jsxRuntime.jsxs("div", {
42
38
  css: _ref2,
43
39
  children: [jsxRuntime.jsxs(AccessibleButton__default["default"], {
44
40
  label: props.children,
45
41
  onClick: props.onClick,
46
42
  isDisabled: props.isDisabled,
47
- css: [...getButtonStyles(props.isDisabled, props.isNewTheme), /*#__PURE__*/react$1.css("padding:", designSystem.designTokens.paddingForPrimaryActionDropdown, ";border-radius:", designSystem.designTokens.borderRadiusForPrimaryActionDropdown, ";" + ("" ), "" ), "" ],
43
+ css: [...getButtonStyles(props.isDisabled), /*#__PURE__*/react$1.css("padding:", designSystem.designTokens.paddingForPrimaryActionDropdown, ";border-radius:", designSystem.designTokens.borderRadiusForPrimaryActionDropdown, ";" + ("" ), "" ), "" ],
48
44
  children: [jsxRuntime.jsx("span", {
49
45
  css: /*#__PURE__*/react$1.css("margin-right:", designSystem.designTokens.marginRightForPrimaryActionDropdown, ";display:flex;align-items:center;justify-content:center;" + ("" ), "" ),
50
46
  children: /*#__PURE__*/react.cloneElement(props.iconLeft, {
@@ -60,35 +56,32 @@ const DropdownHead = props => jsxRuntime.jsxs("div", {
60
56
  })]
61
57
  }), props.chevron]
62
58
  });
63
-
64
59
  DropdownHead.propTypes = {};
65
60
  DropdownHead.displayName = 'DropdownHead';
66
-
67
61
  var _ref = {
68
62
  name: "1jklb6q",
69
63
  styles: "pointer-events:none;margin-top:3px"
70
64
  } ;
71
-
72
65
  const DropdownChevron = /*#__PURE__*/react.forwardRef((props, ref) => jsxRuntime.jsx(AccessibleButton__default["default"], {
73
66
  ref: ref,
74
67
  label: "Open Dropdown",
75
68
  onClick: props.onClick,
76
69
  isDisabled: props.isDisabled,
77
- css: [...getButtonStyles(props.isDisabled, props.isNewTheme), /*#__PURE__*/react$1.css("padding:", designSystem.designTokens.paddingForPrimaryActionDropdownIcon, ";border-radius:", designSystem.designTokens.borderRadiusForPrimaryActionDropdownIcon, ";border-color:", designSystem.designTokens.colorNeutral, ";border-width:", designSystem.designTokens.borderForPrimaryActionDropdownIcon, ";border-style:solid;" + ("" ), "" ), "" ],
70
+ css: [...getButtonStyles(props.isDisabled), /*#__PURE__*/react$1.css("padding:", designSystem.designTokens.paddingForPrimaryActionDropdownIcon, ";border-radius:", designSystem.designTokens.borderRadiusForPrimaryActionDropdownIcon, ";border-color:", designSystem.designTokens.colorNeutral, ";border-width:", designSystem.designTokens.borderForPrimaryActionDropdownIcon, ";border-style:solid;" + ("" ), "" ), "" ],
78
71
  children: jsxRuntime.jsx("div", {
79
72
  // The margin-top is to center the icon as the caret visually looks too high otherwise
80
73
  css: _ref,
81
74
  children: /*#__PURE__*/react.cloneElement(props.isOpen && !props.isDisabled ? jsxRuntime.jsx(icons.CaretUpIcon, {}) : jsxRuntime.jsx(icons.CaretDownIcon, {}), {
82
- color: props.isDisabled || props.isNewTheme ? 'neutral60' : 'solid',
75
+ color: 'neutral60',
83
76
  size: 'small'
84
77
  })
85
78
  })
86
79
  }));
87
80
  DropdownChevron.displayName = 'DropdownChevron';
88
-
89
81
  const Options = /*#__PURE__*/_styled__default["default"]("div", {
90
82
  target: "eb24b7r0"
91
- } )("position:absolute;z-index:5;width:100%;top:calc(", designSystem.designTokens.spacing20, " + ", designSystem.designTokens.bigButtonHeight, ");border:1px solid ", designSystem.designTokens.borderColorForPrimaryActionDropdownMenu, ";border-radius:", designSystem.designTokens.borderRadiusForPrimaryActionDropdownMenu, ";box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdownMenu, ";margin-top:", designSystem.designTokens.marginTopForPrimaryActionDropdown, ";>button{padding-left:", props => props.isNewTheme && designSystem.designTokens.spacing30, ";white-space:normal;&:active{background-color:", props => props.isNewTheme && designSystem.designTokens.colorInfo95, ";}}" + ("" ));
83
+ } )("position:absolute;z-index:5;width:100%;top:calc(", designSystem.designTokens.spacing20, " + ", designSystem.designTokens.bigButtonHeight, ");border:1px solid ", designSystem.designTokens.borderColorForPrimaryActionDropdownMenu, ";border-radius:", designSystem.designTokens.borderRadiusForPrimaryActionDropdownMenu, ";box-shadow:", designSystem.designTokens.shadowForPrimaryActionDropdownMenu, ";margin-top:", designSystem.designTokens.marginTopForPrimaryActionDropdown, ";>button{padding-left:", designSystem.designTokens.spacing30, ";white-space:normal;&:active{background-color:", designSystem.designTokens.colorInfo95, ";}}" + ("" ));
84
+
92
85
  /*
93
86
  This component registers a global click event listener to close the dropdown.
94
87
  It uses this global listener to close when:
@@ -100,21 +93,14 @@ const Options = /*#__PURE__*/_styled__default["default"]("div", {
100
93
  immediately.
101
94
  */
102
95
 
103
-
104
96
  const PrimaryActionDropdown = props => {
105
97
  const ref = react.useRef();
106
-
107
98
  const _useToggleState = hooks.useToggleState(false),
108
- _useToggleState2 = _slicedToArray(_useToggleState, 2),
109
- isOpen = _useToggleState2[0],
110
- toggle = _useToggleState2[1];
111
-
112
- const _useTheme = designSystem.useTheme(),
113
- isNewTheme = _useTheme.isNewTheme;
114
-
99
+ _useToggleState2 = _slicedToArray(_useToggleState, 2),
100
+ isOpen = _useToggleState2[0],
101
+ toggle = _useToggleState2[1];
115
102
  const handleGlobalClick = react.useCallback(event => {
116
103
  const dropdownButton = ref.current;
117
-
118
104
  if (dropdownButton && event.target !== dropdownButton && !dropdownButton.contains(event.target)) {
119
105
  toggle(false);
120
106
  }
@@ -143,23 +129,19 @@ const PrimaryActionDropdown = props => {
143
129
  children: [jsxRuntime.jsx(DropdownHead, {
144
130
  iconLeft: primaryOption.props.iconLeft,
145
131
  isDisabled: primaryOption.props.isDisabled,
146
- isNewTheme: isNewTheme,
147
132
  onClick: handleClickOnHead,
148
133
  chevron: jsxRuntime.jsx(DropdownChevron, {
149
134
  ref: ref,
150
135
  onClick: handleClickOnChevron,
151
136
  isDisabled: primaryOption.props.isDisabled,
152
- isNewTheme: isNewTheme,
153
137
  isOpen: isOpen
154
138
  }),
155
139
  children: primaryOption.props.children
156
140
  }), isOpen && !primaryOption.props.isDisabled && jsxRuntime.jsx(Options, {
157
- isNewTheme: isNewTheme,
158
141
  children: childrenAsArray
159
142
  })]
160
143
  });
161
144
  };
162
-
163
145
  PrimaryActionDropdown.propTypes = {};
164
146
  PrimaryActionDropdown.displayName = 'PrimaryActionDropdown';
165
147
  var PrimaryActionDropdown$1 = PrimaryActionDropdown;
@@ -171,7 +153,6 @@ const Option = props => jsxRuntime.jsx(AccessibleButton__default["default"], {
171
153
  css: [/*#__PURE__*/react$1.css("display:block;text-align:left;width:100%;padding:", designSystem.designTokens.spacing20, ";background-color:", designSystem.designTokens.colorSurface, ";&:first-of-type{border-radius:", designSystem.designTokens.borderRadius6, " ", designSystem.designTokens.borderRadius6, " 0 0;}&:last-of-type{border-radius:0 0 ", designSystem.designTokens.borderRadius6, " ", designSystem.designTokens.borderRadius6, ";}&:hover{background-color:", designSystem.designTokens.colorNeutral95, ";}" + ("" ), "" ), props.isDisabled && /*#__PURE__*/react$1.css("color:", designSystem.designTokens.colorNeutral, ";" + ("" ), "" ), "" , "" ],
172
154
  children: props.children
173
155
  });
174
-
175
156
  Option.propTypes = {};
176
157
  Option.displayName = 'Option';
177
158
  Option.defaultProps = {
@@ -180,7 +161,7 @@ Option.defaultProps = {
180
161
  var Option$1 = Option;
181
162
 
182
163
  // NOTE: This string will be replaced on build time with the package version.
183
- var version = "16.0.0";
164
+ var version = "16.1.1";
184
165
 
185
166
  exports.Option = Option$1;
186
167
  exports["default"] = PrimaryActionDropdown$1;