Skip to content

Commit

Permalink
React import paths (#1507)
Browse files Browse the repository at this point in the history
* fix react imports in examples

* move types to definition files

* update changelog

* update changelog
  • Loading branch information
claviska authored Aug 11, 2023
1 parent f8c37e0 commit 1383ea3
Show file tree
Hide file tree
Showing 170 changed files with 1,058 additions and 896 deletions.
26 changes: 13 additions & 13 deletions docs/pages/components/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ layout: component
```

```jsx:react
import SlAlert from '@shoelace-style/shoelace/dist/react/sl-alert';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAlert from '@shoelace-style/shoelace/dist/react/alert';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<SlAlert open>
Expand Down Expand Up @@ -75,8 +75,8 @@ Set the `variant` attribute to change the alert's variant.
```

```jsx:react
import SlAlert from '@shoelace-style/shoelace/dist/react/sl-alert';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAlert from '@shoelace-style/shoelace/dist/react/alert';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<>
Expand Down Expand Up @@ -146,8 +146,8 @@ Add the `closable` attribute to show a close button that will hide the alert.

```jsx:react
import { useState } from 'react';
import SlAlert from '@shoelace-style/shoelace/dist/react/sl-alert';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAlert from '@shoelace-style/shoelace/dist/react/alert';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => {
const [open, setOpen] = useState(true);
Expand Down Expand Up @@ -175,7 +175,7 @@ Icons are optional. Simply omit the `icon` slot if you don't want them.
```

```jsx:react
import SlAlert from '@shoelace-style/shoelace/dist/react/sl-alert';
import SlAlert from '@shoelace-style/shoelace/dist/react/alert';
const App = () => (
<SlAlert variant="primary" open>
Expand Down Expand Up @@ -215,9 +215,9 @@ Set the `duration` attribute to automatically hide an alert after a period of ti

```jsx:react
import { useState } from 'react';
import SlAlert from '@shoelace-style/shoelace/dist/react/sl-alert';
import SlButton from '@shoelace-style/shoelace/dist/react/sl-button';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAlert from '@shoelace-style/shoelace/dist/react/alert';
import SlButton from '@shoelace-style/shoelace/dist/react/button';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const css = `
.alert-duration sl-alert {
Expand Down Expand Up @@ -306,9 +306,9 @@ You should always use the `closable` attribute so users can dismiss the notifica

```jsx:react
import { useRef } from 'react';
import SlAlert from '@shoelace-style/shoelace/dist/react/sl-alert';
import SlButton from '@shoelace-style/shoelace/dist/react/sl-button';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAlert from '@shoelace-style/shoelace/dist/react/alert';
import SlButton from '@shoelace-style/shoelace/dist/react/button';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
function showToast(alert) {
alert.toast();
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/components/animated-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ layout: component
```

```jsx:react
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/sl-animated-image';
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/animated-image';
const App = () => (
<SlAnimatedImage
Expand Down Expand Up @@ -41,7 +41,7 @@ Both GIF and WEBP images are supported.
```

```jsx:react
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/sl-animated-image';
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/animated-image';
const App = () => (
<SlAnimatedImage src="https://shoelace.style/assets/images/tie.webp" alt="Animation of a shoe being tied" />
Expand All @@ -64,7 +64,7 @@ To set a custom size, apply a width and/or height to the host element.
{% raw %}

```jsx:react
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/sl-animated-image';
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/animated-image';
const App = () => (
<SlAnimatedImage
Expand Down Expand Up @@ -102,7 +102,7 @@ You can change the appearance and location of the control box by targeting the `
```

```jsx:react
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/sl-animated-image';
import SlAnimatedImage from '@shoelace-style/shoelace/dist/react/animated-image';
const css = `
.animated-image-custom-control-box::part(control-box) {
Expand Down
10 changes: 5 additions & 5 deletions docs/pages/components/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To animate an element, wrap it in `<sl-animation>` and set an animation `name`.
```

```jsx:react
import SlAnimation from '@shoelace-style/shoelace/dist/react/sl-animation';
import SlAnimation from '@shoelace-style/shoelace/dist/react/animation';
const css = `
.animation-overview .box {
Expand Down Expand Up @@ -173,7 +173,7 @@ Use an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/

```jsx:react
import { useEffect, useRef, useState } from 'react';
import SlAnimation from '@shoelace-style/shoelace/dist/react/sl-animation';
import SlAnimation from '@shoelace-style/shoelace/dist/react/animation';
const css = `
.animation-scroll {
Expand Down Expand Up @@ -262,7 +262,7 @@ Supply your own [keyframe formats](https://developer.mozilla.org/en-US/docs/Web/
```

```jsx:react
import SlAnimation from '@shoelace-style/shoelace/dist/react/sl-animation';
import SlAnimation from '@shoelace-style/shoelace/dist/react/animation';
const css = `
.animation-keyframes .box {
Expand Down Expand Up @@ -329,8 +329,8 @@ Animations won't play until you apply the `play` attribute. You can omit it init

```jsx:react
import { useState } from 'react';
import SlAnimation from '@shoelace-style/shoelace/dist/react/sl-animation';
import SlButton from '@shoelace-style/shoelace/dist/react/sl-button';
import SlAnimation from '@shoelace-style/shoelace/dist/react/animation';
import SlButton from '@shoelace-style/shoelace/dist/react/button';
const App = () => {
const [play, setPlay] = useState(false);
Expand Down
18 changes: 9 additions & 9 deletions docs/pages/components/avatar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ By default, a generic icon will be shown. You can personalize avatars by adding
```

```jsx:react
import SlAvatar from '@shoelace-style/shoelace/dist/react/sl-avatar';
import SlAvatar from '@shoelace-style/shoelace/dist/react/avatar';
const App = () => <SlAvatar label="User avatar" />;
```
Expand All @@ -37,7 +37,7 @@ Avatar images can be lazily loaded by setting the `loading` attribute to `lazy`.
```

```jsx:react
import SlAvatar from '@shoelace-style/shoelace/dist/react/sl-avatar';
import SlAvatar from '@shoelace-style/shoelace/dist/react/avatar';
const App = () => (
<SlAvatar
Expand All @@ -61,7 +61,7 @@ When you don't have an image to use, you can set the `initials` attribute to sho
```

```jsx:react
import SlAvatar from '@shoelace-style/shoelace/dist/react/sl-avatar';
import SlAvatar from '@shoelace-style/shoelace/dist/react/avatar';
const App = () => <SlAvatar initials="SL" label="Avatar with initials: SL" />;
```
Expand All @@ -85,8 +85,8 @@ When no image or initials are set, an icon will be shown. The default avatar sho
```

```jsx:react
import SlAvatar from '@shoelace-style/shoelace/dist/react/sl-avatar';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAvatar from '@shoelace-style/shoelace/dist/react/avatar';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<>
Expand Down Expand Up @@ -116,8 +116,8 @@ Avatars can be shaped using the `shape` attribute.
```

```jsx:react
import SlAvatar from '@shoelace-style/shoelace/dist/react/sl-avatar';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAvatar from '@shoelace-style/shoelace/dist/react/avatar';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<>
Expand Down Expand Up @@ -167,8 +167,8 @@ You can group avatars with a few lines of CSS.
```

```jsx:react
import SlAvatar from '@shoelace-style/shoelace/dist/react/sl-avatar';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlAvatar from '@shoelace-style/shoelace/dist/react/avatar';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const css = `
.avatar-group sl-avatar:not(:first-of-type) {
Expand Down
22 changes: 11 additions & 11 deletions docs/pages/components/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ layout: component
```

```jsx:react
import SlBadge from '@shoelace-style/shoelace/dist/react/sl-badge';
import SlBadge from '@shoelace-style/shoelace/dist/react/badge';
const App = () => <SlBadge>Badge</SlBadge>;
```
Expand All @@ -30,7 +30,7 @@ Set the `variant` attribute to change the badge's variant.
```

```jsx:react
import SlBadge from '@shoelace-style/shoelace/dist/react/sl-badge';
import SlBadge from '@shoelace-style/shoelace/dist/react/badge';
const App = () => (
<>
Expand All @@ -56,7 +56,7 @@ Use the `pill` attribute to give badges rounded edges.
```

```jsx:react
import SlBadge from '@shoelace-style/shoelace/dist/react/sl-badge';
import SlBadge from '@shoelace-style/shoelace/dist/react/badge';
const App = () => (
<>
Expand Down Expand Up @@ -100,7 +100,7 @@ Use the `pulse` attribute to draw attention to the badge with a subtle animation
```

```jsx:react
import SlBadge from '@shoelace-style/shoelace/dist/react/sl-badge';
import SlBadge from '@shoelace-style/shoelace/dist/react/badge';
const css = `
.badge-pulse sl-badge:not(:last-of-type) {
Expand Down Expand Up @@ -157,8 +157,8 @@ One of the most common use cases for badges is attaching them to buttons. To mak
{% raw %}

```jsx:react
import SlBadge from '@shoelace-style/shoelace/dist/react/sl-badge';
import SlButton from '@shoelace-style/shoelace/dist/react/sl-button';
import SlBadge from '@shoelace-style/shoelace/dist/react/badge';
import SlButton from '@shoelace-style/shoelace/dist/react/button';
const App = () => (
<>
Expand Down Expand Up @@ -201,11 +201,11 @@ When including badges in menu items, use the `suffix` slot to make sure they're
{% raw %}

```jsx:react
import SlBadge from '@shoelace-style/shoelace/dist/react/sl-badge';
import SlButton from '@shoelace-style/shoelace/dist/react/sl-button';
import SlMenu from '@shoelace-style/shoelace/dist/react/sl-menu';
import SlMenuItem from '@shoelace-style/shoelace/dist/react/sl-menu-item';
import SlMenuLabel from '@shoelace-style/shoelace/dist/react/sl-menu-label';
import SlBadge from '@shoelace-style/shoelace/dist/react/badge';
import SlButton from '@shoelace-style/shoelace/dist/react/button';
import SlMenu from '@shoelace-style/shoelace/dist/react/menu';
import SlMenuItem from '@shoelace-style/shoelace/dist/react/menu-item';
import SlMenuLabel from '@shoelace-style/shoelace/dist/react/menu-label';
const App = () => (
<SlMenu
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/components/breadcrumb-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ layout: component
```

```jsx:react
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/sl-breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/sl-breadcrumb-item';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<SlBreadcrumb>
Expand Down
24 changes: 12 additions & 12 deletions docs/pages/components/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Breadcrumbs are usually placed before a page's main content with the current pag
```

```jsx:react
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/sl-breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/sl-breadcrumb-item';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
const App = () => (
<SlBreadcrumb>
Expand Down Expand Up @@ -51,8 +51,8 @@ For websites, you'll probably want to use links instead. You can make any breadc
```

```jsx:react
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/sl-breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/sl-breadcrumb-item';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
const App = () => (
<SlBreadcrumb>
Expand Down Expand Up @@ -100,8 +100,8 @@ Use the `separator` slot to change the separator that goes between breadcrumb it

```jsx:react
import '@shoelace-style/shoelace/dist/components/icon/icon.js';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/sl-breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/sl-breadcrumb-item';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
const App = () => (
<>
Expand Down Expand Up @@ -149,9 +149,9 @@ Use the `prefix` slot to add content before any breadcrumb item.
```

```jsx:react
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/sl-breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/sl-breadcrumb-item';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<SlBreadcrumb>
Expand Down Expand Up @@ -181,9 +181,9 @@ Use the `suffix` slot to add content after any breadcrumb item.
```

```jsx:react
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/sl-breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/sl-breadcrumb-item';
import SlIcon from '@shoelace-style/shoelace/dist/react/sl-icon';
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb';
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
import SlIcon from '@shoelace-style/shoelace/dist/react/icon';
const App = () => (
<SlBreadcrumb>
Expand Down
Loading

0 comments on commit 1383ea3

Please sign in to comment.