Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/orange-hounds-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": minor
---

Add useEventBus hook to emit global events and subscribe to them.
5 changes: 5 additions & 0 deletions .changeset/silver-crabs-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": minor
---

Add useContextMenu hook to invoke a context menu in the exact place of the click.
5 changes: 5 additions & 0 deletions .changeset/thin-years-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": minor
---

Add useAnchoredMenu hook to programmatically invoke a menu anchored to the specific element.
2 changes: 1 addition & 1 deletion .size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = [
}),
);
},
limit: '268kB',
limit: '270kB',
},
{
name: 'Tree shaking (just a Button)',
Expand Down
3 changes: 0 additions & 3 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ const config = {
'node_modules/(?!(.pnpm/)?react-hotkeys-hook)',
],
setupFilesAfterEnv: ['./src/test/setup.ts'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
};

module.exports = config;
9 changes: 6 additions & 3 deletions src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '../tasty';
import { TOKENS } from '../tokens';
import { useViewportSize } from '../utils/react';
import { EventBusProvider } from '../utils/react/useEventBus';

import { GlobalStyles } from './GlobalStyles';
import { AlertDialogApiProvider } from './overlays/AlertDialog';
Expand Down Expand Up @@ -150,9 +151,11 @@ export function Root(allProps: CubeRootProps) {
/>
<ModalProvider>
<PortalProvider value={ref}>
<NotificationsProvider rootRef={ref}>
<AlertDialogApiProvider>{children}</AlertDialogApiProvider>
</NotificationsProvider>
<EventBusProvider>
<NotificationsProvider rootRef={ref}>
<AlertDialogApiProvider>{children}</AlertDialogApiProvider>
</NotificationsProvider>
</EventBusProvider>
</PortalProvider>
</ModalProvider>
</RootElement>
Expand Down
19 changes: 12 additions & 7 deletions src/components/actions/Button/Button.docs.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Canvas, Story, Controls } from '@storybook/blocks';
import { Meta, Story, Controls } from '@storybook/blocks';
import { Button } from './Button';
import * as ButtonStories from './Button.stories';

Expand All @@ -17,9 +17,9 @@ A versatile action component that triggers commands and navigates users.

## Component

<Canvas>
<Story of={ButtonStories.Default} />
</Canvas>
<Story of={ButtonStories.Default} />

---

## Properties

Expand Down Expand Up @@ -59,7 +59,7 @@ The `mods` prop accepts the following modifiers you can override:

## Variants

### Types
### Types. `type` prop

- `primary` – Emphasised call-to-action.
- `secondary` – Less emphasised, alternative action.
Expand All @@ -68,14 +68,14 @@ The `mods` prop accepts the following modifiers you can override:
- `clear` – Text-only variant without background and border.
- `link` – Styled as a textual link.

### Themes
### Themes. `theme` prop

- `default` – Brand purple colours.
- `danger` – Red palette for destructive actions.
- `success` – Green palette for positive actions.
- `special` – White palette for dark backgrounds.

### Sizes
### Sizes. `size` prop

- `small` – Compact height (4×).
- `medium` – Default height (5×).
Expand All @@ -100,9 +100,14 @@ import { IconPlus } from '@tabler/icons-react';
### Link Button

```jsx
<!-- Navigate to a new page using the router -->
<Button to="/pricing">Pricing</Button>
<!-- Use `!` prefix to open in a new tab -->
<Button to="!/pricing">Pricing</Button>
<!-- Use `@` prefix to navigate to a new page without using the router -->
<Button to="@/pricing">Pricing</Button>
<!-- Use `@` to reload the page -->
<Button to="@/pricing">Pricing</Button>
```

### Loading State
Expand Down
Loading
Loading