Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next release #143

Merged
merged 26 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
81d1fd9
feat: add `clipItemOne` prop
zoltan-mihalyi Mar 29, 2024
356a102
Merge remote-tracking branch 'origin/main' into next
nerdyman May 20, 2024
77dff61
feat: add `clip` prop to clip `itemOne`, `itemTwo` or `all` (default)
nerdyman Aug 23, 2024
6c213fe
test: use display block on images inzero bounds tests to ensure corre…
nerdyman Sep 6, 2024
5d2adae
docs: add docs for `clip` and `disabled` props
nerdyman Sep 7, 2024
86ce7b4
doc: update clip docs
nerdyman Sep 7, 2024
aba0ad4
ci: add pkg.pr.new action
nerdyman Sep 7, 2024
4079c3b
ci: publish preview when label is applied and pr is not draft
nerdyman Sep 7, 2024
a1a69dc
ci: set lib in publish preview
nerdyman Sep 7, 2024
0972cbb
ci: run preview package publish on pr sync with label
nerdyman Sep 7, 2024
8c73048
ci: use example as template for preview package publish
nerdyman Sep 7, 2024
ed1af8f
ci: add glob to publish preview example
nerdyman Sep 7, 2024
b3ac921
ci: enable compress action
nerdyman Sep 7, 2024
d808668
ci: update template arg for pkg preview publish
nerdyman Sep 8, 2024
d001886
docs: add new real world links
nerdyman Sep 8, 2024
e6508ca
ci: try dev mode version of pkg.pr.new
nerdyman Sep 12, 2024
e35d7c4
fix: try only applying `touch-action: none` when the slider is being …
nerdyman Sep 12, 2024
079620b
fix: default `touch-action` on slider root to `pan-y` #134
nerdyman Sep 12, 2024
7bd6bb8
chore: update vscode config
nerdyman Sep 12, 2024
dc98418
ci: replace debug version of pkg-pr-new
nerdyman Sep 14, 2024
c878402
build: add cjs build to avoid issues with jest, resolves #144
nerdyman Sep 14, 2024
4de2634
build: BREAKING CHANGE: set min node version to 18
nerdyman Sep 14, 2024
0405456
ci: remove `--no-template` flag from publish preview
nerdyman Sep 14, 2024
3387f82
build(deps): upgrade sb to latest v7
nerdyman Sep 14, 2024
d0c1bd1
ci: set install script for compressed size action
nerdyman Sep 14, 2024
7a6ba24
chore: release v4.0.0-0
nerdyman Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
${{github.workspace}}/coverage/ssr-tests/*.info:lcov
${{github.workspace}}/coverage/storybook/*.info:lcov

# Needs https://github.com/preactjs/compressed-size-action/issues/83
# - uses: preactjs/compressed-size-action@v2
# with:
# repo-token: '${{ secrets.GITHUB_TOKEN }}'
# build-script: 'build'
# cwd: lib
- uses: preactjs/compressed-size-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
install-script: 'pnpm install --frozen-lockfile --filter react-compare-slider'
build-script: 'build'
cwd: lib
31 changes: 31 additions & 0 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Preview Release
on:
pull_request:
types: [synchronize]
jobs:
approved:
if: contains(join(github.event.pull_request.labels.*.name, ','), 'publish-preview')
runs-on: ubuntu-latest

steps:
- name: 🛒 Checkout repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2

- name: ⚒️ Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: 📦 Install Dependencies
run: |
corepack enable
pnpm install --frozen-lockfile --filter react-compare-slider

- name: 🔨 Build
run: pnpm run --filter react-compare-slider build

- name: 🚀 Publish Preview Release
run: pnpx pkg-pr-new publish './lib' --template='./docs/example'
2 changes: 1 addition & 1 deletion .github/workflows/ssr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: ⚒️ Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- name: 📦 Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.rulers": [100],
"editor.formatOnSave": true,
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const Example = () => {
| ---- | ---- | :------: | ------- | ----------- |
| [`boundsPadding`](https://react-compare-slider.vercel.app/?path=/story/demos--bounds-padding) | `number` | | `0` | Padding to limit the slideable bounds in pixels on the X-axis (landscape) or Y-axis (portrait).
| [`browsingContext`](https://react-compare-slider.vercel.app/?path=/story/demos--browsing-context) | `globalThis` | | `globalThis` | Context to bind events to (useful for iframes).
| [`clip`](https://react-compare-slider.vercel.app/?path=/story/docs/docs-clip--docs) | `` both\|itemOne\|itemTwo `` | | `5%` | Percentage or pixel amount to move when the slider handle is focused and keyboard arrow is pressed.
| [`changePositionOnHover`](https://react-compare-slider.vercel.app/?path=/story/demos--change-position-on-hover) | `boolean` | | `false` | Whether the slider should follow the pointer on hover.
| [`disabled`](https://react-compare-slider.vercel.app/?path=/story/demos--disabled) | `boolean` | | `false` | Whether to disable slider movement (items are still interactable).
| [`handle`](https://react-compare-slider.vercel.app/?path=/story/demos--handle) | `ReactNode` | | `undefined` | Custom handle component.
Expand Down
4 changes: 2 additions & 2 deletions docs/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"typescript": "^5.3.3",
"vite": "^5.1.1"
"typescript": "^5.6.2",
"vite": "^5.4.5"
}
}
2 changes: 1 addition & 1 deletion docs/ssr-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test-legacy": "node --test"
},
"devDependencies": {
"@types/node": "^20.11.16",
"@types/node": "^22.5.5",
"react": "^18.2.0",
"react-compare-slider": "latest",
"react-dom": "^18.2.0",
Expand Down
16 changes: 0 additions & 16 deletions docs/storybook/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,4 @@
.sbdocs table:not(.docblock-argstable) td:last-of-type {
border-right: 0 !important;
}

/** @HACK Storybook adds a 100px height to this container for some reason.
* Using custom styles to workaround it...ish.
*/

.sbdocs-preview div[id^='story--'] {
display: flex;
}

.sbdocs-preview div[id^='story--'] > div {
height: 70vh !important;
max-height: 32rem;
max-width: 100%;
overflow: hidden;
flex-grow: 1;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slide
# Using `boundsPadding`

The `boundsPadding` prop allows you to limit the slideable area on the Y-axis
in `portrait` mode or on the X-axis in the default landscape mode. The default
`boundsPadding` value is `0`, negative values are treated the same as `0` and
the value **MUST** be supplied as a number in pixels.
in `portrait` mode or on the X-axis in the default landscape mode. Negative values are treated the
same as `0` and the value **MUST** be supplied as a number in pixels.

Bounds padding is useful when the slider has other components overlaying it - e.g. in a full
width/height carousel with previous and next buttons which you don't want the slider
handle to going behind.
Bounds padding is useful when the slider has other components overlaying it. E.g. in a full
width or height carousel with overlaying navigation buttons.

In the example below, bounds padding prevents the slider handle from going
within range of pixels of the left or right of the slider specified by the `boundsPadding` prop. The bounds are automatically
applied to the top/bottom or right/left depending on the orientation of the slider.
within range of pixels of the left or right of the slider specified by the `boundsPadding` prop.
The bounds are automatically applied to the top/bottom or right/left depending on the orientation of the slider.

```JSX
boundsPadding={80}
Expand Down
25 changes: 25 additions & 0 deletions docs/storybook/content/03-clip.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ArgTypes, Canvas, Meta, Story } from '@storybook/blocks';

import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slider';

<Meta title="Docs/Clip" component={ReactCompareSlider} />

# Using `clip`

The `clip` prop allows you to control whether `itemOne`, `itemTwo`, or both items are clipped to
the bounds of the slider.

This is useful in cases where you have transparent items and want to control which item takes
precedence when the slider is moved.

<Canvas>
<Story id="demos--images" />
</Canvas>

<ArgTypes of={ReactCompareSlider} />

<br />

## Live Examples

Checkout the [Images example](/story/demos--images).
22 changes: 22 additions & 0 deletions docs/storybook/content/04-disabled.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ArgTypes, Canvas, Meta, Story } from '@storybook/blocks';

import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slider';

<Meta title="Docs/Disabled" component={ReactCompareSlider} />

# Using `disabled`

The `disabled` prop prevents the slider from being interacted with by the user and also applies
the appropriate accessibility attributes to the slider controls.

<Canvas>
<Story id="demos--disabled" />
</Canvas>

<ArgTypes of={ReactCompareSlider} />

<br />

## Live Examples

Checkout the [Disabled example](/story/demos--disabled).
10 changes: 5 additions & 5 deletions docs/storybook/content/99-real-world-examples.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { Meta } from '@storybook/blocks';
The library is used by many companies and over 1000 open source projects, below are some examples of
how it's being used in the wild.

- [Upscayl, Free and Open Source AI Image Upscaler](https://github.com/upscayl/upscayl#free-and-open-source-ai-image-upscaler)
- [Official GOV.UK Coronavirus Dashboard](https://coronavirus.data.gov.uk/details/interactive-map/vaccinations#vaccinations-map-container)
- [Counter-Strike 2 Website](https://www.counter-strike.net/cs2#Maps)
- [Dota 2 Summer Client Update](https://www.dota2.com/summer2023)
- [upscaler.party: Image upscaler and comparator](https://upscaler.party/)
- [removerized: Free AI-Powered Background Remover Tool](https://removerized.tech/)
- [VideoGigaGAN: Detail-rich Video Super-Resolution](https://videogigagan.com/)
- [Upscayl: Free and Open Source AI Image Upscaler](https://github.com/upscayl/upscayl#free-and-open-source-ai-image-upscaler)
- [Counter-Strike 2 Website](https://www.counter-strike.net/cs2#Maps) and [Dota 2 Summer Client Update](https://www.dota2.com/summer2023)
- [RoomGPT](https://github.com/Nutlope/roomGPT)
- [RestorePhotos.io](https://github.com/Nutlope/restorePhotos)
Loading
Loading