(valueToken, label)
| 49 | } |
| 50 | |
| 51 | const renderChip = (valueToken, label) => { |
| 52 | const isSelected = selected.includes(valueToken) |
| 53 | const isLastDay = valueToken === LAST_DAY_TOKEN |
| 54 | const chip = ( |
| 55 | <Chip |
| 56 | key={valueToken} |
| 57 | label={label} |
| 58 | size='small' |
| 59 | disabled={disabled} |
| 60 | onClick={() => toggle(valueToken)} |
| 61 | sx={{ |
| 62 | cursor: disabled ? 'default' : 'pointer', |
| 63 | minWidth: 32, |
| 64 | gridColumn: isLastDay ? 'span 2' : 'span 1', |
| 65 | fontWeight: isSelected ? 600 : 400, |
| 66 | borderWidth: '1.5px', |
| 67 | borderStyle: 'solid', |
| 68 | borderColor: isSelected ? theme.palette.primary.main : theme.palette.grey[400], |
| 69 | backgroundColor: isSelected ? theme.palette.primary.main + '20' : 'transparent', |
| 70 | color: isSelected ? theme.palette.primary.main : theme.palette.text.primary, |
| 71 | '&:hover': disabled |
| 72 | ? {} |
| 73 | : { |
| 74 | backgroundColor: isSelected ? theme.palette.primary.main + '35' : theme.palette.grey[200] |
| 75 | } |
| 76 | }} |
| 77 | /> |
| 78 | ) |
| 79 | if (isLastDay) { |
| 80 | return ( |
| 81 | <Tooltip |
| 82 | key={valueToken} |
| 83 | title='Always runs on the last day of every month — automatically resolves to 28, 29, 30, or 31 (handles short months and leap years). Unlike picking 31, this fires every month.' |
| 84 | placement='top' |
| 85 | arrow |
| 86 | > |
| 87 | <span style={{ gridColumn: 'span 2', display: 'inline-flex' }}>{chip}</span> |
| 88 | </Tooltip> |
| 89 | ) |
| 90 | } |
| 91 | return chip |
| 92 | } |
| 93 | |
| 94 | return ( |
| 95 | <Box |
no test coverage detected