@instructure/ui-buttons 11.6.0 → 11.6.1-snapshot-129
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.
- package/CHANGELOG.md +57 -323
- package/es/BaseButton/{index.js → v1/index.js} +2 -2
- package/es/BaseButton/v2/index.js +304 -0
- package/es/BaseButton/v2/props.js +26 -0
- package/es/BaseButton/v2/styles.js +578 -0
- package/es/Button/{index.js → v1/index.js} +2 -2
- package/es/{CondensedButton → Button/v1}/theme.js +1 -1
- package/es/Button/v2/index.js +121 -0
- package/es/Button/v2/props.js +26 -0
- package/es/CloseButton/{index.js → v1/index.js} +2 -2
- package/es/CloseButton/v2/index.js +130 -0
- package/es/CloseButton/v2/props.js +26 -0
- package/es/CloseButton/v2/styles.js +68 -0
- package/es/CondensedButton/{index.js → v1/index.js} +2 -2
- package/es/{Button → CondensedButton/v1}/theme.js +1 -1
- package/es/CondensedButton/v2/index.js +111 -0
- package/es/CondensedButton/v2/props.js +26 -0
- package/es/IconButton/{index.js → v1/index.js} +2 -2
- package/es/IconButton/{theme.js → v1/theme.js} +1 -1
- package/es/IconButton/v2/index.js +121 -0
- package/es/IconButton/v2/props.js +26 -0
- package/es/ToggleButton/{index.js → v1/index.js} +2 -2
- package/es/ToggleButton/v2/index.js +121 -0
- package/es/ToggleButton/v2/props.js +26 -0
- package/es/exports/a.js +29 -0
- package/es/exports/b.js +29 -0
- package/lib/BaseButton/{index.js → v1/index.js} +3 -3
- package/lib/BaseButton/v2/index.js +311 -0
- package/lib/BaseButton/v2/props.js +31 -0
- package/lib/BaseButton/v2/styles.js +584 -0
- package/lib/Button/v1/index.js +128 -0
- package/lib/Button/{theme.js → v1/theme.js} +1 -1
- package/lib/Button/{index.js → v2/index.js} +3 -4
- package/lib/Button/v2/props.js +31 -0
- package/lib/CloseButton/{index.js → v1/index.js} +4 -4
- package/lib/CloseButton/v2/index.js +136 -0
- package/lib/CloseButton/v2/props.js +31 -0
- package/lib/CloseButton/v2/styles.js +74 -0
- package/lib/CondensedButton/{index.js → v1/index.js} +3 -3
- package/lib/CondensedButton/{theme.js → v1/theme.js} +1 -1
- package/lib/CondensedButton/v2/index.js +116 -0
- package/lib/CondensedButton/v2/props.js +31 -0
- package/lib/IconButton/{index.js → v1/index.js} +3 -3
- package/lib/IconButton/{theme.js → v1/theme.js} +1 -1
- package/lib/IconButton/v2/index.js +126 -0
- package/lib/IconButton/v2/props.js +31 -0
- package/lib/ToggleButton/{index.js → v1/index.js} +4 -4
- package/lib/ToggleButton/v2/index.js +127 -0
- package/lib/ToggleButton/v2/props.js +31 -0
- package/lib/{index.js → exports/a.js} +12 -12
- package/lib/exports/b.js +47 -0
- package/package.json +46 -24
- package/src/BaseButton/{index.tsx → v1/index.tsx} +3 -3
- package/src/BaseButton/{props.ts → v1/props.ts} +1 -1
- package/src/BaseButton/v2/README.md +15 -0
- package/src/BaseButton/v2/index.tsx +343 -0
- package/src/BaseButton/v2/props.ts +226 -0
- package/src/BaseButton/v2/styles.ts +640 -0
- package/src/Button/{index.tsx → v1/index.tsx} +2 -2
- package/src/Button/{props.ts → v1/props.ts} +1 -1
- package/src/{CondensedButton → Button/v1}/theme.ts +1 -1
- package/src/Button/v2/README.md +338 -0
- package/src/Button/v2/index.tsx +137 -0
- package/src/Button/v2/props.ts +159 -0
- package/src/CloseButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/CloseButton/{props.ts → v1/props.ts} +1 -1
- package/src/CloseButton/v2/README.md +70 -0
- package/src/CloseButton/v2/index.tsx +142 -0
- package/src/CloseButton/v2/props.ts +148 -0
- package/src/CloseButton/v2/styles.ts +81 -0
- package/src/CondensedButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/CondensedButton/{props.ts → v1/props.ts} +1 -1
- package/src/{Button → CondensedButton/v1}/theme.ts +1 -1
- package/src/CondensedButton/v2/README.md +75 -0
- package/src/CondensedButton/v2/index.tsx +129 -0
- package/src/CondensedButton/v2/props.ts +134 -0
- package/src/IconButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/IconButton/{props.ts → v1/props.ts} +1 -1
- package/src/IconButton/{theme.ts → v1/theme.ts} +1 -1
- package/src/IconButton/v2/README.md +86 -0
- package/src/IconButton/v2/index.tsx +138 -0
- package/src/IconButton/v2/props.ts +166 -0
- package/src/ToggleButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/ToggleButton/{props.ts → v1/props.ts} +1 -1
- package/src/ToggleButton/v2/README.md +85 -0
- package/src/ToggleButton/v2/index.tsx +133 -0
- package/src/ToggleButton/v2/props.ts +143 -0
- package/src/exports/a.ts +40 -0
- package/src/exports/b.ts +40 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/BaseButton/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/BaseButton/v1/index.d.ts.map +1 -0
- package/types/BaseButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/BaseButton/v1/props.d.ts.map +1 -0
- package/types/BaseButton/v1/styles.d.ts.map +1 -0
- package/types/BaseButton/v1/theme.d.ts.map +1 -0
- package/types/BaseButton/v2/index.d.ts +48 -0
- package/types/BaseButton/v2/index.d.ts.map +1 -0
- package/types/BaseButton/v2/props.d.ts +118 -0
- package/types/BaseButton/v2/props.d.ts.map +1 -0
- package/types/BaseButton/v2/styles.d.ts +5 -0
- package/types/BaseButton/v2/styles.d.ts.map +1 -0
- package/types/Button/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/Button/v1/index.d.ts.map +1 -0
- package/types/Button/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/Button/v1/props.d.ts.map +1 -0
- package/types/Button/v1/theme.d.ts +2 -0
- package/types/Button/v1/theme.d.ts.map +1 -0
- package/types/Button/v2/index.d.ts +51 -0
- package/types/Button/v2/index.d.ts.map +1 -0
- package/types/Button/v2/props.d.ts +82 -0
- package/types/Button/v2/props.d.ts.map +1 -0
- package/types/CloseButton/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/CloseButton/v1/index.d.ts.map +1 -0
- package/types/CloseButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/CloseButton/v1/props.d.ts.map +1 -0
- package/types/CloseButton/v1/styles.d.ts.map +1 -0
- package/types/CloseButton/v1/theme.d.ts.map +1 -0
- package/types/CloseButton/v2/index.d.ts +46 -0
- package/types/CloseButton/v2/index.d.ts.map +1 -0
- package/types/CloseButton/v2/props.d.ts +77 -0
- package/types/CloseButton/v2/props.d.ts.map +1 -0
- package/types/CloseButton/v2/styles.d.ts +15 -0
- package/types/CloseButton/v2/styles.d.ts.map +1 -0
- package/types/CondensedButton/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/CondensedButton/v1/index.d.ts.map +1 -0
- package/types/CondensedButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/CondensedButton/v1/props.d.ts.map +1 -0
- package/types/CondensedButton/v1/theme.d.ts +2 -0
- package/types/CondensedButton/v1/theme.d.ts.map +1 -0
- package/types/CondensedButton/v2/index.d.ts +45 -0
- package/types/CondensedButton/v2/index.d.ts.map +1 -0
- package/types/CondensedButton/v2/props.d.ts +69 -0
- package/types/CondensedButton/v2/props.d.ts.map +1 -0
- package/types/IconButton/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/IconButton/v1/index.d.ts.map +1 -0
- package/types/IconButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/IconButton/v1/props.d.ts.map +1 -0
- package/types/IconButton/v1/theme.d.ts +2 -0
- package/types/IconButton/v1/theme.d.ts.map +1 -0
- package/types/IconButton/v2/index.d.ts +51 -0
- package/types/IconButton/v2/index.d.ts.map +1 -0
- package/types/IconButton/v2/props.d.ts +85 -0
- package/types/IconButton/v2/props.d.ts.map +1 -0
- package/types/ToggleButton/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/ToggleButton/v1/index.d.ts.map +1 -0
- package/types/ToggleButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/ToggleButton/v1/props.d.ts.map +1 -0
- package/types/ToggleButton/v2/index.d.ts +43 -0
- package/types/ToggleButton/v2/index.d.ts.map +1 -0
- package/types/ToggleButton/v2/props.d.ts +75 -0
- package/types/ToggleButton/v2/props.d.ts.map +1 -0
- package/types/exports/a.d.ts +13 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +13 -0
- package/types/exports/b.d.ts.map +1 -0
- package/es/index.js +0 -29
- package/src/index.ts +0 -37
- package/types/BaseButton/index.d.ts.map +0 -1
- package/types/BaseButton/props.d.ts.map +0 -1
- package/types/BaseButton/styles.d.ts.map +0 -1
- package/types/BaseButton/theme.d.ts.map +0 -1
- package/types/Button/index.d.ts.map +0 -1
- package/types/Button/props.d.ts.map +0 -1
- package/types/Button/theme.d.ts +0 -2
- package/types/Button/theme.d.ts.map +0 -1
- package/types/CloseButton/index.d.ts.map +0 -1
- package/types/CloseButton/props.d.ts.map +0 -1
- package/types/CloseButton/styles.d.ts.map +0 -1
- package/types/CloseButton/theme.d.ts.map +0 -1
- package/types/CondensedButton/index.d.ts.map +0 -1
- package/types/CondensedButton/props.d.ts.map +0 -1
- package/types/CondensedButton/theme.d.ts +0 -2
- package/types/CondensedButton/theme.d.ts.map +0 -1
- package/types/IconButton/index.d.ts.map +0 -1
- package/types/IconButton/props.d.ts.map +0 -1
- package/types/IconButton/theme.d.ts +0 -2
- package/types/IconButton/theme.d.ts.map +0 -1
- package/types/ToggleButton/index.d.ts.map +0 -1
- package/types/ToggleButton/props.d.ts.map +0 -1
- package/types/index.d.ts +0 -13
- package/types/index.d.ts.map +0 -1
- /package/es/BaseButton/{props.js → v1/props.js} +0 -0
- /package/es/BaseButton/{styles.js → v1/styles.js} +0 -0
- /package/es/BaseButton/{theme.js → v1/theme.js} +0 -0
- /package/es/Button/{props.js → v1/props.js} +0 -0
- /package/es/CloseButton/{props.js → v1/props.js} +0 -0
- /package/es/CloseButton/{styles.js → v1/styles.js} +0 -0
- /package/es/CloseButton/{theme.js → v1/theme.js} +0 -0
- /package/es/CondensedButton/{props.js → v1/props.js} +0 -0
- /package/es/IconButton/{props.js → v1/props.js} +0 -0
- /package/es/ToggleButton/{props.js → v1/props.js} +0 -0
- /package/lib/BaseButton/{props.js → v1/props.js} +0 -0
- /package/lib/BaseButton/{styles.js → v1/styles.js} +0 -0
- /package/lib/BaseButton/{theme.js → v1/theme.js} +0 -0
- /package/lib/Button/{props.js → v1/props.js} +0 -0
- /package/lib/CloseButton/{props.js → v1/props.js} +0 -0
- /package/lib/CloseButton/{styles.js → v1/styles.js} +0 -0
- /package/lib/CloseButton/{theme.js → v1/theme.js} +0 -0
- /package/lib/CondensedButton/{props.js → v1/props.js} +0 -0
- /package/lib/IconButton/{props.js → v1/props.js} +0 -0
- /package/lib/ToggleButton/{props.js → v1/props.js} +0 -0
- /package/src/BaseButton/{README.md → v1/README.md} +0 -0
- /package/src/BaseButton/{styles.ts → v1/styles.ts} +0 -0
- /package/src/BaseButton/{theme.ts → v1/theme.ts} +0 -0
- /package/src/Button/{README.md → v1/README.md} +0 -0
- /package/src/CloseButton/{README.md → v1/README.md} +0 -0
- /package/src/CloseButton/{styles.ts → v1/styles.ts} +0 -0
- /package/src/CloseButton/{theme.ts → v1/theme.ts} +0 -0
- /package/src/CondensedButton/{README.md → v1/README.md} +0 -0
- /package/src/IconButton/{README.md → v1/README.md} +0 -0
- /package/src/ToggleButton/{README.md → v1/README.md} +0 -0
- /package/types/BaseButton/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/BaseButton/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/CloseButton/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/CloseButton/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const generateStyle = (componentTheme, params, _sharedTokens, extraArgs) => {
|
|
32
|
+
const size = params.size,
|
|
33
|
+
color = params.color,
|
|
34
|
+
textAlign = params.textAlign,
|
|
35
|
+
shape = params.shape,
|
|
36
|
+
withBackground = params.withBackground,
|
|
37
|
+
withBorder = params.withBorder,
|
|
38
|
+
isCondensed = params.isCondensed;
|
|
39
|
+
const isDisabled = extraArgs.isDisabled,
|
|
40
|
+
hasOnlyIconVisible = extraArgs.hasOnlyIconVisible,
|
|
41
|
+
isEnabled = extraArgs.isEnabled;
|
|
42
|
+
const gapForSize = {
|
|
43
|
+
small: componentTheme.gapButtonContentSm,
|
|
44
|
+
medium: componentTheme.gapButtonContentMd,
|
|
45
|
+
large: componentTheme.gapButtonContentLg,
|
|
46
|
+
condensedSmall: componentTheme.gapButtonContentSm,
|
|
47
|
+
condensedMedium: componentTheme.gapButtonContentSm
|
|
48
|
+
};
|
|
49
|
+
const shapeVariants = {
|
|
50
|
+
circle: {
|
|
51
|
+
borderRadius: componentTheme.borderRadiusFull
|
|
52
|
+
},
|
|
53
|
+
rectangle: {}
|
|
54
|
+
};
|
|
55
|
+
const sizeVariants = {
|
|
56
|
+
small: {
|
|
57
|
+
content: {
|
|
58
|
+
fontSize: componentTheme.smallFontSize,
|
|
59
|
+
paddingLeft: componentTheme.smallPaddingHorizontal,
|
|
60
|
+
paddingRight: componentTheme.smallPaddingHorizontal,
|
|
61
|
+
minHeight: componentTheme.smallHeight,
|
|
62
|
+
...(hasOnlyIconVisible && {
|
|
63
|
+
paddingLeft: 0,
|
|
64
|
+
paddingRight: 0,
|
|
65
|
+
width: componentTheme.smallHeight
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
medium: {
|
|
70
|
+
content: {
|
|
71
|
+
fontSize: componentTheme.mediumFontSize,
|
|
72
|
+
paddingLeft: componentTheme.mediumPaddingHorizontal,
|
|
73
|
+
paddingRight: componentTheme.mediumPaddingHorizontal,
|
|
74
|
+
minHeight: componentTheme.mediumHeight,
|
|
75
|
+
...(hasOnlyIconVisible && {
|
|
76
|
+
paddingLeft: 0,
|
|
77
|
+
paddingRight: 0,
|
|
78
|
+
width: componentTheme.mediumHeight
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
large: {
|
|
83
|
+
content: {
|
|
84
|
+
fontSize: componentTheme.largeFontSize,
|
|
85
|
+
paddingLeft: componentTheme.largePaddingHorizontal,
|
|
86
|
+
paddingRight: componentTheme.largePaddingHorizontal,
|
|
87
|
+
minHeight: componentTheme.largeHeight,
|
|
88
|
+
...(hasOnlyIconVisible && {
|
|
89
|
+
paddingLeft: 0,
|
|
90
|
+
paddingRight: 0,
|
|
91
|
+
width: componentTheme.largeHeight
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
condensedSmall: {
|
|
96
|
+
content: {
|
|
97
|
+
fontSize: componentTheme.smallFontSize,
|
|
98
|
+
paddingLeft: componentTheme.smallPaddingHorizontal,
|
|
99
|
+
paddingRight: componentTheme.smallPaddingHorizontal,
|
|
100
|
+
height: componentTheme.heightXxs,
|
|
101
|
+
...(hasOnlyIconVisible && {
|
|
102
|
+
paddingLeft: 0,
|
|
103
|
+
paddingRight: 0,
|
|
104
|
+
width: componentTheme.heightXxs
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
condensedMedium: {
|
|
109
|
+
content: {
|
|
110
|
+
fontSize: componentTheme.smallFontSize,
|
|
111
|
+
paddingLeft: componentTheme.smallPaddingHorizontal,
|
|
112
|
+
paddingRight: componentTheme.smallPaddingHorizontal,
|
|
113
|
+
height: componentTheme.heightXs,
|
|
114
|
+
...(hasOnlyIconVisible && {
|
|
115
|
+
paddingLeft: 0,
|
|
116
|
+
paddingRight: 0,
|
|
117
|
+
width: componentTheme.heightXs
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const colorVariants = {
|
|
123
|
+
'ai-primary': {
|
|
124
|
+
default: {
|
|
125
|
+
color: componentTheme.aiBaseTextColor,
|
|
126
|
+
background: `
|
|
127
|
+
linear-gradient(to bottom, ${componentTheme.aiBackgroundTopGradientColor} 0%, ${componentTheme.aiBackgroundBottomGradientColor} 100%) padding-box,
|
|
128
|
+
linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) border-box`,
|
|
129
|
+
borderStyle: 'solid',
|
|
130
|
+
borderColor: 'transparent',
|
|
131
|
+
boxShadow: componentTheme.primaryBoxShadow
|
|
132
|
+
},
|
|
133
|
+
active: {
|
|
134
|
+
background: `
|
|
135
|
+
linear-gradient(to bottom, ${componentTheme.aiActiveBackgroundTopGradientColor} 0%, ${componentTheme.aiActiveBackgroundBottomGradientColor} 100%) padding-box,
|
|
136
|
+
linear-gradient(to bottom, ${componentTheme.aiActiveBorderTopGradientColor} 0%, ${componentTheme.aiActiveBorderBottomGradientColor} 100%) border-box`,
|
|
137
|
+
borderStyle: 'solid',
|
|
138
|
+
borderColor: 'transparent',
|
|
139
|
+
color: componentTheme.aiActiveTextColor
|
|
140
|
+
},
|
|
141
|
+
hover: {
|
|
142
|
+
background: `
|
|
143
|
+
linear-gradient(to bottom, ${componentTheme.aiHoverBackgroundTopGradientColor} 0%, ${componentTheme.aiHoverBackgroundBottomGradientColor} 100%) padding-box,
|
|
144
|
+
linear-gradient(to bottom, ${componentTheme.aiHoverBorderTopGradientColor} 0%, ${componentTheme.aiHoverBorderBottomGradientColor} 100%) border-box`,
|
|
145
|
+
borderStyle: 'solid',
|
|
146
|
+
borderColor: 'transparent',
|
|
147
|
+
color: componentTheme.aiHoverTextColor,
|
|
148
|
+
boxShadow: componentTheme.primaryHoverBoxShadow
|
|
149
|
+
},
|
|
150
|
+
disabled: {
|
|
151
|
+
background: componentTheme.aiDisabledBackgroundColor,
|
|
152
|
+
borderColor: componentTheme.aiDisabledBorderColor,
|
|
153
|
+
color: componentTheme.aiDisabledTextColor
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
'ai-secondary': {
|
|
157
|
+
default: {
|
|
158
|
+
boxShadow: componentTheme.primaryBoxShadow
|
|
159
|
+
},
|
|
160
|
+
active: {
|
|
161
|
+
background: `
|
|
162
|
+
linear-gradient(to bottom, ${componentTheme.aiSecondaryActiveBackgroundTopGradientColor} 0%, ${componentTheme.aiSecondaryActiveBackgroundBottomGradientColor} 100%)`
|
|
163
|
+
},
|
|
164
|
+
hover: {
|
|
165
|
+
background: `
|
|
166
|
+
linear-gradient(to bottom, ${componentTheme.aiSecondaryHoverBackgroundTopGradientColor} 0%, ${componentTheme.aiSecondaryHoverBackgroundBottomGradientColor} 100%)`
|
|
167
|
+
},
|
|
168
|
+
disabled: {
|
|
169
|
+
borderColor: componentTheme.aiSecondaryDisabledBorderColor,
|
|
170
|
+
color: componentTheme.aiSecondaryDisabledTextColor
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
primary: withBackground ? {
|
|
174
|
+
default: {
|
|
175
|
+
color: componentTheme.primaryColor,
|
|
176
|
+
background: componentTheme.primaryBackground,
|
|
177
|
+
borderColor: componentTheme.primaryBorderColor,
|
|
178
|
+
boxShadow: componentTheme.primaryBoxShadow
|
|
179
|
+
},
|
|
180
|
+
active: {
|
|
181
|
+
background: componentTheme.primaryActiveBackground,
|
|
182
|
+
color: componentTheme.primaryActiveTextColor,
|
|
183
|
+
borderColor: componentTheme.primaryActiveBorderColor
|
|
184
|
+
},
|
|
185
|
+
hover: {
|
|
186
|
+
background: componentTheme.primaryHoverBackground,
|
|
187
|
+
boxShadow: componentTheme.primaryHoverBoxShadow,
|
|
188
|
+
color: componentTheme.primaryHoverTextColor,
|
|
189
|
+
borderColor: componentTheme.primaryHoverBorderColor
|
|
190
|
+
},
|
|
191
|
+
disabled: {
|
|
192
|
+
background: componentTheme.primaryDisabledBackgroundColor,
|
|
193
|
+
borderColor: componentTheme.primaryDisabledBorderColor,
|
|
194
|
+
color: componentTheme.primaryDisabledTextColor
|
|
195
|
+
}
|
|
196
|
+
} : {
|
|
197
|
+
default: {
|
|
198
|
+
color: componentTheme.primaryGhostColor,
|
|
199
|
+
borderColor: componentTheme.primaryGhostBorderColor,
|
|
200
|
+
background: componentTheme.primaryGhostBackground,
|
|
201
|
+
boxShadow: componentTheme.primaryBoxShadow
|
|
202
|
+
},
|
|
203
|
+
active: {
|
|
204
|
+
background: componentTheme.primaryGhostActiveBackground,
|
|
205
|
+
color: componentTheme.tertiaryActiveTextColor,
|
|
206
|
+
borderColor: componentTheme.tertiaryActiveBorderColor
|
|
207
|
+
},
|
|
208
|
+
hover: {
|
|
209
|
+
background: componentTheme.primaryGhostHoverBackground,
|
|
210
|
+
boxShadow: componentTheme.primaryHoverBoxShadow,
|
|
211
|
+
color: componentTheme.tertiaryHoverTextColor,
|
|
212
|
+
borderColor: componentTheme.tertiaryHoverBorderColor
|
|
213
|
+
},
|
|
214
|
+
disabled: {
|
|
215
|
+
background: 'transparent',
|
|
216
|
+
borderColor: componentTheme.tertiaryDisabledBorderColor,
|
|
217
|
+
color: componentTheme.tertiaryDisabledTextColor
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
secondary: withBackground ? {
|
|
221
|
+
default: {
|
|
222
|
+
color: componentTheme.secondaryColor,
|
|
223
|
+
background: componentTheme.secondaryBackground,
|
|
224
|
+
borderColor: componentTheme.secondaryBorderColor,
|
|
225
|
+
boxShadow: componentTheme.secondaryBoxShadow
|
|
226
|
+
},
|
|
227
|
+
active: {
|
|
228
|
+
background: componentTheme.secondaryActiveBackground,
|
|
229
|
+
color: componentTheme.secondaryActiveTextColor,
|
|
230
|
+
borderColor: componentTheme.secondaryActiveBorderColor
|
|
231
|
+
},
|
|
232
|
+
hover: {
|
|
233
|
+
background: componentTheme.secondaryHoverBackground,
|
|
234
|
+
boxShadow: componentTheme.secondaryHoverBoxShadow,
|
|
235
|
+
color: componentTheme.secondaryHoverTextColor,
|
|
236
|
+
borderColor: componentTheme.secondaryHoverBorderColor
|
|
237
|
+
},
|
|
238
|
+
disabled: {
|
|
239
|
+
background: componentTheme.secondaryDisabledBackgroundColor,
|
|
240
|
+
borderColor: componentTheme.secondaryDisabledBorderColor,
|
|
241
|
+
color: componentTheme.secondaryDisabledTextColor
|
|
242
|
+
}
|
|
243
|
+
} : {
|
|
244
|
+
default: {
|
|
245
|
+
color: componentTheme.secondaryGhostColor,
|
|
246
|
+
borderColor: componentTheme.secondaryGhostBorderColor,
|
|
247
|
+
background: componentTheme.secondaryGhostBackground,
|
|
248
|
+
boxShadow: componentTheme.secondaryGhostBoxShadow
|
|
249
|
+
},
|
|
250
|
+
active: {
|
|
251
|
+
background: componentTheme.secondaryGhostActiveBackground
|
|
252
|
+
},
|
|
253
|
+
hover: {
|
|
254
|
+
background: componentTheme.secondaryGhostHoverBackground,
|
|
255
|
+
boxShadow: componentTheme.secondaryGhostHoverBoxShadow
|
|
256
|
+
},
|
|
257
|
+
disabled: {
|
|
258
|
+
background: 'transparent'
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
'primary-inverse': withBackground ? {
|
|
262
|
+
default: {
|
|
263
|
+
color: componentTheme.primaryInverseColor,
|
|
264
|
+
background: componentTheme.primaryInverseBackground,
|
|
265
|
+
borderColor: componentTheme.primaryInverseBorderColor,
|
|
266
|
+
boxShadow: componentTheme.primaryInverseBoxShadow
|
|
267
|
+
},
|
|
268
|
+
active: {
|
|
269
|
+
background: componentTheme.primaryInverseActiveBackground,
|
|
270
|
+
color: componentTheme.primaryOnColorActiveTextColor,
|
|
271
|
+
borderColor: componentTheme.primaryOnColorActiveBorderColor
|
|
272
|
+
},
|
|
273
|
+
hover: {
|
|
274
|
+
background: componentTheme.primaryInverseHoverBackground,
|
|
275
|
+
boxShadow: componentTheme.primaryInverseHoverBoxShadow,
|
|
276
|
+
color: componentTheme.primaryOnColorHoverTextColor,
|
|
277
|
+
borderColor: componentTheme.primaryOnColorHoverBorderColor
|
|
278
|
+
},
|
|
279
|
+
disabled: {
|
|
280
|
+
background: componentTheme.primaryOnColorDisabledBackgroundColor,
|
|
281
|
+
borderColor: componentTheme.primaryOnColorDisabledBorderColor,
|
|
282
|
+
color: componentTheme.primaryOnColorDisabledTextColor
|
|
283
|
+
}
|
|
284
|
+
} : {
|
|
285
|
+
default: {
|
|
286
|
+
color: componentTheme.primaryInverseGhostColor,
|
|
287
|
+
borderColor: componentTheme.primaryInverseGhostBorderColor,
|
|
288
|
+
background: componentTheme.primaryInverseGhostBackground,
|
|
289
|
+
boxShadow: componentTheme.primaryInverseGhostBoxShadow
|
|
290
|
+
},
|
|
291
|
+
active: {
|
|
292
|
+
background: componentTheme.primaryInverseGhostActiveBackground,
|
|
293
|
+
color: componentTheme.secondaryOnColorActiveTextColor,
|
|
294
|
+
borderColor: componentTheme.secondaryOnColorActiveBorderColor
|
|
295
|
+
},
|
|
296
|
+
hover: {
|
|
297
|
+
background: componentTheme.primaryInverseGhostHoverBackground,
|
|
298
|
+
boxShadow: componentTheme.primaryInverseGhostHoverBoxShadow,
|
|
299
|
+
color: componentTheme.secondaryOnColorHoverTextColor,
|
|
300
|
+
borderColor: componentTheme.secondaryOnColorHoverBorderColor
|
|
301
|
+
},
|
|
302
|
+
disabled: {
|
|
303
|
+
background: 'transparent',
|
|
304
|
+
borderColor: componentTheme.secondaryOnColorDisabledBorderColor,
|
|
305
|
+
color: componentTheme.secondaryOnColorDisabledTextColor
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
success: withBackground ? {
|
|
309
|
+
default: {
|
|
310
|
+
color: componentTheme.successColor,
|
|
311
|
+
background: componentTheme.successBackground,
|
|
312
|
+
borderColor: componentTheme.successBorderColor,
|
|
313
|
+
boxShadow: componentTheme.successBoxShadow
|
|
314
|
+
},
|
|
315
|
+
active: {
|
|
316
|
+
background: componentTheme.successActiveBackground,
|
|
317
|
+
color: componentTheme.successActiveTextColor,
|
|
318
|
+
borderColor: componentTheme.successActiveBorderColor
|
|
319
|
+
},
|
|
320
|
+
hover: {
|
|
321
|
+
background: componentTheme.successHoverBackground,
|
|
322
|
+
boxShadow: componentTheme.successHoverBoxShadow,
|
|
323
|
+
color: componentTheme.successHoverTextColor,
|
|
324
|
+
borderColor: componentTheme.successHoverBorderColor
|
|
325
|
+
},
|
|
326
|
+
disabled: {
|
|
327
|
+
background: componentTheme.successDisabledBackgroundColor,
|
|
328
|
+
borderColor: componentTheme.successDisabledBorderColor,
|
|
329
|
+
color: componentTheme.successDisabledTextColor
|
|
330
|
+
}
|
|
331
|
+
} : {
|
|
332
|
+
default: {
|
|
333
|
+
color: componentTheme.successGhostColor,
|
|
334
|
+
borderColor: componentTheme.successGhostBorderColor,
|
|
335
|
+
background: componentTheme.successGhostBackground,
|
|
336
|
+
boxShadow: componentTheme.successGhostBoxShadow
|
|
337
|
+
},
|
|
338
|
+
active: {
|
|
339
|
+
background: componentTheme.successGhostActiveBackground,
|
|
340
|
+
color: componentTheme.successSecondaryActiveTextColor,
|
|
341
|
+
borderColor: componentTheme.successSecondaryActiveBorderColor
|
|
342
|
+
},
|
|
343
|
+
hover: {
|
|
344
|
+
background: componentTheme.successGhostHoverBackground,
|
|
345
|
+
boxShadow: componentTheme.successGhostHoverBoxShadow,
|
|
346
|
+
color: componentTheme.successSecondaryHoverTextColor,
|
|
347
|
+
borderColor: componentTheme.successSecondaryHoverBorderColor
|
|
348
|
+
},
|
|
349
|
+
disabled: {
|
|
350
|
+
background: 'transparent',
|
|
351
|
+
borderColor: componentTheme.successSecondaryDisabledBorderColor,
|
|
352
|
+
color: componentTheme.successSecondaryDisabledTextColor
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
danger: withBackground ? {
|
|
356
|
+
default: {
|
|
357
|
+
color: componentTheme.dangerColor,
|
|
358
|
+
background: componentTheme.dangerBackground,
|
|
359
|
+
borderColor: componentTheme.dangerBorderColor,
|
|
360
|
+
boxShadow: componentTheme.dangerBoxShadow
|
|
361
|
+
},
|
|
362
|
+
active: {
|
|
363
|
+
background: componentTheme.dangerActiveBackground,
|
|
364
|
+
color: componentTheme.destructiveActiveTextColor,
|
|
365
|
+
borderColor: componentTheme.destructiveActiveBorderColor
|
|
366
|
+
},
|
|
367
|
+
hover: {
|
|
368
|
+
background: componentTheme.dangerHoverBackground,
|
|
369
|
+
boxShadow: componentTheme.dangerHoverBoxShadow,
|
|
370
|
+
color: componentTheme.destructiveHoverTextColor,
|
|
371
|
+
borderColor: componentTheme.destructiveHoverBorderColor
|
|
372
|
+
},
|
|
373
|
+
disabled: {
|
|
374
|
+
background: componentTheme.destructiveDisabledBackgroundColor,
|
|
375
|
+
borderColor: componentTheme.destructiveDisabledBorderColor,
|
|
376
|
+
color: componentTheme.destructiveDisabledTextColor
|
|
377
|
+
}
|
|
378
|
+
} : {
|
|
379
|
+
default: {
|
|
380
|
+
color: componentTheme.dangerGhostColor,
|
|
381
|
+
borderColor: componentTheme.dangerGhostBorderColor,
|
|
382
|
+
background: componentTheme.dangerGhostBackground,
|
|
383
|
+
boxShadow: componentTheme.dangerGhostBoxShadow
|
|
384
|
+
},
|
|
385
|
+
active: {
|
|
386
|
+
background: componentTheme.dangerGhostActiveBackground,
|
|
387
|
+
color: componentTheme.destructiveSecondaryActiveTextColor,
|
|
388
|
+
borderColor: componentTheme.destructiveSecondaryActiveBorderColor
|
|
389
|
+
},
|
|
390
|
+
hover: {
|
|
391
|
+
background: componentTheme.dangerGhostHoverBackground,
|
|
392
|
+
boxShadow: componentTheme.dangerGhostHoverBoxShadow,
|
|
393
|
+
color: componentTheme.destructiveSecondaryHoverTextColor,
|
|
394
|
+
borderColor: componentTheme.destructiveSecondaryHoverBorderColor
|
|
395
|
+
},
|
|
396
|
+
disabled: {
|
|
397
|
+
background: 'transparent',
|
|
398
|
+
borderColor: componentTheme.destructiveSecondaryDisabledBorderColor,
|
|
399
|
+
color: componentTheme.destructiveSecondaryDisabledTextColor
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
return {
|
|
404
|
+
baseButton: isEnabled ? {
|
|
405
|
+
label: 'baseButton',
|
|
406
|
+
appearance: 'none',
|
|
407
|
+
textDecoration: 'none' /* for links styled as buttons */,
|
|
408
|
+
touchAction: 'manipulation',
|
|
409
|
+
// This sets the focus ring's border radius displayed by the `View`
|
|
410
|
+
borderRadius: size === 'condensedSmall' || size === 'condensedMedium' ? componentTheme.borderRadiusSm : componentTheme.borderRadius,
|
|
411
|
+
...shapeVariants[shape],
|
|
412
|
+
// Prevents vertical stretching in flex parents with fixed height
|
|
413
|
+
// Avoids background/focus ring distortion
|
|
414
|
+
height: 'fit-content',
|
|
415
|
+
'&::-moz-focus-inner': {
|
|
416
|
+
border: '0' /* removes default dotted focus outline in Firefox */
|
|
417
|
+
},
|
|
418
|
+
'*': {
|
|
419
|
+
pointerEvents: 'none' /* Ensures that button or link is always the event target */
|
|
420
|
+
},
|
|
421
|
+
'&:focus': {
|
|
422
|
+
textDecoration: 'none'
|
|
423
|
+
},
|
|
424
|
+
'&:hover > [class$=-baseButton__content]': colorVariants[color].hover,
|
|
425
|
+
'&:active > [class$=-baseButton__content]': colorVariants[color].active,
|
|
426
|
+
//TODO not the greatest solution. Must be stronger than the same &&& enforcement of <View>
|
|
427
|
+
...(color === 'ai-secondary' ? {
|
|
428
|
+
'&&&&&&&&&&': {
|
|
429
|
+
padding: componentTheme.borderWidth,
|
|
430
|
+
...(shape !== 'circle' ? {
|
|
431
|
+
borderRadius: `calc(${componentTheme.borderRadius} + ${componentTheme.borderWidth})`
|
|
432
|
+
} : {
|
|
433
|
+
borderRadius: componentTheme.borderRadiusFull
|
|
434
|
+
}),
|
|
435
|
+
'&::before': {
|
|
436
|
+
content: '""',
|
|
437
|
+
position: 'absolute',
|
|
438
|
+
inset: '0',
|
|
439
|
+
borderRadius: 'inherit',
|
|
440
|
+
padding: componentTheme.borderWidth,
|
|
441
|
+
background: `linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%)`,
|
|
442
|
+
WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
|
|
443
|
+
WebkitMaskComposite: 'xor',
|
|
444
|
+
mask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
|
|
445
|
+
maskComposite: 'exclude',
|
|
446
|
+
pointerEvents: 'none'
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
} : {})
|
|
450
|
+
} : {
|
|
451
|
+
textDecoration: 'none',
|
|
452
|
+
label: 'baseButton',
|
|
453
|
+
appearance: 'none'
|
|
454
|
+
},
|
|
455
|
+
content: {
|
|
456
|
+
label: 'baseButton__content',
|
|
457
|
+
opacity: componentTheme.opacityBase,
|
|
458
|
+
boxSizing: 'border-box',
|
|
459
|
+
width: '100%',
|
|
460
|
+
display: 'flex',
|
|
461
|
+
alignItems: 'center',
|
|
462
|
+
direction: 'inherit',
|
|
463
|
+
userSelect: 'none',
|
|
464
|
+
transition: 'background 0.2s, transform 0.2s',
|
|
465
|
+
transform: componentTheme.transform,
|
|
466
|
+
fontFamily: componentTheme.fontFamily,
|
|
467
|
+
fontWeight: componentTheme.fontWeight,
|
|
468
|
+
textTransform: componentTheme.textTransform,
|
|
469
|
+
letterSpacing: componentTheme.letterSpacing,
|
|
470
|
+
borderStyle: componentTheme.borderStyle,
|
|
471
|
+
borderWidth: componentTheme.borderWidth,
|
|
472
|
+
borderRadius: componentTheme.borderRadius,
|
|
473
|
+
lineHeight: componentTheme.lineHeight,
|
|
474
|
+
textAlign,
|
|
475
|
+
'&:hover': {
|
|
476
|
+
transform: componentTheme.hoverTransform
|
|
477
|
+
},
|
|
478
|
+
...(color === 'ai-secondary' ? {
|
|
479
|
+
border: 'none',
|
|
480
|
+
background: 'transparent',
|
|
481
|
+
transition: 'none'
|
|
482
|
+
} : {}),
|
|
483
|
+
paddingTop: componentTheme.paddingVertical,
|
|
484
|
+
paddingBottom: componentTheme.paddingVertical,
|
|
485
|
+
...sizeVariants[size].content,
|
|
486
|
+
...colorVariants[color].default,
|
|
487
|
+
...shapeVariants[shape],
|
|
488
|
+
...(isCondensed && {
|
|
489
|
+
paddingLeft: 0,
|
|
490
|
+
paddingRight: 0,
|
|
491
|
+
paddingTop: 0,
|
|
492
|
+
paddingBottom: 0,
|
|
493
|
+
minHeight: 'fit-content'
|
|
494
|
+
}),
|
|
495
|
+
...((size === 'condensedSmall' || size === 'condensedMedium') && {
|
|
496
|
+
background: 'transparent',
|
|
497
|
+
borderStyle: 'none',
|
|
498
|
+
borderRadius: componentTheme.borderRadiusSm,
|
|
499
|
+
paddingTop: 0,
|
|
500
|
+
paddingBottom: 0
|
|
501
|
+
}),
|
|
502
|
+
...(isDisabled && {
|
|
503
|
+
...colorVariants[color].disabled,
|
|
504
|
+
opacity: componentTheme.opacityDisabled
|
|
505
|
+
}),
|
|
506
|
+
...(hasOnlyIconVisible && {
|
|
507
|
+
lineHeight: 1
|
|
508
|
+
}),
|
|
509
|
+
...(!withBorder && {
|
|
510
|
+
borderStyle: 'none'
|
|
511
|
+
})
|
|
512
|
+
},
|
|
513
|
+
children: {
|
|
514
|
+
label: 'baseButton__children',
|
|
515
|
+
display: 'block',
|
|
516
|
+
minWidth: 0,
|
|
517
|
+
...(isCondensed && {
|
|
518
|
+
paddingTop: 0,
|
|
519
|
+
paddingBottom: 0
|
|
520
|
+
}),
|
|
521
|
+
...(color === 'ai-secondary' ? {
|
|
522
|
+
...(isDisabled ? {
|
|
523
|
+
color: componentTheme.aiSecondaryDisabledTextColor
|
|
524
|
+
} : {
|
|
525
|
+
background: `
|
|
526
|
+
linear-gradient(to bottom, ${componentTheme.aiSecondaryTextTopGradientColor} 0%, ${componentTheme.aiSecondaryTextBottomGradientColor} 100%)`,
|
|
527
|
+
backgroundClip: 'text',
|
|
528
|
+
color: 'transparent'
|
|
529
|
+
})
|
|
530
|
+
} : {})
|
|
531
|
+
},
|
|
532
|
+
iconSVG: {
|
|
533
|
+
label: 'baseButton__iconSVG',
|
|
534
|
+
display: 'flex',
|
|
535
|
+
alignItems: 'center'
|
|
536
|
+
},
|
|
537
|
+
childrenLayout: {
|
|
538
|
+
label: 'baseButton__childrenLayout',
|
|
539
|
+
display: 'flex',
|
|
540
|
+
height: '100%',
|
|
541
|
+
width: '100%',
|
|
542
|
+
justifyContent: hasOnlyIconVisible || textAlign === 'center' ? 'center' : 'flex-start',
|
|
543
|
+
boxSizing: 'border-box',
|
|
544
|
+
alignItems: 'center',
|
|
545
|
+
flexDirection: 'row',
|
|
546
|
+
maxWidth: '100%',
|
|
547
|
+
overflowX: 'visible',
|
|
548
|
+
overflowY: 'visible',
|
|
549
|
+
unicodeBidi: 'isolate'
|
|
550
|
+
},
|
|
551
|
+
iconOnly: {
|
|
552
|
+
label: 'baseButton__iconOnly',
|
|
553
|
+
boxSizing: 'border-box',
|
|
554
|
+
minWidth: '0.0625rem',
|
|
555
|
+
flexShrink: 0,
|
|
556
|
+
maxWidth: '100%',
|
|
557
|
+
overflowX: 'visible',
|
|
558
|
+
overflowY: 'visible',
|
|
559
|
+
unicodeBidi: 'isolate'
|
|
560
|
+
},
|
|
561
|
+
iconWrapper: {
|
|
562
|
+
label: 'baseButton__iconWrapper',
|
|
563
|
+
boxSizing: 'border-box',
|
|
564
|
+
minWidth: '0.0625rem',
|
|
565
|
+
paddingInlineEnd: gapForSize[size],
|
|
566
|
+
flexShrink: 0,
|
|
567
|
+
maxWidth: '100%',
|
|
568
|
+
overflowX: 'visible',
|
|
569
|
+
overflowY: 'visible',
|
|
570
|
+
unicodeBidi: 'isolate'
|
|
571
|
+
},
|
|
572
|
+
childrenWrapper: {
|
|
573
|
+
label: 'baseButton__childrenWrapper',
|
|
574
|
+
boxSizing: 'border-box',
|
|
575
|
+
minWidth: '0.0625rem',
|
|
576
|
+
flexShrink: 1,
|
|
577
|
+
maxWidth: '100%',
|
|
578
|
+
overflowX: 'visible',
|
|
579
|
+
overflowY: 'visible',
|
|
580
|
+
unicodeBidi: 'isolate'
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
var _default = exports.default = generateStyle;
|