@zendeskgarden/react-buttons 8.75.1 → 8.76.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.
@@ -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 StyledButtonGroup = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '8.76.0'
14
+ }).withConfig({
15
+ displayName: "StyledButtonGroup",
16
+ componentId: "sc-1fbpzef-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
+ StyledButtonGroup.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledButtonGroup };
@@ -0,0 +1,23 @@
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 SvgNewWindowStroke from '../node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js';
9
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'buttons.external_icon';
12
+ const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
13
+ 'data-garden-id': COMPONENT_ID,
14
+ 'data-garden-version': '8.76.0'
15
+ }).withConfig({
16
+ displayName: "StyledExternalIcon",
17
+ componentId: "sc-16oz07e-0"
18
+ })(["transform:", ";margin-bottom:-0.085em;padding-left:0.25em;box-sizing:content-box;width:0.85em;height:0.85em;", ";"], props => props.theme.rtl && 'scaleX(-1)', props => retrieveComponentStyles(COMPONENT_ID, props));
19
+ StyledExternalIcon.defaultProps = {
20
+ theme: DEFAULT_THEME
21
+ };
22
+
23
+ export { StyledExternalIcon };
@@ -0,0 +1,40 @@
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 React__default, { Children } from 'react';
9
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'buttons.icon';
12
+ const sizeStyles = props => {
13
+ let marginProperty;
14
+ if (props.position === 'start') {
15
+ marginProperty = `margin-${props.theme.rtl ? 'left' : 'right'}`;
16
+ } else if (props.position === 'end') {
17
+ marginProperty = `margin-${props.theme.rtl ? 'right' : 'left'}`;
18
+ }
19
+ return marginProperty && css(["", ":", "px;"], marginProperty, props.theme.space.base * 2);
20
+ };
21
+ const StyledIcon = styled(_ref => {
22
+ let {
23
+ children,
24
+ isRotated,
25
+ theme,
26
+ ...props
27
+ } = _ref;
28
+ return React__default.cloneElement(Children.only(children), props);
29
+ }).attrs({
30
+ 'data-garden-id': COMPONENT_ID,
31
+ 'data-garden-version': '8.76.0'
32
+ }).withConfig({
33
+ displayName: "StyledIcon",
34
+ componentId: "sc-19meqgg-0"
35
+ })(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";"], props => props.isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
36
+ StyledIcon.defaultProps = {
37
+ theme: DEFAULT_THEME
38
+ };
39
+
40
+ export { StyledIcon };
@@ -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': '8.76.0'
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,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 ButtonGroupContext = createContext(undefined);
10
+ const useButtonGroupContext = () => {
11
+ return useContext(ButtonGroupContext);
12
+ };
13
+
14
+ export { ButtonGroupContext, useButtonGroupContext };
@@ -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');
@@ -41,27 +40,12 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
41
40
  var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
42
41
  var styled__default = /*#__PURE__*/_interopDefault(styled);
43
42
 
44
- function _extends$2() {
45
- _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
46
- for (var i = 1; i < arguments.length; i++) {
47
- var source = arguments[i];
48
- for (var key in source) {
49
- if (Object.prototype.hasOwnProperty.call(source, key)) {
50
- target[key] = source[key];
51
- }
52
- }
53
- }
54
- return target;
55
- };
56
- return _extends$2.apply(this, arguments);
57
- }
58
-
59
43
  const SIZE = ['small', 'medium', 'large'];
60
44
 
61
45
  const COMPONENT_ID$5 = 'buttons.button_group_view';
62
46
  const StyledButtonGroup = styled__default.default.div.attrs({
63
47
  'data-garden-id': COMPONENT_ID$5,
64
- 'data-garden-version': '8.75.1'
48
+ 'data-garden-version': '8.76.0'
65
49
  }).withConfig({
66
50
  displayName: "StyledButtonGroup",
67
51
  componentId: "sc-1fbpzef-0"
@@ -90,7 +74,7 @@ const StyledIcon = styled__default.default(_ref => {
90
74
  return React__namespace.default.cloneElement(React.Children.only(children), props);
91
75
  }).attrs({
92
76
  'data-garden-id': COMPONENT_ID$4,
93
- 'data-garden-version': '8.75.1'
77
+ 'data-garden-version': '8.76.0'
94
78
  }).withConfig({
95
79
  displayName: "StyledIcon",
96
80
  componentId: "sc-19meqgg-0"
@@ -228,7 +212,7 @@ const sizeStyles = props => {
228
212
  };
229
213
  const StyledButton = styled__default.default.button.attrs(props => ({
230
214
  'data-garden-id': COMPONENT_ID$3,
231
- 'data-garden-version': '8.75.1',
215
+ 'data-garden-version': '8.76.0',
232
216
  type: props.type || 'button'
233
217
  })).withConfig({
234
218
  displayName: "StyledButton",
@@ -241,7 +225,7 @@ StyledButton.defaultProps = {
241
225
  const COMPONENT_ID$2 = 'buttons.anchor';
242
226
  const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
243
227
  'data-garden-id': COMPONENT_ID$2,
244
- 'data-garden-version': '8.75.1',
228
+ 'data-garden-version': '8.76.0',
245
229
  as: 'a',
246
230
  dir: props.theme.rtl ? 'rtl' : undefined,
247
231
  isLink: true,
@@ -275,7 +259,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
275
259
  const COMPONENT_ID$1 = 'buttons.external_icon';
276
260
  const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
277
261
  'data-garden-id': COMPONENT_ID$1,
278
- 'data-garden-version': '8.75.1'
262
+ 'data-garden-version': '8.76.0'
279
263
  }).withConfig({
280
264
  displayName: "StyledExternalIcon",
281
265
  componentId: "sc-16oz07e-0"
@@ -302,7 +286,7 @@ const iconStyles = props => {
302
286
  };
303
287
  const StyledIconButton = styled__default.default(StyledButton).attrs({
304
288
  'data-garden-id': COMPONENT_ID,
305
- 'data-garden-version': '8.75.1'
289
+ 'data-garden-version': '8.76.0'
306
290
  }).withConfig({
307
291
  displayName: "StyledIconButton",
308
292
  componentId: "sc-1t0ughp-0"
@@ -321,13 +305,13 @@ const useSplitButtonContext = () => {
321
305
  return React.useContext(SplitButtonContext);
322
306
  };
323
307
 
324
- const StartIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
308
+ const StartIconComponent = props => React__namespace.default.createElement(StyledIcon, Object.assign({
325
309
  position: "start"
326
310
  }, props));
327
311
  StartIconComponent.displayName = 'Button.StartIcon';
328
312
  const StartIcon = StartIconComponent;
329
313
 
330
- const EndIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
314
+ const EndIconComponent = props => React__namespace.default.createElement(StyledIcon, Object.assign({
331
315
  position: "end"
332
316
  }, props));
333
317
  EndIconComponent.displayName = 'Button.EndIcon';
@@ -352,7 +336,7 @@ const ButtonComponent = React.forwardRef((props, ref) => {
352
336
  computedRef = mergeRefs__default.default([
353
337
  computedProps.ref, ref]);
354
338
  }
355
- return React__namespace.default.createElement(StyledButton, _extends$2({}, computedProps, {
339
+ return React__namespace.default.createElement(StyledButton, Object.assign({}, computedProps, {
356
340
  ref: computedRef
357
341
  }));
358
342
  });
@@ -397,7 +381,7 @@ const Anchor = React.forwardRef((_ref, ref) => {
397
381
  noIconLabel: 'true'
398
382
  };
399
383
  const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
400
- return React__namespace.default.createElement(StyledAnchor, _extends$2({
384
+ return React__namespace.default.createElement(StyledAnchor, Object.assign({
401
385
  ref: ref
402
386
  }, anchorProps), children, isExternal &&
403
387
  React__namespace.default.createElement(StyledExternalIcon, {
@@ -455,7 +439,7 @@ const ButtonGroup = React.forwardRef((_ref, ref) => {
455
439
  }), [selectedItem, getElementProps]);
456
440
  return React__namespace.default.createElement(ButtonGroupContext.Provider, {
457
441
  value: contextValue
458
- }, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
442
+ }, React__namespace.default.createElement(StyledButtonGroup, Object.assign({
459
443
  ref: ref
460
444
  }, getGroupProps(otherProps)), children));
461
445
  });
@@ -472,7 +456,7 @@ const IconButton = React.forwardRef((_ref, ref) => {
472
456
  ...otherProps
473
457
  } = _ref;
474
458
  const focusInset = useSplitButtonContext();
475
- return React__namespace.default.createElement(StyledIconButton, _extends$2({
459
+ return React__namespace.default.createElement(StyledIconButton, Object.assign({
476
460
  ref: ref
477
461
  }, otherProps, {
478
462
  focusInset: otherProps.focusInset || focusInset
@@ -517,7 +501,7 @@ const ChevronButton = React.forwardRef((_ref, ref) => {
517
501
  let {
518
502
  ...buttonProps
519
503
  } = _ref;
520
- return React__namespace.default.createElement(IconButton, _extends$2({
504
+ return React__namespace.default.createElement(IconButton, Object.assign({
521
505
  ref: ref
522
506
  }, buttonProps), React__namespace.default.createElement(SvgChevronDownStroke, null));
523
507
  });
@@ -536,7 +520,7 @@ const SplitButton = React.forwardRef((_ref, ref) => {
536
520
  } = _ref;
537
521
  return React__namespace.default.createElement(SplitButtonContext.Provider, {
538
522
  value: true
539
- }, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
523
+ }, React__namespace.default.createElement(StyledButtonGroup, Object.assign({
540
524
  ref: ref
541
525
  }, other), children));
542
526
  });
@@ -547,7 +531,7 @@ const ToggleButton = React.forwardRef((_ref, ref) => {
547
531
  isPressed,
548
532
  ...otherProps
549
533
  } = _ref;
550
- return React__namespace.default.createElement(Button, _extends$2({
534
+ return React__namespace.default.createElement(Button, Object.assign({
551
535
  "aria-pressed": isPressed,
552
536
  ref: ref
553
537
  }, otherProps));
@@ -566,7 +550,7 @@ const ToggleIconButton = React.forwardRef((_ref, ref) => {
566
550
  isPressed,
567
551
  ...otherProps
568
552
  } = _ref;
569
- return React__namespace.default.createElement(IconButton, _extends$2({
553
+ return React__namespace.default.createElement(IconButton, Object.assign({
570
554
  "aria-pressed": isPressed,
571
555
  ref: ref
572
556
  }, otherProps));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-buttons",
3
- "version": "8.75.1",
3
+ "version": "8.76.0",
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
  ],
@@ -28,13 +28,13 @@
28
28
  "react-merge-refs": "^1.1.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@zendeskgarden/react-theming": "^8.67.0",
31
+ "@zendeskgarden/react-theming": "^8.75.0",
32
32
  "react": ">=16.8.0",
33
33
  "react-dom": ">=16.8.0",
34
34
  "styled-components": "^4.2.0 || ^5.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@zendeskgarden/react-theming": "^8.75.1",
37
+ "@zendeskgarden/react-theming": "^8.76.0",
38
38
  "@zendeskgarden/svg-icons": "7.0.0"
39
39
  },
40
40
  "keywords": [
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "zendeskgarden:src": "src/index.ts",
50
- "gitHead": "8e2bb36bcfef722db47a135fc987f72597be5000"
50
+ "gitHead": "3e52650c39fd1085a2e97b40a43eed7bc1e21937"
51
51
  }