Skip to content

Commit fe62c86

Browse files
Add textAlign to Paragraph and improve JSDoc
Replace the 'type' prop with 'textAlign' on ParagraphElementProps to align with the underlying s-paragraph web component change. - Add textAlign prop ('start' | 'end' | 'center' | 'auto') - Remove type prop ('paragraph' | 'small') - Add @publicdocs annotations - Improve JSDoc for BaseElementProps and BaseElementPropsWithChildren
1 parent 97d2762 commit fe62c86

2 files changed

Lines changed: 26 additions & 10 deletions

File tree

.changeset/paragraph-text-align.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': patch
3+
---
4+
5+
Add `textAlign` prop to the checkout `Paragraph` component, supporting `'start'`, `'end'`, `'center'`, and `'auto'` values.

packages/ui-extensions/src/surfaces/checkout/components/Paragraph.d.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,30 @@
1111
import type {ParagraphProps$1} from './components-shared.d.ts';
1212

1313
/**
14-
* Used when an element does not have children.
14+
* The base properties for elements that don't have children, providing essential attributes like keys and refs for component management.
1515
*/
1616
export interface BaseElementProps<TClass = HTMLElement> {
17+
/**
18+
* A unique identifier for this element within its parent. This is used by the rendering engine for efficient reconciliation when lists change.
19+
*/
1720
key?: preact.Key;
21+
/**
22+
* A reference to the underlying DOM element, typically created using `useRef()`. This allows you to access and manipulate the DOM element directly in your component logic.
23+
*/
1824
ref?: preact.Ref<TClass>;
25+
/**
26+
* Assigns the element to a named slot in a parent component that uses slot-based composition patterns.
27+
*/
1928
slot?: Lowercase<string>;
2029
}
2130
/**
22-
* Used when an element has children.
31+
* The base properties for elements that have children, extending `BaseElementProps` with children support.
32+
* @publicDocs
2333
*/
2434
export interface BaseElementPropsWithChildren<TClass = HTMLElement> extends BaseElementProps<TClass> {
35+
/**
36+
* The child elements to render within this component.
37+
*/
2538
children?: preact.ComponentChildren;
2639
}
2740

@@ -31,19 +44,17 @@ export interface ParagraphElementProps extends Pick<ParagraphProps$1, 'accessibi
3144
color?: Extract<ParagraphProps$1['color'], 'subdued' | 'base'>;
3245
tone?: Extract<ParagraphProps$1['tone'], 'auto' | 'info' | 'success' | 'warning' | 'critical' | 'neutral' | 'custom'>;
3346
/**
34-
* The semantic type and styling treatment for the paragraph content.
35-
*
36-
* Other presentation properties on `s-paragraph` override the default styling.
47+
* Sets the alignment of the text.
48+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
3749
*
38-
* - `paragraph`: A semantic type that indicates the text is a structural grouping of related content.
39-
* - `small`: A semantic type that indicates the text is considered less important than the main content, but is still necessary for the reader to understand.
40-
*
41-
* @default 'paragraph'
50+
* @default 'auto'
4251
*/
43-
type?: Extract<ParagraphProps$1['type'], 'paragraph' | 'small'>;
52+
textAlign?: 'start' | 'end' | 'center' | 'auto';
4453
}
54+
/** @publicDocs */
4555
export interface ParagraphElement extends ParagraphElementProps, Omit<HTMLElement, 'id' | 'dir' | 'lang'> {
4656
}
57+
/** @publicDocs */
4758
export interface ParagraphProps extends ParagraphElementProps {
4859
}
4960
declare global {

0 commit comments

Comments
 (0)