@atlaskit/button 17.20.0 → 17.22.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/new-button/containers/split-button/split-button.js +23 -6
  3. package/dist/cjs/new-button/variants/default/use-default-button.js +13 -14
  4. package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -5
  5. package/dist/cjs/new-button/variants/shared/icon-renderer.js +38 -0
  6. package/dist/cjs/new-button/variants/shared/use-button-base.js +79 -18
  7. package/dist/cjs/old-button/shared/button-base.js +1 -1
  8. package/dist/es2019/new-button/containers/split-button/split-button.js +22 -5
  9. package/dist/es2019/new-button/variants/default/use-default-button.js +13 -14
  10. package/dist/es2019/new-button/variants/icon/use-icon-button.js +5 -5
  11. package/dist/es2019/new-button/variants/shared/icon-renderer.js +32 -0
  12. package/dist/es2019/new-button/variants/shared/use-button-base.js +79 -18
  13. package/dist/es2019/old-button/shared/button-base.js +1 -1
  14. package/dist/esm/new-button/containers/split-button/split-button.js +23 -6
  15. package/dist/esm/new-button/variants/default/use-default-button.js +13 -14
  16. package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -5
  17. package/dist/esm/new-button/variants/shared/icon-renderer.js +31 -0
  18. package/dist/esm/new-button/variants/shared/use-button-base.js +79 -18
  19. package/dist/esm/old-button/shared/button-base.js +1 -1
  20. package/dist/types/new-button/containers/split-button/split-button.d.ts +2 -1
  21. package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
  22. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
  23. package/dist/types/new-button/variants/shared/icon-renderer.d.ts +14 -0
  24. package/dist/types/new-button/variants/shared/use-button-base.d.ts +1 -1
  25. package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +2 -1
  26. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
  27. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
  28. package/dist/types-ts4.5/new-button/variants/shared/icon-renderer.d.ts +14 -0
  29. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +1 -1
  30. package/package.json +9 -1
@@ -20,27 +20,25 @@ const buttonStyles = xcss({
20
20
  alignItems: 'baseline',
21
21
  justifyContent: 'center',
22
22
  columnGap: 'space.050',
23
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
24
- background: `var(--ds-background-neutral, ${colors.N20A})`,
25
23
  borderRadius: 'border.radius.100',
26
24
  borderWidth: 'border.width.0',
27
- // @ts-expect-error
28
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
29
- color: `var(--ds-text, ${colors.N500})`,
30
25
  flexShrink: 0,
31
26
  height: `${32 / fontSize}em`,
32
27
  paddingInlineEnd: 'space.150',
33
28
  paddingInlineStart: 'space.150',
34
29
  textAlign: 'center',
35
- transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
30
+ transition: 'background 0.1s ease-out',
36
31
  verticalAlign: 'middle',
37
- ':visited': {
38
- // @ts-expect-error
39
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
40
- color: `var(--ds-text, ${colors.N500})`
32
+ '::after': {
33
+ borderRadius: 'inherit',
34
+ inset: 'space.0',
35
+ borderStyle: 'solid',
36
+ borderWidth: "var(--ds-border-width, 1px)",
37
+ pointerEvents: 'none',
38
+ position: 'absolute'
41
39
  }
42
40
  });
43
- const baseButtonStyles = xcss({
41
+ const hardCodedButtonStyles = xcss({
44
42
  fontFamily: 'inherit',
45
43
  fontSize: 'inherit',
46
44
  fontStyle: 'normal',
@@ -58,16 +56,46 @@ const defaultInteractiveStyles = xcss({
58
56
  background: "var(--ds-background-neutral-hovered, #091e4214)",
59
57
  // @ts-expect-error
60
58
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
61
- color: `var(--ds-text, ${colors.N500})`,
62
- transitionDuration: '0s, 0.15s'
59
+ color: `var(--ds-text, ${colors.N500})`
63
60
  },
64
61
  ':active': {
65
62
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
66
63
  background: `var(--ds-background-neutral-pressed, ${colors.B75})`,
67
64
  // @ts-expect-error
68
65
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
69
- color: `var(--ds-text, ${colors.B400})`,
70
- transitionDuration: '0s, 0s'
66
+ color: `var(--ds-text, ${colors.B400})`
67
+ }
68
+ });
69
+ const defaultInteractiveRefreshedStyles = xcss({
70
+ ':hover': {
71
+ background: "var(--ds-background-neutral-subtle-hovered, #091E420F)",
72
+ color: 'color.text.subtle'
73
+ },
74
+ ':active': {
75
+ background: "var(--ds-background-neutral-subtle-pressed, #091E4224)",
76
+ color: 'color.text.subtle'
77
+ }
78
+ });
79
+ const defaultStyles = xcss({
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
81
+ background: `var(--ds-background-neutral, ${colors.N20A})`,
82
+ // @ts-expect-error — using tokens for explicit fallback usage.
83
+ color: `var(--ds-text, ${colors.N500})`,
84
+ ':visited': {
85
+ // @ts-expect-error
86
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
87
+ color: `var(--ds-text, ${colors.N500})`
88
+ }
89
+ });
90
+ const defaultRefreshedStyles = xcss({
91
+ background: "var(--ds-background-neutral-subtle, #00000000)",
92
+ color: 'color.text.subtle',
93
+ '::after': {
94
+ content: '""',
95
+ borderColor: 'color.border'
96
+ },
97
+ ':visited': {
98
+ color: 'color.text.subtle'
71
99
  }
72
100
  });
73
101
  const primaryStyles = xcss({
@@ -155,6 +183,13 @@ const subtleStyles = xcss({
155
183
  color: "var(--ds-text, #42526E)"
156
184
  }
157
185
  });
186
+ const subtleRefreshedStyles = xcss({
187
+ background: "var(--ds-background-neutral-subtle, transparent)",
188
+ color: 'color.text.subtle',
189
+ ':visited': {
190
+ color: 'color.text.subtle'
191
+ }
192
+ });
158
193
  const subtleInteractiveStyles = xcss({
159
194
  ':hover': {
160
195
  background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
@@ -167,6 +202,16 @@ const subtleInteractiveStyles = xcss({
167
202
  color: "var(--ds-text, #42526E)"
168
203
  }
169
204
  });
205
+ const subtleInteractiveRefreshedStyles = xcss({
206
+ ':hover': {
207
+ background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
208
+ color: 'color.text.subtle'
209
+ },
210
+ ':active': {
211
+ background: "var(--ds-background-neutral-subtle-pressed, #B3D4FF)",
212
+ color: 'color.text.subtle'
213
+ }
214
+ });
170
215
  const linkStyles = xcss({
171
216
  // @ts-expect-error
172
217
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
@@ -252,6 +297,9 @@ const disabledStyles = xcss({
252
297
  background: `var(--ds-background-disabled, ${colors.N20A})`,
253
298
  // @ts-expect-error
254
299
  color: "var(--ds-text-disabled, #091E424F)"
300
+ },
301
+ '::after': {
302
+ content: 'none'
255
303
  }
256
304
  });
257
305
  const selectedStyles = xcss({
@@ -266,6 +314,17 @@ const selectedStyles = xcss({
266
314
  color: `var(--ds-text-selected, ${colors.N20})`
267
315
  }
268
316
  });
317
+ const selectedRefreshedStyles = xcss({
318
+ background: "var(--ds-background-selected, #E9F2FF)",
319
+ color: 'color.text.selected',
320
+ '::after': {
321
+ content: '""',
322
+ borderColor: 'color.border.selected'
323
+ },
324
+ ':visited': {
325
+ color: 'color.text.selected'
326
+ }
327
+ });
269
328
  const selectedInteractiveStyles = xcss({
270
329
  ':hover': {
271
330
  // @ts-expect-error
@@ -440,7 +499,7 @@ const useButtonBase = ({
440
499
  autoFocus = false,
441
500
  isDisabled: propIsDisabled = false,
442
501
  isLoading = false,
443
- isSelected = false,
502
+ isSelected: propIsSelected = false,
444
503
  // TODO: Separate Icon Button styling from button base
445
504
  isIconButton = false,
446
505
  isCircle = false,
@@ -474,16 +533,18 @@ const useButtonBase = ({
474
533
  });
475
534
  const isSplitButton = Boolean(splitButtonContext);
476
535
  const isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
477
- const appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
536
+ const isDefaultAppearanceSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) === 'default';
537
+ const appearance = getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
478
538
  const spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
479
539
  const isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
480
540
  const hasOverlay = Boolean(overlay);
481
541
  const isInteractive = !isDisabled && !isLoading && !hasOverlay;
482
542
  const isEffectivelyDisabled = isDisabled || Boolean(overlay);
543
+ const isSelected = propIsSelected && !isDisabled;
483
544
  useAutoFocus(localRef, autoFocus);
484
545
  return {
485
546
  ref: mergeRefs([localRef, ref]),
486
- xcss: [getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedButtonStyles : baseButtonStyles, buttonStyles, appearance === 'default' && isInteractive && defaultInteractiveStyles, appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && subtleStyles, appearance === 'subtle' && isInteractive && subtleInteractiveStyles, appearance === 'link' && linkStyles, appearance === 'subtle-link' && subtleLinkStyles, !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? linkDecorationStyles : linkDecorationUnsetStyles, isSelected && selectedStyles, isSelected && isInteractive && selectedInteractiveStyles,
547
+ xcss: [getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedButtonStyles : hardCodedButtonStyles, buttonStyles, appearance === 'default' && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), appearance === 'link' && linkStyles, appearance === 'subtle-link' && subtleLinkStyles, !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? linkDecorationStyles : linkDecorationUnsetStyles, isSelected && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? selectedRefreshedStyles : selectedStyles), isSelected && isInteractive && selectedInteractiveStyles,
487
548
  // TODO: remove me once we kill color fallbacks
488
549
  isSelected && appearance === 'danger' && selectedDangerStyles,
489
550
  // TODO: remove me once we kill color fallbacks
@@ -119,7 +119,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
119
119
  action: 'clicked',
120
120
  componentName: 'button',
121
121
  packageName: "@atlaskit/button",
122
- packageVersion: "17.20.0",
122
+ packageVersion: "17.22.0",
123
123
  analyticsData: analyticsContext
124
124
  });
125
125
 
@@ -5,6 +5,7 @@
5
5
 
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
7
  import { css, jsx } from '@emotion/react';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
9
  import { fontSize as getFontSize } from '@atlaskit/theme/constants';
9
10
  var fontSize = getFontSize();
10
11
  var heights = {
@@ -16,7 +17,7 @@ import { SplitButtonContext } from './split-button-context';
16
17
  import { getActions } from './utils';
17
18
  var baseDividerStyles = css({
18
19
  display: 'inline-flex',
19
- width: '1px',
20
+ width: "var(--ds-border-width, 1px)",
20
21
  position: 'relative',
21
22
  zIndex: 2
22
23
  });
@@ -49,6 +50,9 @@ var dividerAppearance = {
49
50
  }),
50
51
  navigation: navigationDividerStyles
51
52
  };
53
+ var dividerRefreshedOffsetStyles = css({
54
+ marginInline: "calc(0px - ".concat("var(--ds-border-width, 1px)", ")")
55
+ });
52
56
  var dividerHeight = {
53
57
  default: defaultDividerStyles,
54
58
  compact: compactDividerStyles
@@ -64,7 +68,7 @@ export var Divider = function Divider(_ref) {
64
68
  return (
65
69
  // I find it funny to provide a div for Divider
66
70
  jsx("div", {
67
- css: [baseDividerStyles, dividerHeight[spacing], dividerAppearance[appearance], isDisabled ? dividerDisabledStyles : undefined]
71
+ css: [baseDividerStyles, dividerHeight[spacing], dividerAppearance[appearance], isDisabled ? dividerDisabledStyles : undefined, getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && dividerRefreshedOffsetStyles]
68
72
  })
69
73
  );
70
74
  };
@@ -88,13 +92,22 @@ var secondaryButtonStyles = css({
88
92
  borderStartStartRadius: 0
89
93
  }
90
94
  });
95
+ var defaultAppearanceContainerStyles = css({
96
+ borderRadius: "var(--ds-border-radius, 3px)",
97
+ outlineColor: "var(--ds-border, #091E4224)",
98
+ outlineOffset: "calc(0px - ".concat("var(--ds-border-width, 1px)", ")"),
99
+ outlineStyle: 'solid',
100
+ outlineWidth: "var(--ds-border-width, 1px)"
101
+ });
102
+
91
103
  /**
92
104
  * TODO: Add JSdoc
93
105
  */
94
106
  export var SplitButtonContainer = function SplitButtonContainer(_ref2) {
95
- var children = _ref2.children;
107
+ var appearance = _ref2.appearance,
108
+ children = _ref2.children;
96
109
  return jsx("div", {
97
- css: splitButtonStyles
110
+ css: [getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && appearance === 'default' && defaultAppearanceContainerStyles, splitButtonStyles]
98
111
  }, children);
99
112
  };
100
113
 
@@ -118,7 +131,9 @@ export var SplitButton = function SplitButton(_ref3) {
118
131
  var _getActions = getActions(children),
119
132
  PrimaryAction = _getActions.PrimaryAction,
120
133
  SecondaryAction = _getActions.SecondaryAction;
121
- return jsx(SplitButtonContainer, null, jsx(SplitButtonContext.Provider, {
134
+ return jsx(SplitButtonContainer, {
135
+ appearance: appearance
136
+ }, jsx(SplitButtonContext.Provider, {
122
137
  value: {
123
138
  appearance: appearance,
124
139
  spacing: spacing,
@@ -146,7 +161,9 @@ export var SplitButtonWithSlots = function SplitButtonWithSlots(_ref4) {
146
161
  spacing = _ref4$spacing === void 0 ? 'default' : _ref4$spacing,
147
162
  _ref4$isDisabled = _ref4.isDisabled,
148
163
  isDisabled = _ref4$isDisabled === void 0 ? false : _ref4$isDisabled;
149
- return jsx(SplitButtonContainer, null, jsx(SplitButtonContext.Provider, {
164
+ return jsx(SplitButtonContainer, {
165
+ appearance: appearance
166
+ }, jsx(SplitButtonContext.Provider, {
150
167
  value: {
151
168
  appearance: appearance,
152
169
  spacing: spacing,
@@ -1,5 +1,6 @@
1
1
  import React, { Fragment } from 'react';
2
2
  import Content from '../shared/content';
3
+ import IconRenderer from '../shared/icon-renderer';
3
4
  import renderLoadingOverlay from '../shared/loading-overlay';
4
5
  import useButtonBase from '../shared/use-button-base';
5
6
  /**
@@ -19,8 +20,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
19
20
  autoFocus = _ref.autoFocus,
20
21
  buttonType = _ref.buttonType,
21
22
  children = _ref.children,
22
- IconAfter = _ref.iconAfter,
23
- IconBefore = _ref.iconBefore,
23
+ iconAfter = _ref.iconAfter,
24
+ iconBefore = _ref.iconBefore,
24
25
  interactionName = _ref.interactionName,
25
26
  isDisabled = _ref.isDisabled,
26
27
  _ref$isLoading = _ref.isLoading,
@@ -51,24 +52,22 @@ var useDefaultButton = function useDefaultButton(_ref) {
51
52
  ariaLabel: ariaLabel,
52
53
  ariaLabelledBy: ariaLabelledBy,
53
54
  buttonType: buttonType,
54
- children: /*#__PURE__*/React.createElement(Fragment, null, IconBefore && /*#__PURE__*/React.createElement(Content, {
55
+ children: /*#__PURE__*/React.createElement(Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Content, {
55
56
  type: "icon",
56
57
  position: "before",
57
58
  hasOverlay: hasOverlay
58
- }, /*#__PURE__*/React.createElement(IconBefore, {
59
- label: "",
60
- size: UNSAFE_iconBefore_size,
61
- color: 'currentColor'
59
+ }, /*#__PURE__*/React.createElement(IconRenderer, {
60
+ icon: iconBefore,
61
+ size: UNSAFE_iconBefore_size
62
62
  })), children && /*#__PURE__*/React.createElement(Content, {
63
63
  hasOverlay: hasOverlay
64
- }, children), IconAfter && /*#__PURE__*/React.createElement(Content, {
64
+ }, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
65
65
  type: "icon",
66
66
  position: "after",
67
67
  hasOverlay: hasOverlay
68
- }, /*#__PURE__*/React.createElement(IconAfter, {
69
- label: "",
70
- size: UNSAFE_iconAfter_size,
71
- color: 'currentColor'
68
+ }, /*#__PURE__*/React.createElement(IconRenderer, {
69
+ icon: iconAfter,
70
+ size: UNSAFE_iconAfter_size
72
71
  }))),
73
72
  interactionName: interactionName,
74
73
  isDisabled: isDisabled,
@@ -94,8 +93,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
94
93
  ref: ref,
95
94
  shouldFitContainer: shouldFitContainer,
96
95
  spacing: spacing,
97
- hasIconBefore: Boolean(IconBefore),
98
- hasIconAfter: Boolean(IconAfter)
96
+ hasIconBefore: Boolean(iconBefore),
97
+ hasIconAfter: Boolean(iconAfter)
99
98
  });
100
99
  return baseProps;
101
100
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import VisuallyHidden from '@atlaskit/visually-hidden';
3
3
  import Content from '../shared/content';
4
+ import IconRenderer from '../shared/icon-renderer';
4
5
  import renderLoadingOverlay from '../shared/loading-overlay';
5
6
  import useButtonBase from '../shared/use-button-base';
6
7
  /**
@@ -19,7 +20,7 @@ var useIconButton = function useIconButton(_ref) {
19
20
  ariaLabelledBy = _ref.ariaLabelledBy,
20
21
  autoFocus = _ref.autoFocus,
21
22
  buttonType = _ref.buttonType,
22
- Icon = _ref.icon,
23
+ icon = _ref.icon,
23
24
  interactionName = _ref.interactionName,
24
25
  isDisabled = _ref.isDisabled,
25
26
  isLoading = _ref.isLoading,
@@ -54,10 +55,9 @@ var useIconButton = function useIconButton(_ref) {
54
55
  children: /*#__PURE__*/React.createElement(Content, {
55
56
  type: "icon",
56
57
  hasOverlay: hasOverlay
57
- }, /*#__PURE__*/React.createElement(Icon, {
58
- label: "",
59
- size: UNSAFE_size,
60
- color: 'currentColor'
58
+ }, /*#__PURE__*/React.createElement(IconRenderer, {
59
+ icon: icon,
60
+ size: UNSAFE_size
61
61
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
62
62
  interactionName: interactionName,
63
63
  isDisabled: isDisabled,
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+ function isIconRenderProp(func) {
4
+ return !func.displayName &&
5
+ // most function components and class components have a displayName, negate them
6
+ !func.render &&
7
+ // forwardRef doesn't require a display name, however it does include a render function, negate them
8
+ typeof func === 'function' // at the very least we need to be a function
9
+ ;
10
+ }
11
+
12
+ /**
13
+ * __Icon renderer__
14
+ *
15
+ * Used to support render props with icons.
16
+ *
17
+ */
18
+ var IconRenderer = function IconRenderer(_ref) {
19
+ var Icon = _ref.icon,
20
+ size = _ref.size;
21
+ return /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.design-system-team.button-render-prop-fix_lyo55') && isIconRenderProp(Icon) ? Icon({
22
+ label: '',
23
+ size: size,
24
+ color: 'currentColor'
25
+ }) : /*#__PURE__*/React.createElement(Icon, {
26
+ label: "",
27
+ size: size,
28
+ color: 'currentColor'
29
+ }));
30
+ };
31
+ export default IconRenderer;
@@ -23,27 +23,25 @@ var buttonStyles = xcss({
23
23
  alignItems: 'baseline',
24
24
  justifyContent: 'center',
25
25
  columnGap: 'space.050',
26
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
27
- background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
28
26
  borderRadius: 'border.radius.100',
29
27
  borderWidth: 'border.width.0',
30
- // @ts-expect-error
31
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
32
- color: "var(--ds-text, ".concat(colors.N500, ")"),
33
28
  flexShrink: 0,
34
29
  height: "".concat(32 / fontSize, "em"),
35
30
  paddingInlineEnd: 'space.150',
36
31
  paddingInlineStart: 'space.150',
37
32
  textAlign: 'center',
38
- transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
33
+ transition: 'background 0.1s ease-out',
39
34
  verticalAlign: 'middle',
40
- ':visited': {
41
- // @ts-expect-error
42
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
43
- color: "var(--ds-text, ".concat(colors.N500, ")")
35
+ '::after': {
36
+ borderRadius: 'inherit',
37
+ inset: 'space.0',
38
+ borderStyle: 'solid',
39
+ borderWidth: "var(--ds-border-width, 1px)",
40
+ pointerEvents: 'none',
41
+ position: 'absolute'
44
42
  }
45
43
  });
46
- var baseButtonStyles = xcss({
44
+ var hardCodedButtonStyles = xcss({
47
45
  fontFamily: 'inherit',
48
46
  fontSize: 'inherit',
49
47
  fontStyle: 'normal',
@@ -61,16 +59,46 @@ var defaultInteractiveStyles = xcss({
61
59
  background: "var(--ds-background-neutral-hovered, #091e4214)",
62
60
  // @ts-expect-error
63
61
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
64
- color: "var(--ds-text, ".concat(colors.N500, ")"),
65
- transitionDuration: '0s, 0.15s'
62
+ color: "var(--ds-text, ".concat(colors.N500, ")")
66
63
  },
67
64
  ':active': {
68
65
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
69
66
  background: "var(--ds-background-neutral-pressed, ".concat(colors.B75, ")"),
70
67
  // @ts-expect-error
71
68
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
72
- color: "var(--ds-text, ".concat(colors.B400, ")"),
73
- transitionDuration: '0s, 0s'
69
+ color: "var(--ds-text, ".concat(colors.B400, ")")
70
+ }
71
+ });
72
+ var defaultInteractiveRefreshedStyles = xcss({
73
+ ':hover': {
74
+ background: "var(--ds-background-neutral-subtle-hovered, #091E420F)",
75
+ color: 'color.text.subtle'
76
+ },
77
+ ':active': {
78
+ background: "var(--ds-background-neutral-subtle-pressed, #091E4224)",
79
+ color: 'color.text.subtle'
80
+ }
81
+ });
82
+ var defaultStyles = xcss({
83
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
84
+ background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
85
+ // @ts-expect-error — using tokens for explicit fallback usage.
86
+ color: "var(--ds-text, ".concat(colors.N500, ")"),
87
+ ':visited': {
88
+ // @ts-expect-error
89
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
90
+ color: "var(--ds-text, ".concat(colors.N500, ")")
91
+ }
92
+ });
93
+ var defaultRefreshedStyles = xcss({
94
+ background: "var(--ds-background-neutral-subtle, #00000000)",
95
+ color: 'color.text.subtle',
96
+ '::after': {
97
+ content: '""',
98
+ borderColor: 'color.border'
99
+ },
100
+ ':visited': {
101
+ color: 'color.text.subtle'
74
102
  }
75
103
  });
76
104
  var primaryStyles = xcss({
@@ -158,6 +186,13 @@ var subtleStyles = xcss({
158
186
  color: "var(--ds-text, #42526E)"
159
187
  }
160
188
  });
189
+ var subtleRefreshedStyles = xcss({
190
+ background: "var(--ds-background-neutral-subtle, transparent)",
191
+ color: 'color.text.subtle',
192
+ ':visited': {
193
+ color: 'color.text.subtle'
194
+ }
195
+ });
161
196
  var subtleInteractiveStyles = xcss({
162
197
  ':hover': {
163
198
  background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
@@ -170,6 +205,16 @@ var subtleInteractiveStyles = xcss({
170
205
  color: "var(--ds-text, #42526E)"
171
206
  }
172
207
  });
208
+ var subtleInteractiveRefreshedStyles = xcss({
209
+ ':hover': {
210
+ background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
211
+ color: 'color.text.subtle'
212
+ },
213
+ ':active': {
214
+ background: "var(--ds-background-neutral-subtle-pressed, #B3D4FF)",
215
+ color: 'color.text.subtle'
216
+ }
217
+ });
173
218
  var linkStyles = xcss({
174
219
  // @ts-expect-error
175
220
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
@@ -255,6 +300,9 @@ var disabledStyles = xcss({
255
300
  background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
256
301
  // @ts-expect-error
257
302
  color: "var(--ds-text-disabled, #091E424F)"
303
+ },
304
+ '::after': {
305
+ content: 'none'
258
306
  }
259
307
  });
260
308
  var selectedStyles = xcss({
@@ -269,6 +317,17 @@ var selectedStyles = xcss({
269
317
  color: "var(--ds-text-selected, ".concat(colors.N20, ")")
270
318
  }
271
319
  });
320
+ var selectedRefreshedStyles = xcss({
321
+ background: "var(--ds-background-selected, #E9F2FF)",
322
+ color: 'color.text.selected',
323
+ '::after': {
324
+ content: '""',
325
+ borderColor: 'color.border.selected'
326
+ },
327
+ ':visited': {
328
+ color: 'color.text.selected'
329
+ }
330
+ });
272
331
  var selectedInteractiveStyles = xcss({
273
332
  ':hover': {
274
333
  // @ts-expect-error
@@ -448,7 +507,7 @@ var useButtonBase = function useButtonBase(_ref) {
448
507
  _ref$isLoading = _ref.isLoading,
449
508
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
450
509
  _ref$isSelected = _ref.isSelected,
451
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
510
+ propIsSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
452
511
  _ref$isIconButton = _ref.isIconButton,
453
512
  isIconButton = _ref$isIconButton === void 0 ? false : _ref$isIconButton,
454
513
  _ref$isCircle = _ref.isCircle,
@@ -485,16 +544,18 @@ var useButtonBase = function useButtonBase(_ref) {
485
544
  });
486
545
  var isSplitButton = Boolean(splitButtonContext);
487
546
  var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
488
- var appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
547
+ var isDefaultAppearanceSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) === 'default';
548
+ var appearance = getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
489
549
  var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
490
550
  var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
491
551
  var hasOverlay = Boolean(overlay);
492
552
  var isInteractive = !isDisabled && !isLoading && !hasOverlay;
493
553
  var isEffectivelyDisabled = isDisabled || Boolean(overlay);
554
+ var isSelected = propIsSelected && !isDisabled;
494
555
  useAutoFocus(localRef, autoFocus);
495
556
  return _objectSpread({
496
557
  ref: mergeRefs([localRef, ref]),
497
- xcss: [getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedButtonStyles : baseButtonStyles, buttonStyles, appearance === 'default' && isInteractive && defaultInteractiveStyles, appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && subtleStyles, appearance === 'subtle' && isInteractive && subtleInteractiveStyles, appearance === 'link' && linkStyles, appearance === 'subtle-link' && subtleLinkStyles, !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? linkDecorationStyles : linkDecorationUnsetStyles, isSelected && selectedStyles, isSelected && isInteractive && selectedInteractiveStyles,
558
+ xcss: [getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedButtonStyles : hardCodedButtonStyles, buttonStyles, appearance === 'default' && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), appearance === 'link' && linkStyles, appearance === 'subtle-link' && subtleLinkStyles, !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? linkDecorationStyles : linkDecorationUnsetStyles, isSelected && (getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') ? selectedRefreshedStyles : selectedStyles), isSelected && isInteractive && selectedInteractiveStyles,
498
559
  // TODO: remove me once we kill color fallbacks
499
560
  isSelected && appearance === 'danger' && selectedDangerStyles,
500
561
  // TODO: remove me once we kill color fallbacks
@@ -125,7 +125,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
125
125
  action: 'clicked',
126
126
  componentName: 'button',
127
127
  packageName: "@atlaskit/button",
128
- packageVersion: "17.20.0",
128
+ packageVersion: "17.22.0",
129
129
  analyticsData: analyticsContext
130
130
  });
131
131
 
@@ -17,7 +17,8 @@ export declare const Divider: ({ appearance, spacing, isDisabled }: DividerProps
17
17
  /**
18
18
  * TODO: Add JSdoc
19
19
  */
20
- export declare const SplitButtonContainer: ({ children }: {
20
+ export declare const SplitButtonContainer: ({ appearance, children, }: {
21
+ appearance: SplitButtonAppearance;
21
22
  children: ReactNode;
22
23
  }) => jsx.JSX.Element;
23
24
  /**
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
12
12
  *
13
13
  * @private
14
14
  */
15
- declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter: IconAfter, iconBefore: IconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
15
+ declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
16
16
  export default useDefaultButton;
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
12
12
  *
13
13
  * @private
14
14
  */
15
- declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
15
+ declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
16
16
  export default useIconButton;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { type IconProps, type UNSAFE_NewIconProps } from '@atlaskit/icon/types';
3
+ import { type IconProp } from '../types';
4
+ /**
5
+ * __Icon renderer__
6
+ *
7
+ * Used to support render props with icons.
8
+ *
9
+ */
10
+ declare const IconRenderer: ({ icon: Icon, size, }: {
11
+ icon: IconProp;
12
+ size: IconProps['size'] | UNSAFE_NewIconProps['LEGACY_size'];
13
+ }) => JSX.Element;
14
+ export default IconRenderer;
@@ -42,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
42
42
  *
43
43
  * @private
44
44
  */
45
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
45
+ declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
46
46
  export default useButtonBase;
@@ -17,7 +17,8 @@ export declare const Divider: ({ appearance, spacing, isDisabled }: DividerProps
17
17
  /**
18
18
  * TODO: Add JSdoc
19
19
  */
20
- export declare const SplitButtonContainer: ({ children }: {
20
+ export declare const SplitButtonContainer: ({ appearance, children, }: {
21
+ appearance: SplitButtonAppearance;
21
22
  children: ReactNode;
22
23
  }) => jsx.JSX.Element;
23
24
  /**