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/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/is-input-focused.test.tsx | import React from 'react';
import {mount} from 'tests/utilities';
import {isInputFocused} from '../is-input-focused';
describe('isInputFocused', () => {
it('returns true when the focused element is not input, textarea, select or has the attribute contenteditable', () => {
const markup = mount(<button />);
m... | 400 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/is-object.test.ts | import {isObject} from '../is-object';
describe('isObject', () => {
it('returns false for null', () => {
expect(isObject(null)).toBe(false);
});
it('returns false for primitive values', () => {
expect(isObject(4)).toBe(false);
});
it('returns true for objects', () => {
expect(isObject({})).toBe... | 401 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/merge.test.ts | import {merge} from '../merge';
describe('merge', () => {
it('returns an object', () => {
expect(merge()).toStrictEqual({});
});
it('does not merge prototypes', () => {
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
class Obj {}
(Obj.prototype as any).prototypeVal = 'val';
... | 402 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/pick.test.ts | import {pick} from '../pick';
describe('pick', () => {
it('returns an empty object when null is provided', () => {
expect(pick(null, 'a')).toStrictEqual({});
});
it('returns an empty object when an empty keypath is provided', () => {
expect(pick({propA: 1}, '')).toStrictEqual({});
});
it('does not ... | 403 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/pluck-deep.test.ts | import {pluckDeep} from '../pluck-deep';
describe('pluckDeep', () => {
it('will return a value from a flat object', () => {
const pluckedValue = pluckDeep({test: 'val', hello: 'world'}, 'hello');
expect(pluckedValue).toBe('world');
});
it('will return a value from a nested structure', () => {
const ... | 404 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/roundNumberToDecimals.test.ts | import {roundNumberToDecimalPlaces} from '../roundNumberToDecimalPlaces';
describe('roundNumberToDecimalPlaces', () => {
it('rounds 1.004 to 1.00', () => {
expect(roundNumberToDecimalPlaces(1.004, 2)).toBe(1.0);
});
it('rounds 1.005 to 1.01', () => {
expect(roundNumberToDecimalPlaces(1.005, 2)).toBe(1.0... | 405 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/set-root-property.test.ts | import {setRootProperty} from '../set-root-property';
describe('setRootProperty', () => {
it('sets styles on the document element', () => {
setRootProperty('--topBar', '#eee');
expect(document.documentElement.style.getPropertyValue('--topBar')).toBe(
'#eee',
);
});
});
| 406 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-breakpoints-ssr.test.tsx | /**
* @jest-environment node
*/
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import {useBreakpoints} from '../breakpoints';
describe('useBreakpoints SSR', () => {
it('applies false as the default value for each directional breakpoints alias', () => {
ReactDOMServer.renderToStatic... | 407 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-breakpoints.test.tsx | import React from 'react';
import {mount} from 'tests/utilities';
import {matchMedia} from '@shopify/jest-dom-mocks';
import {themeDefault, getMediaConditions} from '@shopify/polaris-tokens';
import type {BreakpointsTokenName} from '@shopify/polaris-tokens';
import {useBreakpoints, getBreakpointsQueryEntries} from '..... | 408 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-component-did-mount.test.tsx | import React from 'react';
import {mount} from 'tests/utilities';
import {useComponentDidMount} from '../use-component-did-mount';
import {useIsAfterInitialMount} from '../use-is-after-initial-mount';
describe('useComponentDidMount', () => {
it('invokes your callback after mount', () => {
const spy = jest.fn();... | 409 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-disable-interaction.test.tsx | import {mount} from '@shopify/react-testing';
import React from 'react';
import {useDisableClick, useDisableKeyboard} from '../use-disable-interaction';
describe('useDisableClick', () => {
it('returns click handler passed but prevents interaction if the boolean is true', () => {
const spy = jest.fn();
func... | 410 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-event-listener.test.tsx | import React, {useRef} from 'react';
import {mount} from 'tests/utilities';
import {useEventListener} from '../use-event-listener';
describe('useEventListener', () => {
it('calls handler when the resize event is fired', () => {
function MockComponent() {
useEventListener('resize', spy);
return null;... | 411 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx | import React from 'react';
import {mountWithApp} from 'tests/utilities';
import {
useIndexResourceState,
SelectionType,
} from '../use-index-resource-state';
interface TypedChildProps {
onClick: ReturnType<typeof useIndexResourceState>['handleSelectionChange'];
allResourcesSelected: ReturnType<
typeof use... | 412 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-is-after-initial-mount.test.tsx | import React from 'react';
import {mount} from 'tests/utilities';
import {useIsAfterInitialMount} from '../use-is-after-initial-mount';
describe('useIsAfterInitialMount', () => {
it('starts off false', () => {
let isAfterInitialMountValue: boolean | undefined;
function Component() {
const isAfterIniti... | 413 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-is-mounted-ref.test.tsx | import React, {useEffect} from 'react';
import {mount} from 'tests/utilities';
import {useIsMountedRef} from '../use-is-mounted-ref';
describe('useIsMountedRef', () => {
it('returns a false value before mounting', () => {
const spy = jest.fn((_) => {});
function MockComponent() {
const isMounted = us... | 414 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-lazy-ref.test.tsx | import React, {useEffect, useState} from 'react';
import {mount} from 'tests/utilities';
import {useLazyRef} from '../use-lazy-ref';
describe('useLazyRef', () => {
it('returns a ref object', () => {
const spy = jest.fn();
function MockComponent() {
const lazyValue = useLazyRef(() => true);
spy(... | 415 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-on-value-change.test.tsx | import React from 'react';
import {mount} from 'tests/utilities';
import {useOnValueChange} from '../use-on-value-change';
describe('useOnValueChnge', () => {
function MockComponent({value, spy}: {value: string; spy: () => void}) {
useOnValueChange(value, spy);
return null;
}
it('does not call the onCh... | 416 |
0 | petrpan-code/Shopify/polaris/polaris-react/src/utilities | petrpan-code/Shopify/polaris/polaris-react/src/utilities/tests/use-previous.test.tsx | import React from 'react';
import {mount} from 'tests/utilities';
import {usePrevious} from '../use-previous';
describe('usePrevious', () => {
function Score({value}: {value: number}) {
const previousValue = usePrevious(value);
const newRecord =
previousValue && value > previousValue ? (
<p>We... | 417 |
0 | petrpan-code/Shopify/polaris/polaris-react | petrpan-code/Shopify/polaris/polaris-react/tests/readme-update-version.test.js | const path = require('path');
const fs = require('fs');
const {semverRegExp} = require('../scripts/utilities');
const readmePath = path.resolve(__dirname, '../README.md');
describe('readme-update-version', () => {
it('matches 2 semver numbers in README.md', () => {
const readme = fs.readFileSync(readmePath, 'u... | 418 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests | petrpan-code/Shopify/polaris/polaris-react/tests/setup/environment.ts | export {};
if (typeof window !== 'undefined') {
// Mocks for scrolling
window.scroll = () => {};
window.open = (
_url?: string,
_target?: string,
_features?: string,
_replace?: boolean,
) => null;
}
const IGNORE_ERROR_REGEXES = [
/React does not recognize the `%s` prop on a DOM element/,
];... | 419 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests | petrpan-code/Shopify/polaris/polaris-react/tests/setup/tests.ts | import {destroyAll} from '@shopify/react-testing';
import '@shopify/react-testing/matchers';
import './matchers';
// eslint-disable-next-line jest/require-top-level-describe
afterEach(() => {
destroyAll();
});
| 420 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests/setup | petrpan-code/Shopify/polaris/polaris-react/tests/setup/matchers/index.ts | import {toBeDisabled} from './props';
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace jest {
interface Matchers<R> {
toBeDisabled(): void;
}
}
}
expect.extend({toBeDisabled});
| 421 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests/setup | petrpan-code/Shopify/polaris/polaris-react/tests/setup/matchers/props.ts | import type {Node} from '@shopify/react-testing';
export function toBeDisabled(received: Node<any>) {
const pass = received.prop('disabled') === true;
return {
pass,
message() {
return pass
? 'Expected component not to be disabled, but it was.'
: "Expected component to be disabled, b... | 422 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests | petrpan-code/Shopify/polaris/polaris-react/tests/utilities/breakpoints.tsx | import {themeDefault, getMediaConditions} from '@shopify/polaris-tokens';
import type {BreakpointsTokenName} from '@shopify/polaris-tokens';
const mediaConditions = getMediaConditions(themeDefault.breakpoints);
export function setMediaWidth(breakpointsTokenName: BreakpointsTokenName) {
const aliasDirectionCondition... | 423 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests | petrpan-code/Shopify/polaris/polaris-react/tests/utilities/index.ts | export * from './react-testing';
| 424 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests | petrpan-code/Shopify/polaris/polaris-react/tests/utilities/listbox.tsx | import React from 'react';
import type {ReactElement} from 'react';
import {createMount} from '@shopify/react-testing';
// eslint-disable-next-line @shopify/strict-component-boundaries
import {PolarisTestProvider} from '../../src/components/PolarisTestProvider';
import {ListboxContext} from '../../src/utilities/listbo... | 425 |
0 | petrpan-code/Shopify/polaris/polaris-react/tests | petrpan-code/Shopify/polaris/polaris-react/tests/utilities/react-testing.tsx | import React from 'react';
import {
createMount,
mount,
Element as ReactTestingElement,
CustomRoot,
} from '@shopify/react-testing';
import translations from '../../locales/en.json';
// eslint-disable-next-line @shopify/strict-component-boundaries
import {PolarisTestProvider} from '../../src/components/Polaris... | 426 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris-tokens/CHANGELOG.md | # Changelog
## 8.1.0
### Minor Changes
- [#11087](https://github.com/Shopify/polaris/pull/11087) [`23055adcf`](https://github.com/Shopify/polaris/commit/23055adcfa97decbfbc51924bd121d1dae76ac6f) Thanks [@matallo](https://github.com/matallo)! - Added `--p-color-border-magic-secondary-hover` token
## 8.0.2
### Patch... | 427 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris-tokens/README.md | # [Polaris Tokens](https://polaris.shopify.com/tokens/getting-started-with-tokens)
[](https://www.npmjs.com/package/@shopify/polaris-tokens)
[Design tokens](https://medium.com/eightshapes-llc/tokens-in-design-systems-25dd82d58421) for ... | 428 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris-tokens/jest.config.js | module.exports = {
transform: {
'\\.(js|tsx?)$': [
'babel-jest',
{targets: 'current node', envName: 'test', rootMode: 'upward'},
],
},
};
| 429 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris-tokens/package.json | {
"name": "@shopify/polaris-tokens",
"version": "8.1.0",
"description": "",
"main": "dist/cjs/build/index.js",
"module": "dist/esm/build/index.mjs",
"types": "dist/types/build/index.d.ts",
"engines": {
"node": "^16.17.0 || >=18.12.0"
},
"exports": {
".": {
"types": "./dist/types/build/in... | 430 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris-tokens/rollup.config.mjs | import {readFileSync} from 'fs';
import {babel} from '@rollup/plugin-babel';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
const pkg = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url).pathname),
);
const extensions = ['.js', '.jsx', '.ts'... | 431 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris-tokens/tsconfig.json | {
"extends": "@shopify/typescript-configs/node-library",
"compilerOptions": {
"composite": true,
"declarationDir": "dist/types",
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "."
},
"include": ["src", "build"]
}
| 432 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/scripts/index.ts | import {toMediaConditions} from './toMediaConditions';
import {toStyleSheet} from './toStyleSheet';
import {toValues} from './toValues';
(async () => {
await Promise.all([toMediaConditions(), toStyleSheet(), toValues()]);
})();
| 433 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/scripts/toMediaConditions.ts | import fs from 'fs';
import path from 'path';
import {getMediaConditions} from '../src';
import {metaThemeDefault} from '../src/themes';
import {extractMetaTokenGroupValues} from '../src/themes/utils';
const cssOutputDir = path.join(__dirname, '../dist/css');
const cssOutputPath = path.join(cssOutputDir, 'media-queri... | 434 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/scripts/toStyleSheet.ts | import fs from 'fs';
import path from 'path';
import type {
MetaThemeShape,
MetaTokenGroupShape,
TokenName,
} from '../src/themes/types';
import {metaThemePartials, metaThemeDefault} from '../src/themes';
import {themeNameDefault} from '../src/themes/constants';
import {createThemeSelector, isTokenName} from '..... | 435 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/scripts/toValues.ts | import fs from 'fs';
import path from 'path';
import {metaThemes} from '../src/themes';
import {
extractMetaThemeValues,
resolveMetaThemeRefs,
} from '../src/themes/utils';
const outputDir = path.join(__dirname, '../build');
export async function toValues() {
await fs.promises.mkdir(outputDir).catch((error) =>... | 436 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/src/colors.ts | type ColorScale =
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
| '10'
| '11'
| '12'
| '13'
| '14'
| '15'
| '16';
type Color = {
[Scale in ColorScale]: `rgba(${number}, ${number}, ${number}, 1)`;
};
type ColorAlpha = {
[Scale in ColorScale]: `rgba(${number}, ${number}, ${nu... | 437 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/src/index.ts | export {breakpointsAliases} from './themes/base/breakpoints';
export type {BreakpointsAliasDirection} from './utils';
export {
createVar,
createVarName,
getThemeVarNames,
getMediaConditions,
toPx,
toPxs,
toRem,
} from './utils';
export {metaThemes, metaThemeDefault} from './themes';
export type {
Ex... | 438 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/src/size.ts | export const size = {
'0': '0px',
'0165': '0.66px',
'025': '1px',
'050': '2px',
'100': '4px',
'150': '6px',
'200': '8px',
'275': '11px',
'300': '12px',
'325': '13px',
'350': '14px',
'400': '16px',
'500': '20px',
'600': '24px',
'700': '28px',
'750': '30px',
'800': '32px',
'900': '36px... | 439 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/src/types.ts | export type Entry<T> = [keyof T, T[keyof T]];
export type Entries<T> = Entry<T>[];
export type Experimental<T extends string> = `${T}-experimental`;
// The following utility types are copied directly from `type-fest`:
// https://github.com/sindresorhus/type-fest
/**
* Matches any [primitive value](https://developer.... | 440 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/src/utils.ts | import type {Entry, Exact} from './types';
import type {
breakpoints as metaBreakpointsTokenGroup,
BreakpointsTokenGroup,
BreakpointsTokenName,
} from './themes/base/breakpoints';
import type {
MetaTheme,
MetaThemeShape,
MetaTokenGroupShape,
Theme,
TokenName,
} from './themes/types';
const BASE_FONT_SI... | 441 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/constants.ts | export const themeNameLight = 'light';
export const themeNameDefault = themeNameLight;
export const themeNames = [
themeNameLight,
'light-high-contrast-experimental',
] as const;
| 442 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/index.ts | import type {MetaThemePartials, MetaThemes} from './types';
import {createMetaTheme} from './utils';
import {themeNameDefault} from './constants';
import {metaThemeLight, metaThemeLightPartial} from './light';
import {
metaThemeLightHighContrast,
metaThemeLightHighContrastPartial,
} from './light-high-contrast';
e... | 443 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/light-high-contrast.ts | import * as colors from '../colors';
import {createMetaTheme, createMetaThemePartial} from './utils';
export const metaThemeLightHighContrastPartial = createMetaThemePartial({
color: {
'color-text': {
value: colors.gray[16],
},
'color-text-secondary': {
value: colors.gray[16],
},
'co... | 444 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/light.ts | import {createMetaTheme, createMetaThemePartial} from './utils';
export const metaThemeLightPartial = createMetaThemePartial({});
export const metaThemeLight = createMetaTheme(metaThemeLightPartial);
| 445 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/types.ts | import type {metaThemeBase} from './base';
import type {themeNames} from './constants';
export type MetaThemeBase = typeof metaThemeBase;
export type MetaTheme = MetaThemeBase;
export type ThemeName = typeof themeNames[number];
export type ThemeBase = ExtractMetaThemeValues<MetaThemeBase>;
export type Theme = Extract... | 446 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/utils.ts | import deepmerge from 'deepmerge';
import type {Entry, Exact} from '../types';
import {getTokenNames, tokenGroupToRems, tokenGroupNamesToRems} from '../utils';
import type {
ExtractMetaThemeValues,
ExtractMetaTokenGroupValues,
MetaThemeShape,
MetaTheme,
MetaThemePartialShape,
MetaTokenGroupShape,
ThemeN... | 447 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/border.ts | import type {MetaTokenProperties} from '../types';
import {size} from '../../size';
export type BorderRadiusScale =
| '0'
| '050'
| '100'
| '150'
| '200'
| '300'
| '400'
| '500'
| '750';
export type BorderRadiusAlias = 'full';
export type BorderRadiusAliasOrScale = BorderRadiusAlias | BorderRadiusS... | 448 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/breakpoints.ts | import type {MetaTokenProperties} from '../types';
// NOTE: Order is important here: smallest -> largest
// Exporting as const means it will be typed as a Tuple instead of string[]
export const breakpointsAliases = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
// Convert the Tuple to a union
export type BreakpointsAlias =... | 449 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/color.ts | import type {MetaTokenProperties} from '../types';
import * as colors from '../../colors';
export type ColorBackgroundAlias =
| 'bg-fill-active'
| 'bg-fill-brand-active'
| 'bg-fill-brand-disabled'
| 'bg-fill-brand-hover'
| 'bg-fill-brand-selected'
| 'bg-fill-brand'
| 'bg-fill-caution-active'
| 'bg-fill... | 450 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/font.ts | import {size} from '../../size';
import type {MetaTokenProperties} from '../types';
export type FontFamilyPrefix = 'font-family';
type FontFamilyAlias = 'sans' | 'mono';
export type FontSizePrefix = 'font-size';
export type FontSizeScale =
| '275'
| '300'
| '325'
| '350'
| '400'
| '500'
| '600'
| '750... | 451 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/height.ts | import {size} from '../../size';
import type {MetaTokenProperties} from '../types';
export type HeightScale =
| '0'
| '025'
| '050'
| '100'
| '150'
| '200'
| '300'
| '400'
| '500'
| '600'
| '700'
| '800'
| '900'
| '1000'
| '1200'
| '1600'
| '2000'
| '2400'
| '2800'
| '3200';
ex... | 452 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/index.ts | import {createMetaThemeBase} from '../../utils';
import {border} from './border';
import {breakpoints} from './breakpoints';
import {color} from './color';
import {font} from './font';
import {height} from './height';
import {motion} from './motion';
import {shadow} from './shadow';
import {space} from './space';
impo... | 453 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/motion.ts | import type {MetaTokenProperties} from '../types';
export type MotionDurationScale =
| '0'
| '50'
| '100'
| '150'
| '200'
| '250'
| '300'
| '350'
| '400'
| '450'
| '500'
| '5000';
export type MotionKeyframesAlias =
| 'bounce'
| 'fade-in'
| 'pulse'
| 'spin'
| 'appear-above'
| 'appea... | 454 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/shadow.ts | import type {MetaTokenProperties} from '../types';
export type ShadowScale = '0' | '100' | '200' | '300' | '400' | '500' | '600';
export type ShadowBevelScale = '100';
export type ShadowInsetScale = '100' | '200';
export type ShadowAlias =
| 'button'
| 'button-hover'
| 'button-inset'
| 'button-primary'
| ... | 455 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/space.ts | import {size} from '../../size';
import {createVarName} from '../../utils';
import type {MetaTokenProperties} from '../types';
export type SpaceScale =
| '0'
| '025'
| '050'
| '100'
| '150'
| '200'
| '300'
| '400'
| '500'
| '600'
| '800'
| '1000'
| '1200'
| '1600'
| '2000'
| '2400'
| ... | 456 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/text.ts | import type {MetaTokenProperties} from '../types';
import {createVar} from '../../utils';
import type {FontPrefix} from './font';
export type TextVariant =
| 'heading-3xl'
| 'heading-2xl'
| 'heading-xl'
| 'heading-lg'
| 'heading-md'
| 'heading-sm'
| 'body-lg'
| 'body-md'
| 'body-sm'
| 'body-xs';
... | 457 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/width.ts | import {size} from '../../size';
import type {MetaTokenProperties} from '../types';
export type WidthScale =
| '0'
| '025'
| '050'
| '100'
| '150'
| '200'
| '300'
| '400'
| '500'
| '600'
| '700'
| '800'
| '900'
| '1000'
| '1200'
| '1600'
| '2000'
| '2400'
| '2800'
| '3200';
exp... | 458 |
0 | petrpan-code/Shopify/polaris/polaris-tokens/src/themes | petrpan-code/Shopify/polaris/polaris-tokens/src/themes/base/zIndex.ts | import type {MetaTokenProperties} from '../types';
export type ZIndexZScale =
| '0'
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
| '10'
| '11'
| '12';
export type ZIndexTokenName = `z-index-${ZIndexZScale}`;
export type ZIndexTokenGroup = {
[TokenName in ZIndexTokenName]: string;... | 459 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/tests/toStyleSheet.test.js | import {
getMetaThemeDecls,
getMetaTokenGroupDecls,
getKeyframes,
} from '../scripts/toStyleSheet';
const mockTokenGroup = {
'token-name-1': {
value: 'valueA',
},
'token-name-2': {
value: 'valueB',
},
};
const mockMotionTokenGroup = {
'motion-token-1': {
value: 'valueA',
},
'motion-tok... | 460 |
0 | petrpan-code/Shopify/polaris/polaris-tokens | petrpan-code/Shopify/polaris/polaris-tokens/tests/utilities.test.js | import {
createVar,
createVarName,
getThemeVarNames,
getKeyframeNames,
tokenGroupToRems,
toPx,
toEm,
toRem,
getUnit,
getMediaConditions,
} from '../src/utils';
import {resolveMetaThemeRefs} from '../src/themes/utils';
const mockTokenGroup = {
'design-token-1': {
value: 'valueA',
},
'desig... | 461 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/.eslintrc.js | module.exports = {
root: true,
extends: ['next/core-web-vitals'],
ignorePatterns: ['public/playroom'],
rules: {},
};
| 462 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/CHANGELOG.md | # polaris.shopify.com
## 0.60.4
### Patch Changes
- Updated dependencies [[`23055adcf`](https://github.com/Shopify/polaris/commit/23055adcfa97decbfbc51924bd121d1dae76ac6f)]:
- @shopify/polaris-tokens@8.1.0
- @shopify/polaris@12.1.1
## 0.60.3
### Patch Changes
- [#11083](https://github.com/Shopify/polaris/pull... | 463 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/README.md | # polaris.shopify.com
The public facing style guide, available via [https://polaris.shopify.com](https://polaris.shopify.com).
## Getting Started
```
yarn
yarn dev
```
## Development tips
To quickly create new components, run:
```
yarn create-component
```
## Site Content
Our website combines [Next.js](https://... | 464 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/constants.js | // Not a TS file because our playroom.config.js needs to access it also, and can't understand ts imports.
module.exports = {
playroom: {
baseUrl: '/playroom/',
},
};
| 465 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/next-env.d.ts | /// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
| 466 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/next.config.js | const path = require('path');
/* eslint-disable require-await */
/** @type {import('next').NextConfig} */
const nextConfig = {
// See: https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files
output: 'standalone',
reactStrictMode: false,
eslint: {
ignoreDuringBuilds:... | 467 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/package.json | {
"name": "polaris.shopify.com",
"version": "0.60.4",
"private": true,
"engines": {
"node": "^16.17.0 || >=18.12.0"
},
"scripts": {
"build": "yarn gen-colors && yarn gen-assets && playroom build && next build && cp -r public ./.next/standalone/polaris.shopify.com/ && mkdirp ./.next/standalone/polari... | 468 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/playroom.config.js | // Note: Hot module reloading for dev has been turned off for this environment
// Why? We embed playroom in an iframe, and that iframe is loaded from the public asset folder
// So we need to build into that public asset folder. Hence no dev mode and HMR
// Workaround: restart the next dev server after each change to th... | 469 |
0 | petrpan-code/Shopify/polaris | petrpan-code/Shopify/polaris/polaris.shopify.com/tsconfig.json | {
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental"... | 470 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com | petrpan-code/Shopify/polaris/polaris.shopify.com/content/icons.mdx | ---
title: Icons
description: Use icons to increase visual appeal and improve navigation, comprehension, and engagement.
order: 9
icon: IconsMajor
---
| 471 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com | petrpan-code/Shopify/polaris/polaris.shopify.com/content/tokens.mdx | ---
title: Tokens
description: Tokens are variables that represent design decisions such as color, typography, and spacing, in a consistent and reusable way.
order: 8
icon: EyeDropperMinor
url: /tokens/color
---
| 472 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content | petrpan-code/Shopify/polaris/polaris.shopify.com/content/coming-soon/index.mdx | ---
title: Coming soon
hideChildren: true
url: /coming-soon/view-transitions
---
| 473 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content | petrpan-code/Shopify/polaris/polaris.shopify.com/content/coming-soon/view-transitions.mdx | ---
title: Embracing the future with the View Transitions API
description: Merchants need tools that are not just powerful, but also intuitive. That's why we're experimenting with new ways to enhance the Shopify admin experience using the View Transitions API.
keywords:
- motion
- animations
- transitions
- vie... | 474 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/index.mdx | ---
title: Components
order: 7
icon: AppsMajor
previewImg: /images/components.png
---
# {frontmatter.title}
<Lede>
Components are the reusable building blocks for creating Shopify admin experiences.
</Lede>
<Stack gap="1200">
{posts.map(group => <Box>
<h2>{group.title}</h2>
<RichCardGrid cards={group.children} /... | 475 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/actions/account-connection.mdx | ---
title: Account connection
shortDescription: Used for connecting or disconnecting a store to various accounts, like Facebook for the sales channel.
category: Actions
keywords:
- AccountConnection
- connect
- account
- sign-up
- default account connection
- disconnection
- authorize
- third-party acco... | 476 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/actions/button-group.mdx | ---
title: Button group
shortDescription: Displays multiple related actions stacked or in a horizontal row for arrangement and spacing.
category: Actions
keywords:
- ButtonGroup
- choices
- decision
- call-to-action
- CTA
- segmented buttons
- divided buttons
- grouped actions
- multiple horizontal bu... | 477 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/actions/button.mdx | ---
title: Button
shortDescription: Used primarily for actions like 'Add', 'Close', 'Cancel', or 'Save'. Plain buttons are used for less important actions.
category: Actions
keywords:
- CTA
- call to action
- call-to-action
- primary
- action
- basic button
- outline
- plain
- destructive
- slim
-... | 478 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/actions/index.mdx | ---
title: Actions
shortDescription: Perform tasks or take actions within the Shopify admin.
expanded: true
order: 1
previewImg: /images/components/actions.png
---
# {frontmatter.title}
<Lede>
Perform tasks or take actions within the Shopify admin.
</Lede>
<RichCardGrid cards={posts} />
| 479 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/actions/page-actions.mdx | ---
title: Page actions
shortDescription: Allows merchants to take key actions at the bottom of specific pages in the interface.
category: Actions
keywords:
- PageActions
- bottom of page actions
- bottom page actions
- primary action
- primary page actions
- default page actions
- save delete actions
-... | 480 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/caption.mdx | ---
title: Caption
shortDescription: Caption text is smaller than the recommended size for general reading. Used in graphs, timestamps, or as secondary text.
category: Deprecated
keywords:
- labels
- text
- microcopy
- typographic
- graph
- timestamp
- smaller text
- smallest text
- smaller than readi... | 481 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/display-text.mdx | ---
title: Display text
shortDescription: Display styles make a bold visual statement. Used for visual storytelling, marketing content, or capturing attention.
category: Deprecated
keywords:
- DisplayText
- announcement text
- greeting text
- marketing text
- title text
- biggest text
- bigger text
- bi... | 482 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/heading.mdx | ---
title: Heading
shortDescription: Used as the titles of each major section of a page in the interface, like in card components.
category: Deprecated
keywords:
- titles
- text
- microcopy
- conversational
- typographic
- card headings
- card titles
- section titles
- section headings
- heading tex... | 483 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/index.mdx | ---
title: Deprecated
shortDescription: Deprecated components will be removed in future major versions of Polaris. They should be avoided and will show warnings.
expanded: true
order: 12
previewImg: /images/components/deprecated.png
---
# {frontmatter.title}
<Lede>
Deprecated components will be removed in future maj... | 484 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/legacy-card.mdx | ---
title: Legacy card
shortDescription: Legacy version of the Card component. Used to group similar concepts and tasks together for easier scanning and reading.
category: Deprecated
keywords:
- layout
- container
- box
- grid
- panel
- card with call to action in the footer
- card with call to action in ... | 485 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/legacy-filters.mdx | ---
title: Legacy filters
shortDescription: Legacy version of the Filters component. Used to filter the items of a list or table.
category: Selection and input
keywords:
- filters
- filtering
- filter control
- resource list
- index
- list filter
- table
status: Deprecated
examples:
- fileName: legacy-f... | 486 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/legacy-stack.mdx | ---
title: Legacy stack
shortDescription: Legacy version of the Stack component. Used for layout of a horizontal row of components or vertical centering.
category: Deprecated
keywords:
- rows
- vertical centering
- horizontal row of components
- flexible items
- flexbox
- row of components
- stack spacing... | 487 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/legacy-tabs.mdx | ---
title: Legacy tabs
shortDescription: Used to alternate among related views within the same context.
category: Deprecated
keywords:
- layout
- navigate
- organize
- list views
- list filters
- fitted tabs
- segmented controls
- scrollable
status: Deprecated
examples:
- fileName: legacy-tabs-default... | 488 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/setting-toggle.mdx | ---
title: Setting toggle
shortDescription: Used to control a feature or option that can be turned on or off.
category: Deprecated
keywords:
- SettingToggle
- settings buttons
- setting buttons
- enable buttons
- disable buttons
- setting switches
- turn on button
- turn off button
- option button
-... | 489 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/sheet.mdx | ---
title: Sheet
shortDescription: A large container providing actions and information contextual to the page without interrupting flow like a modal.
category: Deprecated
keywords:
- sheet
- modal
- open
- title
- overlay
- drawer
- dialog
status: Deprecated
examples:
- fileName: sheet-default.tsx
t... | 490 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/subheading.mdx | ---
title: Subheading
shortDescription: Used for the title of any sub-sections in top-level page sections.
category: Deprecated
keywords:
- title bar
- top-level
- description
- sub-section titles
- titles of sub-sections
- subsection titles
- titles of subsections
status: Deprecated
previewImg: /images/c... | 491 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/text-container.mdx | ---
title: Text container
shortDescription: Used to wrap text elements like paragraphs, headings, and lists for vertical spacing.
category: Deprecated
releasedIn: 1.9.0
keywords:
- spacing
- heading
- list
- layout
- vertical
- margin
- padding
status: Deprecated
examples:
- fileName: text-container-def... | 492 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/text-style.mdx | ---
title: Text style
shortDescription: Enhances text with additional visual meaning, like using subdued text to de-emphasize it.
category: Deprecated
keywords:
- TextStyle
- typographic
- subdued
- strong
- negative
- warning
- positive
- cues
- enhancements
- type
- bold
- dollar
- increase
... | 493 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/deprecated/visually-hidden.mdx | ---
title: Visually hidden
shortDescription: Used when an element needs to be available to assistive technology but otherwise hidden.
category: Deprecated
keywords:
- VisuallyHidden
- screen readers
- hidden but available for screen readers
- visually hidden headings
- hide
- hidden headings
- hidden text... | 494 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/feedback-indicators/badge.mdx | ---
title: Badge
shortDescription: Used to inform merchants of the tone of an object or an action taken.
category: Feedback indicators
keywords:
- pills
- tone indicators
- color-coded indicators
- informational badge
- success badge
- attention badge
- warning badge
- critical badge
- object tone
-... | 495 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/feedback-indicators/banner.mdx | ---
title: Banner
shortDescription: Informs merchants about important changes or persistent conditions in a prominent way.
category: Feedback indicators
keywords:
- inform
- update
- changes
- conditions
- dismissible banners
- banner with footer call-to-action
- banner with footer button
- banner with ... | 496 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/feedback-indicators/exception-list.mdx | ---
title: Exception list
shortDescription: Helps merchants notice important, standout information that adds extra context to a task.
category: Feedback indicators
keywords:
- exception list
- exceptions
- list
- list exceptions
examples:
- fileName: exception-list-default.tsx
title: Default
descripti... | 497 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/feedback-indicators/index.mdx | ---
title: Feedback indicators
shortDescription: Inform merchants about the status of a process, provide feedback, or indicate progress.
expanded: true
order: 5
previewImg: /images/components/feedback-indicators.png
---
# {frontmatter.title}
<Lede>
Inform merchants about the status of a process, provide feedback on ... | 498 |
0 | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components | petrpan-code/Shopify/polaris/polaris.shopify.com/content/components/feedback-indicators/loading.mdx | ---
title: Loading
shortDescription: Used to indicate to merchants that a page is loading or an upload is processing.
category: Feedback indicators
keywords:
- spinner
- loader
- loading
- loading bar
examples:
- fileName: loading-default.tsx
title: Default
description: Use to indicate that the page i... | 499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.