Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit 620f9a5

Browse files
committed
Merge branch 'alpha' of https://github.com/supabase/ui into alpha
2 parents 9072715 + 7c69701 commit 620f9a5

File tree

5 files changed

+50
-11
lines changed

5 files changed

+50
-11
lines changed

development.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@ make sure you are in the supabase-ui folder
99
cd supabase-ui
1010
```
1111

12+
install dependencies
13+
14+
> :warning: **This project currently won't work using the latest node version. Internally we are using node 17.**
15+
16+
```cli
17+
npm install
18+
```
19+
1220
run storybook
1321

1422
```cli
1523
npm run storybook
1624
```
1725

18-
(you may need to run `npm install` first)
19-
2026
Storybook runs by default on `http://localhost:6006/`
2127

2228
## Local Development

src/components/Listbox/Listbox2.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,11 @@ function Listbox({
271271

272272
interface OptionProps {
273273
id?: string
274-
className?: string
275274
value: any
276-
children?: React.ReactNode
277275
label: string
278-
addOnBefore?: ({ active, selected }: any) => React.ReactNode
279276
disabled?: boolean
277+
children?: React.ReactNode
278+
addOnBefore?: ({ active, selected }: any) => React.ReactNode
280279
}
281280

282281
type addOnBefore = {
@@ -286,12 +285,11 @@ type addOnBefore = {
286285

287286
function SelectOption({
288287
id,
289-
className,
290288
value,
291-
children,
292289
label,
293-
addOnBefore,
294290
disabled = false,
291+
children,
292+
addOnBefore,
295293
}: OptionProps) {
296294
const __styles = styleHandler('listbox')
297295

@@ -308,7 +306,7 @@ function SelectOption({
308306
active ? __styles.option_active : ' ',
309307
disabled ? __styles.option_disabled : ' '
310308
)}
311-
onSelect={() => onChange(value)}
309+
onSelect={() => (!disabled ? onChange(value) : {})}
312310
>
313311
<div className={__styles.option_inner}>
314312
{addOnBefore && addOnBefore({ active, selected })}

src/components/Listbox/SelectStyled.stories.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ export const Default = (args: any) => (
3737
</Listbox>
3838
)
3939

40+
export const WithDisabled = (args: any) => (
41+
<Listbox label="Default listbox">
42+
<Listbox.Option label="Option 1" value="option-1">
43+
Option 1
44+
</Listbox.Option>
45+
<Listbox.Option label="Option 2" value="option-2">
46+
Option 2
47+
</Listbox.Option>
48+
<Listbox.Option disabled label="Option 3" value="option-3">
49+
Option 3
50+
</Listbox.Option>
51+
</Listbox>
52+
)
53+
4054
const people = [
4155
{
4256
value: 1,

src/lib/theme/defaultTheme.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ export default {
388388
size: {
389389
...default__padding_and_text,
390390
},
391-
scrollable: `overflow-auto whitespace-nowrap`,
392-
content: `focus:outline-none focus:ring`,
391+
scrollable: `overflow-auto whitespace-nowrap no-scrollbar mask-fadeout-right`,
392+
content: `focus:outline-none focus:ring text-scale-900`,
393393
},
394394

395395
/*

ui.config.js

+21
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,27 @@ const uiConfig = {
300300
border: '1px solid hsla(0, 0%, 39.2%, 0.2)',
301301
borderRadius: '3px',
302302
},
303+
'.no-scrollbar': {
304+
/* Hide scrollbar for IE, Edge*/
305+
'-ms-overflow-style': 'none',
306+
307+
/* Firefox */
308+
'scrollbar-width': 'none', /* Firefox */
309+
310+
/* Hide scrollbar for Chrome, Safari and Opera */
311+
'&::-webkit-scrollbar': {
312+
display: 'none'
313+
}
314+
},
315+
/* Add fadeout effect */
316+
'.mask-fadeout-right': {
317+
'-webkit-mask-image': 'linear-gradient(to right, white 98%, transparent 100%)',
318+
'mask-image': 'linear-gradient(to right, white 98%, transparent 100%)',
319+
},
320+
'.mask-fadeout-left': {
321+
'-webkit-mask-image': 'linear-gradient(to left, white 98%, transparent 100%)',
322+
'mask-image': 'linear-gradient(to left, white 98%, transparent 100%)',
323+
},
303324
})
304325
addVariant('data-open-parent', '[data-state="open"] &')
305326
addVariant('data-closed-parent', '[data-state="closed"] &')

0 commit comments

Comments
 (0)