@atlaskit/button 17.12.1 → 17.12.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.
Files changed (25) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/new-button/containers/split-button/split-button.js +9 -3
  3. package/dist/cjs/new-button/variants/shared/use-button-base.js +329 -31
  4. package/dist/cjs/old-button/shared/button-base.js +1 -1
  5. package/dist/es2019/new-button/containers/split-button/split-button.js +7 -1
  6. package/dist/es2019/new-button/variants/shared/use-button-base.js +330 -30
  7. package/dist/es2019/old-button/shared/button-base.js +1 -1
  8. package/dist/esm/new-button/containers/split-button/split-button.js +7 -1
  9. package/dist/esm/new-button/variants/shared/use-button-base.js +330 -32
  10. package/dist/esm/old-button/shared/button-base.js +1 -1
  11. package/dist/types/new-button/variants/shared/use-button-base.d.ts +3 -2
  12. package/dist/types/old-button/custom-theme-button/theme.d.ts +2 -6
  13. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +3 -2
  14. package/dist/types-ts4.5/old-button/custom-theme-button/theme.d.ts +2 -6
  15. package/package.json +4 -3
  16. package/dist/cjs/new-button/variants/shared/colors.js +0 -145
  17. package/dist/cjs/new-button/variants/shared/xcss.js +0 -198
  18. package/dist/es2019/new-button/variants/shared/colors.js +0 -136
  19. package/dist/es2019/new-button/variants/shared/xcss.js +0 -196
  20. package/dist/esm/new-button/variants/shared/colors.js +0 -136
  21. package/dist/esm/new-button/variants/shared/xcss.js +0 -190
  22. package/dist/types/new-button/variants/shared/colors.d.ts +0 -20
  23. package/dist/types/new-button/variants/shared/xcss.d.ts +0 -33
  24. package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +0 -20
  25. package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +0 -33
@@ -1,22 +1,337 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import React, { Fragment, useMemo, useRef } from 'react';
4
+ import React, { Fragment, useRef } from 'react';
5
5
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
6
6
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
7
7
  import { Box, xcss } from '@atlaskit/primitives';
8
+ import * as colors from '@atlaskit/theme/colors';
9
+ import { fontSize as getFontSize } from '@atlaskit/theme/constants';
8
10
  import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
9
11
  import blockEvents from './block-events';
10
- import { getXCSS } from './xcss';
12
+ var fontSize = getFontSize();
13
+ var buttonStyles = xcss({
14
+ display: 'inline-flex',
15
+ boxSizing: 'border-box',
16
+ width: 'auto',
17
+ maxWidth: '100%',
18
+ position: 'relative',
19
+ alignItems: 'baseline',
20
+ justifyContent: 'center',
21
+ columnGap: 'space.050',
22
+ background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
23
+ borderRadius: 'border.radius.100',
24
+ borderWidth: 'border.width.0',
25
+ // @ts-expect-error
26
+ color: "var(--ds-text, ".concat(colors.N500, ")"),
27
+ fontFamily: 'inherit',
28
+ fontSize: 'inherit',
29
+ fontStyle: 'normal',
30
+ fontWeight: 500,
31
+ height: "".concat(32 / fontSize, "em"),
32
+ lineHeight: "".concat(32 / fontSize, "em"),
33
+ paddingBlock: 'space.0',
34
+ paddingInlineEnd: 'space.150',
35
+ paddingInlineStart: 'space.150',
36
+ textAlign: 'center',
37
+ transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
38
+ verticalAlign: 'middle',
39
+ whiteSpace: 'nowrap',
40
+ ':visited': {
41
+ // @ts-expect-error
42
+ color: "var(--ds-text, ".concat(colors.N500, ")")
43
+ }
44
+ });
45
+ var defaultInteractiveStyles = xcss({
46
+ ':hover': {
47
+ background: "var(--ds-background-neutral-hovered, #091e4214)",
48
+ // @ts-expect-error
49
+ color: "var(--ds-text, ".concat(colors.N500, ")"),
50
+ transitionDuration: '0s, 0.15s'
51
+ },
52
+ ':active': {
53
+ background: "var(--ds-background-neutral-pressed, ".concat(colors.B75, ")"),
54
+ // @ts-expect-error
55
+ color: "var(--ds-text, ".concat(colors.B400, ")"),
56
+ transitionDuration: '0s, 0s'
57
+ }
58
+ });
59
+ var primaryStyles = xcss({
60
+ background: "var(--ds-background-brand-bold, #0052CC)",
61
+ // @ts-expect-error
62
+ color: "var(--ds-text-inverse, #FFFFFF)",
63
+ ':visited': {
64
+ // @ts-expect-error
65
+ color: "var(--ds-text-inverse, #FFFFFF)"
66
+ }
67
+ });
68
+ var primaryInteractiveStyles = xcss({
69
+ ':hover': {
70
+ // @ts-expect-error
71
+ color: "var(--ds-text-inverse, #FFFFFF)",
72
+ background: "var(--ds-background-brand-bold-hovered, #0065FF)"
73
+ },
74
+ ':active': {
75
+ // @ts-expect-error
76
+ color: "var(--ds-text-inverse, #FFFFFF)",
77
+ background: "var(--ds-background-brand-bold-pressed, #0747A6)"
78
+ }
79
+ });
80
+ var warningStyles = xcss({
81
+ background: "var(--ds-background-warning-bold, #FFAB00)",
82
+ // @ts-expect-error
83
+ color: "var(--ds-text-warning-inverse, #172B4D)",
84
+ ':visited': {
85
+ // @ts-expect-error
86
+ color: "var(--ds-text-warning-inverse, #172B4D)"
87
+ }
88
+ });
89
+ var warningInteractiveStyles = xcss({
90
+ ':hover': {
91
+ // @ts-expect-error
92
+ color: "var(--ds-text-warning-inverse, #172B4D)",
93
+ background: "var(--ds-background-warning-bold-hovered, #FFC400)"
94
+ },
95
+ ':active': {
96
+ // @ts-expect-error
97
+ color: "var(--ds-text-warning-inverse, #172B4D)",
98
+ background: "var(--ds-background-warning-bold-pressed, #FF991F)"
99
+ }
100
+ });
101
+ var dangerStyles = xcss({
102
+ background: "var(--ds-background-danger-bold, #DE350B)",
103
+ color: 'color.text.inverse',
104
+ ':visited': {
105
+ color: 'color.text.inverse'
106
+ }
107
+ });
108
+ var dangerInteractiveStyles = xcss({
109
+ ':hover': {
110
+ color: 'color.text.inverse',
111
+ background: "var(--ds-background-danger-bold-hovered, #FF5630)"
112
+ },
113
+ ':active': {
114
+ color: 'color.text.inverse',
115
+ background: "var(--ds-background-danger-bold-pressed, #BF2600)"
116
+ }
117
+ });
118
+ var subtleStyles = xcss({
119
+ background: "var(--ds-background-neutral-subtle, transparent)",
120
+ // @ts-expect-error
121
+ color: "var(--ds-text, #42526E)",
122
+ ':visited': {
123
+ // @ts-expect-error
124
+ color: "var(--ds-text, #42526E)"
125
+ }
126
+ });
127
+ var subtleInteractiveStyles = xcss({
128
+ ':hover': {
129
+ background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
130
+ // @ts-expect-error
131
+ color: "var(--ds-text, #42526E)"
132
+ },
133
+ ':active': {
134
+ background: "var(--ds-background-neutral-subtle-pressed, #B3D4FF)",
135
+ // @ts-expect-error
136
+ color: "var(--ds-text, #42526E)"
137
+ }
138
+ });
139
+ var linkStyles = xcss({
140
+ // @ts-expect-error
141
+ color: "var(--ds-link, ".concat(colors.B400, ")"),
142
+ background: "var(--ds-background-neutral-subtle, transparent)",
143
+ textDecoration: 'none',
144
+ ':hover': {
145
+ // @ts-expect-error
146
+ color: "var(--ds-link, ".concat(colors.B300, ")"),
147
+ background: "var(--ds-background-neutral-subtle, transparent)"
148
+ },
149
+ ':active': {
150
+ // @ts-expect-error
151
+ color: "var(--ds-link-pressed, #0055CC)",
152
+ background: "var(--ds-background-neutral-subtle, transparent)"
153
+ },
154
+ ':visited': {
155
+ // @ts-expect-error
156
+ color: "var(--ds-link, ".concat(colors.B400, ")")
157
+ }
158
+ });
159
+ var subtleLinkStyles = xcss({
160
+ // @ts-expect-error
161
+ color: "var(--ds-text-subtle, ".concat(colors.N200, ")"),
162
+ background: "var(--ds-background-neutral-subtle, transparent)",
163
+ textDecoration: 'none',
164
+ ':hover': {
165
+ // @ts-expect-error
166
+ color: "var(--ds-text-subtle, ".concat(colors.N90, ")"),
167
+ background: "var(--ds-background-neutral-subtle, transparent)"
168
+ },
169
+ ':active': {
170
+ // @ts-expect-error
171
+ color: "var(--ds-text, ".concat(colors.N400, ")"),
172
+ background: "var(--ds-background-neutral-subtle, transparent)"
173
+ },
174
+ ':visited': {
175
+ // @ts-expect-error
176
+ color: "var(--ds-text-subtle, ".concat(colors.N200, ")")
177
+ }
178
+ });
179
+
180
+ // Required due to Jira's AUI CSS reset: https://product-fabric.atlassian.net/browse/DSP-15687
181
+ var linkDecorationUnsetStyles = xcss({
182
+ textDecoration: 'none',
183
+ ':hover': {
184
+ textDecoration: 'none'
185
+ },
186
+ ':active': {
187
+ textDecoration: 'none'
188
+ },
189
+ ':focus': {
190
+ textDecoration: 'none'
191
+ }
192
+ });
193
+ var linkDecorationStyles = xcss({
194
+ ':hover': {
195
+ textDecoration: 'underline'
196
+ },
197
+ ':focus': {
198
+ textDecoration: 'underline'
199
+ }
200
+ });
201
+ var disabledStyles = xcss({
202
+ background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
203
+ // @ts-expect-error
204
+ color: "var(--ds-text-disabled, #091E424F)",
205
+ ':hover': {
206
+ background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
207
+ // @ts-expect-error
208
+ color: "var(--ds-text-disabled, #091E424F)"
209
+ },
210
+ ':active': {
211
+ background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
212
+ // @ts-expect-error
213
+ color: "var(--ds-text-disabled, #091E424F)"
214
+ }
215
+ });
216
+ var selectedStyles = xcss({
217
+ background: "var(--ds-background-selected, ".concat(colors.N700, ")"),
218
+ // @ts-expect-error
219
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
220
+ ':visited': {
221
+ // @ts-expect-error
222
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")")
223
+ }
224
+ });
225
+ var selectedInteractiveStyles = xcss({
226
+ ':hover': {
227
+ // @ts-expect-error
228
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
229
+ background: "var(--ds-background-selected-hovered, ".concat(colors.N700, ")")
230
+ },
231
+ ':active': {
232
+ // @ts-expect-error
233
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
234
+ background: "var(--ds-background-selected-pressed, ".concat(colors.N700, ")")
235
+ }
236
+ });
237
+
238
+ // TODO: Remove me once we kill color fallbacks
239
+ var selectedWarningStyles = xcss({
240
+ background: "var(--ds-background-selected, ".concat(colors.Y400, ")"),
241
+ // @ts-expect-error
242
+ color: "var(--ds-text-selected, ".concat(colors.N800, ")"),
243
+ ':hover': {
244
+ // @ts-expect-error
245
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
246
+ background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
247
+ },
248
+ ':active': {
249
+ // @ts-expect-error
250
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
251
+ background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
252
+ }
253
+ });
254
+
255
+ // TODO: Remove me once we kill color fallbacks
256
+ var selectedDangerStyles = xcss({
257
+ background: "var(--ds-background-selected, ".concat(colors.R500, ")"),
258
+ // @ts-expect-error
259
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
260
+ ':hover': {
261
+ // @ts-expect-error
262
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
263
+ background: "var(--ds-background-selected, ".concat(colors.R500, ")")
264
+ },
265
+ ':active': {
266
+ // @ts-expect-error
267
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
268
+ background: "var(--ds-background-selected, ".concat(colors.R500, ")")
269
+ }
270
+ });
271
+ var spacingCompactStyles = xcss({
272
+ columnGap: 'space.050',
273
+ height: "".concat(24 / fontSize, "em"),
274
+ lineHeight: "".concat(24 / fontSize, "em"),
275
+ paddingInlineEnd: 'space.150',
276
+ paddingInlineStart: 'space.150',
277
+ verticalAlign: 'middle'
278
+ });
279
+ var spacingNoneStyles = xcss({
280
+ columnGap: 'space.0',
281
+ height: 'auto',
282
+ lineHeight: 'inherit',
283
+ paddingInlineEnd: 'space.0',
284
+ paddingInlineStart: 'space.0',
285
+ verticalAlign: 'baseline'
286
+ });
287
+ var circleStyles = xcss({
288
+ borderRadius: 'border.radius.circle'
289
+ });
290
+ var fullWidthStyles = xcss({
291
+ width: '100%'
292
+ });
293
+ var loadingOverlayStyles = xcss({
294
+ cursor: 'progress'
295
+ });
296
+ var nonInteractiveStyles = xcss({
297
+ cursor: 'not-allowed'
298
+ });
299
+ var iconButtonStyles = xcss({
300
+ height: "".concat(32 / fontSize, "em"),
301
+ width: "".concat(32 / fontSize, "em"),
302
+ paddingInlineEnd: 'space.0',
303
+ paddingInlineStart: 'space.0'
304
+ });
305
+ var iconButtonCompactStyles = xcss({
306
+ width: "".concat(24 / fontSize, "em"),
307
+ height: "".concat(24 / fontSize, "em")
308
+ });
309
+ var buttonIconBeforeStyles = xcss({
310
+ paddingInlineStart: 'space.100'
311
+ });
312
+ var buttonIconAfterStyles = xcss({
313
+ paddingInlineEnd: 'space.100'
314
+ });
315
+ var splitButtonStyles = xcss({
316
+ ':focus-visible': {
317
+ zIndex: 'card'
318
+ }
319
+ });
320
+ var navigationSplitButtonStyles = xcss({
321
+ width: '24px',
322
+ backgroundColor: 'color.background.neutral.subtle',
323
+ paddingInlineEnd: 'space.075',
324
+ paddingInlineStart: 'space.075'
325
+ });
11
326
  var overlayStyles = xcss({
327
+ display: 'flex',
12
328
  position: 'absolute',
13
- insetInlineStart: 'space.0',
329
+ alignItems: 'center',
330
+ justifyContent: 'center',
331
+ insetBlockEnd: 'space.0',
14
332
  insetBlockStart: 'space.0',
15
333
  insetInlineEnd: 'space.0',
16
- insetBlockEnd: 'space.0',
17
- display: 'flex',
18
- alignItems: 'center',
19
- justifyContent: 'center'
334
+ insetInlineStart: 'space.0'
20
335
  });
21
336
 
22
337
  /**
@@ -37,7 +352,6 @@ var useButtonBase = function useButtonBase(_ref) {
37
352
  propAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
38
353
  _ref$autoFocus = _ref.autoFocus,
39
354
  autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
40
- buttonType = _ref.buttonType,
41
355
  _ref$isDisabled = _ref.isDisabled,
42
356
  propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
43
357
  _ref$isLoading = _ref.isLoading,
@@ -76,33 +390,17 @@ var useButtonBase = function useButtonBase(_ref) {
76
390
  var appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
77
391
  var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
78
392
  var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
79
- var isHighlighted = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isHighlighted) || false;
80
- var isActiveOverSelected = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isActiveOverSelected) || false;
81
- useAutoFocus(localRef, autoFocus);
82
- var buttonXCSS = useMemo(function () {
83
- return getXCSS({
84
- appearance: appearance,
85
- spacing: spacing,
86
- isDisabled: isDisabled,
87
- isLoading: isLoading,
88
- isSelected: isSelected,
89
- isHighlighted: isHighlighted,
90
- isActiveOverSelected: isActiveOverSelected,
91
- shouldFitContainer: shouldFitContainer,
92
- isIconButton: isIconButton,
93
- isCircle: isCircle,
94
- hasOverlay: Boolean(overlay),
95
- isLink: buttonType === 'link',
96
- hasIconBefore: hasIconBefore,
97
- hasIconAfter: hasIconAfter,
98
- isSplit: isSplitButton,
99
- isNavigationSplit: isNavigationSplitButton
100
- });
101
- }, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
393
+ var hasOverlay = Boolean(overlay);
394
+ var isInteractive = !isDisabled && !isLoading && !hasOverlay;
102
395
  var isEffectivelyDisabled = isDisabled || Boolean(overlay);
396
+ useAutoFocus(localRef, autoFocus);
103
397
  return _objectSpread({
104
398
  ref: mergeRefs([localRef, ref]),
105
- xcss: buttonXCSS,
399
+ xcss: [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 === '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,
400
+ // TODO: remove me once we kill color fallbacks
401
+ isSelected && appearance === 'danger' && selectedDangerStyles,
402
+ // TODO: remove me once we kill color fallbacks
403
+ isSelected && appearance === 'warning' && selectedWarningStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'none' && spacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingOverlayStyles, (isDisabled || hasOverlay && !isLoading) && nonInteractiveStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
106
404
  // Consider overlay buttons to be effectively disabled
107
405
  isDisabled: isEffectivelyDisabled,
108
406
  children: /*#__PURE__*/React.createElement(Fragment, null, children, overlay ? /*#__PURE__*/React.createElement(Box, {
@@ -108,7 +108,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
108
108
  action: 'clicked',
109
109
  componentName: 'button',
110
110
  packageName: "@atlaskit/button",
111
- packageVersion: "17.12.1",
111
+ packageVersion: "17.12.2",
112
112
  analyticsData: analyticsContext
113
113
  });
114
114
 
@@ -18,8 +18,9 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
18
18
  spacing?: Spacing;
19
19
  isLoading?: boolean;
20
20
  } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
21
+ type XCSS = ReturnType<typeof xcss>;
21
22
  export type UseButtonBaseReturn<TagName extends HTMLElement> = {
22
- xcss: ReturnType<typeof xcss>;
23
+ xcss: XCSS | Array<XCSS | false | undefined>;
23
24
  ref(node: TagName | null): void;
24
25
  children: React.ReactNode;
25
26
  isDisabled: boolean;
@@ -37,5 +38,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
37
38
  *
38
39
  * @private
39
40
  */
40
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
41
+ 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, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
41
42
  export default useButtonBase;
@@ -1,17 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { CSSObject } from '@emotion/react';
3
- import { InteractionState, ThemeProps, ThemeTokens } from './custom-theme-button-types';
3
+ import { ThemeProps, ThemeTokens } from './custom-theme-button-types';
4
4
  export declare function getCustomCss({ appearance, spacing, mode, isSelected, shouldFitContainer, iconIsOnlyChild, isLoading, state, }: ThemeProps): CSSObject;
5
5
  export declare function getSpecifiers(styles: CSSObject): CSSObject;
6
6
  export declare function defaultThemeFn(current: (values: ThemeProps) => ThemeTokens, values: ThemeProps): ThemeTokens;
7
7
  declare const Theme: {
8
8
  Consumer: import("react").ComponentType<{
9
9
  children: (tokens: ThemeTokens) => import("react").ReactNode;
10
- } & Partial<import("./custom-theme-button-types").CustomThemeButtonProps> & {
11
- state: InteractionState;
12
- iconIsOnlyChild?: boolean | undefined;
13
- mode?: import("@atlaskit/theme").ThemeModes | undefined;
14
- }>;
10
+ } & Omit<ThemeProps, "children">>;
15
11
  Provider: import("react").ComponentType<{
16
12
  children?: import("react").ReactNode;
17
13
  value?: import("@atlaskit/theme/components").ThemeProp<ThemeTokens, ThemeProps> | undefined;
@@ -18,8 +18,9 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
18
18
  spacing?: Spacing;
19
19
  isLoading?: boolean;
20
20
  } & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
21
+ type XCSS = ReturnType<typeof xcss>;
21
22
  export type UseButtonBaseReturn<TagName extends HTMLElement> = {
22
- xcss: ReturnType<typeof xcss>;
23
+ xcss: XCSS | Array<XCSS | false | undefined>;
23
24
  ref(node: TagName | null): void;
24
25
  children: React.ReactNode;
25
26
  isDisabled: boolean;
@@ -37,5 +38,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
37
38
  *
38
39
  * @private
39
40
  */
40
- declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
41
+ 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, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
41
42
  export default useButtonBase;
@@ -1,17 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { CSSObject } from '@emotion/react';
3
- import { InteractionState, ThemeProps, ThemeTokens } from './custom-theme-button-types';
3
+ import { ThemeProps, ThemeTokens } from './custom-theme-button-types';
4
4
  export declare function getCustomCss({ appearance, spacing, mode, isSelected, shouldFitContainer, iconIsOnlyChild, isLoading, state, }: ThemeProps): CSSObject;
5
5
  export declare function getSpecifiers(styles: CSSObject): CSSObject;
6
6
  export declare function defaultThemeFn(current: (values: ThemeProps) => ThemeTokens, values: ThemeProps): ThemeTokens;
7
7
  declare const Theme: {
8
8
  Consumer: import("react").ComponentType<{
9
9
  children: (tokens: ThemeTokens) => import("react").ReactNode;
10
- } & Partial<import("./custom-theme-button-types").CustomThemeButtonProps> & {
11
- state: InteractionState;
12
- iconIsOnlyChild?: boolean | undefined;
13
- mode?: import("@atlaskit/theme").ThemeModes | undefined;
14
- }>;
10
+ } & Omit<ThemeProps, "children">>;
15
11
  Provider: import("react").ComponentType<{
16
12
  children?: import("react").ReactNode;
17
13
  value?: import("@atlaskit/theme/components").ThemeProp<ThemeTokens, ThemeProps> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.12.1",
3
+ "version": "17.12.2",
4
4
  "description": "A button triggers an event or action. They let users know what will happen next.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@atlaskit/analytics-next": "^9.2.0",
86
- "@atlaskit/ds-lib": "^2.2.0",
86
+ "@atlaskit/ds-lib": "^2.3.0",
87
87
  "@atlaskit/focus-ring": "^1.3.9",
88
88
  "@atlaskit/icon": "^22.1.0",
89
89
  "@atlaskit/interaction-context": "^2.1.0",
@@ -104,7 +104,8 @@
104
104
  "@af/integration-testing": "*",
105
105
  "@af/visual-regression": "*",
106
106
  "@atlaskit/app-provider": "^1.3.0",
107
- "@atlaskit/checkbox": "*",
107
+ "@atlaskit/calendar": "^14.2.0",
108
+ "@atlaskit/checkbox": "^13.1.0",
108
109
  "@atlaskit/ssr": "*",
109
110
  "@atlaskit/visual-regression": "*",
110
111
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -1,145 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- var values = {
12
- // Default appearance
13
- background: {
14
- default: {
15
- /**
16
- * Some colors need specific fallback colors specified
17
- * to match the original Button when no theme is active.
18
- *
19
- * This is because the `xcss` automatic token fallbacks use
20
- * the legacy themes, which do not match original colors.
21
- */
22
- // @ts-expect-error
23
- default: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
24
- hover: 'color.background.neutral.hovered',
25
- active: 'color.background.neutral.pressed',
26
- // @ts-expect-error
27
- disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")")
28
- },
29
- primary: {
30
- default: 'color.background.brand.bold',
31
- hover: 'color.background.brand.bold.hovered',
32
- active: 'color.background.brand.bold.pressed',
33
- // @ts-expect-error
34
- disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")")
35
- },
36
- warning: {
37
- default: 'color.background.warning.bold',
38
- hover: 'color.background.warning.bold.hovered',
39
- active: 'color.background.warning.bold.pressed',
40
- // @ts-expect-error
41
- disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
42
- selected: {
43
- // @ts-expect-error
44
- default: "var(--ds-background-selected, ".concat(colors.Y400, ")"),
45
- // @ts-expect-error
46
- hover: "var(--ds-background-selected-hovered, ".concat(colors.Y400, ")"),
47
- // @ts-expect-error
48
- active: "var(--ds-background-selected-pressed, ".concat(colors.Y400, ")")
49
- }
50
- },
51
- danger: {
52
- default: 'color.background.danger.bold',
53
- hover: 'color.background.danger.bold.hovered',
54
- active: 'color.background.danger.bold.pressed',
55
- // @ts-expect-error
56
- disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
57
- selected: {
58
- // @ts-expect-error
59
- default: "var(--ds-background-selected, ".concat(colors.R500, ")"),
60
- // @ts-expect-error
61
- hover: "var(--ds-background-selected-hovered, ".concat(colors.R500, ")"),
62
- // @ts-expect-error
63
- active: "var(--ds-background-selected-pressed, ".concat(colors.R500, ")")
64
- }
65
- },
66
- link: {
67
- default: 'color.background.neutral.subtle'
68
- },
69
- subtle: {
70
- default: 'color.background.neutral.subtle',
71
- hover: 'color.background.neutral.subtle.hovered',
72
- active: 'color.background.neutral.subtle.pressed',
73
- // @ts-expect-error
74
- disabled: "var(--ds-background-neutral-subtle, none)"
75
- },
76
- 'subtle-link': {
77
- default: 'color.background.neutral.subtle'
78
- },
79
- selected: {
80
- // @ts-expect-error
81
- default: "var(--ds-background-selected, ".concat(colors.N700, ")"),
82
- // @ts-expect-error
83
- hover: "var(--ds-background-selected-hovered, ".concat(colors.N700, ")"),
84
- // @ts-expect-error
85
- active: "var(--ds-background-selected-pressed, ".concat(colors.N700, ")")
86
- }
87
- },
88
- color: {
89
- default: {
90
- // @ts-expect-error
91
- default: "var(--ds-text, ".concat(colors.N500, ")"),
92
- // @ts-expect-error
93
- active: "var(--ds-text, ".concat(colors.B400, ")"),
94
- disabled: 'color.text.disabled'
95
- },
96
- primary: {
97
- default: 'color.text.inverse',
98
- disabled: 'color.text.disabled'
99
- },
100
- warning: {
101
- default: 'color.text.warning.inverse',
102
- disabled: 'color.text.disabled',
103
- selected: {
104
- // @ts-expect-error
105
- default: "var(--ds-text-selected, ".concat(colors.N800, ")")
106
- }
107
- },
108
- danger: {
109
- default: 'color.text.inverse',
110
- disabled: 'color.text.disabled',
111
- selected: {
112
- // @ts-expect-error
113
- default: "var(--ds-text-selected, ".concat(colors.N0, ")")
114
- }
115
- },
116
- link: {
117
- default: 'color.link',
118
- // @ts-expect-error
119
- hover: "var(--ds-link, ".concat(colors.B300, ")"),
120
- active: 'color.link.pressed',
121
- disabled: 'color.text.disabled'
122
- },
123
- subtle: {
124
- // @ts-expect-error
125
- default: "var(--ds-text, ".concat(colors.N500, ")"),
126
- // @ts-expect-error
127
- active: "var(--ds-text, ".concat(colors.B400, ")"),
128
- disabled: 'color.text.disabled'
129
- },
130
- 'subtle-link': {
131
- // @ts-expect-error
132
- default: "var(--ds-text-subtle, ".concat(colors.N200, ")"),
133
- // @ts-expect-error
134
- hover: "var(--ds-text-subtle, ".concat(colors.N90, ")"),
135
- // @ts-expect-error
136
- active: "var(--ds-text, ".concat(colors.N400, ")"),
137
- disabled: 'color.text.disabled'
138
- },
139
- selected: {
140
- // @ts-expect-error
141
- default: "var(--ds-text-selected, ".concat(colors.N20, ")")
142
- }
143
- }
144
- };
145
- var _default = exports.default = values;