@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,190 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
- 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 { xcss } from '@atlaskit/primitives';
5
- import { fontSize as getFontSize } from '@atlaskit/theme/constants';
6
- import colors from './colors';
7
- var fontSize = getFontSize();
8
- export var heights = {
9
- default: "".concat(32 / fontSize, "em"),
10
- compact: "".concat(24 / fontSize, "em"),
11
- none: 'auto'
12
- };
13
- var lineHeights = {
14
- default: heights.default,
15
- compact: heights.compact,
16
- none: 'inherit'
17
- };
18
- var paddingInline = {
19
- default: {
20
- default: 'space.150',
21
- withIcon: 'space.100'
22
- },
23
- compact: {
24
- default: 'space.150',
25
- withIcon: 'space.100'
26
- },
27
- none: {
28
- default: 'space.0',
29
- withIcon: 'space.0'
30
- }
31
- };
32
- var gap = {
33
- compact: 'space.050',
34
- default: 'space.050',
35
- none: 'space.0'
36
- };
37
- var verticalAlign = {
38
- default: 'middle',
39
- compact: 'middle',
40
- none: 'baseline'
41
- };
42
- var splitBorderStyles = {
43
- ':focus-visible': {
44
- zIndex: 1
45
- }
46
- };
47
- function getColor(_ref) {
48
- var group = _ref.group,
49
- key = _ref.key;
50
- return group[key] || group.default;
51
- }
52
- function getColors(_ref2) {
53
- var appearance = _ref2.appearance,
54
- _ref2$interactionStat = _ref2.interactionState,
55
- interactionState = _ref2$interactionStat === void 0 ? 'default' : _ref2$interactionStat,
56
- isDisabled = _ref2.isDisabled,
57
- isSelected = _ref2.isSelected,
58
- isHighlighted = _ref2.isHighlighted,
59
- isActiveOverSelected = _ref2.isActiveOverSelected,
60
- hasOverlay = _ref2.hasOverlay;
61
- var showSelectedState = (isSelected || isHighlighted) && !isDisabled && !isActiveOverSelected;
62
- var key = interactionState;
63
- // Overlay does not change color on interaction, revert to 'default' or resting state
64
- key = hasOverlay ? 'default' : key;
65
- key = showSelectedState && isActiveOverSelected ? 'active' : key;
66
-
67
- // Disabled colors overrule everything else
68
- key = isDisabled ? 'disabled' : key;
69
- return {
70
- backgroundColor: getColor({
71
- group: showSelectedState && colors.background[appearance]['selected'] || colors.background[showSelectedState ? 'selected' : appearance],
72
- key: key
73
- }),
74
- color: getColor({
75
- group: showSelectedState && colors.color[appearance]['selected'] || colors.color[showSelectedState ? 'selected' : appearance],
76
- key: key
77
- })
78
- };
79
- }
80
- export function getXCSS(_ref3) {
81
- var appearance = _ref3.appearance,
82
- spacing = _ref3.spacing,
83
- isDisabled = _ref3.isDisabled,
84
- isSelected = _ref3.isSelected,
85
- isLoading = _ref3.isLoading,
86
- isHighlighted = _ref3.isHighlighted,
87
- isActiveOverSelected = _ref3.isActiveOverSelected,
88
- isIconButton = _ref3.isIconButton,
89
- isCircle = _ref3.isCircle,
90
- shouldFitContainer = _ref3.shouldFitContainer,
91
- isLink = _ref3.isLink,
92
- isSplit = _ref3.isSplit,
93
- isNavigationSplit = _ref3.isNavigationSplit,
94
- hasOverlay = _ref3.hasOverlay,
95
- hasIconBefore = _ref3.hasIconBefore,
96
- hasIconAfter = _ref3.hasIconAfter;
97
- var baseColors = getColors({
98
- appearance: appearance,
99
- isSelected: isSelected,
100
- isHighlighted: isHighlighted,
101
- isActiveOverSelected: isActiveOverSelected,
102
- isDisabled: isDisabled
103
- });
104
- var combinedBaseColorStyles = isLink ? _objectSpread(_objectSpread({}, baseColors), {}, {
105
- textDecoration: 'none',
106
- // Disabling visited styles (by re-declaring the base colors)
107
- ':visited': baseColors
108
- }) : isNavigationSplit && !isSelected ? _objectSpread(_objectSpread({}, baseColors), {}, {
109
- backgroundColor: 'color.background.neutral.subtle'
110
- }) : baseColors;
111
- var height = heights[spacing];
112
- var width = shouldFitContainer ? '100%' : 'auto';
113
- width = isIconButton ? isNavigationSplit ? '24px' : height : width;
114
- var defaultPaddingInlineStart = paddingInline[spacing][hasIconBefore ? 'withIcon' : 'default'];
115
- var defaultPaddingInlineEnd = paddingInline[spacing][hasIconAfter ? 'withIcon' : 'default'];
116
- var splitButtonStyles = isSplit ? splitBorderStyles : {};
117
- var getNavigationSplitButtonPaddings = function getNavigationSplitButtonPaddings() {
118
- if (isNavigationSplit) {
119
- return {
120
- paddingInlineStart: 'space.075',
121
- paddingInlineEnd: 'space.075'
122
- };
123
- }
124
- return {
125
- paddingInlineStart: isIconButton ? 'space.0' : defaultPaddingInlineStart,
126
- paddingInlineEnd: isIconButton ? 'space.0' : defaultPaddingInlineEnd
127
- };
128
- };
129
- var _getNavigationSplitBu = getNavigationSplitButtonPaddings(),
130
- paddingInlineStart = _getNavigationSplitBu.paddingInlineStart,
131
- paddingInlineEnd = _getNavigationSplitBu.paddingInlineEnd;
132
- return xcss(_objectSpread(_objectSpread(_objectSpread({
133
- alignItems: 'baseline',
134
- borderWidth: 'border.width.0',
135
- borderRadius: isCircle && !isSplit ? 'border.radius.circle' : 'border.radius.100',
136
- boxSizing: 'border-box',
137
- display: 'inline-flex',
138
- fontSize: 'inherit',
139
- fontStyle: 'normal',
140
- fontFamily: 'inherit',
141
- fontWeight: 500,
142
- maxWidth: '100%',
143
- // Needed to position overlay
144
- position: 'relative',
145
- textAlign: 'center',
146
- transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
147
- whiteSpace: 'nowrap',
148
- height: height,
149
- lineHeight: lineHeights[spacing],
150
- paddingBlock: 'space.0',
151
- paddingInlineStart: paddingInlineStart,
152
- paddingInlineEnd: paddingInlineEnd,
153
- columnGap: gap[spacing],
154
- verticalAlign: verticalAlign[spacing],
155
- width: width,
156
- // justifyContent required for shouldFitContainer buttons with an icon inside
157
- justifyContent: 'center'
158
- }, combinedBaseColorStyles), isDisabled || hasOverlay || isLoading ? {
159
- cursor: isLoading ? 'progress' : 'not-allowed'
160
- } : {}), {}, {
161
- ':hover': _objectSpread(_objectSpread({}, getColors({
162
- appearance: appearance,
163
- isSelected: isNavigationSplit && !isSelected ? false : isSelected,
164
- isActiveOverSelected: isActiveOverSelected,
165
- isDisabled: isDisabled,
166
- interactionState: 'hover',
167
- hasOverlay: hasOverlay
168
- })), {}, {
169
- textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none',
170
- // background, box-shadow
171
- transitionDuration: '0s, 0.15s'
172
- }),
173
- ':active': _objectSpread(_objectSpread({}, getColors({
174
- appearance: appearance,
175
- isSelected: isNavigationSplit && !isSelected ? false : isSelected,
176
- isActiveOverSelected: isActiveOverSelected,
177
- isDisabled: isDisabled,
178
- interactionState: 'active',
179
- hasOverlay: hasOverlay
180
- })), {}, {
181
- // background, box-shadow
182
- transitionDuration: '0s, 0s'
183
- }),
184
- ':focus': {
185
- // Required due to Jira's AUI CSS reset
186
- // See https://product-fabric.atlassian.net/browse/DSP-15687
187
- textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none'
188
- }
189
- }, splitButtonStyles));
190
- }
@@ -1,20 +0,0 @@
1
- import { type BackgroundColor, type TextColor } from '@atlaskit/primitives';
2
- import { type Appearance } from '../types';
3
- export type ColorGroup<T extends BackgroundColor | TextColor> = {
4
- default: T;
5
- hover?: T;
6
- active?: T;
7
- disabled?: T;
8
- };
9
- export type ColorGroupWithSelected<T extends BackgroundColor | TextColor> = ColorGroup<T> & {
10
- selected?: ColorGroup<T>;
11
- };
12
- export type ColorPreset<T extends BackgroundColor | TextColor> = Record<Appearance, ColorGroupWithSelected<T>> & {
13
- selected: ColorGroup<T>;
14
- };
15
- type Values = {
16
- background: ColorPreset<BackgroundColor>;
17
- color: ColorPreset<TextColor>;
18
- };
19
- declare const values: Values;
20
- export default values;
@@ -1,33 +0,0 @@
1
- import { xcss } from '@atlaskit/primitives';
2
- import { type Appearance, type Spacing } from '../types';
3
- export declare const heights: {
4
- [key in Spacing]: string;
5
- };
6
- export type GetXCSSArgs = {
7
- appearance: Appearance;
8
- spacing: Spacing;
9
- isDisabled: boolean;
10
- isLoading: boolean;
11
- isSelected: boolean;
12
- isHighlighted: boolean;
13
- isActiveOverSelected: boolean;
14
- shouldFitContainer: boolean;
15
- hasOverlay: boolean;
16
- isIconButton: boolean;
17
- isCircle: boolean;
18
- hasIconBefore: boolean;
19
- hasIconAfter: boolean;
20
- /**
21
- * If the button is a LinkButton
22
- */
23
- isLink: boolean;
24
- /**
25
- * If the button is a SplitButton
26
- */
27
- isSplit: boolean;
28
- /**
29
- * If the button is a PrimarySplitButton used in atlassian-navigation
30
- */
31
- isNavigationSplit: boolean;
32
- };
33
- export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isLoading, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
@@ -1,20 +0,0 @@
1
- import { type BackgroundColor, type TextColor } from '@atlaskit/primitives';
2
- import { type Appearance } from '../types';
3
- export type ColorGroup<T extends BackgroundColor | TextColor> = {
4
- default: T;
5
- hover?: T;
6
- active?: T;
7
- disabled?: T;
8
- };
9
- export type ColorGroupWithSelected<T extends BackgroundColor | TextColor> = ColorGroup<T> & {
10
- selected?: ColorGroup<T>;
11
- };
12
- export type ColorPreset<T extends BackgroundColor | TextColor> = Record<Appearance, ColorGroupWithSelected<T>> & {
13
- selected: ColorGroup<T>;
14
- };
15
- type Values = {
16
- background: ColorPreset<BackgroundColor>;
17
- color: ColorPreset<TextColor>;
18
- };
19
- declare const values: Values;
20
- export default values;
@@ -1,33 +0,0 @@
1
- import { xcss } from '@atlaskit/primitives';
2
- import { type Appearance, type Spacing } from '../types';
3
- export declare const heights: {
4
- [key in Spacing]: string;
5
- };
6
- export type GetXCSSArgs = {
7
- appearance: Appearance;
8
- spacing: Spacing;
9
- isDisabled: boolean;
10
- isLoading: boolean;
11
- isSelected: boolean;
12
- isHighlighted: boolean;
13
- isActiveOverSelected: boolean;
14
- shouldFitContainer: boolean;
15
- hasOverlay: boolean;
16
- isIconButton: boolean;
17
- isCircle: boolean;
18
- hasIconBefore: boolean;
19
- hasIconAfter: boolean;
20
- /**
21
- * If the button is a LinkButton
22
- */
23
- isLink: boolean;
24
- /**
25
- * If the button is a SplitButton
26
- */
27
- isSplit: boolean;
28
- /**
29
- * If the button is a PrimarySplitButton used in atlassian-navigation
30
- */
31
- isNavigationSplit: boolean;
32
- };
33
- export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isLoading, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;