MCPcopy Create free account
hub / github.com/adobe/react-spectrum / bar

Function bar

packages/@react-spectrum/s2/src/bar-utils.ts:16–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14import {controlSize, fieldInput, staticColor} from './style-utils' with {type: 'macro'};
15
16export const bar = () =>
17 ({
18 ...staticColor(),
19 position: 'relative',
20 display: 'grid',
21 gridTemplateColumns: {
22 labelPosition: {
23 top: ['1fr', 'auto'],
24 side: ['auto', '1fr']
25 }
26 },
27 gridTemplateAreas: {
28 labelPosition: {
29 top: ['label value', 'bar bar'],
30 side: ['label bar value']
31 }
32 },
33 alignItems: 'baseline',
34 isolation: 'isolate',
35 minWidth: 48, // progress-bar-minimum-width
36 maxWidth: 768, // progress-bar-maximum-width
37 '--field-height': {
38 type: 'height',
39 value: controlSize()
40 },
41 '--track-to-label': {
42 type: 'height',
43 value: 4
44 },
45 // Spectrum defines the field label/help text with a (minimum) height, with text centered inside.
46 // Calculate what the gap should be based on the height and line height.
47 // Use a variable here rather than rowGap since it is applied to the children as padding.
48 // This allows the gap to collapse when the label/help text is not present.
49 // Eventually this may be possible to do in pure CSS: https://github.com/w3c/csswg-drafts/issues/5813
50 '--field-gap': {
51 type: 'rowGap',
52 value: centerPadding('calc(var(--field-height) + var(--track-to-label))')
53 },
54
55 columnGap: 12 // spacing-200
56 }) as const;
57
58export const track = () =>
59 ({

Callers 2

Meter.tsxFile · 0.90
ProgressBar.tsxFile · 0.90

Calls 3

staticColorFunction · 0.90
controlSizeFunction · 0.90
centerPaddingFunction · 0.90

Tested by

no test coverage detected