@shopify/ui-extensions 2023.4.0 → 2023.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/surfaces/admin/components/Pressable/Pressable.js +9 -0
- package/build/cjs/surfaces/admin.js +2 -0
- package/build/esm/surfaces/admin/components/Pressable/Pressable.mjs +5 -0
- package/build/esm/surfaces/admin.mjs +1 -0
- package/build/esnext/surfaces/admin/components/Pressable/Pressable.esnext +5 -0
- package/build/esnext/surfaces/admin.esnext +1 -0
- package/build/ts/api.d.ts +12 -0
- package/build/ts/api.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/action/action.d.ts +3 -3
- package/build/ts/surfaces/admin/api/action/action.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/action/action.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/customer-segmentation-template/customer-segmentation-template.d.ts +2 -2
- package/build/ts/surfaces/admin/api/customer-segmentation-template/customer-segmentation-template.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/extension-targets/extension-targets.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/standard/standard.d.ts +16 -6
- package/build/ts/surfaces/admin/api/standard/standard.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/standard/standard.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminAction/AdminAction.d.ts +0 -1
- package/build/ts/surfaces/admin/components/AdminAction/AdminAction.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminAction/AdminAction.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminBlock/AdminBlock.d.ts +0 -1
- package/build/ts/surfaces/admin/components/AdminBlock/AdminBlock.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminBlock/AdminBlock.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/BlockStack/BlockStack.d.ts +13 -1
- package/build/ts/surfaces/admin/components/BlockStack/BlockStack.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/BlockStack/BlockStack.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Box/Box.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Button/Button.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Checkbox/Checkbox.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Divider/Divider.d.ts +3 -2
- package/build/ts/surfaces/admin/components/Divider/Divider.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Divider/Divider.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/EmailField/EmailField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Form/Form.d.ts +3 -3
- package/build/ts/surfaces/admin/components/Form/Form.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Form/Form.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Heading/Heading.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/HeadingGroup/HeadingGroup.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Icon/Icon.d.ts +3 -1
- package/build/ts/surfaces/admin/components/Icon/Icon.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Icon/Icon.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Icon/IconName.d.ts +2 -0
- package/build/ts/surfaces/admin/components/Icon/IconName.d.ts.map +1 -0
- package/build/ts/surfaces/admin/components/Image/Image.d.ts +3 -2
- package/build/ts/surfaces/admin/components/Image/Image.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Image/Image.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/InlineStack/InlineStack.d.ts +13 -1
- package/build/ts/surfaces/admin/components/InlineStack/InlineStack.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/InlineStack/InlineStack.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Link/Link.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/NumberField/NumberField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/PasswordField/PasswordField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Pressable/Pressable.d.ts +10 -0
- package/build/ts/surfaces/admin/components/Pressable/Pressable.d.ts.map +1 -0
- package/build/ts/surfaces/admin/components/Pressable/Pressable.doc.d.ts +4 -0
- package/build/ts/surfaces/admin/components/Pressable/Pressable.doc.d.ts.map +1 -0
- package/build/ts/surfaces/admin/components/Select/Select.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Text/Text.d.ts +1 -1
- package/build/ts/surfaces/admin/components/Text/Text.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Text/Text.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/TextArea/TextArea.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/TextField/TextField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/URLField/URLField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/shared/index.d.ts +4 -4
- package/build/ts/surfaces/admin/components/shared/index.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components.d.ts +2 -0
- package/build/ts/surfaces/admin/components.d.ts.map +1 -1
- package/build/ts/surfaces/admin/{extension-points.d.ts → extension-targets.d.ts} +62 -20
- package/build/ts/surfaces/admin/extension-targets.d.ts.map +1 -0
- package/build/ts/surfaces/admin/extension.d.ts +3 -3
- package/build/ts/surfaces/admin/extension.d.ts.map +1 -1
- package/build/ts/surfaces/admin/globals.d.ts +2 -2
- package/build/ts/surfaces/admin/globals.d.ts.map +1 -1
- package/build/ts/surfaces/admin.d.ts +1 -1
- package/build/ts/surfaces/admin.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api/checkout/checkout.d.ts +45 -5
- package/build/ts/surfaces/checkout/api/checkout/checkout.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api/shipping/shipping-method-details.d.ts +1 -1
- package/build/ts/surfaces/checkout/api/shipping/shipping-method-details.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api/standard/standard.d.ts +5 -3
- package/build/ts/surfaces/checkout/api/standard/standard.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api.d.ts +1 -1
- package/build/ts/surfaces/checkout/api.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/extension-points.d.ts +12 -0
- package/build/ts/surfaces/checkout/extension-points.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/api.ts +14 -0
- package/src/surfaces/admin/api/action/action.doc.ts +1 -0
- package/src/surfaces/admin/api/action/action.ts +4 -4
- package/src/surfaces/admin/api/customer-segmentation-template/customer-segmentation-template.ts +3 -3
- package/src/surfaces/admin/api/extension-targets/extension-targets.doc.ts +3 -2
- package/src/surfaces/admin/api/standard/standard.doc.ts +1 -0
- package/src/surfaces/admin/api/standard/standard.ts +21 -6
- package/src/surfaces/admin/components/AdminAction/AdminAction.doc.ts +10 -3
- package/src/surfaces/admin/components/AdminAction/AdminAction.ts +0 -2
- package/src/surfaces/admin/components/AdminAction/examples/basic-adminaction.example.ts +12 -6
- package/src/surfaces/admin/components/AdminBlock/AdminBlock.doc.ts +10 -3
- package/src/surfaces/admin/components/AdminBlock/AdminBlock.ts +0 -2
- package/src/surfaces/admin/components/BlockStack/BlockStack.doc.ts +8 -1
- package/src/surfaces/admin/components/BlockStack/BlockStack.ts +16 -0
- package/src/surfaces/admin/components/BlockStack/examples/basic-blockstack.example.ts +1 -1
- package/src/surfaces/admin/components/Box/Box.doc.ts +1 -0
- package/src/surfaces/admin/components/Box/examples/basic-box.example.ts +1 -1
- package/src/surfaces/admin/components/Button/Button.doc.ts +13 -1
- package/src/surfaces/admin/components/Checkbox/Checkbox.doc.ts +8 -1
- package/src/surfaces/admin/components/Divider/Divider.doc.ts +2 -1
- package/src/surfaces/admin/components/Divider/Divider.ts +3 -2
- package/src/surfaces/admin/components/Divider/examples/basic-divider.example.ts +2 -2
- package/src/surfaces/admin/components/EmailField/EmailField.doc.ts +14 -3
- package/src/surfaces/admin/components/Form/Form.doc.ts +23 -1
- package/src/surfaces/admin/components/Form/Form.ts +3 -3
- package/src/surfaces/admin/components/Form/examples/basic-form.example.ts +8 -6
- package/src/surfaces/admin/components/Heading/Heading.doc.ts +14 -2
- package/src/surfaces/admin/components/HeadingGroup/HeadingGroup.doc.ts +9 -2
- package/src/surfaces/admin/components/HeadingGroup/examples/basic-headinggroup.example.ts +1 -1
- package/src/surfaces/admin/components/Icon/Icon.doc.ts +35 -3
- package/src/surfaces/admin/components/Icon/Icon.ts +3 -1
- package/src/surfaces/admin/components/Icon/IconName.ts +567 -0
- package/src/surfaces/admin/components/Image/Image.doc.ts +9 -2
- package/src/surfaces/admin/components/Image/Image.ts +38 -35
- package/src/surfaces/admin/components/Image/examples/basic-image.example.ts +2 -2
- package/src/surfaces/admin/components/InlineStack/InlineStack.doc.ts +8 -1
- package/src/surfaces/admin/components/InlineStack/InlineStack.ts +16 -0
- package/src/surfaces/admin/components/InlineStack/examples/basic-inlinestack.example.ts +1 -1
- package/src/surfaces/admin/components/Link/Link.doc.ts +15 -8
- package/src/surfaces/admin/components/NumberField/NumberField.doc.ts +9 -2
- package/src/surfaces/admin/components/PasswordField/PasswordField.doc.ts +14 -2
- package/src/surfaces/admin/components/PasswordField/examples/basic-passwordfield.example.ts +10 -9
- package/src/surfaces/admin/components/Pressable/Pressable.doc.ts +49 -0
- package/src/surfaces/admin/components/Pressable/Pressable.ts +9 -0
- package/src/surfaces/admin/components/Pressable/examples/basic-pressable.example.ts +25 -0
- package/src/surfaces/admin/components/Select/Select.doc.ts +9 -2
- package/src/surfaces/admin/components/Text/Text.doc.ts +9 -2
- package/src/surfaces/admin/components/Text/Text.ts +1 -3
- package/src/surfaces/admin/components/Text/examples/basic-text.example.ts +3 -7
- package/src/surfaces/admin/components/TextArea/TextArea.doc.ts +9 -2
- package/src/surfaces/admin/components/TextField/TextField.doc.ts +19 -2
- package/src/surfaces/admin/components/URLField/URLField.doc.ts +9 -3
- package/src/surfaces/admin/components/shared/index.ts +4 -4
- package/src/surfaces/admin/components.ts +2 -0
- package/src/surfaces/admin/{extension-points.ts → extension-targets.ts} +75 -22
- package/src/surfaces/admin/extension.ts +3 -2
- package/src/surfaces/admin/globals.ts +4 -4
- package/src/surfaces/admin.ts +1 -1
- package/src/surfaces/checkout/api/checkout/checkout.ts +57 -5
- package/src/surfaces/checkout/api/shipping/shipping-method-details.ts +1 -1
- package/src/surfaces/checkout/api/standard/README.md +3 -3
- package/src/surfaces/checkout/api/standard/standard.ts +13 -3
- package/src/surfaces/checkout/api.ts +2 -0
- package/src/surfaces/checkout/extension-points.ts +12 -0
- package/src/surfaces/checkout/style/examples/style.example.tsx +1 -1
- package/build/ts/surfaces/admin/extension-points.d.ts.map +0 -1
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
StandardApi as BaseStandardApi,
|
|
3
|
+
I18n,
|
|
4
|
+
Intents,
|
|
5
|
+
Navigation,
|
|
6
|
+
} from '../../../../api';
|
|
7
|
+
import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-targets';
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
|
-
* The following APIs are provided to all extension
|
|
10
|
+
* The following APIs are provided to all extension targets.
|
|
6
11
|
*/
|
|
7
|
-
export interface StandardApi<
|
|
12
|
+
export interface StandardApi<ExtensionTarget extends AnyExtensionTarget>
|
|
8
13
|
extends BaseStandardApi {
|
|
9
14
|
/**
|
|
10
|
-
* The identifier of the running extension
|
|
15
|
+
* The identifier of the running extension target.
|
|
11
16
|
*/
|
|
12
|
-
|
|
17
|
+
extension: {
|
|
18
|
+
target: ExtensionTarget;
|
|
19
|
+
};
|
|
13
20
|
i18n: I18n;
|
|
21
|
+
/**
|
|
22
|
+
* Provides information to the receiver the of an intent.
|
|
23
|
+
*/
|
|
24
|
+
intents: Intents;
|
|
25
|
+
/**
|
|
26
|
+
* Provides methods to navigate to other features in the Admin.
|
|
27
|
+
*/
|
|
28
|
+
navigation: Navigation;
|
|
14
29
|
}
|
|
@@ -2,10 +2,11 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'AdminAction',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'AdminAction is a component used by Admin Action extensions to configure a primary and secondary action and title.',
|
|
7
8
|
requires: '',
|
|
8
|
-
thumbnail: '
|
|
9
|
+
thumbnail: 'adminaction-thumbnail.png',
|
|
9
10
|
isVisualComponent: true,
|
|
10
11
|
type: '',
|
|
11
12
|
definitions: [
|
|
@@ -18,7 +19,7 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
18
19
|
category: 'Components',
|
|
19
20
|
subCategory: 'Other',
|
|
20
21
|
defaultExample: {
|
|
21
|
-
image: '
|
|
22
|
+
image: 'adminaction-default.png',
|
|
22
23
|
codeblock: {
|
|
23
24
|
title: 'Set the primary and secondary action of the Action modal.',
|
|
24
25
|
tabs: [
|
|
@@ -35,7 +36,13 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
35
36
|
],
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
|
-
related: [
|
|
39
|
+
related: [
|
|
40
|
+
{
|
|
41
|
+
type: 'component',
|
|
42
|
+
name: 'AdminBlock',
|
|
43
|
+
url: '/docs/api/admin-extensions/components/other/adminblock',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
39
46
|
};
|
|
40
47
|
|
|
41
48
|
export default data;
|
|
@@ -16,8 +16,6 @@ export interface AdminActionProps {
|
|
|
16
16
|
* Sets the Secondary action button of the container. This component must a button component.
|
|
17
17
|
*/
|
|
18
18
|
secondaryAction?: RemoteFragment;
|
|
19
|
-
|
|
20
|
-
children: any;
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
21
|
* AdminAction is a component used by Admin Action extensions to configure a primary and secondary action and title.
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import {extension, AdminAction, Button} from '@shopify/ui-extensions/admin';
|
|
2
2
|
|
|
3
3
|
export default extension('Playground', (root) => {
|
|
4
|
+
const primaryAction = root.createFragment();
|
|
5
|
+
const secondaryAction = root.createFragment();
|
|
6
|
+
|
|
7
|
+
primaryAction.appendChild(
|
|
8
|
+
root.createComponent(Button, {onPress: () => {}}, 'Action')
|
|
9
|
+
);
|
|
10
|
+
secondaryAction.appendChild(
|
|
11
|
+
root.createComponent(Button, {onPress: () => {}}, 'Secondary')
|
|
12
|
+
);
|
|
13
|
+
|
|
4
14
|
const adminAction = root.createComponent(AdminAction, {
|
|
5
15
|
title: 'My App Action',
|
|
6
|
-
primaryAction
|
|
7
|
-
|
|
8
|
-
),
|
|
9
|
-
secondaryAction: root.createFragment(
|
|
10
|
-
root.createComponent(Button, {onPress: () => {}}, 'Secondary')
|
|
11
|
-
)
|
|
16
|
+
primaryAction,
|
|
17
|
+
secondaryAction,
|
|
12
18
|
}, 'Modal content');
|
|
13
19
|
|
|
14
20
|
root.appendChild(adminAction);
|
|
@@ -2,10 +2,11 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'AdminBlock',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'This component is similar to the AdminBlock, providing a deeper integration with the container your UI is rendered into. However, this only applies to Block Extensions which render inline on a resource page.',
|
|
7
8
|
requires: '',
|
|
8
|
-
thumbnail: '
|
|
9
|
+
thumbnail: 'adminblock-thumbnail.png',
|
|
9
10
|
isVisualComponent: true,
|
|
10
11
|
type: '',
|
|
11
12
|
definitions: [
|
|
@@ -18,7 +19,7 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
18
19
|
category: 'Components',
|
|
19
20
|
subCategory: 'Other',
|
|
20
21
|
defaultExample: {
|
|
21
|
-
image: '
|
|
22
|
+
image: 'adminblock-default.png',
|
|
22
23
|
codeblock: {
|
|
23
24
|
title: 'Simple AdminBlock implementation',
|
|
24
25
|
tabs: [
|
|
@@ -35,7 +36,13 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
35
36
|
],
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
|
-
related: [
|
|
39
|
+
related: [
|
|
40
|
+
{
|
|
41
|
+
type: 'component',
|
|
42
|
+
name: 'Adminaction',
|
|
43
|
+
url: '/docs/api/admin-extensions/components/other/adminaction',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
39
46
|
};
|
|
40
47
|
|
|
41
48
|
export default data;
|
|
@@ -10,8 +10,6 @@ export interface AdminBlockProps {
|
|
|
10
10
|
* The summary to display when the app block is collapsed. If not provided, no summary will be displayed. No summary is shown when the app block is expanded.
|
|
11
11
|
*/
|
|
12
12
|
summary?: string;
|
|
13
|
-
|
|
14
|
-
children: any;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export const AdminBlock = createRemoteComponent<'AdminBlock', AdminBlockProps>(
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'BlockStack',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
"This structures layout elements along the vertical axis of the page. It's useful for vertical alignment.",
|
|
7
8
|
requires: '',
|
|
@@ -36,7 +37,13 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
|
|
39
|
-
related: [
|
|
40
|
+
related: [
|
|
41
|
+
{
|
|
42
|
+
type: 'component',
|
|
43
|
+
name: 'InlineStack',
|
|
44
|
+
url: '/docs/api/admin-extensions/components/structure/Stack',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
export default data;
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
SizingProps,
|
|
7
7
|
PaddingProps,
|
|
8
8
|
GapProps,
|
|
9
|
+
CrossAxisAlignment,
|
|
10
|
+
MainAxisAlignment,
|
|
9
11
|
} from '../shared';
|
|
10
12
|
|
|
11
13
|
export interface BlockStackProps
|
|
@@ -20,6 +22,20 @@ export interface BlockStackProps
|
|
|
20
22
|
* provide them with more context.
|
|
21
23
|
*/
|
|
22
24
|
accessibilityLabel?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Position children along the main axis
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue 'start'
|
|
30
|
+
*/
|
|
31
|
+
inlineAlignment?: CrossAxisAlignment;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Position children along the cross axis
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue 'start'
|
|
37
|
+
*/
|
|
38
|
+
blockAlignment?: MainAxisAlignment;
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
export const BlockStack = createRemoteComponent<'BlockStack', BlockStackProps>(
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Box',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'This is your foundational structural element for composing UI. It can be styled using predefined tokens. Use it to build your layout.',
|
|
7
8
|
requires: '',
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Button',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'Use this component when you want to provide users the ability to perform specific actions, like saving data.',
|
|
7
8
|
requires: '',
|
|
@@ -35,7 +36,18 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
35
36
|
],
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
|
-
related: [
|
|
39
|
+
related: [
|
|
40
|
+
{
|
|
41
|
+
type: 'component',
|
|
42
|
+
name: 'Pressable',
|
|
43
|
+
url: '/docs/api/admin-extensions/components/actions/pressable',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'component',
|
|
47
|
+
name: 'Link',
|
|
48
|
+
url: '/docs/api/admin-extensions/components/actions/link',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
39
51
|
};
|
|
40
52
|
|
|
41
53
|
export default data;
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Checkbox',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'Use this component when you want to provide users with a clear selection option, such as for agreeing to terms and conditions or selecting multiple options from a list.',
|
|
7
8
|
requires: '',
|
|
@@ -36,7 +37,13 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
|
|
39
|
-
related: [
|
|
40
|
+
related: [
|
|
41
|
+
{
|
|
42
|
+
type: 'component',
|
|
43
|
+
name: 'ChoiceList',
|
|
44
|
+
url: '/docs/api/admin-extensions/components/forms/choicelist',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
export default data;
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Divider',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'Use this to create a clear visual separation between different elements in your user interface.',
|
|
7
8
|
requires: '',
|
|
@@ -20,7 +21,7 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
20
21
|
defaultExample: {
|
|
21
22
|
image: 'divider-default.png',
|
|
22
23
|
codeblock: {
|
|
23
|
-
title: '
|
|
24
|
+
title: 'Simple Divider example',
|
|
24
25
|
tabs: [
|
|
25
26
|
{
|
|
26
27
|
title: 'React',
|
|
@@ -4,9 +4,10 @@ export interface DividerProps {
|
|
|
4
4
|
/**
|
|
5
5
|
* Specify the direction of the divider.
|
|
6
6
|
*
|
|
7
|
-
* @defaultValue '
|
|
7
|
+
* @defaultValue 'inline'
|
|
8
|
+
* @defaultValue 'inline'
|
|
8
9
|
*/
|
|
9
|
-
direction?: '
|
|
10
|
+
direction?: 'inline' | 'block';
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const Divider = createRemoteComponent<'Divider', DividerProps>(
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
'Playground',
|
|
8
8
|
(root) => {
|
|
9
9
|
const divier = root.createComponent(Divider);
|
|
10
|
-
const firstText = root.createText('First Text')
|
|
11
|
-
const secondText = root.createText('Second Text')
|
|
10
|
+
const firstText = root.createText('First Text');
|
|
11
|
+
const secondText = root.createText('Second Text');
|
|
12
12
|
|
|
13
13
|
root.appendChild(firstText);
|
|
14
14
|
root.appendChild(divier);
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'EmailField',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description: 'Use this when you need users to provide their email addresses.',
|
|
6
7
|
requires: '',
|
|
7
8
|
thumbnail: 'emailfield-thumbnail.png',
|
|
@@ -19,7 +20,7 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
19
20
|
defaultExample: {
|
|
20
21
|
image: 'emailfield-default.png',
|
|
21
22
|
codeblock: {
|
|
22
|
-
title: '
|
|
23
|
+
title: 'Simple EmailField example',
|
|
23
24
|
tabs: [
|
|
24
25
|
{
|
|
25
26
|
title: 'React',
|
|
@@ -34,8 +35,18 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
34
35
|
],
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
related: [
|
|
39
|
+
{
|
|
40
|
+
type: 'component',
|
|
41
|
+
name: 'TextField',
|
|
42
|
+
url: '/docs/api/admin-extensions/components/forms/textfield',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'component',
|
|
46
|
+
name: 'NumberField',
|
|
47
|
+
url: '/docs/api/admin-extensions/components/forms/numberfield',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
39
50
|
};
|
|
40
51
|
|
|
41
52
|
export default data;
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Form',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'Use this component when you want to collect input from users. It provides a structure for various input fields and controls, such as text fields, checkboxes, and buttons. It also handles form submission and reset actions.',
|
|
7
8
|
requires: '',
|
|
@@ -35,7 +36,28 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
35
36
|
],
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
|
-
related: [
|
|
39
|
+
related: [
|
|
40
|
+
{
|
|
41
|
+
type: 'component',
|
|
42
|
+
name: 'TextField',
|
|
43
|
+
url: '/docs/api/admin-extensions/components/forms/textfield',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'component',
|
|
47
|
+
name: 'NumberField',
|
|
48
|
+
url: '/docs/api/admin-extensions/components/forms/numberfield',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'component',
|
|
52
|
+
name: 'EmailField',
|
|
53
|
+
url: '/docs/api/admin-extensions/components/forms/emailfield',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'component',
|
|
57
|
+
name: 'ChoiceList',
|
|
58
|
+
url: '/docs/api/admin-extensions/components/forms/choicelist',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
39
61
|
};
|
|
40
62
|
|
|
41
63
|
export default data;
|
|
@@ -21,12 +21,12 @@ export interface FormProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* A callback that is run when the form is submitted.
|
|
23
23
|
*/
|
|
24
|
-
onSubmit
|
|
24
|
+
onSubmit(): void | Promise<void>;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* A callback that is run when the form is
|
|
27
|
+
* A callback that is run when the form is reset.
|
|
28
28
|
*/
|
|
29
|
-
onReset
|
|
29
|
+
onReset(): void | Promise<void>;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export const Form = createRemoteComponent<'Form', FormProps>('Form');
|
|
@@ -10,11 +10,12 @@ extend('admin.product-details.block.render', (root) => {
|
|
|
10
10
|
const textField = root.createComponent(
|
|
11
11
|
TextField,
|
|
12
12
|
{
|
|
13
|
+
label: 'name',
|
|
13
14
|
value: name,
|
|
14
|
-
onChange
|
|
15
|
+
onChange: (value) => {
|
|
15
16
|
textField.updateProps({value});
|
|
16
17
|
name = value;
|
|
17
|
-
}
|
|
18
|
+
},
|
|
18
19
|
}
|
|
19
20
|
);
|
|
20
21
|
|
|
@@ -22,14 +23,15 @@ extend('admin.product-details.block.render', (root) => {
|
|
|
22
23
|
// API call to save the values
|
|
23
24
|
const res = await fetch('/save', {method:'POST', body: JSON.stringify({name})});
|
|
24
25
|
if (!res.ok) {
|
|
26
|
+
const json = await res.json();
|
|
25
27
|
// The Host can catch these errors and do something with them.
|
|
26
|
-
throw Error(`There were errors: ${
|
|
28
|
+
throw Error(`There were errors: ${json.errors.join(',')}`);
|
|
27
29
|
}
|
|
28
|
-
}
|
|
30
|
+
};
|
|
29
31
|
|
|
30
32
|
const onReset = async () => {
|
|
31
33
|
name = '';
|
|
32
|
-
}
|
|
34
|
+
};
|
|
33
35
|
|
|
34
36
|
const form = root.createComponent(
|
|
35
37
|
Form,
|
|
@@ -38,4 +40,4 @@ extend('admin.product-details.block.render', (root) => {
|
|
|
38
40
|
|
|
39
41
|
form.appendChild(textField);
|
|
40
42
|
root.appendChild(form);
|
|
41
|
-
};
|
|
43
|
+
});
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Heading',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
"Use this to display a title. It's similar to the h1-h6 tags in HTML",
|
|
7
8
|
requires: '',
|
|
@@ -20,7 +21,7 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
20
21
|
defaultExample: {
|
|
21
22
|
image: 'heading-default.png',
|
|
22
23
|
codeblock: {
|
|
23
|
-
title: '
|
|
24
|
+
title: 'Simple Heading example',
|
|
24
25
|
tabs: [
|
|
25
26
|
{
|
|
26
27
|
title: 'React',
|
|
@@ -36,7 +37,18 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
|
|
39
|
-
related: [
|
|
40
|
+
related: [
|
|
41
|
+
{
|
|
42
|
+
type: 'component',
|
|
43
|
+
name: 'Text',
|
|
44
|
+
url: '/docs/api/admin-extensions/components/titles-and-text/text',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'component',
|
|
48
|
+
name: 'HeadingGroup',
|
|
49
|
+
url: '/docs/api/admin-extensions/components/titles-and-text/headinggroup',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
40
52
|
};
|
|
41
53
|
|
|
42
54
|
export default data;
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'HeadingGroup',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'This groups headings together, much like the hgroup element in HTML.',
|
|
7
8
|
requires: '',
|
|
@@ -20,7 +21,7 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
20
21
|
defaultExample: {
|
|
21
22
|
image: 'headinggroup-default.png',
|
|
22
23
|
codeblock: {
|
|
23
|
-
title: '
|
|
24
|
+
title: 'Simple HeadingGroup example',
|
|
24
25
|
tabs: [
|
|
25
26
|
{
|
|
26
27
|
title: 'React',
|
|
@@ -36,7 +37,13 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
|
|
39
|
-
related: [
|
|
40
|
+
related: [
|
|
41
|
+
{
|
|
42
|
+
type: 'component',
|
|
43
|
+
name: 'Heading',
|
|
44
|
+
url: '/docs/api/admin-extensions/components/titles-and-text/heading',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
export default data;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
BlockStack,
|
|
6
6
|
} from '@shopify/ui-extensions/admin';
|
|
7
7
|
|
|
8
|
-
extend('
|
|
8
|
+
extend('Playground', (root) => {
|
|
9
9
|
const headingGroup = root.createComponent(BlockStack, undefined, [
|
|
10
10
|
root.createComponent(Heading, undefined, 'Heading <h1>'),
|
|
11
11
|
root.createComponent(HeadingGroup, undefined, [
|
|
@@ -2,6 +2,7 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
|
2
2
|
|
|
3
3
|
const data: ReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'Icon',
|
|
5
|
+
featureFlag: 'admin_extensibility',
|
|
5
6
|
description:
|
|
6
7
|
'This component renders an icon from a predefined list. Choose the one that suits your needs.',
|
|
7
8
|
requires: '',
|
|
@@ -14,13 +15,18 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
14
15
|
description: '',
|
|
15
16
|
type: 'IconProps',
|
|
16
17
|
},
|
|
18
|
+
{
|
|
19
|
+
title: 'IconName',
|
|
20
|
+
description: 'List of available Icons for the Icon component',
|
|
21
|
+
type: 'IconName',
|
|
22
|
+
},
|
|
17
23
|
],
|
|
18
24
|
category: 'Components',
|
|
19
25
|
subCategory: 'Media',
|
|
20
26
|
defaultExample: {
|
|
21
27
|
image: 'icon-default.png',
|
|
22
28
|
codeblock: {
|
|
23
|
-
title: '
|
|
29
|
+
title: 'Simple Icon example',
|
|
24
30
|
tabs: [
|
|
25
31
|
{
|
|
26
32
|
title: 'React',
|
|
@@ -35,8 +41,34 @@ const data: ReferenceEntityTemplateSchema = {
|
|
|
35
41
|
],
|
|
36
42
|
},
|
|
37
43
|
},
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
subSections: [
|
|
45
|
+
{
|
|
46
|
+
type: 'Generic',
|
|
47
|
+
title: 'Available Icons',
|
|
48
|
+
anchorLink: 'availableIcons',
|
|
49
|
+
sectionContent:
|
|
50
|
+
'The available Icons are a 1:1 map of what Icons are available in Polaris. You can find the full list of Icons in the [Polaris Icons documentation](https://polaris.shopify.com/icons).',
|
|
51
|
+
sectionCard: [
|
|
52
|
+
{
|
|
53
|
+
type: 'information',
|
|
54
|
+
name: 'Polaris Icons',
|
|
55
|
+
url: 'https://polaris.shopify.com/icons',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
related: [
|
|
61
|
+
{
|
|
62
|
+
type: 'component',
|
|
63
|
+
name: 'Image',
|
|
64
|
+
url: '/docs/api/admin-extensions/components/media/image',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'component',
|
|
68
|
+
name: 'Image',
|
|
69
|
+
url: '/docs/api/admin-extensions/components/media/image',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
40
72
|
};
|
|
41
73
|
|
|
42
74
|
export default data;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {createRemoteComponent} from '@remote-ui/core';
|
|
2
|
+
import {IconName} from './IconName';
|
|
2
3
|
|
|
3
4
|
export interface IconProps {
|
|
4
5
|
/*
|
|
@@ -36,7 +37,8 @@ export interface IconProps {
|
|
|
36
37
|
/*
|
|
37
38
|
* Specifies the name of the icon that will be displayed.
|
|
38
39
|
*/
|
|
39
|
-
name:
|
|
40
|
+
name: IconName;
|
|
40
41
|
}
|
|
42
|
+
export type {IconName};
|
|
41
43
|
|
|
42
44
|
export const Icon = createRemoteComponent<'Icon', IconProps>('Icon');
|