11import {
2- Group ,
3- createListCollection ,
2+ Button ,
3+ ButtonGroup ,
44 Flex ,
5+ Group ,
6+ HStack ,
57 Heading ,
68 Input ,
9+ Stack ,
710 Text ,
11+ createListCollection ,
812 parseColor ,
9- HStack ,
10- Stack ,
11- Button ,
12- ButtonGroup ,
13+ ColorPicker ,
14+ Select ,
15+ Portal ,
1316} from "@chakra-ui/react" ;
1417import type { ComponentPropsWithoutRef , FormEvent } from "react" ;
1518import { useContext , useLayoutEffect , useState } from "react" ;
1619
17- import { Radio , RadioGroup } from "./ui/radio" ;
18- import {
19- SelectContent ,
20- SelectItem ,
21- SelectRoot ,
22- SelectTrigger ,
23- SelectValueText ,
24- } from "./ui/select" ;
25- import { Field } from "./ui/field" ;
26- import { Checkbox } from "./ui/checkbox" ;
27- import {
28- ColorPickerArea ,
29- ColorPickerContent ,
30- ColorPickerControl ,
31- ColorPickerEyeDropper ,
32- ColorPickerChannelSlider ,
33- ColorPickerInput ,
34- ColorPickerRoot ,
35- ColorPickerTrigger ,
36- } from "./ui/color-picker" ;
3720import { LuCheck as CheckIcon , LuX as CloseIcon } from "react-icons/lu" ;
21+ import { Checkbox } from "./ui/checkbox" ;
22+ import { Field } from "./ui/field" ;
23+ import { Radio , RadioGroup } from "./ui/radio" ;
3824
3925import type { Activity , NonClass } from "../lib/activity" ;
4026import { Timeslot } from "../lib/activity" ;
4127import type { Class , SectionLockOption , Sections } from "../lib/class" ;
4228import { LockOption } from "../lib/class" ;
43- import { WEEKDAY_STRINGS , TIMESLOT_STRINGS , Slot } from "../lib/dates" ;
29+ import { Slot , TIMESLOT_STRINGS , WEEKDAY_STRINGS } from "../lib/dates" ;
4430import { HydrantContext } from "../lib/hydrant" ;
4531
4632/**
@@ -219,24 +205,29 @@ function ActivityColor(props: { activity: Activity; onHide: () => void }) {
219205 return (
220206 < Flex gap = { 2 } >
221207 < Flex direction = "row" gap = { 2 } >
222- < ColorPickerRoot
208+ < ColorPicker . Root
223209 value = { color }
224210 onValueChange = { ( e ) => {
225211 setColor ( e . value ) ;
226212 } }
227213 >
228- < ColorPickerControl >
229- < ColorPickerInput autoFocus />
230- < ColorPickerTrigger />
231- </ ColorPickerControl >
232- < ColorPickerContent >
233- < ColorPickerArea />
234- < HStack >
235- < ColorPickerEyeDropper />
236- < ColorPickerChannelSlider channel = "hue" />
237- </ HStack >
238- </ ColorPickerContent >
239- </ ColorPickerRoot >
214+ < ColorPicker . HiddenInput />
215+ < ColorPicker . Control >
216+ < ColorPicker . Input autoFocus />
217+ < ColorPicker . Trigger />
218+ </ ColorPicker . Control >
219+ < Portal >
220+ < ColorPicker . Positioner >
221+ < ColorPicker . Content >
222+ < ColorPicker . Area />
223+ < HStack >
224+ < ColorPicker . EyeDropper />
225+ < ColorPicker . ChannelSlider channel = "hue" />
226+ </ HStack >
227+ </ ColorPicker . Content >
228+ </ ColorPicker . Positioner >
229+ </ Portal >
230+ </ ColorPicker . Root >
240231 < ButtonGroup >
241232 < Button onClick = { onReset } > Reset</ Button >
242233 < Button onClick = { onCancel } > Cancel</ Button >
@@ -347,7 +338,7 @@ function NonClassAddTime(props: { activity: NonClass }) {
347338 } ) ;
348339
349340 const renderTimeDropdown = ( key : "start" | "end" ) => (
350- < SelectRoot
341+ < Select . Root
351342 collection = { timesCollection }
352343 size = "sm"
353344 width = "8rem"
@@ -356,17 +347,28 @@ function NonClassAddTime(props: { activity: NonClass }) {
356347 setTimes ( { ...times , [ key ] : e . value [ 0 ] } ) ;
357348 } }
358349 >
359- < SelectTrigger >
360- < SelectValueText />
361- </ SelectTrigger >
362- < SelectContent >
363- { timesCollection . items . map ( ( time ) => (
364- < SelectItem item = { time } key = { time } >
365- { time }
366- </ SelectItem >
367- ) ) }
368- </ SelectContent >
369- </ SelectRoot >
350+ < Select . HiddenSelect />
351+ < Select . Control >
352+ < Select . Trigger >
353+ < Select . ValueText />
354+ </ Select . Trigger >
355+ < Select . IndicatorGroup >
356+ < Select . Indicator />
357+ </ Select . IndicatorGroup >
358+ </ Select . Control >
359+ < Portal >
360+ < Select . Positioner >
361+ < Select . Content >
362+ { timesCollection . items . map ( ( time ) => (
363+ < Select . Item item = { time } key = { time } >
364+ { time }
365+ < Select . ItemIndicator />
366+ </ Select . Item >
367+ ) ) }
368+ </ Select . Content >
369+ </ Select . Positioner >
370+ </ Portal >
371+ </ Select . Root >
370372 ) ;
371373
372374 return (
0 commit comments