|
1 | 1 | import * as stylex from '@stylexjs/stylex'; |
2 | 2 |
|
3 | | -import { durationVars, easingVars, space } from '../../tokens.stylex'; |
| 3 | +import { colorVars, durationVars, easingVars, radiusVars, shadowVars, space } from '../../tokens.stylex'; |
4 | 4 | import { avatarUploadDropzoneScope } from './avatar-upload.markers.stylex'; |
5 | 5 |
|
| 6 | +const SCRIM = 'color-mix(in oklab, oklch(0 0 0) 55%, transparent)'; |
| 7 | +const RING = 'oklch(1 0 0 / 0.85)'; |
| 8 | +const THUMB = '16px'; |
| 9 | +const TRACK = '4px'; |
| 10 | + |
6 | 11 | export const styles = stylex.create({ |
7 | 12 | dropzone: { |
8 | 13 | alignItems: 'center', |
@@ -45,4 +50,105 @@ export const styles = stylex.create({ |
45 | 50 | [stylex.when.ancestor('[data-drag-rejected]', avatarUploadDropzoneScope)]: 'inline-block', |
46 | 51 | }, |
47 | 52 | }, |
| 53 | + cropContent: { |
| 54 | + display: 'flex', |
| 55 | + flexDirection: 'column', |
| 56 | + rowGap: space['4'], |
| 57 | + }, |
| 58 | + stage: { |
| 59 | + position: 'relative', |
| 60 | + }, |
| 61 | + frame: { |
| 62 | + borderRadius: radiusVars['--cl-radius-lg'], |
| 63 | + overflow: 'hidden', |
| 64 | + aspectRatio: '1', |
| 65 | + backgroundColor: colorVars['--cl-color-surface-subtle'], |
| 66 | + cursor: { |
| 67 | + default: 'grab', |
| 68 | + ':where([data-disabled])': 'default', |
| 69 | + ':where([data-dragging])': 'grabbing', |
| 70 | + }, |
| 71 | + position: 'relative', |
| 72 | + userSelect: 'none', |
| 73 | + width: '100%', |
| 74 | + }, |
| 75 | + area: { |
| 76 | + inset: '7%', |
| 77 | + position: 'absolute', |
| 78 | + }, |
| 79 | + mask: { |
| 80 | + inset: 0, |
| 81 | + boxShadow: `0 0 0 100vmax ${SCRIM}, inset 0 0 0 2px ${RING}`, |
| 82 | + pointerEvents: 'none', |
| 83 | + position: 'absolute', |
| 84 | + }, |
| 85 | + circleMask: { |
| 86 | + borderRadius: '50%', |
| 87 | + }, |
| 88 | + rotate: { |
| 89 | + insetBlockStart: space['2'], |
| 90 | + insetInlineEnd: space['2'], |
| 91 | + position: 'absolute', |
| 92 | + }, |
| 93 | + clockwise: { |
| 94 | + transform: 'scaleX(-1)', |
| 95 | + }, |
| 96 | + zoomRow: { |
| 97 | + alignItems: 'center', |
| 98 | + columnGap: space['2'], |
| 99 | + display: 'flex', |
| 100 | + }, |
| 101 | + zoom: { |
| 102 | + margin: 0, |
| 103 | + borderRadius: radiusVars['--cl-radius-full'], |
| 104 | + appearance: 'none', |
| 105 | + backgroundColor: 'transparent', |
| 106 | + cursor: { |
| 107 | + default: 'pointer', |
| 108 | + ':disabled': 'default', |
| 109 | + }, |
| 110 | + flexGrow: 1, |
| 111 | + opacity: { |
| 112 | + default: 1, |
| 113 | + ':disabled': 0.5, |
| 114 | + }, |
| 115 | + height: THUMB, |
| 116 | + minWidth: 0, |
| 117 | + '::-moz-range-thumb': { |
| 118 | + borderColor: colorVars['--cl-color-border'], |
| 119 | + borderRadius: radiusVars['--cl-radius-full'], |
| 120 | + borderStyle: 'solid', |
| 121 | + borderWidth: '1px', |
| 122 | + backgroundColor: 'oklch(1 0 0)', |
| 123 | + boxShadow: shadowVars['--cl-shadow-sm'], |
| 124 | + height: THUMB, |
| 125 | + width: THUMB, |
| 126 | + }, |
| 127 | + '::-moz-range-track': { |
| 128 | + borderRadius: radiusVars['--cl-radius-full'], |
| 129 | + backgroundColor: colorVars['--cl-color-neutral-alpha-300'], |
| 130 | + height: TRACK, |
| 131 | + }, |
| 132 | + '::-webkit-slider-runnable-track': { |
| 133 | + borderRadius: radiusVars['--cl-radius-full'], |
| 134 | + backgroundColor: colorVars['--cl-color-neutral-alpha-300'], |
| 135 | + height: TRACK, |
| 136 | + }, |
| 137 | + '::-webkit-slider-thumb': { |
| 138 | + borderColor: colorVars['--cl-color-border'], |
| 139 | + borderRadius: radiusVars['--cl-radius-full'], |
| 140 | + borderStyle: 'solid', |
| 141 | + borderWidth: '1px', |
| 142 | + appearance: 'none', |
| 143 | + backgroundColor: 'oklch(1 0 0)', |
| 144 | + boxShadow: shadowVars['--cl-shadow-sm'], |
| 145 | + height: THUMB, |
| 146 | + marginTop: `calc((${TRACK} - ${THUMB}) / 2)`, |
| 147 | + width: THUMB, |
| 148 | + }, |
| 149 | + }, |
| 150 | + footerActions: { |
| 151 | + columnGap: space['2'], |
| 152 | + display: 'flex', |
| 153 | + }, |
48 | 154 | }); |
0 commit comments