Skip to content

Commit

Permalink
chore(release): update monorepo packages versions (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Apr 15, 2021
1 parent d0b45de commit 4a76172
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 125 deletions.
17 changes: 0 additions & 17 deletions .changeset/gentle-mails-tap.md

This file was deleted.

53 changes: 0 additions & 53 deletions .changeset/ninety-trains-hope.md

This file was deleted.

54 changes: 0 additions & 54 deletions .changeset/olive-news-know.md

This file was deleted.

119 changes: 119 additions & 0 deletions packages/leva/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,124 @@
# leva

## 0.9.5

### Patch Changes

- 234cfcd: Add `onEditStart` and `onEditEnd` callbacks for values.

```tsx
useControls({
value: {
value: 1,
onEditStart: (value, path) => {},
onEditEnd: (value, path) => {},
},
})
```

Add `path` as a second parameter to `onChange` callback to mimic `onEditXXX` signature.

- a2db0e6: Improve `buttonGroup` API.

The label is now completely hidden when specifying key that only includes spaces. Previously the label was still rendered, but without text, this caused ugly spacing when using the `oneLineLabels` option on the `Leva` component.

```ts
const [values, set] = useControls(() => ({
Size: 1,
' ': buttonGroup({
'0.25x': () => set({ Size: 0.25 }),
'0.5x': () => set({ Size: 0.5 }),
'1x': () => set({ Size: 1 }),
'2x': () => set({ Size: 2 }),
'3x': () => set({ Size: 3 }),
}),
}))
```

It is now possible to set the `label` via the `buttonGroup` arguments by using the alternative API:

```ts
const [values, set] = useControls(() => ({
Width: 1,
WidthPresets: buttonGroup({
label: null,
opts: {
'0.25x': () => set({ Size: 0.25 }),
'0.5x': () => set({ Size: 0.5 }),
'1x': () => set({ Size: 1 }),
'2x': () => set({ Size: 2 }),
'3x': () => set({ Size: 3 }),
},
}),
Height: 1,
HeightPresets: buttonGroup({
label: null,
opts: {
'0.25x': () => set({ Size: 0.25 }),
'0.5x': () => set({ Size: 0.5 }),
'1x': () => set({ Size: 1 }),
'2x': () => set({ Size: 2 }),
'3x': () => set({ Size: 3 }),
},
}),
}))
```

This also allows passing any JSX element as the label beside strings.

It also helps avoiding a bunch of `` labels (where each new one contains one more space).

- d0b45de: Add `context` argument to `onChange` handler.

The `context.initial` boolean parameter can be used to identify whether `onChange` is invoked initially.

```tsx
useControls({
value: {
value: 1,
onChange: (value, { initial }) => {
syncValue(value)
if (!initial) {
saveValueOnRemote(value)
}
},
},
})
```

The `context.fromPanel` boolean parameter can be used to identify whether the `onChange` invocation is caused by the `Leva` component or via the `set` function return from the `useControl` hook.

```tsx
const [, set] = useControls(() => ({
value: {
value: 1,
onChange: (value, { initial, fromPanel }) => {
syncValue(value)
if (!initial && !fromPanel) {
// we don't wanna trigger a remote save in case the value has not been updated from the panel
saveValueOnRemote(value)
}
},
},
}))
```

The `context.get` parameter can be used for retrieving the up to date state of the store. This is handy if you need to do some invocations based on all the store values.

```tsx
const [, set] = useControls(() => ({
value1: 1,
value2: 2,
value3: {
value: 1,
onChange: (value3, { get }) => {
const { value1, value2 } = get()
// calculate something based on value1 and value2
},
},
}))
```

## 0.9.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/leva/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leva",
"version": "0.9.4",
"version": "0.9.5",
"main": "dist/leva.cjs.js",
"module": "dist/leva.esm.js",
"types": "dist/leva.cjs.d.ts",
Expand Down

1 comment on commit 4a76172

@vercel
Copy link

@vercel vercel bot commented on 4a76172 Apr 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.