Skip to content

Commit 8e93bcc

Browse files
authored
Refactor to define a single wrap method (#91)
Co-authored-by: Frédéric Collonval <[email protected]>
1 parent ac784ad commit 8e93bcc

File tree

46 files changed

+142
-283
lines changed

Some content is hidden

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

46 files changed

+142
-283
lines changed

packages/lab-example/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
},
1515
"license": "BSD-3-Clause",
1616
"author": {
17-
"name": "Jupyter Developer Team",
18-
"email": ""
17+
"name": "Jupyter Developer Team"
1918
},
2019
"files": [
2120
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",

packages/react-components/src/accordion-item/index.tsx renamed to packages/react-components/src/accordion-item/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpAccordionItem
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpAccordionItem } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const AccordionItem: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/accordion/index.tsx renamed to packages/react-components/src/accordion/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpAccordion
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpAccordion } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const Accordion: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/anchor/index.tsx renamed to packages/react-components/src/anchor/index.ts

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

4-
import { provideJupyterDesignSystem, jpAnchor } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpAnchor } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Anchor: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/anchored-region/index.tsx renamed to packages/react-components/src/anchored-region/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpAnchoredRegion
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpAnchoredRegion } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const AnchoredRegion: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/avatar/index.tsx renamed to packages/react-components/src/avatar/index.ts

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

4-
import { provideJupyterDesignSystem, jpAvatar } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpAvatar } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Avatar: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/badge/index.tsx renamed to packages/react-components/src/badge/index.ts

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

4-
import { provideJupyterDesignSystem, jpBadge } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpBadge } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Badge: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/breadcrumb-item/index.tsx renamed to packages/react-components/src/breadcrumb-item/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpBreadcrumbItem
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpBreadcrumbItem } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const BreadcrumbItem: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/breadcrumb/index.tsx renamed to packages/react-components/src/breadcrumb/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpBreadcrumb
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpBreadcrumb } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const Breadcrumb: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/button/index.tsx renamed to packages/react-components/src/button/index.ts

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

4-
import { provideJupyterDesignSystem, jpButton } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpButton } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Button: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/card/index.tsx renamed to packages/react-components/src/card/index.ts

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

4-
import { provideJupyterDesignSystem, jpCard } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpCard } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Card: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement>,

packages/react-components/src/checkbox/index.tsx renamed to packages/react-components/src/checkbox/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpCheckbox
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpCheckbox } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const Checkbox: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/combobox/index.tsx renamed to packages/react-components/src/combobox/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpCombobox
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpCombobox } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const Combobox: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/data-grid/index.tsx renamed to packages/react-components/src/data-grid/index.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
// Distributed under the terms of the Modified BSD License.
33

44
import {
5-
provideJupyterDesignSystem,
65
jpDataGrid,
76
jpDataGridCell,
87
jpDataGridRow
98
} from '@jupyter/web-components';
10-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
11-
import React from 'react';
12-
13-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
9+
import type React from 'react';
10+
import { wrap } from '../wrap';
1411

1512
// WARNING The wrapping needs to be called in order (from bottom to top DOM elements)
1613
// Otherwise during the wrapping the tag for sub elements won't be resolved and this

packages/react-components/src/date-field/index.tsx renamed to packages/react-components/src/date-field/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpDateField
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpDateField } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const DateField: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/design-system-provider/index.tsx renamed to packages/react-components/src/design-system-provider/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpDesignSystemProvider
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpDesignSystemProvider } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const DesignSystemProvider: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/dialog/index.tsx renamed to packages/react-components/src/dialog/index.ts

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

4-
import { provideJupyterDesignSystem, jpDialog } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpDialog } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Dialog: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/disclosure/index.tsx renamed to packages/react-components/src/disclosure/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpDisclosure
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpDisclosure } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const Disclosure: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/divider/index.tsx renamed to packages/react-components/src/divider/index.ts

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

4-
import { provideJupyterDesignSystem, jpDivider } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpDivider } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Divider: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/drafts/picker/index.tsx renamed to packages/react-components/src/drafts/picker/index.ts

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

4-
import { provideJupyterDesignSystem, jpPicker } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpPicker } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../../wrap';
97

108
/**
119
* @alpha

packages/react-components/src/index.ts

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

4+
export * from './wrap';
5+
46
export * from './accordion';
57
export * from './accordion-item';
68
export * from './anchor';

packages/react-components/src/listbox/index.tsx renamed to packages/react-components/src/listbox/index.ts

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

4-
import { provideJupyterDesignSystem, jpListbox } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpListbox } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Listbox: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/menu-item/index.tsx renamed to packages/react-components/src/menu-item/index.ts

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

4-
import {
5-
provideJupyterDesignSystem,
6-
jpMenuItem
7-
} from '@jupyter/web-components';
8-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
9-
import React from 'react';
10-
11-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpMenuItem } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
127

138
export const MenuItem: React.DetailedHTMLFactory<
149
React.HTMLAttributes<HTMLElement> & {

packages/react-components/src/menu/index.tsx renamed to packages/react-components/src/menu/index.ts

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

4-
import { provideJupyterDesignSystem, jpMenu } from '@jupyter/web-components';
5-
import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
6-
import React from 'react';
7-
8-
const { wrap } = provideReactWrapper(React, provideJupyterDesignSystem());
4+
import { jpMenu } from '@jupyter/web-components';
5+
import type React from 'react';
6+
import { wrap } from '../wrap';
97

108
export const Menu: React.DetailedHTMLFactory<
119
React.HTMLAttributes<HTMLElement>,

0 commit comments

Comments
 (0)