Skip to content

Commit 811f701

Browse files
authored
Remove accessory capability/slot from TextArea component (#3603)
Resolves shop/issues-retail#21304 ### Background This PR refines the TypeScript definitions for the TextArea component in the Point of Sale UI extensions. ### Solution This change streamlines the type definitions by: - Removing the `accessory` prop from the `TextAreaJSXProps` interface These changes make the type definitions more maintainable while preserving type safety. ### 🎩 - Verified that existing components using TextArea still compile correctly - Confirmed that the type definitions work as expected in the Point of Sale surface ### Checklist - [ ] I have 🎩'd these changes - [ ] I have updated relevant documentation
2 parents ebfcf76 + 72817d1 commit 811f701

File tree

2 files changed

+16
-54
lines changed

2 files changed

+16
-54
lines changed

.changeset/old-geese-smoke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': major
3+
---
4+
5+
Remove accessory slot from TextArea component

packages/ui-extensions/src/surfaces/point-of-sale/components/TextArea.d.ts

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,73 +8,34 @@
88
/* eslint-disable import-x/namespace */
99
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
1010
/// <reference lib="DOM" />
11-
import type {
12-
TextAreaProps,
13-
Key,
14-
Ref,
15-
ComponentChild,
16-
} from './components-shared.d.ts';
11+
import type {TextAreaProps, Key, Ref} from './components-shared.d.ts';
1712

1813
export type ComponentChildren = any;
1914
/**
20-
* The base props for elements without children, providing key, ref, and slot properties.
15+
* Used when an element does not have children.
2116
*/
2217
export interface BaseElementProps<TClass = HTMLElement> {
23-
/**
24-
* A unique identifier for the element in lists. Used by Preact for efficient rendering and reconciliation.
25-
*/
2618
key?: Key;
27-
/**
28-
* A reference to the underlying DOM element. Commonly used to access the element directly for imperative operations.
29-
*/
3019
ref?: Ref<TClass>;
31-
/**
32-
* The named [slot](/docs/api/polaris/using-polaris-web-components#slots) this element should be placed in when used within a web component.
33-
*/
3420
slot?: Lowercase<string>;
3521
}
3622
/**
37-
* The base props for elements with children, extending `BaseElementProps` with children support.
23+
* Used when an element has children.
3824
*/
3925
export interface BaseElementPropsWithChildren<TClass = HTMLElement>
4026
extends BaseElementProps<TClass> {
41-
/**
42-
* The child elements to render within this component.
43-
*/
4427
children?: ComponentChildren;
4528
}
46-
export type IntrinsicElementProps<T> = T & BaseElementPropsWithChildren<T>;
47-
/**
48-
* Represents the event object passed to callback functions when interactive events occur. Contains metadata about the event, including the target element, event phase, and propagation behavior.
49-
*/
29+
export type IntrinsicElementProps<T> = T &
30+
BaseElementPropsWithChildren<T & HTMLElement>;
31+
export type HtmlElementTagNameProps<T> = T & HTMLElement;
5032
export interface CallbackEvent<T extends keyof HTMLElementTagNameMap> {
51-
/**
52-
* The element that the event listener is attached to.
53-
*/
5433
currentTarget: HTMLElementTagNameMap[T];
55-
/**
56-
* Whether the event bubbles up through the DOM tree.
57-
*/
5834
bubbles?: boolean;
59-
/**
60-
* Whether the event can be canceled.
61-
*/
6235
cancelable?: boolean;
63-
/**
64-
* Whether the event will trigger listeners outside of a shadow root.
65-
*/
6636
composed?: boolean;
67-
/**
68-
* The additional data associated with the event.
69-
*/
7037
detail?: any;
71-
/**
72-
* The current phase of the event flow.
73-
*/
7438
eventPhase: number;
75-
/**
76-
* The element that triggered the event.
77-
*/
7839
target: HTMLElementTagNameMap[T] | null;
7940
}
8041

@@ -94,30 +55,26 @@ export interface TextAreaJSXProps
9455
| 'rows'
9556
> {
9657
/**
97-
* A callback function that executes when the user makes any changes in the field.
58+
* Callback when the user makes any changes in the field.
9859
*/
9960
onInput?: ((event: CallbackEvent<typeof tagName>) => void) | null;
10061
/**
101-
* A callback function that executes after editing completes, typically on blur.
62+
* Callback after editing completes (typically on blur).
10263
*/
10364
onChange?: ((event: CallbackEvent<typeof tagName>) => void) | null;
10465
/**
105-
* A callback function that executes when the element loses focus.
66+
* Callback when the element loses focus.
10667
*/
10768
onBlur?: ((event: CallbackEvent<typeof tagName>) => void) | null;
10869
/**
109-
* A callback function that executes when the element receives focus.
70+
* Callback when the element receives focus.
11071
*/
11172
onFocus?: ((event: CallbackEvent<typeof tagName>) => void) | null;
112-
/**
113-
* The additional content to be displayed in the field. Commonly used to display clickable text or action elements. Only `Button` and `Clickable` components are supported in this slot. Use the `slot="accessory"` attribute to place elements in this area.
114-
*/
115-
accessory?: ComponentChild;
11673
}
11774
export type ElementProps = Omit<TextAreaJSXProps, 'accessory'>;
11875
declare global {
11976
interface HTMLElementTagNameMap {
120-
[tagName]: ElementProps;
77+
[tagName]: HtmlElementTagNameProps<ElementProps>;
12178
}
12279
}
12380
declare module 'preact' {

0 commit comments

Comments
 (0)