Skip to content

Commit 6af059a

Browse files
authored
Merge pull request #2977 from Shopify/admin-ui-componnets/1.1.0
Update definitions, add QueryContainer definition
2 parents 80fb84f + b7bf36a commit 6af059a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1209
-796
lines changed

packages/ui-extensions/src/surfaces/admin/components.d.ts

Lines changed: 333 additions & 513 deletions
Large diffs are not rendered by default.

packages/ui-extensions/src/surfaces/admin/components/AdminAction.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */

packages/ui-extensions/src/surfaces/admin/components/AdminBlock.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */

packages/ui-extensions/src/surfaces/admin/components/AdminPrintAction.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */

packages/ui-extensions/src/surfaces/admin/components/Badge.d.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */
@@ -98,6 +98,21 @@ declare abstract class PreactCustomElement extends BaseClass {
9898
click({sourceEvent}?: ClickOptions): void;
9999
}
100100

101+
/** Used when an element does not have children. */
102+
export interface PreactBaseElementProps<TClass extends HTMLElement> {
103+
/** Assigns a unique key to this element. */
104+
key?: preact.Key;
105+
/** Assigns a ref (generally from `useRef()`) to this element. */
106+
ref?: preact.Ref<TClass>;
107+
/** Assigns this element to a parent's slot. */
108+
slot?: Lowercase<string>;
109+
}
110+
/** Used when an element has children. */
111+
export interface PreactBaseElementPropsWithChildren<TClass extends HTMLElement>
112+
extends PreactBaseElementProps<TClass> {
113+
children?: preact.ComponentChildren;
114+
}
115+
101116
declare class Badge extends PreactCustomElement implements BadgeProps {
102117
accessor color: BadgeProps['color'];
103118
accessor icon: BadgeProps['icon'];
@@ -111,13 +126,9 @@ declare global {
111126
}
112127
}
113128
declare module 'preact' {
114-
interface BaseProps {
115-
children?: preact.ComponentChildren;
116-
slot?: Lowercase<string>;
117-
}
118129
namespace createElement.JSX {
119130
interface IntrinsicElements {
120-
[tagName]: BadgeJSXProps & BaseProps;
131+
[tagName]: BadgeJSXProps & PreactBaseElementPropsWithChildren<Badge>;
121132
}
122133
}
123134
}

packages/ui-extensions/src/surfaces/admin/components/Banner.d.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */
@@ -34,6 +34,20 @@ export type CallbackEventListener<
3434
(event: CallbackEvent<TTagName, TEvent>): void;
3535
})
3636
| null;
37+
/** Used when an element does not have children. */
38+
export interface PreactBaseElementProps<TClass extends HTMLElement> {
39+
/** Assigns a unique key to this element. */
40+
key?: preact.Key;
41+
/** Assigns a ref (generally from `useRef()`) to this element. */
42+
ref?: preact.Ref<TClass>;
43+
/** Assigns this element to a parent's slot. */
44+
slot?: Lowercase<string>;
45+
}
46+
/** Used when an element has children. */
47+
export interface PreactBaseElementPropsWithChildren<TClass extends HTMLElement>
48+
extends PreactBaseElementProps<TClass> {
49+
children?: preact.ComponentChildren;
50+
}
3751

3852
export type Styles = string;
3953
export type RenderImpl = Omit<ShadowRootInit, 'mode'> & {
@@ -110,13 +124,10 @@ declare global {
110124
}
111125
}
112126
declare module 'preact' {
113-
interface BaseProps {
114-
children?: preact.ComponentChildren;
115-
slot?: Lowercase<string>;
116-
}
117127
namespace createElement.JSX {
118128
interface IntrinsicElements {
119-
[tagName]: Omit<BannerJSXProps, 'secondaryActions'> & BaseProps;
129+
[tagName]: Omit<BannerJSXProps, 'secondaryActions'> &
130+
PreactBaseElementPropsWithChildren<Banner>;
120131
}
121132
}
122133
}

packages/ui-extensions/src/surfaces/admin/components/Box.d.ts

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */
@@ -57,6 +57,7 @@ export type ResponsiveBoxProps = MakeResponsivePick<
5757
| 'paddingInline'
5858
| 'paddingInlineStart'
5959
| 'paddingInlineEnd'
60+
| 'display'
6061
>;
6162
export interface BoxProps
6263
extends Pick<
@@ -71,7 +72,6 @@ export interface BoxProps
7172
| 'borderRadius'
7273
| 'borderStyle'
7374
| 'borderWidth'
74-
| 'display'
7575
| 'inlineSize'
7676
| 'maxBlockSize'
7777
| 'maxInlineSize'
@@ -196,6 +196,16 @@ export interface BoxProps
196196
* @default '' - meaning no override
197197
*/
198198
paddingInlineEnd: ResponsiveBoxProps['paddingInlineEnd'];
199+
/**
200+
* Sets the outer display type of the component. The outer type sets a component's participation in [flow layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout).
201+
*
202+
* - `auto` the component's initial value. The actual value depends on the component and context.
203+
* - `none` hides the component from display and removes it from the accessibility tree, making it invisible to screen readers.
204+
*
205+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
206+
* @default 'auto'
207+
*/
208+
display: ResponsiveBoxProps['display'];
199209
}
200210

201211
export type Styles = string;
@@ -286,6 +296,21 @@ declare class BoxElement extends PreactCustomElement implements BoxProps {
286296
accessor display: BoxProps['display'];
287297
}
288298

299+
/** Used when an element does not have children. */
300+
export interface PreactBaseElementProps<TClass extends HTMLElement> {
301+
/** Assigns a unique key to this element. */
302+
key?: preact.Key;
303+
/** Assigns a ref (generally from `useRef()`) to this element. */
304+
ref?: preact.Ref<TClass>;
305+
/** Assigns this element to a parent's slot. */
306+
slot?: Lowercase<string>;
307+
}
308+
/** Used when an element has children. */
309+
export interface PreactBaseElementPropsWithChildren<TClass extends HTMLElement>
310+
extends PreactBaseElementProps<TClass> {
311+
children?: preact.ComponentChildren;
312+
}
313+
289314
declare class Box extends BoxElement implements BoxProps {
290315
constructor();
291316
}
@@ -295,13 +320,9 @@ declare global {
295320
}
296321
}
297322
declare module 'preact' {
298-
interface BaseProps {
299-
children?: preact.ComponentChildren;
300-
slot?: Lowercase<string>;
301-
}
302323
namespace createElement.JSX {
303324
interface IntrinsicElements {
304-
[tagName]: BoxJSXProps & BaseProps;
325+
[tagName]: BoxJSXProps & PreactBaseElementPropsWithChildren<Box>;
305326
}
306327
}
307328
}

packages/ui-extensions/src/surfaces/admin/components/Button.d.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */
@@ -70,6 +70,20 @@ export type CallbackEventListener<
7070
(event: CallbackEvent<TTagName, TEvent>): void;
7171
})
7272
| null;
73+
/** Used when an element does not have children. */
74+
export interface PreactBaseElementProps<TClass extends HTMLElement> {
75+
/** Assigns a unique key to this element. */
76+
key?: preact.Key;
77+
/** Assigns a ref (generally from `useRef()`) to this element. */
78+
ref?: preact.Ref<TClass>;
79+
/** Assigns this element to a parent's slot. */
80+
slot?: Lowercase<string>;
81+
}
82+
/** Used when an element has children. */
83+
export interface PreactBaseElementPropsWithChildren<TClass extends HTMLElement>
84+
extends PreactBaseElementProps<TClass> {
85+
children?: preact.ComponentChildren;
86+
}
7387

7488
export type Styles = string;
7589
export type RenderImpl = Omit<ShadowRootInit, 'mode'> & {
@@ -179,13 +193,9 @@ declare global {
179193
}
180194
}
181195
declare module 'preact' {
182-
interface BaseProps {
183-
children?: preact.ComponentChildren;
184-
slot?: Lowercase<string>;
185-
}
186196
namespace createElement.JSX {
187197
interface IntrinsicElements {
188-
[tagName]: ButtonJSXProps & BaseProps;
198+
[tagName]: ButtonJSXProps & PreactBaseElementPropsWithChildren<Button>;
189199
}
190200
}
191201
}

packages/ui-extensions/src/surfaces/admin/components/Checkbox.d.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */
@@ -86,6 +86,20 @@ export type CallbackEventListener<
8686
(event: CallbackEvent<TTagName, TEvent>): void;
8787
})
8888
| null;
89+
/** Used when an element does not have children. */
90+
export interface PreactBaseElementProps<TClass extends HTMLElement> {
91+
/** Assigns a unique key to this element. */
92+
key?: preact.Key;
93+
/** Assigns a ref (generally from `useRef()`) to this element. */
94+
ref?: preact.Ref<TClass>;
95+
/** Assigns this element to a parent's slot. */
96+
slot?: Lowercase<string>;
97+
}
98+
/** Used when an element has children. */
99+
export interface PreactBaseElementPropsWithChildren<TClass extends HTMLElement>
100+
extends PreactBaseElementProps<TClass> {
101+
children?: preact.ComponentChildren;
102+
}
89103

90104
declare const internals: unique symbol;
91105
export type PreactInputProps = Required<
@@ -166,7 +180,8 @@ declare global {
166180
declare module 'preact' {
167181
namespace createElement.JSX {
168182
interface IntrinsicElements {
169-
[tagName]: CheckboxJSXProps;
183+
[tagName]: CheckboxJSXProps &
184+
PreactBaseElementPropsWithChildren<Checkbox>;
170185
}
171186
}
172187
}

packages/ui-extensions/src/surfaces/admin/components/Choice.d.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** VERSION: 1.0.0 **/
1+
/** VERSION: 1.1.0 **/
22
/* eslint-disable import/extensions */
33

44
/* eslint-disable @typescript-eslint/no-namespace */
@@ -82,6 +82,21 @@ declare abstract class PreactCustomElement extends BaseClass {
8282
click({sourceEvent}?: ClickOptions): void;
8383
}
8484

85+
/** Used when an element does not have children. */
86+
export interface PreactBaseElementProps<TClass extends HTMLElement> {
87+
/** Assigns a unique key to this element. */
88+
key?: preact.Key;
89+
/** Assigns a ref (generally from `useRef()`) to this element. */
90+
ref?: preact.Ref<TClass>;
91+
/** Assigns this element to a parent's slot. */
92+
slot?: Lowercase<string>;
93+
}
94+
/** Used when an element has children. */
95+
export interface PreactBaseElementPropsWithChildren<TClass extends HTMLElement>
96+
extends PreactBaseElementProps<TClass> {
97+
children?: preact.ComponentChildren;
98+
}
99+
85100
declare class Choice extends PreactCustomElement implements ChoiceProps {
86101
accessor disabled: ChoiceProps['disabled'];
87102
accessor details: ChoiceProps['details'];
@@ -101,7 +116,7 @@ declare global {
101116
declare module 'preact' {
102117
namespace createElement.JSX {
103118
interface IntrinsicElements {
104-
[tagName]: ChoiceJSXProps;
119+
[tagName]: ChoiceJSXProps & PreactBaseElementPropsWithChildren<Choice>;
105120
}
106121
}
107122
}

0 commit comments

Comments
 (0)