@startupjs-ui/button 0.3.1 → 0.3.5
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 +16 -0
- package/README.mdx +8 -0
- package/index.cssx.styl +3 -0
- package/index.tsx +15 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.5](https://github.com/startupjs/startupjs-ui/compare/v0.3.4...v0.3.5) (2026-06-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/button
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.3.4](https://github.com/startupjs/startupjs-ui/compare/v0.3.3...v0.3.4) (2026-06-18)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @startupjs-ui/button
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.3.1](https://github.com/startupjs/startupjs-ui/compare/v0.3.0...v0.3.1) (2026-06-08)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @startupjs-ui/button
|
package/README.mdx
CHANGED
|
@@ -173,6 +173,14 @@ You can fine-tune the button's appearance using style props:
|
|
|
173
173
|
- **hoverStyle** -- custom styles applied on hover
|
|
174
174
|
- **activeStyle** -- custom styles applied when pressed
|
|
175
175
|
|
|
176
|
+
## Theme configuration
|
|
177
|
+
|
|
178
|
+
Button also exposes CSSX theme configuration for app-wide visual tuning:
|
|
179
|
+
|
|
180
|
+
- **$UI.Button.outlinedBorderColor** -- override the border color used by the `outlined` variant. By default the border uses the button color with opacity.
|
|
181
|
+
- **$UI.Button.useBgColorForFlat** -- when enabled, the `flat` variant first tries `bg-${color}` before falling back to the regular color token.
|
|
182
|
+
- **$UI.Button.webNativeButton** -- controls whether the web root renders with native button semantics. It is enabled by default.
|
|
183
|
+
|
|
176
184
|
## Call to Action
|
|
177
185
|
|
|
178
186
|
Try to keep the variety of button combinations you use in your app to a minimum.
|
package/index.cssx.styl
CHANGED
package/index.tsx
CHANGED
|
@@ -10,10 +10,19 @@ import STYLES from './index.cssx.styl'
|
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
config: {
|
|
13
|
-
heights,
|
|
13
|
+
heights,
|
|
14
|
+
outlinedBorderWidth,
|
|
15
|
+
outlinedBorderColor,
|
|
16
|
+
useBgColorForFlat,
|
|
17
|
+
webNativeButton,
|
|
18
|
+
iconMargins
|
|
14
19
|
}
|
|
15
20
|
} = STYLES
|
|
16
21
|
|
|
22
|
+
function isConfigEnabled (value: unknown): boolean {
|
|
23
|
+
return value !== false && value !== 0 && value !== '0'
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
export default observer(themed('Button', Button))
|
|
18
27
|
|
|
19
28
|
export const _PropsJsonSchema = {/* ButtonProps */} // used in docs generation
|
|
@@ -98,6 +107,8 @@ function Button ({
|
|
|
98
107
|
if (!getColor(color)) console.error('Button component: Color for color property is incorrect. Use colors from Colors')
|
|
99
108
|
|
|
100
109
|
const isFlat = variant === 'flat'
|
|
110
|
+
const shouldUseBgColorForFlat = isConfigEnabled(useBgColorForFlat)
|
|
111
|
+
const shouldUseWebNativeButton = isConfigEnabled(webNativeButton)
|
|
101
112
|
const _color = getColor(color) as string | undefined
|
|
102
113
|
const textColor = isFlat ? getFlatTextColorName() : color
|
|
103
114
|
const _textColor = getColor(textColor) as string | undefined
|
|
@@ -121,11 +132,11 @@ function Button ({
|
|
|
121
132
|
|
|
122
133
|
switch (variant) {
|
|
123
134
|
case 'flat':
|
|
124
|
-
rootStyle.backgroundColor = _color
|
|
135
|
+
rootStyle.backgroundColor = (shouldUseBgColorForFlat ? getColor(`bg-${color}`) : null) || _color
|
|
125
136
|
break
|
|
126
137
|
case 'outlined':
|
|
127
138
|
rootStyle.borderWidth = outlinedBorderWidth
|
|
128
|
-
rootStyle.borderColor = colorToRGBA(_colorString, 0.5)
|
|
139
|
+
rootStyle.borderColor = outlinedBorderColor || colorToRGBA(_colorString, 0.5)
|
|
129
140
|
extraHoverStyle = { backgroundColor: colorToRGBA(_colorString, 0.05) }
|
|
130
141
|
extraActiveStyle = { backgroundColor: colorToRGBA(_colorString, 0.25) }
|
|
131
142
|
break
|
|
@@ -163,7 +174,7 @@ function Button ({
|
|
|
163
174
|
return pug`
|
|
164
175
|
Div.root(
|
|
165
176
|
row
|
|
166
|
-
_webNativeButton
|
|
177
|
+
_webNativeButton=shouldUseWebNativeButton
|
|
167
178
|
shape=shape
|
|
168
179
|
style=[rootStyle, style]
|
|
169
180
|
styleName=[
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/button",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@startupjs-ui/core": "^0.3.0",
|
|
12
|
-
"@startupjs-ui/div": "^0.3.
|
|
13
|
-
"@startupjs-ui/icon": "^0.3.
|
|
12
|
+
"@startupjs-ui/div": "^0.3.4",
|
|
13
|
+
"@startupjs-ui/icon": "^0.3.5",
|
|
14
14
|
"@startupjs-ui/loader": "^0.3.0",
|
|
15
|
-
"@startupjs-ui/span": "^0.3.
|
|
15
|
+
"@startupjs-ui/span": "^0.3.4"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*",
|
|
19
19
|
"react-native": "*",
|
|
20
20
|
"startupjs": "*"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "8fc799070c16fb24de4ad0dbd6054108fe342d7c"
|
|
23
23
|
}
|