Skip to content

Commit e5884d4

Browse files
authored
feat(Item): show actions on hover (#880)
1 parent df91f10 commit e5884d4

Some content is hidden

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

43 files changed

+845
-184
lines changed

.changeset/bright-rabbits-walk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Allow text wrapping in labels.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix FilterPicker `renderSummary` to be evaluated regardless of selection state. The custom summary renderer and `renderSummary={false}` now work correctly even when no items are selected, providing consistent control over trigger content display.
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@cube-dev/ui-kit": minor
3+
---
4+
5+
Add `showActionsOnHover` prop to Item component. When enabled, actions are hidden by default and revealed smoothly on hover, focus, or focus-within states using opacity transitions. This provides a cleaner interface while keeping actions easily accessible without content shifting.
6+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Add `Text.Placeholder` variant with disabled opacity styling. This new text variant is useful for displaying placeholder content with reduced visual emphasis.
6+
7+

.cursor/rules/documentation.mdc

Lines changed: 45 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
---
2-
description: When updating the component documentation file *.docs.mdx
2+
description: When creating or updating the component documentation file *.docs.mdx
33
alwaysApply: false
44
---
55
# Component Documentation Guidelines
66

7-
This guide outlines the standards and structure for documenting components in the Cube UI Kit. Following these guidelines ensures consistency, clarity, and comprehensive coverage of component features.
8-
9-
## Overview
10-
11-
Our component documentation serves multiple purposes:
12-
- Provides clear usage instructions for developers
13-
- Ensures accessibility best practices are communicated
14-
- Documents styling capabilities through the `tasty` style system
15-
- Maintains consistency across all component documentation
16-
177
## Key Principles
188

19-
1. **Accessibility First**: Components use React Aria Hooks and documentation should emphasize accessibility features
20-
2. **Style System Integration**: Document `tasty` styling capabilities thoroughly
21-
3. **Practical Examples**: Include real-world usage examples, not just API references
22-
4. **Clear Structure**: Follow the prescribed documentation structure for consistency
9+
1. **Accessibility First**: Document React Aria features and keyboard/screen reader support
10+
2. **Style System**: Document `tasty` styling capabilities (sub-elements, modifiers, style props)
11+
3. **Code Examples Required**: **CRITICAL - Stories alone are NOT code examples. Always include actual JSX code snippets showing usage.**
12+
4. **Clear Structure**: Follow the prescribed structure below
2313

2414
## Documentation Structure
2515

26-
Every component documentation file should follow this structure:
27-
2816
```mdx
2917
import { Meta, Canvas, Story, Controls } from '@storybook/addon-docs/blocks';
3018
import { ComponentName } from './ComponentName';
@@ -104,6 +92,8 @@ The `mods` property accepts the following modifiers you can override:
10492

10593
## Examples
10694

95+
**IMPORTANT: Stories are for interactive demos. You MUST also provide JSX code snippets in this section.**
96+
10797
### Basic Usage
10898

10999
```jsx
@@ -112,6 +102,8 @@ The `mods` property accepts the following modifiers you can override:
112102

113103
### [Additional Examples as needed]
114104

105+
**Each example must show actual code, not just reference a story.**
106+
115107
## Accessibility
116108

117109
### Keyboard Navigation
@@ -163,84 +155,55 @@ This component supports all [Field properties](/field-properties.md) when used w
163155
- [RelatedComponent2](/components/RelatedComponent2) - Complementary component
164156
```
165157

166-
## Specific Guidelines
167-
168-
### 1. Component Description
158+
## Guidelines
169159

170-
- Start with a clear, concise description of what the component is
171-
- Follow with scenarios where the component should be used
172-
- Avoid technical implementation details in the introduction
173-
174-
### 2. Properties Documentation
175-
176-
#### Base Properties
177-
- If the component uses `filterBaseProps`, don't list base properties individually
178-
- Instead, include the link: `Supports [Base properties](/base-properties.md)`
179-
- Exception: Always document the `qa` property if it has special behavior
180-
181-
#### Styling Properties
182-
- Document each `styles` or `*Styles` property separately
183-
- For each styling property, list all available tasty sub-elements with descriptions. Count only those sub-elements that are mentioned in tasty styles in the root element inside component and can be overrided by passing an object with a specific key (sub-element name) to `styles` property
184-
- Format: `ElementName` - Description of what this element represents
185-
186-
#### Style Properties
187-
- List all properties that can be used for direct styling (e.g., `width`, `height`, `padding`)
188-
- These are properties that map to `tasty` styles without using the `styles` prop
189-
- Use `src/tasty/styles/list.ts` file to understand how it works.
160+
### Properties
190161

191-
#### React Aria Properties
192-
- Document all React Aria properties with clear descriptions
193-
- It's acceptable to rewrite React Aria descriptions for clarity
194-
- Focus on practical usage rather than technical implementation
162+
- **Props List**: Use `<Controls of={componentStories.Default} />` - DO NOT manually list props if Controls is used
163+
- **Base Properties**: Link to `/base-properties.md` instead of listing (unless `qa` has special behavior)
164+
- **Styling Properties**: Document `styles`/`*Styles` props. List sub-elements that can be overridden (check component's tasty styles)
165+
- **Style Properties**: List direct styling props (`width`, `height`, etc.) - see `src/tasty/styles/list.ts`
166+
- **React Aria Properties**: Only document if adding clarifications beyond what Controls shows
195167

196-
### 3. Examples
168+
### Examples
197169

198-
- Provide practical, real-world examples written in `jsx` code
199-
- Avoid styling examples unless it demonstrates essential capabilities
200-
- Each example should have a clear purpose and title
201-
- Do not use Storybook's Canvas and Story components for interactive examples
202-
- Each story should describe a usage case
203-
- The more sophisticated component, the more stories we need to cover all cases
170+
- **CRITICAL**: Must include JSX code snippets, not just story references
171+
- Provide real-world examples with clear purpose
172+
- Avoid pure styling examples unless demonstrating essential capabilities
173+
- More sophisticated components need more examples to cover all cases
204174

205-
### 4. Modifiers
175+
### Modifiers
206176

207-
- Document all available modifiers that can be passed via the `mods` property
208-
- Explain how each modifier affects the component's appearance or behavior
209-
- Include any modifier combinations that have special behavior
177+
- Document all `mods` property values
178+
- Explain effects on appearance/behavior
179+
- Note special modifier combinations
210180

211-
### 5. Accessibility Section
181+
### Accessibility
212182

213-
- Include keyboard navigation patterns
214-
- Document screen reader behavior
215-
- List relevant ARIA properties and their usage
216-
- Provide guidance on ensuring accessible implementations
183+
- Keyboard navigation patterns
184+
- Screen reader behavior
185+
- Relevant ARIA properties
186+
- Accessible implementation guidance
217187

218-
### 6. Form Integration
188+
### Form Integration
219189

220-
For input components (TextInput, Select, DatePicker, etc.):
221-
- Don't duplicate field property documentation
222-
- Include: "This component supports all [Field properties](/field-properties.md) when used within a Form."
190+
For input components: "This component supports all [Field properties](/field-properties.md) when used within a Form."
223191

224-
### 7. File Naming and Location
192+
### File Naming
225193

226-
- Documentation files use `.docs.mdx` extension
227-
- Place in the same directory as the component
228-
- Naming convention: `ComponentName.tsx` → `ComponentName.docs.mdx`
194+
`ComponentName.tsx` → `ComponentName.docs.mdx` in same directory
229195

230196
## Review Checklist
231197

232-
Before submitting component documentation, ensure:
233-
234-
- [ ] Follows the prescribed structure
235-
- [ ] Includes practical examples with Storybook Stories
236-
- [ ] Documents all styling properties and sub-elements
237-
- [ ] Lists all modifiers with descriptions
238-
- [ ] Includes accessibility information
239-
- [ ] Contains best practices section
240-
- [ ] Has "Suggested Improvements" section
241-
- [ ] Uses correct file naming and location
242-
- [ ] All links use provided placeholder format
243-
- [ ] Style properties are documented separately from styling properties
244-
- [ ] Form integration mentioned for input components
198+
- [ ] **JSX code snippets provided (not just stories)**
199+
- [ ] **No manual props list if using `<Controls />`**
200+
- [ ] Follows prescribed structure
201+
- [ ] Styling properties and sub-elements documented
202+
- [ ] Modifiers listed with descriptions
203+
- [ ] Accessibility section complete
204+
- [ ] Best practices included
205+
- [ ] Suggested improvements section
206+
- [ ] Style props vs styling props separated
207+
- [ ] Form integration noted (input components)
245208
- [ ] Base properties linked, not listed (except `qa`)
246-
- [ ] Tabler (`@tabler/icons-react`) or UI Kit icons are used in examples
209+
- [ ] Icons from `@tabler/icons-react` or `/src/icons`

.cursor/rules/storybook.mdc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
description: When updating storybook files and documentatino files *.stories.tsx, *.docs.mdx
2+
description: When creating or updating storybook files and documentatino files *.stories.tsx, *.docs.mdx
33
alwaysApply: false
44
---
55
## Imports
66

77
### Stories Files (.stories.tsx)
88
- Import types: `import type { Meta, StoryObj } from '@storybook/react-vite';`
99
- Import `StoryFn` for custom template functions
10-
- For interactive tests: `import { userEvent, within } from 'storybook/test';` (NOT from `@testing-library/react`)
10+
- For interactive tests: `import { userEvent, within } from '@storybook/test';` (NOT from `@testing-library/react`)
1111

1212
### Documentation Files (.docs.mdx)
1313
- `import { Meta, Canvas, Story, Controls } from '@storybook/addon-docs/blocks';`
@@ -103,7 +103,7 @@ export const Interactive: StoryObj = {
103103
};
104104
```
105105

106-
**Important:** Always import `userEvent` and `within` from `'storybook/test'` in story files. This ensures they respect Storybook's configuration (e.g., `testIdAttribute: 'data-qa'` set in `.storybook/preview.jsx`). Do NOT use `@testing-library/react` imports in stories.
106+
**Important:** Always import `userEvent` and `within` from `'@storybook/test'` in story files. This ensures they respect Storybook's configuration (e.g., `testIdAttribute: 'data-qa'` set in `.storybook/preview.jsx`). Do NOT use `@testing-library/react` imports in stories.
107107

108108
## MDX Documentation Structure
109109

.storybook/preview.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { configure } from '@storybook/test';
12
import isChromatic from 'chromatic/isChromatic';
23
import { config } from 'react-transition-group';
3-
import { configure } from 'storybook/test';
44

55
import { Root } from '../src';
66

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"@react-stately/utils": "^3.10.8",
7676
"@react-types/shared": "^3.31.0",
7777
"@sparticuz/chromium": "^137.0.1",
78+
"@storybook/test": "^8.6.14",
7879
"@tabler/icons-react": "^3.31.0",
7980
"@tanstack/react-virtual": "^3.13.12",
8081
"@trivago/prettier-plugin-sort-imports": "^5.2.2",

0 commit comments

Comments
 (0)