Skip to content

Commit 66f7401

Browse files
authored
Align with fast components (#33)
* Align with fast components * Upgrade @microsft/fast packages * Update snapsots
1 parent 9bb89b1 commit 66f7401

File tree

56 files changed

+104
-52
lines changed

Some content is hidden

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

56 files changed

+104
-52
lines changed

packages/components/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
"test:visual": "tsc --incremental -p tsconfig.playwright.json && playwright test"
4141
},
4242
"dependencies": {
43-
"@microsoft/fast-colors": "^5.1.4",
44-
"@microsoft/fast-components": "^2.17.1",
45-
"@microsoft/fast-element": "^1.6.0",
46-
"@microsoft/fast-foundation": "^2.21.0",
43+
"@microsoft/fast-colors": "^5.1.5",
44+
"@microsoft/fast-components": "^2.25.1",
45+
"@microsoft/fast-element": "^1.8.0",
46+
"@microsoft/fast-foundation": "^2.37.1",
4747
"@microsoft/fast-web-utilities": "^5.1.0"
4848
},
4949
"devDependencies": {

packages/components/src/accordion-item/accordion-item.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
strokeWidth,
2424
typeRampMinus1FontSize,
2525
typeRampMinus1LineHeight
26-
} from '../design-token';
26+
} from '../design-tokens';
2727
import { heightNumber } from '../styles/size';
2828

2929
/**

packages/components/src/avatar/avatar.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
foregroundOnAccentRest,
2020
neutralForegroundRest,
2121
typeRampBaseFontSize
22-
} from '../design-token';
22+
} from '../design-tokens';
2323

2424
const rtl: FoundationElementTemplate<ElementStyles, AvatarOptions> = (
2525
context,

packages/components/src/badge/badge.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
strokeWidth,
1313
typeRampMinus1FontSize,
1414
typeRampMinus1LineHeight
15-
} from '../design-token';
15+
} from '../design-tokens';
1616
import { heightNumber } from '../styles/index';
1717

1818
/**

packages/components/src/breadcrumb-item/breadcrumb-item.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
strokeWidth,
2323
typeRampBaseFontSize,
2424
typeRampBaseLineHeight
25-
} from '../design-token';
25+
} from '../design-tokens';
2626
import { heightNumber } from '../styles/index';
2727

2828
/**

packages/components/src/button/button.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
strokeWidth,
4646
typeRampBaseFontSize,
4747
typeRampBaseLineHeight
48-
} from '../design-token';
48+
} from '../design-tokens';
4949
import { heightNumber } from '../styles';
5050

5151
/**

packages/components/src/card/card.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
import { neutralForegroundRest, typeRampBaseFontSize } from '../design-token';
4+
import { neutralForegroundRest, typeRampBaseFontSize } from '../design-tokens';
55
import { setTheme } from '../utilities/storybook';
66

77
export default {

packages/components/src/checkbox/checkbox.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
strokeWidth,
3636
typeRampBaseFontSize,
3737
typeRampBaseLineHeight
38-
} from '../design-token';
38+
} from '../design-tokens';
3939
import { heightNumber } from '../styles/index';
4040

4141
/**

packages/components/src/checkbox/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const jpCheckbox = Checkbox.compose<CheckboxOptions>({
2121
baseName: 'checkbox',
2222
template,
2323
styles,
24-
checkedIndicator: `
24+
checkedIndicator: /* html */ `
2525
<svg
2626
part="checked-indicator"
2727
class="checked-indicator"
@@ -35,7 +35,7 @@ export const jpCheckbox = Checkbox.compose<CheckboxOptions>({
3535
/>
3636
</svg>
3737
`,
38-
indeterminateIndicator: `
38+
indeterminateIndicator: /* html */ `
3939
<div part="indeterminate-indicator" class="indeterminate-indicator"></div>
4040
`
4141
});

packages/components/src/combobox/combobox.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
strokeWidth,
1616
typeRampBaseFontSize,
1717
typeRampBaseLineHeight
18-
} from '../design-token';
18+
} from '../design-tokens';
1919
import { selectStyles } from '../select/select.styles';
2020

2121
/**

packages/components/src/combobox/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const jpCombobox = Combobox.compose<ComboboxOptions>({
4242
shadowOptions: {
4343
delegatesFocus: true
4444
},
45-
indicator: `
45+
indicator: /* html */ `
4646
<svg
4747
class="select-indicator"
4848
part="select-indicator"

packages/components/src/data-grid/data-grid-cell.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
strokeWidth,
2020
typeRampBaseFontSize,
2121
typeRampBaseLineHeight
22-
} from '../design-token';
22+
} from '../design-tokens';
2323

2424
/**
2525
* Styles for Data Grid cell

packages/components/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
export { addJupyterLabThemeChangeListener } from './utilities/theme/applyTheme';
55

6-
export * from './design-token';
6+
export * from './design-tokens';
77
export * from './jupyter-design-system';
88
export * from './custom-elements';
99

packages/components/src/menu-item/menu-item.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
strokeWidth,
3030
typeRampBaseFontSize,
3131
typeRampBaseLineHeight
32-
} from '../design-token';
32+
} from '../design-tokens';
3333
import { heightNumber } from '../styles/index';
3434

3535
/**

packages/components/src/number-field/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export const jpNumberField = NumberField.compose<NumberFieldOptions>({
3131
shadowOptions: {
3232
delegatesFocus: true
3333
},
34-
stepDownGlyph: `
34+
stepDownGlyph: /* html */ `
3535
<span class="step-down-glyph" part="step-down-glyph"></span>
3636
`,
37-
stepUpGlyph: `
37+
stepUpGlyph: /* html */ `
3838
<span class="step-up-glyph" part="step-up-glyph"></span>
3939
`
4040
});

packages/components/src/number-field/number-field.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
FoundationElementTemplate,
88
NumberFieldOptions
99
} from '@microsoft/fast-foundation';
10-
import { neutralForegroundRest } from '../design-token';
10+
import { neutralForegroundRest } from '../design-tokens';
1111
import { BaseFieldStyles } from '../styles/index';
1212

1313
/**

packages/components/src/progress-ring/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const jpProgressRing = ProgressRing.compose<ProgressRingOptions>({
2121
baseName: 'progress-ring',
2222
template,
2323
styles,
24-
indeterminateIndicator: `
24+
indeterminateIndicator: /* html */ `
2525
<svg class="progress" part="progress" viewBox="0 0 16 16">
2626
<circle
2727
class="background"

packages/components/src/progress/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ export const jpProgress = Progress.compose<ProgressOptions>({
2121
baseName: 'progress',
2222
template,
2323
styles,
24-
indeterminateIndicator1: `
24+
indeterminateIndicator1: /* html */ `
2525
<span class="indeterminate-indicator-1" part="indeterminate-indicator-1"></span>
2626
`,
27-
indeterminateIndicator2: `
27+
indeterminateIndicator2: /* html */ `
2828
<span class="indeterminate-indicator-2" part="indeterminate-indicator-2"></span>
2929
`
3030
});

packages/components/src/radio/radio.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
strokeWidth,
3535
typeRampBaseFontSize,
3636
typeRampBaseLineHeight
37-
} from '../design-token';
37+
} from '../design-tokens';
3838
import { heightNumber } from '../styles/index';
3939

4040
/**

packages/components/src/search/search.styles.ts

+61-9
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,45 @@
44

55
import { css, ElementStyles } from '@microsoft/fast-element';
66
import {
7+
DesignToken,
78
focusVisible,
89
FoundationElementTemplate,
910
TextFieldOptions
1011
} from '@microsoft/fast-foundation';
11-
import { designUnit } from '../design-token';
12+
import { Swatch } from '../colors';
13+
import {
14+
bodyFont,
15+
controlCornerRadius,
16+
density,
17+
neutralFillRecipe,
18+
neutralFillStealthActive,
19+
neutralFillStealthHover,
20+
neutralFillStealthRecipe,
21+
neutralForegroundRest,
22+
typeRampBaseFontSize,
23+
typeRampBaseLineHeight,
24+
designUnit
25+
} from '../design-tokens';
1226
import { BaseFieldStyles, heightNumber } from '../styles/index';
1327

28+
const clearButtonHover = DesignToken.create<Swatch>(
29+
'clear-button-hover'
30+
).withDefault((target: HTMLElement) => {
31+
const buttonRecipe = neutralFillStealthRecipe.getValueFor(target);
32+
const inputRecipe = neutralFillRecipe.getValueFor(target);
33+
return buttonRecipe.evaluate(target, inputRecipe.evaluate(target).hover)
34+
.hover;
35+
});
36+
37+
const clearButtonActive = DesignToken.create<Swatch>(
38+
'clear-button-active'
39+
).withDefault((target: HTMLElement) => {
40+
const buttonRecipe = neutralFillStealthRecipe.getValueFor(target);
41+
const inputRecipe = neutralFillRecipe.getValueFor(target);
42+
return buttonRecipe.evaluate(target, inputRecipe.evaluate(target).hover)
43+
.active;
44+
});
45+
1446
export const searchStyles: FoundationElementTemplate<
1547
ElementStyles,
1648
TextFieldOptions
@@ -37,17 +69,37 @@ export const searchStyles: FoundationElementTemplate<
3769
outline: none;
3870
}
3971
40-
/* Cancel margin set for button focus outline */
41-
jp-button {
42-
margin: 0;
43-
}
44-
4572
.clear-button {
46-
position: absolute;
47-
right: 0;
48-
top: 1px;
4973
height: calc(100% - 2px);
5074
opacity: 0;
75+
margin: 1px;
76+
background: transparent;
77+
color: ${neutralForegroundRest};
78+
fill: currentcolor;
79+
border: none;
80+
border-radius: calc(${controlCornerRadius} * 1px);
81+
min-width: calc(${heightNumber} * 1px);
82+
font-size: ${typeRampBaseFontSize};
83+
line-height: ${typeRampBaseLineHeight};
84+
outline: none;
85+
font-family: ${bodyFont};
86+
padding: 0 calc((10 + (${designUnit} * 2 * ${density})) * 1px);
87+
}
88+
89+
.clear-button:hover {
90+
background: ${neutralFillStealthHover};
91+
}
92+
93+
.clear-button:active {
94+
background: ${neutralFillStealthActive};
95+
}
96+
97+
:host([appearance='filled']) .clear-button:hover {
98+
background: ${clearButtonHover};
99+
}
100+
101+
:host([appearance='filled']) .clear-button:active {
102+
background: ${clearButtonActive};
51103
}
52104
53105
.input-wrapper {

packages/components/src/select/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const jpSelect = Select.compose<SelectOptions>({
3939
baseClass: FoundationSelect,
4040
template,
4141
styles,
42-
indicator: `
42+
indicator: /* html */ `
4343
<svg
4444
class="select-indicator"
4545
part="select-indicator"

packages/components/src/slider/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const jpSlider = Slider.compose<SliderOptions>({
2121
baseName: 'slider',
2222
template,
2323
styles,
24-
thumb: `
24+
thumb: /* html */ `
2525
<div class="thumb-cursor"></div>
2626
`
2727
});

packages/components/src/slider/slider.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
neutralForegroundRest,
2323
neutralStrokeHover,
2424
neutralStrokeRest
25-
} from '../design-token';
25+
} from '../design-tokens';
2626
import { heightNumber } from '../styles/index';
2727

2828
/**

packages/components/src/styles/size.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Distributed under the terms of the Modified BSD License.
44

55
import { cssPartial } from '@microsoft/fast-element';
6-
import { baseHeightMultiplier, density, designUnit } from '../design-token';
6+
import { baseHeightMultiplier, density, designUnit } from '../design-tokens';
77

88
/**
99
* A formula to retrieve the control height.

packages/components/src/switch/switch.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
strokeWidth,
3737
typeRampBaseFontSize,
3838
typeRampBaseLineHeight
39-
} from '../design-token';
39+
} from '../design-tokens';
4040
import { heightNumber } from '../styles/index';
4141

4242
/**

packages/components/src/tabs/tabs.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
neutralForegroundRest,
1919
typeRampBaseFontSize,
2020
typeRampBaseLineHeight
21-
} from '../design-token';
21+
} from '../design-tokens';
2222
import { heightNumber } from '../styles/index';
2323

2424
/**

packages/components/src/text-area/text-area.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
strokeWidth,
2323
typeRampBaseFontSize,
2424
typeRampBaseLineHeight
25-
} from '../design-token';
25+
} from '../design-tokens';
2626
import { css, ElementStyles } from '@microsoft/fast-element';
2727
import {
2828
disabledCursor,

packages/components/src/toolbar/toolbar.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
fillColor,
1818
focusStrokeWidth,
1919
strokeWidth
20-
} from '../design-token';
20+
} from '../design-tokens';
2121

2222
/**
2323
* Styles for the Toolbar

packages/components/src/tree-item/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const jpTreeItem = TreeItem.compose<TreeItemOptions>({
2222
baseName: 'tree-item',
2323
template,
2424
styles,
25-
expandCollapseGlyph: `
25+
expandCollapseGlyph: /* html */ `
2626
<svg
2727
viewBox="0 0 16 16"
2828
xmlns="http://www.w3.org/2000/svg"

packages/components/src/tree-item/tree-item.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
strokeWidth,
3737
typeRampBaseFontSize,
3838
typeRampBaseLineHeight
39-
} from '../design-token';
39+
} from '../design-tokens';
4040
import { heightNumber } from '../styles/index';
4141

4242
const ltr = css`

packages/components/src/utilities/storybook/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { icon, library } from '@fortawesome/fontawesome-svg-core';
55
import * as icons from '@fortawesome/free-solid-svg-icons';
66
import { parseColor } from '@microsoft/fast-colors';
77
import { isDark, PaletteRGB, StandardLuminance, SwatchRGB } from '../../colors';
8-
import { accentPalette, baseLayerLuminance } from '../../design-token';
8+
import { accentPalette, baseLayerLuminance } from '../../design-tokens';
99

1010
/**
1111
* Generate the SVG for a fontawesome icon

packages/components/src/utilities/theme/applyTheme.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
neutralPalette,
2424
strokeWidth,
2525
typeRampBaseFontSize
26-
} from '../../design-token';
26+
} from '../../design-tokens';
2727

2828
const THEME_NAME_BODY_ATTRIBUTE = 'data-jp-theme-name';
2929
const THEME_MODE_BODY_ATTRIBUTE = 'data-jp-theme-light';

0 commit comments

Comments
 (0)