index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/index.ts | export * from './PortalsManager';
| 0 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/components/index.ts | export * from './PortalsContainer';
| 1 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/components | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/components/PortalsContainer/PortalsContainer.tsx | import React, {forwardRef} from 'react';
import type {RefObject} from 'react';
export interface PolarisContainerProps {}
function PortalsContainerComponent(
_props: PolarisContainerProps,
ref: RefObject<HTMLDivElement>,
) {
return <div id="PolarisPortalsContainer" ref={ref} />;
}
export const PortalsContainer ... | 2 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/components | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/components/PortalsContainer/index.ts | export * from './PortalsContainer';
| 3 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager | petrpan-code/Shopify/polaris/polaris-react/src/components/PortalsManager/tests/PortalsManager.test.tsx | import React from 'react';
import {mountWithApp, mount} from 'tests/utilities';
import {usePortalsManager} from '../../../utilities/portals';
import {PortalsManager} from '../PortalsManager';
const TestConsumer = () => {
const portalsManager = usePortalsManager();
return <>{portalsManager.container ? portalsManag... | 4 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/PositionedOverlay.scss | .PositionedOverlay {
position: absolute;
z-index: var(--p-z-index-2);
}
.fixed {
position: fixed;
}
.calculating {
visibility: hidden;
}
.preventInteraction {
pointer-events: none;
}
| 5 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/PositionedOverlay.tsx | import React, {PureComponent} from 'react';
import {classNames} from '../../utilities/css';
import {getRectForNode, Rect} from '../../utilities/geometry';
// eslint-disable-next-line import/no-deprecated
import {EventListener} from '../EventListener';
import {Scrollable} from '../Scrollable';
import {layer, dataPolari... | 6 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/index.ts | export * from './PositionedOverlay';
| 7 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/tests/PositionedOverlay.test.tsx | import React, {useRef} from 'react';
import {mountWithApp} from 'tests/utilities';
// eslint-disable-next-line import/no-deprecated
import {EventListener} from '../../EventListener';
import {PositionedOverlay} from '../PositionedOverlay';
import * as mathModule from '../utilities/math';
import * as geometry from '../.... | 8 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/utilities/math.ts | import {Rect} from '../../../utilities/geometry';
export type PreferredPosition = 'above' | 'below' | 'mostSpace';
export type PreferredAlignment = 'left' | 'center' | 'right';
export interface Margins {
activator: number;
container: number;
horizontal: number;
}
export function calculateVerticalPosition(
a... | 9 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/utilities | petrpan-code/Shopify/polaris/polaris-react/src/components/PositionedOverlay/utilities/tests/math.test.ts | import {Rect} from '../../../../utilities/geometry';
import {intersectionWithViewport} from '../math';
describe('intersectionWithViewport', () => {
const viewport = new Rect({
top: 0,
left: 0,
width: 1000,
height: 1000,
});
it('clips the given rect to stay within the viewport (top-left clip)', (... | 10 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ProgressBar/ProgressBar.scss | @import '../../styles/common';
@function progress-bar-height($height: base) {
$base: 16px;
$data: (
small: $base * 0.5,
base: $base,
large: $base * 2,
);
@return map-get($data, $height);
}
.ProgressBar {
@include scope-custom-property('progress-bar', 'duration');
@include scope-custom-propert... | 11 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ProgressBar/ProgressBar.stories.tsx | import React from 'react';
import type {ComponentMeta} from '@storybook/react';
import {ProgressBar} from '@shopify/polaris';
export default {
component: ProgressBar,
} as ComponentMeta<typeof ProgressBar>;
export function Default() {
return <ProgressBar progress={75} />;
}
export function Small() {
return <Pr... | 12 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ProgressBar/ProgressBar.tsx | import React, {useRef} from 'react';
import {CSSTransition} from 'react-transition-group';
import {classNames, variationName} from '../../utilities/css';
import {useI18n} from '../../utilities/i18n';
import {useTheme} from '../../utilities/use-theme';
import styles from './ProgressBar.scss';
type Size = 'small' | 'm... | 13 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ProgressBar/index.ts | export * from './ProgressBar';
| 14 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/ProgressBar | petrpan-code/Shopify/polaris/polaris-react/src/components/ProgressBar/tests/ProgressBar.test.tsx | import React from 'react';
import {CSSTransition} from 'react-transition-group';
import {mountWithApp} from 'tests/utilities';
import {ProgressBar} from '../ProgressBar';
import styles from '../ProgressBar.scss';
describe('<ProgressBar />', () => {
it('sets the progress element to 80 when the progress is 80', () =>... | 15 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RadioButton/RadioButton.scss | @import '../../styles/common';
.RadioButton {
position: relative;
margin: var(--p-space-025);
}
/* stylelint-disable selector-max-specificity, selector-max-class, selector-max-combinators -- code is much more readable this way */
.Input {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT CO... | 16 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RadioButton/RadioButton.stories.tsx | import React, {useCallback, useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
RadioButton,
LegacyStack,
Card,
BlockStack,
Text,
Box,
Divider,
} from '@shopify/polaris';
export default {
component: RadioButton,
} as ComponentMeta<typeof RadioButton>;
export function ... | 17 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RadioButton/RadioButton.tsx | import React, {useRef, useId} from 'react';
import {classNames, variationName} from '../../utilities/css';
import type {ResponsiveProp} from '../../utilities/css';
import {Choice, helpTextID} from '../Choice';
import type {ChoiceBleedProps} from '../Choice';
import styles from './RadioButton.scss';
export interface ... | 18 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RadioButton/index.ts | export * from './RadioButton';
| 19 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RadioButton | petrpan-code/Shopify/polaris/polaris-react/src/components/RadioButton/tests/RadioButton.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {RadioButton} from '../RadioButton';
describe('<RadioButton />', () => {
describe('checked', () => {
it('gets passed to the input', () => {
const input = mountWithApp(
<RadioButton
label="RadioButton"
... | 20 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/RangeSlider.scss | .RangeSlider {
// stylelint-disable -- Polaris component custom properties
--pc-range-slider-input: 10;
--pc-range-slider-output: 20;
--pc-range-slider-track-height: 4px;
--pc-range-slider-thumb-size: 16px;
--pc-track-dashed-border-radius: var(--p-border-radius-100);
// stylelint-enable
}
@mixin track-da... | 21 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/RangeSlider.stories.tsx | import React, {useCallback, useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
LegacyCard,
RangeSlider,
LegacyStack,
TextField,
} from '@shopify/polaris';
export default {
component: RangeSlider,
} as ComponentMeta<typeof RangeSlider>;
export function Default() {
const [... | 22 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/RangeSlider.tsx | import React, {useId} from 'react';
import type {RangeSliderProps, RangeSliderValue, DualValue} from './types';
import {SingleThumb, DualThumb} from './components';
export type {RangeSliderProps};
// The script in the styleguide that generates the Props Explorer data expects
// that the interface defining the props ... | 23 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/index.ts | export * from './RangeSlider';
| 24 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/types.ts | import type {LabelledProps} from '../Labelled';
import type {Error} from '../../types';
export type DualValue = [number, number];
export type RangeSliderValue = number | DualValue;
export interface RangeSliderProps {
/** Label for the range input */
label: React.ReactNode;
/** Adds an action to the label */
... | 25 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/index.ts | export * from './DualThumb';
export * from './SingleThumb';
| 26 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/DualThumb/DualThumb.scss | @import '../../../../styles/common';
@import '../../RangeSlider';
$range-wrapper: 28px;
.DualThumb {
position: relative;
width: 100%;
display: flex;
align-items: center;
}
.TrackWrapper {
position: relative;
display: flex;
align-items: center;
width: 100%;
min-height: $range-wrapper;
cursor: poin... | 27 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/DualThumb/DualThumb.tsx | import React, {Component, createRef} from 'react';
import {debounce} from '../../../../utilities/debounce';
import {classNames} from '../../../../utilities/css';
import {FeaturesContext} from '../../../../utilities/features';
import type {RangeSliderProps, DualValue} from '../../types';
import {Labelled, labelID} from... | 28 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/DualThumb/index.ts | export * from './DualThumb';
| 29 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/DualThumb | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/DualThumb/tests/DualThumb.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import type {CustomRoot} from 'tests/utilities';
import {Key} from '../../../../../types';
import {DualThumb} from '../DualThumb';
import type {DualThumbProps} from '../DualThumb';
type MountedComponentType = CustomRoot<any, any>;
describe('<Du... | 30 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/SingleThumb/SingleThumb.scss | @import '../../../../styles/common';
@import '../../RangeSlider';
@mixin range-track-selectors {
&::-ms-track {
outline: var(--p-border-width-025) solid transparent;
@content;
}
&::-moz-range-track {
@content;
}
&::-webkit-slider-runnable-track {
@content;
}
}
@mixin range-thumb-selector... | 31 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/SingleThumb/SingleThumb.tsx | import React from 'react';
import {classNames} from '../../../../utilities/css';
import {clamp} from '../../../../utilities/clamp';
import {Labelled, helpTextID} from '../../../Labelled';
import {Text} from '../../../Text';
import {invertNumber} from '../../utilities';
import type {RangeSliderProps} from '../../types'... | 32 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/SingleThumb/index.ts | export * from './SingleThumb';
| 33 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/SingleThumb | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/components/SingleThumb/tests/SingleThumb.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {InlineError} from '../../../../InlineError';
import {SingleThumb} from '../SingleThumb';
const mockProps = {
id: 'MyRangeSlider',
label: 'RangeSlider',
min: 10,
max: 20,
step: 0.5,
onChange: noop,
value: 15,
};
describe('<... | 34 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/tests/RangeSlider.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {RangeSlider} from '../RangeSlider';
import {DualThumb, SingleThumb} from '../components';
const mockRangeSliderProps = {
label: 'RangeSlider',
onChange: noop,
};
describe('<RangeSlider />', () => {
describe('<DualThumb />', () => ... | 35 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/utilities/index.ts | export {invertNumber} from './invertNumber';
| 36 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/utilities/invertNumber.ts | export function invertNumber(number: number) {
if (Math.sign(number) === 1) {
return -Math.abs(number);
} else if (Math.sign(number) === -1) {
return Math.abs(number);
} else {
return 0;
}
}
| 37 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/utilities | petrpan-code/Shopify/polaris/polaris-react/src/components/RangeSlider/utilities/tests/invertNumber.test.ts | import {invertNumber} from '../index';
describe('invertNumber', () => {
it('returns a negative number when the argument is positive', () => {
const negative = invertNumber(10);
expect(negative).toBe(-10);
});
it('returns a positive number when the argument is negative', () => {
const negative = inve... | 38 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceItem/ResourceItem.scss | @import '../../styles/common';
@import '../ResourceList/variables';
@mixin action-hide {
clip: rect(0, 0, 0, 0);
overflow: hidden;
}
@mixin action-unhide {
clip: auto;
overflow: visible;
}
.ResourceItem {
// stylelint-disable -- Polaris component custom properties
--pc-resource-item-min-height: 44px;
-... | 39 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceItem/ResourceItem.stories.tsx | import React, {useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
Avatar,
LegacyCard,
ResourceItem,
ResourceList,
Text,
} from '@shopify/polaris';
import type {ResourceListProps} from '@shopify/polaris';
export default {
component: ResourceItem,
} as ComponentMeta<typeof ... | 40 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceItem/ResourceItem.tsx | import React, {Component, createRef, useContext, useId} from 'react';
import {HorizontalDotsMinor} from '@shopify/polaris-icons';
import isEqual from 'react-fast-compare';
import {ActionList} from '../ActionList';
import {Box} from '../Box';
import {Button, buttonsFrom} from '../Button';
import {ButtonGroup} from '../... | 41 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceItem/index.ts | export * from './ResourceItem';
| 42 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceItem | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceItem/tests/ResourceItem.test.tsx | import React from 'react';
import type {AllHTMLAttributes} from 'react';
import {mountWithApp} from 'tests/utilities';
import {matchMedia} from '@shopify/jest-dom-mocks';
import {setMediaWidth} from 'tests/utilities/breakpoints';
import {Avatar} from '../../Avatar';
import {Button} from '../../Button';
import {ButtonG... | 43 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList/ResourceList.scss | @import '../../styles/common';
@import './variables';
$item-wrapper-loading-height: 64px;
@mixin disabled-pointer-events {
pointer-events: none;
}
@mixin resource-list-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.FiltersWrapper {
padding: var(--p-space-300);
+ .ResourceLis... | 44 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList/ResourceList.stories.tsx | import React, {useCallback, useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
Avatar,
Button,
Card,
EmptyState,
LegacyFilters,
Layout,
Page,
ResourceItem,
ResourceList,
TextField,
Text,
} from '@shopify/polaris';
export default {
component: ResourceList,
} as... | 45 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList/ResourceList.tsx | import React, {
useCallback,
useEffect,
useReducer,
useRef,
useState,
Children,
} from 'react';
import {EnableSelectionMinor} from '@shopify/polaris-icons';
import {themeDefault, toPx} from '@shopify/polaris-tokens';
import {debounce} from '../../utilities/debounce';
import {classNames} from '../../utiliti... | 46 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList/_variables.scss | // stylelint-disable -- generated by polaris-migrator DO NOT COPY
$resource-list-variables: (
header-min-height: 56px,
header-vertical-padding: var(--p-space-200),
header-content-min-height: control-height(),
list-stacking-order: 1,
content-wrapper-stacking-order: 1,
bulk-actions-wrapper-stacking-order: 2,
... | 47 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList/index.ts | export * from './ResourceList';
| 48 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList | petrpan-code/Shopify/polaris/polaris-react/src/components/ResourceList/tests/ResourceList.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import type {Root, Node, Element} from '@shopify/react-testing';
import {matchMedia} from '@shopify/jest-dom-mocks';
import {BulkActions} from '../../BulkActions';
import type {useIsBulkActionsSticky} from '../../BulkActions';
import {SelectAllAc... | 49 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ScrollLock/ScrollLock.scss | [data-lock-scrolling] {
overflow-y: scroll;
margin: 0;
// stylelint-disable selector-max-attribute -- generated by polaris-migrator DO NOT COPY
&[data-lock-scrolling-hidden] {
overflow-y: hidden;
}
[data-lock-scrolling-wrapper] {
overflow: hidden;
height: 100%;
}
}
| 50 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ScrollLock/ScrollLock.ts | import {useEffect} from 'react';
import {useScrollLockManager} from '../../utilities/scroll-lock-manager';
import './ScrollLock.scss';
interface ScrollLockProps {}
// Even though this has no args, reference ScrollLockProps so the prop explorer
// in the styleguide works without warnings about unfound props
export fu... | 51 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ScrollLock/index.ts | export * from './ScrollLock';
| 52 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/ScrollLock | petrpan-code/Shopify/polaris/polaris-react/src/components/ScrollLock/tests/ScrollLock.test.tsx | import React, {useState, useCallback} from 'react';
import {mountWithApp} from 'tests/utilities';
import {SCROLL_LOCKING_ATTRIBUTE} from '../../../utilities/scroll-lock-manager';
import {ScrollLock} from '../ScrollLock';
describe('ScrollLock', () => {
let scrollSpy: jest.SpyInstance;
beforeEach(() => {
scrol... | 53 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/Scrollable.scss | .Scrollable {
// stylelint-disable -- Polaris component custom properties
--pc-scrollable-shadow-size: var(--p-space-500);
--pc-scrollable-shadow-color: rgba(0, 0, 0, 0.15);
--pc-scrollable-shadow-bottom: 0 var(--pc-scrollable-shadow-size)
var(--pc-scrollable-shadow-size) var(--pc-scrollable-shadow-size)
... | 54 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/Scrollable.stories.tsx | import React, {ComponentRef, useRef} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
Button,
LegacyCard,
Scrollable,
Banner,
Box,
Text,
BlockStack,
FormLayout,
TextField,
} from '@shopify/polaris';
import type {ScrollableRef} from '@shopify/polaris';
export default {
com... | 55 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/Scrollable.tsx | import React, {
useEffect,
useRef,
useState,
useCallback,
useImperativeHandle,
forwardRef,
} from 'react';
import {debounce} from '../../utilities/debounce';
import {classNames} from '../../utilities/css';
import {
StickyManager,
StickyManagerContext,
} from '../../utilities/sticky-manager';
import {sc... | 56 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/context.ts | import {createContext} from 'react';
type ScrollToPositionFn = (scrollY: number) => void;
export const ScrollableContext = createContext<ScrollToPositionFn | undefined>(
undefined,
);
| 57 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/index.ts | export * from './Scrollable';
| 58 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components/index.ts | export * from './ScrollTo';
| 59 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components/ScrollTo/ScrollTo.tsx | import React, {useContext, useEffect, useRef, useId} from 'react';
import {ScrollableContext} from '../../context';
export function ScrollTo() {
const anchorNode = useRef<HTMLAnchorElement>(null);
const scrollToPosition = useContext(ScrollableContext);
useEffect(() => {
if (!scrollToPosition || !anchorNode... | 60 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components/ScrollTo/index.ts | export * from './ScrollTo';
| 61 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components/ScrollTo | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/components/ScrollTo/tests/ScrollTo.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {ScrollTo} from '../ScrollTo';
import {ScrollableContext} from '../../../context';
describe('<Scrollable.ScrollTo />', () => {
it('calls scrollToPosition on mount', () => {
const spy = jest.fn();
mountWithApp(
<Scrollable... | 62 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable | petrpan-code/Shopify/polaris/polaris-react/src/components/Scrollable/tests/Scrollable.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {Scrollable} from '../Scrollable';
import {ScrollableContext} from '../context';
import type {ScrollableProps} from '../Scrollable';
describe('<Scrollable />', () => {
let rafSpy: jest.SpyInstance;
beforeAll(() => {
rafSpy = jest... | 63 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Select/Select.scss | @import '../../styles/common';
.Select {
// stylelint-disable -- Polaris component custom properties
--pc-select-backdrop: 10;
--pc-select-content: 20;
--pc-select-input: 30;
// stylelint-enable
position: relative;
// IE 11 fix to remove default dropdown arrow
select::-ms-expand {
display: none;
... | 64 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Select/Select.stories.tsx | import React, {useCallback, useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
LegacyCard,
FormLayout,
Icon,
InlineError,
Link,
Select,
LegacyStack,
TextField,
Text,
} from '@shopify/polaris';
import {CaretDownMinor, CaretUpMinor} from '@shopify/polaris-icons';
expo... | 65 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Select/Select.tsx | import React, {useCallback, useId} from 'react';
import {SelectMinor} from '@shopify/polaris-icons';
import {classNames, variationName} from '../../utilities/css';
import {Labelled, helpTextID} from '../Labelled';
import type {LabelledProps} from '../Labelled';
import {Box} from '../Box';
import {Icon} from '../Icon';... | 66 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Select/index.ts | export * from './Select';
| 67 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Select | petrpan-code/Shopify/polaris/polaris-react/src/components/Select/tests/Select.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {CircleTickOutlineMinor} from '@shopify/polaris-icons';
import {InlineError} from '../../InlineError';
import {Icon} from '../../Icon';
import {Labelled} from '../../Labelled';
import {Select} from '../Select';
describe('<Select />', () =... | 68 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SelectAllActions/SelectAllActions.scss | @import '../../styles/common';
.SelectAllActions {
display: flex;
gap: var(--p-space-200);
align-items: center;
justify-content: flex-start;
will-change: opacity;
}
.SelectAllActions-entering,
.SelectAllActions-exiting {
opacity: 0;
display: flex;
}
.SelectAllActions-entered {
opacity: 1;
display: ... | 69 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SelectAllActions/SelectAllActions.tsx | import React, {forwardRef} from 'react';
import {Transition} from 'react-transition-group';
import {classNames} from '../../utilities/css';
import type {Action} from '../../types';
import {UnstyledButton} from '../UnstyledButton';
import {CheckableButton} from '../CheckableButton';
import styles from './SelectAllActi... | 70 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SelectAllActions/index.ts | export * from './SelectAllActions';
| 71 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/SelectAllActions | petrpan-code/Shopify/polaris/polaris-react/src/components/SelectAllActions/tests/SelectAllActions.test.tsx | import React from 'react';
import {Transition, CSSTransition} from 'react-transition-group';
import {mountWithApp} from 'tests/utilities';
import {CheckableButton} from '../../CheckableButton';
import {UnstyledButton} from '../../UnstyledButton';
import {SelectAllActions} from '../SelectAllActions';
import styles from... | 72 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingAction/SettingAction.scss | @import '../../styles/common';
$feature-width: 350px;
.SettingAction {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-top: calc(-1 * var(--p-space-400));
margin-left: calc(-1 * var(--p-space-400));
}
.Setting,
.Action {
flex: 0 0 auto;
margin-top: var(--p-space-400);
margin-left: var(--p... | 73 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingAction/SettingAction.tsx | import React from 'react';
import styles from './SettingAction.scss';
export interface SettingActionProps {
action?: React.ReactNode;
children?: React.ReactNode;
}
export function SettingAction({action, children}: SettingActionProps) {
return (
<div className={styles.SettingAction}>
<div className={s... | 74 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingAction/index.ts | export * from './SettingAction';
| 75 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingToggle/SettingToggle.stories.tsx | import React, {useCallback, useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
SettingToggle,
Text,
InlineStack,
Box,
Card,
Button,
Badge,
BlockStack,
useBreakpoints,
} from '@shopify/polaris';
import {CircleInformationMajor} from '@shopify/polaris-icons';
export de... | 76 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingToggle/SettingToggle.tsx | import React, {useId} from 'react';
import type {ComplexAction} from '../../types';
import {SettingAction} from '../SettingAction';
import {buttonFrom} from '../Button';
// eslint-disable-next-line import/no-deprecated
import {LegacyCard} from '../LegacyCard';
export interface SettingToggleProps {
/** Inner content... | 77 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingToggle/index.ts | export * from './SettingToggle';
| 78 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingToggle | petrpan-code/Shopify/polaris/polaris-react/src/components/SettingToggle/tests/SettingToggle.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {SettingAction} from '../../SettingAction';
// eslint-disable-next-line import/no-deprecated
import {SettingToggle} from '../SettingToggle';
import {Button} from '../../Button';
describe('<SettingToggle />', () => {
function getComponen... | 79 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ShadowBevel/ShadowBevel.scss | @import '../../styles/common';
.ShadowBevel {
overflow: hidden;
// stylelint-disable-next-line -- Explicitly set `0` to create a local stacking context. While the initial `z-index: auto` has a stack level of `0` within the current stacking context, it does not create a new local stacking context.
z-index: 0;
... | 80 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ShadowBevel/ShadowBevel.stories.tsx | import React from 'react';
import type {ComponentMeta} from '@storybook/react';
import type {BoxProps} from '@shopify/polaris';
import {Box, BlockStack, InlineCode} from '@shopify/polaris';
import {ShadowBevel} from './ShadowBevel';
export default {
component: ShadowBevel,
} as ComponentMeta<typeof ShadowBevel>;
e... | 81 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ShadowBevel/ShadowBevel.tsx | import React from 'react';
import type {
BorderRadiusAliasOrScale,
ShadowAliasOrScale,
} from '@shopify/polaris-tokens';
import {getResponsiveValue} from '../../utilities/css';
import type {ResponsiveProp} from '../../utilities/css';
import styles from './ShadowBevel.scss';
export interface ShadowBevelProps {
... | 82 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/ShadowBevel/index.ts | export * from './ShadowBevel';
| 83 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/ShadowBevel | petrpan-code/Shopify/polaris/polaris-react/src/components/ShadowBevel/tests/ShadowBevel.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {ShadowBevel} from '..';
describe('ShadowBevel', () => {
it('renders children', () => {
const shadowBevel = mountWithApp(
<ShadowBevel boxShadow="300" borderRadius="300">
<p>hello</p>
<p>world</p>
</Shado... | 84 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Sheet/Sheet.scss | @import '../../styles/common';
$sheet-desktop-width: 380px;
.Sheet {
position: fixed;
bottom: 0;
width: 100%;
height: 100%;
background-color: var(--p-color-bg-surface);
box-shadow: var(--p-shadow-600);
@media screen and (-ms-high-contrast: active) {
border-left: var(--p-border-width-025) solid var(... | 85 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Sheet/Sheet.stories.tsx | import React, {useCallback, useState} from 'react';
import type {ComponentMeta} from '@storybook/react';
import {
Button,
LegacyCard,
ChoiceList,
Text,
List,
Page,
Scrollable,
Sheet,
EmptySearchResult,
Listbox,
TextField,
TextContainer,
Icon,
AutoSelection,
} from '@shopify/polaris';
import ... | 86 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Sheet/Sheet.tsx | import React, {useCallback, useRef, useEffect} from 'react';
import {CSSTransition} from 'react-transition-group';
import {focusFirstFocusableNode} from '../../utilities/focus';
import {useMediaQuery} from '../../utilities/media-query';
import {classNames} from '../../utilities/css';
import {Key} from '../../types';
i... | 87 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/Sheet/index.ts | export * from './Sheet';
| 88 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/Sheet | petrpan-code/Shopify/polaris/polaris-react/src/components/Sheet/tests/Sheet.test.tsx | /* eslint-disable import/no-deprecated */
import React, {useRef} from 'react';
import {CSSTransition} from 'react-transition-group';
import {mountWithApp} from 'tests/utilities';
import {Backdrop} from '../../Backdrop';
import {Button} from '../../Button';
import {Sheet} from '../Sheet';
describe('<Sheet />', () => {... | 89 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonBodyText/SkeletonBodyText.scss | @import '../../styles/common';
$body-text-last-line-width: 80%;
.SkeletonBodyTextContainer {
width: 100%;
}
.SkeletonBodyText {
height: var(--p-space-200);
display: flex;
background-color: var(--p-color-bg-fill-tertiary);
border-radius: var(--p-border-radius-100);
@media screen and (-ms-high-contrast: a... | 90 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonBodyText/SkeletonBodyText.stories.tsx | import React from 'react';
import type {ComponentMeta} from '@storybook/react';
import {SkeletonBodyText} from '@shopify/polaris';
export default {
component: SkeletonBodyText,
} as ComponentMeta<typeof SkeletonBodyText>;
export function Default() {
return <SkeletonBodyText />;
}
export function SingleLineConten... | 91 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonBodyText/SkeletonBodyText.tsx | import React from 'react';
import styles from './SkeletonBodyText.scss';
export interface SkeletonBodyTextProps {
/**
* Number of lines to display
* @default 3
*/
lines?: number;
}
export function SkeletonBodyText({lines = 3}: SkeletonBodyTextProps) {
const bodyTextLines = [];
for (let i = 0; i < l... | 92 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonBodyText/index.ts | export * from './SkeletonBodyText';
| 93 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonBodyText | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonBodyText/tests/SkeletonBodyText.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {SkeletonBodyText} from '../SkeletonBodyText';
describe('<SkeletonBodyText />', () => {
it('renders the amount of lines provided', () => {
const skeletonBodyText = mountWithApp(<SkeletonBodyText lines={2} />);
expect(
skel... | 94 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonDisplayText/SkeletonDisplayText.scss | @import '../../styles/common';
$skeleton-display-text-max-width: 120px;
@mixin skeleton-display-text-height {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
height: var(--pc-skeleton-display-text-height);
@media #{$p-breakpoints-md-up} {
// stylelint-disable-next-line -- genera... | 95 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonDisplayText/SkeletonDisplayText.stories.tsx | import React from 'react';
import type {ComponentMeta} from '@storybook/react';
import {SkeletonDisplayText} from '@shopify/polaris';
export default {
component: SkeletonDisplayText,
} as ComponentMeta<typeof SkeletonDisplayText>;
export function MediumAndLarge() {
return <SkeletonDisplayText size="medium" />;
}
... | 96 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonDisplayText/SkeletonDisplayText.tsx | import React from 'react';
import {classNames, variationName} from '../../utilities/css';
import styles from './SkeletonDisplayText.scss';
type Size = 'small' | 'medium' | 'large' | 'extraLarge';
export interface SkeletonDisplayTextProps {
/**
* Size of the text
* @default 'medium'
*/
size?: Size;
}
e... | 97 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonDisplayText/index.ts | export * from './SkeletonDisplayText';
| 98 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonDisplayText | petrpan-code/Shopify/polaris/polaris-react/src/components/SkeletonDisplayText/tests/SkeletonDisplayText.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {SkeletonDisplayText} from '../SkeletonDisplayText';
describe('<SkeletonDisplayText />', () => {
it('renders', () => {
const skeletonBodyText = mountWithApp(<SkeletonDisplayText />);
expect(skeletonBodyText).toContainReactCompon... | 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.