@zendeskgarden/react-buttons 9.0.0-next.7 → 9.0.0-next.8

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.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+ import { StyledButton, getHeight } from './StyledButton.js';
10
+ import { StyledIcon } from './StyledIcon.js';
11
+
12
+ const COMPONENT_ID = 'buttons.icon_button';
13
+ const iconColorStyles = props => {
14
+ const shade = 600;
15
+ const baseColor = getColorV8('neutralHue', shade, props.theme);
16
+ const hoverColor = getColorV8('neutralHue', shade + 100, props.theme);
17
+ const activeColor = getColorV8('neutralHue', shade + 200, props.theme);
18
+ return css(["color:", ";&:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}"], baseColor, hoverColor, activeColor);
19
+ };
20
+ const iconButtonStyles = props => {
21
+ const width = getHeight(props);
22
+ return css(["border:", ";padding:0;width:", ";min-width:", ";", ";&:disabled{background-color:", ";}"], props.isBasic && 'none', width, width, props.isBasic && !(props.isPrimary || props.isDanger || props.disabled) && iconColorStyles(props), !props.isPrimary && 'transparent');
23
+ };
24
+ const iconStyles = props => {
25
+ const size = props.theme.iconSizes.md;
26
+ return css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
27
+ };
28
+ const StyledIconButton = styled(StyledButton).attrs({
29
+ 'data-garden-id': COMPONENT_ID,
30
+ 'data-garden-version': '9.0.0-next.8'
31
+ }).withConfig({
32
+ displayName: "StyledIconButton",
33
+ componentId: "sc-1t0ughp-0"
34
+ })(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
35
+ StyledIconButton.defaultProps = {
36
+ theme: DEFAULT_THEME
37
+ };
38
+
39
+ export { StyledIconButton };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'buttons.button_group_view';
11
+ const StyledSplitButton = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.8'
14
+ }).withConfig({
15
+ displayName: "StyledSplitButton",
16
+ componentId: "sc-1u4v04v-0"
17
+ })(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap;", ";"], props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ StyledSplitButton.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledSplitButton };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ const SIZE = ['small', 'medium', 'large'];
8
+
9
+ export { SIZE };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { createContext, useContext } from 'react';
8
+
9
+ const SplitButtonContext = createContext(undefined);
10
+ const useSplitButtonContext = () => {
11
+ return useContext(SplitButtonContext);
12
+ };
13
+
14
+ export { SplitButtonContext, useSplitButtonContext };
package/dist/index.cjs.js CHANGED
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
-
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
8
7
  'use strict';
9
8
 
10
9
  var React = require('react');
@@ -37,27 +36,12 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
37
36
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
38
37
  var styled__default = /*#__PURE__*/_interopDefault(styled);
39
38
 
40
- function _extends$2() {
41
- _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
42
- for (var i = 1; i < arguments.length; i++) {
43
- var source = arguments[i];
44
- for (var key in source) {
45
- if (Object.prototype.hasOwnProperty.call(source, key)) {
46
- target[key] = source[key];
47
- }
48
- }
49
- }
50
- return target;
51
- };
52
- return _extends$2.apply(this, arguments);
53
- }
54
-
55
39
  const SIZE = ['small', 'medium', 'large'];
56
40
 
57
41
  const COMPONENT_ID$5 = 'buttons.button_group_view';
58
42
  const StyledSplitButton = styled__default.default.div.attrs({
59
43
  'data-garden-id': COMPONENT_ID$5,
60
- 'data-garden-version': '9.0.0-next.7'
44
+ 'data-garden-version': '9.0.0-next.8'
61
45
  }).withConfig({
62
46
  displayName: "StyledSplitButton",
63
47
  componentId: "sc-1u4v04v-0"
@@ -86,7 +70,7 @@ const StyledIcon = styled__default.default(_ref => {
86
70
  return React__namespace.default.cloneElement(React.Children.only(children), props);
87
71
  }).attrs({
88
72
  'data-garden-id': COMPONENT_ID$4,
89
- 'data-garden-version': '9.0.0-next.7'
73
+ 'data-garden-version': '9.0.0-next.8'
90
74
  }).withConfig({
91
75
  displayName: "StyledIcon",
92
76
  componentId: "sc-19meqgg-0"
@@ -188,8 +172,12 @@ const groupStyles = props => {
188
172
  const focusBoxShadow = isBasic && !isPrimary && reactTheming.getFocusBoxShadow({
189
173
  theme,
190
174
  inset: focusInset,
191
- spacerHue: focusColor,
192
- hue: 'transparent'
175
+ spacerColor: {
176
+ hue: focusColor
177
+ },
178
+ color: {
179
+ hue: 'transparent'
180
+ }
193
181
  });
194
182
  return styled.css(["position:relative;transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,color 0.1s ease-in-out,margin-", " 0.1s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;border:", " ", ";", "{border-color:", ";box-shadow:", ";}&:hover,&:active,", "{z-index:1;}&:disabled{z-index:-1;background-color:", ";}&:not(:first-of-type){margin-", ":", ";}&:not(:first-of-type):disabled{margin-", ":", ";}&:not(:first-of-type):not(:last-of-type){border-radius:0;}&:first-of-type:not(:last-of-type){border-top-", "-radius:0;border-bottom-", "-radius:0;}&:last-of-type:not(:first-of-type){border-top-", "-radius:0;border-bottom-", "-radius:0;}&:first-of-type:not(:last-of-type) ", "{margin-", ":", ";}&:last-of-type:not(:first-of-type) ", "{margin-", ":", ";}"], startPosition, borders.sm, borderColor, reactTheming.SELECTOR_FOCUS_VISIBLE, focusColor, focusBoxShadow, reactTheming.SELECTOR_FOCUS_VISIBLE, disabledBackgroundColor, startPosition, marginDisplacement, startPosition, marginOffset, endPosition, endPosition, startPosition, startPosition, StyledIcon, endPosition, iconMarginDisplacement, StyledIcon, startPosition, iconMarginDisplacement);
195
183
  };
@@ -223,7 +211,7 @@ const sizeStyles = props => {
223
211
  };
224
212
  const StyledButton = styled__default.default.button.attrs(props => ({
225
213
  'data-garden-id': COMPONENT_ID$3,
226
- 'data-garden-version': '9.0.0-next.7',
214
+ 'data-garden-version': '9.0.0-next.8',
227
215
  type: props.type || 'button'
228
216
  })).withConfig({
229
217
  displayName: "StyledButton",
@@ -236,7 +224,7 @@ StyledButton.defaultProps = {
236
224
  const COMPONENT_ID$2 = 'buttons.anchor';
237
225
  const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
238
226
  'data-garden-id': COMPONENT_ID$2,
239
- 'data-garden-version': '9.0.0-next.7',
227
+ 'data-garden-version': '9.0.0-next.8',
240
228
  as: 'a',
241
229
  dir: props.theme.rtl ? 'rtl' : undefined,
242
230
  isLink: true,
@@ -270,7 +258,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
270
258
  const COMPONENT_ID$1 = 'buttons.external_icon';
271
259
  const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
272
260
  'data-garden-id': COMPONENT_ID$1,
273
- 'data-garden-version': '9.0.0-next.7'
261
+ 'data-garden-version': '9.0.0-next.8'
274
262
  }).withConfig({
275
263
  displayName: "StyledExternalIcon",
276
264
  componentId: "sc-16oz07e-0"
@@ -297,7 +285,7 @@ const iconStyles = props => {
297
285
  };
298
286
  const StyledIconButton = styled__default.default(StyledButton).attrs({
299
287
  'data-garden-id': COMPONENT_ID,
300
- 'data-garden-version': '9.0.0-next.7'
288
+ 'data-garden-version': '9.0.0-next.8'
301
289
  }).withConfig({
302
290
  displayName: "StyledIconButton",
303
291
  componentId: "sc-1t0ughp-0"
@@ -311,13 +299,13 @@ const useSplitButtonContext = () => {
311
299
  return React.useContext(SplitButtonContext);
312
300
  };
313
301
 
314
- const StartIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
302
+ const StartIconComponent = props => React__namespace.default.createElement(StyledIcon, Object.assign({
315
303
  position: "start"
316
304
  }, props));
317
305
  StartIconComponent.displayName = 'Button.StartIcon';
318
306
  const StartIcon = StartIconComponent;
319
307
 
320
- const EndIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
308
+ const EndIconComponent = props => React__namespace.default.createElement(StyledIcon, Object.assign({
321
309
  position: "end"
322
310
  }, props));
323
311
  EndIconComponent.displayName = 'Button.EndIcon';
@@ -329,7 +317,7 @@ const ButtonComponent = React.forwardRef((props, ref) => {
329
317
  ...props,
330
318
  focusInset: props.focusInset || splitButtonContext
331
319
  };
332
- return React__namespace.default.createElement(StyledButton, _extends$2({}, computedProps, {
320
+ return React__namespace.default.createElement(StyledButton, Object.assign({}, computedProps, {
333
321
  ref: ref
334
322
  }));
335
323
  });
@@ -373,7 +361,7 @@ const Anchor = React.forwardRef((_ref, ref) => {
373
361
  noIconLabel: 'true'
374
362
  };
375
363
  const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
376
- return React__namespace.default.createElement(StyledAnchor, _extends$2({
364
+ return React__namespace.default.createElement(StyledAnchor, Object.assign({
377
365
  ref: ref
378
366
  }, anchorProps), children, isExternal &&
379
367
  React__namespace.default.createElement(StyledExternalIcon, {
@@ -396,7 +384,7 @@ const IconButton = React.forwardRef((_ref, ref) => {
396
384
  ...otherProps
397
385
  } = _ref;
398
386
  const focusInset = useSplitButtonContext();
399
- return React__namespace.default.createElement(StyledIconButton, _extends$2({
387
+ return React__namespace.default.createElement(StyledIconButton, Object.assign({
400
388
  ref: ref
401
389
  }, otherProps, {
402
390
  focusInset: otherProps.focusInset || focusInset
@@ -441,7 +429,7 @@ const ChevronButton = React.forwardRef((_ref, ref) => {
441
429
  let {
442
430
  ...buttonProps
443
431
  } = _ref;
444
- return React__namespace.default.createElement(IconButton, _extends$2({
432
+ return React__namespace.default.createElement(IconButton, Object.assign({
445
433
  ref: ref
446
434
  }, buttonProps), React__namespace.default.createElement(SvgChevronDownStroke, null));
447
435
  });
@@ -460,7 +448,7 @@ const SplitButton = React.forwardRef((_ref, ref) => {
460
448
  } = _ref;
461
449
  return React__namespace.default.createElement(SplitButtonContext.Provider, {
462
450
  value: true
463
- }, React__namespace.default.createElement(StyledSplitButton, _extends$2({
451
+ }, React__namespace.default.createElement(StyledSplitButton, Object.assign({
464
452
  ref: ref
465
453
  }, other), children));
466
454
  });
@@ -471,7 +459,7 @@ const ToggleButton = React.forwardRef((_ref, ref) => {
471
459
  isPressed,
472
460
  ...otherProps
473
461
  } = _ref;
474
- return React__namespace.default.createElement(Button, _extends$2({
462
+ return React__namespace.default.createElement(Button, Object.assign({
475
463
  "aria-pressed": isPressed,
476
464
  ref: ref
477
465
  }, otherProps));
@@ -490,7 +478,7 @@ const ToggleIconButton = React.forwardRef((_ref, ref) => {
490
478
  isPressed,
491
479
  ...otherProps
492
480
  } = _ref;
493
- return React__namespace.default.createElement(IconButton, _extends$2({
481
+ return React__namespace.default.createElement(IconButton, Object.assign({
494
482
  "aria-pressed": isPressed,
495
483
  ref: ref
496
484
  }, otherProps));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-buttons",
3
- "version": "9.0.0-next.7",
3
+ "version": "9.0.0-next.8",
4
4
  "description": "Components relating to buttons in the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/zendeskgarden/react-components/issues"
11
11
  },
12
12
  "main": "dist/index.cjs.js",
13
- "module": "dist/index.esm.js",
13
+ "module": "dist/esm/index.js",
14
14
  "files": [
15
15
  "dist"
16
16
  ],
@@ -27,13 +27,13 @@
27
27
  "react-merge-refs": "^2.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@zendeskgarden/react-theming": "^9.0.0",
30
+ "@zendeskgarden/react-theming": ">=9.0.0-next",
31
31
  "react": ">=16.8.0",
32
32
  "react-dom": ">=16.8.0",
33
33
  "styled-components": "^5.3.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@zendeskgarden/react-theming": "^9.0.0-next.7",
36
+ "@zendeskgarden/react-theming": "^9.0.0-next.8",
37
37
  "@zendeskgarden/svg-icons": "7.0.0"
38
38
  },
39
39
  "keywords": [
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "zendeskgarden:src": "src/index.ts",
49
- "gitHead": "50a2b45b2e237a490a6d460818d33498b92479ec"
49
+ "gitHead": "a3d6534843d5a4f5cb60b52bc67264f3230f2da0"
50
50
  }