Skip to content

Commit 11ddc3c

Browse files
committed
Improve descriptions for layout and structure components
1 parent 103355f commit 11ddc3c

File tree

16 files changed

+394
-483
lines changed

16 files changed

+394
-483
lines changed

packages/ui-extensions/src/surfaces/checkout/components/BlockLayout/BlockLayout.ts

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,28 @@ import type {Rows} from '../shared';
55
import type {GridProps} from '../Grid/Grid';
66

77
/**
8-
* BlockLayout is used to lay out content over multiple rows.
9-
10-
By default, all rows fill the available block space, sharing it equally.
118
* @publicDocs
129
*/
1310
export interface BlockLayoutProps extends Omit<GridProps, 'columns' | 'rows'> {
1411
/**
15-
* Sizes for each row of the layout.
16-
*
17-
*
18-
* `auto`: intrinsic size of the element.
19-
*
20-
* `fill`: fills the remaining available space. When multiple elements are set to `fill`, the remaining space is shared equally.
21-
*
22-
* `` `${number}%` ``: size in percentages.
23-
*
24-
* `` `${number}fr` ``: size in fractions.
25-
*
26-
* `number`: size in pixels.
27-
*
28-
*
29-
* - When the sum of the defined sizes is larger than the available space, elements will shrink to avoid overflow.
30-
*
31-
* - When the size of an element is not explicitly set, it will fill the remaining space available.
12+
* The sizes for each row of the layout.
3213
*
33-
* - When only one size is set and outside of an array, all elements of the layout will take that size.
14+
* - `auto`: The intrinsic size of the element.
15+
* - `fill`: Fills the remaining available space. When multiple elements use `fill`, the space is shared equally.
16+
* - `` `${number}%` ``: A percentage of the container's block size.
17+
* - `` `${number}fr` ``: A fractional unit of the available space.
18+
* - `number`: A fixed size in pixels.
3419
*
20+
* When the sum of defined sizes exceeds the available space, elements shrink to avoid overflow. Elements without an explicit size fill the remaining space. A single value outside an array applies to all rows.
3521
*
3622
* @defaultValue 'fill'
3723
*/
3824
rows?: MaybeResponsiveConditionalStyle<Rows>;
3925
}
4026

4127
/**
42-
* BlockLayout is used to lay out content over multiple rows.
43-
*
44-
* By default, all rows fill the available block space, sharing it equally.
28+
* BlockLayout arranges content over multiple rows. By default, all rows
29+
* fill the available block space, sharing it equally.
4530
*/
4631
export const BlockLayout = createRemoteComponent<
4732
'BlockLayout',

packages/ui-extensions/src/surfaces/checkout/components/BlockSpacer/BlockSpacer.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,21 @@ import type {MaybeResponsiveConditionalStyle} from '../../style/types';
44
import type {IdProps, Spacing} from '../shared';
55

66
/**
7-
* BlockSpacer is used to create empty block space, typically when variable spacing is needed between multiple elements.
8-
9-
Note that you should favor BlockStack when spacing between all elements is the same.
107
* @publicDocs
118
*/
129
export interface BlockSpacerProps extends IdProps {
1310
/**
14-
* Adjust size of the spacer
11+
* The size of the spacer.
1512
*
1613
* @defaultValue 'base'
1714
**/
1815
spacing?: MaybeResponsiveConditionalStyle<Spacing>;
1916
}
2017

2118
/**
22-
* BlockSpacer is used to create empty block space, typically when variable spacing
23-
* is needed between multiple elements.
24-
*
25-
* Note that you should favor BlockStack when spacing between all elements is the same.
19+
* BlockSpacer creates empty block-axis space, typically when variable spacing
20+
* is needed between elements. Use BlockStack instead when spacing between all
21+
* elements is the same.
2622
*/
2723
export const BlockSpacer = createRemoteComponent<
2824
'BlockSpacer',

packages/ui-extensions/src/surfaces/checkout/components/BlockStack/BlockStack.ts

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {
1414
import type {MaybeResponsiveConditionalStyle} from '../../style/types';
1515

1616
/**
17-
* BlockStack is used to vertically stack elements.
1817
* @publicDocs
1918
*/
2019
export interface BlockStackProps
@@ -25,63 +24,43 @@ export interface BlockStackProps
2524
SizingProps,
2625
SpacingProps {
2726
/**
28-
* Position children along the main axis
27+
* The alignment of children along the inline (main) axis.
2928
*/
3029
inlineAlignment?: MaybeResponsiveConditionalStyle<InlineAlignment>;
3130
/**
32-
* Adjust spacing between children
31+
* The spacing between child elements.
3332
*
3433
* @defaultValue 'base'
3534
*/
3635
spacing?: MaybeResponsiveConditionalStyle<Spacing>;
3736
/**
38-
* Sets the semantic meaning of the component’s content. When set,
39-
* the role will be used by assistive technologies to help buyers
40-
* navigate the page.
41-
*
42-
*
43-
* For example:
44-
*
45-
* - In an HTML host a `['listItem', 'separator']` tuple will render: `<li role='separator'>`
46-
*
47-
* - In an HTML host a `listItem` string will render: `<li>`
37+
* The semantic meaning of the component's content. When set, assistive technologies use this role to help users navigate the page. Accepts a single role or a tuple of two roles (for example, `['listItem', 'separator']`).
4838
*/
4939
accessibilityRole?: ViewLikeAccessibilityRole;
5040
/**
51-
* A label that describes the purpose or contents of the element. When set,
52-
* it will be announced to buyers using assistive technologies and will
53-
* provide them with more context.
41+
* A label announced by assistive technologies that describes the purpose or contents of the element. Only set this when the element's visible content doesn't provide enough context on its own.
5442
*/
5543
accessibilityLabel?: string;
5644
/**
57-
* Sets the overflow behavior of the element.
58-
*
59-
* `hidden`: clips the content when it is larger than the element’s container.
60-
* The element will not be scrollable and the users will not be able
61-
* to access the clipped content by dragging or using a scroll wheel.
45+
* The overflow behavior of the element.
6246
*
63-
* `visible`: the content that extends beyond the element’s container is visible.
47+
* - `visible`: Content that extends beyond the container is visible.
48+
* - `hidden`: Content that extends beyond the container is clipped and not scrollable.
6449
*
6550
* @default 'visible'
6651
*/
6752
overflow?: 'hidden' | 'visible';
6853
/**
69-
* Changes the display of the component.
54+
* The display mode of the component. Learn more about [`display`](https://developer.mozilla.org/en-US/docs/Web/CSS/display).
7055
*
71-
* `auto` the component's initial value. The actual value depends on the component and context.
72-
*
73-
* `none` hides the component and removes it from the accessibility tree, making it invisible to screen readers.
74-
*
75-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
56+
* - `auto`: The initial value; the actual behavior depends on the component and context.
57+
* - `none`: Hides the component and removes it from the accessibility tree.
7658
*
7759
* @defaultValue 'auto'
7860
*/
7961
display?: MaybeResponsiveConditionalStyle<'auto' | 'none'>;
8062
}
8163

82-
/**
83-
* BlockStack is used to vertically stack elements.
84-
*/
8564
export const BlockStack = createRemoteComponent<'BlockStack', BlockStackProps>(
8665
'BlockStack',
8766
);

packages/ui-extensions/src/surfaces/checkout/components/Divider/Divider.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,42 @@ import {createRemoteComponent} from '@remote-ui/core';
33
import type {Alignment, Direction, IdProps, Size} from '../shared';
44

55
/**
6-
* A divider separates content and represents a thematic break between elements.
76
* @publicDocs
87
*/
98
export interface DividerProps extends IdProps {
109
/**
11-
* Use to create dividers with varying widths.
10+
* The thickness of the divider line.
11+
*
12+
* - `small`: A thin, subtle line.
13+
* - `base`: The standard divider thickness.
14+
* - `large`: A thicker line for stronger visual separation.
15+
* - `extraLarge`: The thickest available line.
1216
*
1317
* @defaultValue 'small'
1418
*/
1519
size?: Extract<Size, 'small' | 'base' | 'large' | 'extraLarge'>;
1620

1721
/**
18-
* Use to specify direction of divider.
22+
* The orientation of the divider, using [logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values).
23+
*
24+
* - `inline`: A horizontal divider that separates content stacked vertically.
25+
* - `block`: A vertical divider that separates content arranged horizontally.
1926
*
2027
* @defaultValue 'inline'
2128
*/
2229
direction?: Direction;
2330

2431
/**
25-
* Use to specify alignment of contents of divider.
32+
* The alignment of the divider's content within its container.
2633
*
2734
* @defaultValue 'center'
2835
*/
2936
alignment?: Alignment;
3037
}
3138

3239
/**
33-
* A divider separates content and represents a thematic break between elements.
40+
* A visual separator that draws a line between adjacent sections of content,
41+
* representing a thematic break.
3442
*/
3543
export const Divider = createRemoteComponent<'Divider', DividerProps>(
3644
'Divider',

packages/ui-extensions/src/surfaces/checkout/components/Grid/Grid.ts

Lines changed: 25 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import type {
1717
} from '../shared';
1818

1919
/**
20-
* Grid is used to lay out content in a matrix of rows and columns.
2120
* @publicDocs
2221
*/
2322
export interface GridProps
@@ -28,115 +27,73 @@ export interface GridProps
2827
SizingProps,
2928
SpacingProps {
3029
/**
31-
* Sizes for each column of the layout.
30+
* The sizes for each column of the grid.
3231
*
32+
* - `auto`: The intrinsic size of the content.
33+
* - `fill`: Fills the remaining available space. When multiple columns use `fill`, the space is shared equally.
34+
* - `` `${number}%` ``: A percentage of the container's inline size.
35+
* - `` `${number}fr` ``: A fractional unit of the available space.
36+
* - `number`: A fixed size in pixels.
3337
*
34-
* `auto`: intrinsic size of the content.
35-
*
36-
* `fill`: fills the remaining available space. When multiple columns are set to `fill`, the remaining space is shared equally.
37-
*
38-
* `` `${number}%` ``: size in percentages.
39-
*
40-
* `` `${number}fr` ``: size in fractions.
41-
*
42-
* `number`: size in pixels.
43-
*
44-
*
45-
* - When the sum of the defined sizes is larger than the available space, elements will shrink to avoid overflow.
46-
* - Except when in scrollview, where the grid will fill the space with the defined sizes.
47-
*
48-
* - When only one size is set and outside of an array, the grid will have one column of that size.
38+
* When the sum of defined sizes exceeds the available space, elements shrink to avoid overflow (except inside a ScrollView). A single value outside an array creates one column of that size.
4939
*
5040
* @defaultValue 'fill'
5141
*/
5242
columns?: MaybeResponsiveConditionalStyle<Columns>;
5343
/**
54-
* Sizes for each row of the layout.
55-
*
56-
*
57-
* `auto`: intrinsic size of the content.
58-
*
59-
* `fill`: fills the remaining available space. When multiple rows are set to `fill`, the remaining space is shared equally.
60-
*
61-
* `` `${number}%` ``: size in percentages.
62-
*
63-
* `` `${number}fr` ``: size in fractions.
64-
*
65-
* `number`: size in pixels.
44+
* The sizes for each row of the grid.
6645
*
46+
* - `auto`: The intrinsic size of the content.
47+
* - `fill`: Fills the remaining available space. When multiple rows use `fill`, the space is shared equally.
48+
* - `` `${number}%` ``: A percentage of the container's block size.
49+
* - `` `${number}fr` ``: A fractional unit of the available space.
50+
* - `number`: A fixed size in pixels.
6751
*
68-
* - When the sum of the defined sizes is larger than the available space, elements will shrink to avoid overflow.
69-
*
70-
* - When only one size is set and outside of an array, the grid will have one row of that size.
52+
* When the sum of defined sizes exceeds the available space, elements shrink to avoid overflow. A single value outside an array creates one row of that size.
7153
*
7254
* @defaultValue 'fill'
7355
*/
7456
rows?: MaybeResponsiveConditionalStyle<Rows>;
7557
/**
76-
* Adjust spacing between children.
77-
*
78-
* - `base` means the space between rows and columns is `base`.
79-
*
80-
* - [`base`, `none`] means the space between rows is `base`, space between columns is `none`.
58+
* The spacing between child elements. A single value applies to both the row and column axes. A pair of values (for example, `['base', 'none']`) sets the row and column spacing independently.
8159
*
8260
* @defaultValue 'none'
8361
**/
8462
spacing?: MaybeResponsiveConditionalStyle<Spacing | [Spacing, Spacing]>;
8563
/**
86-
* Position children along the cross axis.
64+
* The alignment of children along the block (cross) axis.
8765
*/
8866
blockAlignment?: MaybeResponsiveConditionalStyle<BlockAlignment>;
8967
/**
90-
* Position children along the main axis.
68+
* The alignment of children along the inline (main) axis.
9169
*/
9270
inlineAlignment?: MaybeResponsiveConditionalStyle<InlineAlignment>;
9371
/**
94-
* Sets the semantic meaning of the component’s content. When set,
95-
* the role will be used by assistive technologies to help buyers
96-
* navigate the page.
97-
*
98-
*
99-
* For example:
100-
*
101-
* - In an HTML host a `['listItem', 'separator']` tuple will render: `<li role='separator'>`
102-
*
103-
* - In an HTML host a `listItem` string will render: `<li>`
72+
* The semantic meaning of the component's content. When set, assistive technologies use this role to help users navigate the page. Accepts a single role or a tuple of two roles (for example, `['listItem', 'separator']`).
10473
*/
10574
accessibilityRole?: ViewLikeAccessibilityRole;
10675
/**
107-
* A label that describes the purpose or contents of the element. When set,
108-
* it will be announced to buyers using assistive technologies and will
109-
* provide them with more context.
76+
* A label announced by assistive technologies that describes the purpose or contents of the element. Only set this when the element's visible content doesn't provide enough context on its own.
11077
*/
11178
accessibilityLabel?: string;
11279
/**
113-
* Sets the overflow behavior of the element.
80+
* The overflow behavior of the element.
11481
*
115-
* `hidden`: clips the content when it is larger than the element’s container.
116-
* The element will not be scrollable and the users will not be able
117-
* to access the clipped content by dragging or using a scroll wheel.
118-
*
119-
* `visible`: the content that extends beyond the element’s container is visible.
82+
* - `visible`: Content that extends beyond the container is visible.
83+
* - `hidden`: Content that extends beyond the container is clipped and not scrollable.
12084
*
12185
* @default 'visible'
12286
*/
12387
overflow?: 'hidden' | 'visible';
12488
/**
125-
* Changes the display of the component.
126-
*
127-
*
128-
* `auto` the component's initial value. The actual value depends on the component and context.
89+
* The display mode of the component. Learn more about [`display`](https://developer.mozilla.org/en-US/docs/Web/CSS/display).
12990
*
130-
* `none` hides the component and removes it from the accessibility tree, making it invisible to screen readers.
131-
*
132-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
91+
* - `auto`: The initial value; the actual behavior depends on the component and context.
92+
* - `none`: Hides the component and removes it from the accessibility tree.
13393
*
13494
* @defaultValue 'auto'
13595
*/
13696
display?: MaybeResponsiveConditionalStyle<'auto' | 'none'>;
13797
}
13898

139-
/**
140-
* Grid is used to lay out content in a matrix of rows and columns.
141-
*/
14299
export const Grid = createRemoteComponent<'Grid', GridProps>('Grid');

0 commit comments

Comments
 (0)