diff --git a/.changeset/admin-component-type-drift.md b/.changeset/admin-component-type-drift.md
new file mode 100644
index 0000000000..526d411123
--- /dev/null
+++ b/.changeset/admin-component-type-drift.md
@@ -0,0 +1,5 @@
+---
+'@shopify/ui-extensions': minor
+---
+
+Regenerate the Admin per-component types so they match the components as shipped. Around 35 components gain properties that existed in the implementation but were missing from the types, including the whole of `DatePicker` (`allow`, `allowDays`, `defaultValue`, `defaultView`, `disallow`, `disallowDays`, `value`, `view`, `visibleMonths`), typography properties on `Text`, `Paragraph`, and `Heading` (`fontSize`, `fontWeight`, `fontVariantNumeric`), `Banner`'s `heading` and `dismissible`, `Button`'s `variant` and `accessibilityLabel`, and `ColorPicker`'s `alpha`, `value`, and `defaultValue`.
diff --git a/.changeset/admin-number-empty-state-types.md b/.changeset/admin-number-empty-state-types.md
new file mode 100644
index 0000000000..56ceddbb09
--- /dev/null
+++ b/.changeset/admin-number-empty-state-types.md
@@ -0,0 +1,5 @@
+---
+'@shopify/ui-extensions': minor
+---
+
+Add Admin `Number` and `EmptyState` types. `Number` exposes the `tone`, `color`, `fontSize`, and `fontWeight` properties; `EmptyState` exposes the `heading` property and the `graphic`, `subheading`, `primaryAction`, and `secondaryActions` slots.
diff --git a/.changeset/admin-section-header-slots.md b/.changeset/admin-section-header-slots.md
new file mode 100644
index 0000000000..50cc5dfe7a
--- /dev/null
+++ b/.changeset/admin-section-header-slots.md
@@ -0,0 +1,5 @@
+---
+'@shopify/ui-extensions': minor
+---
+
+Added `subheading` property and the `primaryAction`, `secondaryActions`, `graphic`, `accessory`, and `supplemental` slots to Admin `Section`.
diff --git a/packages/ui-extensions/src/surfaces/admin/components/AdminAction.d.ts b/packages/ui-extensions/src/surfaces/admin/components/AdminAction.d.ts
index 1b9f978638..ac304f6b26 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/AdminAction.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/AdminAction.d.ts
@@ -1,151 +1,105 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///
-import type {ComponentChildren, AdminActionProps$1} from './shared.d.ts';
+import type {
+ ComponentChildren,
+ AdminActionProps$1,
+ PreactCustomElement,
+ RenderImpl,
+} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
/**
- * The properties for the admin action component. These properties configure the heading and loading state of the admin action extension interface.
+ * Configure the following properties on the admin action component.
* @publicDocs
*/
export interface AdminActionProps
- extends Pick {}
+ extends Pick {
+ /**
+ * Whether the action is in a loading state, such as during initial page load or when the action is being opened.
+ * When `true`, the action is in an inert state that prevents user interaction.
+ *
+ * @default false
+ */
+ loading: AdminActionProps$1['loading'];
+}
-declare const tagName = 's-admin-action';
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
-/**
- * The JSX props for the admin action component. These properties extend `AdminActionProps` with slots for primary and secondary action buttons that merchants can interact with.
- * @publicDocs
- */
+declare const tagName = 's-admin-action';
export interface AdminActionJSXProps
extends Partial,
Pick {
/**
- * The primary action button or link to display in the admin action area. This is the main call-to-action that appears prominently in the interface. Typically uses a button component with `variant="primary"` to complete or advance the workflow.
+ * The main action button or link displayed in the admin action modal.
+ * This represents the primary or most important action that users can take in this modal context, typically displayed with high visual prominence.
*/
primaryAction: ComponentChildren;
/**
- * The secondary action buttons or links to display in the admin action area. These are supporting actions like cancel, back, or alternative operations. Typically uses button components with `variant="secondary"` or `variant="tertiary"`.
+ * Additional action buttons or links displayed in the admin action modal.
+ * These provide alternative or supporting actions, visually de-emphasized compared to the primary action to establish clear hierarchy.
*/
secondaryActions: ComponentChildren;
}
-/**
- * The CSS styles as a string, used for styling web components within their shadow DOM.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The implementation configuration for rendering a Preact component into a shadow root. Defines the render function that returns JSX elements and optional CSS styles to apply to the component's shadow DOM.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The render function that returns Preact/JSX elements to display in the component's shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * The optional CSS styles to inject into the component's shadow DOM.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event (such as a click or keyboard press) that describe which modifier keys and mouse buttons were involved. This is used to determine intended behavior like opening links in new tabs when Command/Control is pressed.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was pressed during the activation event.
- */
- shiftKey: boolean;
- /**
- * Whether the Meta key (Command on Mac, Windows key on Windows) was pressed during the activation event.
- */
- metaKey: boolean;
- /**
- * Whether the Control key was pressed during the activation event.
- */
- ctrlKey: boolean;
- /**
- * The mouse button that was pressed during the activation event. `0` for primary button (left click), `1` for auxiliary button (middle click), `2` for secondary button (right click).
- */
- button: number;
-}
-/**
- * The options for controlling how a synthetic click behaves. Allows passing modifier key states and button information from an original event to influence link behavior such as opening in new tabs or background tabs.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The activation event (such as a click or keyboard event) whose modifier key state and button information should influence the synthetic click behavior. For example, passing an event with `metaKey: true` will cause links to open in a new tab.
- */
- sourceEvent?: ActivationEventEsque;
-}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
-
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
/**
- * The admin action custom element class that renders action controls in the Shopify admin interface. This component creates a standardized action area with a heading and slots for primary and secondary action buttons, used exclusively in admin action extensions.
+ * Configure the following properties on the admin action component.
+ * @publicDocs
*/
declare class AdminAction
- extends PreactCustomElement
+ extends PolarisCustomElement
implements AdminActionProps
{
/**
- * The heading text to display at the top of the action area. This title describes the action or task the merchant is performing. If not provided, the extension name is used as the heading.
+ * The text to use as the Action modal's title. If not provided, the name of the extension will be used.
*/
heading: string;
-
/**
- * Whether the action extension is currently in a loading state, such as during initial data fetching or when opening the action. When `true`, the action area might display loading indicators and prevent user interaction until loading completes.
- *
- * @default false
+ * Whether the action is in a loading state, such as during initial page load or when the action is being opened. When `true`, the action might be in an inert state that prevents user interaction.
*/
loading: boolean;
-
constructor();
}
declare global {
diff --git a/packages/ui-extensions/src/surfaces/admin/components/AdminBlock.d.ts b/packages/ui-extensions/src/surfaces/admin/components/AdminBlock.d.ts
index 6d80f01de6..5cfdddc8a7 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/AdminBlock.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/AdminBlock.d.ts
@@ -1,140 +1,55 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///
-import type {AdminBlockProps$1, ComponentChildren} from './shared.d.ts';
+import type {
+ AdminBlockProps$1,
+ PreactCustomElement,
+ RenderImpl,
+} from './shared.d.ts';
/**
- * The properties for the admin block component. These properties configure the heading and collapsed summary of collapsible content blocks in the admin interface.
+ * Configure the following properties on the admin block component.
* @publicDocs
*/
export interface AdminBlockProps
- extends Pick {}
-
-declare const tagName = 's-admin-block';
-
-/**
- * The JSX props for the admin block component. These properties extend `AdminBlockProps` with an optional `id` for element identification in JSX rendering.
- * @publicDocs
- */
-export interface AdminBlockJSXProps
- extends Partial,
- Pick {}
-
-/**
- * The CSS styles as a string, used for styling web components within their shadow DOM.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The implementation configuration for rendering a Preact component into a shadow root. Defines the render function that returns JSX elements and optional CSS styles to apply to the component's shadow DOM.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The render function that returns Preact/JSX elements to display in the component's shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * The optional CSS styles to inject into the component's shadow DOM.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event (such as a click or keyboard press) that describe which modifier keys and mouse buttons were involved. This is used to determine intended behavior like opening links in new tabs when Command/Control is pressed.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was pressed during the activation event.
- */
- shiftKey: boolean;
+ extends Pick {
/**
- * Whether the Meta key (Command on Mac, Windows key on Windows) was pressed during the activation event.
+ * The text displayed as the block's title in the header. If not provided, the extension name will be used.
*/
- metaKey: boolean;
+ heading: AdminBlockProps$1['heading'];
/**
- * Whether the Control key was pressed during the activation event.
+ * The summary text displayed when the app block is collapsed. Summaries longer than 30 characters will be truncated.
*/
- ctrlKey: boolean;
- /**
- * The mouse button that was pressed during the activation event. `0` for primary button (left click), `1` for auxiliary button (middle click), `2` for secondary button (right click).
- */
- button: number;
+ collapsedSummary: AdminBlockProps$1['collapsedSummary'];
}
-/**
- * The options for controlling how a synthetic click behaves. Allows passing modifier key states and button information from an original event to influence link behavior such as opening in new tabs or background tabs.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The activation event (such as a click or keyboard event) whose modifier key state and button information should influence the synthetic click behavior. For example, passing an event with `metaKey: true` will cause links to open in a new tab.
- */
- sourceEvent?: ActivationEventEsque;
-}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare const tagName = 's-admin-block';
+export interface AdminBlockJSXProps
+ extends Partial,
+ Pick {}
+
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
/**
- * The admin block custom element class that renders a collapsible content block in the Shopify admin interface. This component organizes content into expandable sections with headings and provides a summary when collapsed.
+ * Configure the following properties on the admin block component.
+ * @publicDocs
*/
declare class AdminBlock
- extends PreactCustomElement
+ extends PolarisCustomElement
implements AdminBlockProps
{
- /**
- * The heading text to display at the top of the block. This title describes the content section the merchant is viewing. If not provided, no heading is displayed.
- */
heading: string;
-
- /**
- * The summary text to display when the block is collapsed. This provides merchants with a preview of the block's contents without expanding it. If not provided, no summary is displayed.
- */
collapsedSummary: string;
-
constructor();
}
declare global {
diff --git a/packages/ui-extensions/src/surfaces/admin/components/AdminPrintAction.d.ts b/packages/ui-extensions/src/surfaces/admin/components/AdminPrintAction.d.ts
index cca98e64c7..f5790035e8 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/AdminPrintAction.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/AdminPrintAction.d.ts
@@ -1,135 +1,54 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///
-import type {AdminPrintActionProps$1, ComponentChildren} from './shared.d.ts';
+import type {
+ AdminPrintActionProps$1,
+ PreactCustomElement,
+ RenderImpl,
+} from './shared.d.ts';
/**
- * The properties for the admin print action component. These properties configure the source URL for printing content within admin extensions.
+ * Configure the following properties on the admin print action component.
* @publicDocs
*/
export interface AdminPrintActionProps
- extends Pick {}
+ extends Pick {
+ /**
+ * The URL of the document to preview and print. Supports HTML, PDF, and image formats.
+ * If not provided, the preview will show an empty state and the print button will be disabled.
+ */
+ src: AdminPrintActionProps$1['src'];
+}
declare const tagName = 's-admin-print-action';
-
-/**
- * The JSX props for the admin print action component. These properties extend `AdminPrintActionProps` with an optional `id` for element identification in JSX rendering.
- * @publicDocs
- */
export interface AdminPrintActionJSXProps
extends Partial,
Pick {}
-/**
- * The CSS styles as a string, used for styling web components within their shadow DOM.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The implementation configuration for rendering a Preact component into a shadow root. Defines the render function that returns JSX elements and optional CSS styles to apply to the component's shadow DOM.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The render function that returns Preact/JSX elements to display in the component's shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * The optional CSS styles to inject into the component's shadow DOM.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event (such as a click or keyboard press) that describe which modifier keys and mouse buttons were involved. This is used to determine intended behavior like opening links in new tabs when Command/Control is pressed.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was pressed during the activation event.
- */
- shiftKey: boolean;
- /**
- * Whether the Meta key (Command on Mac, Windows key on Windows) was pressed during the activation event.
- */
- metaKey: boolean;
- /**
- * Whether the Control key was pressed during the activation event.
- */
- ctrlKey: boolean;
- /**
- * The mouse button that was pressed during the activation event. `0` for primary button (left click), `1` for auxiliary button (middle click), `2` for secondary button (right click).
- */
- button: number;
-}
-/**
- * The options for controlling how a synthetic click behaves. Allows passing modifier key states and button information from an original event to influence link behavior such as opening in new tabs or background tabs.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The activation event (such as a click or keyboard event) whose modifier key state and button information should influence the synthetic click behavior. For example, passing an event with `metaKey: true` will cause links to open in a new tab.
- */
- sourceEvent?: ActivationEventEsque;
-}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
-
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
/**
- * The admin print action custom element class that renders a print interface in the Shopify admin. This component enables merchants to print content from a specified source URL using the browser's print functionality.
+ * Configure the following properties on the admin print action component.
+ * @publicDocs
*/
declare class AdminPrintAction
- extends PreactCustomElement
+ extends PolarisCustomElement
implements AdminPrintActionProps
{
/**
- * The source URL of the content to print. This should point to the document or page that'll be sent to the printer when the merchant initiates the print action.
+ * The `src` URL of the preview and the document to print. If not provided, the preview will show an empty state and the print button will be disabled. HTML, PDFs, and images are supported.
*/
src: string;
-
constructor();
}
declare global {
diff --git a/packages/ui-extensions/src/surfaces/admin/components/AppNav.d.ts b/packages/ui-extensions/src/surfaces/admin/components/AppNav.d.ts
index 359288d2bc..d3f5a20b75 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/AppNav.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/AppNav.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.67.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -10,9 +10,42 @@ import type {
PreactCustomElement,
RenderImpl,
} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
export interface AppNavProps {}
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
+
declare const tagName = 's-app-nav';
export interface AppNavJSXProps
extends Partial,
@@ -20,6 +53,10 @@ export interface AppNavJSXProps
declare class PolarisCustomElement extends PreactCustomElement {
constructor(renderImpl: Omit);
+ /** @private */
+ connectedCallback(): void;
+ /** @private */
+ adoptedCallback(): void;
}
declare class AppNav extends PolarisCustomElement implements AppNavProps {
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Avatar.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Avatar.d.ts
index ffa9595c85..357423c188 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Avatar.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Avatar.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -6,146 +6,124 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///
-import type {AvatarProps$1, ComponentChildren} from './shared.d.ts';
+import type {
+ AvatarProps$1,
+ PreactCustomElement,
+ RenderImpl,
+} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
+
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
/**
- * The properties for the avatar component. An avatar displays a user or entity image with fallback initials when the image isn't available. Properties include `src` for the image URL, `initials` for the fallback text, `alt` for accessibility text, and `size` for controlling the avatar dimensions.
- * @publicDocs
+ * Configure the following properties on the avatar component.
*/
export interface AvatarProps
extends Required> {
/**
- * The initials to display when no image is provided or if the image fails to load. This typically includes the first letter of a user's first and last name (for example, `'JD'` for John Doe).
- */
- initials: AvatarProps$1['initials'];
- /**
- * The URL of the avatar image to display. You can provide an absolute or relative URL pointing to the image file.
- */
- src: AvatarProps$1['src'];
- /**
- * Alternative text that describes the avatar for screen readers. This text should identify who or what the avatar represents.
- */
- alt: AvatarProps$1['alt'];
- /**
- * The size of the avatar. Choose from `'small-200'`, `'small'`, `'base'`, `'large'`, or `'large-200'` to control the avatar dimensions.
+ * The size of the avatar image.
*
- * @default 'base'
+ * - `small-200`: Extra small avatar, suitable for compact displays or lists with many items.
+ * - `small-100`: Alias of `small`.
+ * - `small`: Small avatar, good for secondary contexts or tight layouts.
+ * - `base`: Default size that works well in most contexts.
+ * - `large`: Large avatar for emphasis or when the avatar is a focal point.
+ * - `large-100`: Alias of `large`.
+ * - `large-200`: Extra large avatar for prominent display.
*/
size: Extract<
AvatarProps$1['size'],
- 'small-200' | 'small' | 'base' | 'large' | 'large-200'
+ | 'small-200'
+ | 'small-100'
+ | 'small'
+ | 'base'
+ | 'large'
+ | 'large-100'
+ | 'large-200'
>;
-}
-
-/**
- * A string containing CSS styles for a custom element.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The configuration for rendering a custom element with Preact.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The function that renders the shadow root content.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * The optional CSS styles to apply to the shadow root.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event, such as a click or keypress. These properties capture which modifier keys were pressed and which mouse button was used during the event.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the shift key was pressed during the event.
- */
- shiftKey: boolean;
/**
- * Whether the meta key (Command on Mac, Windows key on Windows) was pressed during the event.
+ * Alternative text that describes the avatar for accessibility.
+ *
+ * Provides a text description of the avatar for users with assistive technology
+ * and serves as a fallback when the avatar fails to load. A well-written description
+ * enables people with visual impairments to understand non-text content.
+ *
+ * When a screen reader encounters an avatar, it reads this description aloud.
+ * When an avatar fails to load, this text displays on screen, helping all users
+ * understand what content was intended.
+ *
+ * Learn more about [writing effective alt text](https://www.shopify.com/ca/blog/image-alt-text#4)
+ * and the [alt attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#alt).
*/
- metaKey: boolean;
+ alt: Required['alt'];
/**
- * Whether the control key was pressed during the event.
+ * The URL or path to the avatar image. When provided, the image takes priority over `initials`.
+ * If the image fails to load or loads slowly, `initials` will be rendered as a fallback.
*/
- ctrlKey: boolean;
+ src: Required['src'];
/**
- * The mouse button that was pressed (0 for left, 1 for middle, 2 for right).
+ * The initials to display in the avatar when no image is provided or fails to load.
+ * Typically one or two characters representing a person's first and last name initials, such as "JD" for John Doe.
*/
- button: number;
+ initials: Required['initials'];
}
-/**
- * The options for triggering a synthetic click event.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The original user event (such as a click or keyboard event) that triggered this programmatic click. When provided, the component preserves important event properties like modifier keys (Ctrl, Shift, Alt, Meta) and mouse button states, enabling behaviors such as opening links in a new tab when middle-clicked or Ctrl+clicked.
- */
- sourceEvent?: ActivationEventEsque;
-}
-/**
- * The base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of `HTMLElement` to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-/**
- * An abstract base class for creating custom elements that render with Preact.
- */
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queues a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to `@property` values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in a background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
/**
- * A callback event that's typed to a specific HTML element.
+ * An event object with a strongly-typed `currentTarget` property that references the specific HTML element that triggered the event.
+ *
+ * This type extends the standard DOM `Event` interface and ensures type safety when accessing the element that fired the event.
* @publicDocs
*/
export type CallbackEvent = Event & {
- /**
- * The element that currently has the event listener attached.
- */
currentTarget: HTMLElementTagNameMap[T];
};
/**
- * An event listener for callback events, typed to a specific HTML element.
+ * A function that handles events from UI components.
+ *
+ * This type represents an event listener callback that receives a `CallbackEvent` with a strongly-typed `currentTarget`. Use this for component event handlers like `click`, `focus`, `blur`, and other DOM events.
+ *
+ * @example
+ * const handleClick: CallbackEventListener<'button'> = (event) => {
+ * console.log('Button clicked:', event.currentTarget);
+ * };
* @publicDocs
*/
export type CallbackEventListener =
@@ -154,51 +132,38 @@ export type CallbackEventListener =
})
| null;
/**
- * The base properties for Preact elements that don't have children, providing essential attributes like keys and refs for component management.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
export interface PreactBaseElementProps {
/**
- * A unique identifier for this element within its parent. Preact uses keys to optimize rendering performance when lists change by tracking which items have been added, removed, or reordered.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
key?: preact.Key;
/**
- * 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.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
ref?: preact.Ref;
/**
- * Assigns this element to a named slot in a parent component that uses shadow DOM or slot-based composition patterns.
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
slot?: Lowercase;
}
/**
- * An avatar displays a user or entity image with fallback initials when the image isn't available.
+ * Configure the following properties on the avatar component.
+ * @publicDocs
*/
-declare class Avatar extends PreactCustomElement implements AvatarProps {
- /**
- * The initials to display when no image is provided or if the image fails to load.
- */
+declare class Avatar extends PolarisCustomElement implements AvatarProps {
accessor initials: AvatarProps['initials'];
- /**
- * The URL of the avatar image to display.
- */
accessor src: AvatarProps['src'];
- /**
- * The size of the avatar.
- */
accessor size: AvatarProps['size'];
- /**
- * Alternative text that describes the avatar for screen readers.
- */
accessor alt: AvatarProps['alt'];
- /**
- * A callback that's fired when the avatar image has loaded successfully.
- */
accessor onload: CallbackEventListener | null;
- /**
- * A callback that's fired when the avatar image fails to load.
- */
accessor onerror: OnErrorEventHandler;
constructor();
}
@@ -216,19 +181,15 @@ declare module 'preact' {
}
declare const tagName = 's-avatar';
-/**
- * The properties for the avatar component when it's used in JSX.
- * @publicDocs
- */
export interface AvatarJSXProps
extends Partial,
Pick {
/**
- * A callback that's fired when the avatar image has loaded successfully.
+ * A callback fired when the avatar image loads successfully.
*/
onLoad?: () => void;
/**
- * A callback that's fired when the avatar image fails to load.
+ * A callback fired when the avatar image fails to load.
*/
onError?: () => void;
}
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Badge.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Badge.d.ts
index d1a0d99533..3ab4d685a8 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Badge.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Badge.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -11,30 +11,68 @@ import type {
IconProps$1,
BadgeProps$1,
IconType,
+ PreactCustomElement,
+ RenderImpl,
} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
+
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
/**
- * The configuration for icons used within Badge components. Defines the visual appearance, size, and semantic meaning of icons displayed in badges.
- * @publicDocs
+ * Configure the following properties on the icon component.
*/
export interface IconProps
- extends Pick<
- IconProps$1,
- 'type' | 'tone' | 'color' | 'size' | 'interestFor'
+ extends Required<
+ Pick
> {
/**
- * The type of icon to display inside the badge. Use any valid icon name from the admin icon set, an empty string for no icon, or `'empty'` to reserve space for an icon without displaying one.
+ * The icon to display from the icon library.
+ *
+ * Set to a valid icon name to display that icon. To hide the icon completely,
+ * use an empty string `''`. To reserve the icon's space without displaying an icon,
+ * use `'empty'`.
*/
type: '' | IconType | 'empty';
/**
- * Determines the color used for the icon based on semantic meaning. Available options:
- * - `'auto'` - Lets the system automatically choose the appropriate tone based on context.
- * - `'neutral'` - Gray styling for general information.
- * - `'info'` - Blue styling for informational content.
- * - `'success'` - Green styling for positive states.
- * - `'caution'` - Yellow styling for situations that need attention.
- * - `'warning'` - Orange styling for important notices.
- * - `'critical'` - Red styling for errors and urgent issues.
+ * The semantic meaning and color treatment of the component.
+ *
+ * - `info`: Informational content or helpful tips.
+ * - `success`: Positive outcomes or successful states.
+ * - `warning`: Important warnings about potential issues.
+ * - `critical`: Urgent problems or destructive actions.
+ * - `auto`: Automatically determined based on context.
+ * - `neutral`: General information without specific intent.
+ * - `caution`: Advisory notices that need attention.
*
* @default 'auto'
*/
@@ -43,61 +81,62 @@ export interface IconProps
'auto' | 'neutral' | 'info' | 'success' | 'caution' | 'warning' | 'critical'
>;
/**
- * Controls the visual prominence of the icon. Available options:
- * - `'base'` - Standard color intensity for normal emphasis.
- * - `'subdued'` - Reduced color intensity for less emphasis.
+ * The color emphasis level that controls visual intensity.
+ *
+ * - `base`: Primary color for body text, standard UI elements, and general content with good readability.
+ * - `subdued`: Deemphasized color for secondary text, supporting labels, and less critical interface elements.
*
* @default 'base'
*/
color: Extract;
/**
- * Determines the size of the icon. Available options:
- * - `'small'` - Smaller icon size for compact layouts.
- * - `'base'` - Standard icon size for most use cases.
+ * The size of the icon.
*
- * @default 'base'
+ * - `small`: Smaller icon suitable for inline use within text or compact UI elements.
+ * - `base`: Default size that works well for standalone icons and standard use cases.
*/
size: Extract;
}
/**
- * The properties for the badge component. Badges display status information through compact visual indicators with customizable tones, sizes, and optional icons.
- * @publicDocs
+ * Configure the following properties on the badge component.
*/
export interface BadgeProps
extends Pick {
/**
- * Controls the visual weight and emphasis of the badge. Available options:
- * - `'base'` - Standard weight with moderate emphasis, suitable for most use cases.
- * - `'strong'` - Increased visual weight for higher emphasis and prominence.
+ * Controls the visual weight and emphasis of the badge.
+ *
+ * - `base`: Standard weight with moderate emphasis, suitable for most use cases.
+ * - `strong`: Increased visual weight for higher emphasis and prominence.
*
* @default 'base'
*/
color: Extract;
/**
- * The icon to display inside the badge. Accepts any valid icon type or an empty string to display no icon.
+ * An icon displayed inside the badge to provide additional visual context or reinforce the badge's meaning.
+ * Accepts any icon name from the icon library or a custom string identifier.
*
* @default ''
*/
icon: IconProps['type'] | '';
/**
- * Determines the size of the badge. Available options:
- * - `'base'` - Standard size for most use cases.
- * - `'large'` - Larger size for increased visibility and prominence.
- * - `'large-100'` - Extra large size for maximum visibility in specific contexts.
+ * The size of the badge.
*
- * @default 'base'
+ * - `base`: Default size suitable for most badge use cases.
+ * - `large`: Larger badge for increased visibility and prominence.
+ * - `large-100`: Extra large badge for maximum visibility in emphasized contexts.
*/
size: Extract;
/**
- * Determines the visual appearance and semantic meaning of the badge. Badges rely on the tone system for semantic meaning, so using custom styling might not clearly convey meaning to merchants. Available options:
- * - `'auto'` - Lets the system automatically choose the appropriate tone based on context.
- * - `'neutral'` - Gray styling for general status information that doesn't require emphasis.
- * - `'info'` - Blue styling for informational content and neutral updates.
- * - `'success'` - Green styling for positive states, completed actions, and successful operations.
- * - `'caution'` - Yellow styling for situations that need attention but aren't urgent.
- * - `'warning'` - Orange styling for important notices that require merchant awareness.
- * - `'critical'` - Red styling for errors, failures, and urgent issues requiring immediate action.
+ * The semantic meaning and color treatment of the component.
+ *
+ * - `info`: Informational content or helpful tips.
+ * - `success`: Positive outcomes or successful states.
+ * - `warning`: Important warnings about potential issues.
+ * - `critical`: Urgent problems or destructive actions.
+ * - `auto`: Automatically determined based on context.
+ * - `neutral`: General information without specific intent.
+ * - `caution`: Advisory notices that need attention.
*
* @default 'auto'
*/
@@ -107,149 +146,65 @@ export interface BadgeProps
>;
}
-/**
- * The CSS styles as a string, used for styling web components within their shadow DOM.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The implementation configuration for rendering a Preact component into a shadow root. Defines the render function that returns JSX elements and optional CSS styles to apply to the component's shadow DOM.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The render function that returns Preact/JSX elements to display in the component's shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * The optional CSS styles to inject into the component's shadow DOM.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event (such as a click or keyboard press) that describe which modifier keys and mouse buttons were involved. This is used to determine intended behavior like opening links in new tabs when Command/Control is pressed.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was pressed during the activation event.
- */
- shiftKey: boolean;
- /**
- * Whether the Meta key (Command on Mac, Windows key on Windows) was pressed during the activation event.
- */
- metaKey: boolean;
- /**
- * Whether the Control key was pressed during the activation event.
- */
- ctrlKey: boolean;
- /**
- * The mouse button that was pressed during the activation event. `0` for primary button (left click), `1` for auxiliary button (middle click), `2` for secondary button (right click).
- */
- button: number;
-}
-/**
- * The options for controlling how a synthetic click behaves. Allows passing modifier key states and button information from an original event to influence link behavior such as opening in new tabs or background tabs.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The activation event (such as a click or keyboard event) whose modifier key state and button information should influence the synthetic click behavior. For example, passing an event with `metaKey: true` will cause links to open in a new tab.
- */
- sourceEvent?: ActivationEventEsque;
-}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
-
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
+}
+
+declare abstract class BadgeBase
+ extends PolarisCustomElement
+ implements Pick
+{
+ accessor color: BadgeProps['color'];
+ accessor size: BadgeProps['size'];
+ abstract tone: string;
+ abstract icon: string;
+ constructor(renderImpl: Omit);
}
/**
- * The base properties for Preact elements without children. Provides key, ref, and slot properties for element identification, DOM access, and slot-based positioning.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
export interface PreactBaseElementProps {
/**
- * A unique identifier for the element when used in lists. Preact uses keys for efficient rendering and reconciliation when lists change.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
key?: preact.Key;
/**
- * A reference to the underlying DOM element. Typically created with `useRef()` to access the element directly for imperative operations like focusing or measuring.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
ref?: preact.Ref;
/**
- * The named slot this element should be placed in when used within a web component. Learn more about [using slots](/docs/api/polaris/using-polaris-web-components#slots).
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
slot?: Lowercase;
}
/**
- * The base properties for Preact elements with children. Extends `PreactBaseElementProps` with the ability to render child elements.
+ * Base props for Preact custom elements with children support. Extends PreactBaseElementProps with the ability to render child elements.
* @publicDocs
*/
export interface PreactBaseElementPropsWithChildren
extends PreactBaseElementProps {
/**
- * The child elements to render within this component.
+ * The child elements to be rendered within this component.
*/
children?: preact.ComponentChildren;
}
/**
- * The badge custom element class that renders status indicators in the Shopify admin interface. This component displays compact visual indicators with customizable tones, sizes, and optional icons to communicate status information to merchants.
+ * Configure the following properties on the badge component.
+ * @publicDocs
*/
-declare class Badge extends PreactCustomElement implements BadgeProps {
- /**
- * The visual weight of the badge. Available options: `'base'` for standard weight or `'strong'` for increased emphasis.
- */
- accessor color: BadgeProps['color'];
- /**
- * The icon to display inside the badge. Accepts any valid icon type from the admin icon set, or an empty string to display no icon.
- */
+declare class Badge extends BadgeBase implements BadgeProps {
accessor icon: BadgeProps['icon'];
- /**
- * The size of the badge. Available options: `'base'` for standard size, `'large'` for larger size, or `'large-100'` for extra large size.
- */
- accessor size: BadgeProps['size'];
- /**
- * The tone that determines the badge's visual appearance and semantic meaning. Available options: `'auto'`, `'neutral'`, `'info'`, `'success'`, `'caution'`, `'warning'`, or `'critical'`.
- */
accessor tone: BadgeProps['tone'];
constructor();
}
@@ -267,15 +222,11 @@ declare module 'preact' {
}
declare const tagName = 's-badge';
-/**
- * The JSX props for the badge component. These properties extend `BadgeProps` with an optional `id` and `children` for rendering badge content in JSX.
- * @publicDocs
- */
export interface BadgeJSXProps
extends Partial,
Pick {
/**
- * The text content to display inside the badge. Typically a short status label like "Fulfilled", "Draft", or "Active".
+ * The text label displayed within the badge component, typically a short status indicator or category label.
*/
children?: ComponentChildren;
}
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Banner.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Banner.d.ts
index bc53b6c290..75b99874b6 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Banner.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Banner.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -6,20 +6,33 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///
-import type {ComponentChildren, BannerProps$1} from './shared.d.ts';
+import type {
+ ComponentChildren,
+ BannerProps$1,
+ PreactCustomElement,
+ RenderImpl,
+} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
/**
- * A callback event that's typed to a specific HTML element.
+ * An event object with a strongly-typed `currentTarget` property that references the specific HTML element that triggered the event.
+ *
+ * This type extends the standard DOM `Event` interface and ensures type safety when accessing the element that fired the event.
* @publicDocs
*/
export type CallbackEvent = Event & {
- /**
- * The element that currently has the event listener attached.
- */
currentTarget: HTMLElementTagNameMap[T];
};
/**
- * An event listener for callback events, typed to a specific HTML element.
+ * A function that handles events from UI components.
+ *
+ * This type represents an event listener callback that receives a `CallbackEvent` with a strongly-typed `currentTarget`. Use this for component event handlers like `click`, `focus`, `blur`, and other DOM events.
+ *
+ * @example
+ * const handleClick: CallbackEventListener<'button'> = (event) => {
+ * console.log('Button clicked:', event.currentTarget);
+ * };
* @publicDocs
*/
export type CallbackEventListener =
@@ -28,43 +41,77 @@ export type CallbackEventListener =
})
| null;
/**
- * The base properties for Preact elements that don't have children, providing essential attributes like keys and refs for component management.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
export interface PreactBaseElementProps {
/**
- * A unique identifier for this element within its parent. Preact uses keys to optimize rendering performance when lists change by tracking which items have been added, removed, or reordered.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
key?: preact.Key;
/**
- * 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.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
ref?: preact.Ref;
/**
- * Assigns this element to a named slot in a parent component that uses shadow DOM or slot-based composition patterns.
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
slot?: Lowercase;
}
/**
- * The base properties for Preact elements that have children, extending the base element properties to include child content.
+ * Base props for Preact custom elements with children support. Extends PreactBaseElementProps with the ability to render child elements.
* @publicDocs
*/
export interface PreactBaseElementPropsWithChildren
extends PreactBaseElementProps {
/**
- * The child elements to render inside this element.
+ * The child elements to be rendered within this component.
*/
children?: preact.ComponentChildren;
}
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
+
/**
- * All properties for the banner component marked as required.
+ * Represents the banner component props with all properties marked as required.
* @publicDocs
*/
export type RequiredBannerProps = Required;
/**
- * The properties for the banner component. These properties define an important message or notification with visual styling that conveys its semantic meaning.
- * @publicDocs
+ * Configure the following properties on the banner component.
*/
export interface BannerProps
extends Pick<
@@ -72,7 +119,13 @@ export interface BannerProps
'heading' | 'dismissible' | 'hidden' | 'tone'
> {
/**
- * The color tone of the banner based on its semantic meaning.
+ * The semantic meaning and color treatment of the component.
+ *
+ * - `info`: Informational content or helpful tips.
+ * - `success`: Positive outcomes or successful states.
+ * - `warning`: Important warnings about potential issues.
+ * - `critical`: Urgent problems or destructive actions.
+ * - `auto`: Automatically determined based on context.
*
* @default 'auto'
*/
@@ -80,129 +133,52 @@ export interface BannerProps
RequiredBannerProps['tone'],
'auto' | 'critical' | 'warning' | 'success' | 'info'
>;
-}
-
-/**
- * A string containing CSS styles for the component.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The implementation details for rendering a custom element with Preact.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
/**
- * The function that renders the component's shadow root content.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * Optional CSS styles to apply to the shadow root.
- */
- styles?: Styles;
-};
-/**
- * An event-like object that contains activation information for synthetic clicks.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the shift key was pressed during activation.
- */
- shiftKey: boolean;
- /**
- * Whether the meta key (Command on Mac, Windows key on Windows) was pressed during activation.
+ * The heading text displayed at the top of the banner.
+ *
+ * @default ''
*/
- metaKey: boolean;
+ heading: RequiredBannerProps['heading'];
/**
- * Whether the control key was pressed during activation.
+ * Whether the banner displays a close button that allows users to dismiss it.
+ *
+ * When the close button is pressed, the `dismiss` event fires, then `hidden` is set to `true`,
+ * any animation completes, and the `afterhide` event fires.
+ *
+ * @default false
*/
- ctrlKey: boolean;
+ dismissible: RequiredBannerProps['dismissible'];
/**
- * The mouse button that was pressed during activation.
- */
- button: number;
-}
-/**
- * Options for customizing synthetic click behavior.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The original user event (such as a click or keyboard event) that triggered this programmatic click. When provided, the component preserves important event properties like modifier keys (Ctrl, Shift, Alt, Meta) and mouse button states, enabling behaviors such as opening links in a new tab when middle-clicked or Ctrl+clicked.
+ * Controls whether the banner is visible or hidden.
+ *
+ * When using a controlled component pattern and the banner is `dismissible`,
+ * update this property to `true` when the `dismiss` event fires.
+ *
+ * You can hide the banner programmatically by setting this to `true` even if it's not `dismissible`.
+ *
+ * @default false
*/
- sourceEvent?: ActivationEventEsque;
+ hidden: RequiredBannerProps['hidden'];
}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
/**
- * A custom element for displaying important messages and notifications.
+ * Configure the following properties on the banner component.
+ * @publicDocs
*/
-declare class Banner extends PreactCustomElement implements BannerProps {
- /**
- * The heading text displayed at the top of the banner.
- */
+declare class Banner extends PolarisCustomElement implements BannerProps {
accessor heading: BannerProps['heading'];
- /**
- * The color tone of the banner based on its semantic meaning.
- */
accessor tone: BannerProps['tone'];
- /**
- * Whether the banner is hidden from view.
- */
accessor hidden: BannerProps['hidden'];
- /**
- * Whether the banner can be dismissed by the user.
- */
accessor dismissible: BannerProps['dismissible'];
- /**
- * A callback that's fired when the banner is dismissed.
- */
accessor ondismiss: CallbackEventListener | null;
- /**
- * A callback that's fired after the banner finishes hiding.
- */
accessor onafterhide: CallbackEventListener | null;
constructor();
}
@@ -221,27 +197,26 @@ declare module 'preact' {
}
declare const tagName = 's-banner';
-/**
- * The JSX properties for the banner component. These properties define how a banner is rendered in Preact or JSX.
- * @publicDocs
- */
export interface BannerJSXProps
extends Partial,
Pick {
/**
- * The content of the banner.
+ * The main message content displayed within the banner component, providing important information or guidance to users.
*/
children?: ComponentChildren;
/**
- * The secondary actions to display at the bottom of the banner. Only buttons with the `variant` of `'secondary'` or `'auto'` are allowed. A maximum of two `s-button` components can be provided.
+ * Action buttons displayed at the bottom of the banner that let users respond to the message.
+ * Accepts up to two button components with `variant="secondary"` or `variant="auto"`.
*/
secondaryActions?: ComponentChildren;
/**
- * A callback that's fired when the banner is dismissed.
+ * A callback fired when the user dismisses the banner by clicking the close button.
+ * Use this to update your app state and control the banner's visibility.
*/
onDismiss?: ((event: CallbackEvent) => void) | null;
/**
- * A callback that's fired after the banner finishes hiding.
+ * A callback fired when the banner is completely hidden, after any hide animations have completed.
+ * Use this to perform cleanup or trigger subsequent actions after the banner is no longer visible.
*/
onAfterHide?: ((event: CallbackEvent) => void) | null;
}
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Box.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Box.d.ts
index af7e829eb5..fe3aec7fe6 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Box.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Box.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -12,10 +12,45 @@ import type {
SizeUnitsOrAuto,
SizeUnits,
SizeUnitsOrNone,
+ PreactCustomElement,
+ RenderImpl,
} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
+
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
/**
- * A type that allows a value to be responsive using container query syntax.
+ * Makes a type responsive by allowing it to be either the base value or a container query string. This enables conditional styling based on container dimensions.
* @publicDocs
*/
export type MakeResponsive = T | `@container${string}`;
@@ -41,12 +76,21 @@ export type MakeResponsivePick = {
};
/**
- * A version of the box properties with all fields required.
+ * Represents the box component props with all properties marked as required.
* @publicDocs
*/
export type RequiredBoxProps = Required;
/**
- * The allowed border radius values for a box component.
+ * Represents the subset of border radius values supported by the component.
+ *
+ * - `small-200`: Extra small radius for subtle rounding.
+ * - `small-100`: Small radius for minimal corner rounding.
+ * - `small`: Standard small radius.
+ * - `base`: Medium radius for moderate corner rounding.
+ * - `large`: Standard large radius for pronounced rounding.
+ * - `large-100`: Large radius for more prominent corner rounding.
+ * - `large-200`: Extra large radius for maximum rounding.
+ * - `none`: No border radius (sharp corners).
* @publicDocs
*/
export type BoxBorderRadii = Extract<
@@ -61,7 +105,12 @@ export type BoxBorderRadii = Extract<
| 'large-200'
>;
/**
- * The allowed border style values for a box component.
+ * Represents the subset of border style values supported by the box component.
+ *
+ * - `auto`: Default border style determined by the system.
+ * - `none`: No border style (removes the border).
+ * - `solid`: Continuous line border.
+ * - `dashed`: Border made up of dashes.
* @publicDocs
*/
export type BoxBorderStyles = Extract<
@@ -69,7 +118,9 @@ export type BoxBorderStyles = Extract<
'none' | 'solid' | 'dashed' | 'auto'
>;
/**
- * The box properties that support responsive values through container queries.
+ * Represents box props with responsive capabilities for layout properties.
+ *
+ * This enables conditional styling based on container queries.
* @publicDocs
*/
export type ResponsiveBoxProps = MakeResponsivePick<
@@ -83,10 +134,6 @@ export type ResponsiveBoxProps = MakeResponsivePick<
| 'paddingInlineEnd'
| 'display'
>;
-/**
- * The properties for the box component. A box provides control over layout, spacing, sizing, borders, and background styling for its content.
- * @publicDocs
- */
export interface BoxProps
extends Pick<
RequiredBoxProps,
@@ -108,7 +155,7 @@ export interface BoxProps
| 'overflow'
> {
/**
- * The background color of the box. You can choose from `'transparent'`, `'base'`, `'subdued'`, or `'strong'` to control the visual emphasis of the background.
+ * The background color of the component.
*
* @default 'transparent'
*/
@@ -117,16 +164,13 @@ export interface BoxProps
'transparent' | 'base' | 'subdued' | 'strong'
>;
/**
- * Controls the thickness of the border on all sides. When set, this overrides the width value specified in the `border` property.
+ * A border applied using shorthand syntax to specify width, color, and style in a single property.
*
- * - `small`: Thin border for subtle definition.
- * - `small-100`: Extra thin border for minimal emphasis.
- * - `base`: Standard border width.
- * - `large`: Thick border for strong emphasis.
- * - `large-100`: Extra thick border for maximum prominence.
- * - `none`: No border.
- *
- * Supports [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box) for specifying different widths per side.
+ * @default 'none'
+ */
+ border: RequiredBoxProps['border'];
+ /**
+ * The thickness of the border on all sides. When set, this overrides the width value specified in the `border` property.
*
* @default '' - meaning no override
*/
@@ -139,11 +183,7 @@ export interface BoxProps
>
| Extract;
/**
- * Controls the visual style of the border on all sides (solid, dashed, auto, or none).
- *
- * When set, this overrides the style value specified in the `border` property.
- * Supports [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box)for specifying different styles per side: one value applies to all sides,
- * two values apply to block and inline sides, and so on.
+ * The visual style of the border on all sides, such as solid, dashed, or dotted. When set, this overrides the style value specified in the `border` property.
*
* @default '' - meaning no override
*/
@@ -151,10 +191,7 @@ export interface BoxProps
| MaybeAllValuesShorthandProperty
| Extract;
/**
- * Controls the color of the border using the design system's color scale.
- *
- * When set, this overrides the color value specified in the `border` property.
- * Choose from `subdued`, `base`, or `strong` to match the visual emphasis needed.
+ * The color of the border using the design system's color scale. When set, this overrides the color value specified in the `border` property.
*
* @default '' - meaning no override
*/
@@ -163,64 +200,94 @@ export interface BoxProps
'subdued' | 'base' | 'strong' | ''
>;
/**
- * Controls the roundedness of the element's corners using the design system's radius scale.
- *
- * Supports [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box) for specifying different radii per corner. Use this to create rounded corners or fully rounded elements.
- * One value applies to all corners, two values apply to opposite corners, and so on.
+ * The roundedness of the element's corners using the design system's radius scale.
*
* @default 'none'
*/
borderRadius: MaybeAllValuesShorthandProperty;
/**
- * The padding on all sides of the box. The [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box) is supported, using flow-relative values in the order `block-start inline-end block-end inline-start`. For example, `'large'` applies large padding to all sides, while `'large none'` applies large padding to the block axis and no padding to the inline axis. A value of `'auto'` will use the default padding from the closest container that has had its padding removed. This property also accepts responsive values using container query syntax.
+ * The padding applied to all edges of the component.
+ *
+ * Supports [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box) using flow-relative values:
+ * - 1 value applies to all sides
+ * - 2 values apply to block (top/bottom) and inline (left/right)
+ * - 3 values apply to block-start (top), inline (left/right), and block-end (bottom)
+ * - 4 values apply to block-start (top), inline-end (right), block-end (bottom), and inline-start (left)
+ *
+ * **Examples:** `base`, `large none`, `base large-100 base small`
+ *
+ * Use `auto` to inherit padding from the nearest container with removed padding. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default 'none'
*/
padding: ResponsiveBoxProps['padding'];
/**
- * The padding on the block axis (top and bottom in horizontal writing modes). This property overrides the block-axis value set by the `padding` property. For example, `'large none'` applies large padding to the block-start and no padding to the block-end. This property also accepts responsive values using container query syntax.
+ * The block-direction padding (top and bottom in horizontal writing modes).
+ *
+ * Accepts a single value for both sides or two space-separated values for block-start and block-end.
+ *
+ * **Example:** `large none` applies `large` to the top and `none` to the bottom.
+ *
+ * Overrides the block value from `padding`. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default '' - meaning no override
*/
paddingBlock: ResponsiveBoxProps['paddingBlock'];
/**
- * The padding at the start of the block axis (top in horizontal writing modes). This property overrides the block-start value set by the `paddingBlock` property. It also accepts responsive values using container query syntax.
+ * The block-start padding (top in horizontal writing modes).
+ *
+ * Overrides the block-start value from `paddingBlock`. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default '' - meaning no override
*/
paddingBlockStart: ResponsiveBoxProps['paddingBlockStart'];
/**
- * The padding at the end of the block axis (bottom in horizontal writing modes). This property overrides the block-end value set by the `paddingBlock` property. It also accepts responsive values using container query syntax.
+ * The block-end padding (bottom in horizontal writing modes).
+ *
+ * Overrides the block-end value from `paddingBlock`. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default '' - meaning no override
*/
paddingBlockEnd: ResponsiveBoxProps['paddingBlockEnd'];
/**
- * The padding on the inline axis (left and right in horizontal writing modes). This property overrides the inline-axis value set by the `padding` property. For example, `'large none'` applies large padding to the inline-start and no padding to the inline-end. This property also accepts responsive values using container query syntax.
+ * The inline-direction padding (left and right in horizontal writing modes).
+ *
+ * Accepts a single value for both sides or two space-separated values for inline-start and inline-end.
+ *
+ * **Example:** `large none` applies `large` to the left and `none` to the right.
+ *
+ * Overrides the inline value from `padding`. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default '' - meaning no override
*/
paddingInline: ResponsiveBoxProps['paddingInline'];
/**
- * The padding at the start of the inline axis (left in left-to-right writing modes). This property overrides the inline-start value set by the `paddingInline` property. It also accepts responsive values using container query syntax.
+ * The inline-start padding (left in LTR writing modes, right in RTL).
+ *
+ * Overrides the inline-start value from `paddingInline`. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default '' - meaning no override
*/
paddingInlineStart: ResponsiveBoxProps['paddingInlineStart'];
/**
- * The padding at the end of the inline axis (right in left-to-right writing modes). This property overrides the inline-end value set by the `paddingInline` property. It also accepts responsive values using container query syntax.
+ * The inline-end padding (right in LTR writing modes, left in RTL).
+ *
+ * Overrides the inline-end value from `paddingInline`. Also accepts a [responsive value](/docs/api/polaris/using-polaris-web-components#responsive-values) string with the supported `PaddingKeyword` as a query value.
*
* @default '' - meaning no override
*/
paddingInlineEnd: ResponsiveBoxProps['paddingInlineEnd'];
/**
- * The outer [display](https://developer.mozilla.org/en-US/docs/Web/CSS/display) type of the component, which controls how it participates in [flow layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout). Use `'auto'` for the component's default behavior, or `'none'` to hide the component completely and remove it from the accessibility tree.
+ * The outer [display](https://developer.mozilla.org/en-US/docs/Web/CSS/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).
+ *
+ * - `auto` the component's initial value. The actual value depends on the component and context.
+ * - `none` hides the component from display and removes it from the accessibility tree, making it invisible to screen readers.
*
* @default 'auto'
*/
display: ResponsiveBoxProps['display'];
/**
- * The vertical size of the box in standard layouts (height in left-to-right or right-to-left writing modes).
+ * The vertical size of the element in standard layouts (height in left-to-right or right-to-left writing modes).
*
* Block size adjusts based on the writing direction: in horizontal layouts, it controls the height;
* in vertical layouts, it controls the width. This ensures consistent behavior across different text directions.
@@ -231,275 +298,123 @@ export interface BoxProps
*/
blockSize: SizeUnitsOrAuto;
/**
- * The [minimum block size](https://developer.mozilla.org/en-US/docs/Web/CSS/min-block-size) of the box (minimum height in horizontal writing modes).
+ * The minimum height in horizontal writing modes, or minimum width in vertical writing modes.
+ * Prevents the element from shrinking below this size.
+ *
+ * Learn more about [min-block-size](https://developer.mozilla.org/en-US/docs/Web/CSS/min-block-size).
*
* @default '0'
*/
minBlockSize: SizeUnits;
/**
- * The [maximum block size](https://developer.mozilla.org/en-US/docs/Web/CSS/max-block-size) of the box (maximum height in horizontal writing modes).
+ * The maximum height in horizontal writing modes, or maximum width in vertical writing modes.
+ * Prevents the element from growing beyond this size.
+ *
+ * Learn more about [max-block-size](https://developer.mozilla.org/en-US/docs/Web/CSS/max-block-size).
*
* @default 'none'
*/
maxBlockSize: SizeUnitsOrNone;
/**
- * The [inline size](https://developer.mozilla.org/en-US/docs/Web/CSS/inline-size) of the box (width in horizontal writing modes).
+ * The width in horizontal writing modes, or height in vertical writing modes.
+ * Use this for flow-relative sizing that adapts to text direction. Learn more about [inline-size](https://developer.mozilla.org/en-US/docs/Web/CSS/inline-size).
*
* @default 'auto'
*/
inlineSize: SizeUnitsOrAuto;
/**
- * The [minimum inline size](https://developer.mozilla.org/en-US/docs/Web/CSS/min-inline-size) of the box (minimum width in horizontal writing modes).
+ * The minimum width in horizontal writing modes, or minimum height in vertical writing modes.
+ * Prevents the element from shrinking below this size.
+ *
+ * Learn more about [min-inline-size](https://developer.mozilla.org/en-US/docs/Web/CSS/min-inline-size).
*
* @default '0'
*/
minInlineSize: SizeUnits;
/**
- * The [maximum inline size](https://developer.mozilla.org/en-US/docs/Web/CSS/max-inline-size) of the box (maximum width in horizontal writing modes).
+ * The maximum width in horizontal writing modes, or maximum height in vertical writing modes.
+ * Prevents the element from growing beyond this size.
+ *
+ * Learn more about [max-inline-size](https://developer.mozilla.org/en-US/docs/Web/CSS/max-inline-size).
*
* @default 'none'
*/
maxInlineSize: SizeUnitsOrNone;
}
-/**
- * A string containing CSS styles for a custom element.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The configuration for rendering a custom element with Preact.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The function that renders the shadow root content.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * The optional CSS styles to apply to the shadow root.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event, such as a click or keypress. These properties capture which modifier keys were pressed and which mouse button was used during the event.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the shift key was pressed during the event.
- */
- shiftKey: boolean;
- /**
- * Whether the meta key (Command on Mac, Windows key on Windows) was pressed during the event.
- */
- metaKey: boolean;
- /**
- * Whether the control key was pressed during the event.
- */
- ctrlKey: boolean;
- /**
- * The mouse button that was pressed (0 for left, 1 for middle, 2 for right).
- */
- button: number;
-}
-/**
- * The options for triggering a synthetic click event.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The original user event (such as a click or keyboard event) that triggered this programmatic click. When provided, the component preserves important event properties like modifier keys (Ctrl, Shift, Alt, Meta) and mouse button states, enabling behaviors such as opening links in a new tab when middle-clicked or Ctrl+clicked.
- */
- sourceEvent?: ActivationEventEsque;
-}
-/**
- * The base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of `HTMLElement` to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-/**
- * An abstract base class for creating custom elements that render with Preact.
- */
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
-
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
-/**
- * The base element class for Box components with all Box properties as accessors.
- */
-declare class BoxElement extends PreactCustomElement implements BoxProps {
+declare class BoxElement extends PolarisCustomElement implements BoxProps {
constructor(renderImpl: RenderImpl);
- /**
- * The ARIA role that defines the semantic meaning of the box for assistive technologies.
- */
accessor accessibilityRole: BoxProps['accessibilityRole'];
- /**
- * The background color of the box using the design system's color scale. Choose from `transparent`, `subdued`, `base`, or `strong`.
- */
accessor background: BoxProps['background'];
- /**
- * The height of the box in horizontal writing modes, or width in vertical writing modes.
- * Use this for flow-relative sizing that adapts to text direction.
- */
accessor blockSize: BoxProps['blockSize'];
- /**
- * The minimum height of the box in horizontal writing modes, or minimum width in vertical writing modes.
- * Prevents the box from shrinking below this size.
- */
accessor minBlockSize: BoxProps['minBlockSize'];
- /**
- * The maximum height of the box in horizontal writing modes, or maximum width in vertical writing modes.
- * Prevents the box from growing beyond this size.
- */
accessor maxBlockSize: BoxProps['maxBlockSize'];
- /**
- * The width of the box in horizontal writing modes, or height in vertical writing modes.
- * Use this for flow-relative sizing that adapts to text direction.
- */
accessor inlineSize: BoxProps['inlineSize'];
- /**
- * The minimum width of the box in horizontal writing modes, or minimum height in vertical writing modes.
- * Prevents the box from shrinking below this size.
- */
accessor minInlineSize: BoxProps['minInlineSize'];
- /**
- * The maximum width of the box in horizontal writing modes, or maximum height in vertical writing modes.
- * Prevents the box from growing beyond this size.
- */
accessor maxInlineSize: BoxProps['maxInlineSize'];
- /**
- * Controls how content that exceeds the box's boundaries is displayed. Use `hidden` to clip overflow or `visible` to allow content to extend beyond boundaries.
- */
accessor overflow: BoxProps['overflow'];
- /**
- * The padding on all sides of the box.
- */
accessor padding: BoxProps['padding'];
- /**
- * The vertical padding (top and bottom) in horizontal writing modes.
- * Use this for flow-relative padding that adapts to text direction.
- */
accessor paddingBlock: BoxProps['paddingBlock'];
- /**
- * The padding at the top in horizontal writing modes, or at the start edge in vertical writing modes.
- */
accessor paddingBlockStart: BoxProps['paddingBlockStart'];
- /**
- * The padding at the bottom in horizontal writing modes, or at the end edge in vertical writing modes.
- */
accessor paddingBlockEnd: BoxProps['paddingBlockEnd'];
- /**
- * The horizontal padding (left and right) in horizontal writing modes.
- * Use this for flow-relative padding that adapts to text direction.
- */
accessor paddingInline: BoxProps['paddingInline'];
- /**
- * The padding at the left in left-to-right languages, or at the right in right-to-left languages.
- */
accessor paddingInlineStart: BoxProps['paddingInlineStart'];
- /**
- * The padding at the right in left-to-right languages, or at the left in right-to-left languages.
- */
accessor paddingInlineEnd: BoxProps['paddingInlineEnd'];
- /**
- * Applies a border using shorthand syntax to specify width, color, and style in a single property.
- */
accessor border: BoxProps['border'];
- /**
- * Controls the thickness of the border on all sides. When set, this overrides the width value specified in the `border` property.
- */
accessor borderWidth: BoxProps['borderWidth'];
- /**
- * Controls the visual style of the border on all sides (solid, dashed, auto, or none). When set, this overrides the style value specified in the `border` property.
- */
accessor borderStyle: BoxProps['borderStyle'];
- /**
- * Controls the color of the border using the design system's color scale. When set, this overrides the color value specified in the `border` property.
- */
accessor borderColor: BoxProps['borderColor'];
- /**
- * Controls the roundedness of the element's corners using the design system's radius scale.
- */
accessor borderRadius: BoxProps['borderRadius'];
- /**
- * The accessibility label for screen readers.
- */
accessor accessibilityLabel: BoxProps['accessibilityLabel'];
- /**
- * Controls the visibility of the box for both visual and assistive technology users. Use `hidden` to hide from screen readers or `exclusive` to hide visually but announce to screen readers.
- */
accessor accessibilityVisibility: BoxProps['accessibilityVisibility'];
- /**
- * Controls how the box is displayed in the layout, such as block, inline, or none.
- */
accessor display: BoxProps['display'];
}
/**
- * The base properties for Preact elements that don't have children, providing essential attributes like keys and refs for component management.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
export interface PreactBaseElementProps {
/**
- * A unique identifier for this element within its parent. Preact uses keys to optimize rendering performance when lists change by tracking which items have been added, removed, or reordered.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
key?: preact.Key;
/**
- * 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.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
ref?: preact.Ref;
/**
- * Assigns this element to a named slot in a parent component that uses shadow DOM or slot-based composition patterns.
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
slot?: Lowercase;
}
/**
- * The base properties for Preact elements that have children, extending the base element properties to include child content.
+ * Base props for Preact custom elements with children support. Extends PreactBaseElementProps with the ability to render child elements.
* @publicDocs
*/
export interface PreactBaseElementPropsWithChildren
extends PreactBaseElementProps {
- /** The child elements to render inside this element. */
+ /**
+ * The child elements to be rendered within this component.
+ */
children?: preact.ComponentChildren;
}
/**
- * A box is a container component that provides control over layout, spacing, and styling.
+ * Configure the following properties on the box component.
+ * @publicDocs
*/
declare class Box extends BoxElement implements BoxProps {
constructor();
@@ -518,15 +433,11 @@ declare module 'preact' {
}
declare const tagName = 's-box';
-/**
- * The properties for the box component when it's used in JSX.
- * @publicDocs
- */
export interface BoxJSXProps
extends Partial,
Pick {
/**
- * The child elements to render inside the box.
+ * The content displayed within the box component, which serves as a flexible container for organizing and styling other components.
*/
children?: ComponentChildren;
}
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Button.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Button.d.ts
index 605f4a20eb..70dbea29c0 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Button.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Button.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -12,20 +12,30 @@ import type {
ButtonProps$1,
IconType,
InteractionProps,
+ PreactCustomElement,
+ RenderImpl,
} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
/**
- * A callback event with a strongly-typed `currentTarget` property that corresponds to a specific HTML element. This provides better type safety when handling events from custom elements.
+ * An event object with a strongly-typed `currentTarget` property that references the specific HTML element that triggered the event.
+ *
+ * This type extends the standard DOM `Event` interface and ensures type safety when accessing the element that fired the event.
* @publicDocs
*/
export type CallbackEvent = Event & {
- /**
- * The element that the event listener is attached to, strongly typed based on the element's tag name.
- */
currentTarget: HTMLElementTagNameMap[T];
};
/**
- * An event listener function type for callback events with a strongly-typed `currentTarget`. This ensures the event handler receives the correct element type.
+ * A function that handles events from UI components.
+ *
+ * This type represents an event listener callback that receives a `CallbackEvent` with a strongly-typed `currentTarget`. Use this for component event handlers like `click`, `focus`, `blur`, and other DOM events.
+ *
+ * @example
+ * const handleClick: CallbackEventListener<'button'> = (event) => {
+ * console.log('Button clicked:', event.currentTarget);
+ * };
* @publicDocs
*/
export type CallbackEventListener =
@@ -34,57 +44,95 @@ export type CallbackEventListener =
})
| null;
/**
- * The base properties for Preact elements without children. Provides `key`, `ref`, and `slot` properties for element identification, DOM access, and slot-based positioning.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
export interface PreactBaseElementProps {
/**
- * A unique identifier for the element when used in lists. Preact uses keys for efficient rendering and reconciliation when lists change.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
key?: preact.Key;
/**
- * A reference to the underlying DOM element. Typically created with `useRef()` to access the element directly for imperative operations like focusing or measuring.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
ref?: preact.Ref;
/**
- * The named slot this element should be placed in when used within a web component. Learn more about [using slots](/docs/api/polaris/using-polaris-web-components#slots).
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
slot?: Lowercase;
}
/**
- * The base properties for Preact elements with children. Extends `PreactBaseElementProps` with the ability to render child elements.
+ * Base props for Preact custom elements with children support. Extends PreactBaseElementProps with the ability to render child elements.
* @publicDocs
*/
export interface PreactBaseElementPropsWithChildren
extends PreactBaseElementProps {
/**
- * The child elements to render within this component.
+ * The child elements to be rendered within this component.
*/
children?: preact.ComponentChildren;
}
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
+
/**
- * The configuration for icons used within Button components. Defines the visual appearance, size, and semantic meaning of icons displayed in buttons.
- * @publicDocs
+ * Configure the following properties on the icon component.
*/
export interface IconProps
- extends Pick<
- IconProps$1,
- 'type' | 'tone' | 'color' | 'size' | 'interestFor'
+ extends Required<
+ Pick
> {
/**
- * Specifies the type of icon that will be displayed.
+ * The icon to display from the icon library.
+ *
+ * Set to a valid icon name to display that icon. To hide the icon completely,
+ * use an empty string `''`. To reserve the icon's space without displaying an icon,
+ * use `'empty'`.
*/
type: '' | IconType | 'empty';
/**
- * Determines the color used for the icon based on semantic meaning. Available options:
- * - `'auto'` - Lets the system automatically choose the appropriate tone based on context.
- * - `'neutral'` - Gray styling for general information.
- * - `'info'` - Blue styling for informational content.
- * - `'success'` - Green styling for positive states.
- * - `'caution'` - Yellow styling for situations that need attention.
- * - `'warning'` - Orange styling for important notices.
- * - `'critical'` - Red styling for errors and urgent issues.
+ * The semantic meaning and color treatment of the component.
+ *
+ * - `info`: Informational content or helpful tips.
+ * - `success`: Positive outcomes or successful states.
+ * - `warning`: Important warnings about potential issues.
+ * - `critical`: Urgent problems or destructive actions.
+ * - `auto`: Automatically determined based on context.
+ * - `neutral`: General information without specific intent.
+ * - `caution`: Advisory notices that need attention.
*
* @default 'auto'
*/
@@ -93,25 +141,25 @@ export interface IconProps
'auto' | 'neutral' | 'info' | 'success' | 'caution' | 'warning' | 'critical'
>;
/**
- * Controls the visual prominence of the icon. Available options:
- * - `'base'` - Standard color intensity for normal emphasis.
- * - `'subdued'` - Reduced color intensity for less emphasis.
+ * The color emphasis level that controls visual intensity.
+ *
+ * - `base`: Primary color for body text, standard UI elements, and general content with good readability.
+ * - `subdued`: Deemphasized color for secondary text, supporting labels, and less critical interface elements.
*
* @default 'base'
*/
color: Extract;
/**
- * Determines the size of the icon. Available options:
- * - `'small'` - Smaller icon size for compact layouts.
- * - `'base'` - Standard icon size for most use cases.
+ * The size of the icon.
*
- * @default 'base'
+ * - `small`: Smaller icon suitable for inline use within text or compact UI elements.
+ * - `base`: Default size that works well for standalone icons and standard use cases.
*/
size: Extract;
}
/**
- * The button-specific properties extracted from the base button props type, used internally for type safety.
+ * Represents button props that are specific to button-type elements only. Extracts the subset of `ButtonProps` that includes the `type` property.
* @publicDocs
*/
export type ButtonOnlyProps = Extract<
@@ -121,7 +169,7 @@ export type ButtonOnlyProps = Extract<
}
>;
/**
- * The base required properties for the button component, including all essential button configuration options. This type ensures all button properties have default values.
+ * Represents the base button props with all properties marked as required.
* @publicDocs
*/
export type ButtonBaseProps = Required<
@@ -141,138 +189,69 @@ export type ButtonBaseProps = Required<
| 'target'
| 'href'
| 'download'
+ | 'inlineSize'
>
>;
/**
- * The properties for the button component. Buttons trigger actions or navigation when clicked, with customizable visual styles, states, and optional icons.
- * @publicDocs
+ * Configure the following properties on the button component.
*/
export interface ButtonProps extends ButtonBaseProps {
/**
- * Determines the visual appearance and semantic meaning of the button. Buttons rely on the tone system for semantic meaning, so using custom styling might not clearly convey intent to merchants. Available options:
- * - `'auto'` - Lets the system automatically choose the appropriate tone based on context.
- * - `'neutral'` - Standard styling for general actions without specific semantic meaning.
- * - `'critical'` - Red styling for destructive actions that can't be undone, such as deleting data.
+ * The semantic meaning and color treatment of the component.
+ *
+ * - `critical`: Urgent problems or destructive actions.
+ * - `auto`: Automatically determined based on context.
+ * - `neutral`: General information without specific intent.
*
* @default 'auto'
*/
tone: Extract;
/**
- * The icon to display inside the button. Accepts any valid icon type or an empty string to display no icon.
+ * An icon displayed inside the button, typically positioned before the button text.
+ * Use icons to help users quickly identify the button's action or to improve scannability.
+ * Accepts any icon name from the icon library or a custom string identifier.
*
* @default ''
*/
icon: IconProps['type'];
-}
-
-/**
- * The CSS styles as a string, used for styling web components within their shadow DOM.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * The implementation configuration for rendering a Preact component into a shadow root. Defines the render function that returns JSX elements and optional CSS styles to apply to the component's shadow DOM.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * The render function that returns Preact/JSX elements to display in the component's shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
/**
- * The optional CSS styles to inject into the component's shadow DOM.
- */
- styles?: Styles;
-};
-/**
- * The properties of an activation event (such as a click or keyboard press) that describe which modifier keys and mouse buttons were involved. This is used to determine intended behavior like opening links in new tabs when Command/Control is pressed.
- * @publicDocs
- */
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was pressed during the activation event.
- */
- shiftKey: boolean;
- /**
- * Whether the Meta key (Command on Mac, Windows key on Windows) was pressed during the activation event.
- */
- metaKey: boolean;
- /**
- * Whether the Control key was pressed during the activation event.
+ * A label that describes the purpose or content of the component for assistive technologies like screen readers. Use this to provide additional context when the visible content alone doesn't clearly convey the component's purpose.
*/
- ctrlKey: boolean;
+ accessibilityLabel: Required['accessibilityLabel'];
/**
- * The mouse button that was pressed during the activation event. `0` for primary button (left click), `1` for auxiliary button (middle click), `2` for secondary button (right click).
+ * The visual appearance of the button component.
+ *
+ * - `auto`: The variant is automatically determined by the button component's context.
+ * - `primary`: High emphasis button for the primary action on the page. Should be used sparingly.
+ * - `secondary`: Medium emphasis button for secondary actions.
+ * - `tertiary`: Low emphasis button for less important actions.
+ *
+ * @default 'auto'
*/
- button: number;
-}
-/**
- * The options for controlling how a synthetic click behaves. Allows passing modifier key states and button information from an original event to influence link behavior such as opening in new tabs or background tabs.
- * @publicDocs
- */
-export interface ClickOptions {
+ variant: Required['variant'];
/**
- * The activation event (such as a click or keyboard event) whose modifier key state and button information should influence the synthetic click behavior. For example, passing an event with `metaKey: true` will cause links to open in a new tab.
+ * The language of the text content. Use this when the text is in a different language than the rest of the page, allowing assistive technologies such as screen readers to invoke the correct pronunciation. The value should be a valid language subtag from the [IANA language subtag registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).
*/
- sourceEvent?: ActivationEventEsque;
+ lang: Required['lang'];
}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
-/**
- * The properties for controlling overlay interactions via commands. These properties enable buttons to control other components like modals, popovers, and dialogs using declarative commands.
- * @publicDocs
- */
export interface PreactOverlayControlProps
extends Pick {
/**
- * Sets the action the [command](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#command) should take when this button is activated. Available options:
- * - `'--auto'`: Performs the default action appropriate for the target component.
- * - `'--show'`: Displays the target component if it's currently hidden.
- * - `'--hide'`: Conceals the target component from view.
- * - `'--toggle'`: Alternates the target component between visible and hidden states.
+ * The action that [command](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#command) should take when this component is activated.
*
- * The supported actions vary by target component type.
+ * - `--auto`: A default action for the target component.
+ * - `--show`: Shows the target component.
+ * - `--hide`: Hides the target component.
+ * - `--toggle`: Toggles the visibility of the target component.
*
* @default '--auto'
*/
@@ -281,78 +260,59 @@ export interface PreactOverlayControlProps
'--show' | '--hide' | '--toggle' | '--auto'
>;
/**
- * Sets the element ID that the [commandFor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#commandfor) should act on when this button is activated. References another component by its `id` attribute.
+ * The component that [commandFor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#commandfor) should act on when this component is activated.
*/
commandFor: Extract;
/**
- * Sets the element ID that the [interestFor](https://open-ui.org/components/interest-invokers.explainer/#the-pitch-in-code) should act on when this button is activated. Used for interest-based interactions with other components.
+ * The ID of the component to show when users hover over or focus on this component. Use this to connect interactive components to popovers or tooltips that provide additional context or information.
*/
interestFor: Extract;
}
-/**
- * The base class for the button component, combining Preact custom element functionality with overlay control capabilities.
- */
-declare const Button_base: (abstract new (
- args_0: RenderImpl,
-) => PreactCustomElement & PreactOverlayControlProps) &
- Pick;
-/**
- * The button custom element class that renders interactive buttons in the Shopify admin interface. This component triggers actions or navigation when clicked, with customizable visual styles, states, and optional icons.
- */
-declare class Button extends Button_base implements ButtonProps {
- /**
- * Whether the button is disabled, preventing any interaction. When `true`, the button appears visually disabled and doesn't respond to user clicks.
- */
+declare const ButtonBase_base: (abstract new (
+ renderImpl: Omit,
+) => PolarisCustomElement & PreactOverlayControlProps) &
+ Pick;
+declare abstract class ButtonBase
+ extends ButtonBase_base
+ implements
+ Pick<
+ ButtonProps,
+ | 'disabled'
+ | 'loading'
+ | 'target'
+ | 'href'
+ | 'download'
+ | 'type'
+ | 'accessibilityLabel'
+ | 'inlineSize'
+ >
+{
accessor disabled: ButtonProps['disabled'];
- /**
- * The icon to display inside the button. Accepts any valid icon type from the admin icon set, or an empty string to display no icon.
- */
- accessor icon: ButtonProps['icon'];
- /**
- * Whether the button is in a loading state. When `true`, displays a loading indicator and prevents interaction to show that an action is in progress.
- */
accessor loading: ButtonProps['loading'];
- /**
- * The visual style variant of the button that determines its emphasis. Available options: `'primary'`, `'secondary'`, `'tertiary'`, or `'plain'`.
- */
- accessor variant: ButtonProps['variant'];
- /**
- * The tone that determines the button's visual appearance and semantic meaning. Available options: `'auto'`, `'neutral'`, or `'critical'`.
- */
- accessor tone: ButtonProps['tone'];
- /**
- * Specifies where to open the linked document when the button acts as a link. Available options: `''`, `'_blank'`, `'_self'`, `'_parent'`, or `'_top'`.
- */
accessor target: ButtonProps['target'];
- /**
- * A URL that the button should navigate to when clicked. When provided, the button behaves as a link.
- */
accessor href: ButtonProps['href'];
- /**
- * Prompts the user to save the linked URL as a file with the specified filename. Only works when `href` is provided.
- */
accessor download: ButtonProps['download'];
- /**
- * A callback that's invoked when the button is clicked. Receives the click event as an argument.
- */
- accessor onclick: CallbackEventListener | null;
- /**
- * A callback that's invoked when the button loses focus. Receives the blur event as an argument.
- */
- accessor onblur: CallbackEventListener | null;
- /**
- * A callback that's invoked when the button receives focus. Receives the focus event as an argument.
- */
- accessor onfocus: CallbackEventListener | null;
- /**
- * The button's behavior in forms. Available options: `'button'`, `'submit'`, or `'reset'`.
- */
accessor type: ButtonProps['type'];
- /**
- * A text description of the button's purpose for screen readers. This is essential for accessibility when the button doesn't have visible text.
- */
accessor accessibilityLabel: ButtonProps['accessibilityLabel'];
+ accessor inlineSize: ButtonProps['inlineSize'];
+ accessor onclick: CallbackEventListener | null;
+ accessor onblur: CallbackEventListener | null;
+ accessor onfocus: CallbackEventListener | null;
+ abstract icon: string;
+ abstract variant: string;
+ abstract tone: string;
+ constructor(renderImpl: RenderImpl);
+}
+
+/**
+ * Configure the following properties on the button component.
+ * @publicDocs
+ */
+declare class Button extends ButtonBase implements ButtonProps {
+ accessor icon: ButtonProps['icon'];
+ accessor variant: ButtonProps['variant'];
+ accessor tone: ButtonProps['tone'];
constructor();
}
declare global {
@@ -369,95 +329,25 @@ declare module 'preact' {
}
declare const tagName = 's-button';
-/**
- * The JSX props for the button component. These properties extend `ButtonProps` with event callbacks and additional options for rendering buttons in JSX.
- * @publicDocs
- */
export interface ButtonJSXProps
extends Partial,
Pick {
/**
- * The text label or content to display inside the button. Can be plain text or other components.
+ * The label text or elements displayed inside the button component, describing the action that will be performed when clicked.
*/
children?: ComponentChildren;
/**
- * Callback function that's invoked when the button is clicked. Receives the click event as an argument.
+ * A callback fired when the button is clicked.
*/
onClick?: ((event: CallbackEvent) => void) | null;
/**
- * Callback function that's invoked when the button receives focus. Receives the focus event as an argument.
+ * A callback fired when the button receives focus.
*/
onFocus?: ((event: CallbackEvent) => void) | null;
/**
- * Callback function that's invoked when the button loses focus. Receives the blur event as an argument.
+ * A callback fired when the button loses focus.
*/
onBlur?: ((event: CallbackEvent) => void) | null;
- /**
- * A label that describes the purpose or content of the component for assistive technologies like screen readers. Use this to provide additional context when the visible content alone doesn't clearly convey the component's purpose.
- *
- * @default ''
- */
- accessibilityLabel?: string;
- /**
- * Prevents the button from being clicked when set to `true`. The button appears visually disabled and doesn't respond to user interaction.
- *
- * @default false
- */
- disabled?: boolean;
- /**
- * Displays a loading indicator and prevents interaction when set to `true`. Use this to show that an action triggered by the button is in progress.
- *
- * @default false
- */
- loading?: boolean;
- /**
- * Determines the visual style and emphasis of the button. Available options:
- * - `'primary'` - Highest emphasis for the main action on a screen.
- * - `'secondary'` - Medium emphasis for secondary actions.
- * - `'tertiary'` - Lowest emphasis for less important actions.
- * - `'plain'` - Text-only appearance for subtle actions that don't need visual weight.
- *
- * @default 'secondary'
- */
- variant?: ButtonProps['variant'];
- /**
- * Specifies where to open the linked document when the button acts as a link (when `href` is provided). Available options:
- * - `''` - Opens in the same frame (default behavior).
- * - `'_blank'` - Opens in a new window or tab.
- * - `'_self'` - Opens in the same frame (explicit version of default).
- * - `'_parent'` - Opens in the parent frame.
- * - `'_top'` - Opens in the full body of the window.
- *
- * @default ''
- */
- target?: ButtonProps['target'];
- /**
- * A URL that the button should navigate to when clicked. When provided, the button behaves as a link.
- *
- * @default ''
- */
- href?: ButtonProps['href'];
- /**
- * Prompts the user to save the linked URL as a file with the specified filename. Only works when `href` is provided.
- *
- * @default ''
- */
- download?: ButtonProps['download'];
- /**
- * Specifies the button's behavior in forms. Available options:
- * - `'button'` - A standard button with no default behavior.
- * - `'submit'` - Submits the form data to the server.
- * - `'reset'` - Resets all form controls to their initial values.
- *
- * @default 'button'
- */
- type?: ButtonProps['type'];
- /**
- * The language of the button's content, specified as a BCP 47 language tag (such as `'en'` or `'fr'`). This helps assistive technologies pronounce content correctly.
- *
- * @default ''
- */
- lang?: ButtonProps['lang'];
}
export {Button};
diff --git a/packages/ui-extensions/src/surfaces/admin/components/ButtonGroup.d.ts b/packages/ui-extensions/src/surfaces/admin/components/ButtonGroup.d.ts
index 812d0bad41..a462a3122f 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/ButtonGroup.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/ButtonGroup.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -6,157 +6,132 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///
-import type {ComponentChildren, ButtonGroupProps$1} from './shared.d.ts';
+import type {
+ ComponentChildren,
+ ButtonGroupProps$1,
+ PreactCustomElement,
+ RenderImpl,
+} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
-/**
- * Properties for rendering a button group that arranges multiple buttons together with consistent spacing and semantic grouping.
- * @publicDocs
- */
-export interface ButtonGroupProps
- extends Required> {}
-
-/**
- * CSS styles that will be applied to the component's shadow DOM.
- * @publicDocs
- */
-export type Styles = string;
-/**
- * Configuration for rendering a custom element with Preact and shadow DOM.
- * @publicDocs
- */
-export type RenderImpl = Omit & {
- /**
- * A function that renders the component's content inside the shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * CSS styles that will be applied to the shadow DOM.
- */
- styles?: Styles;
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
+
/**
- * Information about modifier keys and mouse buttons that were active during an interaction.
- * @publicDocs
+ * Configure the following properties on the button group component.
*/
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was held down during the interaction.
- */
- shiftKey: boolean;
- /**
- * Whether the Meta key (Command on Mac, Windows key on PC) was held down during the interaction.
- */
- metaKey: boolean;
- /**
- * Whether the Control key was held down during the interaction.
- */
- ctrlKey: boolean;
+export interface ButtonGroupProps
+ extends Required> {
/**
- * The mouse button that was pressed during the interaction.
+ * A label that describes the purpose or content of the component for assistive technologies like screen readers. Use this to provide additional context when the visible content alone doesn't clearly convey the component's purpose.
+ *
+ * @implementation Used as a hidden heading or an aria-label on the wrapping element.
*/
- button: number;
-}
-/**
- * Options for influencing how a programmatic click behaves.
- * @publicDocs
- */
-export interface ClickOptions {
+ accessibilityLabel: Required['accessibilityLabel'];
/**
- * The original user event (such as a click or keyboard event) that triggered this programmatic click. When provided, the component preserves important event properties like modifier keys (Ctrl, Shift, Alt, Meta) and mouse button states, enabling behaviors such as opening links in a new tab when middle-clicked or Ctrl+clicked.
+ * The spacing between buttons in the group.
+ *
+ * - `base`: Standard spacing that provides clear visual separation between buttons.
+ * - `none`: No spacing, creating a connected button group.
+ *
+ * @default 'base'
*/
- sourceEvent?: ActivationEventEsque;
+ gap: Required['gap'];
}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
+}
+
+declare abstract class ButtonGroupBase
+ extends PolarisCustomElement
+ implements Pick
+{
+ accessor gap: ButtonGroupProps['gap'];
+ accessor accessibilityLabel: ButtonGroupProps['accessibilityLabel'];
+ constructor(renderImpl: RenderImpl);
/**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
+ * Actions whose translucent fill can't paint over a seam, so the neighbour
+ * has to be told not to draw it. The foundation resolves the list.
* @private
- * @param options
*/
- click({sourceEvent}?: ClickOptions): void;
+ setInertActions(actions: ReadonlyArray): void;
+ /** @private */
+ disconnectedCallback(): void;
}
/**
- * The base properties for Preact elements that don't have children, providing essential attributes like keys and refs for component management.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
export interface PreactBaseElementProps {
/**
- * A unique identifier for this element within its parent. Preact uses keys to optimize rendering performance when lists change by tracking which items have been added, removed, or reordered.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
key?: preact.Key;
/**
- * 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.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
ref?: preact.Ref;
/**
- * Assigns this element to a named slot in a parent component that uses shadow DOM or slot-based composition patterns.
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
slot?: Lowercase;
}
-
/**
- * The base properties for Preact elements that have children, extending the base element properties to include child content.
+ * Base props for Preact custom elements with children support. Extends PreactBaseElementProps with the ability to render child elements.
* @publicDocs
*/
export interface PreactBaseElementPropsWithChildren
extends PreactBaseElementProps {
/**
- * The child elements or content that will be rendered inside this element.
+ * The child elements to be rendered within this component.
*/
children?: preact.ComponentChildren;
}
/**
- * A button group that arranges multiple buttons together with consistent spacing and semantic grouping for related actions.
+ * Configure the following properties on the button group component.
+ * @publicDocs
*/
-declare class ButtonGroup
- extends PreactCustomElement
- implements ButtonGroupProps
-{
- /**
- * The amount of spacing between buttons in the group, affecting the visual separation of actions.
- */
- accessor gap: ButtonGroupProps['gap'];
-
- /**
- * A label that's only visible to screen readers, describing the purpose of this group of buttons.
- */
- accessor accessibilityLabel: ButtonGroupProps['accessibilityLabel'];
-
+declare class ButtonGroup extends ButtonGroupBase implements ButtonGroupProps {
constructor();
}
declare global {
@@ -177,28 +152,25 @@ declare module 'preact' {
}
declare const tagName = 's-button-group';
-
-/**
- * Properties for using the button group component in JSX with React-style props.
- * @publicDocs
- */
export interface ButtonGroupJSXProps
extends Partial,
Pick {
/**
- * The buttons that should be grouped together, provided as Button components.
+ * The buttons displayed within the button group component, which are arranged together as a cohesive set of related actions.
*/
children?: ComponentChildren;
/**
- * A single primary action button that's visually emphasized as the most important action in the group.
+ * The main action for this group, displayed with high visual emphasis.
+ * Accepts a single button with `variant="primary"`.
*
- * Accepts a single Button element with a `variant` of `primary`. Can't be used when `gap` is set to `none`.
+ * Use this for the primary action you want users to take. This can't be used when `gap="none"`.
*/
primaryAction?: ComponentChildren;
/**
- * One or more secondary action buttons that provide alternative or less prominent actions.
+ * Supporting actions displayed with less emphasis than the primary action.
+ * Accepts one or more button components with `variant="secondary"` or `variant="auto"`.
*
- * Accepts Button elements with a `variant` of `secondary` or `auto`.
+ * Use these for alternative or less critical actions.
*/
secondaryActions?: ComponentChildren;
}
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Checkbox.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Checkbox.d.ts
index 9ffb8f8199..92dea30555 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Checkbox.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Checkbox.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -9,21 +9,30 @@
import type {
TextFieldProps,
CheckboxProps$1,
- ComponentChildren,
+ PreactCustomElement,
+ RenderImpl,
} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
/**
- * An event that includes a strongly-typed reference to the element that triggered it.
+ * An event object with a strongly-typed `currentTarget` property that references the specific HTML element that triggered the event.
+ *
+ * This type extends the standard DOM `Event` interface and ensures type safety when accessing the element that fired the event.
* @publicDocs
*/
export type CallbackEvent = Event & {
- /**
- * The element that the event handler was attached to.
- */
currentTarget: HTMLElementTagNameMap[T];
};
/**
- * A function that handles events for a specific element type, or null if no handler is set.
+ * A function that handles events from UI components.
+ *
+ * This type represents an event listener callback that receives a `CallbackEvent` with a strongly-typed `currentTarget`. Use this for component event handlers like `click`, `focus`, `blur`, and other DOM events.
+ *
+ * @example
+ * const handleClick: CallbackEventListener<'button'> = (event) => {
+ * console.log('Button clicked:', event.currentTarget);
+ * };
* @publicDocs
*/
export type CallbackEventListener =
@@ -31,170 +40,113 @@ export type CallbackEventListener =
(event: CallbackEvent): void;
})
| null;
-/** Used when an element does not have children. * @publicDocs
- */
-export interface PreactBaseElementProps {
- /**
- * A unique identifier for this element within its parent. Preact uses keys to optimize rendering performance when lists change by tracking which items have been added, removed, or reordered.
- */
- key?: preact.Key;
- /**
- * 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.
- */
- ref?: preact.Ref;
- /**
- * Assigns this element to a named slot in a parent component that uses shadow DOM or slot-based composition patterns.
- */
- slot?: Lowercase;
-}
-
/**
- * CSS styles that will be applied to the component's shadow DOM.
- * @publicDocs
+ * Props for field slot content (label, error, details) that accept
+ * either a string or JSX content in the React wrapper.
+ *
+ * Internal use only — not exported publicly. External consumers receive
+ * string-only types via FieldSlotPreactProps.
*/
-export type Styles = string;
+export interface FieldSlotInternalReactProps {
+ error?: preact.ComponentChildren;
+ details?: preact.ComponentChildren;
+}
/**
- * Configuration for rendering a custom element with Preact and shadow DOM.
- * @publicDocs
+ * Preact JSX string-only versions of field slot props.
+ * Used in Preact module declarations after Omit-ing the ComponentChildren
+ * versions (required by force-omit-react-slots lint rule).
*/
-export type RenderImpl = Omit & {
- /**
- * A function that renders the component's content inside the shadow root.
- */
- ShadowRoot: (element: any) => ComponentChildren;
- /**
- * CSS styles that will be applied to the shadow DOM.
- */
- styles?: Styles;
-};
+export interface FieldSlotPreactProps {
+ error?: string;
+ details?: string;
+}
/**
- * Information about modifier keys and mouse buttons that were active during an interaction.
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
* @publicDocs
*/
-export interface ActivationEventEsque {
- /**
- * Whether the Shift key was held down during the interaction.
- */
- shiftKey: boolean;
+export interface PreactBaseElementProps {
/**
- * Whether the Meta key (Command on Mac, Windows key on PC) was held down during the interaction.
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
*/
- metaKey: boolean;
+ key?: preact.Key;
/**
- * Whether the Control key was held down during the interaction.
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
*/
- ctrlKey: boolean;
+ ref?: preact.Ref;
/**
- * The mouse button that was pressed during the interaction.
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
*/
- button: number;
+ slot?: Lowercase;
}
-/**
- * Options for influencing how a programmatic click behaves.
- * @publicDocs
- */
-export interface ClickOptions {
- /**
- * The original user event (such as a click or keyboard event) that triggered this programmatic click. When provided, the component preserves important event properties like modifier keys (Ctrl, Shift, Alt, Meta) and mouse button states, enabling behaviors such as opening links in a new tab when middle-clicked or Ctrl+clicked.
- */
- sourceEvent?: ActivationEventEsque;
+
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
}
-/**
- * Base class for creating custom elements with Preact.
- * While this class could be used in both Node and the browser, the constructor will only be used in the browser.
- * So we give it a type of HTMLElement to avoid typing issues later where it's used, which will only happen in the browser.
- */
-declare const BaseClass: typeof globalThis.HTMLElement;
-declare abstract class PreactCustomElement extends BaseClass {
- /** @private */
- static get observedAttributes(): string[];
- constructor({
- styles,
- ShadowRoot: renderFunction,
- delegatesFocus,
- ...options
- }: RenderImpl);
- /** @private */
- setAttribute(name: string, value: string): void;
- /** @private */
- attributeChangedCallback(name: string): void;
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
/** @private */
connectedCallback(): void;
/** @private */
- disconnectedCallback(): void;
- /** @private */
adoptedCallback(): void;
- /**
- * Queue a run of the render function.
- * You shouldn't need to call this manually - it should be handled by changes to @property values.
- * @private
- */
- queueRender(): void;
- /**
- * Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`.
- *
- * For example, if the `sourceEvent` was a middle click, or has particular keys held down,
- * components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
- * @private
- * @param options
- */
- click({sourceEvent}?: ClickOptions): void;
}
declare const internals: unique symbol;
/**
- * The core properties that all input elements need to function within forms.
+ * Represents the essential input props required for Preact-based input elements. Includes properties like `disabled`, `id`, `name`, and `value`.
* @publicDocs
*/
export type PreactInputProps = Required<
Pick
>;
-/**
- * Base class for input elements that participate in form submission.
- */
declare class PreactInputElement
- extends PreactCustomElement
+ extends PolarisCustomElement
implements PreactInputProps
{
- /**
- * Indicates that this element can participate in form submission.
- */
static formAssociated: boolean;
/** @private */
[internals]: ElementInternals;
- /**
- * A callback that's triggered when the input's value changes and the field loses focus.
- */
accessor onchange: CallbackEventListener<'input'>;
- /**
- * A callback that's triggered when the input's value changes as the user types.
- */
accessor oninput: CallbackEventListener<'input'>;
- /**
- * Whether the input is disabled and can't be interacted with.
- */
accessor disabled: PreactInputProps['disabled'];
- /**
- * A unique identifier for the input element.
- */
accessor id: PreactInputProps['id'];
- /**
- * The name that identifies this input when the form is submitted.
- */
accessor name: PreactInputProps['name'];
- /**
- * The current value of the input.
- */
get value(): PreactInputProps['value'];
set value(value: PreactInputProps['value']);
constructor(renderImpl: RenderImpl);
}
-/**
- * Properties that are common to checkbox-style components.
- * @publicDocs
- */
export interface PreactCheckboxProps
extends Required<
Pick<
@@ -211,20 +163,15 @@ export interface PreactCheckboxProps
>
> {
/**
- * The value that's submitted with the form when the checkbox is checked.
+ * The value used in form data when the checkbox is checked.
*/
value: Required['value'];
}
-/**
- * Base class for checkbox-style elements that can be toggled on and off.
- */
declare class PreactCheckboxElement
extends PreactInputElement
implements PreactCheckboxProps
{
- /**
- * Whether the checkbox is currently checked.
- */
+ accessor onblur: CallbackEventListener<'input'>;
get checked(): boolean;
set checked(checked: PreactCheckboxProps['checked']);
/**
@@ -232,29 +179,11 @@ declare class PreactCheckboxElement
*/
get value(): string;
set value(value: string);
- /**
- * Whether the checkbox should be checked when it's first rendered.
- */
accessor defaultChecked: PreactCheckboxProps['defaultChecked'];
- /**
- * A label that's only visible to screen readers, used when the visual label isn't descriptive enough.
- */
accessor accessibilityLabel: PreactCheckboxProps['accessibilityLabel'];
- /**
- * Additional text to provide context or guidance for the checkbox.
- */
accessor details: PreactCheckboxProps['details'];
- /**
- * An error message that's displayed below the checkbox when validation fails.
- */
accessor error: PreactCheckboxProps['error'];
- /**
- * The text that describes what the checkbox is for.
- */
accessor label: PreactCheckboxProps['label'];
- /**
- * Whether the checkbox must be checked before the form can be submitted.
- */
accessor required: PreactCheckboxProps['required'];
/** @private */
formResetCallback(): void;
@@ -263,33 +192,69 @@ declare class PreactCheckboxElement
}
/**
- * Properties for rendering a checkbox that supports checked, unchecked, and indeterminate states for complex selection scenarios.
- * @publicDocs
+ * Configure the following properties on the checkbox component.
*/
export interface CheckboxProps extends PreactCheckboxProps {
/**
- * Whether the checkbox is in an indeterminate state, showing a dash instead of a checkmark to represent a partial selection.
+ * Whether the checkbox displays in an indeterminate state (neither checked nor unchecked),
+ * typically used to indicate partial selection in hierarchical lists.
+ *
+ * This visual state takes priority over the `checked` prop in appearance only.
+ * The form submission value is still determined by the `checked` prop.
+ *
+ * If `indeterminate` has not been explicitly set and hasn't been modified by user interaction,
+ * it returns the value of `defaultIndeterminate`.
*/
indeterminate: Required['indeterminate'];
/**
- * Whether the checkbox should be in an indeterminate state when it's first rendered, useful for partial selection scenarios.
+ * The initial indeterminate state for uncontrolled components. Use this when you want the checkbox to start
+ * in an indeterminate state but don't need to control it afterward.
+ *
+ * This value applies until `indeterminate` is explicitly set or the user changes the checkbox state by clicking.
+ *
+ * @default false
*/
defaultIndeterminate: Required['defaultIndeterminate'];
-}
-
-/**
- * A checkbox that lets users select or deselect an option, with support for an indeterminate state.
- */
-declare class Checkbox extends PreactCheckboxElement implements CheckboxProps {
/**
- * Whether the checkbox is in an indeterminate state, showing a dash instead of a checkmark.
+ * Whether the field needs a value. This requirement adds semantic value
+ * to the field, but it will not cause an error to appear automatically.
+ * If you want to present an error when this field is empty, you can do
+ * so with the `error` property.
+ *
+ * @default false
*/
- get indeterminate(): CheckboxProps['indeterminate'];
- set indeterminate(indeterminate: CheckboxProps['indeterminate']);
+ required: Required['required'];
/**
- * Whether the checkbox should be in an indeterminate state when it's first rendered.
+ * Changes the visibility of the component's label.
+ *
+ * - `visible`: the label is visible to all users.
+ * - `exclusive`: the label is visually hidden but remains in the accessibility tree.
+ *
+ * @default 'visible'
*/
+ labelAccessibilityVisibility: Required['labelAccessibilityVisibility'];
+}
+
+declare abstract class CheckboxBase
+ extends PreactCheckboxElement
+ implements
+ Pick<
+ CheckboxProps,
+ 'defaultIndeterminate' | 'indeterminate' | 'labelAccessibilityVisibility'
+ >
+{
+ get indeterminate(): CheckboxProps['indeterminate'];
+ set indeterminate(indeterminate: CheckboxProps['indeterminate']);
accessor defaultIndeterminate: CheckboxProps['defaultIndeterminate'];
+ accessor labelAccessibilityVisibility: CheckboxProps['labelAccessibilityVisibility'];
+ constructor(renderImpl: RenderImpl);
+}
+
+/**
+ * Configure the following properties on the checkbox component.
+ * @publicDocs
+ */
+declare class Checkbox extends CheckboxBase implements CheckboxProps {
constructor();
}
declare global {
@@ -300,27 +265,27 @@ declare global {
declare module 'preact' {
namespace createElement.JSX {
interface IntrinsicElements {
- [tagName]: CheckboxJSXProps & PreactBaseElementProps;
+ [tagName]: Omit &
+ FieldSlotPreactProps &
+ PreactBaseElementProps;
}
}
}
declare const tagName = 's-checkbox';
-/**
- * Props for using the checkbox component in JSX with React-style event handlers.
- * @publicDocs
- */
export interface CheckboxJSXProps
- extends Partial,
- Pick {
+ extends Partial>,
+ Pick,
+ FieldSlotInternalReactProps {
/**
- * A callback that's triggered when the checkbox's checked state changes and it loses focus.
+ * A callback fired when the checkbox state changes and the user has finished interacting with it.
*/
onChange?: ((event: CallbackEvent) => void) | null;
/**
- * A callback that's triggered when the checkbox's checked state changes.
+ * A callback fired when the checkbox state changes, including intermediate states during user interaction.
*/
onInput?: ((event: CallbackEvent) => void) | null;
+ onBlur?: ((event: CallbackEvent) => void) | null;
}
export {Checkbox};
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Chip.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Chip.d.ts
index 6401010a8a..3c99bca9d5 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Chip.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Chip.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.38.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -12,34 +12,135 @@ import type {
PreactCustomElement,
RenderImpl,
} from './shared.d.ts';
+import * as preact$1 from 'preact';
+import {ReactNode, RefAttributes} from 'react';
-export interface ChipProps
- extends Required> {}
-
-declare class PolarisCustomElement extends PreactCustomElement {
- constructor(renderImpl: Omit);
-}
-
-/** Used when an element does not have children. * @publicDocs
+/**
+ * An event object with a strongly-typed `currentTarget` property that references the specific HTML element that triggered the event.
+ *
+ * This type extends the standard DOM `Event` interface and ensures type safety when accessing the element that fired the event.
+ * @publicDocs
+ */
+export type CallbackEvent = Event & {
+ currentTarget: HTMLElementTagNameMap[T];
+};
+/**
+ * A function that handles events from UI components.
+ *
+ * This type represents an event listener callback that receives a `CallbackEvent` with a strongly-typed `currentTarget`. Use this for component event handlers like `click`, `focus`, `blur`, and other DOM events.
+ *
+ * @example
+ * const handleClick: CallbackEventListener<'button'> = (event) => {
+ * console.log('Button clicked:', event.currentTarget);
+ * };
+ * @publicDocs
+ */
+export type CallbackEventListener =
+ | (EventListener & {
+ (event: CallbackEvent): void;
+ })
+ | null;
+/**
+ * Base props for Preact custom elements without children support. Includes common properties like key, ref, and slot for elements that don't accept child content.
+ * @publicDocs
*/
export interface PreactBaseElementProps {
- /** Assigns a unique key to this element. */
+ /**
+ * A unique identifier for this element, used by the virtual DOM to efficiently track and update elements in lists.
+ * Essential for maintaining component state and optimizing re-renders when lists change.
+ */
key?: preact.Key;
- /** Assigns a ref (generally from `useRef()`) to this element. */
+ /**
+ * A reference to access the underlying DOM element directly.
+ * Typically created using `useRef()` to interact with the element imperatively or measure its properties.
+ */
ref?: preact.Ref;
- /** Assigns this element to a parent's slot. */
+ /**
+ * The named slot to which this element is assigned in the parent component's shadow DOM.
+ *
+ * Used for advanced component composition with web components.
+ */
slot?: Lowercase;
}
-/** Used when an element has children. * @publicDocs
+/**
+ * Base props for Preact custom elements with children support. Extends PreactBaseElementProps with the ability to render child elements.
+ * @publicDocs
*/
export interface PreactBaseElementPropsWithChildren
extends PreactBaseElementProps {
+ /**
+ * The child elements to be rendered within this component.
+ */
children?: preact.ComponentChildren;
}
+export type ReactIntrinsicElementChildren =
+ 'children' extends keyof PreactProps
+ ? {
+ children?: ReactNode;
+ }
+ : Record;
+export type ReactIntrinsicElementProps<
+ PreactProps extends object,
+ ElementType,
+> = Omit &
+ ReactIntrinsicElementChildren &
+ RefAttributes & {
+ slot?: Lowercase;
+ };
+export type ReactIntrinsicElements = {
+ [Tag in Exclude<
+ Extract,
+ `s-test-${string}`
+ >]: ReactIntrinsicElementProps<
+ preact$1.createElement.JSX.IntrinsicElements[Tag],
+ Tag extends keyof HTMLElementTagNameMap
+ ? HTMLElementTagNameMap[Tag]
+ : HTMLElement
+ >;
+};
+declare module 'react' {
+ namespace JSX {
+ interface IntrinsicElements extends ReactIntrinsicElements {}
+ }
+}
+
+/**
+ * Configure the following properties on the chip component.
+ */
+export interface ChipProps
+ extends Required<
+ Pick
+ > {
+ /**
+ * The color emphasis level that controls visual intensity.
+ *
+ * @default 'base'
+ */
+ color: Required['color'];
+ /**
+ * A label that describes the purpose or content of the component for assistive technologies like screen readers. Use this to provide additional context when the visible content alone doesn't clearly convey the component's purpose.
+ */
+ accessibilityLabel: Required['accessibilityLabel'];
+}
+
+declare class PolarisCustomElement extends PreactCustomElement {
+ constructor(renderImpl: Omit);
+ /** @private */
+ connectedCallback(): void;
+ /** @private */
+ adoptedCallback(): void;
+}
+
+/**
+ * Configure the following properties on the chip component.
+ * @publicDocs
+ */
declare class Chip extends PolarisCustomElement implements ChipProps {
accessor color: ChipProps['color'];
accessor accessibilityLabel: ChipProps['accessibilityLabel'];
+ accessor removable: ChipProps['removable'];
+ accessor onremove: CallbackEventListener | null;
constructor();
}
declare global {
@@ -61,13 +162,14 @@ export interface ChipJSXProps
extends Partial,
Pick {
/**
- * The content of the chip.
+ * The text label displayed within the chip component, typically representing a selected filter, tag, or removable item.
*/
children?: ComponentChildren;
/**
- * An optional icon to display at the start of the chip. Accepts only Icon components.
+ * An optional icon to display at the start of the chip. Accepts only icon components.
*/
graphic?: ComponentChildren;
+ onRemove?: ((event: CallbackEvent) => void) | null;
}
export {Chip};
diff --git a/packages/ui-extensions/src/surfaces/admin/components/Choice.d.ts b/packages/ui-extensions/src/surfaces/admin/components/Choice.d.ts
index 63cbb9998e..f2630acac6 100644
--- a/packages/ui-extensions/src/surfaces/admin/components/Choice.d.ts
+++ b/packages/ui-extensions/src/surfaces/admin/components/Choice.d.ts
@@ -1,4 +1,4 @@
-/** VERSION: 1.25.0 **/
+/** VERSION: 2.23.0 **/
/* eslint-disable import/extensions */
/* eslint-disable @typescript-eslint/no-namespace */
@@ -6,11 +6,50 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
///