Skip to content

Commit 0eac043

Browse files
authored
feat: ScrollArea component (#3591)
* chore: implement scroll-area * chore: add slash command * chore: bump deps * feat(scroll-area): enhance scrollbar functionality and context management * fix: build * chore: update deps * chore: update style * chore: update examples * chore: document types
1 parent 8c59605 commit 0eac043

File tree

107 files changed

+2956
-579
lines changed

Some content is hidden

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

107 files changed

+2956
-579
lines changed

.claude/commands/zag.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: Implement a Zag.js component in Ark UI
3+
---
4+
5+
## Steps
6+
7+
- Make sure the component is installed
8+
- Install it for every framework if it’s not
9+
- Check the `[component]-types.d.ts` file to understand it’s api and anatomy
10+
- Implement the component similar to the `[framework]/components/avatar/src`
11+
- Styling a component happens in `.storybook/styles` (as CSS) so we can share across frameworks
12+
- No Tailwind
13+
- No style prop
14+
- Create an example folder and agree with me on the list of examples before working on it
15+
- After examples are created, create or update the stories file based on the framework
16+
- Repeat for all frameworks (please ask before moving on to the next framework)

.storybook/styles.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
@import url('./styles/qr-code.css');
2626
@import url('./styles/radio-group.css');
2727
@import url('./styles/segment-group.css');
28+
@import url('./styles/scroll-area.css');
2829
@import url('./styles/select.css');
2930
@import url('./styles/signature-pad.css');
3031
@import url('./styles/slider.css');
@@ -47,7 +48,10 @@ body {
4748
min-height: 100dvh;
4849
}
4950

50-
* {
51+
*,
52+
*::before,
53+
*::after {
54+
margin: 0;
5155
box-sizing: border-box;
5256
font-family:
5357
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',

.storybook/styles/listbox.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
}
1313

1414
[data-scope='listbox'][data-part='content'] {
15-
padding: 0px;
1615
list-style: none;
1716
width: 400px;
1817
margin: 0;
@@ -48,7 +47,6 @@
4847
justify-content: center;
4948
min-height: 40px;
5049
border: 1px solid #ccc;
51-
padding: 8px;
5250

5351
> * {
5452
flex: 0 0 auto;

.storybook/styles/radio-group.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363

6464
[data-scope='radio-group'][data-part='indicator'] {
6565
height: 4px;
66-
background-color: red;
6766
z-index: 1;
6867
border-radius: 0.25rem;
6968
box-shadow:

.storybook/styles/scroll-area.css

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[data-scope='scroll-area'][data-part='viewport'] {
2+
border-radius: 0.375rem;
3+
outline: 1px solid lightgray;
4+
outline-offset: -1px;
5+
6+
/* hide scrollbar */
7+
scrollbar-width: none;
8+
&::-webkit-scrollbar {
9+
display: none;
10+
}
11+
}
12+
13+
[data-scope='scroll-area'][data-part='content'] {
14+
display: flex;
15+
flex-direction: column;
16+
gap: 10px;
17+
padding-block: 0.75rem;
18+
padding-inline-start: 1rem;
19+
padding-inline-end: 1.5rem;
20+
}
21+
22+
[data-scope='scroll-area'][data-part='scrollbar'] {
23+
display: flex;
24+
background-color: lightgray;
25+
border-radius: 0.375rem;
26+
margin: 0.5rem;
27+
opacity: 0;
28+
transition: opacity 150ms 300ms;
29+
30+
&[data-hovering],
31+
&[data-scrolling] {
32+
opacity: 1;
33+
transition-duration: 75ms;
34+
transition-delay: 0ms;
35+
}
36+
37+
&::before {
38+
content: '';
39+
position: absolute;
40+
}
41+
42+
&[data-orientation='vertical'] {
43+
justify-content: center;
44+
width: 0.5rem;
45+
&::before {
46+
width: 1.25rem;
47+
height: 100%;
48+
}
49+
&:not([data-overflow-y]) {
50+
display: none;
51+
}
52+
}
53+
54+
&[data-orientation='horizontal'] {
55+
align-items: center;
56+
height: 0.5rem;
57+
&::before {
58+
width: 100%;
59+
height: 1.25rem;
60+
}
61+
&:not([data-overflow-x]) {
62+
display: none;
63+
}
64+
}
65+
}
66+
67+
[data-scope='scroll-area'][data-part='thumb'] {
68+
border-radius: inherit;
69+
background-color: gray;
70+
71+
&[data-orientation='vertical'] {
72+
width: 100%;
73+
}
74+
75+
&[data-orientation='horizontal'] {
76+
height: 100%;
77+
}
78+
}

0 commit comments

Comments
 (0)