@oxy.so/bloom 7.14.1 → 7.14.3
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/docs/adoption-matrix.mdx +2 -2
- package/docs/button.mdx +48 -0
- package/docs/stepper.mdx +3 -2
- package/lib/commonjs/button/Button.js +129 -65
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/button/Button.web.js +47 -19
- package/lib/commonjs/button/Button.web.js.map +1 -1
- package/lib/commonjs/stepper/Stepper.js +3 -1
- package/lib/commonjs/stepper/Stepper.js.map +1 -1
- package/lib/module/button/Button.js +130 -66
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/button/Button.web.js +47 -19
- package/lib/module/button/Button.web.js.map +1 -1
- package/lib/module/stepper/Stepper.js +3 -1
- package/lib/module/stepper/Stepper.js.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/module/stepper/Stepper.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/button/Button.tsx +95 -71
- package/src/button/Button.web.tsx +34 -19
- package/src/stepper/Stepper.tsx +3 -1
|
@@ -62,10 +62,18 @@ const DISABLED = '.bloom-btn:disabled:not([aria-busy="true"]),\n.bloom-btn[aria-
|
|
|
62
62
|
* applies none of them, so a modifier class alone proves nothing about whether
|
|
63
63
|
* an underline is drawn.
|
|
64
64
|
*/
|
|
65
|
-
export const BLOOM_BUTTON_CSS = interactiveWebCss({
|
|
65
|
+
export const BLOOM_BUTTON_CSS = `@layer base {\n${interactiveWebCss({
|
|
66
66
|
selector: '.bloom-btn',
|
|
67
67
|
varPrefix: 'bloom-btn',
|
|
68
68
|
base: `
|
|
69
|
+
height: var(--bloom-btn-height);
|
|
70
|
+
width: var(--bloom-btn-width, auto);
|
|
71
|
+
padding-inline: var(--bloom-btn-padding);
|
|
72
|
+
border-radius: var(--bloom-btn-radius);
|
|
73
|
+
font-size: var(--bloom-btn-font-size);
|
|
74
|
+
line-height: var(--bloom-btn-line-height);
|
|
75
|
+
font-weight: var(--bloom-btn-font-weight);
|
|
76
|
+
letter-spacing: var(--bloom-btn-letter-spacing, normal);
|
|
69
77
|
flex-direction: row;
|
|
70
78
|
gap: var(--bloom-btn-gap, 2px);
|
|
71
79
|
position: relative;
|
|
@@ -134,7 +142,7 @@ ${surfaceMaterialCss('.bloom-btn--surface', 'var(--bloom-btn-bg)', `background-c
|
|
|
134
142
|
transition: none;
|
|
135
143
|
}
|
|
136
144
|
}`,
|
|
137
|
-
})
|
|
145
|
+
})}\n}`;
|
|
138
146
|
|
|
139
147
|
// ---------------------------------------------------------------------------
|
|
140
148
|
// Component
|
|
@@ -223,14 +231,13 @@ const ButtonWebComponent = forwardRef<View, ButtonProps>(function ButtonWebCompo
|
|
|
223
231
|
const containerStyle = useMemo((): CSSProperties => {
|
|
224
232
|
const shadow = palette.shadow ? BUTTON_SHADOW[theme.isDark ? 'dark' : 'light'] : 'none';
|
|
225
233
|
const base: CSSProperties = {
|
|
226
|
-
height: geometry.height
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
letterSpacing: geometry.letterSpacing || undefined,
|
|
234
|
+
['--bloom-btn-height' as string]: `${geometry.height}px`,
|
|
235
|
+
['--bloom-btn-padding' as string]: `${geometry.paddingHorizontal}px`,
|
|
236
|
+
['--bloom-btn-radius' as string]: `${BUTTON_RADIUS}px`,
|
|
237
|
+
['--bloom-btn-font-size' as string]: `${geometry.fontSize}px`,
|
|
238
|
+
['--bloom-btn-line-height' as string]: `${geometry.lineHeight}px`,
|
|
239
|
+
['--bloom-btn-font-weight' as string]: geometry.fontWeight,
|
|
240
|
+
['--bloom-btn-letter-spacing' as string]: geometry.letterSpacing ? `${geometry.letterSpacing}px` : 'normal',
|
|
234
241
|
// CSS custom props consumed by the static stylesheet — see its header.
|
|
235
242
|
['--bloom-surface-rim' as string]: resolveSurfaceOptics(theme.isDark).rim,
|
|
236
243
|
['--bloom-surface-sheen' as string]: resolveSurfaceOptics(theme.isDark).sheenCss,
|
|
@@ -254,22 +261,30 @@ const ButtonWebComponent = forwardRef<View, ButtonProps>(function ButtonWebCompo
|
|
|
254
261
|
['--bloom-btn-border-active' as string]: palette.active.border,
|
|
255
262
|
['--bloom-btn-border-disabled' as string]: palette.disabled.border,
|
|
256
263
|
};
|
|
264
|
+
// Keep the existing inline defaults for callers without utilities. When
|
|
265
|
+
// classes are present, the same defaults come from the base layer.
|
|
266
|
+
if (!className) Object.assign(base, {
|
|
267
|
+
height: geometry.height, paddingLeft: geometry.paddingHorizontal,
|
|
268
|
+
paddingRight: geometry.paddingHorizontal, borderRadius: BUTTON_RADIUS,
|
|
269
|
+
fontSize: geometry.fontSize, lineHeight: `${geometry.lineHeight}px`,
|
|
270
|
+
fontWeight: Number(geometry.fontWeight), letterSpacing: geometry.letterSpacing || undefined,
|
|
271
|
+
});
|
|
257
272
|
if (isSquare) {
|
|
258
|
-
base
|
|
259
|
-
base
|
|
260
|
-
base
|
|
273
|
+
if (!className) Object.assign(base, { width: geometry.height, paddingLeft: 0, paddingRight: 0 });
|
|
274
|
+
(base as Record<string, unknown>)['--bloom-btn-width'] = `${geometry.height}px`;
|
|
275
|
+
(base as Record<string, unknown>)['--bloom-btn-padding'] = '0px';
|
|
261
276
|
}
|
|
262
277
|
if (isLink && !isSquare) {
|
|
263
278
|
// LinkButton: no container at all — the label's own line box,
|
|
264
279
|
// a 4px gap, and a 4px corner that only the focus ring shows.
|
|
265
|
-
base
|
|
266
|
-
base
|
|
267
|
-
base
|
|
268
|
-
base
|
|
280
|
+
if (!className) Object.assign(base, { height: undefined, paddingLeft: 0, paddingRight: 0, borderRadius: 4 });
|
|
281
|
+
(base as Record<string, unknown>)['--bloom-btn-height'] = 'auto';
|
|
282
|
+
(base as Record<string, unknown>)['--bloom-btn-padding'] = '0px';
|
|
283
|
+
(base as Record<string, unknown>)['--bloom-btn-radius'] = '4px';
|
|
269
284
|
(base as Record<string, unknown>)['--bloom-btn-gap'] = `${LINK_BUTTON_GAP}px`;
|
|
270
285
|
}
|
|
271
286
|
return base;
|
|
272
|
-
}, [geometry, palette, theme.isDark, isSquare, isIconVariant, isLink, togglePressed, loading]);
|
|
287
|
+
}, [geometry, palette, theme.isDark, isSquare, isIconVariant, isLink, togglePressed, loading, className]);
|
|
273
288
|
|
|
274
289
|
const handleClick = useCallback(
|
|
275
290
|
(event: MouseEvent<HTMLElement>) => {
|
|
@@ -293,7 +308,7 @@ const ButtonWebComponent = forwardRef<View, ButtonProps>(function ButtonWebCompo
|
|
|
293
308
|
.join(' ');
|
|
294
309
|
|
|
295
310
|
const spinnerColor =
|
|
296
|
-
loadingColor ??
|
|
311
|
+
loadingColor ?? 'currentColor';
|
|
297
312
|
|
|
298
313
|
// Normalize the caller's `style` (single object, StyleProp array, or falsy)
|
|
299
314
|
// into ONE flat plain object here, once, so neither raw-DOM merge site below
|
package/src/stepper/Stepper.tsx
CHANGED
|
@@ -233,7 +233,9 @@ function StepperComponent({
|
|
|
233
233
|
: {};
|
|
234
234
|
|
|
235
235
|
const valueStyle: WebCssStyle = {
|
|
236
|
-
|
|
236
|
+
// Reserve the value slot from the control's body size, independently of
|
|
237
|
+
// its smaller digit typography. Otherwise the capsule becomes too narrow.
|
|
238
|
+
minWidth: outlined ? (size === 'sm' ? 14 : 16) * 2.8 : config.valueWidth,
|
|
237
239
|
height: outlined ? 22 : config.height,
|
|
238
240
|
paddingLeft: 2,
|
|
239
241
|
paddingRight: 2,
|