Skip to content

Commit 6dcd69a

Browse files
sophschneidergwyneplainekyledurandlaurkimaaronccasanova
authored
v11.x.x updates feature branch (#9342)
### WHY are these changes introduced? See [issue here](Shopify/archive-polaris-backlog-2024#96) for steps and how to tophat ### WHAT is this pull request doing? See previous commits and PRs --------- Co-authored-by: Charles <cc.lee@live.com.au> Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com> Co-authored-by: Lo Kim <lo.kim@shopify.com> Co-authored-by: kyledurand <kyle.durand@shopify.com> Co-authored-by: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com> Co-authored-by: Sara Hill <sara.hill@shopify.com> Co-authored-by: aveline <aveline@users.noreply.github.com> Co-authored-by: Yuraima Estevez <4642404+yurm04@users.noreply.github.com> Co-authored-by: Yuraima Estevez <yuraima.estevez@shopify.com> Co-authored-by: Mateus Ferreira <mateus.ferreira@shopify.com> Co-authored-by: Laura Griffee <laura@mailzone.com> Co-authored-by: Jess Telford <jess+github@jes.st> Co-authored-by: Sophie <qt314@users.noreply.github.com> Co-authored-by: Alex Page <hi@alexpage.dev> Co-authored-by: Jess Telford <jess.telford@shopify.com>
1 parent a5cf62c commit 6dcd69a

File tree

83 files changed

+3064
-179
lines changed

Some content is hidden

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

83 files changed

+3064
-179
lines changed

.changeset/cool-hats-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Fixed small screen horizontal overflow by changing `Banner` focus ring from `box-shadow` to `outline`

.changeset/good-turtles-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Removed unused transition delay param from focus-ring mixin

.changeset/khaki-eggs-shout.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Add polarisSummerEditions2023 feature flag to AppProvider context.

.changeset/tough-deers-brush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Add `primarySuccess` variant prop to `Button`

polaris-react/.storybook/manager.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,23 @@ addons.register('polaris/global-controls', () => {
5757
match: ({viewMode}) => viewMode === 'story',
5858
render: ({active, key}) => <GridPanel active={active} key={key} />,
5959
});
60+
addons.add('provider/panel', {
61+
type: types.PANEL,
62+
title: 'Feature flags',
63+
match: ({viewMode}) => viewMode === 'story',
64+
render: ({active, key}) => <FeatureFlagPanel active={active} key={key} />,
65+
});
6066
});
6167

68+
export const featureFlagOptions = {
69+
polarisSummerEditions2023: {
70+
name: 'polarisSummerEditions2023',
71+
description: 'Toggle the summer editions feature flag',
72+
defaultValue: false,
73+
control: {type: 'boolean'},
74+
},
75+
};
76+
6277
export const gridOptions = {
6378
showGrid: {
6479
name: 'Show grid overlay',
@@ -88,6 +103,20 @@ export const gridOptions = {
88103
},
89104
};
90105

106+
function FeatureFlagPanel(props) {
107+
const [globals, updateGlobals] = useGlobals();
108+
return (
109+
<AddonPanel {...props}>
110+
<ArgsTable
111+
inAddonPanel
112+
rows={featureFlagOptions}
113+
args={globals}
114+
updateArgs={updateGlobals}
115+
/>
116+
</AddonPanel>
117+
);
118+
}
119+
91120
function GridPanel(props) {
92121
const [globals, updateGlobals] = useGlobals();
93122

polaris-react/.storybook/preview.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {AppProvider} from '../src';
44
import enTranslations from '../locales/en.json';
55
import {GridOverlay} from './GridOverlay';
66
import {RenderPerformanceProfiler} from './RenderPerformanceProfiler';
7-
import {gridOptions} from './manager';
7+
import {gridOptions, featureFlagOptions} from './manager';
88
import {breakpoints} from '@shopify/polaris-tokens';
99

1010
function StrictModeDecorator(Story, context) {
@@ -19,10 +19,15 @@ function StrictModeDecorator(Story, context) {
1919
}
2020

2121
function AppProviderDecorator(Story, context) {
22+
const {polarisSummerEditions2023} = context.globals;
2223
if (context.args.omitAppProvider) return <Story {...context} />;
23-
2424
return (
25-
<AppProvider i18n={enTranslations}>
25+
<AppProvider
26+
features={{
27+
polarisSummerEditions2023,
28+
}}
29+
i18n={enTranslations}
30+
>
2631
<Story {...context} />
2732
</AppProvider>
2833
);
@@ -76,6 +81,7 @@ export const globalTypes = {
7681
],
7782
},
7883
},
84+
...featureFlagOptions,
7985
...gridOptions,
8086
};
8187
const viewPorts = Object.entries({

polaris-react/playground/DetailsPage.tsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ import {
4141
Thumbnail,
4242
Toast,
4343
TopBar,
44+
FooterHelp,
45+
Link,
4446
} from '../src';
45-
import type {DropZoneProps} from '../src';
47+
import type {DropZoneProps, PageProps} from '../src';
4648

4749
import styles from './DetailsPage.scss';
4850

@@ -480,7 +482,7 @@ export function DetailsPage() {
480482
setPreviewValue(newValue);
481483
}, []);
482484

483-
const actions1 = [
485+
const actions1: PageProps['secondaryActions'] = [
484486
{
485487
content: 'Duplicate',
486488
onAction: () => console.log('duplicate'),
@@ -490,17 +492,18 @@ export function DetailsPage() {
490492
onAction: () => console.log('print'),
491493
},
492494
];
493-
const actions2 = [
495+
const actions2: PageProps['secondaryActions'] = [
494496
{
495497
content: 'Print',
496498
onAction: () => console.log('print'),
497499
},
498500
];
499501

500-
const [actions, setActions] = useState(actions1);
502+
const [actions, setActions] =
503+
useState<PageProps['secondaryActions']>(actions1);
501504

502505
const toggleActions = () => {
503-
if (actions.length === 2) {
506+
if (Array.isArray(actions) && actions.length === 2) {
504507
setActions(actions2);
505508
} else {
506509
setActions(actions1);
@@ -556,15 +559,17 @@ export function DetailsPage() {
556559
onAction: () => console.log('save'),
557560
}}
558561
additionalMetadata="Created May 8, 2020 at 7:31 am from Developer Tools (via import)"
559-
secondaryActions={[
560-
...actions,
561-
{
562-
content: 'View',
563-
onAction: () => {
564-
console.log(previewValue);
562+
secondaryActions={
563+
Array.isArray(actions) && [
564+
...actions,
565+
{
566+
content: 'View',
567+
onAction: () => {
568+
console.log(previewValue);
569+
},
565570
},
566-
},
567-
]}
571+
]
572+
}
568573
actionGroups={[
569574
{
570575
title: 'Promote',
@@ -709,6 +714,12 @@ export function DetailsPage() {
709714
{pageMarkup}
710715
{toastMarkup}
711716
{modalMarkup}
717+
<FooterHelp>
718+
Learn more about{' '}
719+
<Link url="https://help.shopify.com/manual/orders/fulfill-orders">
720+
fulfilling orders
721+
</Link>
722+
</FooterHelp>
712723
</Frame>
713724
);
714725
}

polaris-react/playground/KitchenSink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function KitchenSink() {
2626
'Sheet',
2727
'Frame',
2828
'Loading',
29+
'AppProvider',
2930
].includes(id.split(':')[0]),
3031
)
3132
.map(([id, Story]) => {

polaris-react/src/components/ActionMenu/components/Actions/Actions.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {useI18n} from '../../../../utilities/i18n';
1313
import {SecondaryAction} from '../SecondaryAction';
1414
import {useEventListener} from '../../../../utilities/use-event-listener';
1515
import {useIsomorphicLayoutEffect} from '../../../../utilities/use-isomorphic-layout-effect';
16+
import {useFeatures} from '../../../../utilities/features';
1617

1718
import styles from './Actions.scss';
1819

@@ -41,6 +42,7 @@ export function Actions({actions = [], groups = [], onActionRollup}: Props) {
4142
const timesMeasured = useRef(0);
4243
const actionWidthsRef = useRef<number[]>([]);
4344
const rollupActiveRef = useRef<boolean | null>(null);
45+
const {polarisSummerEditions2023} = useFeatures();
4446
const [activeMenuGroup, setActiveMenuGroup] = useState<string | undefined>(
4547
undefined,
4648
);
@@ -311,7 +313,7 @@ export function Actions({actions = [], groups = [], onActionRollup}: Props) {
311313
});
312314

313315
const groupedActionsMarkup = (
314-
<ButtonGroup spacing="extraTight">
316+
<ButtonGroup spacing={polarisSummerEditions2023 ? 'tight' : 'extraTight'}>
315317
{rollUppableActionsMarkup}
316318
{actionsMarkup}
317319
{groupsMarkup}

polaris-react/src/components/ActionMenu/components/RollupActions/RollupActions.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import '../../../../styles/common';
2+
13
.RollupActivator {
24
text-align: right;
35
// Override `.iconOnly` negative margins
@@ -11,5 +13,27 @@
1113
&:focus {
1214
border: var(--p-border-width-1) solid var(--p-color-border-strong);
1315
}
16+
17+
#{$se23} & {
18+
background: var(--p-color-bg-strong);
19+
border-radius: var(--p-border-radius-2);
20+
/* stylelint-disable-next-line selector-max-combinators -- se23 */
21+
&:hover {
22+
background: var(--p-color-bg-strong-hover);
23+
}
24+
/* stylelint-disable-next-line selector-max-combinators -- se23 */
25+
&:focus {
26+
/* stylelint-disable-next-line polaris/border/polaris/at-rule-disallowed-list -- se23 button overrides */
27+
@include no-focus-ring;
28+
outline: var(--p-border-width-2) solid
29+
var(--p-color-border-interactive-focus);
30+
outline-offset: var(--p-space-05);
31+
background: var(--p-color-bg-strong-active);
32+
}
33+
/* stylelint-disable-next-line selector-max-combinators -- se23 */
34+
&:active {
35+
background: var(--p-color-bg-strong-active);
36+
}
37+
}
1438
}
1539
}

0 commit comments

Comments
 (0)